@donglegeyu/company-ui 2.10.0 → 2.12.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.
Files changed (23) hide show
  1. package/dist/cjs/shared-components/PageTitleActions/index.d.ts +55 -0
  2. package/dist/cjs/shared-components/PageTitleActions/index.js +82 -0
  3. package/dist/cjs/shared-components/PageTitleActions/index.scss +20 -0
  4. package/dist/cjs/shared-components/index.d.ts +2 -0
  5. package/dist/cjs/shared-components/index.js +3 -0
  6. package/dist/cjs/template-components/CompanySidebar/FirstSidebar.js +12 -1
  7. package/dist/cjs/template-components/CompanySidebar/SecondSidebar.js +9 -1
  8. package/dist/cjs/template-components/CompanySidebar/index.js +1 -5
  9. package/dist/cjs/template-components/SmartListTemplate/index.d.ts +9 -1
  10. package/dist/cjs/template-components/SmartListTemplate/index.js +31 -26
  11. package/dist/cjs/template-components/SmartListTemplate/index.scss +19 -46
  12. package/dist/es/shared-components/PageTitleActions/index.d.ts +55 -0
  13. package/dist/es/shared-components/PageTitleActions/index.js +90 -0
  14. package/dist/es/shared-components/PageTitleActions/index.scss +20 -0
  15. package/dist/es/shared-components/index.d.ts +2 -0
  16. package/dist/es/shared-components/index.js +1 -0
  17. package/dist/es/template-components/CompanySidebar/FirstSidebar.js +15 -0
  18. package/dist/es/template-components/CompanySidebar/SecondSidebar.js +14 -0
  19. package/dist/es/template-components/CompanySidebar/index.js +4 -9
  20. package/dist/es/template-components/SmartListTemplate/index.d.ts +9 -1
  21. package/dist/es/template-components/SmartListTemplate/index.js +26 -31
  22. package/dist/es/template-components/SmartListTemplate/index.scss +19 -46
  23. package/package.json +2 -2
@@ -0,0 +1,55 @@
1
+ /**
2
+ * PageTitleActions —— 页面标题右侧操作区
3
+ *
4
+ * 将「描述文字 + 链接 + 按钮」这类高频组合收敛为组件:
5
+ * 描述文字三级文本色、链接主色均已内置,业务侧无需每次手写样式描述。
6
+ */
7
+ import { type CSSProperties, type HTMLAttributeAnchorTarget, type MouseEvent, type ReactNode } from "react";
8
+ import "./index.scss";
9
+ /** 操作区里的描述文字(三级文本色,与标题形成视觉层级) */
10
+ export interface PageTitleActionTextProps {
11
+ /** 文字内容 */
12
+ children: ReactNode;
13
+ /** 自定义样式(默认三级文本色,可覆盖) */
14
+ style?: CSSProperties;
15
+ /** 自定义类名 */
16
+ className?: string;
17
+ }
18
+ /** 操作区里的链接(主色文字,区分于描述文字) */
19
+ export interface PageTitleActionLinkProps {
20
+ /** 链接文字 */
21
+ children: ReactNode;
22
+ /** 跳转地址;不传则仅渲染文字(配合 onClick 做站内路由跳转) */
23
+ href?: string;
24
+ /** 打开方式(如新标签页 `_blank`) */
25
+ target?: HTMLAttributeAnchorTarget;
26
+ /** 点击回调(站内路由跳转时传) */
27
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
28
+ /** 自定义样式(默认主色,可覆盖) */
29
+ style?: CSSProperties;
30
+ /** 自定义类名 */
31
+ className?: string;
32
+ }
33
+ export interface PageTitleActionsProps {
34
+ /** 操作区内容:PageTitleActions.Text / PageTitleActions.Link / CompanyButton 等任意节点 */
35
+ children?: ReactNode;
36
+ /** 自定义样式 */
37
+ style?: CSSProperties;
38
+ /** 自定义类名 */
39
+ className?: string;
40
+ }
41
+ /** 描述文字子组件:三级文本色 */
42
+ declare function ActionText({ children, style, className }: PageTitleActionTextProps): import("react").JSX.Element;
43
+ /** 链接子组件:主色文字;href + target 走外链(新标签页),仅 onClick 走站内路由 */
44
+ declare function ActionLink({ children, href, target, onClick, style, className, }: PageTitleActionLinkProps): import("react").JSX.Element;
45
+ /**
46
+ * 页面标题右侧操作区。
47
+ * 裸字符串 / 数字子元素自动按描述文字样式(三级文本色)渲染,
48
+ * 免去每次手写 style 描述;Text / Link / 按钮等节点原样透出,不注入额外样式。
49
+ */
50
+ declare function PageTitleActions({ children, style, className }: PageTitleActionsProps): import("react").JSX.Element;
51
+ declare const PageTitleActionsWithStatics: typeof PageTitleActions & {
52
+ Text: typeof ActionText;
53
+ Link: typeof ActionLink;
54
+ };
55
+ export default PageTitleActionsWithStatics;
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/shared-components/PageTitleActions/index.tsx
20
+ var PageTitleActions_exports = {};
21
+ __export(PageTitleActions_exports, {
22
+ default: () => PageTitleActions_default
23
+ });
24
+ module.exports = __toCommonJS(PageTitleActions_exports);
25
+ var import_index = require("./index.scss");
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ function ActionText({ children, style, className }) {
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `page-title-action-text${className ? ` ${className}` : ""}`, style, children });
29
+ }
30
+ function ActionLink({
31
+ children,
32
+ href,
33
+ target,
34
+ onClick,
35
+ style,
36
+ className
37
+ }) {
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ "a",
40
+ {
41
+ className: `page-title-action-link${className ? ` ${className}` : ""}`,
42
+ href,
43
+ target,
44
+ onClick,
45
+ style,
46
+ children
47
+ }
48
+ );
49
+ }
50
+ function PageTitleActions({ children, style, className }) {
51
+ const childList = children === null || children === void 0 ? [] : Array.isArray(children) ? children : [children];
52
+ const items = [];
53
+ let textBuffer = [];
54
+ let wrappedCount = 0;
55
+ const flushText = () => {
56
+ if (textBuffer.length > 0) {
57
+ items.push(
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "page-title-action-text", children: textBuffer }, `text-${wrappedCount}`)
59
+ );
60
+ textBuffer = [];
61
+ wrappedCount += 1;
62
+ }
63
+ };
64
+ childList.forEach((child) => {
65
+ if (child === null || child === void 0 || child === false || child === true) {
66
+ return;
67
+ }
68
+ if (typeof child === "string" || typeof child === "number") {
69
+ textBuffer.push(child);
70
+ } else {
71
+ flushText();
72
+ items.push(child);
73
+ }
74
+ });
75
+ flushText();
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `page-title-actions-group${className ? ` ${className}` : ""}`, style, children: items });
77
+ }
78
+ var PageTitleActionsWithStatics = Object.assign(PageTitleActions, {
79
+ Text: ActionText,
80
+ Link: ActionLink
81
+ });
82
+ var PageTitleActions_default = PageTitleActionsWithStatics;
@@ -0,0 +1,20 @@
1
+ .page-title-actions-group {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ font-size: 14px;
6
+ }
7
+
8
+ .page-title-action-text {
9
+ font-size: 14px;
10
+ font-weight: normal;
11
+ color: var(--color-text-tertiary);
12
+ }
13
+
14
+ .page-title-action-link {
15
+ font-size: 14px;
16
+ font-weight: normal;
17
+ color: var(--color-primary);
18
+ cursor: pointer;
19
+ text-decoration: none;
20
+ }
@@ -2,6 +2,8 @@ export { default as SvgIcon } from "./SvgIcon";
2
2
  export { default as ActionCell } from "./ActionCell";
