@yuku123/z-cognition-component 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),S=require("react-router-dom"),t=require("antd"),p=require("@ant-design/icons"),h=require("./api.cjs"),l=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:b}=t.Input;function v(){const x=S.useNavigate(),[y,g]=a.useState([]),[j,c]=a.useState(!1),[d,u]=a.useState(""),[w,r]=a.useState(!1),[I,m]=a.useState(!1),[o]=t.Form.useForm(),i=async(n=d)=>{c(!0);try{g(await h.cognitionApi.listConcepts({domain:n}))}catch(s){t.message.error(s.message)}finally{c(!1)}};a.useEffect(()=>{i()},[]);const f=async()=>{const n=await o.validateFields();m(!0);try{await h.cognitionApi.createConcept({...n,actor:n.actor||"console",note:n.note||"console create"}),t.message.success(`概念 ${n.conceptKey} 已登记`),r(!1),o.resetFields(),await i()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{m(!1)}};return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:180},value:d,onChange:n=>u(n.target.value),onPressEnter:()=>i()}),e.jsx(t.Button,{icon:e.jsx(p.ReloadOutlined,{}),onClick:()=>{u(""),i("")},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(p.PlusOutlined,{}),onClick:()=>r(!0),children:"新建概念"})]}),e.jsx(t.Table,{rowKey:"conceptKey",size:"middle",loading:j,dataSource:y,pagination:{pageSize:20,showSizeChanger:!1},columns:[{title:"conceptKey",dataIndex:"conceptKey",width:200},{title:"名称",dataIndex:"name",width:180},{title:"类型",dataIndex:"conceptType",width:120,render:n=>e.jsx(t.Tag,{children:n})},{title:"域",dataIndex:"domain",width:120},{title:"父概念",dataIndex:"parentKey",width:180,render:n=>n||"—"},{title:"版本",dataIndex:"revisionNo",width:70,render:n=>`r${n}`},{title:"定义",dataIndex:"definition",ellipsis:!0},{title:"操作",width:110,render:(n,s)=>e.jsx(t.Button,{size:"small",onClick:()=>x(`/cognition/impact?subjectType=concept&subjectKey=${encodeURIComponent(s.conceptKey)}`),children:"影响面"})}]}),e.jsx(t.Modal,{title:"新建概念(证据必填)",open:w,onCancel:()=>r(!1),onOk:f,confirmLoading:I,width:800,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:o,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"conceptKey",label:"conceptKey",rules:[{required:!0,message:"必填"},{pattern:l.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:240},placeholder:"order"})}),e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:200},placeholder:"订单"})}),e.jsx(t.Form.Item,{name:"conceptType",label:"类型",rules:[{required:!0,message:"必填"}],initialValue:"ENTITY",children:e.jsx(t.Select,{style:{width:140},options:l.CONCEPT_TYPES.map(n=>({value:n,label:n}))})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"parentKey",label:"父概念",children:e.jsx(t.Input,{style:{width:180}})})]}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(b,{rows:3})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(l.EvidenceFormList,{})})]})})]})}exports.default=v;
@@ -0,0 +1,123 @@
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { useState as r, useEffect as T } from "react";
3
+ import { useNavigate as x } from "react-router-dom";
4
+ import { Input as i, Form as a, Space as f, Button as d, Table as E, Tag as S, Modal as z, Select as O, message as m } from "antd";
5
+ import { ReloadOutlined as P, PlusOutlined as $ } from "@ant-design/icons";
6
+ import { cognitionApi as g } from "./api.js";
7
+ import { K as q, C as F, a as N } from "./EvidenceFormList-097ICr7D.js";
8
+ const { TextArea: j } = i;
9
+ function H() {
10
+ const w = x(), [I, C] = r([]), [b, u] = r(!1), [p, h] = r(""), [K, s] = r(!1), [v, y] = r(!1), [c] = a.useForm(), l = async (t = p) => {
11
+ u(!0);
12
+ try {
13
+ C(await g.listConcepts({ domain: t }));
14
+ } catch (n) {
15
+ m.error(n.message);
16
+ } finally {
17
+ u(!1);
18
+ }
19
+ };
20
+ return T(() => {
21
+ l();
22
+ }, []), /* @__PURE__ */ o("div", { children: [
23
+ /* @__PURE__ */ o(f, { wrap: !0, style: { marginBottom: 16 }, children: [
24
+ /* @__PURE__ */ e(
25
+ i,
26
+ {
27
+ placeholder: "域(如 trade)",
28
+ allowClear: !0,
29
+ style: { width: 180 },
30
+ value: p,
31
+ onChange: (t) => h(t.target.value),
32
+ onPressEnter: () => l()
33
+ }
34
+ ),
35
+ /* @__PURE__ */ e(d, { icon: /* @__PURE__ */ e(P, {}), onClick: () => {
36
+ h(""), l("");
37
+ }, children: "重置" }),
38
+ /* @__PURE__ */ e(d, { type: "primary", icon: /* @__PURE__ */ e($, {}), onClick: () => s(!0), children: "新建概念" })
39
+ ] }),
40
+ /* @__PURE__ */ e(
41
+ E,
42
+ {
43
+ rowKey: "conceptKey",
44
+ size: "middle",
45
+ loading: b,
46
+ dataSource: I,
47
+ pagination: { pageSize: 20, showSizeChanger: !1 },
48
+ columns: [
49
+ { title: "conceptKey", dataIndex: "conceptKey", width: 200 },
50
+ { title: "名称", dataIndex: "name", width: 180 },
51
+ { title: "类型", dataIndex: "conceptType", width: 120, render: (t) => /* @__PURE__ */ e(S, { children: t }) },
52
+ { title: "域", dataIndex: "domain", width: 120 },
53
+ { title: "父概念", dataIndex: "parentKey", width: 180, render: (t) => t || "—" },
54
+ { title: "版本", dataIndex: "revisionNo", width: 70, render: (t) => `r${t}` },
55
+ { title: "定义", dataIndex: "definition", ellipsis: !0 },
56
+ {
57
+ title: "操作",
58
+ width: 110,
59
+ render: (t, n) => /* @__PURE__ */ e(
60
+ d,
61
+ {
62
+ size: "small",
63
+ onClick: () => w(`/cognition/impact?subjectType=concept&subjectKey=${encodeURIComponent(n.conceptKey)}`),
64
+ children: "影响面"
65
+ }
66
+ )
67
+ }
68
+ ]
69
+ }
70
+ ),
71
+ /* @__PURE__ */ e(
72
+ z,
73
+ {
74
+ title: "新建概念(证据必填)",
75
+ open: K,
76
+ onCancel: () => s(!1),
77
+ onOk: async () => {
78
+ const t = await c.validateFields();
79
+ y(!0);
80
+ try {
81
+ await g.createConcept({
82
+ ...t,
83
+ actor: t.actor || "console",
84
+ note: t.note || "console create"
85
+ }), m.success(`概念 ${t.conceptKey} 已登记`), s(!1), c.resetFields(), await l();
86
+ } catch (n) {
87
+ m.error(n.field ? `${n.field}: ${n.message}` : n.message);
88
+ } finally {
89
+ y(!1);
90
+ }
91
+ },
92
+ confirmLoading: v,
93
+ width: 800,
94
+ destroyOnHidden: !0,
95
+ children: /* @__PURE__ */ o(a, { form: c, layout: "vertical", children: [
96
+ /* @__PURE__ */ o(f, { size: "large", wrap: !0, children: [
97
+ /* @__PURE__ */ e(
98
+ a.Item,
99
+ {
100
+ name: "conceptKey",
101
+ label: "conceptKey",
102
+ rules: [
103
+ { required: !0, message: "必填" },
104
+ { pattern: q, message: "^[a-z][a-z0-9_.-]{1,127}$" }
105
+ ],
106
+ children: /* @__PURE__ */ e(i, { style: { width: 240 }, placeholder: "order" })
107
+ }
108
+ ),
109
+ /* @__PURE__ */ e(a.Item, { name: "name", label: "名称", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(i, { style: { width: 200 }, placeholder: "订单" }) }),
110
+ /* @__PURE__ */ e(a.Item, { name: "conceptType", label: "类型", rules: [{ required: !0, message: "必填" }], initialValue: "ENTITY", children: /* @__PURE__ */ e(O, { style: { width: 140 }, options: F.map((t) => ({ value: t, label: t })) }) }),
111
+ /* @__PURE__ */ e(a.Item, { name: "domain", label: "域", children: /* @__PURE__ */ e(i, { style: { width: 140 } }) }),
112
+ /* @__PURE__ */ e(a.Item, { name: "parentKey", label: "父概念", children: /* @__PURE__ */ e(i, { style: { width: 180 } }) })
113
+ ] }),
114
+ /* @__PURE__ */ e(a.Item, { name: "definition", label: "定义", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(j, { rows: 3 }) }),
115
+ /* @__PURE__ */ e(a.Item, { label: "证据(至少一条)", required: !0, children: /* @__PURE__ */ e(N, {}) })
116
+ ] })
117
+ }
118
+ )
119
+ ] });
120
+ }
121
+ export {
122
+ H as default
123
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("antd"),r=[["GET","/api/terms","术语列表(domain / status / q)"],["GET","/api/terms/{key}","术语详情"],["POST","/api/terms","登记术语(需 Authorization,证据必填)"],["PUT","/api/terms/{key}","更新术语(生成新 revision)"],["GET","/api/terms/{key}/revisions","版本列表"],["GET","/api/terms/{key}/evidence","当前版本证据"],["GET","/api/terms/{key}/diff?left=&right=","版本字段级 diff"],["POST","/api/terms/{key}/rollback/{r}","回滚(追加新 revision)"],["GET","/api/concepts","概念列表"],["GET","/api/concepts/{key}/evidence","概念当前版本证据"],["POST","/api/concepts","登记概念(证据必填)"],["POST","/api/resolve","消歧:词 → 术语/概念 + 证据"],["GET","/api/impact?subjectType=&subjectKey=","影响面"]],a=[["术语登记 + 别名","✅","termKey 稳定,别名参与消歧"],["概念(六类 + 父子)","✅","ENTITY / PROCESS / ROLE / EVENT / VALUE"],["证据链(写入强制)","✅","缺证据 400;M0 四类证据,KB_CHUNK 暂拒(D6)"],["版本 / diff / 回滚","✅","只追加不改写"],["resolve 消歧","✅","KEY 100 / 规范名 90 / 别名 80 / 包含 50 / DEPRECATED −10"],["影响面","✅","本域关系;跨域 M1"],["写授权(权限点)","❌ M2","M0 只校验 token 存在性;M2 接 z-ctc"],["SKOS / JSON-LD 导出","❌ M1","—"]];function s(){return e.jsxs("div",{children:[e.jsx(t.Typography.Title,{level:4,children:"z-cognition 管控台(M0)"}),e.jsx(t.Typography.Paragraph,{type:"secondary",children:"业务认知域:持有「解释」,不持有「事实」。术语/概念/证据/消歧/影响面是 M0 竖切, 口径、规则、指标、决策记录按 D1 只登记 schema,不铺 UI。"}),e.jsx(t.Typography.Title,{level:5,children:"能力清单"}),e.jsx(t.Table,{rowKey:i=>i[0],size:"small",pagination:!1,style:{marginBottom:24},dataSource:a,columns:[{title:"能力",dataIndex:0,width:240},{title:"状态",dataIndex:1,width:100,render:i=>e.jsx(t.Tag,{color:i.startsWith("✅")?"green":"default",children:i})},{title:"说明",dataIndex:2}]}),e.jsx(t.Typography.Title,{level:5,children:"HTTP 面(前缀 /cognition)"}),e.jsx(t.Table,{rowKey:i=>`${i[0]} ${i[1]}`,size:"small",pagination:!1,dataSource:r,columns:[{title:"方法",dataIndex:0,width:90,render:i=>e.jsx(t.Typography.Text,{code:!0,children:i})},{title:"路径",dataIndex:1,width:340,render:i=>e.jsx(t.Typography.Text,{code:!0,children:i})},{title:"用途",dataIndex:2}]}),e.jsx(t.Typography.Title,{level:5,children:"凭证"}),e.jsxs(t.Descriptions,{size:"small",column:1,bordered:!0,children:[e.jsxs(t.Descriptions.Item,{label:"写操作",children:["需要 ",e.jsx(t.Typography.Text,{code:!0,children:"Authorization: Bearer <token>"}),"(M0 只校验存在性)。顶栏「凭证」写入本机 localStorage。"]}),e.jsx(t.Descriptions.Item,{label:"只读",children:"列表 / 详情 / revisions / evidence / diff / resolve / impact 不需要 token。"})]})]})}exports.default=s;
@@ -0,0 +1,75 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { Typography as i, Table as l, Tag as n, Descriptions as a } from "antd";
3
+ const o = [
4
+ ["GET", "/api/terms", "术语列表(domain / status / q)"],
5
+ ["GET", "/api/terms/{key}", "术语详情"],
6
+ ["POST", "/api/terms", "登记术语(需 Authorization,证据必填)"],
7
+ ["PUT", "/api/terms/{key}", "更新术语(生成新 revision)"],
8
+ ["GET", "/api/terms/{key}/revisions", "版本列表"],
9
+ ["GET", "/api/terms/{key}/evidence", "当前版本证据"],
10
+ ["GET", "/api/terms/{key}/diff?left=&right=", "版本字段级 diff"],
11
+ ["POST", "/api/terms/{key}/rollback/{r}", "回滚(追加新 revision)"],
12
+ ["GET", "/api/concepts", "概念列表"],
13
+ ["GET", "/api/concepts/{key}/evidence", "概念当前版本证据"],
14
+ ["POST", "/api/concepts", "登记概念(证据必填)"],
15
+ ["POST", "/api/resolve", "消歧:词 → 术语/概念 + 证据"],
16
+ ["GET", "/api/impact?subjectType=&subjectKey=", "影响面"]
17
+ ], d = [
18
+ ["术语登记 + 别名", "✅", "termKey 稳定,别名参与消歧"],
19
+ ["概念(六类 + 父子)", "✅", "ENTITY / PROCESS / ROLE / EVENT / VALUE"],
20
+ ["证据链(写入强制)", "✅", "缺证据 400;M0 四类证据,KB_CHUNK 暂拒(D6)"],
21
+ ["版本 / diff / 回滚", "✅", "只追加不改写"],
22
+ ["resolve 消歧", "✅", "KEY 100 / 规范名 90 / 别名 80 / 包含 50 / DEPRECATED −10"],
23
+ ["影响面", "✅", "本域关系;跨域 M1"],
24
+ ["写授权(权限点)", "❌ M2", "M0 只校验 token 存在性;M2 接 z-ctc"],
25
+ ["SKOS / JSON-LD 导出", "❌ M1", "—"]
26
+ ];
27
+ function p() {
28
+ return /* @__PURE__ */ r("div", { children: [
29
+ /* @__PURE__ */ e(i.Title, { level: 4, children: "z-cognition 管控台(M0)" }),
30
+ /* @__PURE__ */ e(i.Paragraph, { type: "secondary", children: "业务认知域:持有「解释」,不持有「事实」。术语/概念/证据/消歧/影响面是 M0 竖切, 口径、规则、指标、决策记录按 D1 只登记 schema,不铺 UI。" }),
31
+ /* @__PURE__ */ e(i.Title, { level: 5, children: "能力清单" }),
32
+ /* @__PURE__ */ e(
33
+ l,
34
+ {
35
+ rowKey: (t) => t[0],
36
+ size: "small",
37
+ pagination: !1,
38
+ style: { marginBottom: 24 },
39
+ dataSource: d,
40
+ columns: [
41
+ { title: "能力", dataIndex: 0, width: 240 },
42
+ { title: "状态", dataIndex: 1, width: 100, render: (t) => /* @__PURE__ */ e(n, { color: t.startsWith("✅") ? "green" : "default", children: t }) },
43
+ { title: "说明", dataIndex: 2 }
44
+ ]
45
+ }
46
+ ),
47
+ /* @__PURE__ */ e(i.Title, { level: 5, children: "HTTP 面(前缀 /cognition)" }),
48
+ /* @__PURE__ */ e(
49
+ l,
50
+ {
51
+ rowKey: (t) => `${t[0]} ${t[1]}`,
52
+ size: "small",
53
+ pagination: !1,
54
+ dataSource: o,
55
+ columns: [
56
+ { title: "方法", dataIndex: 0, width: 90, render: (t) => /* @__PURE__ */ e(i.Text, { code: !0, children: t }) },
57
+ { title: "路径", dataIndex: 1, width: 340, render: (t) => /* @__PURE__ */ e(i.Text, { code: !0, children: t }) },
58
+ { title: "用途", dataIndex: 2 }
59
+ ]
60
+ }
61
+ ),
62
+ /* @__PURE__ */ e(i.Title, { level: 5, children: "凭证" }),
63
+ /* @__PURE__ */ r(a, { size: "small", column: 1, bordered: !0, children: [
64
+ /* @__PURE__ */ r(a.Item, { label: "写操作", children: [
65
+ "需要 ",
66
+ /* @__PURE__ */ e(i.Text, { code: !0, children: "Authorization: Bearer <token>" }),
67
+ "(M0 只校验存在性)。顶栏「凭证」写入本机 localStorage。"
68
+ ] }),
69
+ /* @__PURE__ */ e(a.Item, { label: "只读", children: "列表 / 详情 / revisions / evidence / diff / resolve / impact 不需要 token。" })
70
+ ] })
71
+ ] });
72
+ }
73
+ export {
74
+ p as default
75
+ };
@@ -0,0 +1,88 @@
1
+ import { jsx as e, jsxs as E } from "react/jsx-runtime";
2
+ import { Form as r, Space as d, Select as u, Input as c, Button as m } from "antd";
3
+ import { PlusOutlined as p } from "@ant-design/icons";
4
+ const L = ["DRAFT", "ACTIVE", "DEPRECATED"], S = ["ENTITY", "PROCESS", "ROLE", "EVENT", "VALUE"], A = ["EXTERNAL_URL", "META_COLUMN", "CODE_SYMBOL", "API"], I = { DRAFT: "gold", ACTIVE: "green", DEPRECATED: "default" }, g = /^[a-z][a-z0-9_.-]{1,127}$/;
5
+ function _({ name: n = "evidences" }) {
6
+ return /* @__PURE__ */ e(
7
+ r.List,
8
+ {
9
+ name: n,
10
+ rules: [
11
+ {
12
+ validator: async (s, t) => {
13
+ if (!t || t.length === 0) throw new Error("至少一条证据");
14
+ }
15
+ }
16
+ ],
17
+ children: (s, { add: t, remove: i }, { errors: h }) => /* @__PURE__ */ E(d, { direction: "vertical", style: { width: "100%" }, size: 4, children: [
18
+ s.map(({ key: T, name: a, ...o }) => /* @__PURE__ */ E(d, { align: "baseline", wrap: !0, children: [
19
+ /* @__PURE__ */ e(
20
+ r.Item,
21
+ {
22
+ ...o,
23
+ name: [a, "evidenceType"],
24
+ rules: [{ required: !0, message: "类型" }],
25
+ style: { marginBottom: 8 },
26
+ children: /* @__PURE__ */ e(
27
+ u,
28
+ {
29
+ style: { width: 150 },
30
+ placeholder: "证据类型",
31
+ options: A.map((l) => ({ value: l, label: l }))
32
+ }
33
+ )
34
+ }
35
+ ),
36
+ /* @__PURE__ */ e(
37
+ r.Item,
38
+ {
39
+ ...o,
40
+ name: [a, "refId"],
41
+ rules: [{ required: !0, message: "refId" }],
42
+ style: { marginBottom: 8 },
43
+ children: /* @__PURE__ */ e(c, { style: { width: 320 }, placeholder: "refId(URL / 表.列 / 类#方法)" })
44
+ }
45
+ ),
46
+ /* @__PURE__ */ e(
47
+ r.Item,
48
+ {
49
+ ...o,
50
+ name: [a, "snapshotHash"],
51
+ rules: [{ required: !0, message: "snapshotHash" }],
52
+ style: { marginBottom: 8 },
53
+ children: /* @__PURE__ */ e(c, { style: { width: 220 }, placeholder: "snapshotHash(sha256 前 16 位即可)" })
54
+ }
55
+ ),
56
+ /* @__PURE__ */ e(m, { type: "text", danger: !0, onClick: () => i(a), children: "删除" })
57
+ ] }, T)),
58
+ /* @__PURE__ */ e(
59
+ m,
60
+ {
61
+ type: "dashed",
62
+ icon: /* @__PURE__ */ e(p, {}),
63
+ onClick: () => t({ evidenceType: "EXTERNAL_URL" }),
64
+ style: { width: 220 },
65
+ children: "加一条证据"
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e(r.ErrorList, { errors: h })
69
+ ] })
70
+ }
71
+ );
72
+ }
73
+ function f(n) {
74
+ return (n || []).map(({ evidenceType: s, refId: t, snapshotHash: i }) => ({
75
+ evidenceType: s,
76
+ refId: t,
77
+ snapshotHash: i
78
+ }));
79
+ }
80
+ export {
81
+ S as C,
82
+ A as E,
83
+ g as K,
84
+ I as S,
85
+ L as T,
86
+ _ as a,
87
+ f as t
88
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("antd"),T=require("@ant-design/icons"),u=["DRAFT","ACTIVE","DEPRECATED"],m=["ENTITY","PROCESS","ROLE","EVENT","VALUE"],a=["EXTERNAL_URL","META_COLUMN","CODE_SYMBOL","API"],h={DRAFT:"gold",ACTIVE:"green",DEPRECATED:"default"},S=/^[a-z][a-z0-9_.-]{1,127}$/;function p({name:i="evidences"}){return e.jsx(t.Form.List,{name:i,rules:[{validator:async(r,s)=>{if(!s||s.length===0)throw new Error("至少一条证据")}}],children:(r,{add:s,remove:o},{errors:c})=>e.jsxs(t.Space,{direction:"vertical",style:{width:"100%"},size:4,children:[r.map(({key:d,name:n,...E})=>e.jsxs(t.Space,{align:"baseline",wrap:!0,children:[e.jsx(t.Form.Item,{...E,name:[n,"evidenceType"],rules:[{required:!0,message:"类型"}],style:{marginBottom:8},children:e.jsx(t.Select,{style:{width:150},placeholder:"证据类型",options:a.map(l=>({value:l,label:l}))})}),e.jsx(t.Form.Item,{...E,name:[n,"refId"],rules:[{required:!0,message:"refId"}],style:{marginBottom:8},children:e.jsx(t.Input,{style:{width:320},placeholder:"refId(URL / 表.列 / 类#方法)"})}),e.jsx(t.Form.Item,{...E,name:[n,"snapshotHash"],rules:[{required:!0,message:"snapshotHash"}],style:{marginBottom:8},children:e.jsx(t.Input,{style:{width:220},placeholder:"snapshotHash(sha256 前 16 位即可)"})}),e.jsx(t.Button,{type:"text",danger:!0,onClick:()=>o(n),children:"删除"})]},d)),e.jsx(t.Button,{type:"dashed",icon:e.jsx(T.PlusOutlined,{}),onClick:()=>s({evidenceType:"EXTERNAL_URL"}),style:{width:220},children:"加一条证据"}),e.jsx(t.Form.ErrorList,{errors:c})]})})}function R(i){return(i||[]).map(({evidenceType:r,refId:s,snapshotHash:o})=>({evidenceType:r,refId:s,snapshotHash:o}))}exports.CONCEPT_TYPES=m;exports.EVIDENCE_TYPES=a;exports.EvidenceFormList=p;exports.KEY_PATTERN=S;exports.STATUS_COLOR=h;exports.TERM_STATUSES=u;exports.toEvidenceFormValues=R;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),h=require("react-router-dom"),t=require("antd"),f=require("@ant-design/icons"),x=require("./api.cjs"),b=[{value:"term",label:"TERM(术语)"},{value:"concept",label:"CONCEPT(概念)"}],y=r=>(r||"").toLowerCase()==="concept"?"concept":"term";function S(){const[r]=h.useSearchParams(),[o,p]=a.useState(y(r.get("subjectType"))),[i,d]=a.useState(r.get("subjectKey")||""),[n,g]=a.useState(null),[m,l]=a.useState(!1),c=async(s=o,u=i)=>{if(!u.trim()){t.message.warning("先输入 subjectKey");return}l(!0);try{g(await x.cognitionApi.impact(s,u.trim()))}catch(j){t.message.error(j.message)}finally{l(!1)}};return a.useEffect(()=>{r.get("subjectKey")&&c(y(r.get("subjectType")),r.get("subjectKey"))},[]),e.jsxs("div",{children:[e.jsx(t.Typography.Paragraph,{type:"secondary",children:"影响面:改一个 key 前先看谁引用了它。M0 基于本域关系(术语↔概念、父子概念), M1 再接 z-graph / z-meta 的跨域引用。"}),e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Select,{style:{width:200},value:o,onChange:p,options:b}),e.jsx(t.Input,{style:{width:260},placeholder:"termKey / conceptKey",value:i,onChange:s=>d(s.target.value),onPressEnter:()=>c()}),e.jsx(t.Button,{type:"primary",icon:e.jsx(f.SearchOutlined,{}),loading:m,onClick:()=>c(),children:"分析"})]}),n&&n.references.length===0?e.jsx(t.Alert,{type:"success",showIcon:!0,message:"没有引用方(本域内)",description:"可以安全变更;跨域引用 M1 接入后再扩。"}):null,n&&n.references.length>0?e.jsx(t.Table,{rowKey:s=>`${s.refType}-${s.refKey}`,size:"middle",pagination:!1,dataSource:n.references,columns:[{title:"引用类型",dataIndex:"refType",width:140,render:s=>e.jsx(t.Typography.Text,{code:!0,children:s})},{title:"引用方",dataIndex:"refKey",width:240},{title:"说明",dataIndex:"detail"}]}):null,n?null:e.jsx(t.Empty,{description:"输入一个 key,列出它的引用面"})]})}exports.default=S;
@@ -0,0 +1,64 @@
1
+ import { jsxs as u, jsx as e } from "react/jsx-runtime";
2
+ import { useState as a, useEffect as T } from "react";
3
+ import { useSearchParams as j } from "react-router-dom";
4
+ import { Typography as p, Space as K, Select as w, Input as S, Button as x, Alert as C, Table as E, Empty as v, message as m } from "antd";
5
+ import { SearchOutlined as I } from "@ant-design/icons";
6
+ import { cognitionApi as P } from "./api.js";
7
+ const z = [
8
+ { value: "term", label: "TERM(术语)" },
9
+ { value: "concept", label: "CONCEPT(概念)" }
10
+ ], y = (r) => (r || "").toLowerCase() === "concept" ? "concept" : "term";
11
+ function R() {
12
+ const [r] = j(), [c, d] = a(y(r.get("subjectType"))), [o, f] = a(r.get("subjectKey") || ""), [n, g] = a(null), [h, l] = a(!1), s = async (t = c, i = o) => {
13
+ if (!i.trim()) {
14
+ m.warning("先输入 subjectKey");
15
+ return;
16
+ }
17
+ l(!0);
18
+ try {
19
+ g(await P.impact(t, i.trim()));
20
+ } catch (b) {
21
+ m.error(b.message);
22
+ } finally {
23
+ l(!1);
24
+ }
25
+ };
26
+ return T(() => {
27
+ r.get("subjectKey") && s(y(r.get("subjectType")), r.get("subjectKey"));
28
+ }, []), /* @__PURE__ */ u("div", { children: [
29
+ /* @__PURE__ */ e(p.Paragraph, { type: "secondary", children: "影响面:改一个 key 前先看谁引用了它。M0 基于本域关系(术语↔概念、父子概念), M1 再接 z-graph / z-meta 的跨域引用。" }),
30
+ /* @__PURE__ */ u(K, { wrap: !0, style: { marginBottom: 16 }, children: [
31
+ /* @__PURE__ */ e(w, { style: { width: 200 }, value: c, onChange: d, options: z }),
32
+ /* @__PURE__ */ e(
33
+ S,
34
+ {
35
+ style: { width: 260 },
36
+ placeholder: "termKey / conceptKey",
37
+ value: o,
38
+ onChange: (t) => f(t.target.value),
39
+ onPressEnter: () => s()
40
+ }
41
+ ),
42
+ /* @__PURE__ */ e(x, { type: "primary", icon: /* @__PURE__ */ e(I, {}), loading: h, onClick: () => s(), children: "分析" })
43
+ ] }),
44
+ n && n.references.length === 0 ? /* @__PURE__ */ e(C, { type: "success", showIcon: !0, message: "没有引用方(本域内)", description: "可以安全变更;跨域引用 M1 接入后再扩。" }) : null,
45
+ n && n.references.length > 0 ? /* @__PURE__ */ e(
46
+ E,
47
+ {
48
+ rowKey: (t) => `${t.refType}-${t.refKey}`,
49
+ size: "middle",
50
+ pagination: !1,
51
+ dataSource: n.references,
52
+ columns: [
53
+ { title: "引用类型", dataIndex: "refType", width: 140, render: (t) => /* @__PURE__ */ e(p.Text, { code: !0, children: t }) },
54
+ { title: "引用方", dataIndex: "refKey", width: 240 },
55
+ { title: "说明", dataIndex: "detail" }
56
+ ]
57
+ }
58
+ ) : null,
59
+ n ? null : /* @__PURE__ */ e(v, { description: "输入一个 key,列出它的引用面" })
60
+ ] });
61
+ }
62
+ export {
63
+ R as default
64
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("antd"),m=require("@ant-design/icons"),h=require("./api.cjs");function x(){const[r,p]=c.useState(""),[u,o]=c.useState(!1),[s,y]=c.useState(null),l=async()=>{if(!r.trim()){n.message.warning("先输入要消歧的词");return}o(!0);try{y(await h.cognitionApi.resolve(r.trim()))}catch(t){n.message.error(t.message)}finally{o(!1)}};return e.jsxs("div",{children:[e.jsx(n.Typography.Paragraph,{type:"secondary",children:"打分:KEY 100 / 规范名 90 / 别名 80 / 包含 50,DEPRECATED −10。命中带出定义、绑定概念与证据。"}),e.jsxs(n.Space.Compact,{style:{width:"100%",maxWidth:720,marginBottom:16},children:[e.jsx(n.Input,{size:"large",placeholder:"如:GMV / 成交额 / 订单数",value:r,onChange:t=>p(t.target.value),onPressEnter:l}),e.jsx(n.Button,{size:"large",type:"primary",icon:e.jsx(m.SearchOutlined,{}),loading:u,onClick:l,children:"消歧"})]}),s&&s.hits.length===0?e.jsx(n.Alert,{type:"info",showIcon:!0,message:`没有命中:“${s.query}”`,description:"先登记术语,再让 agent 消费。"}):null,s&&s.hits.length>0?e.jsx(n.Space,{direction:"vertical",style:{width:"100%"},size:12,children:s.hits.map((t,g)=>{const i=t.term||t.concept,d=t.term?t.term.termKey:t.concept.conceptKey;return e.jsxs(n.Card,{size:"small",title:e.jsxs(n.Space,{children:[e.jsx(n.Tag,{color:"purple",children:t.score}),e.jsx("span",{children:d}),e.jsx(n.Tag,{children:t.matchedOn}),t.term?e.jsx(n.Tag,{color:"blue",children:t.term.canonical}):e.jsx(n.Tag,{color:"cyan",children:t.concept.name})]}),children:[e.jsx(n.Typography.Paragraph,{style:{marginBottom:8},children:i?i.definition:""}),t.concept?e.jsxs(n.Typography.Text,{type:"secondary",children:["绑定概念:",t.concept.conceptKey,"(",t.concept.conceptType,")"]}):null,e.jsx(n.Table,{size:"small",style:{marginTop:8},rowKey:a=>`${a.evidenceType}-${a.refId}-${a.revisionNo}`,pagination:!1,dataSource:t.evidence||[],columns:[{title:"证据类型",dataIndex:"evidenceType",width:140},{title:"refId",dataIndex:"refId"},{title:"snapshotHash",dataIndex:"snapshotHash",width:200}]})]},`${d}-${g}`)})}):null,s?null:e.jsx(n.Empty,{description:"输入一个词,看看认知域怎么理解它"})]})}exports.default=x;
@@ -0,0 +1,83 @@
1
+ import { jsxs as r, jsx as n } from "react/jsx-runtime";
2
+ import { useState as l } from "react";
3
+ import { Typography as i, Space as s, Input as T, Button as w, Alert as x, Card as I, Table as E, Tag as o, Empty as $, message as y } from "antd";
4
+ import { SearchOutlined as z } from "@ant-design/icons";
5
+ import { cognitionApi as C } from "./api.js";
6
+ function A() {
7
+ const [a, h] = l(""), [g, d] = l(!1), [t, f] = l(null), p = async () => {
8
+ if (!a.trim()) {
9
+ y.warning("先输入要消歧的词");
10
+ return;
11
+ }
12
+ d(!0);
13
+ try {
14
+ f(await C.resolve(a.trim()));
15
+ } catch (e) {
16
+ y.error(e.message);
17
+ } finally {
18
+ d(!1);
19
+ }
20
+ };
21
+ return /* @__PURE__ */ r("div", { children: [
22
+ /* @__PURE__ */ n(i.Paragraph, { type: "secondary", children: "打分:KEY 100 / 规范名 90 / 别名 80 / 包含 50,DEPRECATED −10。命中带出定义、绑定概念与证据。" }),
23
+ /* @__PURE__ */ r(s.Compact, { style: { width: "100%", maxWidth: 720, marginBottom: 16 }, children: [
24
+ /* @__PURE__ */ n(
25
+ T,
26
+ {
27
+ size: "large",
28
+ placeholder: "如:GMV / 成交额 / 订单数",
29
+ value: a,
30
+ onChange: (e) => h(e.target.value),
31
+ onPressEnter: p
32
+ }
33
+ ),
34
+ /* @__PURE__ */ n(w, { size: "large", type: "primary", icon: /* @__PURE__ */ n(z, {}), loading: g, onClick: p, children: "消歧" })
35
+ ] }),
36
+ t && t.hits.length === 0 ? /* @__PURE__ */ n(x, { type: "info", showIcon: !0, message: `没有命中:“${t.query}”`, description: "先登记术语,再让 agent 消费。" }) : null,
37
+ t && t.hits.length > 0 ? /* @__PURE__ */ n(s, { direction: "vertical", style: { width: "100%" }, size: 12, children: t.hits.map((e, v) => {
38
+ const m = e.term || e.concept, u = e.term ? e.term.termKey : e.concept.conceptKey;
39
+ return /* @__PURE__ */ r(
40
+ I,
41
+ {
42
+ size: "small",
43
+ title: /* @__PURE__ */ r(s, { children: [
44
+ /* @__PURE__ */ n(o, { color: "purple", children: e.score }),
45
+ /* @__PURE__ */ n("span", { children: u }),
46
+ /* @__PURE__ */ n(o, { children: e.matchedOn }),
47
+ e.term ? /* @__PURE__ */ n(o, { color: "blue", children: e.term.canonical }) : /* @__PURE__ */ n(o, { color: "cyan", children: e.concept.name })
48
+ ] }),
49
+ children: [
50
+ /* @__PURE__ */ n(i.Paragraph, { style: { marginBottom: 8 }, children: m ? m.definition : "" }),
51
+ e.concept ? /* @__PURE__ */ r(i.Text, { type: "secondary", children: [
52
+ "绑定概念:",
53
+ e.concept.conceptKey,
54
+ "(",
55
+ e.concept.conceptType,
56
+ ")"
57
+ ] }) : null,
58
+ /* @__PURE__ */ n(
59
+ E,
60
+ {
61
+ size: "small",
62
+ style: { marginTop: 8 },
63
+ rowKey: (c) => `${c.evidenceType}-${c.refId}-${c.revisionNo}`,
64
+ pagination: !1,
65
+ dataSource: e.evidence || [],
66
+ columns: [
67
+ { title: "证据类型", dataIndex: "evidenceType", width: 140 },
68
+ { title: "refId", dataIndex: "refId" },
69
+ { title: "snapshotHash", dataIndex: "snapshotHash", width: 200 }
70
+ ]
71
+ }
72
+ )
73
+ ]
74
+ },
75
+ `${u}-${v}`
76
+ );
77
+ }) }) : null,
78
+ t ? null : /* @__PURE__ */ n($, { description: "输入一个词,看看认知域怎么理解它" })
79
+ ] });
80
+ }
81
+ export {
82
+ A as default
83
+ };
@@ -0,0 +1,221 @@
1
+ import { jsx as e, jsxs as o, Fragment as te } from "react/jsx-runtime";
2
+ import { useState as a, useCallback as ie, useEffect as ne } from "react";
3
+ import { useSearchParams as le, useNavigate as re } from "react-router-dom";
4
+ import { Input as d, Form as l, Alert as D, Spin as ae, Space as F, Button as p, Select as g, Descriptions as s, Typography as f, Tag as z, Table as x, Popconfirm as se, Modal as L, message as m } from "antd";
5
+ import { ArrowLeftOutlined as oe, ReloadOutlined as de, EditOutlined as ce, DiffOutlined as me, RollbackOutlined as ue } from "@ant-design/icons";
6
+ import { cognitionApi as u } from "./api.js";
7
+ import { S as he, T as pe, a as fe, t as ge } from "./EvidenceFormList-097ICr7D.js";
8
+ const { TextArea: ye } = d;
9
+ function Ee() {
10
+ const [P] = le(), q = re(), r = P.get("key") || "", [i, j] = a(null), [S, H] = a([]), [E, _] = a([]), [M, $] = a(!0), [O, k] = a(""), [U, y] = a(!1), [V, C] = a(!1), [w] = l.useForm(), [v, A] = a(null), [I, N] = a(null), [G, R] = a(!1), [c, J] = a(null), h = ie(async () => {
11
+ var t, n;
12
+ if (r) {
13
+ $(!0), k("");
14
+ try {
15
+ const [b, Z, T] = await Promise.all([
16
+ u.getTerm(r),
17
+ u.listTermEvidence(r),
18
+ u.listTermRevisions(r)
19
+ ]);
20
+ j(b), H(Z || []), _(T || []);
21
+ const B = (t = (T || [])[0]) == null ? void 0 : t.revisionNo, ee = (n = (T || [])[1]) == null ? void 0 : n.revisionNo;
22
+ N(B ?? null), A(ee ?? B ?? null);
23
+ } catch (b) {
24
+ k(b.message);
25
+ } finally {
26
+ $(!1);
27
+ }
28
+ }
29
+ }, [r]);
30
+ if (ne(() => {
31
+ h();
32
+ }, [h]), !r)
33
+ return /* @__PURE__ */ e(D, { type: "warning", showIcon: !0, message: "缺少 ?key= 参数" });
34
+ const Q = () => {
35
+ w.setFieldsValue({
36
+ ...i,
37
+ aliases: i.aliases || [],
38
+ evidences: ge(S)
39
+ }), y(!0);
40
+ }, W = async () => {
41
+ const t = await w.validateFields();
42
+ C(!0);
43
+ try {
44
+ await u.updateTerm(r, {
45
+ ...t,
46
+ termKey: r,
47
+ actor: t.actor || "console",
48
+ note: t.note || "console update"
49
+ }), m.success("已生成新 revision"), y(!1), await h();
50
+ } catch (n) {
51
+ m.error(n.field ? `${n.field}: ${n.message}` : n.message);
52
+ } finally {
53
+ C(!1);
54
+ }
55
+ }, X = async (t) => {
56
+ try {
57
+ await u.rollbackTerm(r, t, `console rollback to r${t}`), m.success(`已回滚到 r${t}(生成新 revision,历史不改写)`), await h();
58
+ } catch (n) {
59
+ m.error(n.message);
60
+ }
61
+ }, Y = async () => {
62
+ if (v == null || I == null) {
63
+ m.warning("先选两个 revision");
64
+ return;
65
+ }
66
+ try {
67
+ J(await u.diffTerm(r, v, I)), R(!0);
68
+ } catch (t) {
69
+ m.error(t.message);
70
+ }
71
+ }, K = E.map((t) => ({
72
+ value: t.revisionNo,
73
+ label: `r${t.revisionNo} · ${t.createdAt} · ${t.actor || "-"} · ${t.note || ""}`
74
+ }));
75
+ return /* @__PURE__ */ o(ae, { spinning: M, children: [
76
+ /* @__PURE__ */ o(F, { style: { marginBottom: 16 }, wrap: !0, children: [
77
+ /* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(oe, {}), onClick: () => q("/cognition/terms"), children: "返回列表" }),
78
+ /* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(de, {}), onClick: h, children: "刷新" }),
79
+ /* @__PURE__ */ e(p, { type: "primary", icon: /* @__PURE__ */ e(ce, {}), disabled: !i, onClick: Q, children: "编辑(生成新版本)" }),
80
+ /* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "left", value: v, onChange: A, options: K }),
81
+ /* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "right", value: I, onChange: N, options: K }),
82
+ /* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(me, {}), onClick: Y, children: "版本对比" })
83
+ ] }),
84
+ O ? /* @__PURE__ */ e(D, { type: "error", showIcon: !0, message: O, style: { marginBottom: 16 } }) : null,
85
+ i ? /* @__PURE__ */ o(te, { children: [
86
+ /* @__PURE__ */ o(s, { bordered: !0, size: "small", column: 2, style: { marginBottom: 16 }, children: [
87
+ /* @__PURE__ */ e(s.Item, { label: "termKey", children: /* @__PURE__ */ e(f.Text, { code: !0, children: i.termKey }) }),
88
+ /* @__PURE__ */ e(s.Item, { label: "规范名", children: i.canonical }),
89
+ /* @__PURE__ */ o(s.Item, { label: "状态", children: [
90
+ /* @__PURE__ */ e(z, { color: he[i.status] || "blue", children: i.status }),
91
+ i.supersededBy ? /* @__PURE__ */ o("span", { children: [
92
+ "→ ",
93
+ i.supersededBy
94
+ ] }) : null
95
+ ] }),
96
+ /* @__PURE__ */ o(s.Item, { label: "当前版本", children: [
97
+ "r",
98
+ i.revisionNo
99
+ ] }),
100
+ /* @__PURE__ */ e(s.Item, { label: "域", children: i.domain || "—" }),
101
+ /* @__PURE__ */ e(s.Item, { label: "owner", children: i.owner || "—" }),
102
+ /* @__PURE__ */ e(s.Item, { label: "绑定概念", children: i.conceptKey || "—" }),
103
+ /* @__PURE__ */ e(s.Item, { label: "更新时间", children: i.updatedAt }),
104
+ /* @__PURE__ */ e(s.Item, { label: "别名", span: 2, children: (i.aliases || []).length ? i.aliases.map((t) => /* @__PURE__ */ e(z, { children: t }, t)) : "—" }),
105
+ /* @__PURE__ */ e(s.Item, { label: "定义", span: 2, children: i.definition })
106
+ ] }),
107
+ /* @__PURE__ */ o(f.Title, { level: 5, children: [
108
+ "证据(当前版本 r",
109
+ i.revisionNo,
110
+ ")"
111
+ ] }),
112
+ /* @__PURE__ */ e(
113
+ x,
114
+ {
115
+ rowKey: "id",
116
+ size: "small",
117
+ style: { marginBottom: 24 },
118
+ dataSource: S,
119
+ pagination: !1,
120
+ columns: [
121
+ { title: "类型", dataIndex: "evidenceType", width: 140 },
122
+ { title: "refId", dataIndex: "refId" },
123
+ { title: "snapshotHash", dataIndex: "snapshotHash", width: 200 },
124
+ { title: "版本", dataIndex: "revisionNo", width: 80, render: (t) => `r${t}` },
125
+ { title: "采集时间", dataIndex: "capturedAt", width: 190 }
126
+ ]
127
+ }
128
+ ),
129
+ /* @__PURE__ */ e(f.Title, { level: 5, children: "版本历史(回滚不改写历史,只追加新 revision)" }),
130
+ /* @__PURE__ */ e(
131
+ x,
132
+ {
133
+ rowKey: "revisionNo",
134
+ size: "small",
135
+ dataSource: E,
136
+ pagination: !1,
137
+ columns: [
138
+ { title: "版本", dataIndex: "revisionNo", width: 80, render: (t) => `r${t}` },
139
+ { title: "时间", dataIndex: "createdAt", width: 190 },
140
+ { title: "操作人", dataIndex: "actor", width: 140 },
141
+ { title: "说明", dataIndex: "note" },
142
+ {
143
+ title: "操作",
144
+ width: 120,
145
+ render: (t, n) => /* @__PURE__ */ e(
146
+ se,
147
+ {
148
+ title: `回滚到 r${n.revisionNo}?`,
149
+ description: "会以该版本内容生成一条新的 revision",
150
+ onConfirm: () => X(n.revisionNo),
151
+ children: /* @__PURE__ */ e(p, { size: "small", icon: /* @__PURE__ */ e(ue, {}), children: "回滚" })
152
+ }
153
+ )
154
+ }
155
+ ]
156
+ }
157
+ )
158
+ ] }) : null,
159
+ /* @__PURE__ */ e(
160
+ L,
161
+ {
162
+ title: `编辑 ${r}`,
163
+ open: U,
164
+ onCancel: () => y(!1),
165
+ onOk: W,
166
+ confirmLoading: V,
167
+ width: 820,
168
+ destroyOnHidden: !0,
169
+ children: /* @__PURE__ */ o(l, { form: w, layout: "vertical", children: [
170
+ /* @__PURE__ */ o(F, { size: "large", wrap: !0, children: [
171
+ /* @__PURE__ */ e(l.Item, { name: "canonical", label: "规范名", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(d, { style: { width: 240 } }) }),
172
+ /* @__PURE__ */ e(l.Item, { name: "status", label: "状态", rules: [{ required: !0 }], children: /* @__PURE__ */ e(g, { style: { width: 140 }, options: pe.map((t) => ({ value: t, label: t })) }) }),
173
+ /* @__PURE__ */ e(l.Item, { name: "supersededBy", label: "替代项(DEPRECATED 必填)", children: /* @__PURE__ */ e(d, { style: { width: 180 } }) }),
174
+ /* @__PURE__ */ e(l.Item, { name: "domain", label: "域", children: /* @__PURE__ */ e(d, { style: { width: 140 } }) }),
175
+ /* @__PURE__ */ e(l.Item, { name: "owner", label: "owner", children: /* @__PURE__ */ e(d, { style: { width: 140 } }) })
176
+ ] }),
177
+ /* @__PURE__ */ e(l.Item, { name: "aliases", label: "别名", children: /* @__PURE__ */ e(g, { mode: "tags", tokenSeparators: [","] }) }),
178
+ /* @__PURE__ */ e(l.Item, { name: "conceptKey", label: "绑定概念", children: /* @__PURE__ */ e(d, {}) }),
179
+ /* @__PURE__ */ e(
180
+ l.Item,
181
+ {
182
+ name: "definition",
183
+ label: "定义",
184
+ rules: [{ required: !0, message: "必填" }],
185
+ children: /* @__PURE__ */ e(ye, { rows: 3 })
186
+ }
187
+ ),
188
+ /* @__PURE__ */ e(l.Item, { name: "note", label: "变更说明", children: /* @__PURE__ */ e(d, { placeholder: "console update" }) }),
189
+ /* @__PURE__ */ e(l.Item, { label: "证据(至少一条;本次提交即本版本证据)", required: !0, children: /* @__PURE__ */ e(fe, {}) })
190
+ ] })
191
+ }
192
+ ),
193
+ /* @__PURE__ */ e(
194
+ L,
195
+ {
196
+ title: c ? `${c.subjectKey}: r${c.leftRevision} → r${c.rightRevision}` : "版本对比",
197
+ open: G,
198
+ onCancel: () => R(!1),
199
+ footer: null,
200
+ width: 720,
201
+ children: /* @__PURE__ */ e(
202
+ x,
203
+ {
204
+ rowKey: (t) => t.field,
205
+ size: "small",
206
+ pagination: !1,
207
+ dataSource: c ? c.changes : [],
208
+ columns: [
209
+ { title: "字段", dataIndex: "field", width: 140 },
210
+ { title: "左", dataIndex: "left", render: (t) => /* @__PURE__ */ e(f.Text, { delete: t !== "", children: t ?? "—" }) },
211
+ { title: "右", dataIndex: "right", render: (t) => /* @__PURE__ */ e(f.Text, { strong: !0, children: t ?? "—" }) }
212
+ ]
213
+ }
214
+ )
215
+ }
216
+ )
217
+ ] });
218
+ }
219
+ export {
220
+ Ee as default
221
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),o=require("./api.cjs"),u=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:V}=t.Input;function G(){const[O]=E.useSearchParams(),$=E.useNavigate(),l=O.get("key")||"",[i,k]=n.useState(null),[f,B]=n.useState([]),[y,C]=n.useState([]),[R,I]=n.useState(!0),[v,w]=n.useState(""),[q,m]=n.useState(!1),[N,b]=n.useState(!1),[h]=t.Form.useForm(),[p,T]=n.useState(null),[x,S]=n.useState(null),[K,D]=n.useState(!1),[a,L]=n.useState(null),c=n.useCallback(async()=>{var s,r;if(l){I(!0),w("");try{const[j,_,g]=await Promise.all([o.cognitionApi.getTerm(l),o.cognitionApi.listTermEvidence(l),o.cognitionApi.listTermRevisions(l)]);k(j),B(_||[]),C(g||[]);const A=(s=(g||[])[0])==null?void 0:s.revisionNo,U=(r=(g||[])[1])==null?void 0:r.revisionNo;S(A??null),T(U??A??null)}catch(j){w(j.message)}finally{I(!1)}}},[l]);if(n.useEffect(()=>{c()},[c]),!l)return e.jsx(t.Alert,{type:"warning",showIcon:!0,message:"缺少 ?key= 参数"});const z=()=>{h.setFieldsValue({...i,aliases:i.aliases||[],evidences:u.toEvidenceFormValues(f)}),m(!0)},P=async()=>{const s=await h.validateFields();b(!0);try{await o.cognitionApi.updateTerm(l,{...s,termKey:l,actor:s.actor||"console",note:s.note||"console update"}),t.message.success("已生成新 revision"),m(!1),await c()}catch(r){t.message.error(r.field?`${r.field}: ${r.message}`:r.message)}finally{b(!1)}},M=async s=>{try{await o.cognitionApi.rollbackTerm(l,s,`console rollback to r${s}`),t.message.success(`已回滚到 r${s}(生成新 revision,历史不改写)`),await c()}catch(r){t.message.error(r.message)}},H=async()=>{if(p==null||x==null){t.message.warning("先选两个 revision");return}try{L(await o.cognitionApi.diffTerm(l,p,x)),D(!0)}catch(s){t.message.error(s.message)}},F=y.map(s=>({value:s.revisionNo,label:`r${s.revisionNo} · ${s.createdAt} · ${s.actor||"-"} · ${s.note||""}`}));return e.jsxs(t.Spin,{spinning:R,children:[e.jsxs(t.Space,{style:{marginBottom:16},wrap:!0,children:[e.jsx(t.Button,{icon:e.jsx(d.ArrowLeftOutlined,{}),onClick:()=>$("/cognition/terms"),children:"返回列表"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:c,children:"刷新"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.EditOutlined,{}),disabled:!i,onClick:z,children:"编辑(生成新版本)"}),e.jsx(t.Select,{style:{width:300},placeholder:"left",value:p,onChange:T,options:F}),e.jsx(t.Select,{style:{width:300},placeholder:"right",value:x,onChange:S,options:F}),e.jsx(t.Button,{icon:e.jsx(d.DiffOutlined,{}),onClick:H,children:"版本对比"})]}),v?e.jsx(t.Alert,{type:"error",showIcon:!0,message:v,style:{marginBottom:16}}):null,i?e.jsxs(e.Fragment,{children:[e.jsxs(t.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(t.Descriptions.Item,{label:"termKey",children:e.jsx(t.Typography.Text,{code:!0,children:i.termKey})}),e.jsx(t.Descriptions.Item,{label:"规范名",children:i.canonical}),e.jsxs(t.Descriptions.Item,{label:"状态",children:[e.jsx(t.Tag,{color:u.STATUS_COLOR[i.status]||"blue",children:i.status}),i.supersededBy?e.jsxs("span",{children:["→ ",i.supersededBy]}):null]}),e.jsxs(t.Descriptions.Item,{label:"当前版本",children:["r",i.revisionNo]}),e.jsx(t.Descriptions.Item,{label:"域",children:i.domain||"—"}),e.jsx(t.Descriptions.Item,{label:"owner",children:i.owner||"—"}),e.jsx(t.Descriptions.Item,{label:"绑定概念",children:i.conceptKey||"—"}),e.jsx(t.Descriptions.Item,{label:"更新时间",children:i.updatedAt}),e.jsx(t.Descriptions.Item,{label:"别名",span:2,children:(i.aliases||[]).length?i.aliases.map(s=>e.jsx(t.Tag,{children:s},s)):"—"}),e.jsx(t.Descriptions.Item,{label:"定义",span:2,children:i.definition})]}),e.jsxs(t.Typography.Title,{level:5,children:["证据(当前版本 r",i.revisionNo,")"]}),e.jsx(t.Table,{rowKey:"id",size:"small",style:{marginBottom:24},dataSource:f,pagination:!1,columns:[{title:"类型",dataIndex:"evidenceType",width:140},{title:"refId",dataIndex:"refId"},{title:"snapshotHash",dataIndex:"snapshotHash",width:200},{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"采集时间",dataIndex:"capturedAt",width:190}]}),e.jsx(t.Typography.Title,{level:5,children:"版本历史(回滚不改写历史,只追加新 revision)"}),e.jsx(t.Table,{rowKey:"revisionNo",size:"small",dataSource:y,pagination:!1,columns:[{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"时间",dataIndex:"createdAt",width:190},{title:"操作人",dataIndex:"actor",width:140},{title:"说明",dataIndex:"note"},{title:"操作",width:120,render:(s,r)=>e.jsx(t.Popconfirm,{title:`回滚到 r${r.revisionNo}?`,description:"会以该版本内容生成一条新的 revision",onConfirm:()=>M(r.revisionNo),children:e.jsx(t.Button,{size:"small",icon:e.jsx(d.RollbackOutlined,{}),children:"回滚"})})}]})]}):null,e.jsx(t.Modal,{title:`编辑 ${l}`,open:q,onCancel:()=>m(!1),onOk:P,confirmLoading:N,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:h,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:240}})}),e.jsx(t.Form.Item,{name:"status",label:"状态",rules:[{required:!0}],children:e.jsx(t.Select,{style:{width:140},options:u.TERM_STATUSES.map(s=>({value:s,label:s}))})}),e.jsx(t.Form.Item,{name:"supersededBy",label:"替代项(DEPRECATED 必填)",children:e.jsx(t.Input,{style:{width:180}})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140}})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念",children:e.jsx(t.Input,{})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(V,{rows:3})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console update"})}),e.jsx(t.Form.Item,{label:"证据(至少一条;本次提交即本版本证据)",required:!0,children:e.jsx(u.EvidenceFormList,{})})]})}),e.jsx(t.Modal,{title:a?`${a.subjectKey}: r${a.leftRevision} → r${a.rightRevision}`:"版本对比",open:K,onCancel:()=>D(!1),footer:null,width:720,children:e.jsx(t.Table,{rowKey:s=>s.field,size:"small",pagination:!1,dataSource:a?a.changes:[],columns:[{title:"字段",dataIndex:"field",width:140},{title:"左",dataIndex:"left",render:s=>e.jsx(t.Typography.Text,{delete:s!=="",children:s??"—"})},{title:"右",dataIndex:"right",render:s=>e.jsx(t.Typography.Text,{strong:!0,children:s??"—"})}]})})]})}exports.default=G;
@@ -0,0 +1,162 @@
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { useState as o, useEffect as A } from "react";
3
+ import { useNavigate as O } from "react-router-dom";
4
+ import { Input as r, Form as a, Space as y, Select as h, Button as u, Table as z, Modal as F, message as p, Tag as f } from "antd";
5
+ import { SearchOutlined as I, ReloadOutlined as R, PlusOutlined as $ } from "@ant-design/icons";
6
+ import { cognitionApi as b } from "./api.js";
7
+ import { T as v, K as P, a as L, S as _ } from "./EvidenceFormList-097ICr7D.js";
8
+ const { TextArea: N } = r;
9
+ function D() {
10
+ const C = O(), [T, S] = o([]), [x, g] = o(!1), [n, s] = o({ q: "", domain: "", status: "" }), [K, c] = o(!1), [E, w] = o(!1), [m] = a.useForm(), i = async (t = n) => {
11
+ g(!0);
12
+ try {
13
+ S(await b.listTerms(t));
14
+ } catch (l) {
15
+ p.error(l.message);
16
+ } finally {
17
+ g(!1);
18
+ }
19
+ };
20
+ A(() => {
21
+ i();
22
+ }, []);
23
+ const k = async () => {
24
+ const t = await m.validateFields();
25
+ w(!0);
26
+ try {
27
+ await b.createTerm({
28
+ ...t,
29
+ status: t.status || "ACTIVE",
30
+ actor: t.actor || "console",
31
+ note: t.note || "console create"
32
+ }), p.success(`术语 ${t.termKey} 已登记`), c(!1), m.resetFields(), await i();
33
+ } catch (l) {
34
+ p.error(l.field ? `${l.field}: ${l.message}` : l.message);
35
+ } finally {
36
+ w(!1);
37
+ }
38
+ }, q = [
39
+ {
40
+ title: "termKey",
41
+ dataIndex: "termKey",
42
+ width: 200,
43
+ render: (t) => /* @__PURE__ */ e("a", { onClick: () => C(`/cognition/terms/detail?key=${encodeURIComponent(t)}`), children: t })
44
+ },
45
+ { title: "规范名", dataIndex: "canonical", width: 160 },
46
+ {
47
+ title: "别名",
48
+ dataIndex: "aliases",
49
+ render: (t) => t && t.length ? t.map((l) => /* @__PURE__ */ e(f, { children: l }, l)) : /* @__PURE__ */ e("span", { style: { color: "#bbb" }, children: "—" })
50
+ },
51
+ { title: "域", dataIndex: "domain", width: 120 },
52
+ {
53
+ title: "状态",
54
+ dataIndex: "status",
55
+ width: 110,
56
+ render: (t) => /* @__PURE__ */ e(f, { color: _[t] || "blue", children: t })
57
+ },
58
+ {
59
+ title: "概念",
60
+ dataIndex: "conceptKey",
61
+ width: 160,
62
+ render: (t) => t || /* @__PURE__ */ e("span", { style: { color: "#bbb" }, children: "—" })
63
+ },
64
+ { title: "版本", dataIndex: "revisionNo", width: 70, render: (t) => `r${t}` },
65
+ { title: "更新时间", dataIndex: "updatedAt", width: 190 }
66
+ ];
67
+ return /* @__PURE__ */ d("div", { children: [
68
+ /* @__PURE__ */ d(y, { wrap: !0, style: { marginBottom: 16 }, children: [
69
+ /* @__PURE__ */ e(
70
+ r,
71
+ {
72
+ placeholder: "按 key / 规范名 / 别名搜索",
73
+ allowClear: !0,
74
+ prefix: /* @__PURE__ */ e(I, {}),
75
+ style: { width: 260 },
76
+ value: n.q,
77
+ onChange: (t) => s({ ...n, q: t.target.value }),
78
+ onPressEnter: () => i()
79
+ }
80
+ ),
81
+ /* @__PURE__ */ e(
82
+ r,
83
+ {
84
+ placeholder: "域(如 trade)",
85
+ allowClear: !0,
86
+ style: { width: 160 },
87
+ value: n.domain,
88
+ onChange: (t) => s({ ...n, domain: t.target.value }),
89
+ onPressEnter: () => i()
90
+ }
91
+ ),
92
+ /* @__PURE__ */ e(
93
+ h,
94
+ {
95
+ placeholder: "状态",
96
+ allowClear: !0,
97
+ style: { width: 140 },
98
+ value: n.status || void 0,
99
+ onChange: (t) => s({ ...n, status: t || "" }),
100
+ options: v.map((t) => ({ value: t, label: t }))
101
+ }
102
+ ),
103
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(I, {}), onClick: () => i(), children: "查询" }),
104
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(R, {}), onClick: () => {
105
+ s({ q: "", domain: "", status: "" }), i({});
106
+ }, children: "重置" }),
107
+ /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e($, {}), onClick: () => c(!0), children: "新建术语" })
108
+ ] }),
109
+ /* @__PURE__ */ e(
110
+ z,
111
+ {
112
+ rowKey: "termKey",
113
+ size: "middle",
114
+ loading: x,
115
+ columns: q,
116
+ dataSource: T,
117
+ pagination: { pageSize: 20, showSizeChanger: !1 },
118
+ scroll: { x: 1100 }
119
+ }
120
+ ),
121
+ /* @__PURE__ */ e(
122
+ F,
123
+ {
124
+ title: "新建术语(证据必填)",
125
+ open: K,
126
+ onCancel: () => c(!1),
127
+ onOk: k,
128
+ confirmLoading: E,
129
+ width: 820,
130
+ destroyOnHidden: !0,
131
+ children: /* @__PURE__ */ d(a, { form: m, layout: "vertical", children: [
132
+ /* @__PURE__ */ d(y, { size: "large", wrap: !0, children: [
133
+ /* @__PURE__ */ e(
134
+ a.Item,
135
+ {
136
+ name: "termKey",
137
+ label: "termKey",
138
+ rules: [
139
+ { required: !0, message: "必填" },
140
+ { pattern: P, message: "^[a-z][a-z0-9_.-]{1,127}$" }
141
+ ],
142
+ children: /* @__PURE__ */ e(r, { style: { width: 260 }, placeholder: "order.gmv" })
143
+ }
144
+ ),
145
+ /* @__PURE__ */ e(a.Item, { name: "canonical", label: "规范名", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(r, { style: { width: 220 }, placeholder: "成交总额" }) }),
146
+ /* @__PURE__ */ e(a.Item, { name: "domain", label: "域", children: /* @__PURE__ */ e(r, { style: { width: 140 }, placeholder: "trade" }) }),
147
+ /* @__PURE__ */ e(a.Item, { name: "owner", label: "owner", children: /* @__PURE__ */ e(r, { style: { width: 140 }, placeholder: "@team" }) }),
148
+ /* @__PURE__ */ e(a.Item, { name: "status", label: "状态", initialValue: "ACTIVE", children: /* @__PURE__ */ e(h, { style: { width: 130 }, options: v.map((t) => ({ value: t, label: t })) }) })
149
+ ] }),
150
+ /* @__PURE__ */ e(a.Item, { name: "aliases", label: "别名", children: /* @__PURE__ */ e(h, { mode: "tags", placeholder: "回车追加", tokenSeparators: [","] }) }),
151
+ /* @__PURE__ */ e(a.Item, { name: "conceptKey", label: "绑定概念(可空)", children: /* @__PURE__ */ e(r, { placeholder: "order" }) }),
152
+ /* @__PURE__ */ e(a.Item, { name: "definition", label: "定义", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(N, { rows: 3, placeholder: "一句话说清口径;口径细节写到规则/指标,别塞进定义" }) }),
153
+ /* @__PURE__ */ e(a.Item, { name: "note", label: "变更说明", children: /* @__PURE__ */ e(r, { placeholder: "console create" }) }),
154
+ /* @__PURE__ */ e(a.Item, { label: "证据(至少一条)", required: !0, children: /* @__PURE__ */ e(L, {}) })
155
+ ] })
156
+ }
157
+ )
158
+ ] });
159
+ }
160
+ export {
161
+ D as default
162
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),f=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),x=require("./api.cjs"),o=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:T}=t.Input;function v(){const p=f.useNavigate(),[j,g]=n.useState([]),[y,m]=n.useState(!1),[r,i]=n.useState({q:"",domain:"",status:""}),[w,c]=n.useState(!1),[I,h]=n.useState(!1),[u]=t.Form.useForm(),l=async(a=r)=>{m(!0);try{g(await x.cognitionApi.listTerms(a))}catch(s){t.message.error(s.message)}finally{m(!1)}};n.useEffect(()=>{l()},[]);const S=async()=>{const a=await u.validateFields();h(!0);try{await x.cognitionApi.createTerm({...a,status:a.status||"ACTIVE",actor:a.actor||"console",note:a.note||"console create"}),t.message.success(`术语 ${a.termKey} 已登记`),c(!1),u.resetFields(),await l()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{h(!1)}},b=[{title:"termKey",dataIndex:"termKey",width:200,render:a=>e.jsx("a",{onClick:()=>p(`/cognition/terms/detail?key=${encodeURIComponent(a)}`),children:a})},{title:"规范名",dataIndex:"canonical",width:160},{title:"别名",dataIndex:"aliases",render:a=>a&&a.length?a.map(s=>e.jsx(t.Tag,{children:s},s)):e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"域",dataIndex:"domain",width:120},{title:"状态",dataIndex:"status",width:110,render:a=>e.jsx(t.Tag,{color:o.STATUS_COLOR[a]||"blue",children:a})},{title:"概念",dataIndex:"conceptKey",width:160,render:a=>a||e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"版本",dataIndex:"revisionNo",width:70,render:a=>`r${a}`},{title:"更新时间",dataIndex:"updatedAt",width:190}];return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"按 key / 规范名 / 别名搜索",allowClear:!0,prefix:e.jsx(d.SearchOutlined,{}),style:{width:260},value:r.q,onChange:a=>i({...r,q:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:160},value:r.domain,onChange:a=>i({...r,domain:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Select,{placeholder:"状态",allowClear:!0,style:{width:140},value:r.status||void 0,onChange:a=>i({...r,status:a||""}),options:o.TERM_STATUSES.map(a=>({value:a,label:a}))}),e.jsx(t.Button,{icon:e.jsx(d.SearchOutlined,{}),onClick:()=>l(),children:"查询"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:()=>{i({q:"",domain:"",status:""}),l({})},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.PlusOutlined,{}),onClick:()=>c(!0),children:"新建术语"})]}),e.jsx(t.Table,{rowKey:"termKey",size:"middle",loading:y,columns:b,dataSource:j,pagination:{pageSize:20,showSizeChanger:!1},scroll:{x:1100}}),e.jsx(t.Modal,{title:"新建术语(证据必填)",open:w,onCancel:()=>c(!1),onOk:S,confirmLoading:I,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:u,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"termKey",label:"termKey",rules:[{required:!0,message:"必填"},{pattern:o.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:260},placeholder:"order.gmv"})}),e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:220},placeholder:"成交总额"})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140},placeholder:"trade"})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140},placeholder:"@team"})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ACTIVE",children:e.jsx(t.Select,{style:{width:130},options:o.TERM_STATUSES.map(a=>({value:a,label:a}))})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",placeholder:"回车追加",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念(可空)",children:e.jsx(t.Input,{placeholder:"order"})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(T,{rows:3,placeholder:"一句话说清口径;口径细节写到规则/指标,别塞进定义"})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console create"})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(o.EvidenceFormList,{})})]})})]})}exports.default=v;
package/dist/api.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s="z-cognition-token";function m(){try{return localStorage.getItem(s)||""}catch{return""}}function d(e){try{e?localStorage.setItem(s,e):localStorage.removeItem(s)}catch{}}class T extends Error{constructor(n,t){const i=t&&t.error?t.error:`HTTP ${n}`;super(i),this.status=n,this.field=t&&t.field,this.body=t}}async function o(e,n,t){const i={Accept:"application/json"};t!==void 0&&(i["Content-Type"]="application/json");const l=m();l&&(i.Authorization=`Bearer ${l}`);const p=await fetch(`/cognition${n}`,{method:e,headers:i,body:t===void 0?void 0:JSON.stringify(t)}),a=await p.text();let c=null;if(a)try{c=JSON.parse(a)}catch{c={error:a}}if(!p.ok)throw new T(p.status,c);return c}const r=e=>{const n=Object.entries(e||{}).filter(([,t])=>t!=null&&t!=="").map(([t,i])=>`${encodeURIComponent(t)}=${encodeURIComponent(i)}`);return n.length?`?${n.join("&")}`:""},u={listTerms:({domain:e,status:n,q:t}={})=>o("GET",`/api/terms${r({domain:e,status:n,q:t})}`),getTerm:e=>o("GET",`/api/terms/${encodeURIComponent(e)}`),createTerm:e=>o("POST","/api/terms",e),updateTerm:(e,n)=>o("PUT",`/api/terms/${encodeURIComponent(e)}`,n),listTermRevisions:e=>o("GET",`/api/terms/${encodeURIComponent(e)}/revisions`),listTermEvidence:e=>o("GET",`/api/terms/${encodeURIComponent(e)}/evidence`),diffTerm:(e,n,t)=>o("GET",`/api/terms/${encodeURIComponent(e)}/diff${r({left:n,right:t})}`),rollbackTerm:(e,n,t)=>o("POST",`/api/terms/${encodeURIComponent(e)}/rollback/${n}${r({note:t})}`),listConcepts:({domain:e}={})=>o("GET",`/api/concepts${r({domain:e})}`),getConcept:e=>o("GET",`/api/concepts/${encodeURIComponent(e)}`),listConceptEvidence:e=>o("GET",`/api/concepts/${encodeURIComponent(e)}/evidence`),createConcept:e=>o("POST","/api/concepts",e),updateConcept:(e,n)=>o("PUT",`/api/concepts/${encodeURIComponent(e)}`,n),resolve:e=>o("POST","/api/resolve",{q:e}),impact:(e,n)=>o("GET",`/api/impact${r({subjectType:e,subjectKey:n})}`)};exports.ApiError=T;exports.TOKEN_KEY=s;exports.cognitionApi=u;exports.getToken=m;exports.setToken=d;
package/dist/api.js ADDED
@@ -0,0 +1,67 @@
1
+ const a = "z-cognition-token";
2
+ function l() {
3
+ try {
4
+ return localStorage.getItem(a) || "";
5
+ } catch {
6
+ return "";
7
+ }
8
+ }
9
+ function d(e) {
10
+ try {
11
+ e ? localStorage.setItem(a, e) : localStorage.removeItem(a);
12
+ } catch {
13
+ }
14
+ }
15
+ class T extends Error {
16
+ constructor(n, t) {
17
+ const i = t && t.error ? t.error : `HTTP ${n}`;
18
+ super(i), this.status = n, this.field = t && t.field, this.body = t;
19
+ }
20
+ }
21
+ async function o(e, n, t) {
22
+ const i = { Accept: "application/json" };
23
+ t !== void 0 && (i["Content-Type"] = "application/json");
24
+ const m = l();
25
+ m && (i.Authorization = `Bearer ${m}`);
26
+ const s = await fetch(`/cognition${n}`, {
27
+ method: e,
28
+ headers: i,
29
+ body: t === void 0 ? void 0 : JSON.stringify(t)
30
+ }), p = await s.text();
31
+ let r = null;
32
+ if (p)
33
+ try {
34
+ r = JSON.parse(p);
35
+ } catch {
36
+ r = { error: p };
37
+ }
38
+ if (!s.ok) throw new T(s.status, r);
39
+ return r;
40
+ }
41
+ const c = (e) => {
42
+ const n = Object.entries(e || {}).filter(([, t]) => t != null && t !== "").map(([t, i]) => `${encodeURIComponent(t)}=${encodeURIComponent(i)}`);
43
+ return n.length ? `?${n.join("&")}` : "";
44
+ }, f = {
45
+ listTerms: ({ domain: e, status: n, q: t } = {}) => o("GET", `/api/terms${c({ domain: e, status: n, q: t })}`),
46
+ getTerm: (e) => o("GET", `/api/terms/${encodeURIComponent(e)}`),
47
+ createTerm: (e) => o("POST", "/api/terms", e),
48
+ updateTerm: (e, n) => o("PUT", `/api/terms/${encodeURIComponent(e)}`, n),
49
+ listTermRevisions: (e) => o("GET", `/api/terms/${encodeURIComponent(e)}/revisions`),
50
+ listTermEvidence: (e) => o("GET", `/api/terms/${encodeURIComponent(e)}/evidence`),
51
+ diffTerm: (e, n, t) => o("GET", `/api/terms/${encodeURIComponent(e)}/diff${c({ left: n, right: t })}`),
52
+ rollbackTerm: (e, n, t) => o("POST", `/api/terms/${encodeURIComponent(e)}/rollback/${n}${c({ note: t })}`),
53
+ listConcepts: ({ domain: e } = {}) => o("GET", `/api/concepts${c({ domain: e })}`),
54
+ getConcept: (e) => o("GET", `/api/concepts/${encodeURIComponent(e)}`),
55
+ listConceptEvidence: (e) => o("GET", `/api/concepts/${encodeURIComponent(e)}/evidence`),
56
+ createConcept: (e) => o("POST", "/api/concepts", e),
57
+ updateConcept: (e, n) => o("PUT", `/api/concepts/${encodeURIComponent(e)}`, n),
58
+ resolve: (e) => o("POST", "/api/resolve", { q: e }),
59
+ impact: (e, n) => o("GET", `/api/impact${c({ subjectType: e, subjectKey: n })}`)
60
+ };
61
+ export {
62
+ T as ApiError,
63
+ a as TOKEN_KEY,
64
+ f as cognitionApi,
65
+ l as getToken,
66
+ d as setToken
67
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./api.cjs"),t=require("./EvidenceFormList-CQNgMNCG.cjs"),r=require("./TermsPage-CE3E3fG-.cjs"),T=require("./TermDetailPage-DQcYkPdm.cjs"),o=require("./ConceptsPage-BH4lEiVn.cjs"),E=require("./ResolvePage-BDb56PdI.cjs"),a=require("./ImpactPage-BMvZUgTJ.cjs"),i=require("./DocsPage-CmGTg0A3.cjs");exports.ApiError=e.ApiError;exports.TOKEN_KEY=e.TOKEN_KEY;exports.cognitionApi=e.cognitionApi;exports.getToken=e.getToken;exports.setToken=e.setToken;exports.CONCEPT_TYPES=t.CONCEPT_TYPES;exports.EVIDENCE_TYPES=t.EVIDENCE_TYPES;exports.KEY_PATTERN=t.KEY_PATTERN;exports.STATUS_COLOR=t.STATUS_COLOR;exports.TERM_STATUSES=t.TERM_STATUSES;exports.TermsPage=r.default;exports.TermDetailPage=T.default;exports.ConceptsPage=o.default;exports.ResolvePage=E.default;exports.ImpactPage=a.default;exports.DocsPage=i.default;
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import { ApiError as o, TOKEN_KEY as r, cognitionApi as t, getToken as s, setToken as T } from "./api.js";
2
+ import { C as E, E as p, K as m, S as P, T as g } from "./EvidenceFormList-097ICr7D.js";
3
+ import { default as x } from "./TermsPage-BJWfX1hw.js";
4
+ import { default as d } from "./TermDetailPage-BiF5UVM5.js";
5
+ import { default as C } from "./ConceptsPage-C8nsSzRc.js";
6
+ import { default as i } from "./ResolvePage-CmrRVFkA.js";
7
+ import { default as A } from "./ImpactPage-BiajQqHA.js";
8
+ import { default as K } from "./DocsPage-DNkkd9Sm.js";
9
+ export {
10
+ o as ApiError,
11
+ E as CONCEPT_TYPES,
12
+ C as ConceptsPage,
13
+ K as DocsPage,
14
+ p as EVIDENCE_TYPES,
15
+ A as ImpactPage,
16
+ m as KEY_PATTERN,
17
+ i as ResolvePage,
18
+ P as STATUS_COLOR,
19
+ g as TERM_STATUSES,
20
+ r as TOKEN_KEY,
21
+ d as TermDetailPage,
22
+ x as TermsPage,
23
+ t as cognitionApi,
24
+ s as getToken,
25
+ T as setToken
26
+ };
package/dist/pages.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),e=require("react"),t=require("@ant-design/icons"),n=e.lazy(()=>Promise.resolve().then(()=>require("./TermsPage-CE3E3fG-.cjs"))),i=e.lazy(()=>Promise.resolve().then(()=>require("./TermDetailPage-DQcYkPdm.cjs"))),s=e.lazy(()=>Promise.resolve().then(()=>require("./ConceptsPage-BH4lEiVn.cjs"))),c=e.lazy(()=>Promise.resolve().then(()=>require("./ResolvePage-BDb56PdI.cjs"))),r=e.lazy(()=>Promise.resolve().then(()=>require("./ImpactPage-BMvZUgTJ.cjs"))),a=e.lazy(()=>Promise.resolve().then(()=>require("./DocsPage-CmGTg0A3.cjs"))),l={title:"z-cognition 业务认知域",short:"z-cognition"},m=[{key:"/cognition/terms",label:"术语",icon:o.jsx(t.TagsOutlined,{}),desc:"登记 / 版本 / 回滚"},{key:"/cognition/concepts",label:"概念",icon:o.jsx(t.PartitionOutlined,{}),desc:"六类概念与父子关系"},{key:"/cognition/resolve",label:"消歧",icon:o.jsx(t.SearchOutlined,{}),desc:"词 → 术语 + 证据"},{key:"/cognition/impact",label:"影响面",icon:o.jsx(t.BranchesOutlined,{}),desc:"改之前先看谁引用"},{key:"/cognition/docs",label:"说明",icon:o.jsx(t.ReadOutlined,{}),desc:"能力与 API 清单"}],p=[{path:"/cognition/terms",Component:n},{path:"/cognition/terms/detail",Component:i},{path:"/cognition/concepts",Component:s},{path:"/cognition/resolve",Component:c},{path:"/cognition/impact",Component:r},{path:"/cognition/docs",Component:a}];exports.appMeta=l;exports.menuItems=m;exports.routes=p;
package/dist/pages.js ADDED
@@ -0,0 +1,22 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { lazy as o } from "react";
3
+ import { TagsOutlined as n, PartitionOutlined as e, SearchOutlined as i, BranchesOutlined as c, ReadOutlined as s } from "@ant-design/icons";
4
+ const a = o(() => import("./TermsPage-BJWfX1hw.js")), p = o(() => import("./TermDetailPage-BiF5UVM5.js")), m = o(() => import("./ConceptsPage-C8nsSzRc.js")), r = o(() => import("./ResolvePage-CmrRVFkA.js")), l = o(() => import("./ImpactPage-BiajQqHA.js")), g = o(() => import("./DocsPage-DNkkd9Sm.js")), u = { title: "z-cognition 业务认知域", short: "z-cognition" }, C = [
5
+ { key: "/cognition/terms", label: "术语", icon: /* @__PURE__ */ t(n, {}), desc: "登记 / 版本 / 回滚" },
6
+ { key: "/cognition/concepts", label: "概念", icon: /* @__PURE__ */ t(e, {}), desc: "六类概念与父子关系" },
7
+ { key: "/cognition/resolve", label: "消歧", icon: /* @__PURE__ */ t(i, {}), desc: "词 → 术语 + 证据" },
8
+ { key: "/cognition/impact", label: "影响面", icon: /* @__PURE__ */ t(c, {}), desc: "改之前先看谁引用" },
9
+ { key: "/cognition/docs", label: "说明", icon: /* @__PURE__ */ t(s, {}), desc: "能力与 API 清单" }
10
+ ], y = [
11
+ { path: "/cognition/terms", Component: a },
12
+ { path: "/cognition/terms/detail", Component: p },
13
+ { path: "/cognition/concepts", Component: m },
14
+ { path: "/cognition/resolve", Component: r },
15
+ { path: "/cognition/impact", Component: l },
16
+ { path: "/cognition/docs", Component: g }
17
+ ];
18
+ export {
19
+ u as appMeta,
20
+ C as menuItems,
21
+ y as routes
22
+ };
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@yuku123/z-cognition-component",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "z-cognition 业务认知域共享组件层(library mode)—— 术语 / 概念 / 消歧 / 影响面",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./api": {
14
+ "import": "./dist/api.js",
15
+ "require": "./dist/api.cjs"
16
+ },
17
+ "./pages": {
18
+ "import": "./dist/pages.js",
19
+ "require": "./dist/pages.cjs"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "dev": "vite build --watch",
27
+ "build": "vite build",
28
+ "preview": "vite preview"
29
+ },
30
+ "peerDependencies": {
31
+ "@ant-design/icons": "^6.0.0",
32
+ "@yuku123/z-frontend-common": "^1.1.7",
33
+ "antd": "^6.0.0",
34
+ "react": "^19.0.0",
35
+ "react-dom": "^19.0.0",
36
+ "react-router-dom": "^7.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@ant-design/icons": "^6.1.0",
40
+ "@yuku123/z-frontend-common": "^1.1.7",
41
+ "antd": "^6.3.3",
42
+ "react": "^19.2.0",
43
+ "react-dom": "^19.2.0",
44
+ "react-router-dom": "^7.13.1",
45
+ "vite": "^6.2.0",
46
+ "@vitejs/plugin-react": "^4.2.1"
47
+ },
48
+ "keywords": [
49
+ "z-cognition",
50
+ "cognition",
51
+ "antd",
52
+ "component-library",
53
+ "yuku123"
54
+ ],
55
+ "license": "MIT",
56
+ "publishConfig": {
57
+ "registry": "https://registry.npmjs.org/",
58
+ "access": "public"
59
+ }
60
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.