@power-xa/m-ui 0.0.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.
Files changed (95) hide show
  1. package/README.md +21 -0
  2. package/dist/ActionSheet/index.d.ts +16 -0
  3. package/dist/ActionSheet/index.js +79 -0
  4. package/dist/ActionSheet/index.less +39 -0
  5. package/dist/Breadcrumb/index.d.ts +14 -0
  6. package/dist/Breadcrumb/index.js +31 -0
  7. package/dist/Breadcrumb/index.less +28 -0
  8. package/dist/Button/index.d.ts +16 -0
  9. package/dist/Button/index.js +53 -0
  10. package/dist/Button/index.less +42 -0
  11. package/dist/ConfigProvider/index.d.ts +23 -0
  12. package/dist/ConfigProvider/index.js +41 -0
  13. package/dist/CreatorEdit/index.d.ts +12 -0
  14. package/dist/CreatorEdit/index.js +70 -0
  15. package/dist/CreatorEdit/index.less +41 -0
  16. package/dist/Drawer/index.d.ts +12 -0
  17. package/dist/Drawer/index.js +71 -0
  18. package/dist/Drawer/index.less +24 -0
  19. package/dist/Empty/index.d.ts +12 -0
  20. package/dist/Empty/index.js +18 -0
  21. package/dist/Empty/index.less +15 -0
  22. package/dist/FloatButton/index.d.ts +10 -0
  23. package/dist/FloatButton/index.js +60 -0
  24. package/dist/FloatButton/index.less +26 -0
  25. package/dist/Grid/index.d.ts +15 -0
  26. package/dist/Grid/index.js +26 -0
  27. package/dist/Grid/index.less +4 -0
  28. package/dist/PageContainer/index.d.ts +17 -0
  29. package/dist/PageContainer/index.js +50 -0
  30. package/dist/PageContainer/index.less +41 -0
  31. package/dist/Popup/index.d.ts +13 -0
  32. package/dist/Popup/index.js +65 -0
  33. package/dist/Popup/index.less +22 -0
  34. package/dist/ProForm/Field/index.d.ts +8 -0
  35. package/dist/ProForm/Field/index.js +33 -0
  36. package/dist/ProForm/Field/index.less +96 -0
  37. package/dist/ProForm/Form/index.d.ts +7 -0
  38. package/dist/ProForm/Form/index.js +145 -0
  39. package/dist/ProForm/Form/index.less +61 -0
  40. package/dist/ProForm/Group/index.d.ts +7 -0
  41. package/dist/ProForm/Group/index.js +73 -0
  42. package/dist/ProForm/Group/index.less +32 -0
  43. package/dist/ProForm/controls/Date/index.d.ts +3 -0
  44. package/dist/ProForm/controls/Date/index.js +141 -0
  45. package/dist/ProForm/controls/List/index.d.ts +23 -0
  46. package/dist/ProForm/controls/List/index.js +77 -0
  47. package/dist/ProForm/controls/List/index.less +53 -0
  48. package/dist/ProForm/controls/Select/index.d.ts +4 -0
  49. package/dist/ProForm/controls/Select/index.js +263 -0
  50. package/dist/ProForm/controls/Select/index.less +120 -0
  51. package/dist/ProForm/controls/Text/index.d.ts +4 -0
  52. package/dist/ProForm/controls/Text/index.js +29 -0
  53. package/dist/ProForm/controls/Text/index.less +7 -0
  54. package/dist/ProForm/controls/TextArea/index.d.ts +4 -0
  55. package/dist/ProForm/controls/TextArea/index.js +63 -0
  56. package/dist/ProForm/controls/TextArea/index.less +46 -0
  57. package/dist/ProForm/controls/Upload/index.d.ts +4 -0
  58. package/dist/ProForm/controls/Upload/index.js +383 -0
  59. package/dist/ProForm/controls/Upload/index.less +174 -0
  60. package/dist/ProForm/index.d.ts +9 -0
  61. package/dist/ProForm/index.js +5 -0
  62. package/dist/ProForm/typings.d.ts +164 -0
  63. package/dist/ProList/index.d.ts +78 -0
  64. package/dist/ProList/index.js +323 -0
  65. package/dist/ProList/index.less +318 -0
  66. package/dist/RefreshList/index.d.ts +17 -0
  67. package/dist/RefreshList/index.js +43 -0
  68. package/dist/RefreshList/index.less +19 -0
  69. package/dist/Skeleton/index.d.ts +5 -0
  70. package/dist/Skeleton/index.js +37 -0
  71. package/dist/Skeleton/index.less +7 -0
  72. package/dist/Tabbar/index.d.ts +13 -0
  73. package/dist/Tabbar/index.js +77 -0
  74. package/dist/Tabbar/index.less +44 -0
  75. package/dist/Tabs/index.d.ts +26 -0
  76. package/dist/Tabs/index.js +186 -0
  77. package/dist/Tabs/index.less +249 -0
  78. package/dist/assets/fonts/PingFangSC-Light.ttf +0 -0
  79. package/dist/assets/fonts/PingFangSC-Medium.ttf +0 -0
  80. package/dist/assets/fonts/PingFangSC-Regular.ttf +0 -0
  81. package/dist/assets/less/mixins.less +37 -0
  82. package/dist/global.less +0 -0
  83. package/dist/index.d.ts +25 -0
  84. package/dist/index.js +27 -0
  85. package/dist/request/index.d.ts +8 -0
  86. package/dist/request/index.js +61 -0
  87. package/dist/services/FileController/index.d.ts +12 -0
  88. package/dist/services/FileController/index.js +39 -0
  89. package/dist/services/FileController/typings.d.ts +52 -0
  90. package/dist/services/index.d.ts +2 -0
  91. package/dist/services/index.js +2 -0
  92. package/dist/services/typings.d.ts +25 -0
  93. package/dist/utils/tools.d.ts +33 -0
  94. package/dist/utils/tools.js +231 -0
  95. package/package.json +88 -0