3
3
  export type { ActionButton } from "./ActionCell";
4
4
  export { default as PageTitle } from "./PageTitle";
5
+ export { default as PageTitleActions } from "./PageTitleActions";
6
+ export type { PageTitleActionsProps, PageTitleActionTextProps, PageTitleActionLinkProps, } from "./PageTitleActions";
5
7
  export { default as FormFooterActions } from "./FormFooterActions";
6
8
  export { default as SectionTitle } from "./SectionTitle";
7
9
  export { default as BaseInfoForm } from "./BaseInfoForm";
@@ -40,6 +40,7 @@ __export(shared_components_exports, {
40
40
  IconGallery: () => import_IconGallery.default,
41
41
  IconParkGallery: () => import_IconParkGallery.default,
42
42
  PageTitle: () => import_PageTitle.default,
43
+ PageTitleActions: () => import_PageTitleActions.default,
43
44
  SectionTitle: () => import_SectionTitle.default,
44
45
  SvgIcon: () => import_SvgIcon.default,
45
46
  ViewSwitcher: () => import_ViewSwitcher.default,
@@ -49,6 +50,7 @@ module.exports = __toCommonJS(shared_components_exports);
49
50
  var import_SvgIcon = __toESM(require("./SvgIcon"));
50
51
  var import_ActionCell = __toESM(require("./ActionCell"));
51
52
  var import_PageTitle = __toESM(require("./PageTitle"));
53
+ var import_PageTitleActions = __toESM(require("./PageTitleActions"));
52
54
  var import_FormFooterActions = __toESM(require("./FormFooterActions"));
53
55
  var import_SectionTitle = __toESM(require("./SectionTitle"));
54
56
  var import_BaseInfoForm = __toESM(require("./BaseInfoForm"));
@@ -74,6 +76,7 @@ var import_useIconPark = require("./IconParkGallery/useIconPark");
74
76
  IconGallery,
75
77
  IconParkGallery,
76
78
  PageTitle,
79
+ PageTitleActions,
77
80
  SectionTitle,
78
81
  SvgIcon,
79
82
  ViewSwitcher,
@@ -22,6 +22,7 @@ __export(FirstSidebar_exports, {
22
22
  default: () => FirstSidebar
23
23
  });
24
24
  module.exports = __toCommonJS(FirstSidebar_exports);
25
+ var import_react = require("react");
25
26
  var import_basic_components = require("../../basic-components");
26
27
  var import_shared_components = require("../../shared-components");
27
28
  var import_index = require("./index.scss");
@@ -60,7 +61,17 @@ function FirstSidebar({
60
61
  return businessMenus.slice(0, visibleMenuCount);
61
62
  })();
62
63
  const currentDomain = domains.find((d) => d.id === currentDomainId);
63
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-sidebar-first", children: [
64
+ const rootRef = (0, import_react.useRef)(null);
65
+ (0, import_react.useEffect)(() => {
66
+ const root = rootRef.current;
67
+ if (!root)
68
+ return;
69
+ root.querySelectorAll(".menu-item.active, .business-menu-item.active").forEach((el) => {
70
+ var _a;
71
+ return (_a = el.scrollIntoView) == null ? void 0 : _a.call(el, { block: "nearest" });
72
+ });
73
+ }, [activeFirstMenu, activeKey]);
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-sidebar-first", ref: rootRef, children: [
64
75
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "brand-area", children: [
65
76
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
77
  import_basic_components.CompanyPopover,
@@ -22,6 +22,7 @@ __export(SecondSidebar_exports, {
22
22
  default: () => SecondSidebar
23
23
  });
24
24
  module.exports = __toCommonJS(SecondSidebar_exports);
25
+ var import_react = require("react");
25
26
  var import_shared_components = require("../../shared-components");
26
27
  var import_index = require("./index.scss");
27
28
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -46,6 +47,13 @@ function SecondSidebar({
46
47
  }) {
47
48
  const showSecondSidebar = activeFirstMenu && activeFirstMenu !== "home" ? secondSidebarHovered || secondSidebarFixed : false;
48
49
  const isFavorites = activeFirstMenu === "favorites";
50
+ const menuListRef = (0, import_react.useRef)(null);
51
+ (0, import_react.useEffect)(() => {
52
+ var _a, _b, _c;
53
+ if (!showSecondSidebar)
54
+ return;
55
+ (_c = (_b = (_a = menuListRef.current) == null ? void 0 : _a.querySelector(".menu-item.active")) == null ? void 0 : _b.scrollIntoView) == null ? void 0 : _c.call(_b, { block: "nearest" });
56
+ }, [showSecondSidebar, activeKey, expandedKeys, isFavorites, secondMenus]);
49
57
  const favoriteItems = (favorites || []).map((item) => ({
50
58
  key: item.menuKey,
51
59
  label: item.menuLabel || "未命名",
@@ -208,7 +216,7 @@ function SecondSidebar({
208
216
  onMouseEnter,
209
217
  onMouseLeave,
210
218
  children: [
211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "menu-list", children: isFavorites ? renderFavorites() : renderMenus() }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "menu-list", ref: menuListRef, children: isFavorites ? renderFavorites() : renderMenus() }),
212
220
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "collapse-container", children: [
213
221
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "collapse-divider" }),
214
222
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "collapse-btn", onClick: onToggleFixed, children: [
@@ -102,7 +102,6 @@ function CompanySidebar({
102
102
  hoverKey: null,
103
103
  moreDrawerOpen: false,
104
104
  customNavVisible: false,
105
- localExpandedKeys: expandedKeys,
106
105
  localFavorites: favorites,
107
106
  hasError: false
108
107
  });
@@ -128,9 +127,6 @@ function CompanySidebar({
128
127
  },
129
128
  [leafToFirstKeyMap, activeFirstMenu, onFirstMenuSelect, onMenuClick]
130
129
  );
131
- (0, import_react.useEffect)(() => {
132
- setState((prev) => ({ ...prev, localExpandedKeys: expandedKeys }));
133
- }, [expandedKeys]);
134
130
  (0, import_react.useEffect)(() => {
135
131
  setState((prev) => ({ ...prev, localFavorites: favorites }));
136
132
  }, [favorites]);
@@ -283,7 +279,7 @@ function CompanySidebar({
283
279
  secondSidebarFixed,
284
280
  secondMenus: displaySecondMenus,
285
281
  favorites: state.localFavorites,
286
- expandedKeys: state.localExpandedKeys,
282
+ expandedKeys,
287
283
  emptyImage,
288
284
  onMenuClick: (menu) => {
289
285
  handleLeafMenuClick(menu);
@@ -34,10 +34,18 @@ interface SmartListTemplateProps {
34
34
  record: RecordType;
35
35
  expandedRowKeys: string[];
36
36
  }) => void;
37
+ /**
38
+ * 标题右侧操作区:渲染在视图切换器之后,与其同处标题右侧区域
39
+ * (内部映射到 `PageTitle.titleExtra` 的尾部,保持既有位置)。
40
+ * 后续版本将收敛到 `titleExtra`,新代码建议直接使用 `titleExtra`。
41
+ */
37
42
  titleActions?: ReactNode;
38
43
  /** 紧跟标题右侧的区域:标题的延伸/补充(如状态标签、计数) */
39
44
  titleExtra?: ReactNode;
40
- /** 标题栏最右侧的独立操作区:与标题解耦(如按钮组、描述+link) */
45
+ /**
46
+ * 标题栏最右侧的独立操作区:与标题解耦(如按钮组、描述+link)
47
+ * (内部映射到 `PageTitle.actions`)。
48
+ */
41
49
  titleRightActions?: ReactNode;
42
50
  toolbarActions?: ReactNode;
43
51
  toolbarRightActions?: ReactNode;
@@ -365,7 +365,7 @@ function SmartListTemplate({
365
365
  }, [effectiveFilterParams, isRecordingBaseline, hasSearched, initializedFilterParams]);
366
366
  const updateTableHeight = (0, import_react.useCallback)(() => {
367
367
  var _a, _b, _c, _d, _e;
368
- const header = ((_a = document.querySelector(".page-header")) == null ? void 0 : _a.clientHeight) || 0;
368
+ const header = ((_a = document.querySelector(".smart-list-template .page-title")) == null ? void 0 : _a.clientHeight) || 0;
369
369
  const filter = ((_b = document.querySelector(".filter-form")) == null ? void 0 : _b.clientHeight) || 0;
370
370
  const toolbar = ((_c = document.querySelector(".toolbar")) == null ? void 0 : _c.clientHeight) || 0;
371
371
  const paginationEl = ((_d = document.querySelector(".pagination")) == null ? void 0 : _d.clientHeight) || 56;
@@ -392,31 +392,36 @@ function SmartListTemplate({
392
392
  };
393
393
  }, [pagination, paginationConfig]);
394
394
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "smart-list-template", children: [
395
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "page-header", children: [
396
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "page-title", children: title }),
397
- titleExtra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "page-title-extra", children: titleExtra }),
398
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "page-header-actions", children: [
399
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "page-header-line" }),
400
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
401
- import_shared_components.ViewSwitcher,
402
- {
403
- viewEndpoint,
404
- fields,
405
- filterParams: effectiveFilterParams,
406
- modified: hasModified,
407
- searched: hasSearched,
408
- onSchemeChange: handleViewSchemeChange,
409
- onCurrentSchemeChange: setCurrentScheme,
410
- onSchemesChange: setFilterSchemes,
411
- onEditScheme: updateFilterParams,
412
- onSaved: handleViewSaved,
413
- onSaveAsOpen: handleViewSaveAsOpen
414
- }
415
- ),
416
- titleActions
417
- ] }),
418
- titleRightActions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "page-header-right", children: titleRightActions })
419
- ] }),
395
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
396
+ import_shared_components.PageTitle,
397
+ {
398
+ title,
399
+ titleExtra: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "sl-title-extra", children: [
400
+ titleExtra,
401
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "sl-title-actions", children: [
402
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sl-title-divider" }),
403
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
404
+ import_shared_components.ViewSwitcher,
405
+ {
406
+ viewEndpoint,
407
+ fields,
408
+ filterParams: effectiveFilterParams,
409
+ modified: hasModified,
410
+ searched: hasSearched,
411
+ onSchemeChange: handleViewSchemeChange,
412
+ onCurrentSchemeChange: setCurrentScheme,
413
+ onSchemesChange: setFilterSchemes,
414
+ onEditScheme: updateFilterParams,
415
+ onSaved: handleViewSaved,
416
+ onSaveAsOpen: handleViewSaveAsOpen
417
+ }
418
+ ),
419
+ titleActions
420
+ ] })
421
+ ] }),
422
+ actions: titleRightActions
423
+ }
424
+ ),
420
425
  displayFilterItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
