@oceanbase/design 0.4.2 → 0.4.3

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.
@@ -27,7 +27,7 @@ export var genLargeStyle = function genLargeStyle(token) {
27
27
  controlHeightLG = token.controlHeightLG;
28
28
  var height = controlHeightLG;
29
29
  var lineHeight = "".concat(controlHeightLG, "px");
30
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(antCls, "-btn"), _objectSpread({
30
+ return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(antCls, "-btn"), _objectSpread({
31
31
  // limit min width for icon button
32
32
  minWidth: controlHeightLG,
33
33
  height: height,
@@ -50,7 +50,10 @@ export var genLargeStyle = function genLargeStyle(token) {
50
50
  borderRadius: borderRadiusLG
51
51
  }), "".concat(antCls, "-select-selection-item"), {
52
52
  fontSize: fontSize
53
- }))), "".concat(antCls, "-input-wrapper"), _defineProperty(_defineProperty({
53
+ }))), "".concat(antCls, "-select-multiple ").concat(antCls, "-select-selection-wrap"), {
54
+ // ref: https://github.com/oceanbase/oceanbase-design/pull/881
55
+ height: '100%'
56
+ }), "".concat(antCls, "-input-wrapper"), _defineProperty(_defineProperty({
54
57
  fontSize: fontSize
55
58
  }, "".concat(iconCls), {
56
59
  fontSize: fontSize
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["children", "theme", "locale", "navigate", "hideOnSinglePage", "form", "spin", "table", "tabs", "injectStaticFunction", "styleProviderProps", "appProps"];
2
+ var _excluded = ["children", "theme", "locale", "navigate", "hideOnSinglePage", "collapse", "form", "spin", "table", "tabs", "injectStaticFunction", "styleProviderProps", "appProps"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -11,12 +11,13 @@ import React from 'react';
11
11
  import { App, ConfigProvider as AntConfigProvider } from 'antd';
12
12
  import { StyleProvider } from '@ant-design/cssinjs';
13
13
  import StyleContext from '@ant-design/cssinjs/es/StyleContext';
14
+ import { CaretRightOutlined } from '@oceanbase/icons';
15
+ import aliyunTheme from '@oceanbase/aliyun-theme';
14
16
  import { merge } from 'lodash';
15
17
  import StaticFunction from "../static-function";
16
18
  import themeConfig from "../theme";
17
19
  import defaultTheme, { fontFamilyEn } from "../theme/default";
18
20
  import darkTheme from "../theme/dark";
19
- import aliyunTheme from '@oceanbase/aliyun-theme';
20
21
  import DefaultRenderEmpty from "./DefaultRenderEmpty";
21
22
  import { jsx as _jsx } from "react/jsx-runtime";
22
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -36,6 +37,7 @@ var ConfigProvider = function ConfigProvider(_ref) {
36
37
  locale = _ref.locale,
37
38
  navigate = _ref.navigate,
38
39
  hideOnSinglePage = _ref.hideOnSinglePage,
40
+ collapse = _ref.collapse,
39
41
  form = _ref.form,
40
42
  spin = _ref.spin,
41
43
  table = _ref.table,
@@ -63,6 +65,14 @@ var ConfigProvider = function ConfigProvider(_ref) {
63
65
  var mergedLocale = merge({}, parentContext.locale, locale);
64
66
  return /*#__PURE__*/_jsx(AntConfigProvider, _objectSpread(_objectSpread({
65
67
  locale: mergedLocale,
68
+ collapse: merge({}, {
69
+ expandIcon: function expandIcon(_ref2) {
70
+ var isActive = _ref2.isActive;
71
+ return /*#__PURE__*/_jsx(CaretRightOutlined, {
72
+ rotate: isActive ? 90 : 0
73
+ });
74
+ }
75
+ }, parentContext.collapse, collapse),
66
76
  form: merge({}, {
67
77
  requiredMark: 'optional'
68
78
  }, parentContext.form, form),
@@ -10,11 +10,11 @@ export default function useItems(items?: DescriptionsItemType[], children?: Reac
10
10
  sm?: number;
11
11
  xs?: number;
12
12
  };
13
- className?: string;
13
+ label?: React.ReactNode;
14
14
  style?: React.CSSProperties;
15
- prefixCls?: string;
16
15
  key?: React.Key;
17
- label?: React.ReactNode;
16
+ className?: string;
17
+ prefixCls?: string;
18
18
  labelStyle?: React.CSSProperties;
19
19
  contentStyle?: React.CSSProperties;
20
20
  }[];
@@ -4,6 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
4
4
  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); }
5
5
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
6
6
  export var genTableStyle = function genTableStyle(token) {
7
+ var _ref;
7
8
  var antCls = token.antCls,
8
9
  componentCls = token.componentCls,
9
10
  colorText = token.colorText,
@@ -17,12 +18,13 @@ export var genTableStyle = function genTableStyle(token) {
17
18
  padding = token.padding,
18
19
  marginLG = token.marginLG,
19
20
  marginXS = token.marginXS;
20
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-wrapper ").concat(componentCls), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
21
+ return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, "".concat(componentCls, "-wrapper ").concat(componentCls), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
21
22
  color: colorText,
22
23
  backgroundColor: colorBgBase,
23
24
  borderRadius: borderRadiusLG
24
25
  }, "".concat(componentCls, "-footer"), {
25
- borderBottom: "1px solid ".concat(colorBorderSecondary)
26
+ borderBottom: "1px solid ".concat(colorBorderSecondary),
27
+ borderRadius: 0
26
28
  }), "".concat(componentCls, "-thead, ").concat(componentCls, "-tbody"), _defineProperty({}, 'td, th', _defineProperty(_defineProperty({}, "&".concat(componentCls, "-row-expand-icon-cell"), {
27
29
  backgroundColor: colorBgBase,
28
30
  padding: "".concat(token.paddingSM, "px ").concat(token.paddingXS, "px")
@@ -70,14 +72,24 @@ export var genTableStyle = function genTableStyle(token) {
70
72
  borderRadius: 0
71
73
  }), "".concat(componentCls, "-empty-wrapper"), {
72
74
  minHeight: 'auto'
73
- })))), "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-expandable):not(").concat(componentCls, "-has-footer) ").concat(componentCls, ":not(").concat(componentCls, "-bordered):not(").concat(componentCls, "-empty)"), {
74
- borderBottom: "1px solid ".concat(colorBorderSecondary),
75
- borderRadius: 0
76
- }), "".concat(componentCls, "-wrapper ").concat(componentCls).concat(componentCls, "-scroll-horizontal, ").concat(componentCls, "-wrapper ").concat(componentCls).concat(componentCls, "-fixed-header"), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty(_defineProperty({}, "tr:nth-child(2n + 1):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(antCls, "-descriptions-row) > td"), {
75
+ })))), "".concat(componentCls, "-wrapper ").concat(componentCls).concat(componentCls, "-scroll-horizontal, ").concat(componentCls, "-wrapper ").concat(componentCls).concat(componentCls, "-fixed-header"), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty(_defineProperty({}, "tr:nth-child(2n + 1):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(antCls, "-descriptions-row) > td"), {
77
76
  backgroundColor: colorFillQuaternary
78
77
  }), "tr:nth-child(2n):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(componentCls, "-expanded-row):not(").concat(antCls, "-descriptions-row) > td"), {
