yootd 0.2.44 → 0.2.45

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.
@@ -13,8 +13,10 @@ import { PrimaryTBodyRow } from "./components/primary-tbody-row";
13
13
  // import { RefTable } from 'antd/es/table/interface';
14
14
 
15
15
  import "./index.scss";
16
+ import { useBem } from "../hooks/useBem";
16
17
  export var TableRowContext = /*#__PURE__*/React.createContext({});
17
18
  var InternalTable = function InternalTable(_ref, ref) {
19
+ var _rest$style;
18
20
  var type = _ref.type,
19
21
  showSetting = _ref.showSetting,
20
22
  columns = _ref.columns,
@@ -143,6 +145,7 @@ var InternalTable = function InternalTable(_ref, ref) {
143
145
  console.error(error);
144
146
  }
145
147
  }, [persistKeys]);
148
+ var bem = useBem('table');
146
149
  return /*#__PURE__*/React.createElement(TableRowContext.Provider, {
147
150
  value: {
148
151
  columns: innerColumns,
@@ -159,22 +162,35 @@ var InternalTable = function InternalTable(_ref, ref) {
159
162
  ref: ref,
160
163
  columns: filterColumns(innerColumns, keys),
161
164
  components: _components,
162
- onRow: function onRow(_, index) {
163
- if (index == null || !striped) return {};
165
+ style: _objectSpread(_objectSpread({}, (_rest$style = rest.style) !== null && _rest$style !== void 0 ? _rest$style : {}), {}, {
166
+ // @ts-expect-error
167
+ '--even-striped-color': stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[1],
168
+ '--odd-striped-color': stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[0]
169
+ }),
170
+ rowClassName: striped ? function (_record, index) {
171
+ if (index == null || !striped) return '';
164
172
  if (index % 2 === 0) {
165
- return {
166
- style: {
167
- backgroundColor: stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[0]
168
- }
169
- };
173
+ return "".concat(bem.b('tbody').b('row').m('striped').m('even'));
170
174
  } else {
171
- return {
172
- style: {
173
- backgroundColor: stripedColor === null || stripedColor === void 0 ? void 0 : stripedColor[1]
174
- }
175
- };
175
+ return "".concat(bem.b('tbody').b('row').m('striped').m('odd'));
176
176
  }
177
- }
177
+ } : undefined
178
+ // onRow={(_, index?: number) => {
179
+ // if (index == null || !striped) return {};
180
+ // if (index % 2 === 0) {
181
+ // return {
182
+ // style: {
183
+ // backgroundColor: stripedColor?.[0],
184
+ // },
185
+ // };
186
+ // } else {
187
+ // return {
188
+ // style: {
189
+ // backgroundColor: stripedColor?.[1],
190
+ // },
191
+ // };
192
+ // }
193
+ // }}
178
194
  })));
179
195
  };
180
196
  var Table = /*#__PURE__*/forwardRef(InternalTable);
@@ -15,6 +15,7 @@
15
15
  // }
16
16
  // }
17
17
 
18
+
18
19
  &-header {
19
20
  &:hover {
20
21
  &__icon {
@@ -30,4 +31,28 @@
30
31
  }
31
32
  }
32
33
  }
34
+ &-tbody {
35
+ &-row {
36
+ &--striped {
37
+ &--even {
38
+ background-color: var(--even-striped-color);
39
+ .ant-table-cell-fix-right{
40
+ background-color: var(--even-striped-color) !important;
41
+ }
42
+ .ant-table-cell-fix-left{
43
+ background-color: var(--even-striped-color) !important;
44
+ }
45
+ }
46
+ &--odd {
47
+ background-color: var(--odd-striped-color);
48
+ .ant-table-cell-fix-right{
49
+ background-color: var(--odd-striped-color) !important;
50
+ }
51
+ .ant-table-cell-fix-left{
52
+ background-color: var(--odd-striped-color) !important;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
33
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "description": "基于 Antd 二次开发的组件库",
5
5
  "license": "MIT",
6
6
  "sideEffects": [