@hkyhy/marsun-components-core 0.1.98 → 0.1.99
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.
- package/README.md +5 -4
- package/dist/components/Disposition/AlertDispositionPanel/LevelLegend.d.ts +13 -0
- package/dist/components/Disposition/AlertDispositionPanel/LevelLegend.js +36 -0
- package/dist/components/Disposition/AlertDispositionPanel/LevelLegend.js.map +1 -0
- package/dist/components/Disposition/AlertDispositionPanel/index.d.ts +21 -0
- package/dist/components/Disposition/AlertDispositionPanel/index.js +80 -0
- package/dist/components/Disposition/AlertDispositionPanel/index.js.map +1 -0
- package/dist/components/Disposition/AlertDispositionPanel/levelLegend.module.scss.js +10 -0
- package/dist/components/Disposition/AlertDispositionPanel/levelLegend.module.scss.js.map +1 -0
- package/dist/components/Disposition/AlertDispositionPanel/style.module.scss.js +11 -0
- package/dist/components/Disposition/AlertDispositionPanel/types.d.ts +51 -0
- package/dist/components/Disposition/AlertDispositionPanel/types.js +26 -0
- package/dist/components/Disposition/AlertDispositionPanel/types.js.map +1 -0
- package/dist/components/Disposition/DispositionBar/index.js.map +1 -0
- package/dist/components/Disposition/DispositionBar/style.module.scss.js.map +1 -0
- package/dist/components/Disposition/index.d.ts +4 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +715 -707
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +4 -3
- package/dist/components/DispositionBar/index.js.map +0 -1
- /package/dist/components/{DispositionBar → Disposition/AlertDispositionPanel}/style.module.scss.js.map +0 -0
- /package/dist/components/{DispositionBar → Disposition/DispositionBar}/index.d.ts +0 -0
- /package/dist/components/{DispositionBar → Disposition/DispositionBar}/index.js +0 -0
- /package/dist/components/{DispositionBar → Disposition/DispositionBar}/style.module.scss.js +0 -0
package/README.md
CHANGED
|
@@ -125,12 +125,13 @@ npm run typecheck
|
|
|
125
125
|
包名为 **`@hkyhy/marsun-components-core`**(npm scope 与 GitHub 发布账号 `hkyhy` 对齐)。
|
|
126
126
|
|
|
127
127
|
1. 在 GitHub 仓库 **Settings → Secrets → Actions** 配置 `HKYHY_PACKAGE_PUBLISH`(npm Automation Token,对 `@hkyhy` 有 publish 权限)
|
|
128
|
-
2.
|
|
129
|
-
3.
|
|
128
|
+
2. **顺号**:日常 `package.json` = npm latest;本地 `npm pack` **不要**每次 bump。发版前 `node scripts/version-check.mjs --apply`(= npm+1;**0.1.98 之后下一版为 0.1.99**)
|
|
129
|
+
3. **发版**:再提交并 push 首行形如 `chore(release): vX.Y.Z …` 的 commit;`release.yml` 校验版本 → 打 tag → `npm publish`(仅该消息前缀触发,feat push 不发版)
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
#
|
|
133
|
-
|
|
132
|
+
# 当前 npm latest=0.1.98 时
|
|
133
|
+
node scripts/version-check.mjs --apply # → 0.1.99
|
|
134
|
+
# 再 commit chore(release): v0.1.99 … 并 push main
|
|
134
135
|
```
|
|
135
136
|
|
|
136
137
|
也可在 Actions 中手动运行 **Publish npm**,填写已有 tag 重新发布。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DispositionAlertLevelCatalog } from './types';
|
|
3
|
+
export type DispositionAlertLevelLegendProps = {
|
|
4
|
+
catalog: DispositionAlertLevelCatalog;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** 图例标题,默认「等级」 */
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 等级图例:完全由 catalog 驱动,不内置任何产品级数/文案。
|
|
11
|
+
*/
|
|
12
|
+
declare const DispositionAlertLevelLegend: React.FC<DispositionAlertLevelLegendProps>;
|
|
13
|
+
export default DispositionAlertLevelLegend;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as n, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import t from "classnames";
|
|
3
|
+
import e from "./levelLegend.module.scss.js";
|
|
4
|
+
const p = ({
|
|
5
|
+
catalog: l,
|
|
6
|
+
className: r,
|
|
7
|
+
title: a = "等级"
|
|
8
|
+
}) => l.length ? /* @__PURE__ */ n(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: t(
|
|
12
|
+
"marsun-disposition-alert-level-legend",
|
|
13
|
+
e["marsun-disposition-alert-level-legend"],
|
|
14
|
+
r
|
|
15
|
+
),
|
|
16
|
+
"aria-label": a,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ i("span", { className: e["marsun-disposition-alert-level-legend-title"], children: a }),
|
|
19
|
+
l.map((s) => /* @__PURE__ */ n("span", { className: e["marsun-disposition-alert-level-legend-item"], children: [
|
|
20
|
+
/* @__PURE__ */ i(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: e["marsun-disposition-alert-level-legend-dot"],
|
|
24
|
+
style: { background: s.tone },
|
|
25
|
+
"aria-hidden": !0
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
s.label
|
|
29
|
+
] }, s.key))
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
) : null;
|
|
33
|
+
export {
|
|
34
|
+
p as default
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=LevelLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LevelLegend.js","sources":["../../../../src/components/Disposition/AlertDispositionPanel/LevelLegend.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React from 'react';\nimport type { DispositionAlertLevelCatalog } from './types';\nimport styles from './levelLegend.module.scss';\n\nexport type DispositionAlertLevelLegendProps = {\n catalog: DispositionAlertLevelCatalog;\n className?: string;\n /** 图例标题,默认「等级」 */\n title?: string;\n};\n\n/**\n * 等级图例:完全由 catalog 驱动,不内置任何产品级数/文案。\n */\nconst DispositionAlertLevelLegend: React.FC<DispositionAlertLevelLegendProps> = ({\n catalog,\n className,\n title = '等级',\n}) => {\n if (!catalog.length) return null;\n\n return (\n <div\n className={classNames(\n 'marsun-disposition-alert-level-legend',\n styles['marsun-disposition-alert-level-legend'],\n className,\n )}\n aria-label={title}\n >\n <span className={styles['marsun-disposition-alert-level-legend-title']}>{title}</span>\n {catalog.map((lv) => (\n <span key={lv.key} className={styles['marsun-disposition-alert-level-legend-item']}>\n <span\n className={styles['marsun-disposition-alert-level-legend-dot']}\n style={{ background: lv.tone }}\n aria-hidden\n />\n {lv.label}\n </span>\n ))}\n </div>\n );\n};\n\nexport default DispositionAlertLevelLegend;\n"],"names":["DispositionAlertLevelLegend","catalog","className","title","jsxs","classNames","styles","jsx","lv"],"mappings":";;;AAeA,MAAMA,IAA0E,CAAC;AAAA,EAC/E,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AACV,MACOF,EAAQ,SAGX,gBAAAG;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAC,EAAO,uCAAuC;AAAA,MAC9CJ;AAAA,IAAA;AAAA,IAEF,cAAYC;AAAA,IAEZ,UAAA;AAAA,MAAA,gBAAAI,EAAC,QAAA,EAAK,WAAWD,EAAO,6CAA6C,GAAI,UAAAH,GAAM;AAAA,MAC9EF,EAAQ,IAAI,CAACO,wBACX,QAAA,EAAkB,WAAWF,EAAO,4CAA4C,GAC/E,UAAA;AAAA,QAAA,gBAAAC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,EAAO,2CAA2C;AAAA,YAC7D,OAAO,EAAE,YAAYE,EAAG,KAAA;AAAA,YACxB,eAAW;AAAA,UAAA;AAAA,QAAA;AAAA,QAEZA,EAAG;AAAA,MAAA,EAAA,GANKA,EAAG,GAOd,CACD;AAAA,IAAA;AAAA,EAAA;AAAA,IArBuB;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { DispositionAlertContext } from './types';
|
|
3
|
+
export type { DispositionAlertContext, DispositionAlertKind, DispositionAlertLevelSpec, DispositionAlertLevelCatalog, } from './types';
|
|
4
|
+
export { formatDispositionTriggerText, getDispositionAlertLevel, buildDispositionAlertContext, } from './types';
|
|
5
|
+
export { default as DispositionAlertLevelLegend } from './LevelLegend';
|
|
6
|
+
export type { DispositionAlertLevelLegendProps } from './LevelLegend';
|
|
7
|
+
export type AlertDispositionPanelProps = {
|
|
8
|
+
open: boolean;
|
|
9
|
+
context: DispositionAlertContext | null;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
/** 手动收起(换机台仍由业务 hook resetKey 清空) */
|
|
13
|
+
onCollapse?: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 详情处置展开壳:触发上下文条 + 分域 DispositionBar(children)。
|
|
17
|
+
* 收起 → null;扁平布局,禁双层 card。不绑业务 API / EP / reveal 状态。
|
|
18
|
+
* 等级展示靠 label + 可选 tone 色标,与圆点/方点等形状解耦。
|
|
19
|
+
*/
|
|
20
|
+
declare const AlertDispositionPanel: React.FC<AlertDispositionPanelProps>;
|
|
21
|
+
export default AlertDispositionPanel;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Tag as d, Button as p } from "antd";
|
|
3
|
+
import t from "classnames";
|
|
4
|
+
import { formatDispositionTriggerText as m } from "./types.js";
|
|
5
|
+
import { buildDispositionAlertContext as A, getDispositionAlertLevel as T } from "./types.js";
|
|
6
|
+
import s from "./style.module.scss.js";
|
|
7
|
+
const N = ({
|
|
8
|
+
open: a,
|
|
9
|
+
context: i,
|
|
10
|
+
children: l,
|
|
11
|
+
className: n,
|
|
12
|
+
onCollapse: o
|
|
13
|
+
}) => !a || !i ? null : /* @__PURE__ */ r(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: t(
|
|
17
|
+
"marsun-alert-disposition-panel",
|
|
18
|
+
s["marsun-alert-disposition-panel"],
|
|
19
|
+
n
|
|
20
|
+
),
|
|
21
|
+
"data-testid": "alert-disposition-panel",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: t(
|
|
27
|
+
"marsun-alert-disposition-trigger-row",
|
|
28
|
+
s["marsun-alert-disposition-trigger-row"]
|
|
29
|
+
),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ r(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: t(
|
|
35
|
+
"marsun-alert-disposition-trigger",
|
|
36
|
+
s["marsun-alert-disposition-trigger"]
|
|
37
|
+
),
|
|
38
|
+
"data-testid": "alert-disposition-trigger",
|
|
39
|
+
children: [
|
|
40
|
+
i.tone ? /* @__PURE__ */ e(
|
|
41
|
+
d,
|
|
42
|
+
{
|
|
43
|
+
color: i.tone,
|
|
44
|
+
className: s["marsun-alert-disposition-tone"],
|
|
45
|
+
"data-testid": "alert-disposition-tone",
|
|
46
|
+
children: i.label
|
|
47
|
+
}
|
|
48
|
+
) : null,
|
|
49
|
+
/* @__PURE__ */ e("span", { children: m(i) })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
o ? /* @__PURE__ */ e(
|
|
54
|
+
p,
|
|
55
|
+
{
|
|
56
|
+
type: "link",
|
|
57
|
+
size: "small",
|
|
58
|
+
className: t(
|
|
59
|
+
"marsun-alert-disposition-collapse",
|
|
60
|
+
s["marsun-alert-disposition-collapse"]
|
|
61
|
+
),
|
|
62
|
+
onClick: o,
|
|
63
|
+
"data-testid": "alert-disposition-collapse",
|
|
64
|
+
children: "收起"
|
|
65
|
+
}
|
|
66
|
+
) : null
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
l
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
export {
|
|
75
|
+
A as buildDispositionAlertContext,
|
|
76
|
+
N as default,
|
|
77
|
+
m as formatDispositionTriggerText,
|
|
78
|
+
T as getDispositionAlertLevel
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Disposition/AlertDispositionPanel/index.tsx"],"sourcesContent":["import { Button, Tag } from 'antd';\nimport classNames from 'classnames';\nimport React, { type ReactNode } from 'react';\nimport { formatDispositionTriggerText, type DispositionAlertContext } from './types';\nimport styles from './style.module.scss';\n\nexport type {\n DispositionAlertContext,\n DispositionAlertKind,\n DispositionAlertLevelSpec,\n DispositionAlertLevelCatalog,\n} from './types';\nexport {\n formatDispositionTriggerText,\n getDispositionAlertLevel,\n buildDispositionAlertContext,\n} from './types';\nexport { default as DispositionAlertLevelLegend } from './LevelLegend';\nexport type { DispositionAlertLevelLegendProps } from './LevelLegend';\n\nexport type AlertDispositionPanelProps = {\n open: boolean;\n context: DispositionAlertContext | null;\n children: ReactNode;\n className?: string;\n /** 手动收起(换机台仍由业务 hook resetKey 清空) */\n onCollapse?: () => void;\n};\n\n/**\n * 详情处置展开壳:触发上下文条 + 分域 DispositionBar(children)。\n * 收起 → null;扁平布局,禁双层 card。不绑业务 API / EP / reveal 状态。\n * 等级展示靠 label + 可选 tone 色标,与圆点/方点等形状解耦。\n */\nconst AlertDispositionPanel: React.FC<AlertDispositionPanelProps> = ({\n open,\n context,\n children,\n className,\n onCollapse,\n}) => {\n if (!open || !context) return null;\n\n return (\n <div\n className={classNames(\n 'marsun-alert-disposition-panel',\n styles['marsun-alert-disposition-panel'],\n className,\n )}\n data-testid=\"alert-disposition-panel\"\n >\n <div\n className={classNames(\n 'marsun-alert-disposition-trigger-row',\n styles['marsun-alert-disposition-trigger-row'],\n )}\n >\n <div\n className={classNames(\n 'marsun-alert-disposition-trigger',\n styles['marsun-alert-disposition-trigger'],\n )}\n data-testid=\"alert-disposition-trigger\"\n >\n {context.tone ? (\n <Tag\n color={context.tone}\n className={styles['marsun-alert-disposition-tone']}\n data-testid=\"alert-disposition-tone\"\n >\n {context.label}\n </Tag>\n ) : null}\n <span>{formatDispositionTriggerText(context)}</span>\n </div>\n {onCollapse ? (\n <Button\n type=\"link\"\n size=\"small\"\n className={classNames(\n 'marsun-alert-disposition-collapse',\n styles['marsun-alert-disposition-collapse'],\n )}\n onClick={onCollapse}\n data-testid=\"alert-disposition-collapse\"\n >\n 收起\n </Button>\n ) : null}\n </div>\n {children}\n </div>\n );\n};\n\nexport default AlertDispositionPanel;\n"],"names":["AlertDispositionPanel","open","context","children","className","onCollapse","jsxs","classNames","styles","jsx","Tag","formatDispositionTriggerText","Button"],"mappings":";;;;;;AAkCA,MAAMA,IAA8D,CAAC;AAAA,EACnE,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AACF,MACM,CAACJ,KAAQ,CAACC,IAAgB,OAG5B,gBAAAI;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAC,EAAO,gCAAgC;AAAA,MACvCJ;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IAEZ,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC;AAAA,YACT;AAAA,YACAC,EAAO,sCAAsC;AAAA,UAAA;AAAA,UAG/C,UAAA;AAAA,YAAA,gBAAAF;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWC;AAAA,kBACT;AAAA,kBACAC,EAAO,kCAAkC;AAAA,gBAAA;AAAA,gBAE3C,eAAY;AAAA,gBAEX,UAAA;AAAA,kBAAAN,EAAQ,OACP,gBAAAO;AAAA,oBAACC;AAAA,oBAAA;AAAA,sBACC,OAAOR,EAAQ;AAAA,sBACf,WAAWM,EAAO,+BAA+B;AAAA,sBACjD,eAAY;AAAA,sBAEX,UAAAN,EAAQ;AAAA,oBAAA;AAAA,kBAAA,IAET;AAAA,kBACJ,gBAAAO,EAAC,QAAA,EAAM,UAAAE,EAA6BT,CAAO,EAAA,CAAE;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAE9CG,IACC,gBAAAI;AAAA,cAACG;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,WAAWL;AAAA,kBACT;AAAA,kBACAC,EAAO,mCAAmC;AAAA,gBAAA;AAAA,gBAE5C,SAASH;AAAA,gBACT,eAAY;AAAA,gBACb,UAAA;AAAA,cAAA;AAAA,YAAA,IAGC;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAELF;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"marsun-disposition-alert-level-legend": "_marsun-disposition-alert-level-legend_3bog0_1",
|
|
3
|
+
"marsun-disposition-alert-level-legend-title": "_marsun-disposition-alert-level-legend-title_3bog0_11",
|
|
4
|
+
"marsun-disposition-alert-level-legend-item": "_marsun-disposition-alert-level-legend-item_3bog0_15",
|
|
5
|
+
"marsun-disposition-alert-level-legend-dot": "_marsun-disposition-alert-level-legend-dot_3bog0_21"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
e as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=levelLegend.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levelLegend.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
"marsun-alert-disposition-panel": "_marsun-alert-disposition-panel_1qi78_1",
|
|
3
|
+
"marsun-alert-disposition-trigger-row": "_marsun-alert-disposition-trigger-row_1qi78_10",
|
|
4
|
+
"marsun-alert-disposition-trigger": "_marsun-alert-disposition-trigger_1qi78_10",
|
|
5
|
+
"marsun-alert-disposition-tone": "_marsun-alert-disposition-tone_1qi78_29",
|
|
6
|
+
"marsun-alert-disposition-collapse": "_marsun-alert-disposition-collapse_1qi78_35"
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
i as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=style.module.scss.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** 详情处置展开时的触发上下文(仅展示;写仍机台 grain) */
|
|
2
|
+
/**
|
|
3
|
+
* 等级粗粒度键。常用 info|warn|alarm|critical|overdue;
|
|
4
|
+
* 项目可自定任意 string(与契约 alertLevel / 配置中心 key 对齐)。
|
|
5
|
+
*/
|
|
6
|
+
export type DispositionAlertKind = string;
|
|
7
|
+
export type DispositionAlertContext = {
|
|
8
|
+
/** 等级键(常等于 catalog.key) */
|
|
9
|
+
kind: DispositionAlertKind;
|
|
10
|
+
/** 展示文案:取 catalog.label / 接口已有字段,禁 FE 平行码表 */
|
|
11
|
+
label: string;
|
|
12
|
+
date?: string;
|
|
13
|
+
detail?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 可选色标(展示用):来自 catalog.tone / 业务配置。
|
|
16
|
+
* 不同等级 → 不同颜色;与圆点/方点等形状解耦。
|
|
17
|
+
*/
|
|
18
|
+
tone?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 项目注入的「预警等级展示」规格。
|
|
22
|
+
* SSOT 在业务配置/契约;core 不写死任何产品的级数/文案/阈值。
|
|
23
|
+
*/
|
|
24
|
+
export type DispositionAlertLevelSpec = {
|
|
25
|
+
/** 等级键(与契约 alertLevel / 业务码对齐) */
|
|
26
|
+
key: string;
|
|
27
|
+
/** 展示名 */
|
|
28
|
+
label: string;
|
|
29
|
+
/** 色标 hex / antd 色名 */
|
|
30
|
+
tone: string;
|
|
31
|
+
/** 写入 context.kind;缺省 = key */
|
|
32
|
+
kind?: DispositionAlertKind;
|
|
33
|
+
/** 图点大小(可选;仅可视化) */
|
|
34
|
+
pointSize?: number;
|
|
35
|
+
/** 图点形状(可选;默认 point;形状≠等级语义) */
|
|
36
|
+
shape?: string;
|
|
37
|
+
};
|
|
38
|
+
/** 等级目录:由项目/租户配置注入 */
|
|
39
|
+
export type DispositionAlertLevelCatalog = readonly DispositionAlertLevelSpec[];
|
|
40
|
+
/** 组装「触发:」条可见文案 */
|
|
41
|
+
export declare function formatDispositionTriggerText(ctx: DispositionAlertContext): string;
|
|
42
|
+
/** 按 key 查等级规格(大小写不敏感) */
|
|
43
|
+
export declare function getDispositionAlertLevel(catalog: DispositionAlertLevelCatalog, key: string | null | undefined): DispositionAlertLevelSpec | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* 从 catalog 组装触发上下文。
|
|
46
|
+
* key 不在目录内 → null(调用方勿用硬编码中文兜底冒充等级)。
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildDispositionAlertContext(catalog: DispositionAlertLevelCatalog, key: string, extras?: {
|
|
49
|
+
date?: string;
|
|
50
|
+
detail?: string;
|
|
51
|
+
}): DispositionAlertContext | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function l(t) {
|
|
2
|
+
var i, n;
|
|
3
|
+
return `触发:${[t.label.trim(), (i = t.date) == null ? void 0 : i.trim(), (n = t.detail) == null ? void 0 : n.trim()].filter(Boolean).join(" · ")}`;
|
|
4
|
+
}
|
|
5
|
+
function r(t, e) {
|
|
6
|
+
const i = (e || "").trim();
|
|
7
|
+
if (!i) return;
|
|
8
|
+
const n = i.toLowerCase();
|
|
9
|
+
return t.find((o) => o.key === i) || t.find((o) => o.key.toLowerCase() === n);
|
|
10
|
+
}
|
|
11
|
+
function d(t, e, i) {
|
|
12
|
+
const n = r(t, e);
|
|
13
|
+
return n ? {
|
|
14
|
+
kind: n.kind ?? n.key,
|
|
15
|
+
label: n.label,
|
|
16
|
+
tone: n.tone,
|
|
17
|
+
date: i == null ? void 0 : i.date,
|
|
18
|
+
detail: i == null ? void 0 : i.detail
|
|
19
|
+
} : null;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
d as buildDispositionAlertContext,
|
|
23
|
+
l as formatDispositionTriggerText,
|
|
24
|
+
r as getDispositionAlertLevel
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/Disposition/AlertDispositionPanel/types.ts"],"sourcesContent":["/** 详情处置展开时的触发上下文(仅展示;写仍机台 grain) */\n\n/**\n * 等级粗粒度键。常用 info|warn|alarm|critical|overdue;\n * 项目可自定任意 string(与契约 alertLevel / 配置中心 key 对齐)。\n */\nexport type DispositionAlertKind = string;\n\nexport type DispositionAlertContext = {\n /** 等级键(常等于 catalog.key) */\n kind: DispositionAlertKind;\n /** 展示文案:取 catalog.label / 接口已有字段,禁 FE 平行码表 */\n label: string;\n date?: string;\n detail?: string;\n /**\n * 可选色标(展示用):来自 catalog.tone / 业务配置。\n * 不同等级 → 不同颜色;与圆点/方点等形状解耦。\n */\n tone?: string;\n};\n\n/**\n * 项目注入的「预警等级展示」规格。\n * SSOT 在业务配置/契约;core 不写死任何产品的级数/文案/阈值。\n */\nexport type DispositionAlertLevelSpec = {\n /** 等级键(与契约 alertLevel / 业务码对齐) */\n key: string;\n /** 展示名 */\n label: string;\n /** 色标 hex / antd 色名 */\n tone: string;\n /** 写入 context.kind;缺省 = key */\n kind?: DispositionAlertKind;\n /** 图点大小(可选;仅可视化) */\n pointSize?: number;\n /** 图点形状(可选;默认 point;形状≠等级语义) */\n shape?: string;\n};\n\n/** 等级目录:由项目/租户配置注入 */\nexport type DispositionAlertLevelCatalog = readonly DispositionAlertLevelSpec[];\n\n/** 组装「触发:」条可见文案 */\nexport function formatDispositionTriggerText(ctx: DispositionAlertContext): string {\n const parts = [ctx.label.trim(), ctx.date?.trim(), ctx.detail?.trim()].filter(Boolean);\n return `触发:${parts.join(' · ')}`;\n}\n\n/** 按 key 查等级规格(大小写不敏感) */\nexport function getDispositionAlertLevel(\n catalog: DispositionAlertLevelCatalog,\n key: string | null | undefined,\n): DispositionAlertLevelSpec | undefined {\n const raw = (key || '').trim();\n if (!raw) return undefined;\n const lower = raw.toLowerCase();\n return catalog.find((s) => s.key === raw) || catalog.find((s) => s.key.toLowerCase() === lower);\n}\n\n/**\n * 从 catalog 组装触发上下文。\n * key 不在目录内 → null(调用方勿用硬编码中文兜底冒充等级)。\n */\nexport function buildDispositionAlertContext(\n catalog: DispositionAlertLevelCatalog,\n key: string,\n extras?: { date?: string; detail?: string },\n): DispositionAlertContext | null {\n const spec = getDispositionAlertLevel(catalog, key);\n if (!spec) return null;\n return {\n kind: spec.kind ?? spec.key,\n label: spec.label,\n tone: spec.tone,\n date: extras?.date,\n detail: extras?.detail,\n };\n}\n"],"names":["formatDispositionTriggerText","ctx","_a","_b","getDispositionAlertLevel","catalog","key","raw","lower","s","buildDispositionAlertContext","extras","spec"],"mappings":"AA6CO,SAASA,EAA6BC,GAAsC;AAA5E,MAAAC,GAAAC;AAEL,SAAO,MADO,CAACF,EAAI,MAAM,KAAA,IAAQC,IAAAD,EAAI,SAAJ,gBAAAC,EAAU,SAAQC,IAAAF,EAAI,WAAJ,gBAAAE,EAAY,MAAM,EAAE,OAAO,OAAO,EAClE,KAAK,KAAK,CAAC;AAChC;AAGO,SAASC,EACdC,GACAC,GACuC;AACvC,QAAMC,KAAOD,KAAO,IAAI,KAAA;AACxB,MAAI,CAACC,EAAK;AACV,QAAMC,IAAQD,EAAI,YAAA;AAClB,SAAOF,EAAQ,KAAK,CAACI,MAAMA,EAAE,QAAQF,CAAG,KAAKF,EAAQ,KAAK,CAACI,MAAMA,EAAE,IAAI,YAAA,MAAkBD,CAAK;AAChG;AAMO,SAASE,EACdL,GACAC,GACAK,GACgC;AAChC,QAAMC,IAAOR,EAAyBC,GAASC,CAAG;AAClD,SAAKM,IACE;AAAA,IACL,MAAMA,EAAK,QAAQA,EAAK;AAAA,IACxB,OAAOA,EAAK;AAAA,IACZ,MAAMA,EAAK;AAAA,IACX,MAAMD,KAAA,gBAAAA,EAAQ;AAAA,IACd,QAAQA,KAAA,gBAAAA,EAAQ;AAAA,EAAA,IANA;AAQpB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Disposition/DispositionBar/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React from 'react';\nimport styles from './style.module.scss';\n\nexport type DispositionBarProps = {\n /** 左侧文案,默认「处置状态」 */\n label?: string;\n /** 状态徽章内容(string 或自定义节点) */\n statusBadge: React.ReactNode;\n /** 右侧操作区;由调用方注入业务钮 */\n actions?: React.ReactNode;\n /** true → 仅显示状态区,不渲染 actions */\n statusLoading?: boolean;\n className?: string;\n};\n\n/**\n * 处置条布局壳:左状态 + 右操作。不绑业务 API / EP。\n */\nconst DispositionBar: React.FC<DispositionBarProps> = ({\n label = '处置状态',\n statusBadge,\n actions,\n statusLoading,\n className,\n}) => {\n const badgeNode =\n typeof statusBadge === 'string' || typeof statusBadge === 'number' ? (\n <span className={styles['marsun-disposition-badge']}>{statusBadge}</span>\n ) : (\n statusBadge\n );\n\n return (\n <div\n className={classNames('marsun-disposition-bar', styles['marsun-disposition-bar'], className)}\n role=\"group\"\n aria-label={label}\n >\n <div className={classNames('marsun-disposition-status', styles['marsun-disposition-status'])}>\n <span className={styles['marsun-disposition-label']}>{label}</span>\n {badgeNode}\n </div>\n {!statusLoading && actions ? (\n <div\n className={classNames('marsun-disposition-actions', styles['marsun-disposition-actions'])}\n >\n {actions}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default DispositionBar;\n"],"names":["DispositionBar","label","statusBadge","actions","statusLoading","className","badgeNode","jsx","styles","jsxs","classNames"],"mappings":";;;AAmBA,MAAMA,IAAgD,CAAC;AAAA,EACrD,OAAAC,IAAQ;AAAA,EACR,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAMC,IACJ,OAAOJ,KAAgB,YAAY,OAAOA,KAAgB,WACxD,gBAAAK,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAAI,aAAY,IAElEN;AAGJ,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,0BAA0BF,EAAO,wBAAwB,GAAGH,CAAS;AAAA,MAC3F,MAAK;AAAA,MACL,cAAYJ;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAQ,EAAC,SAAI,WAAWC,EAAW,6BAA6BF,EAAO,2BAA2B,CAAC,GACzF,UAAA;AAAA,UAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAAI,UAAAP,GAAM;AAAA,UAC3DK;AAAA,QAAA,GACH;AAAA,QACC,CAACF,KAAiBD,IACjB,gBAAAI;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWG,EAAW,8BAA8BF,EAAO,4BAA4B,CAAC;AAAA,YAEvF,UAAAL;AAAA,UAAA;AAAA,QAAA,IAED;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as DispositionBar } from './DispositionBar';
|
|
2
|
+
export type { DispositionBarProps } from './DispositionBar';
|
|
3
|
+
export { default as AlertDispositionPanel, DispositionAlertLevelLegend, formatDispositionTriggerText, getDispositionAlertLevel, buildDispositionAlertContext, } from './AlertDispositionPanel';
|
|
4
|
+
export type { AlertDispositionPanelProps, DispositionAlertContext, DispositionAlertKind, DispositionAlertLevelSpec, DispositionAlertLevelCatalog, DispositionAlertLevelLegendProps, } from './AlertDispositionPanel';
|
|
@@ -19,8 +19,8 @@ export * from './OrgTree';
|
|
|
19
19
|
export * from './StateBar';
|
|
20
20
|
export * from './SegmentedRadio';
|
|
21
21
|
export * from './Navigation';
|
|
22
|
-
export {
|
|
23
|
-
export type { DispositionBarProps } from './
|
|
22
|
+
export { DispositionBar, AlertDispositionPanel, DispositionAlertLevelLegend, formatDispositionTriggerText, getDispositionAlertLevel, buildDispositionAlertContext, } from './Disposition';
|
|
23
|
+
export type { DispositionBarProps, AlertDispositionPanelProps, DispositionAlertContext, DispositionAlertKind, DispositionAlertLevelSpec, DispositionAlertLevelCatalog, DispositionAlertLevelLegendProps, } from './Disposition';
|
|
24
24
|
export * from './Audit';
|
|
25
25
|
export * from './Stat';
|
|
26
26
|
export * from './Table';
|
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ export * from './components/OrgTree';
|
|
|
45
45
|
export * from './components/StateBar';
|
|
46
46
|
export * from './components/SegmentedRadio';
|
|
47
47
|
export * from './components/Navigation';
|
|
48
|
-
export {
|
|
49
|
-
export type { DispositionBarProps } from './components/
|
|
48
|
+
export { DispositionBar, AlertDispositionPanel, DispositionAlertLevelLegend, formatDispositionTriggerText, getDispositionAlertLevel, buildDispositionAlertContext, } from './components/Disposition';
|
|
49
|
+
export type { DispositionBarProps, AlertDispositionPanelProps, DispositionAlertContext, DispositionAlertKind, DispositionAlertLevelSpec, DispositionAlertLevelCatalog, DispositionAlertLevelLegendProps, } from './components/Disposition';
|
|
50
50
|
export * from './components/Audit';
|
|
51
51
|
export * from './components/Stat';
|
|
52
52
|
export * from './components/Table';
|