79
78
  backgroundColor: colorBgBase
80
- }))), "".concat(componentCls, "-wrapper").concat(componentCls, "-expandable"), _defineProperty(_defineProperty({}, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty(_defineProperty({}, "tr:nth-child(2n):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(componentCls, "-expanded-row)"), _defineProperty(_defineProperty({}, '& > td', {
79
+ }))), "".concat(componentCls, "-wrapper ").concat(componentCls).concat(componentCls, "-bordered"), _defineProperty({}, "".concat(componentCls, "-footer"), {
80
+ borderRadius: "0px 0px ".concat(token.borderRadiusLG, "px ").concat(token.borderRadiusLG, "px")
81
+ })), "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-has-footer) ").concat(componentCls).concat(componentCls, "-bordered"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-container"), {
82
+ borderRadius: token.borderRadiusLG
83
+ }), "".concat(componentCls, "-tbody"), _defineProperty(_defineProperty({}, "tr:last-child >*:first-child", {
84
+ borderEndStartRadius: token.borderRadiusLG
85
+ }), "tr:last-child >*:last-child", {
86
+ borderEndEndRadius: token.borderRadiusLG
87
+ }))), "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-expandable):not(").concat(componentCls, "-has-footer) ").concat(componentCls, ":not(").concat(componentCls, "-bordered):not(").concat(componentCls, "-empty)"), {
88
+ borderBottom: "1px solid ".concat(colorBorderSecondary),
89
+ borderRadius: 0
90
+ }), "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-expandable)"), _defineProperty({}, "".concat(componentCls, ":not(").concat(componentCls, "-bordered)"), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty({}, "tr:not(".concat(componentCls, "-measure-row) > td"), {
91
+ border: 'none'
92
+ })))), "".concat(componentCls, "-wrapper").concat(componentCls, "-expandable"), _defineProperty(_defineProperty({}, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty(_defineProperty({}, "tr:nth-child(2n):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(componentCls, "-expanded-row)"), _defineProperty(_defineProperty({}, '& > td', {
81
93
  backgroundColor: colorBgBase
82
94
  }), '&:hover', {
83
95
  td: {
@@ -110,9 +122,11 @@ export var genTableStyle = function genTableStyle(token) {
110
122
  }, "".concat(componentCls, "-batch-operation-selection-count"), {
111
123
  margin: "0 ".concat(marginXS, "px"),
112
124
  color: colorLink
113
- }))))), "".concat(antCls, "-popover").concat(componentCls, "-batch-operation-selection-popover"), _defineProperty({}, "".concat(antCls, "-popover-inner"), {
125
+ }))))), _defineProperty(_defineProperty(_ref, "".concat(antCls, "-popover").concat(componentCls, "-batch-operation-selection-popover"), _defineProperty({}, "".concat(antCls, "-popover-inner"), {
114
126
  padding: 0
115
- }));
127
+ })), "".concat(antCls, "-popover, ").concat(antCls, "-tooltip"), _defineProperty({}, "".concat(componentCls, " ").concat(componentCls, "-tbody"), _defineProperty({}, "".concat(componentCls, "-empty-wrapper"), {
128
+ minHeight: 'auto'
129
+ })));
116
130
  };