421
426
  import_FilterForm.default,
422
427
  {
@@ -9,55 +9,28 @@
9
9
  overflow: hidden;
10
10
  box-sizing: border-box;
11
11
  background: var(--color-bg-layout);
12
- }
13
-
14
- .page-header {
15
- display: flex;
16
- align-items: center;
17
- height: 48px;
18
- padding: 0;
19
- gap: 16px;
20
- align-self: stretch;
21
- z-index: 0;
22
- }
23
-
24
- .page-title {
25
- font-size: 16px;
26
- font-weight: 600;
27
- color: rgba(0, 0, 0, 0.88);
28
- margin: 0;
29
- line-height: 24px;
30
- }
31
-
32
- .page-title-extra {
33
- display: flex;
34
- align-items: center;
35
- gap: 4px;
36
- font-size: 14px;
37
- color: rgba(0, 0, 0, 0.65);
38
- }
39
12
 
40
- .page-header-actions {
41
- display: flex;
42
- align-items: center;
43
- gap: 12px;
44
- margin-left: 0;
45
- margin-right: 0;
46
- flex-shrink: 0;
47
- }
13
+ // 标题右侧区域:标题 → 分割线 → 视图切换 → titleActions
14
+ // PageTitle 的 .page-title-left 已有 gap:8px,此处补 8px margin-left 凑齐 16px(与 StatisticsListPage/TreeTableTemplate 一致)
15
+ .sl-title-extra {
16
+ display: flex;
17
+ align-items: center;
18
+ gap: calc(var(--spacing-md, 16) * 1px);
19
+ margin-left: calc(var(--spacing-xs, 8) * 1px);
20
+ }
48
21
 
