@sheinx/base 3.0.2 → 3.1.0-rc.2

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":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGAyHjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGA0HjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -60,13 +60,15 @@ var CascaderNode = function CascaderNode(props) {
60
60
  onPathChange === null || onPathChange === void 0 || onPathChange(id, data, path);
61
61
  };
62
62
  var handleClick = function handleClick(e) {
63
+ if (shouldFinal && hasChildren) {
64
+ handlePathChange();
65
+ return;
66
+ }
63
67
  if (onPathChange) onPathChange(id, data, path, true);
64
68
  if (!multiple) {
65
- // 单选设置了 final 属性后 如果不是末节点不触发onChange
66
- var shouldJump = shouldFinal && hasChildren;
67
- if (onChange && path && !shouldJump) onChange([].concat(_toConsumableArray(path), [id]), datum.getDataById(id));
69
+ if (onChange && path) onChange([].concat(_toConsumableArray(path), [id]), datum.getDataById(id));
68
70
  }
69
- if (loader && uncertainChildren && !loading && !_hooks.util.getParent(e.target, "[".concat(getDataAttributeName('role'), "=checkbox-indicator]"))) {
71
+ if (loader && !loading && !_hooks.util.getParent(e.target, "[".concat(getDataAttributeName('role'), "=checkbox-indicator]"))) {
70
72
  setLoading(true);
71
73
  loader(id, data);
72
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAkB1C,wBA2eE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAkB1C,wBAmeE"}
@@ -54,7 +54,6 @@ var _default = exports.default = function _default(props) {
54
54
  var scrollRef = (0, _react.useRef)(null);
55
55
  var tableRef = (0, _react.useRef)(null);
56
56
  var virtual = ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length) && props.rowsInView !== 0 && (!!props.virtual || props.fixed === 'both' || props.fixed === 'y' || props.fixed === 'auto');
57
- var height = virtual && !props.height ? '100%' : props.height;
58
57
  var _props$verticalAlign = props.verticalAlign,
59
58
  verticalAlign = _props$verticalAlign === void 0 ? 'top' : _props$verticalAlign,
60
59
  _props$size = props.size,
@@ -237,7 +236,7 @@ var _default = exports.default = function _default(props) {
237
236
  });
238
237
  };
239
238
  var renderTable = function renderTable() {
240
- var _props$summary, _props$data3, _sticky$top;
239
+ var _props$data3, _sticky$top;
241
240
  var Group = /*#__PURE__*/(0, _jsxRuntime.jsx)(_colgroup.default, {
242
241
  colgroup: colgroup,
243
242
  columns: columns,
@@ -289,7 +288,6 @@ var _default = exports.default = function _default(props) {
289
288
  treeColumnsName: treeColumnsName,
290
289
  treeCheckAll: props.treeCheckAll
291
290
  };
292
- var showFoot = (_props$summary = props.summary) === null || _props$summary === void 0 ? void 0 : _props$summary.length;
293
291
  var footCommonProps = {
294
292
  summary: props.summary,
295
293
  columns: columns,
@@ -334,7 +332,7 @@ var _default = exports.default = function _default(props) {
334
332
  fixRightNum: maxScrollLeft - virtualInfo.innerLeft
335
333
  }))]
336
334
  })
337
- }), showFoot ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
335
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
338
336
  className: footWrapperClass,
339
337
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
340
338
  style: {
@@ -347,7 +345,7 @@ var _default = exports.default = function _default(props) {
347
345
  fixRightNum: maxScrollLeft - virtualInfo.innerLeft
348
346
  }))]
349
347
  })
350
- }) : null]
348
+ })]
351
349
  });
352
350
  }
353
351
  if (!isScrollY && !props.sticky && (_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -359,7 +357,7 @@ var _default = exports.default = function _default(props) {
359
357
  width: width
360
358
  },
361
359
  ref: tbodyRef,
362
- children: [Group, !props.hideHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)(_thead.default, _objectSpread({}, headCommonProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tbody.default, _objectSpread({}, bodyCommonProps)), showFoot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_tfoot.default, _objectSpread({}, footCommonProps)) : null]
360
+ children: [Group, !props.hideHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)(_thead.default, _objectSpread({}, headCommonProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tbody.default, _objectSpread({}, bodyCommonProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tfoot.default, _objectSpread({}, footCommonProps))]
363
361
  })
364
362
  });
365
363
  var Wrapper = props.sticky ? _sticky.default : _react.default.Fragment;
@@ -399,7 +397,7 @@ var _default = exports.default = function _default(props) {
399
397
  ref: tbodyRef,
400
398
  children: [Group, /*#__PURE__*/(0, _jsxRuntime.jsx)(_tbody.default, _objectSpread({}, bodyCommonProps))]
401
399
  }), renderEmpty()]
402
- }), showFoot ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
400
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
403
401
  className: footWrapperClass,
