yootd 0.2.43 → 0.2.44

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.
@@ -15,6 +15,8 @@ export interface TableProps<T = AnyObject> extends Omit<AntTableProps<T>, 'colum
15
15
  headerTextColor?: string;
16
16
  showSetting?: boolean;
17
17
  persistKeys?: string;
18
+ striped?: boolean;
19
+ stripedColor?: string[];
18
20
  }
19
21
  export interface ColumnType<T = AnyObject> extends Omit<AntColumnType<T>, 'key'> {
20
22
  key: React.Key;
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _typeof from "@babel/runtime/helpers/esm/typeof";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
- var _excluded = ["type", "showSetting", "columns", "components", "persistKeys", "headerBgColor", "headerTextColor"];
6
+ var _excluded = ["type", "showSetting", "columns", "components", "persistKeys", "headerBgColor", "headerTextColor", "striped", "stripedColor"];
7
7
  import { Table as AntTable } from 'antd';
8
8
  import React, { forwardRef, useEffect, useMemo, useState } from 'react';
9
9
  import { PrimaryHeaderRow } from "./components/primary-header-row";
@@ -22,6 +22,10 @@ var InternalTable = function InternalTable(_ref, ref) {
22
22
  persistKeys = _ref.persistKeys,
23
23
  headerBgColor = _ref.headerBgColor,
24
24
  headerTextColor = _ref.headerTextColor,
25
+ _ref$striped = _ref.striped,
26
+ striped = _ref$striped === void 0 ? false : _ref$striped,
27
+ _ref$stripedColor = _ref.stripedColor,
28
+ stripedColor = _ref$stripedColor === void 0 ? ['#F0F9FF', '#FFFFFF'] : _ref$stripedColor,
25
29
  rest = _objectWithoutProperties(_ref, _excluded);
26
30
  var _useState = useState([]),
27
31
  _useState2 = _slicedToArray(_useState, 2),
@@ -154,7 +158,23 @@ var InternalTable = function InternalTable(_ref, ref) {
154
158
  }, /*#__PURE__*/React.createElement(AntTable, _extends({}, rest, {
155
159
  ref: ref,
156
160
  columns: filterColumns(innerColumns, keys),
157
- components: _components
161
+ components: _components,
162
+ onRow: function onRow(_, index) {
163
+ if (index == null || !striped) return {};
164
+ if (index % 2 === 0) {
165
+ return {
166
+ style: {
167
+ backgroundColor: stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[0]
168
+ }
169
+ };
170
+ } else {
171
+ return {
172
+ style: {
173
+ backgroundColor: stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[1]
174
+ }
175
+ };
176
+ }
177
+ }
158
178
  })));
159
179
  };
160
180
  var Table = /*#__PURE__*/forwardRef(InternalTable);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "description": "基于 Antd 二次开发的组件库",
5
5
  "license": "MIT",
6
6
  "sideEffects": [