@agentprismform/render-vue 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,642 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ computed,
4
+ onUnmounted,
5
+ provide,
6
+ reactive,
7
+ ref,
8
+ shallowRef,
9
+ watch,
10
+ } from 'vue'
11
+ import { FormCore, type FormSchema, type StorageAdapter } from '@agentprismform/core'
12
+ import { createFormRenderState, type ResolvedFormGroup } from '@agentprismform/render'
13
+ import {
14
+ FORM_UI_HOST_HANDLERS_KEY,
15
+ MODERN_COLLAPSIBLE_KEY,
16
+ MODERN_CUSTOM_CONTROLS_KEY,
17
+ MODERN_KEYBOARD_POLICY_KEY,
18
+ MODERN_LOCALE_KEY,
19
+ MODERN_READONLY_KEY,
20
+ MODERN_SHELL_SKIN_KEY,
21
+ MODERN_TELEMETRY_KEY,
22
+ MODERN_THEME_OVERRIDE_KEY,
23
+ computeFormProgress,
24
+ getModernShellComponents,
25
+ normalizeModernLocale,
26
+ resolveModernThemeVars,
27
+ type FormTelemetryHandler,
28
+ type FormUiHostHandlers,
29
+ type ModernCustomControlsMap,
30
+ type ModernKeyboardPolicy,
31
+ type ModernLocale,
32
+ type ModernShellSkin,
33
+ type ModernThemeOverride,
34
+ } from '@agentprismform/render-ui'
35
+ import FormRender from './FormRender.vue'
36
+
37
+ export interface PrismFormThemeConfig {
38
+ skin?: ModernShellSkin
39
+ override?: ModernThemeOverride | null
40
+ formMode?: 'flat' | 'collapsible' | 'step'
41
+ showProgressBar?: boolean
42
+ readOnly?: boolean
43
+ keyboardPolicy?: ModernKeyboardPolicy
44
+ submitText?: string
45
+ locale?: ModernLocale
46
+ }
47
+
48
+ export interface PrismFormBundle {
49
+ schema: FormSchema
50
+ themeConfig?: PrismFormThemeConfig | null
51
+ }
52
+
53
+ const props = withDefaults(
54
+ defineProps<{
55
+ /** Raw FormSchema (optional if `bundle` is provided) */
56
+ schema?: FormSchema | null
57
+ /** Finalized form.bundle.json ({ schema, themeConfig }) from release-export / scaffold-host */
58
+ bundle?: PrismFormBundle | null
59
+ /** Optional ThemeConfigJson overrides */
60
+ themeConfig?: PrismFormThemeConfig | null
61
+ /** Initial field values passed into FormCore.init() */
62
+ initialValues?: Record<string, any>
63
+ /** Visual skin: 'fin-minimal' | 'clean-outline' | 'bank-card' */
64
+ skin?: ModernShellSkin
65
+ /** Brand color / radius / density / trust bar overrides */
66
+ themeOverride?: ModernThemeOverride | null
67
+ /** Layout interaction mode: 'flat' | 'collapsible' | 'step' */
68
+ formMode?: 'flat' | 'collapsible' | 'step'
69
+ /** Show top progress bar & jump-to-first-missing button */
70
+ showProgressBar?: boolean
71
+ /** Review Mode (read-only + sensitive field masking) */
72
+ readOnly?: boolean
73
+ /** Custom numeric/ID keypad policy: 'auto' | 'custom' | 'system' */
74
+ keyboardPolicy?: ModernKeyboardPolicy
75
+ /** UI language: 'zh-CN' | 'en-US' */
76
+ locale?: ModernLocale
77
+ /** Business handlers (sendVerifyCode / uploadFile / searchSuggest / loadAddressChildren / launchTask) */
78
+ hostHandlers?: FormUiHostHandlers | null
79
+ /** Partial widget override or custom control registry (by item.key / item.type) */
80
+ customControls?: ModernCustomControlsMap
81
+ /** Optional telemetry callback */
82
+ onTelemetry?: FormTelemetryHandler
83
+ /** Optional custom StorageAdapter (defaults to in-memory Map) */
84
+ storageAdapter?: StorageAdapter
85
+ /** Submit button text override */
86
+ submitText?: string
87
+ /** Whether to render the built-in submit button (default true) */
88
+ showSubmit?: boolean
89
+ /** Disable submit button externally while parent is submitting */
90
+ submitting?: boolean
91
+ /** Max container width (default '680px') */
92
+ maxWidth?: string
93
+ }>(),
94
+ {
95
+ schema: null,
96
+ bundle: null,
97
+ themeConfig: null,
98
+ initialValues: undefined,
99
+ skin: undefined,
100
+ themeOverride: undefined,
101
+ formMode: undefined,
102
+ showProgressBar: undefined,
103
+ readOnly: undefined,
104
+ keyboardPolicy: undefined,
105
+ locale: undefined,
106
+ hostHandlers: null,
107
+ customControls: undefined,
108
+ onTelemetry: undefined,
109
+ storageAdapter: undefined,
110
+ submitText: undefined,
111
+ showSubmit: true,
112
+ submitting: false,
113
+ maxWidth: '680px',
114
+ },
115
+ )
116
+
117
+ const emit = defineEmits<{
118
+ (e: 'submit', data: Record<string, any>): void
119
+ (e: 'change', payload: { values: Record<string, any>; fields: Record<string, any> }): void
120
+ (e: 'validate-error', payload: { firstErrorKey: string | null; errors: Record<string, string> }): void
121
+ }>()
122
+
123
+ const resolvedSchema = computed<FormSchema | null>(() => props.schema || props.bundle?.schema || null)
124
+ const mergedThemeConfig = computed<PrismFormThemeConfig>(() => ({
125
+ ...(props.bundle?.themeConfig || {}),
126
+ ...(props.themeConfig || {}),
127
+ }))
128
+
129
+ const effectiveSkin = computed<ModernShellSkin>(
130
+ () => props.skin || mergedThemeConfig.value.skin || 'fin-minimal',
131
+ )
132
+ const effectiveOverride = computed<ModernThemeOverride | null>(
133
+ () => props.themeOverride ?? mergedThemeConfig.value.override ?? null,
134
+ )
135
+ const effectiveFormMode = computed<'flat' | 'collapsible' | 'step'>(
136
+ () => props.formMode || mergedThemeConfig.value.formMode || 'flat',
137
+ )
138
+ const effectiveShowProgress = computed<boolean>(() => {
139
+ if (typeof props.showProgressBar === 'boolean') return props.showProgressBar
140
+ if (typeof mergedThemeConfig.value.showProgressBar === 'boolean') {
141
+ return mergedThemeConfig.value.showProgressBar
142
+ }
143
+ return true
144
+ })
145
+ const effectiveReadOnly = computed<boolean>(() => {
146
+ if (typeof props.readOnly === 'boolean') return props.readOnly
147
+ return Boolean(mergedThemeConfig.value.readOnly)
148
+ })
149
+ const effectiveKeyboardPolicy = computed<ModernKeyboardPolicy>(
150
+ () => props.keyboardPolicy || mergedThemeConfig.value.keyboardPolicy || 'auto',
151
+ )
152
+ const effectiveLocale = computed<ModernLocale>(() =>
153
+ normalizeModernLocale(props.locale || mergedThemeConfig.value.locale || 'zh-CN'),
154
+ )
155
+ const isEn = computed(() => effectiveLocale.value === 'en-US')
156
+
157
+ const themeVars = computed(() => resolveModernThemeVars(effectiveSkin.value, effectiveOverride.value))
158
+ const modernShell = getModernShellComponents()
159
+
160
+ provide(MODERN_SHELL_SKIN_KEY, effectiveSkin)
161
+ provide(MODERN_THEME_OVERRIDE_KEY, effectiveOverride)
162
+ provide(
163
+ MODERN_COLLAPSIBLE_KEY,
164
+ computed(() => effectiveFormMode.value === 'collapsible'),
165
+ )
166
+ provide(MODERN_KEYBOARD_POLICY_KEY, effectiveKeyboardPolicy)
167
+ provide(MODERN_READONLY_KEY, effectiveReadOnly)
168
+ provide(
169
+ MODERN_TELEMETRY_KEY,
170
+ computed(() => props.onTelemetry || null),
171
+ )
172
+ provide(MODERN_LOCALE_KEY, effectiveLocale)
173
+ provide(
174
+ MODERN_CUSTOM_CONTROLS_KEY,
175
+ computed(() => props.customControls || {}),
176
+ )
177
+ provide(
178
+ FORM_UI_HOST_HANDLERS_KEY,
179
+ computed(() => props.hostHandlers ?? null),
180
+ )
181
+
182
+ const rootEl = ref<HTMLElement | null>(null)
183
+ const coreRef = shallowRef<FormCore | null>(null)
184
+ const fields = reactive<Record<string, any>>({})
185
+ const groups = ref<ResolvedFormGroup[]>([])
186
+ const activeStep = ref(0)
187
+ const ready = ref(false)
188
+ let activeCleanup: (() => void) | null = null
189
+
190
+ function createDefaultStorage(): StorageAdapter {
191
+ const mem = new Map<string, any>()
192
+ return {
193
+ get: (k: string) => mem.get(k),
194
+ set: (k: string, v: any) => mem.set(k, v),
195
+ remove: (k: string) => mem.delete(k),
196
+ }
197
+ }
198
+
199
+ function cloneSchema(s: FormSchema): FormSchema {
200
+ return JSON.parse(JSON.stringify(s))
201
+ }
202
+
203
+ function syncFromCore(core: FormCore, schema: FormSchema) {
204
+ const currentKeys = new Set(Object.keys(core.fields))
205
+ for (const existing of Object.keys(fields)) {
206
+ if (!currentKeys.has(existing)) delete fields[existing]
207
+ }
208
+ const snap: Record<string, any> = {}
209
+ for (const k of currentKeys) {
210
+ const copy = { ...core.fields[k] }
211
+ fields[k] = copy
212
+ snap[k] = copy
213
+ }
214
+ groups.value = createFormRenderState(schema, snap, { excludeTaskAndAgreement: false }).groups
215
+ }
216
+
217
+ async function mountCore(schema: FormSchema | null) {
218
+ if (activeCleanup) {
219
+ activeCleanup()
220
+ activeCleanup = null
221
+ }
222
+ ready.value = false
223
+ activeStep.value = 0
224
+ if (!schema) {
225
+ coreRef.value = null
226
+ groups.value = []
227
+ return
228
+ }
229
+
230
+ const cloned = cloneSchema(schema)
231
+ const core = new FormCore(cloned, props.storageAdapter || createDefaultStorage())
232
+ coreRef.value = core
233
+
234
+ const onAfterChange = () => {
235
+ syncFromCore(core, cloned)
236
+ emit('change', {
237
+ values: core.collectFormData({ skipVerify: true }),
238
+ fields: { ...fields },
239
+ })
240
+ }
241
+
242
+ await core.init(props.initialValues ? { ...props.initialValues } : {})
243
+ core.on('afterChange', onAfterChange)
244
+ activeCleanup = () => {
245
+ core.off('afterChange', onAfterChange)
246
+ }
247
+ syncFromCore(core, cloned)
248
+ ready.value = true
249
+ }
250
+
251
+ watch(
252
+ resolvedSchema,
253
+ (next) => {
254
+ void mountCore(next)
255
+ },
256
+ { immediate: true },
257
+ )
258
+
259
+ onUnmounted(() => {
260
+ if (activeCleanup) {
261
+ activeCleanup()
262
+ activeCleanup = null
263
+ }
264
+ })
265
+
266
+ const isStepMode = computed(() => effectiveFormMode.value === 'step' && groups.value.length > 1)
267
+ const safeStep = computed(() => Math.min(activeStep.value, Math.max(0, groups.value.length - 1)))
268
+ const visibleGroups = computed<ResolvedFormGroup[]>(() =>
269
+ isStepMode.value ? [groups.value[safeStep.value]].filter(Boolean) : groups.value,
270
+ )
271
+ const progress = computed(() =>
272
+ effectiveShowProgress.value ? computeFormProgress(groups.value as any, fields) : null,
273
+ )
274
+ const effectiveSubmitText = computed(
275
+ () =>
276
+ props.submitText ||
277
+ mergedThemeConfig.value.submitText ||
278
+ (isEn.value ? 'Submit Form' : '提交表单'),
279
+ )
280
+
281
+ function scrollToField(key: string | null) {
282
+ if (!key || typeof document === 'undefined') return
283
+ if (isStepMode.value) {
284
+ const idx = groups.value.findIndex((g) => (g.items || []).some((it: any) => it.key === key))
285
+ if (idx >= 0) activeStep.value = idx
286
+ }
287
+ const scope = rootEl.value || document
288
+ const el =
289
+ (scope.querySelector(`[data-field-key="${key}"]`) as HTMLElement | null) ||
290
+ (scope.querySelector('[data-has-error="1"], .m-field-error') as HTMLElement | null)
291
+ if (el && typeof el.scrollIntoView === 'function') {
292
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' })
293
+ }
294
+ const focusable = el?.querySelector('input, textarea, select') as HTMLElement | null
295
+ focusable?.focus?.({ preventScroll: true })
296
+ }
297
+
298
+ function collectErrors(core: FormCore): { firstErrorKey: string | null; errors: Record<string, string> } {
299
+ const errors: Record<string, string> = {}
300
+ let firstErrorKey: string | null = null
301
+ for (const g of groups.value) {
302
+ for (const item of g.items || []) {
303
+ const msg = core.fields[item.key]?.errMsg
304
+ if (msg) {
305
+ errors[item.key] = String(msg)
306
+ if (!firstErrorKey) firstErrorKey = item.key
307
+ }
308
+ }
309
+ }
310
+ return { firstErrorKey, errors }
311
+ }
312
+
313
+ function isAgreementValueChecked(v: unknown): boolean {
314
+ return v === true || v === '1' || v === 1 || v === 'true'
315
+ }
316
+
317
+ function formatAgreementRequiredMsg(label: string): string {
318
+ const clean = String(label || '').trim()
319
+ if (isEn.value) {
320
+ if (clean && /^(I have read|I agree|Agree)/i.test(clean)) return `Please accept "${clean}"`
321
+ return `Please read and accept ${clean || 'the agreement'}`
322
+ }
323
+ if (clean && /^(我已|已)?阅读并同意/.test(clean)) return `请先勾选「${clean}」`
324
+ return `请先阅读并同意${clean || '相关协议'}`
325
+ }
326
+
327
+ function validate(): boolean {
328
+ const core = coreRef.value
329
+ const schema = resolvedSchema.value
330
+ if (!core || !schema) return false
331
+ let ok = core.validateAll()
332
+ for (const g of groups.value) {
333
+ for (const item of g.items || []) {
334
+ const f = core.fields[item.key]
335
+ if (!f || f.visible === false) continue
336
+ if (item.type === 'agreement' && !f.errMsg) {
337
+ const req =
338
+ typeof f.required === 'boolean'
339
+ ? f.required
340
+ : item.required === true ||
341
+ (Array.isArray(item.rules) && item.rules.some((r: any) => r.type === 'required'))
342
+ if (req && !isAgreementValueChecked(f.value)) {
343
+ const ruleMsg = Array.isArray(item.rules)
344
+ ? item.rules.find((r: any) => r.type === 'required')?.message
345
+ : ''
346
+ f.errMsg = String(ruleMsg || formatAgreementRequiredMsg(item.label || ''))
347
+ ok = false
348
+ }
349
+ }
350
+ }
351
+ }
352
+ syncFromCore(core, schema)
353
+ if (!ok) {
354
+ const errInfo = collectErrors(core)
355
+ emit('validate-error', errInfo)
356
+ scrollToField(errInfo.firstErrorKey)
357
+ }
358
+ return ok
359
+ }
360
+
361
+ function getValues(): Record<string, any> {
362
+ return coreRef.value ? coreRef.value.collectFormData({ skipVerify: true }) : {}
363
+ }
364
+
365
+ function setValue(key: string, value: any, options?: { skipVerify?: boolean; eventType?: string }) {
366
+ coreRef.value?.setControlData(key, value, options)
367
+ }
368
+
369
+ async function reset(nextInitialValues?: Record<string, any>) {
370
+ const schema = resolvedSchema.value
371
+ if (!schema) return
372
+ if (nextInitialValues !== undefined) {
373
+ const cloned = cloneSchema(schema)
374
+ if (activeCleanup) {
375
+ activeCleanup()
376
+ activeCleanup = null
377
+ }
378
+ const core = new FormCore(cloned, props.storageAdapter || createDefaultStorage())
379
+ coreRef.value = core
380
+ const onAfterChange = () => {
381
+ syncFromCore(core, cloned)
382
+ emit('change', {
383
+ values: core.collectFormData({ skipVerify: true }),
384
+ fields: { ...fields },
385
+ })
386
+ }
387
+ await core.init({ ...nextInitialValues })
388
+ core.on('afterChange', onAfterChange)
389
+ activeCleanup = () => core.off('afterChange', onAfterChange)
390
+ syncFromCore(core, cloned)
391
+ ready.value = true
392
+ return
393
+ }
394
+ await mountCore(schema)
395
+ }
396
+
397
+ function handleSubmitClick() {
398
+ if (props.submitting || effectiveReadOnly.value) return
399
+ if (!validate()) return
400
+ emit('submit', getValues())
401
+ }
402
+
403
+ defineExpose({
404
+ validate,
405
+ getValues,
406
+ setValue,
407
+ reset,
408
+ getCore: () => coreRef.value,
409
+ })
410
+ </script>
411
+
412
+ <template>
413
+ <div
414
+ ref="rootEl"
415
+ class="apf-prism-form"
416
+ :data-modern-skin="effectiveSkin"
417
+ :style="{ ...themeVars, maxWidth }"
418
+ >
419
+ <div v-if="resolvedSchema?.title" class="apf-prism-form__header">
420
+ <div class="apf-prism-form__title">{{ resolvedSchema.title }}</div>
421
+ <div v-if="resolvedSchema.description" class="apf-prism-form__desc">
422
+ {{ resolvedSchema.description }}
423
+ </div>
424
+ </div>
425
+
426
+ <div
427
+ v-if="ready && progress && progress.total > 0"
428
+ class="apf-prism-form__progress"
429
+ data-testid="prism-form-progress"
430
+ >
431
+ <div class="apf-prism-form__progress-row">
432
+ <span v-if="isEn">
433
+ Progress <strong>{{ progress.percent }}%</strong> (Required {{ progress.requiredFilled }}/{{ progress.requiredTotal }})
434
+ </span>
435
+ <span v-else>
436
+ 填写进度 <strong>{{ progress.percent }}%</strong>(必填 {{ progress.requiredFilled }}/{{ progress.requiredTotal }})
437
+ </span>
438
+ <button
439
+ v-if="progress.firstMissingRequiredKey"
440
+ type="button"
441
+ class="apf-prism-form__jump"
442
+ @click="scrollToField(progress.firstMissingRequiredKey)"
443
+ >
444
+ {{ isEn ? 'Next required ›' : '定位未填 ›' }}
445
+ </button>
446
+ </div>
447
+ <div class="apf-prism-form__bar">
448
+ <div class="apf-prism-form__bar-fill" :style="{ width: `${progress.percent}%` }" />
449
+ </div>
450
+ </div>
451
+
452
+ <div v-if="ready && isStepMode" class="apf-prism-form__steps" data-testid="prism-form-steps">
453
+ <button
454
+ v-for="(grp, idx) in groups"
455
+ :key="grp.key || idx"
456
+ type="button"
457
+ class="apf-prism-form__step-pill"
458
+ :class="{ 'is-active': safeStep === idx }"
459
+ @click="activeStep = idx"
460
+ >
461
+ {{ idx + 1 }}. {{ grp.title || (isEn ? `Step ${idx + 1}` : `第${idx + 1}步`) }}
462
+ </button>
463
+ </div>
464
+
465
+ <FormRender
466
+ v-if="ready && coreRef"
467
+ :groups="visibleGroups"
468
+ :fields="fields"
469
+ :form-core="coreRef"
470
+ :custom-controls="customControls"
471
+ :host-handlers="hostHandlers"
472
+ v-bind="modernShell"
473
+ >
474
+ <template #footer>
475
+ <div v-if="isStepMode" class="apf-prism-form__step-nav">
476
+ <button
477
+ type="button"
478
+ class="apf-prism-form__step-btn"
479
+ :disabled="safeStep <= 0"
480
+ @click="activeStep = Math.max(0, safeStep - 1)"
481
+ >
482
+ {{ isEn ? 'Previous' : '上一步' }}
483
+ </button>
484
+ <span class="apf-prism-form__step-count">{{ safeStep + 1 }} / {{ groups.length }}</span>
485
+ <button
486
+ type="button"
487
+ class="apf-prism-form__step-btn is-primary"
488
+ :disabled="safeStep >= groups.length - 1"
489
+ @click="activeStep = Math.min(groups.length - 1, safeStep + 1)"
490
+ >
491
+ {{ isEn ? 'Next' : '下一步' }}
492
+ </button>
493
+ </div>
494
+
495
+ <slot name="footer" :submit="handleSubmitClick" :validate="validate" :submitting="submitting">
496
+ <div v-if="showSubmit && !effectiveReadOnly" class="apf-prism-form__footer">
497
+ <button
498
+ type="button"
499
+ class="apf-prism-form__submit"
500
+ :disabled="submitting"
501
+ @click="handleSubmitClick"
502
+ >
503
+ {{ submitting ? (isEn ? 'Submitting…' : '提交中…') : effectiveSubmitText }}
504
+ </button>
505
+ </div>
506
+ </slot>
507
+ </template>
508
+ </FormRender>
509
+ </div>
510
+ </template>
511
+
512
+ <style scoped>
513
+ .apf-prism-form {
514
+ width: 100%;
515
+ margin: 0 auto;
516
+ background: var(--fs-page-bg, #f5f6fa);
517
+ box-sizing: border-box;
518
+ padding-bottom: 24px;
519
+ }
520
+ .apf-prism-form :deep(.form-render[data-shell='override']) {
521
+ background: transparent;
522
+ padding-top: 4px;
523
+ }
524
+ .apf-prism-form__header {
525
+ padding: 16px 16px 4px;
526
+ }
527
+ .apf-prism-form__title {
528
+ font-size: 18px;
529
+ font-weight: 600;
530
+ line-height: 26px;
531
+ color: var(--fs-text, #0f172a);
532
+ }
533
+ .apf-prism-form__desc {
534
+ margin-top: 4px;
535
+ font-size: 13px;
536
+ line-height: 20px;
537
+ color: var(--fs-text-sub, #475569);
538
+ }
539
+ .apf-prism-form__progress {
540
+ padding: 8px 16px 4px;
541
+ display: flex;
542
+ flex-direction: column;
543
+ gap: 6px;
544
+ }
545
+ .apf-prism-form__progress-row {
546
+ display: flex;
547
+ align-items: center;
548
+ justify-content: space-between;
549
+ font-size: 12px;
550
+ color: var(--fs-text-sub, #475569);
551
+ }
552
+ .apf-prism-form__jump {
553
+ border: 0;
554
+ border-radius: 999px;
555
+ padding: 2px 9px;
556
+ font-size: 11px;
557
+ font-weight: 600;
558
+ background: var(--fs-brand-soft, #eef4ff);
559
+ color: var(--fs-brand, #0f52ba);
560
+ cursor: pointer;
561
+ }
562
+ .apf-prism-form__bar {
563
+ height: 5px;
564
+ border-radius: 999px;
565
+ background: #e2e8f0;
566
+ overflow: hidden;
567
+ }
568
+ .apf-prism-form__bar-fill {
569
+ height: 100%;
570
+ background: var(--fs-brand, #0f52ba);
571
+ transition: width 0.2s ease;
572
+ }
573
+ .apf-prism-form__steps {
574
+ display: flex;
575
+ gap: 6px;
576
+ padding: 8px 16px 4px;
577
+ overflow-x: auto;
578
+ }
579
+ .apf-prism-form__step-pill {
580
+ border: 1px solid #e2e8f0;
581
+ background: #ffffff;
582
+ color: #475569;
583
+ border-radius: 999px;
584
+ padding: 4px 10px;
585
+ font-size: 12px;
586
+ white-space: nowrap;
587
+ cursor: pointer;
588
+ }
589
+ .apf-prism-form__step-pill.is-active {
590
+ border-color: var(--fs-brand, #0f52ba);
591
+ background: var(--fs-brand, #0f52ba);
592
+ color: #ffffff;
593
+ font-weight: 600;
594
+ }
595
+ .apf-prism-form__step-nav {
596
+ display: flex;
597
+ align-items: center;
598
+ justify-content: space-between;
599
+ padding: 4px 16px 10px;
600
+ }
601
+ .apf-prism-form__step-btn {
602
+ border: 1px solid #cbd5e1;
603
+ background: #ffffff;
604
+ color: #334155;
605
+ border-radius: 8px;
606
+ padding: 6px 14px;
607
+ font-size: 12px;
608
+ cursor: pointer;
609
+ }
610
+ .apf-prism-form__step-btn.is-primary {
611
+ border-color: var(--fs-brand, #0f52ba);
612
+ background: var(--fs-brand, #0f52ba);
613
+ color: #ffffff;
614
+ font-weight: 600;
615
+ }
616
+ .apf-prism-form__step-btn:disabled {
617
+ opacity: 0.45;
618
+ cursor: not-allowed;
619
+ }
620
+ .apf-prism-form__step-count {
621
+ font-size: 12px;
622
+ color: #64748b;
623
+ }
624
+ .apf-prism-form__footer {
625
+ padding: 12px 16px 0;
626
+ }
627
+ .apf-prism-form__submit {
628
+ width: 100%;
629
+ height: 44px;
630
+ border: 0;
631
+ border-radius: 10px;
632
+ background: var(--fs-brand, #0f52ba);
633
+ color: #ffffff;
634
+ font-size: 15px;
635
+ font-weight: 600;
636
+ cursor: pointer;
637
+ }
638
+ .apf-prism-form__submit:disabled {
639
+ opacity: 0.6;
640
+ cursor: not-allowed;
641
+ }
642
+ </style>
package/src/index.ts CHANGED
@@ -1,5 +1,8 @@
1
+ export { default as PrismForm } from './components/PrismForm.vue'
1
2
  export { default as FormRender } from './components/FormRender.vue'
2
3
  export { default as FormGroup } from './components/FormGroup.vue'
3
4
  export { default as FormItem } from './components/FormItem.vue'
4
5
  export { useFormRender } from './composables/useFormRender'
5
6
  export { setTaskHandlers } from './taskHandlers'
7
+ export { createFetchHostHandlers } from '@agentprismform/render'
8
+ export type { FetchHostHandlersOptions, UniversalHostHandlers } from '@agentprismform/render'