404
402
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
405
403
  style: {
@@ -408,7 +406,7 @@ var _default = exports.default = function _default(props) {
408
406
  ref: tfootRef,
409
407
  children: [Group, /*#__PURE__*/(0, _jsxRuntime.jsx)(_tfoot.default, _objectSpread({}, footCommonProps))]
410
408
  })
411
- }) : null]
409
+ })]
412
410
  });
413
411
  };
414
412
  var renderLoading = function renderLoading() {
@@ -462,7 +460,7 @@ var _default = exports.default = function _default(props) {
462
460
  if (!props.columns || columns.length === 0) return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
463
461
  className: (0, _classnames.default)(tableWrapperClass, tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.simple, props.striped && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.striped)),
464
462
  style: _objectSpread({
465
- height: height
463
+ height: props.height || '100%'
466
464
  }, props.style),
467
465
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("table", {
468
466
  style: {
@@ -475,7 +473,7 @@ var _default = exports.default = function _default(props) {
475
473
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
476
474
  className: (0, _classnames.default)(tableWrapperClass, floatLeft && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatLeft), floatRight && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatRight), props.sticky && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sticky)),
477
475
  style: _objectSpread({
478
- height: height
476
+ height: props.height
479
477
  }, props.style)
480
478
  }, selection.getTableProps()), {}, {
481
479
  ref: tableRef,
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,QAAA,MAAM,UAAU,UAAW,eAAe,gBAuNzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,QAAA,MAAM,UAAU,UAAW,eAAe,gBAsNzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -55,8 +55,8 @@ var TabsHeader = function TabsHeader(props) {
55
55
  var _useTransform = (0, _hooks.useTransform)({
56
56
  autoScroll: true,
57
57
  direction: isVertical ? 'Y' : 'X',
58
- containerRef: headerRef,
59
- targetRef: scrollRef
58
+ container: headerRef.current,
59
+ target: scrollRef.current
60
60
  }),
61
61
  delta = _useTransform.delta,
62
62
  atStart = _useTransform.atStart,
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGAyHjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGA0HjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -54,13 +54,15 @@ var CascaderNode = function CascaderNode(props) {
54
54
  onPathChange === null || onPathChange === void 0 || onPathChange(id, data, path);
55
55
  };
56
56
  var handleClick = function handleClick(e) {
57
+ if (shouldFinal && hasChildren) {
58
+ handlePathChange();
59
+ return;
60
+ }
57
61
  if (onPathChange) onPathChange(id, data, path, true);
58
62
  if (!multiple) {
59
- // 单选设置了 final 属性后 如果不是末节点不触发onChange
60
- var shouldJump = shouldFinal && hasChildren;
61
- if (onChange && path && !shouldJump) onChange([].concat(_toConsumableArray(path), [id]), datum.getDataById(id));
63
+ if (onChange && path) onChange([].concat(_toConsumableArray(path), [id]), datum.getDataById(id));
62
64
  }
63
- if (loader && uncertainChildren && !loading && !util.getParent(e.target, "[".concat(getDataAttributeName('role'), "=checkbox-indicator]"))) {
65
+ if (loader && !loading && !util.getParent(e.target, "[".concat(getDataAttributeName('role'), "=checkbox-indicator]"))) {
64
66
  setLoading(true);
65
67
  loader(id, data);
66
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAkB1C,wBA2eE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAkB1C,wBAmeE"}
@@ -47,7 +47,6 @@ export default (function (props) {
47
47
  var scrollRef = useRef(null);
48
48
  var tableRef = useRef(null);
49
49
  var virtual = ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length) && props.rowsInView !== 0 && (!!props.virtual || props.fixed === 'both' || props.fixed === 'y' || props.fixed === 'auto');
50
- var height = virtual && !props.height ? '100%' : props.height;
51
50
  var _props$verticalAlign = props.verticalAlign,
52
51
  verticalAlign = _props$verticalAlign === void 0 ? 'top' : _props$verticalAlign,
53
52
  _props$size = props.size,
@@ -230,7 +229,7 @@ export default (function (props) {
230
229
  });
231
230
  };
232
231
  var renderTable = function renderTable() {
233
- var _props$summary, _props$data3, _sticky$top;
232
+ var _props$data3, _sticky$top;
234
233
  var Group = /*#__PURE__*/_jsx(Colgroup, {
235
234
  colgroup: colgroup,
236
235
  columns: columns,
@@ -282,7 +281,6 @@ export default (function (props) {
282
281
  treeColumnsName: treeColumnsName,
283
282
  treeCheckAll: props.treeCheckAll
284
283
  };
285
- var showFoot = (_props$summary = props.summary) === null || _props$summary === void 0 ? void 0 : _props$summary.length;
286
284
  var footCommonProps = {
287
285
  summary: props.summary,
288
286
  columns: columns,
@@ -327,7 +325,7 @@ export default (function (props) {
327
325
  fixRightNum: maxScrollLeft - virtualInfo.innerLeft
328
326
  }))]
329
327
  })
330
- }), showFoot ? /*#__PURE__*/_jsx("div", {
328
+ }), /*#__PURE__*/_jsx("div", {
331
329
  className: footWrapperClass,
332
330
  children: /*#__PURE__*/_jsxs("table", {
333
331
  style: {
@@ -340,7 +338,7 @@ export default (function (props) {
340
338
  fixRightNum: maxScrollLeft - virtualInfo.innerLeft
341
339
  }))]
342
340
  })
343
- }) : null]
341
+ })]
344
342
  });
