@infinilabs/entity-ui 0.0.2 → 0.0.3
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 +41 -119
- package/dist/entity-ui.cjs +10 -10
- package/dist/entity-ui.js +193 -193
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,64 +1,50 @@
|
|
|
1
1
|
# @infinilabs/entity-ui 使用说明
|
|
2
2
|
|
|
3
|
+
Customized Entity components
|
|
4
|
+
|
|
3
5
|
**概述**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- `
|
|
7
|
-
-
|
|
6
|
+
|
|
7
|
+
- `@infinilabs/entity-ui` 是一个用于展示“实体信息”的 UI 组件库,当前包含组件:
|
|
8
|
+
- `EntityCard`:基于 `antd` Popover 的锚定式信息卡片,贴近触发元素显示,支持富信息内容与自动定位。
|
|
9
|
+
- `EntityLabel`:行内标签型组件,展示实体的基本信息(颜色块、图标、标题、子标题、右侧外链)。
|
|
10
|
+
- `EntityUser`:用于展示用户信息的行内组件,语法同 `EntityLabel`,更便捷地适配“用户实体”的常见样式。
|
|
11
|
+
- 采用命名导出,支持 tree-shaking。
|
|
8
12
|
|
|
9
13
|
**安装**
|
|
10
|
-
- 使用 `pnpm`(或 `npm` / `yarn`)安装组件库:
|
|
11
14
|
- 组件需要 `react` 与 `react-dom` 作为对等依赖(peerDependencies)。
|
|
12
|
-
|
|
13
15
|
```bash
|
|
14
16
|
pnpm add @infinilabs/entity-ui
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
**导入方式**
|
|
18
|
-
-
|
|
19
|
-
- 推荐统一从根入口导出使用:
|
|
20
|
-
|
|
20
|
+
- 推荐从根入口命名导入:
|
|
21
21
|
```tsx
|
|
22
|
-
import { EntityCard, EntityLabel } from '@infinilabs/entity-ui';
|
|
22
|
+
import { EntityCard, EntityLabel, EntityUser } from '@infinilabs/entity-ui';
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**快速上手**
|
|
26
|
-
-
|
|
26
|
+
- 行内标签 + 悬浮卡片的常见组合:
|
|
27
27
|
|
|
28
28
|
```tsx
|
|
29
29
|
import { useState } from 'react';
|
|
30
30
|
import { EntityCard, EntityLabel } from '@infinilabs/entity-ui';
|
|
31
31
|
|
|
32
32
|
export default function Demo() {
|
|
33
|
-
const [count, setCount] = useState(0);
|
|
34
|
-
|
|
35
33
|
const data = {
|
|
36
|
-
style: {
|
|
37
|
-
width: '420px',
|
|
38
|
-
max_height: '360px',
|
|
39
|
-
cover_max_height: '160px',
|
|
40
|
-
},
|
|
34
|
+
style: { width: '376px', max_height: '500px', cover_max_height: '172px' },
|
|
41
35
|
color: '#027FFE',
|
|
42
36
|
icon: 'mail',
|
|
43
|
-
title: '
|
|
44
|
-
subtitle: '
|
|
37
|
+
title: '示例主题',
|
|
38
|
+
subtitle: '示例子标题',
|
|
45
39
|
url: 'https://example.com',
|
|
46
40
|
cover: 'https://picsum.photos/640/360',
|
|
47
|
-
categories: ['
|
|
41
|
+
categories: ['示例组织', '示例部门'],
|
|
48
42
|
properties: [
|
|
49
|
-
{ icon: '
|
|
50
|
-
{ icon: 'datetime', value: '2025-
|
|
43
|
+
{ icon: 'email', value: 'user@example.com' },
|
|
44
|
+
{ icon: 'datetime', value: '2025-08-21T15:34:25Z', view: 'datetime_with_time_zone' },
|
|
51
45
|
{ icon: 'tags', value: ['重要', '待办'], view: 'tags' },
|
|
52
|
-
{ value: 0.6, view: 'percent_bar', payload: { text: '处理进度' } },
|
|
53
46
|
],
|
|
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
|
-
},
|
|
47
|
+
details: { table: { rows: [{ columns: [{ label: '备注', value: '请及时处理' }] }] } },
|
|
62
48
|
tags: ['工作', '提醒'],
|
|
63
49
|
};
|
|
64
50
|
|
|
@@ -67,21 +53,19 @@ export default function Demo() {
|
|
|
67
53
|
<EntityLabel
|
|
68
54
|
data={{
|
|
69
55
|
type: 'user',
|
|
70
|
-
id: '
|
|
56
|
+
id: 'user-demo',
|
|
71
57
|
icon: 'user',
|
|
72
|
-
title: '
|
|
58
|
+
title: '示例用户',
|
|
73
59
|
color: '#0f0f0f',
|
|
74
|
-
subtitle: '
|
|
75
|
-
url: 'mailto:
|
|
60
|
+
subtitle: '示例部门',
|
|
61
|
+
url: 'mailto:user@example.com',
|
|
76
62
|
}}
|
|
77
63
|
/>
|
|
78
|
-
|
|
79
64
|
<div style={{ marginTop: 16 }}>
|
|
80
65
|
<EntityCard
|
|
81
|
-
title="
|
|
66
|
+
title=""
|
|
67
|
+
triggerType="hover"
|
|
82
68
|
hoverOpenDelay={500}
|
|
83
|
-
closeDelay={200}
|
|
84
|
-
placement="right"
|
|
85
69
|
autoPlacement
|
|
86
70
|
data={data}
|
|
87
71
|
trigger={<button className="entity-card__btn">悬停打开卡片</button>}
|
|
@@ -94,17 +78,17 @@ export default function Demo() {
|
|
|
94
78
|
|
|
95
79
|
**组件:EntityCard**
|
|
96
80
|
- 定位与交互
|
|
97
|
-
- `triggerType?: "click" | "hover"`
|
|
98
|
-
- `hoverOpenDelay?: number`
|
|
81
|
+
- `triggerType?: "click" | "hover"` 默认 `"hover"`。
|
|
82
|
+
- `hoverOpenDelay?: number` 悬停延迟(毫秒),默认 `500`。
|
|
99
83
|
- `closeDelay?: number` 悬停离开延迟关闭(毫秒),默认 `200`。
|
|
100
84
|
- `placement?: "left" | "right" | "top" | "bottom"` 默认 `"right"`。
|
|
101
|
-
- `autoPlacement?: boolean`
|
|
85
|
+
- `autoPlacement?: boolean` 打开前根据视窗与触发表剩余空间自动选方向(优先级 `right → left → bottom → top`)。
|
|
102
86
|
- `open?: boolean`、`onOpenChange?: (open: boolean) => void` 支持受控模式。
|
|
103
87
|
- `trigger?: React.ReactNode` 自定义触发节点(默认一个 `Button`)。
|
|
104
|
-
-
|
|
105
|
-
-
|
|
88
|
+
- 弹层容器优先挂载到触发元素(`getPopupContainer={() => triggerRef.current || document.body}`)。
|
|
89
|
+
- 弹层内部移除默认内边距(`overlayInnerStyle={{ padding: 0 }}`)。
|
|
106
90
|
|
|
107
|
-
- 数据结构(`data
|
|
91
|
+
- 数据结构(`data`)
|
|
108
92
|
- `style?: { width?: string; height?: string; max_width?: string; max_height?: string; cover_max_height?: string }`
|
|
109
93
|
- `color?: string`、`icon?: string`、`title?: string`、`subtitle?: string`、`url?: string`、`cover?: string`
|
|
110
94
|
- `categories?: string[]` 面包屑
|
|
@@ -115,37 +99,7 @@ export default function Demo() {
|
|
|
115
99
|
- 当 `icon` 为 `http/https` URL 时,以 `<img>` 加载(尺寸与布局与 lucide 图标保持一致)。
|
|
116
100
|
- 其他字符串按 lucide-react 名称解析,内置别名:`user→User`, `email/mail→Mail`, `phone→Phone`, `datetime/date→Calendar`, `time→Clock`, `tags→Tag`;`kebab-case` 自动转为 `PascalCase`。
|
|
117
101
|
|
|
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
102
|
- 多位置触发示例(测试自动定位)
|
|
148
|
-
|
|
149
103
|
```tsx
|
|
150
104
|
import { EntityCard } from '@infinilabs/entity-ui';
|
|
151
105
|
|
|
@@ -172,48 +126,21 @@ export default function AutoPlacementDemo({ data }: { data: any }) {
|
|
|
172
126
|
}
|
|
173
127
|
```
|
|
174
128
|
|
|
175
|
-
**组件:EntityLabel**
|
|
176
|
-
-
|
|
177
|
-
- 行内展示实体信息,不使用弹层。
|
|
178
|
-
- 渲染颜色块、图标(URL 或 lucide 名称)、标题、子标题、右侧外链。
|
|
179
|
-
|
|
129
|
+
**组件:EntityLabel / EntityUser**
|
|
130
|
+
- 行内展示实体信息,语法一致,`EntityUser` 常用于用户场景。
|
|
180
131
|
- Props
|
|
181
132
|
- `data?: { type?: string; id?: string; icon?: string; title?: string; color?: string; subtitle?: string; url?: string; style?: { width?: string } }`
|
|
182
|
-
|
|
183
133
|
- 图标支持
|
|
184
|
-
- `data.icon`
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- 使用示例
|
|
188
|
-
|
|
134
|
+
- `data.icon` 为 URL 时使用 `<img>`;否则按 lucide 名称解析(含别名与 `kebab→Pascal` 自动转换)。
|
|
135
|
+
- 示例
|
|
189
136
|
```tsx
|
|
190
|
-
import { EntityLabel } from '@infinilabs/entity-ui';
|
|
137
|
+
import { EntityLabel, EntityUser } from '@infinilabs/entity-ui';
|
|
191
138
|
|
|
192
139
|
export default function LabelDemo() {
|
|
193
140
|
return (
|
|
194
141
|
<>
|
|
195
|
-
<EntityLabel
|
|
196
|
-
|
|
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
|
-
/>
|
|
142
|
+
<EntityLabel data={{ type: 'user', id: 'user-demo', icon: 'user', title: '示例用户', color: '#0f0f0f', subtitle: '示例部门', url: 'mailto:user@example.com' }} />
|
|
143
|
+
<EntityUser data={{ type: 'user', id: 'u_only_icon', icon: 'https://picsum.photos/40?random=12' }} />
|
|
217
144
|
</>
|
|
218
145
|
);
|
|
219
146
|
}
|
|
@@ -221,19 +148,14 @@ export default function LabelDemo() {
|
|
|
221
148
|
|
|
222
149
|
**尺寸与滚动(EntityCard)**
|
|
223
150
|
- 使用 `data.style.width/height/max_width/max_height` 控制内容尺寸;
|
|
224
|
-
- 当内容高度超过 `max_height`
|
|
151
|
+
- 当内容高度超过 `max_height` 时,内容区域纵向滚动;
|
|
225
152
|
- 封面最大高度通过 `data.style.cover_max_height` 控制;
|
|
226
153
|
- 弹层内边距已移除,避免双重间距(`overlayInnerStyle={{ padding: 0 }}`)。
|
|
227
154
|
|
|
228
155
|
**常见问题**
|
|
229
|
-
-
|
|
230
|
-
- 悬停闪烁或误关闭:确认触发区与弹层是否存在遮挡(`z-index
|
|
231
|
-
- 点击触发:将 `triggerType` 设置为 `"click"`
|
|
232
|
-
|
|
233
|
-
**迁移说明(从早期版本)**
|
|
234
|
-
- 移除默认导出;现在仅使用命名导出。
|
|
235
|
-
- `EntityCard` 已从 `Modal` 迁移到 `Popover`,不再使用 `mask`;修复了悬停闪烁与误判问题。
|
|
236
|
-
- 保留 `popupMode` / `modalTitle` / `hoverAutoClose` 等字段用于兼容,但当前版本未使用。
|
|
156
|
+
- 无法找到默认导出:使用命名导出 `import { EntityCard, EntityLabel, EntityUser } from '@infinilabs/entity-ui'`。
|
|
157
|
+
- 悬停闪烁或误关闭:确认触发区与弹层是否存在遮挡(`z-index`)、指针事件设置是否合理;组件默认将弹层容器绑定到触发元素以减少误判。
|
|
158
|
+
- 点击触发:将 `triggerType` 设置为 `"click"` 并视需要调整延迟为 `0`。
|
|
237
159
|
|
|
238
160
|
**对等依赖(peerDependencies)建议**
|
|
239
161
|
- 将 `react` 与 `react-dom` 设为对等依赖,并在宿主应用中提供它们,以避免重复打包与版本冲突。
|
package/dist/entity-ui.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react"),L=require("antd"),je=require("lucide-react");function xt(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 ze=xt(je);var Re={exports:{}},Z={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Me;function _t(){if(Me)return Z;Me=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 y(w,p,j){var _,S={},C=null,O=null;j!==void 0&&(C=""+j),p.key!==void 0&&(C=""+p.key),p.ref!==void 0&&(O=p.ref);for(_ in p)c.call(p,_)&&!g.hasOwnProperty(_)&&(S[_]=p[_]);if(w&&w.defaultProps)for(_ in p=w.defaultProps,p)S[_]===void 0&&(S[_]=p[_]);return{$$typeof:f,type:w,key:C,ref:O,props:S,_owner:s.current}}return Z.Fragment=a,Z.jsx=y,Z.jsxs=y,Z}var Q={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+G+e}}var
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+l[
|
|
17
|
+
*/var Ue;function bt(){return Ue||(Ue=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"),y=Symbol.for("react.provider"),w=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),B=Symbol.iterator,ue="@@iterator";function fe(e){if(e===null||typeof e!="object")return null;var r=B&&e[B]||e[ue];return typeof r=="function"?r:null}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];Ee("error",e,i)}}function Ee(e,r,i){{var o=A.ReactDebugCurrentFrame,h=o.getStackAddendum();h!==""&&(r+="%s",i=i.concat([h]));var m=i.map(function(u){return String(u)});m.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,m)}}var pe=!1,he=!1,te=!1,ve=!1,ge=!1,d;d=Symbol.for("react.module.reference");function M(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===g||ge||e===s||e===j||e===_||ve||e===O||pe||he||te||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===S||e.$$typeof===y||e.$$typeof===w||e.$$typeof===p||e.$$typeof===d||e.getModuleId!==void 0))}function ye(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"&&R("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 j:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return re(r)+".Consumer";case y:var i=e;return re(i._context)+".Provider";case p:return ye(e,e.render,"ForwardRef");case S:var o=e.displayName||null;return o!==null?o:I(e.type)||"Memo";case C:{var h=e,m=h._payload,u=h._init;try{return I(u(m))}catch{return null}}}return null}var F=Object.assign,W=0,ne,z,q,J,H,P,ie;function oe(){}oe.__reactDisabledLog=!0;function se(){{if(W===0){ne=console.log,z=console.info,q=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})}W++}}function me(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:ne}),info:F({},e,{value:z}),warn:F({},e,{value:q}),error:F({},e,{value:J}),group:F({},e,{value:H}),groupCollapsed:F({},e,{value:P}),groupEnd:F({},e,{value:ie})})}W<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,G;function U(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 D=!1,N;{var le=typeof WeakMap=="function"?WeakMap:Map;N=new le}function Ce(e,r){if(!e||D)return"";{var i=N.get(e);if(i!==void 0)return i}var o;D=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=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
|
+
`),E=o.stack.split(`
|
|
20
|
+
`),x=l.length-1,b=E.length-1;x>=1&&b>=0&&l[x]!==E[b];)b--;for(;x>=1&&b>=0;x--,b--)if(l[x]!==E[b]){if(x!==1||b!==1)do if(x--,b--,b<0||l[x]!==E[b]){var k=`
|
|
21
|
+
`+l[x].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&N.set(e,k),k}while(x>=1&&b>=0);break}}}finally{D=!1,K.current=m,me(),Error.prepareStackTrace=h}var Y=e?e.displayName||e.name:"",$=Y?U(Y):"";return typeof e=="function"&&N.set(e,$),$}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 U(e);switch(e){case j:return U("Suspense");case _:return U("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,m=o._init;try{return ae(m(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 m=Function.call.bind(X);for(var u in e)if(m(e,u)){var l=void 0;try{if(typeof e[u]!="function"){var E=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 E.name="Invariant Violation",E}l=e[u](r,u,o,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){l=x}l&&!(l instanceof Error)&&(ce(h),R("%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),R("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 R("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,R("%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,R("%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,m,u){var l={$$typeof:f,type:e,key:r,ref:i,props:u,_owner:m};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 m,u={},l=null,E=null;i!==void 0&&(ke(i),l=""+i),nt(r)&&(ke(r.key),l=""+r.key),rt(r)&&(E=r.ref,it(r,h));for(m in r)X.call(r,m)&&!tt.hasOwnProperty(m)&&(u[m]=r[m]);if(e&&e.defaultProps){var x=e.defaultProps;for(m in x)u[m]===void 0&&(u[m]=x[m])}if(l||E){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&ot(u,b),E&&st(u,b)}return lt(e,l,E,h,o,Oe.current,u)}}var xe=A.ReactCurrentOwner,Fe=A.ReactDebugCurrentFrame;function V(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 _e;_e=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function De(){{if(xe.current){var e=I(xe.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function ct(e){return""}var
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ct(e){return""}var Ne={};function ut(e){{var r=De();if(!r){var i=typeof e=="string"?e:e.displayName||e.name;i&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+i+">.")}return r}}function
|
|
25
|
+
Check the top-level render call using <`+i+">.")}return r}}function Le(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=ut(r);if(Ne[i])return;Ne[i]=!0;var o="";e&&e._owner&&e._owner!==xe.current&&(o=" It was passed a child from "+I(e._owner.type)+"."),V(e),R('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),V(null)}}function We(e,r){{if(typeof e!="object")return;if(de(e))for(var i=0;i<e.length;i++){var o=e[i];be(o)&&Le(o,r)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var h=fe(e);if(typeof h=="function"&&h!==e.entries)for(var m=h.call(e),u;!(u=m.next()).done;)be(u.value)&&Le(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&&!_e){_e=!0;var h=I(r);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",h||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&R("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"){V(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),V(null);break}}e.ref!==null&&(V(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var $e={};function Be(e,r,i,o,h,m){{var u=M(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 E=ct();E?l+=E:l+=De();var x;e===null?x="null":de(e)?x="array":e!==void 0&&e.$$typeof===f?(x="<"+(I(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):x=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,l)}var b=at(e,r,i,h,m);if(b==null)return b;if(u){var k=r.children;if(k!==void 0)if(o)if(de(k)){for(var Y=0;Y<k.length;Y++)We(k[Y],e);Object.freeze&&Object.freeze(k)}else R("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 We(k,e)}if(X.call(r,"key")){var $=I(e),T=Object.keys(r).filter(function(dt){return dt!=="key"}),we=T.length>0?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}";if(!$e[$+we]){var mt=T.length>0?"{"+T.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
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;
|
|
30
|
+
<%s key={someKey} {...props} />`,we,$,mt,$),$e[$+we]=!0}}return e===c?pt(b):ft(b),b}}function ht(e,r,i){return Be(e,r,i,!0)}function vt(e,r,i){return Be(e,r,i,!1)}var gt=vt,yt=ht;Q.Fragment=c,Q.jsx=gt,Q.jsxs=yt}()),Q}process.env.NODE_ENV==="production"?Re.exports=_t():Re.exports=bt();var n=Re.exports;const wt="_entityCard_1xtgw_1",jt="_pcCover_1xtgw_15",Rt="_pcSection_1xtgw_31",Et="_pcBreadcrumbSep_1xtgw_38",Ct="_pcBasic_1xtgw_43",Tt="_pcBasicRow_1xtgw_49",St="_pcBasicRowLeft_1xtgw_56",Pt="_pcLinkIconRight_1xtgw_61",kt="_pcColorSwatch_1xtgw_72",Ot="_pcTitleText_1xtgw_99",It="_pcSubTitleText_1xtgw_106",At="_pcProperties_1xtgw_119",Ft="_pcProperty_1xtgw_127",Dt="_pcTagsRow_1xtgw_138",Nt="_pcDetails_1xtgw_151",Lt="_pcRow_1xtgw_157",Wt="_pcCol_1xtgw_72",$t="_pcColLabel_1xtgw_179",Bt="_pcColValue_1xtgw_183",Mt="_pcProgressText_1xtgw_188",Ut="_entityLabel_1xtgw_194",v={entityCard:wt,pcCover:jt,pcSection:Rt,pcBreadcrumbSep:Et,pcBasic:Ct,pcBasicRow:Tt,pcBasicRowLeft:St,pcLinkIconRight:Pt,pcColorSwatch:kt,pcTitleText:Ot,pcSubTitleText:It,pcProperties:At,pcProperty:Ft,pcTagsRow:Dt,pcDetails:Nt,pcRow:Lt,pcCol:Wt,pcColLabel:$t,pcColValue:Bt,pcProgressText:Mt,entityLabel:Ut},Ve=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,y=>y.replace("-","").toUpperCase());return ze[s]||null},Vt=(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(L.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})]})},qe=t=>!Array.isArray(t)||t.length===0?null:n.jsx("div",{className:v.pcTagsRow,children:t.map((f,a)=>n.jsx(L.Tag,{color:"default",style:{display:"inline-flex",alignItems:"center",border:"none",backgroundColor:"#E8E8E8",color:"#027FFE"},children:String(f)},`${f}-${a}`))}),Yt=t=>{const{view:f,value:a,payload:c}=t;return f==="percent_bar"?Vt(a,c):f==="tags"?qe(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(L.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 y;const s=(y=t==null?void 0:t.icon)==null?void 0:y.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=Ve(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(je.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,style:{paddingTop:25},children:n.jsx("div",{className:v.pcProperties,children:t.properties.map((s,g)=>{const y=Ve(s.icon),w=()=>{if(s.view==="tags")return qe(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:[y&&n.jsx(y,{className:v.pcPropertyIcon,size:16,strokeWidth:2}),w()]},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 y=Array.isArray(s.columns)?s.columns.filter(p=>p&&(p.label!==void 0||p.value!==void 0)):[],w=y.length;return n.jsx("div",{className:v.pcRow,style:{gridTemplateColumns:w<=1?"1fr":"repeat(2, minmax(0, 1fr))"},children:y.map((p,j)=>n.jsxs("div",{className:v.pcCol,children:[Yt(p),p.label&&n.jsx("div",{className:v.pcColLabel,children:p.label})]},j))},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(L.Tag,{style:{display:"inline-flex",alignItems:"center",gap:4,color:"#027FFE",border:"none"},icon:n.jsx(je.Tags,{style:{width:12,height:12}}),color:"default",children:s},g))})]})},zt=({title:t,subtitle:f,description:a,imageUrl:c,actions:s=[],footer:g,triggerType:y="hover",popupMode:w="modal",trigger:p,open:j,onOpenChange:_,modalTitle:S,width:C,placement:O="right",data:B,hoverOpenDelay:ue=500,closeDelay:fe=200,autoPlacement:A=!1,hoverAutoClose:R=!1,hoverAutoCloseDelay:Ee=2e3})=>{var z,q,J,H;const[pe,he]=ee.useState(!1),te=typeof j=="boolean",ve=te?j:pe,ge=P=>{te?_==null||_(P):he(P)},d=B,M=ee.useRef(null),[ye,re]=ee.useState(O),I=()=>{if(!M.current)return;const P=M.current.getBoundingClientRect(),ie=window.innerWidth,oe=window.innerHeight,se=(()=>{var le;const N=(typeof C=="number"?C:void 0)??((le=d==null?void 0:d.style)==null?void 0:le.width);return N?typeof N=="string"?parseInt(N,10)||376:N:376})(),me=300,K=ie-P.right,G=P.left,U=oe-P.bottom;P.top;let D=O;K>=se?D="right":G>=se?D="left":U>=me?D="bottom":D="top",re(D)},F=n.jsx(L.Button,{type:"default",children:`打开:${(d==null?void 0:d.title)??t??"详情"}`}),W=n.jsx("span",{ref:M,style:{display:"inline-block"},children:p??F}),ne=n.jsx(L.Popover,{content:n.jsx("div",{className:v.entityCard,style:{width:(z=d==null?void 0:d.style)==null?void 0:z.width,height:(q=d==null?void 0:d.style)==null?void 0:q.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(L.Skeleton,{active:!0,title:!1,avatar:{shape:"circle",size:24},paragraph:{rows:3}})}),open:ve,onOpenChange:P=>{P&&A&&I(),ge(!!P)},trigger:y,placement:A?ye:O,mouseEnterDelay:y==="hover"?ue/1e3:0,mouseLeaveDelay:y==="hover"?fe/1e3:0,autoAdjustOverflow:!0,getPopupContainer:()=>M.current||document.body,overlayInnerStyle:{padding:0},children:W});return n.jsx(n.Fragment,{children:ne})},qt=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 ze[c]||null},Jt=t=>{if(t){if(/^mailto:/i.test(t))try{return decodeURIComponent(t.slice(7))}catch{return t.slice(7)}return t}},Ye=()=>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 _,S;if(!t||!t.title&&!t.icon&&!t.subtitle&&!t.color&&!t.url)return n.jsx(Ye,{});const a=(_=t==null?void 0:t.icon)==null?void 0:_.trim(),c=(S=t==null?void 0:t.title)==null?void 0:S.trim(),s=Jt(t==null?void 0:t.url),g=!!a,y=!!c,w=!!s,p=!!(t!=null&&t.color)||!!(t!=null&&t.subtitle),j=(C=20)=>{if(a&&/^https?:\/\//i.test(a))return n.jsx(L.Avatar,{size:C,src:a});const O=qt(a||"user"),B=Math.max(8,C-4);return n.jsx(L.Avatar,{size:C,icon:O?n.jsx(O,{size:B}):void 0})};return g&&y&&!w&&!p?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[j(),n.jsx("span",{style:{color:"#027FFE",fontWeight:500,lineHeight:"20px"},title:c,children:c})]}):g&&!y&&!w&&!p?n.jsx("span",{style:{display:"inline-flex"},children:j()}):!g&&y&&!w&&!p?n.jsx("span",{style:{display:"inline-block",color:"#027FFE",fontWeight:500},title:c,children:c}):g&&y&&w?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[j(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&&y&&p?n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[j(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]})]})]}):y?n.jsx("span",{style:{color:"#027FFE",fontWeight:500},title:c,children:c}):n.jsx(Ye,{})};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=zt;exports.EntityLabel=Ht;exports.EntityUser=He;
|