@arim-aisdc/public-components 2.3.64 → 2.3.65

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.
@@ -51,6 +51,9 @@ var SplitterPane = function SplitterPane(_ref) {
51
51
  setSizes(defaultCacheSizes);
52
52
  }, []);
53
53
  useUpdateLayoutEffect(function () {
54
+ console.log(options, options === null || options === void 0 ? void 0 : options.map(function (item) {
55
+ return item === null || item === void 0 ? void 0 : item.size;
56
+ }), '3333');
54
57
  setSizes(options === null || options === void 0 ? void 0 : options.map(function (item) {
55
58
  return item === null || item === void 0 ? void 0 : item.size;
56
59
  }));
@@ -58,6 +61,7 @@ var SplitterPane = function SplitterPane(_ref) {
58
61
  return item === null || item === void 0 ? void 0 : item.size;
59
62
  }))]);
60
63
  useDeepCompareEffect(function () {
64
+ console.log(sizes, JSON.stringify(sizes), '33331');
61
65
  localStorage.setItem(_cacheKeyKey, JSON.stringify(sizes));
62
66
  }, [sizes]);
63
67
 
@@ -106,9 +110,25 @@ var SplitterPane = function SplitterPane(_ref) {
106
110
  };
107
111
  }, [sizes]);
108
112
  var handlePaneResize = useCallback(function (newSizes) {
109
- setSizes(newSizes);
113
+ var _convertPixelsToPerce;
114
+ setSizes((_convertPixelsToPerce = convertPixelsToPercentages(newSizes)) !== null && _convertPixelsToPerce !== void 0 ? _convertPixelsToPerce : newSizes);
110
115
  onResize === null || onResize === void 0 || onResize(newSizes);
111
116
  }, [onResize]);
117
+
118
+ // 将像素值转换为百分比
119
+ var convertPixelsToPercentages = useCallback(function (pixelSizes) {
120
+ var isValidSizes = sizes.every(function (size) {
121
+ return typeof size === 'number' && size > 0;
122
+ });
123
+ if (!isValidSizes) return null;
124
+ var totalSize = pixelSizes.reduce(function (sum, size) {
125
+ return sum + size;
126
+ }, 0);
127
+ return pixelSizes.map(function (size) {
128
+ var percentage = size / totalSize * 100;
129
+ return "".concat(Math.round(percentage), "%");
130
+ });
131
+ }, []);
112
132
  return /*#__PURE__*/_jsx(Splitter, {
113
133
  layout: layout,
114
134
  onResize: handlePaneResize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.64",
3
+ "version": "2.3.65",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",