@sheinx/base 3.8.10-beta.1 → 3.8.10-beta.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,4 +1,6 @@
1
+ import React from 'react';
1
2
  import { BaseListProps } from './select.type';
3
+ export declare const defaultRenderItem: <DataItem>(d: DataItem) => React.ReactNode;
2
4
  declare const List: <DataItem, Value>(props: BaseListProps<DataItem, Value>) => import("react/jsx-runtime").JSX.Element;
3
5
  export default List;
4
6
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,eAAO,MAAM,iBAAiB,4CAA8D,CAAC;AAC7F,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.defaultRenderItem = exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _hooks = require("@sheinx/hooks");
@@ -26,6 +26,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
  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; }
27
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
28
  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); }
29
+ var defaultRenderItem = exports.defaultRenderItem = function defaultRenderItem(d) {
30
+ return d;
31
+ };
29
32
  var List = function List(props) {
30
33
  var _jssStyle$select;
31
34
  var jssStyle = props.jssStyle,
@@ -45,9 +48,7 @@ var List = function List(props) {
45
48
  optionListRef = props.optionListRef,
46
49
  isAnimationFinish = props.isAnimationFinish,
47
50
  _props$renderItem = props.renderItem,
48
- renderItemProp = _props$renderItem === void 0 ? function (d) {
49
- return d;
50
- } : _props$renderItem,
51
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
51
52
  closePop = props.closePop,
52
53
  onControlTypeChange = props.onControlTypeChange,
53
54
  onOptionClick = props.onOptionClick;
@@ -188,7 +188,7 @@ var Result = function Result(props) {
188
188
  handleResultItemClick(e, item);
189
189
  };
190
190
  var content = renderResultContent(item, index, nodes);
191
- if (!content) return null;
191
+ if (!content && content !== 0) return null;
192
192
  if (renderResultContentProp) {
193
193
  // cascader 不渲染tag
194
194
  return renderResultContentProp(_objectSpread({
@@ -13,7 +13,7 @@ var _useInnerTitle = _interopRequireDefault(require("../common/use-inner-title")
13
13
  var _animationList = _interopRequireDefault(require("../animation-list"));
14
14
  var _spin = _interopRequireDefault(require("../spin"));
15
15
  var _result = _interopRequireDefault(require("./result"));
16
- var _list = _interopRequireDefault(require("./list"));
16
+ var _list = _interopRequireWildcard(require("./list"));
17
17
  var _listTree = _interopRequireDefault(require("./list-tree"));
18
18
  var _icons = _interopRequireDefault(require("../icons"));
19
19
  var _listColumns = _interopRequireDefault(require("./list-columns"));
@@ -101,9 +101,7 @@ function Select(props0) {
101
101
  autoAdapt = props.autoAdapt,
102
102
  groupBy = props.groupBy,
103
103
  _props$renderItem = props.renderItem,
104
- renderItemProp = _props$renderItem === void 0 ? function (d) {
105
- return d;
106
- } : _props$renderItem,
104
+ renderItemProp = _props$renderItem === void 0 ? _list.defaultRenderItem : _props$renderItem,
107
105
  renderResultProp = props.renderResult,
108
106
  renderUnmatched = props.renderUnmatched,
109
107
  resultClassName = props.resultClassName,
@@ -324,7 +322,8 @@ function Select(props0) {
324
322
  });
325
323
  var rootClass = (0, _classnames.default)(className, styles === null || styles === void 0 ? void 0 : styles.rootClass, styles === null || styles === void 0 ? void 0 : styles.wrapper, isEmpty && styles.wrapperEmpty, open && (styles === null || styles === void 0 ? void 0 : styles.wrapperOpen), open && trigger === 'hover' && (styles === null || styles === void 0 ? void 0 : styles.triggerHover), disabled === true && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), disabled !== true && focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), clearable && (styles === null || styles === void 0 ? void 0 : styles.clearable), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline), _defineProperty({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
326
324
  var getRenderItem = function getRenderItem(data, index) {
327
- return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
325
+ var _data$renderItemProp;
326
+ return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (_data$renderItemProp = data === null || data === void 0 ? void 0 : data[renderItemProp]) !== null && _data$renderItemProp !== void 0 ? _data$renderItemProp : '';
328
327
  };
329
328
  var renderItem = getRenderItem;
330
329
  var handleFocus = (0, _hooks.usePersistFn)(function (e) {
@@ -1,4 +1,6 @@
1
+ import React from 'react';
1
2
  import { BaseListProps } from './select.type';
3
+ export declare const defaultRenderItem: <DataItem>(d: DataItem) => React.ReactNode;
2
4
  declare const List: <DataItem, Value>(props: BaseListProps<DataItem, Value>) => import("react/jsx-runtime").JSX.Element;
3
5
  export default List;
4
6
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,eAAO,MAAM,iBAAiB,4CAA8D,CAAC;AAC7F,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -17,6 +17,9 @@ import { usePersistFn } from '@sheinx/hooks';
17
17
  import { VirtualScrollList } from "../virtual-scroll";
18
18
  import ListOption from "./list-option";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
+ export var defaultRenderItem = function defaultRenderItem(d) {
21
+ return d;
22
+ };
20
23
  var List = function List(props) {
21
24
  var _jssStyle$select;
22
25
  var jssStyle = props.jssStyle,
@@ -36,9 +39,7 @@ var List = function List(props) {
36
39
  optionListRef = props.optionListRef,
37
40
  isAnimationFinish = props.isAnimationFinish,
38
41
  _props$renderItem = props.renderItem,
39
- renderItemProp = _props$renderItem === void 0 ? function (d) {
40
- return d;
41
- } : _props$renderItem,
42
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
42
43
  closePop = props.closePop,
43
44
  onControlTypeChange = props.onControlTypeChange,
44
45
  onOptionClick = props.onOptionClick;
@@ -180,7 +180,7 @@ var Result = function Result(props) {
180
180
  handleResultItemClick(e, item);
181
181
  };
182
182
  var content = renderResultContent(item, index, nodes);
183
- if (!content) return null;
183
+ if (!content && content !== 0) return null;
184
184
  if (renderResultContentProp) {
185
185
  // cascader 不渲染tag
186
186
  return renderResultContentProp(_objectSpread({
@@ -22,7 +22,7 @@ import useInnerTitle from "../common/use-inner-title";
22
22
  import AnimationList from "../animation-list";
23
23
  import Spin from "../spin";
24
24
  import Result from "./result";
25
- import List from "./list";
25
+ import List, { defaultRenderItem } from "./list";
26
26
  import TreeList from "./list-tree";
27
27
  import Icons from "../icons";
28
28
  import ColumnsList from "./list-columns";
@@ -94,9 +94,7 @@ function Select(props0) {
94
94
  autoAdapt = props.autoAdapt,
95
95
  groupBy = props.groupBy,
96
96
  _props$renderItem = props.renderItem,
97
- renderItemProp = _props$renderItem === void 0 ? function (d) {
98
- return d;
99
- } : _props$renderItem,
97
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
100
98
  renderResultProp = props.renderResult,
101
99
  renderUnmatched = props.renderUnmatched,
102
100
  resultClassName = props.resultClassName,
@@ -317,7 +315,8 @@ function Select(props0) {
317
315
  });
318
316
  var rootClass = classNames(className, styles === null || styles === void 0 ? void 0 : styles.rootClass, styles === null || styles === void 0 ? void 0 : styles.wrapper, isEmpty && styles.wrapperEmpty, open && (styles === null || styles === void 0 ? void 0 : styles.wrapperOpen), open && trigger === 'hover' && (styles === null || styles === void 0 ? void 0 : styles.triggerHover), disabled === true && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), disabled !== true && focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), clearable && (styles === null || styles === void 0 ? void 0 : styles.clearable), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline), _defineProperty({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
319
317
  var getRenderItem = function getRenderItem(data, index) {
320
- return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
318
+ var _data$renderItemProp;
319
+ return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (_data$renderItemProp = data === null || data === void 0 ? void 0 : data[renderItemProp]) !== null && _data$renderItemProp !== void 0 ? _data$renderItemProp : '';
321
320
  };
322
321
  var renderItem = getRenderItem;
323
322
  var handleFocus = usePersistFn(function (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.8.10-beta.1",
3
+ "version": "3.8.10-beta.2",
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.10-beta.1",
13
+ "@sheinx/hooks": "3.8.10-beta.2",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"