@tongfun/ui 0.0.0-alpha.3 → 0.0.1-alpha.10
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 +110 -0
- package/dist/agent-schema/index.d.ts +12 -0
- package/dist/agent-schema/index.js +33 -0
- package/dist/agent-schema/types.d.ts +27 -0
- package/dist/formula/index.d.ts +17 -0
- package/dist/formula/types.d.ts +136 -0
- package/dist/html2canvas.esm-Bfw1xMTR.js +4886 -0
- package/dist/index-C0rb4BPV.js +482 -0
- package/dist/index-Ci3-2oB_.js +323459 -0
- package/dist/index.d.ts +719 -0
- package/dist/index.es-CoCAKfeh.js +5790 -0
- package/dist/index.js +842 -0
- package/dist/jspdf.es.min-B9-wXZ_S.js +10769 -0
- package/dist/lowcode-agent/icons.d.ts +12 -0
- package/dist/lowcode-agent/icons.js +229 -0
- package/dist/lowcode-agent/index.d.ts +27 -0
- package/dist/lowcode-agent/index.js +79577 -0
- package/dist/lowcode-agent/types.d.ts +471 -0
- package/dist/skill/golden-examples/dashboard-workbench.md +224 -0
- package/dist/skill/golden-examples/form-create.md +227 -0
- package/dist/skill/golden-examples/management-list.md +264 -0
- package/dist/skill/golden-examples/new-document.md +748 -0
- package/dist/skill/tongfun-ui-skill.json +470 -0
- package/dist/skill/tongfun-ui-skill.md +297 -0
- package/dist/style.css +10 -0
- package/package.json +113 -38
- package/Button/button-props.d.ts +0 -9
- package/Button/button-variants.d.ts +0 -5
- package/Button/index.d.ts +0 -20
- package/Button/index.js +0 -111
- package/index.css +0 -596
- package/index.d.ts +0 -15
- package/index.js +0 -19
- package/utils/forward-attrs.d.ts +0 -6
- package/utils/install.d.ts +0 -6
- package/utils/utils.d.ts +0 -2
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
export type LowcodeAgentJSONPrimitive = string | number | boolean | null
|
|
2
|
+
|
|
3
|
+
export type LowcodeAgentJSONValue =
|
|
4
|
+
| LowcodeAgentJSONPrimitive
|
|
5
|
+
| LowcodeAgentJSONValue[]
|
|
6
|
+
| { [key: string]: LowcodeAgentJSONValue }
|
|
7
|
+
|
|
8
|
+
export type LowcodeAgentFramework = 'vue3'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Material icons use the PascalCase export names exposed by lucide-vue-next.
|
|
12
|
+
* The registry and icon picker must resolve this value without a kebab-case
|
|
13
|
+
* conversion or a custom alias table.
|
|
14
|
+
*/
|
|
15
|
+
export type LowcodeAgentLucideIconName = `${Uppercase<string>}${string}`
|
|
16
|
+
|
|
17
|
+
export type LowcodeAgentComponentCategory =
|
|
18
|
+
| 'layout'
|
|
19
|
+
| 'basic'
|
|
20
|
+
| 'form'
|
|
21
|
+
| 'display'
|
|
22
|
+
| 'nav'
|
|
23
|
+
| 'feedback'
|
|
24
|
+
| 'business'
|
|
25
|
+
| 'ai'
|
|
26
|
+
|
|
27
|
+
export type LowcodeAgentControl =
|
|
28
|
+
| 'text'
|
|
29
|
+
| 'textarea'
|
|
30
|
+
| 'number'
|
|
31
|
+
| 'switch'
|
|
32
|
+
| 'select'
|
|
33
|
+
| 'multi-select'
|
|
34
|
+
| 'segmented'
|
|
35
|
+
| 'date'
|
|
36
|
+
| 'data-binding'
|
|
37
|
+
| 'state-binding'
|
|
38
|
+
| 'options-editor'
|
|
39
|
+
| 'table-column-editor'
|
|
40
|
+
| 'upload-group-editor'
|
|
41
|
+
| 'validation-rule-editor'
|
|
42
|
+
| 'ai-config-editor'
|
|
43
|
+
| 'icon-picker'
|
|
44
|
+
| 'json'
|
|
45
|
+
| (string & {})
|
|
46
|
+
|
|
47
|
+
export interface LowcodeAgentLibrarySchema {
|
|
48
|
+
name: string
|
|
49
|
+
importPath: string
|
|
50
|
+
framework: LowcodeAgentFramework | (string & {})
|
|
51
|
+
description?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface LowcodeAgentGroupSchema {
|
|
55
|
+
id: string
|
|
56
|
+
title: string
|
|
57
|
+
order?: number
|
|
58
|
+
children: Array<{
|
|
59
|
+
id: string
|
|
60
|
+
title: string
|
|
61
|
+
components: string[]
|
|
62
|
+
}>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface LowcodeAgentSourceSchema {
|
|
66
|
+
exportName: string
|
|
67
|
+
importPath: string
|
|
68
|
+
path?: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface LowcodeAgentPropOptionSchema {
|
|
72
|
+
value: LowcodeAgentJSONValue
|
|
73
|
+
label: string
|
|
74
|
+
disabled?: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface LowcodeAgentPropSchema {
|
|
78
|
+
name: string
|
|
79
|
+
title: string
|
|
80
|
+
type: string | string[]
|
|
81
|
+
control?: LowcodeAgentControl
|
|
82
|
+
options?: LowcodeAgentPropOptionSchema[]
|
|
83
|
+
default?: LowcodeAgentJSONValue
|
|
84
|
+
bindable: boolean
|
|
85
|
+
advanced: boolean
|
|
86
|
+
hidden: boolean
|
|
87
|
+
required: boolean
|
|
88
|
+
group?: string
|
|
89
|
+
order?: number
|
|
90
|
+
slot?: string
|
|
91
|
+
schemaRef?: string
|
|
92
|
+
description?: string
|
|
93
|
+
itemShape?: Record<string, LowcodeAgentJSONValue>
|
|
94
|
+
[key: string]: unknown
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface LowcodeAgentEventSchema {
|
|
98
|
+
name: string
|
|
99
|
+
eventName: string
|
|
100
|
+
title: string
|
|
101
|
+
payload: Record<string, LowcodeAgentJSONValue | string>
|
|
102
|
+
group?: string
|
|
103
|
+
order?: number
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface LowcodeAgentMethodSchema {
|
|
107
|
+
name: string
|
|
108
|
+
title: string
|
|
109
|
+
callable: boolean
|
|
110
|
+
returnType?: string
|
|
111
|
+
params?: Array<{
|
|
112
|
+
name: string
|
|
113
|
+
title: string
|
|
114
|
+
type: string | string[]
|
|
115
|
+
required?: boolean
|
|
116
|
+
default?: LowcodeAgentJSONValue
|
|
117
|
+
description?: string
|
|
118
|
+
}>
|
|
119
|
+
description?: string
|
|
120
|
+
actionType?: string
|
|
121
|
+
successCondition?: string
|
|
122
|
+
failureCondition?: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface LowcodeAgentSlotSchema {
|
|
126
|
+
name: string
|
|
127
|
+
title: string
|
|
128
|
+
kind?: 'text' | 'canvas' | 'internal'
|
|
129
|
+
accepts: string[]
|
|
130
|
+
multiple: boolean
|
|
131
|
+
required: boolean
|
|
132
|
+
editor?: {
|
|
133
|
+
droppable: boolean
|
|
134
|
+
canvasVisible: boolean
|
|
135
|
+
defaultVisible: boolean
|
|
136
|
+
textConfigurable?: boolean
|
|
137
|
+
bindable?: boolean
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface LowcodeAgentContainerSchema {
|
|
142
|
+
acceptsChildren: true
|
|
143
|
+
defaultDropSlot: string
|
|
144
|
+
allowedChildren: string[]
|
|
145
|
+
defaultChildren?: string[]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface LowcodeAgentDynamicSlotSchema {
|
|
149
|
+
pattern: string
|
|
150
|
+
fromProp: string
|
|
151
|
+
keyField: string
|
|
152
|
+
titleField?: string
|
|
153
|
+
titleTemplate?: string
|
|
154
|
+
accepts: string[]
|
|
155
|
+
multiple: boolean
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface LowcodeAgentRelationshipSchema {
|
|
159
|
+
type: string
|
|
160
|
+
source: {
|
|
161
|
+
component: string
|
|
162
|
+
path: string
|
|
163
|
+
field?: string
|
|
164
|
+
}
|
|
165
|
+
target: {
|
|
166
|
+
component: string
|
|
167
|
+
path: string
|
|
168
|
+
field?: string
|
|
169
|
+
}
|
|
170
|
+
scope?: string
|
|
171
|
+
validation?: string
|
|
172
|
+
description?: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface LowcodeAgentFieldSchema {
|
|
176
|
+
fieldType?: string
|
|
177
|
+
valueType: string | string[]
|
|
178
|
+
bindable: boolean
|
|
179
|
+
defaultFieldName?: string
|
|
180
|
+
formCompatible: boolean
|
|
181
|
+
recommendedInForm?: boolean
|
|
182
|
+
modelProp?: string
|
|
183
|
+
updateEvent?: string
|
|
184
|
+
changeEvent?: string
|
|
185
|
+
validationTriggers?: string[]
|
|
186
|
+
labelProp?: string
|
|
187
|
+
requiredRulePath?: string
|
|
188
|
+
backendSchema?: Record<string, LowcodeAgentJSONValue>
|
|
189
|
+
wrappedBaseComponent?: string
|
|
190
|
+
wrapperComponent?: string
|
|
191
|
+
formFieldWrapper?: boolean
|
|
192
|
+
[key: string]: unknown
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type LowcodeDataRole =
|
|
196
|
+
| 'object'
|
|
197
|
+
| 'collection'
|
|
198
|
+
| 'scalar'
|
|
199
|
+
| 'tree'
|
|
200
|
+
| 'options'
|
|
201
|
+
| 'pagination'
|
|
202
|
+
| 'status'
|
|
203
|
+
|
|
204
|
+
export type LowcodeRequestPolicy =
|
|
205
|
+
| 'controlled'
|
|
206
|
+
| 'runtime-only'
|
|
207
|
+
| 'disabled'
|
|
208
|
+
|
|
209
|
+
export type LowcodeErrorConsumer =
|
|
210
|
+
| 'external'
|
|
211
|
+
| 'prop'
|
|
212
|
+
| 'slot'
|
|
213
|
+
|
|
214
|
+
export interface LowcodeErrorChannel {
|
|
215
|
+
consumer: LowcodeErrorConsumer
|
|
216
|
+
stateRole: 'ui' | 'diagnostic'
|
|
217
|
+
visibleProp?: string
|
|
218
|
+
titleProp?: string
|
|
219
|
+
descriptionProp?: string
|
|
220
|
+
retryEvent?: string
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface LowcodeNestedDataBinding {
|
|
224
|
+
key: string
|
|
225
|
+
path: string
|
|
226
|
+
role: LowcodeDataRole
|
|
227
|
+
valueType: string
|
|
228
|
+
bindable: boolean
|
|
229
|
+
writable?: boolean
|
|
230
|
+
default?: LowcodeAgentJSONValue
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface LowcodeDataBinding {
|
|
234
|
+
prop: string
|
|
235
|
+
path?: string
|
|
236
|
+
role: LowcodeDataRole
|
|
237
|
+
valueType: string
|
|
238
|
+
bindable: boolean
|
|
239
|
+
writable?: boolean
|
|
240
|
+
default?: LowcodeAgentJSONValue
|
|
241
|
+
nested?: LowcodeNestedDataBinding[]
|
|
242
|
+
updateEvent?: string
|
|
243
|
+
valueEventPath?: string
|
|
244
|
+
errorChannel?: LowcodeErrorChannel
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface LowcodeDesignDataPolicy {
|
|
248
|
+
requestPolicy: LowcodeRequestPolicy
|
|
249
|
+
emptyStateProps?: Record<string, LowcodeAgentJSONValue>
|
|
250
|
+
disabledInternalRequests?: string[]
|
|
251
|
+
note?: string
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface LowcodeColumnContractRef {
|
|
255
|
+
prop: 'columns'
|
|
256
|
+
type: 'PersistableTfColumnDef[]'
|
|
257
|
+
schemaRef: 'TfColumnDef.persistable'
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface LowcodeDataCapability {
|
|
261
|
+
roles: LowcodeDataRole[]
|
|
262
|
+
extends?: string[]
|
|
263
|
+
bindings: LowcodeDataBinding[]
|
|
264
|
+
design: LowcodeDesignDataPolicy
|
|
265
|
+
columnContract?: LowcodeColumnContractRef
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface LowcodePersistableColumnPropertySchema {
|
|
269
|
+
type: string | string[]
|
|
270
|
+
required?: boolean
|
|
271
|
+
default?: LowcodeAgentJSONValue
|
|
272
|
+
options?: LowcodeAgentPropOptionSchema[]
|
|
273
|
+
description?: string
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface LowcodePersistableColumnContractSchema {
|
|
277
|
+
kind: 'interface'
|
|
278
|
+
runtimeType: 'TfColumnDef'
|
|
279
|
+
persistableType: 'PersistableTfColumnDef'
|
|
280
|
+
jsonSafe: true
|
|
281
|
+
fields: Record<string, LowcodePersistableColumnPropertySchema>
|
|
282
|
+
disallowedRuntimeFields: string[]
|
|
283
|
+
description?: string
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface PersistableTfColumnDef {
|
|
287
|
+
field?: string
|
|
288
|
+
fieldId?: string | number
|
|
289
|
+
headerName?: string
|
|
290
|
+
width?: number
|
|
291
|
+
editable?: boolean
|
|
292
|
+
fieldType?: string
|
|
293
|
+
elementPosition?: 'left' | 'center' | 'right'
|
|
294
|
+
required?: boolean
|
|
295
|
+
isQuery?: boolean
|
|
296
|
+
isSum?: boolean
|
|
297
|
+
isChooseSum?: boolean
|
|
298
|
+
isFreeze?: boolean
|
|
299
|
+
isShow?: boolean
|
|
300
|
+
fieldWidth?: number
|
|
301
|
+
fieldIndex?: number
|
|
302
|
+
options?: Array<{ label: string; value: string | number | boolean | null; disabled?: boolean }>
|
|
303
|
+
numberConfig?: Record<string, LowcodeAgentJSONValue>
|
|
304
|
+
decimalConfig?: Record<string, LowcodeAgentJSONValue>
|
|
305
|
+
selectConfig?: Record<string, LowcodeAgentJSONValue>
|
|
306
|
+
basicDataConfig?: Record<string, LowcodeAgentJSONValue>
|
|
307
|
+
tagConfig?: Record<string, LowcodeAgentJSONValue>
|
|
308
|
+
statusConfig?: Record<string, LowcodeAgentJSONValue>
|
|
309
|
+
props?: Record<string, LowcodeAgentJSONValue>
|
|
310
|
+
events?: Record<string, LowcodeAgentJSONValue[]>
|
|
311
|
+
carryMappings?: LowcodeAgentJSONValue[]
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface LowcodeAgentFieldTypeSchema {
|
|
315
|
+
name: string
|
|
316
|
+
title: string
|
|
317
|
+
component: string
|
|
318
|
+
valueType: string[]
|
|
319
|
+
modelProp: string
|
|
320
|
+
updateEvent: string
|
|
321
|
+
defaultProps?: Record<string, LowcodeAgentJSONValue>
|
|
322
|
+
configurableProps?: string[]
|
|
323
|
+
backendSchema?: Record<string, LowcodeAgentJSONValue>
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface LowcodeAgentAiCapabilitySchema {
|
|
327
|
+
id: string
|
|
328
|
+
title: string
|
|
329
|
+
preset: string
|
|
330
|
+
triggerModes: string[]
|
|
331
|
+
defaultNeedConfirm: boolean
|
|
332
|
+
input: Record<string, LowcodeAgentJSONValue | string>
|
|
333
|
+
output: Record<string, LowcodeAgentJSONValue | string>
|
|
334
|
+
defaultApply: string | null
|
|
335
|
+
backendAgentContract?: {
|
|
336
|
+
intent: string
|
|
337
|
+
expectedResponse: Record<string, LowcodeAgentJSONValue | string>
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface LowcodeAgentLowcodeSchema {
|
|
342
|
+
layout?: {
|
|
343
|
+
heightPolicy?: string
|
|
344
|
+
fallbackMinHeight?: number
|
|
345
|
+
[key: string]: unknown
|
|
346
|
+
}
|
|
347
|
+
palette: {
|
|
348
|
+
/** A registered PascalCase export name from lucide-vue-next. */
|
|
349
|
+
icon?: LowcodeAgentLucideIconName
|
|
350
|
+
order?: number
|
|
351
|
+
draggable?: boolean
|
|
352
|
+
recommended?: boolean
|
|
353
|
+
hidden?: boolean
|
|
354
|
+
}
|
|
355
|
+
editor?: {
|
|
356
|
+
canvasSlots: string[]
|
|
357
|
+
defaultEnabledSlots: string[]
|
|
358
|
+
propGroups?: Array<{
|
|
359
|
+
id: string
|
|
360
|
+
title: string
|
|
361
|
+
order?: number
|
|
362
|
+
defaultExpanded?: boolean
|
|
363
|
+
}>
|
|
364
|
+
defaultExpandedPropGroups?: string[]
|
|
365
|
+
eventGroups?: Array<{
|
|
366
|
+
id: string
|
|
367
|
+
title: string
|
|
368
|
+
order?: number
|
|
369
|
+
defaultExpanded?: boolean
|
|
370
|
+
}>
|
|
371
|
+
}
|
|
372
|
+
props: LowcodeAgentPropSchema[]
|
|
373
|
+
events: LowcodeAgentEventSchema[]
|
|
374
|
+
methods?: LowcodeAgentMethodSchema[]
|
|
375
|
+
slots: LowcodeAgentSlotSchema[]
|
|
376
|
+
container?: LowcodeAgentContainerSchema
|
|
377
|
+
dynamicSlots?: LowcodeAgentDynamicSlotSchema[]
|
|
378
|
+
relationships?: LowcodeAgentRelationshipSchema[]
|
|
379
|
+
composition?: Record<string, LowcodeAgentJSONValue>
|
|
380
|
+
customTypes?: Record<string, LowcodeAgentJSONValue>
|
|
381
|
+
field?: LowcodeAgentFieldSchema
|
|
382
|
+
data?: LowcodeDataCapability
|
|
383
|
+
design?: Record<string, LowcodeAgentJSONValue>
|
|
384
|
+
fieldTypes?: LowcodeAgentFieldTypeSchema[]
|
|
385
|
+
formAdapter?: {
|
|
386
|
+
component: string
|
|
387
|
+
whenParent: string[]
|
|
388
|
+
}
|
|
389
|
+
formFieldFor?: string
|
|
390
|
+
formShell?: boolean
|
|
391
|
+
/** Runtime action tree metadata for business shells with nested header actions. */
|
|
392
|
+
actionMenu?: Record<string, LowcodeAgentJSONValue>
|
|
393
|
+
ai?: {
|
|
394
|
+
configurable: boolean
|
|
395
|
+
editor: LowcodeAgentControl
|
|
396
|
+
dslProp: string
|
|
397
|
+
runtimeProp: string
|
|
398
|
+
capabilityIds: string[]
|
|
399
|
+
stateEvent: string
|
|
400
|
+
consumption?: string
|
|
401
|
+
dslSchemaRef?: string
|
|
402
|
+
runtimeSchemaRef?: string
|
|
403
|
+
}
|
|
404
|
+
aiCapabilities?: LowcodeAgentAiCapabilitySchema[]
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface LowcodeAgentComponentSchema {
|
|
408
|
+
name: string
|
|
409
|
+
title: string
|
|
410
|
+
category: LowcodeAgentComponentCategory | (string & {})
|
|
411
|
+
group: string
|
|
412
|
+
source: LowcodeAgentSourceSchema
|
|
413
|
+
lowcode: LowcodeAgentLowcodeSchema
|
|
414
|
+
agent?: Record<string, unknown>
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface LowcodeAgentSceneTemplateSchema {
|
|
418
|
+
id: string
|
|
419
|
+
title: string
|
|
420
|
+
description?: string
|
|
421
|
+
recommendedComponents: string[]
|
|
422
|
+
agentIntentExamples?: string[]
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface LowcodeAgentComponentRegistry {
|
|
426
|
+
schemaVersion: string
|
|
427
|
+
library: LowcodeAgentLibrarySchema
|
|
428
|
+
groups: LowcodeAgentGroupSchema[]
|
|
429
|
+
components: LowcodeAgentComponentSchema[]
|
|
430
|
+
sceneTemplates: LowcodeAgentSceneTemplateSchema[]
|
|
431
|
+
agentCapabilityIndex: Record<string, string[]>
|
|
432
|
+
aiRuntimeContract: Record<string, unknown>
|
|
433
|
+
controlContract?: Record<string, unknown>
|
|
434
|
+
registryConventions?: Record<string, unknown>
|
|
435
|
+
formFieldContract?: Record<string, unknown>
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface LowcodeAgentIconGroupSchema {
|
|
439
|
+
id: string
|
|
440
|
+
title: string
|
|
441
|
+
order?: number
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export interface LowcodeAgentIconSchema {
|
|
445
|
+
name: LowcodeAgentLucideIconName
|
|
446
|
+
label: string
|
|
447
|
+
category: string
|
|
448
|
+
keywords?: string[]
|
|
449
|
+
aliases?: string[]
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface LowcodeAgentIconRegistry {
|
|
453
|
+
schemaVersion: string
|
|
454
|
+
library: {
|
|
455
|
+
name: string
|
|
456
|
+
packageName: string
|
|
457
|
+
importPath: string
|
|
458
|
+
}
|
|
459
|
+
valueShape: {
|
|
460
|
+
library: string
|
|
461
|
+
name: LowcodeAgentLucideIconName
|
|
462
|
+
}
|
|
463
|
+
groups: LowcodeAgentIconGroupSchema[]
|
|
464
|
+
icons: LowcodeAgentIconSchema[]
|
|
465
|
+
runtimeContract: {
|
|
466
|
+
saveAs: string
|
|
467
|
+
resolver: string
|
|
468
|
+
fallback: LowcodeAgentLucideIconName
|
|
469
|
+
renderHint: string
|
|
470
|
+
}
|
|
471
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Golden Example: Dashboard / 工作台
|
|
2
|
+
|
|
3
|
+
## 场景
|
|
4
|
+
|
|
5
|
+
用于企业后台首页、业务工作台、运营概览页。Agent 应生成高密度信息概览,而不是营销式大屏或宣传页。
|
|
6
|
+
|
|
7
|
+
## 推荐结构
|
|
8
|
+
|
|
9
|
+
1. `TfPageHeader` 放页面标题、说明、刷新和时间范围。
|
|
10
|
+
2. `TfGrid` + `TfMetric` 展示核心指标。
|
|
11
|
+
3. `TfCard` 展示待办任务、异常提醒、最近记录。
|
|
12
|
+
4. `TfTable` 展示结构化待办或异常数据。
|
|
13
|
+
5. 局部加载失败时只影响对应卡片,不阻断整个页面。
|
|
14
|
+
|
|
15
|
+
## 推荐组件
|
|
16
|
+
|
|
17
|
+
- `TfPageHeader`
|
|
18
|
+
- `TfGrid`
|
|
19
|
+
- `TfMetric`
|
|
20
|
+
- `TfCard`
|
|
21
|
+
- `TfButton`
|
|
22
|
+
- `TfTable`
|
|
23
|
+
- `TfTag`
|
|
24
|
+
- `TfProgress`
|
|
25
|
+
- `TfSkeleton`
|
|
26
|
+
- `TfEmpty`
|
|
27
|
+
- `TfAlert`
|
|
28
|
+
|
|
29
|
+
## 可替换区域
|
|
30
|
+
|
|
31
|
+
- 指标名称、数值、趋势。
|
|
32
|
+
- 待办列表字段。
|
|
33
|
+
- 异常提醒类型。
|
|
34
|
+
- 时间范围和刷新 API。
|
|
35
|
+
|
|
36
|
+
## 不建议改动区域
|
|
37
|
+
|
|
38
|
+
- 不做全屏 hero。
|
|
39
|
+
- 不使用大面积渐变背景。
|
|
40
|
+
- 不使用装饰性图形替代真实业务数据。
|
|
41
|
+
- 指标区必须可快速扫描。
|
|
42
|
+
- 每个模块必须有 loading、empty 或 error 处理。
|
|
43
|
+
|
|
44
|
+
## 状态覆盖
|
|
45
|
+
|
|
46
|
+
- loading:整体或模块加载。
|
|
47
|
+
- empty:无待办、无异常。
|
|
48
|
+
- error:局部模块加载失败。
|
|
49
|
+
- refreshing:刷新按钮 loading。
|
|
50
|
+
- partial-error:某个模块失败不影响其他模块。
|
|
51
|
+
|
|
52
|
+
## Vue SFC 示例代码
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<template>
|
|
56
|
+
<div class="space-y-4">
|
|
57
|
+
<TfPageHeader title="业务工作台" description="查看今日任务、异常提醒和关键指标">
|
|
58
|
+
<template #actions>
|
|
59
|
+
<TfButton :loading="refreshing" @click="refreshAll">
|
|
60
|
+
<RefreshCw class="h-4 w-4" />
|
|
61
|
+
刷新
|
|
62
|
+
</TfButton>
|
|
63
|
+
</template>
|
|
64
|
+
</TfPageHeader>
|
|
65
|
+
|
|
66
|
+
<TfGrid :cols="4" :gap="16">
|
|
67
|
+
<TfMetric label="今日新增" :value="metrics.todayCreated" unit="条" />
|
|
68
|
+
<TfMetric label="待处理" :value="metrics.pending" unit="条" />
|
|
69
|
+
<TfMetric label="异常单据" :value="metrics.exceptions" unit="条" theme="warning" />
|
|
70
|
+
<TfMetric label="完成率" :value="metrics.completionRate" unit="%" theme="success" />
|
|
71
|
+
</TfGrid>
|
|
72
|
+
|
|
73
|
+
<div class="grid gap-4 lg:grid-cols-2">
|
|
74
|
+
<TfCard title="我的待办">
|
|
75
|
+
<TfAlert v-if="todoError" type="error" title="待办加载失败" :description="todoError" show-icon>
|
|
76
|
+
<template #action>
|
|
77
|
+
<TfButton size="sm" @click="loadTodos">重试</TfButton>
|
|
78
|
+
</template>
|
|
79
|
+
</TfAlert>
|
|
80
|
+
|
|
81
|
+
<TfSkeleton v-else-if="todoLoading" :rows="5" />
|
|
82
|
+
<TfEmpty v-else-if="!todos.length" description="暂无待办任务" />
|
|
83
|
+
<TfTable v-else :columns="todoColumns" :data="todos" row-key="id" />
|
|
84
|
+
</TfCard>
|
|
85
|
+
|
|
86
|
+
<TfCard title="异常提醒">
|
|
87
|
+
<TfAlert v-if="exceptionError" type="error" title="异常提醒加载失败" :description="exceptionError" show-icon>
|
|
88
|
+
<template #action>
|
|
89
|
+
<TfButton size="sm" @click="loadExceptions">重试</TfButton>
|
|
90
|
+
</template>
|
|
91
|
+
</TfAlert>
|
|
92
|
+
|
|
93
|
+
<TfSkeleton v-else-if="exceptionLoading" :rows="5" />
|
|
94
|
+
<TfEmpty v-else-if="!exceptions.length" description="暂无异常提醒" />
|
|
95
|
+
<TfTable v-else :columns="exceptionColumns" :data="exceptions" row-key="id" />
|
|
96
|
+
</TfCard>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup lang="ts">
|
|
102
|
+
import { computed, h, onMounted, reactive, ref } from 'vue'
|
|
103
|
+
import { RefreshCw } from 'lucide-vue-next'
|
|
104
|
+
import {
|
|
105
|
+
TfAlert,
|
|
106
|
+
TfButton,
|
|
107
|
+
TfCard,
|
|
108
|
+
TfEmpty,
|
|
109
|
+
TfGrid,
|
|
110
|
+
TfMetric,
|
|
111
|
+
TfPageHeader,
|
|
112
|
+
TfSkeleton,
|
|
113
|
+
TfTable,
|
|
114
|
+
TfTag
|
|
115
|
+
} from '@tongfun/ui'
|
|
116
|
+
|
|
117
|
+
interface TodoItem {
|
|
118
|
+
id: number
|
|
119
|
+
title: string
|
|
120
|
+
type: string
|
|
121
|
+
deadline: string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface ExceptionItem {
|
|
125
|
+
id: number
|
|
126
|
+
title: string
|
|
127
|
+
level: 'warning' | 'error'
|
|
128
|
+
count: number
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const refreshing = ref(false)
|
|
132
|
+
const todoLoading = ref(false)
|
|
133
|
+
const exceptionLoading = ref(false)
|
|
134
|
+
const todoError = ref('')
|
|
135
|
+
const exceptionError = ref('')
|
|
136
|
+
|
|
137
|
+
const metrics = reactive({
|
|
138
|
+
todayCreated: 0,
|
|
139
|
+
pending: 0,
|
|
140
|
+
exceptions: 0,
|
|
141
|
+
completionRate: 0
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const todos = ref<TodoItem[]>([])
|
|
145
|
+
const exceptions = ref<ExceptionItem[]>([])
|
|
146
|
+
|
|
147
|
+
const todoColumns = computed(() => [
|
|
148
|
+
{ title: '任务', key: 'title', minWidth: 180 },
|
|
149
|
+
{ title: '类型', key: 'type', width: 120 },
|
|
150
|
+
{ title: '截止时间', key: 'deadline', width: 160 }
|
|
151
|
+
])
|
|
152
|
+
|
|
153
|
+
const exceptionColumns = computed(() => [
|
|
154
|
+
{ title: '异常', key: 'title', minWidth: 180 },
|
|
155
|
+
{
|
|
156
|
+
title: '级别',
|
|
157
|
+
key: 'level',
|
|
158
|
+
width: 100,
|
|
159
|
+
render: ({ row }: { row: ExceptionItem }) => h(TfTag, { type: row.level === 'error' ? 'danger' : 'warning' }, () => row.level === 'error' ? '严重' : '提醒')
|
|
160
|
+
},
|
|
161
|
+
{ title: '数量', key: 'count', width: 100 }
|
|
162
|
+
])
|
|
163
|
+
|
|
164
|
+
onMounted(() => {
|
|
165
|
+
refreshAll()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
async function refreshAll() {
|
|
169
|
+
refreshing.value = true
|
|
170
|
+
try {
|
|
171
|
+
await Promise.allSettled([
|
|
172
|
+
loadMetrics(),
|
|
173
|
+
loadTodos(),
|
|
174
|
+
loadExceptions()
|
|
175
|
+
])
|
|
176
|
+
} finally {
|
|
177
|
+
refreshing.value = false
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async function loadMetrics() {
|
|
182
|
+
// Replace with metric API.
|
|
183
|
+
metrics.todayCreated = 0
|
|
184
|
+
metrics.pending = 0
|
|
185
|
+
metrics.exceptions = 0
|
|
186
|
+
metrics.completionRate = 0
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function loadTodos() {
|
|
190
|
+
todoLoading.value = true
|
|
191
|
+
todoError.value = ''
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
// Replace with todo API.
|
|
195
|
+
todos.value = []
|
|
196
|
+
} catch (err) {
|
|
197
|
+
todoError.value = err instanceof Error ? err.message : '请稍后重试'
|
|
198
|
+
} finally {
|
|
199
|
+
todoLoading.value = false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async function loadExceptions() {
|
|
204
|
+
exceptionLoading.value = true
|
|
205
|
+
exceptionError.value = ''
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
// Replace with exception API.
|
|
209
|
+
exceptions.value = []
|
|
210
|
+
} catch (err) {
|
|
211
|
+
exceptionError.value = err instanceof Error ? err.message : '请稍后重试'
|
|
212
|
+
} finally {
|
|
213
|
+
exceptionLoading.value = false
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 设计说明
|
|
220
|
+
|
|
221
|
+
- 工作台首屏直接呈现指标和待办,不做营销式 hero。
|
|
222
|
+
- 指标卡片用于快速扫描,待办和异常使用结构化列表。
|
|
223
|
+
- 每个模块独立处理 loading、empty、error,允许局部失败。
|
|
224
|
+
- 页面只使用少量布局 class,不硬编码品牌色或状态色。
|