117
131
  export default (function (prefixCls) {
118
132
  var useStyle = genComponentStyleHook('Table', function (token) {
@@ -96,6 +96,9 @@ var defaultTheme = {
96
96
  fontHeight: 20,
97
97
  lastItemColor: '#5c6b8a'
98
98
  },
99
+ Collapse: {
100
+ colorBorder: '#E2E8F3'
101
+ },
99
102
  InputNumber: {
100
103
  handleVisible: true
101
104
  },
@@ -91,6 +91,10 @@ var genLargeStyle = (token) => {
91
91
  fontSize
92
92
  }
93
93
  },
94
+ [`${antCls}-select-multiple ${antCls}-select-selection-wrap`]: {
95
+ // ref: https://github.com/oceanbase/oceanbase-design/pull/881
96
+ height: "100%"
97
+ },
94
98
  // Input
95
99
  [`${antCls}-input-wrapper`]: {
96
100
  fontSize,
@@ -37,12 +37,13 @@ var import_react = __toESM(require("react"));
37
37
  var import_antd = require("antd");
38
38
  var import_cssinjs = require("@ant-design/cssinjs");
39
39
  var import_StyleContext = __toESM(require("@ant-design/cssinjs/es/StyleContext"));
40
+ var import_icons = require("@oceanbase/icons");
41
+ var import_aliyun_theme = __toESM(require("@oceanbase/aliyun-theme"));
40
42
  var import_lodash = require("lodash");
41
43
  var import_static_function = __toESM(require("../static-function"));
42
44
  var import_theme = __toESM(require("../theme"));
43
45
  var import_default = __toESM(require("../theme/default"));
44
46
  var import_dark = __toESM(require("../theme/dark"));
45
- var import_aliyun_theme = __toESM(require("@oceanbase/aliyun-theme"));
46
47
  var import_DefaultRenderEmpty = __toESM(require("./DefaultRenderEmpty"));
47
48
  __reExport(config_provider_exports, require("./navigate"), module.exports);
48
49
  __reExport(config_provider_exports, require("antd/es/config-provider/context"), module.exports);
@@ -59,6 +60,7 @@ var ConfigProvider = ({
59
60
  locale,
60
61
  navigate,
61
62
  hideOnSinglePage,
63
+ collapse,
62
64
  form,
63
65
  spin,
64
66
  table,
@@ -89,6 +91,14 @@ var ConfigProvider = ({
89
91
  import_antd.ConfigProvider,
90
92
  {
91
93
  locale: mergedLocale,
94
+ collapse: (0, import_lodash.merge)(
95
+ {},
96
+ {
97
+ expandIcon: ({ isActive }) => /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, { rotate: isActive ? 90 : 0 })
98
+ },
99
+ parentContext.collapse,
100
+ collapse
101
+ ),
92
102
  form: (0, import_lodash.merge)(
93
103
  {},
94
104
  {
@@ -10,11 +10,11 @@ export default function useItems(items?: DescriptionsItemType[], children?: Reac
10
10
  sm?: number;
11
11
  xs?: number;
12
12
  };
13
- className?: string;
13
+ label?: React.ReactNode;
14
14
  style?: React.CSSProperties;
15
- prefixCls?: string;
16
15
  key?: React.Key;
17
- label?: React.ReactNode;
16
+ className?: string;
17
+ prefixCls?: string;
18
18
  labelStyle?: React.CSSProperties;
19
19
  contentStyle?: React.CSSProperties;
20
20
  }[];
@@ -47,7 +47,8 @@ var genTableStyle = (token) => {
47
47
  backgroundColor: colorBgBase,
48
48
  borderRadius: borderRadiusLG,
49
49
  [`${componentCls}-footer`]: {
50
- borderBottom: `1px solid ${colorBorderSecondary}`
50
+ borderBottom: `1px solid ${colorBorderSecondary}`,
51
+ borderRadius: 0
51
52
  },
52
53
  // 单元格通用样式
53
54
  [`${componentCls}-thead, ${componentCls}-tbody`]: {
@@ -140,11 +141,6 @@ var genTableStyle = (token) => {
140
141
  }
141
142
  }
142
143
  },
143
- // 非可展开表格、带 footer 表格、空表格、带边框表格: 底部添加分隔线
144
- [`${componentCls}-wrapper:not(${componentCls}-expandable):not(${componentCls}-has-footer) ${componentCls}:not(${componentCls}-bordered):not(${componentCls}-empty)`]: {
145
- borderBottom: `1px solid ${colorBorderSecondary}`,
146
- borderRadius: 0
147
- },
148
144
  // 滚动表格样式
149
145
  // 由于滚动表格会在 tbody 下最前面多一个 tr 元素,因此需要设置相反的斑马条样式
150
146
  // .ant-table-scroll-horizontal: 水平滚动
@@ -160,6 +156,43 @@ var genTableStyle = (token) => {
160
156
  }
161
157
  }
162
158
  },
159
+ // 带边框的表格样式
160
+ [`${componentCls}-wrapper ${componentCls}${componentCls}-bordered`]: {
161
+ [`${componentCls}-footer`]: {
162
+ borderRadius: `0px 0px ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
163
+ }
164
+ },
165
+ // 带边框但不带 footer 的表格样式
166
+ [`${componentCls}-wrapper:not(${componentCls}-has-footer) ${componentCls}${componentCls}-bordered`]: {
167
+ // 表格容器设置圆角
168
+ [`${componentCls}-container`]: {
169
+ borderRadius: token.borderRadiusLG
170
+ },
171
+ [`${componentCls}-tbody`]: {
172
+ // 最后一行左右单元格增加圆角
173
+ [`tr:last-child >*:first-child`]: {
174
+ borderEndStartRadius: token.borderRadiusLG
175
+ },
176
+ [`tr:last-child >*:last-child`]: {
177
+ borderEndEndRadius: token.borderRadiusLG
178
+ }
179
+ }
180
+ },
181
+ // 非可展开表格、不带 footer 表格、非空表格、不带边框表格: 底部添加分隔线
182
+ [`${componentCls}-wrapper:not(${componentCls}-expandable):not(${componentCls}-has-footer) ${componentCls}:not(${componentCls}-bordered):not(${componentCls}-empty)`]: {
183
+ borderBottom: `1px solid ${colorBorderSecondary}`,
184
+ borderRadius: 0
185
+ },
186
+ // 去掉非展开表格的边框
187
+ [`${componentCls}-wrapper:not(${componentCls}-expandable)`]: {
188
+ [`${componentCls}:not(${componentCls}-bordered)`]: {
189
+ [`${componentCls}-tbody`]: {
190
+ [`tr:not(${componentCls}-measure-row) > td`]: {
191
+ border: "none"
192
+ }
193
+ }
194
+ }
195
+ },
163
196
  // 可展开表格样式
164
197
  [`${componentCls}-wrapper${componentCls}-expandable`]: {
165
198
  [`${componentCls}`]: {
@@ -253,6 +286,14 @@ var genTableStyle = (token) => {
253
286
  [`${antCls}-popover-inner`]: {
254
287
  padding: 0
255
288
  }
289
+ },
290
+ // Popover、Tooltip 等弹出层中的表格空状态高度设为自动,避免高度过大撑高弹出层
291
+ [`${antCls}-popover, ${antCls}-tooltip`]: {
292
+ [`${componentCls} ${componentCls}-tbody`]: {
293
+ [`${componentCls}-empty-wrapper`]: {
294
+ minHeight: "auto"
295
+ }
296
+ }
256
297
  }
257
298
  };
258
299
  };
@@ -112,6 +112,9 @@ var defaultTheme = {
112
112
  fontHeight: 20,
113
113
  lastItemColor: "#5c6b8a"
114
114
  },
115
+ Collapse: {
116
+ colorBorder: "#E2E8F3"
117
+ },
115
118
  InputNumber: {
116
119
  handleVisible: true
117
120
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oceanbase/design",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "The Design System of OceanBase",
5
5
  "keywords": [
6
6
  "oceanbase",
@@ -30,14 +30,19 @@
30
30
  "README.md",
31
31
  "LICENSE"
32
32
  ],
33
+ "sideEffects": [
34
+ "**/*.less",
35
+ "**/*.css",
36
+ "es/index.js"
37
+ ],
33
38
  "scripts": {
34
39
  "build": "father build && cp src/style/reset.css dist/"
35
40
  },
36
41
  "dependencies": {
37
42
  "@ant-design/cssinjs": "^1.22.0",
38
43
  "@oceanbase/aliyun-theme": "^0.1.6",
39
- "@oceanbase/icons": "^0.4.1",
40
- "@oceanbase/util": "^0.4.1",
44
+ "@oceanbase/icons": "^0.4.2",
45
+ "@oceanbase/util": "^0.4.2",
41
46
  "ahooks": "^2.10.14",
42
47
  "antd": "^5.22.1",
43
48
  "classnames": "^2.5.1",
@@ -60,5 +65,5 @@
60
65
  "react": ">=16.9.0",
61
66
  "react-dom": ">=16.9.0"
62
67
  },
63
- "gitHead": "67c1567aad182c4b3b7ecb421928fa3c87f321e0"
68
+ "gitHead": "c2d5b32ba8c8a2ec90de8477cfa0bb808b616cb7"
64
69
  }