@donglegeyu/company-ui 2.2.0 → 2.3.0

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.
@@ -4,7 +4,7 @@
4
4
  align-items: center;
5
5
  height: 38px;
6
6
  padding: 8px 0;
7
- margin-bottom: 8px;
7
+ margin-bottom: 0;
8
8
  }
9
9
 
10
10
  .section-title-head {
@@ -36,6 +36,8 @@ export interface DrawerDetailTemplateProps extends Omit<DrawerProps, "onClose" |
36
36
  maskClosable?: boolean;
37
37
  /** 自定义顶部核心区内容(传入后替代内置 name/tags/titleActions/fields 结构) */
38
38
  headerContent?: ReactNode;
39
+ /** 顶部核心区底部是否显示分割线;Tab 模式下 TabBar 自带分割线,可设为 false 避免双线 */
40
+ headerDivider?: boolean;
39
41
  /** 顶部核心区副标题/说明文字(内置结构时渲染在 fields 下方、分割线上方) */
40
42
  description?: ReactNode;
41
43
  /** 内容区分 Tab 配置;不传则直接渲染 children */
@@ -40,6 +40,7 @@ var DrawerDetailTemplateInner = ({
40
40
  width = 440,
41
41
  maskClosable = true,
42
42
  headerContent,
43
+ headerDivider = true,
43
44
  description,
44
45
  tabs,
45
46
  activeTabKey,
@@ -51,7 +52,6 @@ var DrawerDetailTemplateInner = ({
51
52
  styles,
52
53
  ...rest
53
54
  }, ref) => {
54
- const { token } = import_antd.theme.useToken();
55
55
  const isPresent = (value) => value !== void 0 && value !== null;
56
56
  const hasStructuredHeader = isPresent(name) || isPresent(tags) || isPresent(titleActions) || fields && fields.length > 0;
57
57
  const hasHeader = hasStructuredHeader || isPresent(headerContent) || isPresent(description);
@@ -63,12 +63,11 @@ var DrawerDetailTemplateInner = ({
63
63
  };
64
64
  };
65
65
  const bodyNode = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "drawer-detail-template", ref, children: [
66
- hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "drawer-detail-template__header", children: headerContent ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
66
+ hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
67
  "div",
68
68
  {
69
- className: "drawer-detail-template__header-inner",
70
- style: { padding: `${token.paddingMD}px ${token.paddingLG}px` },
71
- children: [
69
+ className: `drawer-detail-template__header${headerDivider ? "" : " drawer-detail-template__header--no-divider"}`,
70
+ children: headerContent ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "drawer-detail-template__header-inner", children: [
72
71
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "drawer-detail-template__name-row", children: [
73
72
  isPresent(name) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "drawer-detail-template__name", children: name }) : null,
74
73
  tags,
@@ -83,23 +82,29 @@ var DrawerDetailTemplateInner = ({
83
82
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "drawer-detail-template__field-value", children: field.value ?? "--" })
84
83
  ] }, index)) }) : null,
85
84
  isPresent(description) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "drawer-detail-template__description", children: description }) : null
86
- ]
85
+ ] })
87
86
  }
88
- ) }) : null,
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "drawer-detail-template__content", children: tabs && tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
- import_basic_components.CompanyTabs,
87
+ ) : null,
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ "div",
91
90
  {
92
- className: "drawer-detail-template__tabs",
93
- activeKey: activeTabKey,
94
- defaultActiveKey: defaultActiveTabKey ?? tabs[0].key,
95
- onChange: onTabChange,
96
- items: tabs.map((tab) => ({
97
- key: tab.key,
98
- label: tab.label,
99
- children: tab.content
100
- }))
91
+ className: `drawer-detail-template__content${tabs && tabs.length > 0 ? " drawer-detail-template__content--tabs" : ""}`,
92
+ children: tabs && tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
93
+ import_basic_components.CompanyTabs,
94
+ {
95
+ className: "drawer-detail-template__tabs",
96
+ activeKey: activeTabKey,
97
+ defaultActiveKey: defaultActiveTabKey ?? tabs[0].key,
98
+ onChange: onTabChange,
99
+ items: tabs.map((tab) => ({
100
+ key: tab.key,
101
+ label: tab.label,
102
+ children: tab.content
103
+ }))
104
+ }
105
+ ) : children
101
106
  }
102
- ) : children })
107
+ )
103
108
  ] });
104
109
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
110
  import_basic_components.CompanyDrawer,
@@ -1,6 +1,6 @@
1
1
  // 抽屉 body 改为 flex 容器且禁止整体滚动——顶部核心区固定、下方内容区滚动