345
343
  }
346
344
  if (!isScrollY && !props.sticky && (_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) return /*#__PURE__*/_jsx("div", {
@@ -352,7 +350,7 @@ export default (function (props) {
352
350
  width: width
353
351
  },
354
352
  ref: tbodyRef,
355
- children: [Group, !props.hideHeader && /*#__PURE__*/_jsx(Thead, _objectSpread({}, headCommonProps)), /*#__PURE__*/_jsx(Tbody, _objectSpread({}, bodyCommonProps)), showFoot ? /*#__PURE__*/_jsx(Tfoot, _objectSpread({}, footCommonProps)) : null]
353
+ children: [Group, !props.hideHeader && /*#__PURE__*/_jsx(Thead, _objectSpread({}, headCommonProps)), /*#__PURE__*/_jsx(Tbody, _objectSpread({}, bodyCommonProps)), /*#__PURE__*/_jsx(Tfoot, _objectSpread({}, footCommonProps))]
356
354
  })
357
355
  });
358
356
  var Wrapper = props.sticky ? Sticky : React.Fragment;
@@ -392,7 +390,7 @@ export default (function (props) {
392
390
  ref: tbodyRef,
393
391
  children: [Group, /*#__PURE__*/_jsx(Tbody, _objectSpread({}, bodyCommonProps))]
394
392
  }), renderEmpty()]
395
- }), showFoot ? /*#__PURE__*/_jsx("div", {
393
+ }), /*#__PURE__*/_jsx("div", {
396
394
  className: footWrapperClass,
397
395
  children: /*#__PURE__*/_jsxs("table", {
398
396
  style: {
@@ -401,7 +399,7 @@ export default (function (props) {
401
399
  ref: tfootRef,
402
400
  children: [Group, /*#__PURE__*/_jsx(Tfoot, _objectSpread({}, footCommonProps))]
403
401
  })
404
- }) : null]
402
+ })]
405
403
  });
406
404
  };
407
405
  var renderLoading = function renderLoading() {
@@ -455,7 +453,7 @@ export default (function (props) {
455
453
  if (!props.columns || columns.length === 0) return /*#__PURE__*/_jsx("div", {
456
454
  className: classNames(tableWrapperClass, tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.simple, props.striped && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.striped)),
457
455
  style: _objectSpread({
458
- height: height
456
+ height: props.height || '100%'
459
457
  }, props.style),
460
458
  children: /*#__PURE__*/_jsx("table", {
461
459
  style: {
@@ -468,7 +466,7 @@ export default (function (props) {
468
466
  children: [/*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
469
467
  className: classNames(tableWrapperClass, floatLeft && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatLeft), floatRight && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatRight), props.sticky && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sticky)),
470
468
  style: _objectSpread({
471
- height: height
469
+ height: props.height
472
470
  }, props.style)
473
471
  }, selection.getTableProps()), {}, {
474
472
  ref: tableRef,
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,QAAA,MAAM,UAAU,UAAW,eAAe,gBAuNzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,QAAA,MAAM,UAAU,UAAW,eAAe,gBAsNzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -49,8 +49,8 @@ var TabsHeader = function TabsHeader(props) {
49
49
  var _useTransform = useTransform({
50
50
  autoScroll: true,
51
51
  direction: isVertical ? 'Y' : 'X',
52
- containerRef: headerRef,
53
- targetRef: scrollRef
52
+ container: headerRef.current,
53
+ target: scrollRef.current
54
54
  }),
55
55
  delta = _useTransform.delta,
56
56
  atStart = _useTransform.atStart,
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.0.2",
3
+ "version": "3.1.0-rc.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
- "license": "MIT",
6
+ "license": "ISC",
7
7
  "author": "",
8
8
  "sideEffects": false,
9
9
  "main": "./cjs/index.js",
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.0.2",
13
+ "@sheinx/hooks": "3.1.0-rc.2",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.2"
@@ -18,10 +18,5 @@
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8",
20
20
  "core-js": ">=3"
21
- },
22
- "repository": {
23
- "type": "git",
24
- "url": "https://github.com/sheinsight/shineout-next"
25
- },
26
- "authors": ""
21
+ }
27
22
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023-Present SHEIN
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.