@infinilabs/entity-ui 0.0.2
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 +239 -0
- package/dist/entity-ui.cjs +30 -0
- package/dist/entity-ui.js +1082 -0
- package/dist/index.d.ts +99 -0
- package/dist/style.css +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# @infinilabs/entity-ui 使用说明
|
|
2
|
+
|
|
3
|
+
**概述**
|
|
4
|
+
- `@infinilabs/entity-ui` 是一个实体信息的 UI 组件库,当前包含两个组件:
|
|
5
|
+
- `EntityCard`:基于 `antd` Popover 的锚定式信息卡片,贴近触发元素显示,提供富信息内容。
|
|
6
|
+
- `EntityLabel`:行内展示的实体标签组件,不使用弹层,适合作为列表或表格中的标识。
|
|
7
|
+
- 采用命名导出(不再提供默认导出),支持同时导出多个组件,利于 tree-shaking。
|
|
8
|
+
|
|
9
|
+
**安装**
|
|
10
|
+
- 使用 `pnpm`(或 `npm` / `yarn`)安装组件库:
|
|
11
|
+
- 组件需要 `react` 与 `react-dom` 作为对等依赖(peerDependencies)。
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @infinilabs/entity-ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**导入方式**
|
|
18
|
+
- 使用命名导入,库不再提供默认导出:
|
|
19
|
+
- 推荐统一从根入口导出使用:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { EntityCard, EntityLabel } from '@infinilabs/entity-ui';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**快速上手**
|
|
26
|
+
- 基本示例:一个行内标签 + 一个悬浮卡片
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { useState } from 'react';
|
|
30
|
+
import { EntityCard, EntityLabel } from '@infinilabs/entity-ui';
|
|
31
|
+
|
|
32
|
+
export default function Demo() {
|
|
33
|
+
const [count, setCount] = useState(0);
|
|
34
|
+
|
|
35
|
+
const data = {
|
|
36
|
+
style: {
|
|
37
|
+
width: '420px',
|
|
38
|
+
max_height: '360px',
|
|
39
|
+
cover_max_height: '160px',
|
|
40
|
+
},
|
|
41
|
+
color: '#027FFE',
|
|
42
|
+
icon: 'mail',
|
|
43
|
+
title: '邮件主题',
|
|
44
|
+
subtitle: '副标题',
|
|
45
|
+
url: 'https://example.com',
|
|
46
|
+
cover: 'https://picsum.photos/640/360',
|
|
47
|
+
categories: ['邮件', '收件箱'],
|
|
48
|
+
properties: [
|
|
49
|
+
{ icon: 'user', value: '张三' },
|
|
50
|
+
{ icon: 'datetime', value: '2025-10-15 10:00:00', view: 'datetime_with_time_zone' },
|
|
51
|
+
{ icon: 'tags', value: ['重要', '待办'], view: 'tags' },
|
|
52
|
+
{ value: 0.6, view: 'percent_bar', payload: { text: '处理进度' } },
|
|
53
|
+
],
|
|
54
|
+
details: {
|
|
55
|
+
table: {
|
|
56
|
+
rows: [
|
|
57
|
+
{ columns: [{ label: '发件人', value: 'a@example.com' }, { label: '收件人', value: 'b@example.com' }] },
|
|
58
|
+
{ columns: [{ label: '备注', value: '请尽快处理' }] },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
tags: ['工作', '提醒'],
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div style={{ position: 'relative', height: '60vh', padding: 24 }}>
|
|
67
|
+
<EntityLabel
|
|
68
|
+
data={{
|
|
69
|
+
type: 'user',
|
|
70
|
+
id: 'uuid1',
|
|
71
|
+
icon: 'user',
|
|
72
|
+
title: '邹稳安',
|
|
73
|
+
color: '#0f0f0f',
|
|
74
|
+
subtitle: '设计总监@产品创意部',
|
|
75
|
+
url: 'mailto:xxx@infinilabs.com',
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<div style={{ marginTop: 16 }}>
|
|
80
|
+
<EntityCard
|
|
81
|
+
title="示例卡片"
|
|
82
|
+
hoverOpenDelay={500}
|
|
83
|
+
closeDelay={200}
|
|
84
|
+
placement="right"
|
|
85
|
+
autoPlacement
|
|
86
|
+
data={data}
|
|
87
|
+
trigger={<button className="entity-card__btn">悬停打开卡片</button>}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**组件:EntityCard**
|
|
96
|
+
- 定位与交互
|
|
97
|
+
- `triggerType?: "click" | "hover"` 触发方式,默认 `"hover"`。
|
|
98
|
+
- `hoverOpenDelay?: number` 悬停延迟打开(毫秒),默认 `500`。
|
|
99
|
+
- `closeDelay?: number` 悬停离开延迟关闭(毫秒),默认 `200`。
|
|
100
|
+
- `placement?: "left" | "right" | "top" | "bottom"` 默认 `"right"`。
|
|
101
|
+
- `autoPlacement?: boolean` 打开前按视窗与触发表剩余空间自动选方向(优先级 `right → left → bottom → top`)。
|
|
102
|
+
- `open?: boolean`、`onOpenChange?: (open: boolean) => void` 支持受控模式。
|
|
103
|
+
- `trigger?: React.ReactNode` 自定义触发节点(默认一个 `Button`)。
|
|
104
|
+
- 弹层容器:优先挂载到触发元素(`getPopupContainer={() => triggerRef.current || document.body}`)。
|
|
105
|
+
- 内边距:移除内部容器默认 padding(`overlayInnerStyle={{ padding: 0 }}`)。
|
|
106
|
+
|
|
107
|
+
- 数据结构(`data`,驱动内容)
|
|
108
|
+
- `style?: { width?: string; height?: string; max_width?: string; max_height?: string; cover_max_height?: string }`
|
|
109
|
+
- `color?: string`、`icon?: string`、`title?: string`、`subtitle?: string`、`url?: string`、`cover?: string`
|
|
110
|
+
- `categories?: string[]` 面包屑
|
|
111
|
+
- `tags?: string[]` 标签
|
|
112
|
+
- `properties?: { icon?: string; value?: any; view?: string; payload?: any }[]`
|
|
113
|
+
- `details?: { table?: { rows?: { columns?: { label?: string; value?: any; view?: string; payload?: any }[] }[] } }`
|
|
114
|
+
- 图标支持:
|
|
115
|
+
- 当 `icon` 为 `http/https` URL 时,以 `<img>` 加载(尺寸与布局与 lucide 图标保持一致)。
|
|
116
|
+
- 其他字符串按 lucide-react 名称解析,内置别名:`user→User`, `email/mail→Mail`, `phone→Phone`, `datetime/date→Calendar`, `time→Clock`, `tags→Tag`;`kebab-case` 自动转为 `PascalCase`。
|
|
117
|
+
|
|
118
|
+
- 受控模式示例
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import React, { useState } from 'react';
|
|
122
|
+
import { EntityCard } from '@infinilabs/entity-ui';
|
|
123
|
+
|
|
124
|
+
export default function Controlled() {
|
|
125
|
+
const [open, setOpen] = useState(false);
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<EntityCard
|
|
129
|
+
title="受控卡片"
|
|
130
|
+
open={open}
|
|
131
|
+
onOpenChange={setOpen}
|
|
132
|
+
hoverOpenDelay={400}
|
|
133
|
+
closeDelay={250}
|
|
134
|
+
autoPlacement
|
|
135
|
+
placement="right"
|
|
136
|
+
data={{ style: { width: '420px', max_height: '320px' }, title: '受控内容' }}
|
|
137
|
+
trigger={<button className="entity-card__btn">悬停或点击打开</button>}
|
|
138
|
+
/>
|
|
139
|
+
<button onClick={() => setOpen((v) => !v)} style={{ marginLeft: 12 }}>
|
|
140
|
+
切换打开
|
|
141
|
+
</button>
|
|
142
|
+
</>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
- 多位置触发示例(测试自动定位)
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { EntityCard } from '@infinilabs/entity-ui';
|
|
151
|
+
|
|
152
|
+
export default function AutoPlacementDemo({ data }: { data: any }) {
|
|
153
|
+
return (
|
|
154
|
+
<div style={{ position: 'relative', height: '80vh', padding: 24 }}>
|
|
155
|
+
<div style={{ position: 'absolute', top: 12, left: 12 }}>
|
|
156
|
+
<EntityCard title="" triggerType="hover" hoverOpenDelay={500} autoPlacement data={data} trigger={<button>左上角</button>} />
|
|
157
|
+
</div>
|
|
158
|
+
<div style={{ position: 'absolute', top: 12, right: 12 }}>
|
|
159
|
+
<EntityCard title="" triggerType="hover" hoverOpenDelay={500} autoPlacement data={data} trigger={<button>右上角</button>} />
|
|
160
|
+
</div>
|
|
161
|
+
<div style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)' }}>
|
|
162
|
+
<EntityCard title="" triggerType="hover" hoverOpenDelay={500} autoPlacement data={data} trigger={<button>页面中间</button>} />
|
|
163
|
+
</div>
|
|
164
|
+
<div style={{ position: 'absolute', bottom: 12, left: 12 }}>
|
|
165
|
+
<EntityCard title="" triggerType="hover" hoverOpenDelay={500} autoPlacement data={data} trigger={<button>左下角</button>} />
|
|
166
|
+
</div>
|
|
167
|
+
<div style={{ position: 'absolute', bottom: 12, right: 12 }}>
|
|
168
|
+
<EntityCard title="" triggerType="hover" hoverOpenDelay={500} autoPlacement data={data} trigger={<button>右下角</button>} />
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**组件:EntityLabel**
|
|
176
|
+
- 功能概述
|
|
177
|
+
- 行内展示实体信息,不使用弹层。
|
|
178
|
+
- 渲染颜色块、图标(URL 或 lucide 名称)、标题、子标题、右侧外链。
|
|
179
|
+
|
|
180
|
+
- Props
|
|
181
|
+
- `data?: { type?: string; id?: string; icon?: string; title?: string; color?: string; subtitle?: string; url?: string; style?: { width?: string } }`
|
|
182
|
+
|
|
183
|
+
- 图标支持
|
|
184
|
+
- `data.icon` 如果是 `http/https` URL,则用 `<img>` 渲染;
|
|
185
|
+
- 否则按 lucide 名称解析(同上别名与 `kebab→Pascal` 转换)。
|
|
186
|
+
|
|
187
|
+
- 使用示例
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import { EntityLabel } from '@infinilabs/entity-ui';
|
|
191
|
+
|
|
192
|
+
export default function LabelDemo() {
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
<EntityLabel
|
|
196
|
+
data={{
|
|
197
|
+
type: 'user',
|
|
198
|
+
id: 'user-zouwenan',
|
|
199
|
+
icon: 'user',
|
|
200
|
+
title: '邹稳安',
|
|
201
|
+
color: '#0f0f0f',
|
|
202
|
+
subtitle: '设计总监@产品创意部',
|
|
203
|
+
url: 'mailto:xxx@infinilabs.com',
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
<EntityLabel
|
|
207
|
+
data={{
|
|
208
|
+
type: 'service',
|
|
209
|
+
id: 'svc-1',
|
|
210
|
+
icon: 'https://cdn.example.com/icons/service.png',
|
|
211
|
+
title: '服务 A',
|
|
212
|
+
color: '#027FFE',
|
|
213
|
+
subtitle: '生产环境',
|
|
214
|
+
url: 'https://example.com/service/a',
|
|
215
|
+
}}
|
|
216
|
+
/>
|
|
217
|
+
</>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**尺寸与滚动(EntityCard)**
|
|
223
|
+
- 使用 `data.style.width/height/max_width/max_height` 控制内容尺寸;
|
|
224
|
+
- 当内容高度超过 `max_height` 时,纵向滚动可见;
|
|
225
|
+
- 封面最大高度通过 `data.style.cover_max_height` 控制;
|
|
226
|
+
- 弹层内边距已移除,避免双重间距(`overlayInnerStyle={{ padding: 0 }}`)。
|
|
227
|
+
|
|
228
|
+
**常见问题**
|
|
229
|
+
- 导入失败或无法找到默认导出:请确认使用命名导出形式:`import { EntityCard, EntityLabel } from '@infinilabs/entity-ui'`。
|
|
230
|
+
- 悬停闪烁或误关闭:确认触发区与弹层是否存在遮挡(`z-index`)、指针事件设置是否合理;组件已将弹层容器绑定到触发元素以减少误判。
|
|
231
|
+
- 点击触发:将 `triggerType` 设置为 `"click"` 即可;同时可按需调整打开/关闭延迟为 `0`。
|
|
232
|
+
|
|
233
|
+
**迁移说明(从早期版本)**
|
|
234
|
+
- 移除默认导出;现在仅使用命名导出。
|
|
235
|
+
- `EntityCard` 已从 `Modal` 迁移到 `Popover`,不再使用 `mask`;修复了悬停闪烁与误判问题。
|
|
236
|
+
- 保留 `popupMode` / `modalTitle` / `hoverAutoClose` 等字段用于兼容,但当前版本未使用。
|
|
237
|
+
|
|
238
|
+
**对等依赖(peerDependencies)建议**
|
|
239
|
+
- 将 `react` 与 `react-dom` 设为对等依赖,并在宿主应用中提供它们,以避免重复打包与版本冲突。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react"),N=require("antd"),Re=require("lucide-react");function _t(t){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(f,a,c.get?c:{enumerable:!0,get:()=>t[a]})}}return f.default=t,Object.freeze(f)}const Ye=_t(Re);var Ee={exports:{}},Z={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Be;function bt(){if(Be)return Z;Be=1;var t=ee,f=Symbol.for("react.element"),a=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function m(j,p,R){var b,S={},C=null,O=null;R!==void 0&&(C=""+R),p.key!==void 0&&(C=""+p.key),p.ref!==void 0&&(O=p.ref);for(b in p)c.call(p,b)&&!g.hasOwnProperty(b)&&(S[b]=p[b]);if(j&&j.defaultProps)for(b in p=j.defaultProps,p)S[b]===void 0&&(S[b]=p[b]);return{$$typeof:f,type:j,key:C,ref:O,props:S,_owner:s.current}}return Z.Fragment=a,Z.jsx=m,Z.jsxs=m,Z}var Q={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Me;function xt(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&function(){var t=ee,f=Symbol.for("react.element"),a=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),j=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),$=Symbol.iterator,ue="@@iterator";function fe(e){if(e===null||typeof e!="object")return null;var r=$&&e[$]||e[ue];return typeof r=="function"?r:null}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];we("error",e,i)}}function we(e,r,i){{var o=A.ReactDebugCurrentFrame,h=o.getStackAddendum();h!==""&&(r+="%s",i=i.concat([h]));var y=i.map(function(u){return String(u)});y.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,y)}}var pe=!1,he=!1,te=!1,ve=!1,ge=!1,d;d=Symbol.for("react.module.reference");function B(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===g||ge||e===s||e===R||e===b||ve||e===O||pe||he||te||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===S||e.$$typeof===m||e.$$typeof===j||e.$$typeof===p||e.$$typeof===d||e.getModuleId!==void 0))}function me(e,r,i){var o=e.displayName;if(o)return o;var h=r.displayName||r.name||"";return h!==""?i+"("+h+")":i}function re(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case a:return"Portal";case g:return"Profiler";case s:return"StrictMode";case R:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j:var r=e;return re(r)+".Consumer";case m:var i=e;return re(i._context)+".Provider";case p:return me(e,e.render,"ForwardRef");case S:var o=e.displayName||null;return o!==null?o:I(e.type)||"Memo";case C:{var h=e,y=h._payload,u=h._init;try{return I(u(y))}catch{return null}}}return null}var F=Object.assign,L=0,ne,Y,z,J,H,P,ie;function oe(){}oe.__reactDisabledLog=!0;function se(){{if(L===0){ne=console.log,Y=console.info,z=console.warn,J=console.error,H=console.group,P=console.groupCollapsed,ie=console.groupEnd;var e={configurable:!0,enumerable:!0,value:oe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}}function ye(){{if(L--,L===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:ne}),info:F({},e,{value:Y}),warn:F({},e,{value:z}),error:F({},e,{value:J}),group:F({},e,{value:H}),groupCollapsed:F({},e,{value:P}),groupEnd:F({},e,{value:ie})})}L<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,G;function M(e,r,i){{if(G===void 0)try{throw Error()}catch(h){var o=h.stack.trim().match(/\n( *(at )?)/);G=o&&o[1]||""}return`
|
|
18
|
+
`+G+e}}var q=!1,D;{var le=typeof WeakMap=="function"?WeakMap:Map;D=new le}function Ce(e,r){if(!e||q)return"";{var i=D.get(e);if(i!==void 0)return i}var o;q=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var y;y=K.current,K.current=null,se();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(T){o=T}Reflect.construct(e,[],u)}else{try{u.call()}catch(T){o=T}e.call(u.prototype)}}else{try{throw Error()}catch(T){o=T}e()}}catch(T){if(T&&o&&typeof T.stack=="string"){for(var l=T.stack.split(`
|
|
19
|
+
`),w=o.stack.split(`
|
|
20
|
+
`),_=l.length-1,x=w.length-1;_>=1&&x>=0&&l[_]!==w[x];)x--;for(;_>=1&&x>=0;_--,x--)if(l[_]!==w[x]){if(_!==1||x!==1)do if(_--,x--,x<0||l[_]!==w[x]){var k=`
|
|
21
|
+
`+l[_].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&D.set(e,k),k}while(_>=1&&x>=0);break}}}finally{q=!1,K.current=y,ye(),Error.prepareStackTrace=h}var V=e?e.displayName||e.name:"",W=V?M(V):"";return typeof e=="function"&&D.set(e,W),W}function Ke(e,r,i){return Ce(e,!1)}function Ge(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ae(e,r,i){if(e==null)return"";if(typeof e=="function")return Ce(e,Ge(e));if(typeof e=="string")return M(e);switch(e){case R:return M("Suspense");case b:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return Ke(e.render);case S:return ae(e.type,r,i);case C:{var o=e,h=o._payload,y=o._init;try{return ae(y(h),r,i)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,Te={},Se=A.ReactDebugCurrentFrame;function ce(e){if(e){var r=e._owner,i=ae(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(i)}else Se.setExtraStackFrame(null)}function Xe(e,r,i,o,h){{var y=Function.call.bind(X);for(var u in e)if(y(e,u)){var l=void 0;try{if(typeof e[u]!="function"){var w=Error((o||"React class")+": "+i+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}l=e[u](r,u,o,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(_){l=_}l&&!(l instanceof Error)&&(ce(h),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",i,u,typeof l),ce(null)),l instanceof Error&&!(l.message in Te)&&(Te[l.message]=!0,ce(h),E("Failed %s type: %s",i,l.message),ce(null))}}}var Ze=Array.isArray;function de(e){return Ze(e)}function Qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,i=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function et(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function ke(e){if(et(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),Pe(e)}var Oe=A.ReactCurrentOwner,tt={key:!0,ref:!0,__self:!0,__source:!0},Ie,Ae;function rt(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function nt(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function it(e,r){typeof e.ref=="string"&&Oe.current}function ot(e,r){{var i=function(){Ie||(Ie=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function st(e,r){{var i=function(){Ae||(Ae=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var lt=function(e,r,i,o,h,y,u){var l={$$typeof:f,type:e,key:r,ref:i,props:u,_owner:y};return l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function at(e,r,i,o,h){{var y,u={},l=null,w=null;i!==void 0&&(ke(i),l=""+i),nt(r)&&(ke(r.key),l=""+r.key),rt(r)&&(w=r.ref,it(r,h));for(y in r)X.call(r,y)&&!tt.hasOwnProperty(y)&&(u[y]=r[y]);if(e&&e.defaultProps){var _=e.defaultProps;for(y in _)u[y]===void 0&&(u[y]=_[y])}if(l||w){var x=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&ot(u,x),w&&st(u,x)}return lt(e,l,w,h,o,Oe.current,u)}}var _e=A.ReactCurrentOwner,Fe=A.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,i=ae(e.type,e._source,r?r.type:null);Fe.setExtraStackFrame(i)}else Fe.setExtraStackFrame(null)}var be;be=!1;function xe(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function qe(){{if(_e.current){var e=I(_e.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ct(e){return""}var De={};function ut(e){{var r=qe();if(!r){var i=typeof e=="string"?e:e.displayName||e.name;i&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+i+">.")}return r}}function Ne(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=ut(r);if(De[i])return;De[i]=!0;var o="";e&&e._owner&&e._owner!==_e.current&&(o=" It was passed a child from "+I(e._owner.type)+"."),U(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,o),U(null)}}function Le(e,r){{if(typeof e!="object")return;if(de(e))for(var i=0;i<e.length;i++){var o=e[i];xe(o)&&Ne(o,r)}else if(xe(e))e._store&&(e._store.validated=!0);else if(e){var h=fe(e);if(typeof h=="function"&&h!==e.entries)for(var y=h.call(e),u;!(u=y.next()).done;)xe(u.value)&&Ne(u.value,r)}}}function ft(e){{var r=e.type;if(r==null||typeof r=="string")return;var i;if(typeof r=="function")i=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===S))i=r.propTypes;else return;if(i){var o=I(r);Xe(i,e.props,"prop",o,e)}else if(r.PropTypes!==void 0&&!be){be=!0;var h=I(r);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",h||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pt(e){{for(var r=Object.keys(e.props),i=0;i<r.length;i++){var o=r[i];if(o!=="children"&&o!=="key"){U(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),U(null);break}}e.ref!==null&&(U(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var We={};function $e(e,r,i,o,h,y){{var u=B(e);if(!u){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var w=ct();w?l+=w:l+=qe();var _;e===null?_="null":de(e)?_="array":e!==void 0&&e.$$typeof===f?(_="<"+(I(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):_=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_,l)}var x=at(e,r,i,h,y);if(x==null)return x;if(u){var k=r.children;if(k!==void 0)if(o)if(de(k)){for(var V=0;V<k.length;V++)Le(k[V],e);Object.freeze&&Object.freeze(k)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Le(k,e)}if(X.call(r,"key")){var W=I(e),T=Object.keys(r).filter(function(dt){return dt!=="key"}),je=T.length>0?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}";if(!We[W+je]){var yt=T.length>0?"{"+T.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,je,W,yt,W),We[W+je]=!0}}return e===c?pt(x):ft(x),x}}function ht(e,r,i){return $e(e,r,i,!0)}function vt(e,r,i){return $e(e,r,i,!1)}var gt=vt,mt=ht;Q.Fragment=c,Q.jsx=gt,Q.jsxs=mt}()),Q}process.env.NODE_ENV==="production"?Ee.exports=bt():Ee.exports=xt();var n=Ee.exports;const jt="_entityCard_qqftp_1",Rt="_pcCover_qqftp_15",Et="_pcSection_qqftp_31",wt="_pcBreadcrumbSep_qqftp_38",Ct="_pcBasic_qqftp_43",Tt="_pcBasicRow_qqftp_50",St="_pcBasicRowLeft_qqftp_57",Pt="_pcLinkIconRight_qqftp_62",kt="_pcColorSwatch_qqftp_73",Ot="_pcTitleText_qqftp_100",It="_pcSubTitleText_qqftp_107",At="_pcProperties_qqftp_120",Ft="_pcProperty_qqftp_128",qt="_pcTagsRow_qqftp_139",Dt="_pcDetails_qqftp_152",Nt="_pcRow_qqftp_158",Lt="_pcCol_qqftp_73",Wt="_pcColLabel_qqftp_180",$t="_pcColValue_qqftp_184",Bt="_pcProgressText_qqftp_189",Mt="_entityLabel_qqftp_195",v={entityCard:jt,pcCover:Rt,pcSection:Et,pcBreadcrumbSep:wt,pcBasic:Ct,pcBasicRow:Tt,pcBasicRowLeft:St,pcLinkIconRight:Pt,pcColorSwatch:kt,pcTitleText:Ot,pcSubTitleText:It,pcProperties:At,pcProperty:Ft,pcTagsRow:qt,pcDetails:Dt,pcRow:Nt,pcCol:Lt,pcColLabel:Wt,pcColValue:$t,pcProgressText:Bt,entityLabel:Mt},Ue=t=>{if(!t)return null;const f=t.trim(),s={user:"User",email:"Mail",mail:"Mail",phone:"Phone",datetime:"Calendar",date:"Calendar",time:"Clock",tags:"Tag"}[f]??f.replace(/(^\w|-\w)/g,m=>m.replace("-","").toUpperCase());return Ye[s]||null},Ut=(t,f)=>{const a=typeof t=="number"?t:typeof t=="string"?parseFloat(t):NaN,c=isFinite(a)?a<=1?Math.max(0,Math.min(1,a))*100:Math.max(0,Math.min(100,a)):0;return n.jsxs("div",{className:v.pcProgress,children:[n.jsx(N.Progress,{percent:c,showInfo:!1,strokeColor:"#027ffe",size:{height:12}}),(f==null?void 0:f.text)&&n.jsx("div",{className:v.pcProgressText,children:f.text})]})},ze=t=>!Array.isArray(t)||t.length===0?null:n.jsx("div",{className:v.pcTagsRow,children:t.map((f,a)=>n.jsx(N.Tag,{color:"default",style:{display:"inline-flex",alignItems:"center",border:"none",backgroundColor:"#E8E8E8",color:"#027FFE"},children:String(f)},`${f}-${a}`))}),Vt=t=>{const{view:f,value:a,payload:c}=t;return f==="percent_bar"?Ut(a,c):f==="tags"?ze(Array.isArray(a)?a:[]):n.jsx("div",{className:v.pcColValue,children:String(a??"")})},Je=({data:t})=>{var f,a,c;return n.jsxs(n.Fragment,{children:[(t==null?void 0:t.cover)&&n.jsx("div",{className:v.pcCover,style:{height:(f=t==null?void 0:t.style)==null?void 0:f.cover_max_height},children:n.jsx("img",{src:t.cover,alt:"cover"})}),Array.isArray(t==null?void 0:t.categories)&&t.categories.length>0&&n.jsx("div",{className:v.pcSection,children:n.jsx(N.Breadcrumb,{items:t.categories.map((s,g)=>({key:`${s}-${g}`,title:s})),separator:n.jsx("span",{className:v.pcBreadcrumbSep,children:"/"})})}),((t==null?void 0:t.color)||(t==null?void 0:t.icon)||(t==null?void 0:t.title)||(t==null?void 0:t.subtitle)||(t==null?void 0:t.url))&&n.jsx("div",{className:v.pcBasic,children:n.jsxs("div",{className:v.pcBasicRow,children:[n.jsxs("div",{className:v.pcBasicRowLeft,children:[(t==null?void 0:t.color)&&n.jsx("span",{className:v.pcColorSwatch,style:{backgroundColor:t.color},"aria-label":`color ${t.color}`,title:`color: ${t.color}`}),(()=>{var m;const s=(m=t==null?void 0:t.icon)==null?void 0:m.trim();if(s&&/^https?:\/\/+/i.test(s))return n.jsx("img",{src:s,alt:"icon",className:v.pcIcon,width:18,height:18,style:{objectFit:"contain"}});const g=Ue(s);return g?n.jsx(g,{className:v.pcIcon,size:18,strokeWidth:2}):null})(),(t==null?void 0:t.title)&&n.jsx("span",{className:v.pcTitleText,title:t.title,children:t.title}),(t==null?void 0:t.subtitle)&&n.jsxs("span",{className:v.pcSubTitleText,title:t.subtitle,children:["| ",t.subtitle]})]}),(t==null?void 0:t.url)&&n.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer","aria-label":"open link",title:t.url,className:v.pcLinkIconRight,children:n.jsx(Re.ExternalLink,{style:{width:12,height:12,color:"#027FFE"}})})]})}),Array.isArray(t==null?void 0:t.properties)&&t.properties.length>0&&n.jsx("div",{className:v.pcSection,children:n.jsx("div",{className:v.pcProperties,children:t.properties.map((s,g)=>{const m=Ue(s.icon),j=()=>{if(s.view==="tags")return ze(Array.isArray(s.value)?s.value:[]);if(s.view==="datetime_with_time_zone"){const p=String(s.value??"");return n.jsx("span",{className:v.pcPropertyValue,children:p})}return n.jsx("span",{className:v.pcPropertyValue,children:String(s.value??"")})};return n.jsxs("div",{className:v.pcProperty,children:[m&&n.jsx(m,{className:v.pcPropertyIcon,size:16,strokeWidth:2}),j()]},g)})})}),Array.isArray((c=(a=t==null?void 0:t.details)==null?void 0:a.table)==null?void 0:c.rows)&&t.details.table.rows.length>0&&n.jsx("div",{className:v.pcSection,children:n.jsx("div",{className:v.pcDetails,children:t.details.table.rows.map((s,g)=>{const m=Array.isArray(s.columns)?s.columns.filter(p=>p&&(p.label!==void 0||p.value!==void 0)):[],j=m.length;return n.jsx("div",{className:v.pcRow,style:{gridTemplateColumns:j<=1?"1fr":"repeat(2, minmax(0, 1fr))"},children:m.map((p,R)=>n.jsxs("div",{className:v.pcCol,children:[Vt(p),p.label&&n.jsx("div",{className:v.pcColLabel,children:p.label})]},R))},g)})})}),Array.isArray(t==null?void 0:t.tags)&&t.tags.length>0&&n.jsx("div",{className:v.pcSection,children:t.tags.map((s,g)=>n.jsx(N.Tag,{style:{display:"inline-flex",alignItems:"center",gap:4,color:"#027FFE",border:"none"},icon:n.jsx(Re.Tags,{style:{width:12,height:12}}),color:"default",children:s},g))})]})},Yt=({title:t,subtitle:f,description:a,imageUrl:c,actions:s=[],footer:g,triggerType:m="hover",popupMode:j="modal",trigger:p,open:R,onOpenChange:b,modalTitle:S,width:C,placement:O="right",data:$,hoverOpenDelay:ue=500,closeDelay:fe=200,autoPlacement:A=!1,hoverAutoClose:E=!1,hoverAutoCloseDelay:we=2e3})=>{var Y,z,J,H;const[pe,he]=ee.useState(!1),te=typeof R=="boolean",ve=te?R:pe,ge=P=>{te?b==null||b(P):he(P)},d=$,B=ee.useRef(null),[me,re]=ee.useState(O),I=()=>{if(!B.current)return;const P=B.current.getBoundingClientRect(),ie=window.innerWidth,oe=window.innerHeight,se=(()=>{var le;const D=(typeof C=="number"?C:void 0)??((le=d==null?void 0:d.style)==null?void 0:le.width);return D?typeof D=="string"?parseInt(D,10)||376:D:376})(),ye=300,K=ie-P.right,G=P.left,M=oe-P.bottom;P.top;let q=O;K>=se?q="right":G>=se?q="left":M>=ye?q="bottom":q="top",re(q)},F=n.jsx(N.Button,{type:"default",children:`打开:${(d==null?void 0:d.title)??t??"详情"}`}),L=n.jsx("span",{ref:B,style:{display:"inline-block"},children:p??F}),ne=n.jsx(N.Popover,{content:n.jsx("div",{className:v.entityCard,style:{width:(Y=d==null?void 0:d.style)==null?void 0:Y.width,height:(z=d==null?void 0:d.style)==null?void 0:z.height,maxWidth:(J=d==null?void 0:d.style)==null?void 0:J.max_width,maxHeight:(H=d==null?void 0:d.style)==null?void 0:H.max_height},children:d!=null&&d.id?n.jsx(Je,{data:d}):n.jsx(N.Skeleton,{active:!0,title:!1,avatar:{shape:"circle",size:24},paragraph:{rows:3}})}),open:ve,onOpenChange:P=>{P&&A&&I(),ge(!!P)},trigger:m,placement:A?me:O,mouseEnterDelay:m==="hover"?ue/1e3:0,mouseLeaveDelay:m==="hover"?fe/1e3:0,autoAdjustOverflow:!0,getPopupContainer:()=>B.current||document.body,overlayInnerStyle:{padding:0},children:L});return n.jsx(n.Fragment,{children:ne})},zt=t=>{const f=t.trim(),c={user:"User",email:"Mail",mail:"Mail",phone:"Phone",datetime:"Calendar",date:"Calendar",time:"Clock",tags:"Tag"}[f]??f.replace(/(^\w|-\w)/g,g=>g.replace("-","").toUpperCase());return Ye[c]||null},Jt=t=>{if(t){if(/^mailto:/i.test(t))try{return decodeURIComponent(t.slice(7))}catch{return t.slice(7)}return t}},Ve=()=>n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,verticalAlign:"middle"},"aria-label":"entity user skeleton",children:[n.jsx("span",{style:{width:20,height:20,borderRadius:"50%",backgroundColor:"#e9e9e9",flex:"0 0 auto"}}),n.jsx("span",{style:{width:160,height:20,borderRadius:6,backgroundColor:"#e9e9e9",flex:"0 0 auto"}})]}),He=({data:t})=>{var b,S;if(!t||!t.title&&!t.icon&&!t.subtitle&&!t.color&&!t.url)return n.jsx(Ve,{});const a=(b=t==null?void 0:t.icon)==null?void 0:b.trim(),c=(S=t==null?void 0:t.title)==null?void 0:S.trim(),s=Jt(t==null?void 0:t.url),g=!!a,m=!!c,j=!!s,p=!!(t!=null&&t.color)||!!(t!=null&&t.subtitle),R=(C=20)=>{if(a&&/^https?:\/\//i.test(a))return n.jsx(N.Avatar,{size:C,src:a});const O=zt(a||"user"),$=Math.max(8,C-4);return n.jsx(N.Avatar,{size:C,icon:O?n.jsx(O,{size:$}):void 0})};return g&&m&&!j&&!p?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[R(),n.jsx("span",{style:{color:"#027FFE",fontWeight:500,lineHeight:"20px"},title:c,children:c})]}):g&&!m&&!j&&!p?n.jsx("span",{style:{display:"inline-flex"},children:R()}):!g&&m&&!j&&!p?n.jsx("span",{style:{display:"inline-block",color:"#027FFE",fontWeight:500},title:c,children:c}):g&&m&&j?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[R(40),n.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",justifyContent:"space-between"},children:[n.jsx("span",{style:{color:"#027FFE",fontWeight:500},title:c,children:c}),n.jsx("span",{style:{color:"#888",fontSize:12},title:s,children:s})]})]}):g&&m&&p?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[R(40),n.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",justifyContent:"space-between"},children:[n.jsx("span",{style:{color:"#027FFE",fontWeight:500},title:c,children:c}),n.jsxs("span",{style:{marginTop:4,display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"#666"},title:t==null?void 0:t.subtitle,children:[(t==null?void 0:t.color)&&n.jsx("span",{style:{width:12,height:12,borderRadius:"50%",backgroundColor:t.color}}),t==null?void 0:t.subtitle]})]})]}):m?n.jsx("span",{style:{color:"#027FFE",fontWeight:500},title:c,children:c}):n.jsx(Ve,{})};function Ht({data:t}){var a,c,s,g;const f=((t==null?void 0:t.type)??"").toLowerCase()==="user";return n.jsx("div",{className:v.entityLabel,style:{width:(a=t==null?void 0:t.style)==null?void 0:a.width,height:(c=t==null?void 0:t.style)==null?void 0:c.height,maxWidth:(s=t==null?void 0:t.style)==null?void 0:s.max_width,maxHeight:(g=t==null?void 0:t.style)==null?void 0:g.max_height},children:t!=null&&t.id?f?n.jsx(He,{data:t}):n.jsx(Je,{data:t}):n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,verticalAlign:"middle"},"aria-label":"entity label skeleton",children:[n.jsx("span",{style:{width:20,height:20,borderRadius:"50%",backgroundColor:"#e9e9e9",flex:"0 0 auto"}}),n.jsx("span",{style:{width:160,height:20,borderRadius:6,backgroundColor:"#e9e9e9",flex:"0 0 auto"}})]})})}exports.EntityCard=Yt;exports.EntityLabel=Ht;exports.EntityUser=He;
|