2
- .drawer-detail-template__drawer-body {
3
- padding: 0;
2
+ // 特异性 (0,3,0) 覆盖 antd (.ant-drawer .ant-drawer-body) (0,2,0);padding 恢复 antd 默认 24px
3
+ .ant-drawer .ant-drawer-body.drawer-detail-template__drawer-body {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  overflow: hidden;
@@ -19,6 +19,16 @@
19
19
  background: var(--color-bg-container);
20
20
  }
21
21
 
22
+ // Tab 模式下 TabBar 自带底部分割线,去掉 header 的避免双线
23
+ &__header--no-divider {
24
+ border-bottom: 0;
25
+ }
26
+
27
+ // 内置结构化头部:底部留 24px(分割线上方间距)
28
+ &__header-inner {
29
+ padding-bottom: 24px;
30
+ }
31
+
22
32
  // 大标题行:24px/600 大标题 + 状态 Tag + 弹性占位 + 操作按钮
23
33
  &__name-row {
24
34
  display: flex;
@@ -73,11 +83,22 @@
73
83
  color: var(--color-text-tertiary);
74
84
  }
75
85
 
76
- // 内容区:唯一滚动区域
86
+ // 内容区:唯一滚动区域(顶部留 24px,对齐 header 分割线下方间距)
77
87
  &__content {
78
88
  flex: 1;
79
89
  min-height: 0;
80
90
  overflow: auto;
91
+ padding-top: 24px;
92
+ }
93
+
94
+ // Tab 模式:TabBar 紧贴 header,无上间距
95
+ &__content--tabs {
96
+ padding-top: 0;
97
+ }
98
+
99
+ // 内容区垂直 Space(size="small")行间距由 antd 默认 8px 提到 16px,贴合详情排版
100
+ .ant-space-gap-row-small {
101
+ row-gap: 16px;
81
102
  }
82
103
 
83
104
  // Tab 模式:tabBar 固定在内容区顶部,仅 pane 内容滚动
@@ -88,8 +109,12 @@
88
109
 
89
110
  .ant-tabs-nav {
90
111
  flex-shrink: 0;
91
- margin-bottom: 0;
92
- border-bottom: 1px solid var(--color-border-secondary);
112
+ margin-bottom: 16px;
113
+ }
114
+
115
+ // antd 分割线 ::before 紧贴 tab 文字底部,线下方 16px 才是页签内容(margin 放 nav 上,避免撑高导致线错位)
116
+ .ant-tabs-nav-wrap {
117
+ padding-bottom: 0;
93
118
  }
94
119
 
95
120
  .ant-tabs-content-holder {
@@ -4,7 +4,7 @@
4
4
  align-items: center;
5
5
  height: 38px;
6
6
  padding: 8px 0;
7
- margin-bottom: 8px;
7
+ margin-bottom: 0;
8
8
  }
9
9
 
10
10
  .section-title-head {
@@ -36,6 +36,8 @@ export interface DrawerDetailTemplateProps extends Omit<DrawerProps, "onClose" |
36
36
  maskClosable?: boolean;
37
37
  /** 自定义顶部核心区内容(传入后替代内置 name/tags/titleActions/fields 结构) */
38
38
  headerContent?: ReactNode;
39
+ /** 顶部核心区底部是否显示分割线;Tab 模式下 TabBar 自带分割线,可设为 false 避免双线 */
40
+ headerDivider?: boolean;
39
41
  /** 顶部核心区副标题/说明文字(内置结构时渲染在 fields 下方、分割线上方) */
40
42
  description?: ReactNode;
41
43
  /** 内容区分 Tab 配置;不传则直接渲染 children */
@@ -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 = ["open", "onClose", "title", "name", "tags", "titleActions", "fields", "width", "maskClosable", "headerContent", "description", "tabs", "activeTabKey", "defaultActiveTabKey", "onTabChange", "children", "footer", "classNames", "styles"];
2
+ var _excluded = ["open", "onClose", "title", "name", "tags", "titleActions", "fields", "width", "maskClosable", "headerContent", "headerDivider", "description", "tabs", "activeTabKey", "defaultActiveTabKey", "onTabChange", "children", "footer", "classNames", "styles"];
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; }
@@ -8,7 +8,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { forwardRef } from "react";
11
- import { ConfigProvider, theme } from "antd";
11
+ import { ConfigProvider } from "antd";
12
12
  import { CompanyDrawer, CompanyTabs } from "../../basic-components";
13
13
  import { companyTheme } from "../../theme";
14
14
  import "./index.scss";
@@ -31,6 +31,8 @@ var DrawerDetailTemplateInner = function DrawerDetailTemplateInner(_ref, ref) {
31
31
  _ref$maskClosable = _ref.maskClosable,
32
32
  maskClosable = _ref$maskClosable === void 0 ? true : _ref$maskClosable,
33
33
  headerContent = _ref.headerContent,
34
+ _ref$headerDivider = _ref.headerDivider,
35
+ headerDivider = _ref$headerDivider === void 0 ? true : _ref$headerDivider,
34
36
  description = _ref.description,
35
37
  tabs = _ref.tabs,
36
38
  activeTabKey = _ref.activeTabKey,
@@ -41,8 +43,6 @@ var DrawerDetailTemplateInner = function DrawerDetailTemplateInner(_ref, ref) {
41
43
  classNames = _ref.classNames,
42
44
  styles = _ref.styles,
43
45
  rest = _objectWithoutProperties(_ref, _excluded);
44
- var _theme$useToken = theme.useToken(),
45
- token = _theme$useToken.token;
46
46
  var isPresent = function isPresent(value) {
47
47
  return value !== undefined && value !== null;
48
48
  };
@@ -60,12 +60,9 @@ var DrawerDetailTemplateInner = function DrawerDetailTemplateInner(_ref, ref) {
60
60
  className: "drawer-detail-template",
61
61
  ref: ref,
62
62
  children: [hasHeader ? /*#__PURE__*/_jsx("div", {
63
- className: "drawer-detail-template__header",
63
+ className: "drawer-detail-template__header".concat(headerDivider ? "" : " drawer-detail-template__header--no-divider"),
64
64
  children: headerContent !== null && headerContent !== void 0 ? headerContent : /*#__PURE__*/_jsxs("div", {
65
65
  className: "drawer-detail-template__header-inner",
66
- style: {
67
- padding: "".concat(token.paddingMD, "px ").concat(token.paddingLG, "px")
68
- },
69
66
  children: [/*#__PURE__*/_jsxs("div", {
70
67
  className: "drawer-detail-template__name-row",
71
68
  children: [isPresent(name) ? /*#__PURE__*/_jsx("span", {
@@ -98,7 +95,7 @@ var DrawerDetailTemplateInner = function DrawerDetailTemplateInner(_ref, ref) {
98
95
  }) : null]
99
96
  })
100
97
  }) : null, /*#__PURE__*/_jsx("div", {
101
- className: "drawer-detail-template__content",
98
+ className: "drawer-detail-template__content".concat(tabs && tabs.length > 0 ? " drawer-detail-template__content--tabs" : ""),
102
99
  children: tabs && tabs.length > 0 ? /*#__PURE__*/_jsx(CompanyTabs, {
103
100
  className: "drawer-detail-template__tabs",
104
101
  activeKey: activeTabKey,
@@ -1,6 +1,6 @@
1
1
  // 抽屉 body 改为 flex 容器且禁止整体滚动——顶部核心区固定、下方内容区滚动
2
- .drawer-detail-template__drawer-body {
3
- padding: 0;
2
+ // 特异性 (0,3,0) 覆盖 antd (.ant-drawer .ant-drawer-body) (0,2,0);padding 恢复 antd 默认 24px
3
+ .ant-drawer .ant-drawer-body.drawer-detail-template__drawer-body {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  overflow: hidden;
@@ -19,6 +19,16 @@
19
19
  background: var(--color-bg-container);
20
20
  }
21
21
 
22
+ // Tab 模式下 TabBar 自带底部分割线,去掉 header 的避免双线
23
+ &__header--no-divider {
24
+ border-bottom: 0;
25
+ }
26
+
27
+ // 内置结构化头部:底部留 24px(分割线上方间距)
28
+ &__header-inner {
29
+ padding-bottom: 24px;
30
+ }
31
+
22
32
  // 大标题行:24px/600 大标题 + 状态 Tag + 弹性占位 + 操作按钮
23
33
  &__name-row {
24
34
  display: flex;
@@ -73,11 +83,22 @@
73
83
  color: var(--color-text-tertiary);
74
84
  }
75
85
 
76
- // 内容区:唯一滚动区域
86
+ // 内容区:唯一滚动区域(顶部留 24px,对齐 header 分割线下方间距)
77
87
  &__content {
78
88
  flex: 1;
79
89
  min-height: 0;
80
90
  overflow: auto;
91
+ padding-top: 24px;
92
+ }
93
+
94
+ // Tab 模式:TabBar 紧贴 header,无上间距
95
+ &__content--tabs {
96
+ padding-top: 0;
97
+ }
98
+
99
+ // 内容区垂直 Space(size="small")行间距由 antd 默认 8px 提到 16px,贴合详情排版
100
+ .ant-space-gap-row-small {
101
+ row-gap: 16px;
81
102
  }
82
103
 
83
104
  // Tab 模式:tabBar 固定在内容区顶部,仅 pane 内容滚动
@@ -88,8 +109,12 @@
88
109
 
89
110
  .ant-tabs-nav {
90
111
  flex-shrink: 0;
91
- margin-bottom: 0;
92
- border-bottom: 1px solid var(--color-border-secondary);
112
+ margin-bottom: 16px;
113
+ }
114
+
115
+ // antd 分割线 ::before 紧贴 tab 文字底部,线下方 16px 才是页签内容(margin 放 nav 上,避免撑高导致线错位)
116
+ .ant-tabs-nav-wrap {
117
+ padding-bottom: 0;
93
118
  }
94
119
 
95
120
  .ant-tabs-content-holder {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donglegeyu/company-ui",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",