@sheinx/base 3.6.0 → 3.6.1-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":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,gIAyOjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -20,6 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
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); }
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
23
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
26
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -74,13 +75,34 @@ var TransferList = function TransferList(props) {
|
|
|
74
75
|
setAddonHeight = _useState2[1];
|
|
75
76
|
var listContainerRef = (0, _react.useRef)(null);
|
|
76
77
|
(0, _react.useLayoutEffect)(function () {
|
|
77
|
-
if (!listContainerRef.current) return;
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
if (!listContainerRef.current || !window.ResizeObserver) return;
|
|
79
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
80
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
81
|
+
_step;
|
|
82
|
+
try {
|
|
83
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
84
|
+
var entry = _step.value;
|
|
85
|
+
if (entry.target === listContainerRef.current) {
|
|
86
|
+
var $list = listContainerRef.current.querySelector(".".concat(styles.list));
|
|
87
|
+
var containerBottom = listContainerRef.current.getBoundingClientRect().bottom;
|
|
88
|
+
var listBottom = ($list === null || $list === void 0 ? void 0 : $list.getBoundingClientRect().bottom) || containerBottom;
|
|
89
|
+
if (containerBottom - listBottom > 1) {
|
|
90
|
+
setAddonHeight(containerBottom - listBottom - 1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch (err) {
|
|
95
|
+
_iterator.e(err);
|
|
96
|
+
} finally {
|
|
97
|
+
_iterator.f();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
resizeObserver.observe(listContainerRef.current);
|
|
101
|
+
return function () {
|
|
102
|
+
if (!listContainerRef.current) return;
|
|
103
|
+
resizeObserver.unobserve(listContainerRef.current);
|
|
104
|
+
resizeObserver.disconnect();
|
|
105
|
+
};
|
|
84
106
|
}, []);
|
|
85
107
|
var listHeight = listHeightProp + addonHeight;
|
|
86
108
|
var getLineHeight = function getLineHeight() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,gIAyOjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -68,13 +69,34 @@ var TransferList = function TransferList(props) {
|
|
|
68
69
|
setAddonHeight = _useState2[1];
|
|
69
70
|
var listContainerRef = useRef(null);
|
|
70
71
|
useLayoutEffect(function () {
|
|
71
|
-
if (!listContainerRef.current) return;
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
if (!listContainerRef.current || !window.ResizeObserver) return;
|
|
73
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
74
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
75
|
+
_step;
|
|
76
|
+
try {
|
|
77
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
78
|
+
var entry = _step.value;
|
|
79
|
+
if (entry.target === listContainerRef.current) {
|
|
80
|
+
var $list = listContainerRef.current.querySelector(".".concat(styles.list));
|
|
81
|
+
var containerBottom = listContainerRef.current.getBoundingClientRect().bottom;
|
|
82
|
+
var listBottom = ($list === null || $list === void 0 ? void 0 : $list.getBoundingClientRect().bottom) || containerBottom;
|
|
83
|
+
if (containerBottom - listBottom > 1) {
|
|
84
|
+
setAddonHeight(containerBottom - listBottom - 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
_iterator.e(err);
|
|
90
|
+
} finally {
|
|
91
|
+
_iterator.f();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
resizeObserver.observe(listContainerRef.current);
|
|
95
|
+
return function () {
|
|
96
|
+
if (!listContainerRef.current) return;
|
|
97
|
+
resizeObserver.unobserve(listContainerRef.current);
|
|
98
|
+
resizeObserver.disconnect();
|
|
99
|
+
};
|
|
78
100
|
}, []);
|
|
79
101
|
var listHeight = listHeightProp + addonHeight;
|
|
80
102
|
var getLineHeight = function getLineHeight() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1-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.6.
|
|
13
|
+
"@sheinx/hooks": "3.6.1-beta.1",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|