@ray-js/smart-ui 2.0.1-beta-7 → 2.0.1-beta-9

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.
@@ -100,6 +100,12 @@ export interface SmartTabsProps {
100
100
  * @default false
101
101
  */
102
102
  useBeforeChange?: boolean;
103
+ /**
104
+ * 标签未被选择时是否销毁tab插槽内组件
105
+ * @description 必须在受控模式下使用,否则子节点无法渲染
106
+ * @since `v2.0.4`
107
+ */
108
+ inactiveDestroy?: boolean;
103
109
  }
104
110
  /**
105
111
  * @deprecated
package/dist/tab/Tab.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- declare const _default: (props: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
1
+ declare const _default: ({ children, isActive, ...rest }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ isActive: any;
5
+ }) => import("react/jsx-runtime").JSX.Element;
2
6
  export default _default;
package/dist/tab/Tab.js CHANGED
@@ -1,9 +1,36 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
26
  };
5
27
  exports.__esModule = true;
28
+ var jsx_runtime_1 = require("react/jsx-runtime");
6
29
  // @ts-ignore
7
30
  var index_1 = __importDefault(require("@tuya-miniapp/smart-ui/lib/tab/index"));
8
31
  var withReactProps_1 = require("../common/withReactProps");
9
- exports["default"] = (0, withReactProps_1.withReactProps)(index_1["default"]);
32
+ var TabComp = (0, withReactProps_1.withReactProps)(index_1["default"]);
33
+ exports["default"] = (function (_a) {
34
+ var children = _a.children, isActive = _a.isActive, rest = __rest(_a, ["children", "isActive"]);
35
+ return (0, jsx_runtime_1.jsx)(TabComp, __assign({}, rest, { children: isActive && children }));
36
+ });
@@ -1,2 +1,7 @@
1
- declare const _default: (props: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
1
+ declare const _default: ({ children, inactiveDestroy, active, ...rest }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ inactiveDestroy: any;
5
+ active: any;
6
+ }) => import("react/jsx-runtime").JSX.Element;
2
7
  export default _default;
package/dist/tabs/Tabs.js CHANGED
@@ -1,9 +1,43 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
26
  };
5
27
  exports.__esModule = true;
28
+ var jsx_runtime_1 = require("react/jsx-runtime");
6
29
  // @ts-ignore
7
30
  var index_1 = __importDefault(require("@tuya-miniapp/smart-ui/lib/tabs/index"));
31
+ var react_1 = require("react");
8
32
  var withReactProps_1 = require("../common/withReactProps");
9
- exports["default"] = (0, withReactProps_1.withReactProps)(index_1["default"]);
33
+ var TabsComp = (0, withReactProps_1.withReactProps)(index_1["default"]);
34
+ exports["default"] = (function (_a) {
35
+ var children = _a.children, inactiveDestroy = _a.inactiveDestroy, active = _a.active, rest = __rest(_a, ["children", "inactiveDestroy", "active"]);
36
+ return ((0, jsx_runtime_1.jsx)(TabsComp, __assign({}, rest, { inactiveDestroy: inactiveDestroy, active: active }, { children: children &&
37
+ react_1.Children.map(children, function (child, index) {
38
+ var _a, _b;
39
+ return (0, react_1.cloneElement)(child, {
40
+ isActive: inactiveDestroy ? active === ((_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : index) : true
41
+ });
42
+ }) })));
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/smart-ui",
3
- "version": "2.0.1-beta-7",
3
+ "version": "2.0.1-beta-9",
4
4
  "author": "睦海(李利民)",
5
5
  "description": "轻量、可靠的智能小程序 UI 组件库",
6
6
  "scripts": {
@@ -37,7 +37,7 @@
37
37
  "@ray-js/components-ty-progress-bar": "^0.1.1",
38
38
  "@ray-js/components-ty-progress-circle": "^0.1.6",
39
39
  "@ray-js/components-ty-slider": "^0.2.48",
40
- "@tuya-miniapp/smart-ui": "2.0.2-beta-7",
40
+ "@tuya-miniapp/smart-ui": "2.0.2-beta-9",
41
41
  "lodash-es": "^4.17.21"
42
42
  },
43
43
  "devDependencies": {