49
- .page-header-right {
50
- display: flex;
51
- align-items: center;
52
- gap: 8px;
53
- margin-left: auto;
54
- flex-shrink: 0;
55
- }
22
+ .sl-title-actions {
23
+ display: flex;
24
+ align-items: center;
25
+ gap: calc(var(--spacing-sm, 12) * 1px);
26
+ flex-shrink: 0;
27
+ }
56
28
 
57
- .page-header-line {
58
- width: 1px;
59
- height: 16px;
60
- background-color: var(--color-border);
29
+ .sl-title-divider {
30
+ width: 1px;
31
+ height: 16px;
32
+ background-color: var(--color-border);
33
+ }
61
34
  }
62
35
 
63
36
  .filter-gap {
@@ -0,0 +1,55 @@
1
+ /**
2
+ * PageTitleActions —— 页面标题右侧操作区
3
+ *
4
+ * 将「描述文字 + 链接 + 按钮」这类高频组合收敛为组件:
5
+ * 描述文字三级文本色、链接主色均已内置,业务侧无需每次手写样式描述。
6
+ */
7
+ import { type CSSProperties, type HTMLAttributeAnchorTarget, type MouseEvent, type ReactNode } from "react";
8
+ import "./index.scss";
9
+ /** 操作区里的描述文字(三级文本色,与标题形成视觉层级) */
10
+ export interface PageTitleActionTextProps {
11
+ /** 文字内容 */
12
+ children: ReactNode;
13
+ /** 自定义样式(默认三级文本色,可覆盖) */
14
+ style?: CSSProperties;
15
+ /** 自定义类名 */
16
+ className?: string;
17
+ }
18
+ /** 操作区里的链接(主色文字,区分于描述文字) */
19
+ export interface PageTitleActionLinkProps {
20
+ /** 链接文字 */
21
+ children: ReactNode;
22
+ /** 跳转地址;不传则仅渲染文字(配合 onClick 做站内路由跳转) */
23
+ href?: string;
24
+ /** 打开方式(如新标签页 `_blank`) */
25
+ target?: HTMLAttributeAnchorTarget;
26
+ /** 点击回调(站内路由跳转时传) */
27
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
28
+ /** 自定义样式(默认主色,可覆盖) */
29
+ style?: CSSProperties;
30
+ /** 自定义类名 */
31
+ className?: string;
32
+ }
33
+ export interface PageTitleActionsProps {
34
+ /** 操作区内容:PageTitleActions.Text / PageTitleActions.Link / CompanyButton 等任意节点 */
35
+ children?: ReactNode;
36
+ /** 自定义样式 */
37
+ style?: CSSProperties;
38
+ /** 自定义类名 */
39
+ className?: string;
40
+ }
41
+ /** 描述文字子组件:三级文本色 */
42
+ declare function ActionText({ children, style, className }: PageTitleActionTextProps): import("react").JSX.Element;
43
+ /** 链接子组件:主色文字;href + target 走外链(新标签页),仅 onClick 走站内路由 */
44
+ declare function ActionLink({ children, href, target, onClick, style, className, }: PageTitleActionLinkProps): import("react").JSX.Element;
45
+ /**
46
+ * 页面标题右侧操作区。
47
+ * 裸字符串 / 数字子元素自动按描述文字样式(三级文本色)渲染,
48
+ * 免去每次手写 style 描述;Text / Link / 按钮等节点原样透出,不注入额外样式。
49
+ */
50
+ declare function PageTitleActions({ children, style, className }: PageTitleActionsProps): import("react").JSX.Element;
51
+ declare const PageTitleActionsWithStatics: typeof PageTitleActions & {
52
+ Text: typeof ActionText;
53
+ Link: typeof ActionLink;
54
+ };
55
+ export default PageTitleActionsWithStatics;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * PageTitleActions —— 页面标题右侧操作区
3
+ *
4
+ * 将「描述文字 + 链接 + 按钮」这类高频组合收敛为组件:
5
+ * 描述文字三级文本色、链接主色均已内置,业务侧无需每次手写样式描述。
6
+ */
7
+
8
+ import "./index.scss";
9
+
10
+ /** 操作区里的描述文字(三级文本色,与标题形成视觉层级) */
11
+
12
+ /** 操作区里的链接(主色文字,区分于描述文字) */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ /** 描述文字子组件:三级文本色 */
15
+ function ActionText(_ref) {
16
+ var children = _ref.children,
17
+ style = _ref.style,
18
+ className = _ref.className;
19
+ return /*#__PURE__*/_jsx("span", {
20
+ className: "page-title-action-text".concat(className ? " ".concat(className) : ""),
21
+ style: style,
22
+ children: children
23
+ });
24
+ }
25
+
26
+ /** 链接子组件:主色文字;href + target 走外链(新标签页),仅 onClick 走站内路由 */
27
+ function ActionLink(_ref2) {
28
+ var children = _ref2.children,
29
+ href = _ref2.href,
30
+ target = _ref2.target,
31
+ onClick = _ref2.onClick,
32
+ style = _ref2.style,
33
+ className = _ref2.className;
34
+ return /*#__PURE__*/_jsx("a", {
35
+ className: "page-title-action-link".concat(className ? " ".concat(className) : ""),
36
+ href: href,
37
+ target: target,
38
+ onClick: onClick,
39
+ style: style,
40
+ children: children
41
+ });
42
+ }
43
+
44
+ /**
45
+ * 页面标题右侧操作区。
46
+ * 裸字符串 / 数字子元素自动按描述文字样式(三级文本色)渲染,
47
+ * 免去每次手写 style 描述;Text / Link / 按钮等节点原样透出,不注入额外样式。
48
+ */
49
+ function PageTitleActions(_ref3) {
50
+ var children = _ref3.children,
51
+ style = _ref3.style,
52
+ className = _ref3.className;
53
+ var childList = children === null || children === undefined ? [] : Array.isArray(children) ? children : [children];
54
+ var items = [];
55
+ var textBuffer = [];
56
+ var wrappedCount = 0;
57
+ var flushText = function flushText() {
58
+ if (textBuffer.length > 0) {
59
+ items.push( /*#__PURE__*/_jsx("span", {
60
+ className: "page-title-action-text",
61
+ children: textBuffer
62
+ }, "text-".concat(wrappedCount)));
63
+ textBuffer = [];
64
+ wrappedCount += 1;
65
+ }
66
+ };
67
+ childList.forEach(function (child) {
68
+ // 空节点跳过;裸字符串/数字兜底按描述文字渲染;其余节点(Text/Link/按钮等)原样透出
69
+ if (child === null || child === undefined || child === false || child === true) {
70
+ return;
71
+ }
72
+ if (typeof child === "string" || typeof child === "number") {
73
+ textBuffer.push(child);
74
+ } else {
75
+ flushText();
76
+ items.push(child);
77
+ }
78
+ });
79
+ flushText();
80
+ return /*#__PURE__*/_jsx("div", {
81
+ className: "page-title-actions-group".concat(className ? " ".concat(className) : ""),
82
+ style: style,
83
+ children: items
84
+ });
85
+ }
86
+ var PageTitleActionsWithStatics = Object.assign(PageTitleActions, {
87
+ Text: ActionText,
88
+ Link: ActionLink
89
+ });
90
+ export default PageTitleActionsWithStatics;
@@ -0,0 +1,20 @@
1
+ .page-title-actions-group {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ font-size: 14px;
6
+ }
7
+
8
+ .page-title-action-text {
9
+ font-size: 14px;
10
+ font-weight: normal;
11
+ color: var(--color-text-tertiary);
12
+ }
13
+
14
+ .page-title-action-link {
15
+ font-size: 14px;
16
+ font-weight: normal;
17
+ color: var(--color-primary);
18
+ cursor: pointer;
19
+ text-decoration: none;
20
+ }
@@ -2,6 +2,8 @@ export { default as SvgIcon } from "./SvgIcon";
2
2
  export { default as ActionCell } from "./ActionCell";
3
3
  export type { ActionButton } from "./ActionCell";
4
4
  export { default as PageTitle } from "./PageTitle";
5
+ export { default as PageTitleActions } from "./PageTitleActions";
6
+ export type { PageTitleActionsProps, PageTitleActionTextProps, PageTitleActionLinkProps, } from "./PageTitleActions";
5
7
  export { default as FormFooterActions } from "./FormFooterActions";
6
8
  export { default as SectionTitle } from "./SectionTitle";
7
9
  export { default as BaseInfoForm } from "./BaseInfoForm";
@@ -1,6 +1,7 @@
1
1
  export { default as SvgIcon } from "./SvgIcon";
2
2
  export { default as ActionCell } from "./ActionCell";
3
3
  export { default as PageTitle } from "./PageTitle";
4
+ export { default as PageTitleActions } from "./PageTitleActions";
4
5
  export { default as FormFooterActions } from "./FormFooterActions";
5
6
  export { default as SectionTitle } from "./SectionTitle";
6
7
  export { default as BaseInfoForm } from "./BaseInfoForm";
@@ -1,3 +1,4 @@
1
+ import { useEffect, useRef } from "react";
1
2
  import { CompanyPopover } from "../../basic-components";
2
3
  import { SvgIcon } from "../../shared-components";
3
4
  import "./index.scss";
@@ -40,8 +41,22 @@ export default function FirstSidebar(_ref) {
40
41
  var currentDomain = domains.find(function (d) {
41
42
  return d.id === currentDomainId;
42
43
  });
44
+
45
+ // active 项滚动定位:挂载与选中变化后把高亮项滚入可视区(block:"nearest",已在可视区则不动)
46
+ var rootRef = useRef(null);
47
+ useEffect(function () {
48
+ var root = rootRef.current;
49
+ if (!root) return;
50
+ root.querySelectorAll(".menu-item.active, .business-menu-item.active").forEach(function (el) {
51
+ var _el$scrollIntoView;
52
+ return (_el$scrollIntoView = el.scrollIntoView) === null || _el$scrollIntoView === void 0 ? void 0 : _el$scrollIntoView.call(el, {
53
+ block: "nearest"
54
+ });
55
+ });
56
+ }, [activeFirstMenu, activeKey]);
43
57
  return /*#__PURE__*/_jsxs("div", {
44
58
  className: "company-sidebar-first",
59
+ ref: rootRef,
45
60
  children: [/*#__PURE__*/_jsxs("div", {
46
61
  className: "brand-area",
47
62
  children: [/*#__PURE__*/_jsx(CompanyPopover, {
@@ -8,6 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
9
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
10
  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; }
11
+ import { useEffect, useRef } from "react";
11
12
  import { SvgIcon } from "../../shared-components";
12
13
  import "./index.scss";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -32,6 +33,18 @@ export default function SecondSidebar(_ref) {
32
33
  isFavorited = _ref.isFavorited;
33
34
  var showSecondSidebar = activeFirstMenu && activeFirstMenu !== "home" ? secondSidebarHovered || secondSidebarFixed : false;
34
35
  var isFavorites = activeFirstMenu === "favorites";
36
+
37
+ // active 项滚动定位:二级栏显示 / 选中项 / 分组展开变化后,把高亮项滚入可视区。
38
+ // 隐藏项(display:none)的 scrollIntoView 是 no-op;分组展开由 expandedKeys 渲染期直接生效,
39
+ // 父组件同拍传 expandedKeys + activeKey 时,本 effect 在 DOM 提交后执行即可正确定位
40
+ var menuListRef = useRef(null);
41
+ useEffect(function () {
42
+ var _menuListRef$current, _menuListRef$current$;
43
+ if (!showSecondSidebar) return;
44
+ (_menuListRef$current = menuListRef.current) === null || _menuListRef$current === void 0 || (_menuListRef$current = _menuListRef$current.querySelector(".menu-item.active")) === null || _menuListRef$current === void 0 || (_menuListRef$current$ = _menuListRef$current.scrollIntoView) === null || _menuListRef$current$ === void 0 || _menuListRef$current$.call(_menuListRef$current, {
45
+ block: "nearest"
46
+ });
47
+ }, [showSecondSidebar, activeKey, expandedKeys, isFavorites, secondMenus]);
35
48
  var favoriteItems = (favorites || []).map(function (item) {
36
49
  return {
37
50
  key: item.menuKey,
@@ -203,6 +216,7 @@ export default function SecondSidebar(_ref) {
203
216
  onMouseLeave: onMouseLeave,
204
217
  children: [/*#__PURE__*/_jsx("div", {
205
218
  className: "menu-list",
219
+ ref: menuListRef,
206
220
  children: isFavorites ? renderFavorites() : renderMenus()
207
221
  }), /*#__PURE__*/_jsxs("div", {
208
222
  className: "collapse-container",
@@ -89,7 +89,6 @@ export default function CompanySidebar(_ref) {
89
89
  hoverKey: null,
90
90
  moreDrawerOpen: false,
91
91
  customNavVisible: false,
92
- localExpandedKeys: expandedKeys,
93
92
  localFavorites: favorites,
94
93
  hasError: false
95
94
  }),
@@ -132,13 +131,9 @@ export default function CompanySidebar(_ref) {
132
131
  });
133
132
  onMenuClick(menu);
134
133
  }, [leafToFirstKeyMap, activeFirstMenu, onFirstMenuSelect, onMenuClick]);
135
- useEffect(function () {
136
- setState(function (prev) {
137
- return _objectSpread(_objectSpread({}, prev), {}, {
138
- localExpandedKeys: expandedKeys
139
- });
140
- });
141
- }, [expandedKeys]);
134
+
135
+ // expandedKeys 为纯受控 prop,直接渲染(不镜像进内部 state):
136
+ // effect 镜像会让 prop 变化那一拍仍渲染旧值,消费方 effect 读 DOM 永远滞后一拍
142
137
  useEffect(function () {
143
138
  setState(function (prev) {
144
139
  return _objectSpread(_objectSpread({}, prev), {}, {
@@ -339,7 +334,7 @@ export default function CompanySidebar(_ref) {
339
334
  secondSidebarFixed: secondSidebarFixed,
340
335
  secondMenus: displaySecondMenus,
341
336
  favorites: state.localFavorites,
342
- expandedKeys: state.localExpandedKeys,
337
+ expandedKeys: expandedKeys,
343
338
  emptyImage: emptyImage,
344
339
  onMenuClick: function onMenuClick(menu) {
345
340
  handleLeafMenuClick(menu);
@@ -34,10 +34,18 @@ interface SmartListTemplateProps {
34
34
  record: RecordType;
35
35
  expandedRowKeys: string[];
36
36
  }) => void;
37
+ /**
38
+ * 标题右侧操作区:渲染在视图切换器之后,与其同处标题右侧区域
39
+ * (内部映射到 `PageTitle.titleExtra` 的尾部,保持既有位置)。
40
+ * 后续版本将收敛到 `titleExtra`,新代码建议直接使用 `titleExtra`。
41
+ */
37
42
  titleActions?: ReactNode;
38
43
  /** 紧跟标题右侧的区域:标题的延伸/补充(如状态标签、计数) */
39
44
  titleExtra?: ReactNode;
40
- /** 标题栏最右侧的独立操作区:与标题解耦(如按钮组、描述+link) */
45
+ /**
46
+ * 标题栏最右侧的独立操作区:与标题解耦(如按钮组、描述+link)
47
+ * (内部映射到 `PageTitle.actions`)。
48
+ */
41
49
  titleRightActions?: ReactNode;
42
50
  toolbarActions?: ReactNode;
43
51
  toolbarRightActions?: ReactNode;
@@ -19,7 +19,7 @@ import { CompanyTable, CompanyButton, CompanyPagination, CompanyDropdown, Compan
19
19
  import { ConfigProvider } from "antd";
20
20
  import zhCN from "antd/locale/zh_CN";
21
21
  import FilterForm from "../FilterForm";
22
- import { SvgIcon, EllipsisText, ViewSwitcher } from "../../shared-components";
22
+ import { SvgIcon, EllipsisText, ViewSwitcher, PageTitle } from "../../shared-components";
23
23
  import { createActionColumn, DENSITY_CELL_PADDING, TABLE_CELL_INLINE_PADDING } from "../../shared-components/tableActionColumn";
24
24
  import ColumnSettingsPanel from "../ColumnSettingsPanel";
25
25
  import "./index.scss";
@@ -425,7 +425,7 @@ export default function SmartListTemplate(_ref) {
425
425
  }, [effectiveFilterParams, isRecordingBaseline, hasSearched, initializedFilterParams]);
426
426
  var updateTableHeight = useCallback(function () {
427
427
  var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4, _document$querySelect5;
428
- var header = ((_document$querySelect = document.querySelector(".page-header")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || 0;
428
+ var header = ((_document$querySelect = document.querySelector(".smart-list-template .page-title")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || 0;
429
429
  var filter = ((_document$querySelect2 = document.querySelector(".filter-form")) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.clientHeight) || 0;
430
430
  var toolbar = ((_document$querySelect3 = document.querySelector(".toolbar")) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.clientHeight) || 0;
431
431
  var paginationEl = ((_document$querySelect4 = document.querySelector(".pagination")) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.clientHeight) || 56;
@@ -457,35 +457,30 @@ export default function SmartListTemplate(_ref) {
457
457
  }, [pagination, paginationConfig]);
458
458
  return /*#__PURE__*/_jsxs("div", {
459
459
  className: "smart-list-template",
460
- children: [/*#__PURE__*/_jsxs("div", {
461
- className: "page-header",
462
- children: [/*#__PURE__*/_jsx("h2", {
463
- className: "page-title",
464
- children: title
465
- }), titleExtra && /*#__PURE__*/_jsx("div", {
466
- className: "page-title-extra",
467
- children: titleExtra
468
- }), /*#__PURE__*/_jsxs("div", {
469
- className: "page-header-actions",
470
- children: [/*#__PURE__*/_jsx("div", {
471
- className: "page-header-line"
472
- }), /*#__PURE__*/_jsx(ViewSwitcher, {
473
- viewEndpoint: viewEndpoint,
474
- fields: fields,
475
- filterParams: effectiveFilterParams,
476
- modified: hasModified,
477
- searched: hasSearched,
478
- onSchemeChange: handleViewSchemeChange,
479
- onCurrentSchemeChange: setCurrentScheme,
480
- onSchemesChange: setFilterSchemes,
481
- onEditScheme: updateFilterParams,
482
- onSaved: handleViewSaved,
483
- onSaveAsOpen: handleViewSaveAsOpen
484
- }), titleActions]
485
- }), titleRightActions && /*#__PURE__*/_jsx("div", {
486
- className: "page-header-right",
487
- children: titleRightActions
488
- })]
460
+ children: [/*#__PURE__*/_jsx(PageTitle, {
461
+ title: title,
462
+ titleExtra: /*#__PURE__*/_jsxs("span", {
463
+ className: "sl-title-extra",
464
+ children: [titleExtra, /*#__PURE__*/_jsxs("span", {
465
+ className: "sl-title-actions",
466
+ children: [/*#__PURE__*/_jsx("span", {
467
+ className: "sl-title-divider"
468
+ }), /*#__PURE__*/_jsx(ViewSwitcher, {
469
+ viewEndpoint: viewEndpoint,
470
+ fields: fields,
471
+ filterParams: effectiveFilterParams,
472
+ modified: hasModified,
473
+ searched: hasSearched,
474
+ onSchemeChange: handleViewSchemeChange,
475
+ onCurrentSchemeChange: setCurrentScheme,
476
+ onSchemesChange: setFilterSchemes,
477
+ onEditScheme: updateFilterParams,
478
+ onSaved: handleViewSaved,
479
+ onSaveAsOpen: handleViewSaveAsOpen
480
+ }), titleActions]
481
+ })]
482
+ }),
483
+ actions: titleRightActions
489
484
  }), displayFilterItems.length > 0 && /*#__PURE__*/_jsx(FilterForm, {
490
485
  modelValue: effectiveFilterParams,
491
486
  items: displayFilterItems,
@@ -9,55 +9,28 @@
9
9
  overflow: hidden;
10
10
  box-sizing: border-box;
11
11
  background: var(--color-bg-layout);
12
- }
13
-
14
- .page-header {
15
- display: flex;
16
- align-items: center;
17
- height: 48px;
18
- padding: 0;
19
- gap: 16px;
20
- align-self: stretch;
21
- z-index: 0;
22
- }
23
-
24
- .page-title {
25
- font-size: 16px;
26
- font-weight: 600;
27
- color: rgba(0, 0, 0, 0.88);
28
- margin: 0;
29
- line-height: 24px;
30
- }
31
-
32
- .page-title-extra {
33
- display: flex;
34
- align-items: center;
35
- gap: 4px;
36
- font-size: 14px;
37
- color: rgba(0, 0, 0, 0.65);
38
- }
39
12
 
40
- .page-header-actions {
41
- display: flex;
42
- align-items: center;
43
- gap: 12px;
44
- margin-left: 0;
45
- margin-right: 0;
46
- flex-shrink: 0;
47
- }
13
+ // 标题右侧区域:标题 → 分割线 → 视图切换 → titleActions
14
+ // PageTitle 的 .page-title-left 已有 gap:8px,此处补 8px margin-left 凑齐 16px(与 StatisticsListPage/TreeTableTemplate 一致)
15
+ .sl-title-extra {
16
+ display: flex;
17
+ align-items: center;
18
+ gap: calc(var(--spacing-md, 16) * 1px);
19
+ margin-left: calc(var(--spacing-xs, 8) * 1px);
20
+ }
48
21
 
49
- .page-header-right {
50
- display: flex;
51
- align-items: center;
52
- gap: 8px;
53
- margin-left: auto;
54
- flex-shrink: 0;
55
- }
22
+ .sl-title-actions {
23
+ display: flex;
24
+ align-items: center;
25
+ gap: calc(var(--spacing-sm, 12) * 1px);
26
+ flex-shrink: 0;
27
+ }
56
28
 
57
- .page-header-line {
58
- width: 1px;
59
- height: 16px;
60
- background-color: var(--color-border);
29
+ .sl-title-divider {
30
+ width: 1px;
31
+ height: 16px;
32
+ background-color: var(--color-border);
33
+ }
61
34
  }
62
35
 
63
36
  .filter-gap {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donglegeyu/company-ui",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "postpublish": "node scripts/postpublish.mjs",
41
41
  "release:patch": "npm version patch && npm publish",
42
42
  "verify:no-danger-delete": "node scripts/verify-no-danger-delete.mjs",
43
- "verify:skill-examples": "node scripts/verify-skill-examples.mjs && node scripts/verify-no-danger-delete.mjs"
43
+ "verify:skill-examples": "node scripts/verify-llms-coverage.mjs && node scripts/verify-skill-examples.mjs && node scripts/verify-skill-facts.mjs && node scripts/verify-no-danger-delete.mjs"
44
44
  },
45
45
  "keywords": [
46
46
  "antd",