@@ -0,0 +1,318 @@
1
+ @import "@power-xa/m-ui/dist/assets/less/mixins.less";
2
+
3
+ .p-pro-list-container,
4
+ .p-pro-list-view-container {
5
+
6
+ .p-pro-list-content {
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ .p-pro-list-card-skeleton,
13
+ .p-pro-list-card-container {
14
+ background: #fff;
15
+ border-radius: 28px;
16
+ padding: 42px 24px 30px;
17
+ box-sizing: border-box;
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 28px;
21
+ position: relative;
22
+ }
23
+
24
+ .p-pro-list-card-skeleton {
25
+ .p-pro-list-card-tag {
26
+ position: absolute;
27
+ top: 0;
28
+ right: 0;
29
+ border-radius: 0 28px 0 28px;
30
+ width: 100px;
31
+ height: 32px;
32
+ }
33
+
34
+ .p-pro-list-card-title {
35
+ display: flex;
36
+ align-items: flex-start;
37
+ gap: 24px;
38
+
39
+ .p-pro-list-card-title-swiper {
40
+ width: 200px;
41
+ height: 150px;
42
+ border-radius: 24px;
43
+ }
44
+
45
+ .p-pro-list-card-title-text {
46
+ flex: 1;
47
+ display: flex;
48
+ flex-direction: column;
49
+ gap: 4px;
50
+
51
+ .p-pro-list-card-title-text-skeleton {
52
+ width: 100%;
53
+ height: 40px;
54
+ }
55
+ }
56
+ }
57
+
58
+ .p-pro-list-card-sub-title {
59
+ height: 34px;
60
+ width: 100%;
61
+ }
62
+
63
+ .p-pro-list-card-description {
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 20px;
67
+
68
+ .p-pro-list-card-description-row {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 28px;
72
+
73
+ .p-pro-list-card-description-label {
74
+ flex: 1;
75
+ height: 34px;
76
+ }
77
+
78
+ .p-pro-list-card-description-value {
79
+ flex: 4;
80
+ height: 34px;
81
+ }
82
+ }
83
+ }
84
+
85
+ .p-pro-list-card-image-list {
86
+ display: flex;
87
+ align-items: center;
88
+ gap: 20px;
89
+
90
+ .p-pro-list-card-image {
91
+ width: 92px;
92
+ height: 92px;
93
+ border-radius: 20px;
94
+ }
95
+ }
96
+
97
+ .p-pro-list-card-footer {
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: space-between;
101
+ padding-top: 24px;
102
+ box-sizing: border-box;
103
+ border-top: 1px solid rgba(51, 52, 55, 0.10);
104
+ gap: 28px;
105
+
106
+ .p-pro-list-card-footer-creator {
107
+ display: flex;
108
+ align-items: center;
109
+ gap: 20px;
110
+
111
+ .p-pro-list-card-footer-creator-avatar {
112
+ width: 46px;
113
+ height: 46px;
114
+ border-radius: 12px;
115
+ }
116
+
117
+ .p-pro-list-card-footer-creator-name {
118
+ width: 100px;
119
+ height: 34px;
120
+ }
121
+ }
122
+
123
+ .p-pro-list-card-footer-extra-content {
124
+ width: 180px;
125
+ height: 34px;
126
+ }
127
+ }
128
+ }
129
+
130
+ .p-pro-list-card-container {
131
+ .p-pro-list-card-tag {
132
+ position: absolute;
133
+ top: 0;
134
+ right: 0;
135
+ border-radius: 0 28px 0 28px;
136
+ padding: 4px 22px;
137
+ box-sizing: border-box;
138
+ display: flex;
139
+ align-items: center;
140
+
141
+ .p-pro-list-card-tag-text {
142
+ .font(24)
143
+ }
144
+ }
145
+
146
+ .p-pro-list-card-title {
147
+ display: flex;
148
+ align-items: flex-start;
149
+ gap: 24px;
150
+
151
+ .p-pro-list-card-title-swiper {
152
+ width: 200px;
153
+ height: 150px;
154
+ flex-shrink: 0;
155
+
156
+ .p-pro-list-card-title-swiper-content {
157
+ .p-pro-list-card-title-swiper-image {
158
+ width: 200px;
159
+ height: 150px;
160
+ border-radius: 24px;
161
+ }
162
+ }
163
+ }
164
+
165
+ .p-pro-list-card-title-text {
166
+ .font(28, #333437, Regular, 500);
167
+ overflow: hidden;
168
+ display: -webkit-box;
169
+ -webkit-box-orient: vertical;
170
+ -webkit-line-clamp: 2; // 控制显示的行数
171
+ text-overflow: ellipsis;
172
+
173
+ &.p-pro-list-card-title-swiper-text {
174
+ -webkit-line-clamp: 4;
175
+ }
176
+ }
177
+ }
178
+
179
+ .p-pro-list-card-sub-title {
180
+ .font(24, #333437)
181
+ }
182
+
183
+ .p-pro-list-card-description {
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 28px;
187
+
188
+ .p-pro-list-card-description-label,
189
+ .p-pro-list-card-description-value {
190
+ .font(24, #888B94)
191
+ }
192
+
193
+ .label-column,
194
+ .value-column {
195
+ display: flex;
196
+ flex-direction: column;
197
+ gap: 20px;
198
+ flex-shrink: 0;
199
+ }
200
+
201
+ .label-column {
202
+ width: max-content;
203
+ }
204
+
205
+ .value-column {
206
+ flex: 1;
207
+ width: 0;
208
+
209
+ .p-pro-list-card-description-value {
210
+ width: 100%;
211
+ overflow: hidden;
212
+ white-space: nowrap;
213
+ text-overflow: ellipsis;
214
+ }
215
+ }
216
+ }
217
+
218
+ .p-pro-list-card-image-list {
219
+ display: flex;
220
+ align-items: center;
221
+ flex-wrap: wrap;
222
+ gap: 20px;
223
+
224
+ .p-pro-list-card-image {
225
+ width: 92px;
226
+ height: 92px;
227
+ border-radius: 20px;
228
+ }
229
+ }
230
+
231
+ .p-pro-list-card-file-list {
232
+ display: flex;
233
+ flex-direction: column;
234
+ gap: 20px;
235
+
236
+ .p-pro-list-card-file {
237
+ display: flex;
238
+ align-items: center;
239
+ padding: 20px 22px;
240
+ box-sizing: border-box;
241
+ background: #F5F6F7;
242
+ gap: 16px;
243
+ border-radius: 16px;
244
+
245
+ .p-pro-list-card-file-image {
246
+ width: 40px;
247
+ height: 44px;
248
+ }
249
+
250
+ .p-pro-list-card-file-name {
251
+ flex: 1;
252
+ width: 0;
253
+ overflow: hidden;
254
+ text-overflow: ellipsis;
255
+ white-space: nowrap;
256
+ .font(24, #666)
257
+ }
258
+ }
259
+ }
260
+
261
+ .p-pro-list-card-footer {
262
+ display: flex;
263
+ align-items: center;
264
+ padding-top: 24px;
265
+ box-sizing: border-box;
266
+ border-top: 1px solid rgba(51, 52, 55, 0.10);
267
+ gap: 28px;
268
+
269
+ .p-pro-list-card-footer-creator {
270
+ display: flex;
271
+ align-items: center;
272
+ gap: 20px;
273
+
274
+ .p-pro-list-card-footer-creator-avatar {
275
+ width: 46px;
276
+ height: 46px;
277
+ border-radius: 12px;
278
+ }
279
+
280
+ .p-pro-list-card-footer-creator-name {
281
+ .font(24, #888B94)
282
+ }
283
+ }
284
+
285
+ .p-pro-list-card-footer-extra-content {
286
+ flex: 1;
287
+ display: flex;
288
+ align-items: center;
289
+ justify-content: flex-end;
290
+
291
+ .p-pro-list-card-footer-extra-text {
292
+ .font(24, #888B94)
293
+ }
294
+ }
295
+ }
296
+ }
297
+
298
+ .p-pro-list-error-view {
299
+ width: 100%;
300
+ height: 100%;
301
+ display: flex;
302
+ align-items: center;
303
+ justify-content: center;
304
+
305
+ .text {
306
+ .font(24, #999)
307
+ }
308
+ }
309
+ }
310
+
311
+ &.p-pro-list-container {
312
+ width: 100%;
313
+ height: 100%;
314
+ padding: 28px 32px;
315
+ background: #F6F7F9;
316
+ box-sizing: border-box;
317
+ }
318
+ }
@@ -0,0 +1,17 @@
1
+ import { FC, ReactNode } from "react";
2
+ import "./index.less";
3
+ type RefreshListProps = {
4
+ loading?: boolean;
5
+ skeleton?: ReactNode;
6
+ dataSource: {
7
+ [key: string]: any;
8
+ }[];
9
+ getList?: (current: number) => void;
10
+ total?: number;
11
+ size?: number;
12
+ renderItem: (data: {
13
+ [key: string]: any;
14
+ }) => ReactNode;
15
+ };
16
+ declare const RefreshList: FC<RefreshListProps>;
17
+ export default RefreshList;
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { ScrollView, Text, View } from "@tarojs/components";
3
+ import "./index.less";
4
+ var RefreshList = function RefreshList(_ref) {
5
+ var _ref$loading = _ref.loading,
6
+ loading = _ref$loading === void 0 ? false : _ref$loading,
7
+ skeleton = _ref.skeleton,
8
+ _ref$dataSource = _ref.dataSource,
9
+ dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
10
+ getList = _ref.getList,
11
+ total = _ref.total,
12
+ _ref$size = _ref.size,
13
+ size = _ref$size === void 0 ? 0 : _ref$size,
14
+ renderItem = _ref.renderItem;
15
+ return /*#__PURE__*/React.createElement(ScrollView, {
16
+ scrollY: true,
17
+ showScrollbar: false,
18
+ enableBackToTop: true,
19
+ enableFlex: true,
20
+ refresherEnabled: true,
21
+ refresherBackground: "#F6F7F9",
22
+ enhanced: true,
23
+ pagingEnabled: true,
24
+ enablePassive: true,
25
+ type: "custom",
26
+ onRefresherRefresh: function onRefresherRefresh() {
27
+ return getList === null || getList === void 0 ? void 0 : getList(1);
28
+ },
29
+ onScrollToLower: function onScrollToLower() {
30
+ return total && total > dataSource.length && (getList === null || getList === void 0 ? void 0 : getList(dataSource.length / size + 1));
31
+ },
32
+ className: "p-refresh-list-container"
33
+ }, loading ? Array(10).fill(null).map(function () {
34
+ return skeleton;
35
+ }) : dataSource.length ? dataSource.map(function (item) {
36
+ return renderItem(item);
37
+ }) : /*#__PURE__*/React.createElement(View, {
38
+ className: "error-view"
39
+ }, /*#__PURE__*/React.createElement(Text, {
40
+ className: "text"
41
+ }, "\u6682\u65E0\u6570\u636E")));
42
+ };
43
+ export default RefreshList;
@@ -0,0 +1,19 @@
1
+ @import "@power-xa/m-ui/dist/assets/less/mixins.less";
2
+
3
+ .p-refresh-list-container {
4
+ box-sizing: border-box;
5
+ height: 100%;
6
+
7
+ .error-view {
8
+ width: 100%;
9
+ height: 100%;
10
+ display: flex;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+
15
+ .text {
16
+ .font(24, #999)
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ import { ViewProps } from "@tarojs/components";
3
+ import "./index.less";
4
+ declare const Skeleton: FC<ViewProps>;
5
+ export default Skeleton;
@@ -0,0 +1,37 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ 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."); }
4
+ 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); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ import React, { useEffect, useState } from "react";
9
+ import { View } from "@tarojs/components";
10
+ import "./index.less";
11
+ var Skeleton = function Skeleton(props) {
12
+ var className = props.className;
13
+ var timer;
14
+ var _useState = useState(1),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ opacity = _useState2[0],
17
+ setOpacity = _useState2[1];
18
+ useEffect(function () {
19
+ timer = setTimeout(function () {
20
+ setOpacity(.3);
21
+ }, 300);
22
+ return function () {
23
+ clearTimeout(timer);
24
+ timer = null;
25
+ };
26
+ }, []);
27
+ return /*#__PURE__*/React.createElement(View, _extends({}, props, {
28
+ className: "".concat(className, " p-skeleton"),
29
+ onTransitionEnd: function onTransitionEnd() {
30
+ return setOpacity(opacity === 1 ? .3 : 1);
31
+ },
32
+ style: {
33
+ opacity: opacity
34
+ }
35
+ }));
36
+ };
37
+ export default Skeleton;
@@ -0,0 +1,7 @@
1
+ .p-skeleton {
2
+ transition-timing-function: linear;
3
+ transition-property: opacity;
4
+ transition-duration: 900ms;
5
+ background-color: #e4e4e4;
6
+ border-radius: 12px;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { FC, ReactNode } from "react";
2
+ import "./index.less";
3
+ type TabItemProps = {
4
+ label: string;
5
+ icon: string;
6
+ key: string;
7
+ children: ReactNode;
8
+ };
9
+ type TabbarProps = {
10
+ items: TabItemProps[];
11
+ };
12
+ declare const Tabbar: FC<TabbarProps>;
13
+ export default Tabbar;
@@ -0,0 +1,77 @@
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
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ 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; }
7
+ 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; }
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ 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); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ 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."); }
13
+ 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); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import React, { useEffect, useState } from "react";
18
+ import { getWindowInfo } from "@tarojs/taro";
19
+ import { Text, View } from "@tarojs/components";
20
+ import "./index.less";
21
+ var Tabbar = function Tabbar(_ref) {
22
+ var items = _ref.items;
23
+ var _getWindowInfo = getWindowInfo(),
24
+ safeArea = _getWindowInfo.safeArea;
25
+ var _ref2 = safeArea,
26
+ height = _ref2.height,
27
+ bottom = _ref2.bottom;
28
+ var _useState = useState(""),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ tab = _useState2[0],
31
+ setTab = _useState2[1];
32
+ var _useState3 = useState([]),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ tabbarList = _useState4[0],
35
+ setTabbarList = _useState4[1];
36
+ useEffect(function () {
37
+ if (items.length) {
38
+ setTab(items[0].key);
39
+ setTabbarList(items.map(function (item, index) {
40
+ return _objectSpread(_objectSpread({}, item), {}, {
41
+ init: index === 0 ? true : false
42
+ });
43
+ }));
44
+ }
45
+ }, []);
46
+ return /*#__PURE__*/React.createElement(View, {
47
+ className: "p-tabbar-page-container"
48
+ }, tabbarList.map(function (item) {
49
+ return item.init && /*#__PURE__*/React.createElement(View, {
50
+ key: 'content-' + item.key,
51
+ style: {
52
+ display: tab === item.key ? "block" : "none"
53
+ },
54
+ className: "p-tabbar-page-content"
55
+ }, item.children);
56
+ }), /*#__PURE__*/React.createElement(View, {
57
+ className: "p-tabbar-page-footer",
58
+ style: {
59
+ paddingBottom: "".concat(bottom - height > 32 ? bottom - height : 32, "rpx")
60
+ }
61
+ }, tabbarList.map(function (item) {
62
+ return /*#__PURE__*/React.createElement(View, {
63
+ className: "p-tabbar-content ".concat(tab === item.key ? 'selected' : ''),
64
+ key: 'tabbar-' + item.key,
65
+ onTap: function onTap() {
66
+ item.init = true;
67
+ setTabbarList(_toConsumableArray(tabbarList));
68
+ setTab(item.key);
69
+ }
70
+ }, /*#__PURE__*/React.createElement(View, {
71
+ className: "iconfont ".concat(item.icon)
72
+ }), /*#__PURE__*/React.createElement(Text, {
73
+ className: "text"
74
+ }, item.label));
75
+ })));
76
+ };
77
+ export default Tabbar;
@@ -0,0 +1,44 @@
1
+ @import "@power-xa/m-ui/dist/assets/less/mixins.less";
2
+
3
+ .p-tabbar-page-container {
4
+ width: 100%;
5
+ height: 100%;
6
+ display: flex;
7
+ flex-direction: column;
8
+
9
+ .p-tabbar-page-content {
10
+ flex: 1;
11
+ height: 0;
12
+ }
13
+
14
+ .p-tabbar-page-footer {
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: space-around;
18
+ padding: 32px 16px;
19
+
20
+ .p-tabbar-content {
21
+ display: flex;
22
+ flex-direction: column;
23
+ flex: 1;
24
+ align-items: center;
25
+ gap: 8px;
26
+
27
+ .iconfont {
28
+ font-size: 36px;
29
+ color: #3B3A3A;
30
+ }
31
+
32
+ .text {
33
+ .font(24, #737476)
34
+ }
35
+
36
+ &.selected {
37
+ .text {
38
+ color: #3B3A3A;
39
+ font-weight: 500;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,26 @@
1
+ import { FC, ReactNode, ReactElement } from "react";
2
+ import "./index.less";
3
+ type TabItemProps = {
4
+ label: string;
5
+ icon?: string;
6
+ key: string;
7
+ children?: ReactElement;
8
+ init?: boolean;
9
+ };
10
+ type TabsProps = {
11
+ items: TabItemProps[];
12
+ onChange?: (current: string) => void;
13
+ activeKey?: string;
14
+ extra?: {
15
+ right?: ReactNode;
16
+ left?: ReactNode;
17
+ };
18
+ swipeable?: boolean;
19
+ segmented?: boolean;
20
+ lazy?: boolean;
21
+ className?: string;
22
+ isCardList?: boolean;
23
+ centered?: boolean;
24
+ };
25
+ declare const Tabs: FC<TabsProps>;
26
+ export default Tabs;