@airalogy/aimd-recorder 1.22.0 → 1.24.0
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 +80 -0
- package/README.zh-CN.md +80 -0
- package/dist/{AimdCodeField-BN_0UQMx.js → AimdCodeField-CPjcXY4D.js} +1 -1
- package/dist/{AimdDnaSequenceField-Bhj28fP8.js → AimdDnaSequenceField-Dz-IONoA.js} +5 -4
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-D7c01UqN.js → AimdEditor.vue_vue_type_style_index_0_lang-JAD--qFs.js} +1999 -1900
- package/dist/AimdEntityRefField-BE0s2o5T.js +229 -0
- package/dist/{AimdMarkdownField-GS15pv4z.js → AimdMarkdownField-BeD2t9JY.js} +5 -5
- package/dist/{AimdMarkdownNoteField-H9WP8tR6.js → AimdMarkdownNoteField-DIgGEYpj.js} +16 -16
- package/dist/{_commonjsHelpers-B5RozER-.js → _commonjsHelpers-ByX85dGu.js} +12 -19
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/aimd-recorder.css +1 -1
- package/dist/{arc-B50G9-kH.js → arc-CLJJdrm0.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-D9mBEbpY.js → architectureDiagram-3BPJPVTR-BizrFPnS.js} +3 -3
- package/dist/{blockDiagram-GPEHLZMM-Cs4swgto.js → blockDiagram-GPEHLZMM-IHDih8JW.js} +4 -4
- package/dist/{c4Diagram-AAUBKEIU-C12HKS3r.js → c4Diagram-AAUBKEIU-BQtg8m_M.js} +2 -2
- package/dist/{channel-D69VnjVz.js → channel-D8q7AX1Z.js} +1 -1
- package/dist/{chunk-2J33WTMH-oc-89G5c.js → chunk-2J33WTMH-C24lbKon.js} +1 -1
- package/dist/{chunk-4BX2VUAB-BDJS9G3r.js → chunk-4BX2VUAB-1m_lB_xe.js} +1 -1
- package/dist/{chunk-55IACEB6-BPl3uHcA.js → chunk-55IACEB6-BE5Nj-sd.js} +1 -1
- package/dist/{chunk-727SXJPM-pWe-vDGf.js → chunk-727SXJPM-Cg-Xw_d_.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-D-R5sIr1.js → chunk-AQP2D5EJ-BvRpPCiY.js} +3 -3
- package/dist/{chunk-FMBD7UC4-bo6Qyom1.js → chunk-FMBD7UC4-D_44MTsg.js} +1 -1
- package/dist/{chunk-ND2GUHAM-DQMvtYV7.js → chunk-ND2GUHAM-tVBIo4LA.js} +1 -1
- package/dist/{chunk-QZHKN3VN-DlCn3HON.js → chunk-QZHKN3VN-B91HYLks.js} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-DzUwWFwr.js → classDiagram-4FO5ZUOK-CkejvTAN.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-DzUwWFwr.js → classDiagram-v2-Q7XG4LA2-CkejvTAN.js} +2 -2
- package/dist/components.js +3869 -3359
- package/dist/composables.js +98 -93
- package/dist/{cose-bilkent-S5V4N54A-BXLMzfpO.js → cose-bilkent-S5V4N54A-CNcuriOF.js} +2 -2
- package/dist/{dagre-BM42HDAG-DHnofIh9.js → dagre-BM42HDAG-DMqFGafq.js} +3 -3
- package/dist/{diagram-2AECGRRQ-BqTTVPsm.js → diagram-2AECGRRQ-Cksd3pP3.js} +2 -2
- package/dist/{diagram-5GNKFQAL-D5p1UVbw.js → diagram-5GNKFQAL-SVjLnDJG.js} +3 -3
- package/dist/{diagram-KO2AKTUF-Uuoz9cFn.js → diagram-KO2AKTUF-DfNIAG6w.js} +2 -2
- package/dist/{diagram-LMA3HP47-W001U31X.js → diagram-LMA3HP47-DPOyCMGB.js} +2 -2
- package/dist/{diagram-OG6HWLK6-DL516LDr.js → diagram-OG6HWLK6-BDURmT37.js} +3 -3
- package/dist/{erDiagram-TEJ5UH35-CCxgMb67.js → erDiagram-TEJ5UH35-N991qII9.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-nXGdmC0O.js → flowDiagram-I6XJVG4X-BABRFuk-.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-Bi9Ro7_Z.js → ganttDiagram-6RSMTGT7-BMDnK96S.js} +3 -3
- package/dist/{gitGraphDiagram-PVQCEYII-w1kNAy4E.js → gitGraphDiagram-PVQCEYII-cEvL7Dss.js} +3 -3
- package/dist/{graph-CpOkL_eZ.js → graph-BA09aCvZ.js} +1 -1
- package/dist/index.js +125 -113
- package/dist/{infoDiagram-5YYISTIA-Bde_w9T1.js → infoDiagram-5YYISTIA-DpC1Zthd.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-x5M1KR0l.js → ishikawaDiagram-YF4QCWOH-CMEt_f-x.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-CIDQP8Zm.js → journeyDiagram-JHISSGLW-C0Qw169C.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-CKgO7sG8.js → kanban-definition-UN3LZRKU-caROmSUy.js} +2 -2
- package/dist/{layout-BZYprqYR.js → layout-CH65__O4.js} +2 -2
- package/dist/{linear-ClSH2F_v.js → linear-B1VXpcsy.js} +1 -1
- package/dist/{mermaid.core-CcRV6K2R.js → mermaid.core-Cbmwvfvk.js} +35 -35
- package/dist/{mindmap-definition-RKZ34NQL-s3h6uszV.js → mindmap-definition-RKZ34NQL-DpTR5ilS.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-CgiazyWv.js → pieDiagram-4H26LBE5-Cb_KrmWC.js} +3 -3
- package/dist/{quadrantDiagram-W4KKPZXB-DCPVgHoW.js → quadrantDiagram-W4KKPZXB-B5_NswmK.js} +2 -2
- package/dist/record.js +77 -72
- package/dist/{requirementDiagram-4Y6WPE33-DE6F9oSB.js → requirementDiagram-4Y6WPE33-OFwfat5D.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-DZZoFFr-.js → sankeyDiagram-5OEKKPKP-BaawdZEE.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-DaYEOl60.js → sequenceDiagram-3UESZ5HK-DLv8X8ef.js} +3 -3
- package/dist/{stateDiagram-AJRCARHV-BmgpHJlH.js → stateDiagram-AJRCARHV-B6F3wrsd.js} +4 -4
- package/dist/{stateDiagram-v2-BHNVJYJU-D49CHQD6.js → stateDiagram-v2-BHNVJYJU-BcNEoshv.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-DdVLoCkC.js → timeline-definition-PNZ67QCA-CvdHJ4eQ.js} +2 -2
- package/dist/useCodeBlockRendering-D2viVPtA.js +3158 -0
- package/dist/useFieldRendering-Co4DOOvL.js +1120 -0
- package/dist/useVarHelpers-Du2obGza.js +3474 -0
- package/dist/validation-oyqyD7Jp.js +5601 -0
- package/dist/{vennDiagram-CIIHVFJN-CCcMKcd7.js → vennDiagram-CIIHVFJN-U0GlQDjX.js} +1 -1
- package/dist/{wardleyDiagram-YWT4CUSO-R4UGgGWY.js → wardleyDiagram-YWT4CUSO-CzF_KMcn.js} +2 -2
- package/dist/{xychartDiagram-2RQKCTM6-DyFhCubk.js → xychartDiagram-2RQKCTM6-Cljki2Vk.js} +2 -2
- package/package.json +6 -4
- package/src/__tests__/collector-field.test.ts +269 -0
- package/src/__tests__/record-search-render.test.ts +1 -0
- package/src/__tests__/record-validation.test.ts +378 -0
- package/src/__tests__/recorder-wysiwyg-field-host.test.ts +26 -0
- package/src/__tests__/var-field-render.test.ts +64 -2
- package/src/components/AimdCollectorField.vue +233 -0
- package/src/components/AimdEntityRefField.vue +314 -0
- package/src/components/AimdRecorder.vue +285 -7
- package/src/components/AimdRecorderEditor.vue +51 -1
- package/src/components/AimdRecorderWysiwygFieldHost.vue +10 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +166 -4
- package/src/components/AimdVarField.vue +39 -2
- package/src/components/AimdVarTableField.vue +38 -21
- package/src/components/index.ts +4 -0
- package/src/components/recorderMilkdownPlugin.ts +16 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +32 -0
- package/src/composables/index.ts +12 -0
- package/src/composables/useCollectors.ts +399 -0
- package/src/composables/useVarHelpers.ts +130 -2
- package/src/index.ts +32 -2
- package/src/locales.ts +140 -2
- package/src/record/index.ts +14 -0
- package/src/record/validation.ts +772 -0
- package/src/styles/collector-field.css +281 -0
- package/src/styles/recorder-surface.css +163 -0
- package/src/styles/recorder.css +33 -0
- package/src/types.ts +168 -1
- package/dist/index-Dkrf2LJl.js +0 -1308
- package/dist/useCodeBlockRendering-CCuoP52e.js +0 -6103
|
@@ -3,6 +3,7 @@ import { computed, defineComponent, h, nextTick, onBeforeUnmount, reactive, ref,
|
|
|
3
3
|
import type {
|
|
4
4
|
AimdCheckNode,
|
|
5
5
|
AimdClientAssignerField,
|
|
6
|
+
AimdCollectorValidationContext,
|
|
6
7
|
AimdQuizField,
|
|
7
8
|
AimdQuizGradeResult,
|
|
8
9
|
AimdQuizNode,
|
|
@@ -21,25 +22,36 @@ import {
|
|
|
21
22
|
} from "../locales"
|
|
22
23
|
import type {
|
|
23
24
|
AimdChoiceOptionExplanationMode,
|
|
25
|
+
AimdCollectorPermissionHandler,
|
|
26
|
+
AimdCollectorProviderMap,
|
|
24
27
|
AimdAssignerMap,
|
|
25
28
|
AimdAssignerRunner,
|
|
26
29
|
AimdServerAssignerMap,
|
|
27
30
|
AimdServerAssignerRunner,
|
|
31
|
+
AimdEntityResolverMap,
|
|
28
32
|
AimdFileInfoResolver,
|
|
29
33
|
AimdFileUploadHandler,
|
|
30
34
|
AimdFieldMeta,
|
|
31
35
|
AimdFieldState,
|
|
32
36
|
AimdRecorderFieldAdapters,
|
|
33
37
|
AimdRecorderFieldType,
|
|
38
|
+
AimdRecordValidationSchema,
|
|
34
39
|
AimdScaleGradeDisplayMode,
|
|
35
40
|
AimdTypePlugin,
|
|
36
41
|
AimdProtocolRecordData,
|
|
42
|
+
AimdRecorderValidationResult,
|
|
43
|
+
AimdRecorderValidationTrigger,
|
|
37
44
|
AimdStepDetailDisplay,
|
|
38
45
|
AimdStepRecordItem,
|
|
39
46
|
FieldEventPayload,
|
|
40
47
|
TableEventPayload,
|
|
41
48
|
} from "../types"
|
|
42
49
|
import { createEmptyProtocolRecordData } from "../types"
|
|
50
|
+
import {
|
|
51
|
+
getAimdVarTableCellFieldKey,
|
|
52
|
+
matchesAimdValidationFieldSelector,
|
|
53
|
+
validateAimdRecord,
|
|
54
|
+
} from "../record/validation"
|
|
43
55
|
import {
|
|
44
56
|
applyIncomingRecord,
|
|
45
57
|
applyPastedVarTableGrid,
|
|
@@ -77,6 +89,7 @@ import { useVarTableDragDrop, getVarTableColumns } from "../composables/useVarTa
|
|
|
77
89
|
import { useFieldRendering } from "../composables/useFieldRendering"
|
|
78
90
|
import { useCodeBlockRendering } from "../composables/useCodeBlockRendering"
|
|
79
91
|
import { useRecordSearch } from "../composables/useRecordSearch"
|
|
92
|
+
import { useCollectors } from "../composables/useCollectors"
|
|
80
93
|
import {
|
|
81
94
|
createEmptyCheckRecordItem,
|
|
82
95
|
createEmptyStepRecordItem,
|
|
@@ -91,6 +104,7 @@ import {
|
|
|
91
104
|
} from "../composables/useStepTimers"
|
|
92
105
|
import { createAimdTypePlugins } from "../type-plugins"
|
|
93
106
|
import AimdVarField from "./AimdVarField.vue"
|
|
107
|
+
import AimdCollectorField from "./AimdCollectorField.vue"
|
|
94
108
|
import AimdVarTableField from "./AimdVarTableField.vue"
|
|
95
109
|
import AimdRecorderSearchToolbar from "./AimdRecorderSearchToolbar.vue"
|
|
96
110
|
import { AimdStepField, AimdCheckField } from "./AimdStepCheckField.vue"
|
|
@@ -105,6 +119,8 @@ import AimdAssignerCloudStatusIcon from "./icons/AimdAssignerCloudStatusIcon.vue
|
|
|
105
119
|
const props = withDefaults(defineProps<{
|
|
106
120
|
/** AIMD markdown content to render */
|
|
107
121
|
content: string
|
|
122
|
+
/** Metadata-only protocol context used by embedded single-field recorder hosts. */
|
|
123
|
+
protocolContext?: string
|
|
108
124
|
/** Current record data (v-model) */
|
|
109
125
|
modelValue?: Partial<AimdProtocolRecordData>
|
|
110
126
|
/** When true all inputs are read-only */
|
|
@@ -148,6 +164,12 @@ const props = withDefaults(defineProps<{
|
|
|
148
164
|
*/
|
|
149
165
|
fieldState?: Record<string, AimdFieldState>
|
|
150
166
|
|
|
167
|
+
/** Pydantic-compatible JSON Schema returned by protocol parsing. */
|
|
168
|
+
validationSchema?: AimdRecordValidationSchema
|
|
169
|
+
|
|
170
|
+
/** Field events that trigger local validation. Explicit validate() calls always run. */
|
|
171
|
+
validationTriggers?: AimdRecorderValidationTrigger[]
|
|
172
|
+
|
|
151
173
|
/**
|
|
152
174
|
* Optional wrapper applied to every rendered field VNode.
|
|
153
175
|
* Receives (fieldKey, fieldType, defaultVNode) and should return a VNode.
|
|
@@ -167,6 +189,21 @@ const props = withDefaults(defineProps<{
|
|
|
167
189
|
*/
|
|
168
190
|
fieldAdapters?: AimdRecorderFieldAdapters
|
|
169
191
|
|
|
192
|
+
/**
|
|
193
|
+
* EntityRef resolver map keyed by connector id/source or entity namespace.
|
|
194
|
+
* Used by built-in EntityRef fields to search/select related records.
|
|
195
|
+
*/
|
|
196
|
+
entityResolvers?: AimdEntityResolverMap
|
|
197
|
+
|
|
198
|
+
/** Data-source providers keyed by connector id for Collector-backed vars. */
|
|
199
|
+
collectorProviders?: AimdCollectorProviderMap
|
|
200
|
+
/** Optional host authorization hook invoked before a Collector starts. */
|
|
201
|
+
requestCollectorPermission?: AimdCollectorPermissionHandler
|
|
202
|
+
/** Stable actor id recorded when a manual Collector fallback is used. */
|
|
203
|
+
collectorActorId?: string
|
|
204
|
+
/** Stable record key used to scope remembered Collector authorization. */
|
|
205
|
+
collectorRecordKey?: string | number
|
|
206
|
+
|
|
170
207
|
/**
|
|
171
208
|
* Resolves relative paths / Airalogy file IDs to displayable URLs.
|
|
172
209
|
*/
|
|
@@ -194,6 +231,7 @@ const props = withDefaults(defineProps<{
|
|
|
194
231
|
typePlugins?: AimdTypePlugin[]
|
|
195
232
|
}>(), {
|
|
196
233
|
modelValue: undefined,
|
|
234
|
+
protocolContext: undefined,
|
|
197
235
|
readonly: false,
|
|
198
236
|
currentUserName: undefined,
|
|
199
237
|
now: undefined,
|
|
@@ -210,9 +248,16 @@ const props = withDefaults(defineProps<{
|
|
|
210
248
|
serverAssigners: undefined,
|
|
211
249
|
assigners: undefined,
|
|
212
250
|
fieldState: undefined,
|
|
251
|
+
validationSchema: undefined,
|
|
252
|
+
validationTriggers: () => ["change", "blur"],
|
|
213
253
|
wrapField: undefined,
|
|
214
254
|
customRenderers: undefined,
|
|
215
255
|
fieldAdapters: undefined,
|
|
256
|
+
entityResolvers: undefined,
|
|
257
|
+
collectorProviders: undefined,
|
|
258
|
+
requestCollectorPermission: undefined,
|
|
259
|
+
collectorActorId: undefined,
|
|
260
|
+
collectorRecordKey: undefined,
|
|
216
261
|
resolveFile: undefined,
|
|
217
262
|
resolveFileInfo: undefined,
|
|
218
263
|
uploadFile: undefined,
|
|
@@ -228,6 +273,8 @@ const emit = defineEmits<{
|
|
|
228
273
|
(e: "fields-change", fields: ExtractedAimdFields): void
|
|
229
274
|
/** Parse / render error */
|
|
230
275
|
(e: "error", message: string): void
|
|
276
|
+
/** Local record validation completed. */
|
|
277
|
+
(e: "validation", result: AimdRecorderValidationResult): void
|
|
231
278
|
|
|
232
279
|
// ── Granular field events ─────────────────────────────────────────────────
|
|
233
280
|
/** A single field value changed */
|
|
@@ -256,10 +303,12 @@ const inlineNodes = ref<VNode[]>([])
|
|
|
256
303
|
const renderError = ref("")
|
|
257
304
|
const contentRoot = ref<HTMLElement | null>(null)
|
|
258
305
|
const localRecord = reactive<AimdProtocolRecordData>(createEmptyProtocolRecordData())
|
|
306
|
+
const internalValidationFieldState = ref<Record<string, AimdFieldState>>({})
|
|
259
307
|
let buildRequestId = 0
|
|
260
308
|
let inlineBuildRequestId = 0
|
|
261
309
|
let syncingFromExternal = false
|
|
262
310
|
let renderScheduled = false
|
|
311
|
+
let inlineRebuildSettled: Promise<void> = Promise.resolve()
|
|
263
312
|
let recordInitializedDuringRender = false
|
|
264
313
|
let pendingFocusSnapshot: FocusSnapshot | null = null
|
|
265
314
|
let pendingInlineBuildRequestId: number | null = null
|
|
@@ -297,7 +346,18 @@ function applyFieldAdapter<TFieldType extends "var" | "var_table" | "step" | "ch
|
|
|
297
346
|
value: unknown,
|
|
298
347
|
defaultVNode: VNode,
|
|
299
348
|
): VNode {
|
|
300
|
-
|
|
349
|
+
const validationError = effectiveFieldState.value[fieldKey]?.validationError
|
|
350
|
+
const fieldVNode = h(fieldType === "var" ? "span" : "div", {
|
|
351
|
+
"class": ["aimd-rec-field-host", validationError ? "aimd-rec-field-host--invalid" : undefined],
|
|
352
|
+
"data-aimd-recorder-field": fieldKey,
|
|
353
|
+
}, [
|
|
354
|
+
defaultVNode,
|
|
355
|
+
validationError
|
|
356
|
+
? h("span", { class: "aimd-rec-validation-message", role: "alert" }, validationError)
|
|
357
|
+
: null,
|
|
358
|
+
])
|
|
359
|
+
|
|
360
|
+
return resolveAimdRecorderFieldVNode(fieldType, fieldKey, node, value, fieldVNode, {
|
|
301
361
|
fieldAdapters: props.fieldAdapters,
|
|
302
362
|
wrapField: props.wrapField,
|
|
303
363
|
readonly: props.readonly,
|
|
@@ -497,6 +557,8 @@ const EMPTY_FIELDS: ExtractedAimdFields = {
|
|
|
497
557
|
var_definitions: [],
|
|
498
558
|
var_table: [],
|
|
499
559
|
client_assigner: [],
|
|
560
|
+
connectors: [],
|
|
561
|
+
collectors: [],
|
|
500
562
|
quiz: [],
|
|
501
563
|
step: [],
|
|
502
564
|
check: [],
|
|
@@ -508,6 +570,7 @@ const EMPTY_FIELDS: ExtractedAimdFields = {
|
|
|
508
570
|
}
|
|
509
571
|
|
|
510
572
|
const extractedFields = ref<ExtractedAimdFields>(EMPTY_FIELDS)
|
|
573
|
+
const collectorValidationContext = ref<AimdCollectorValidationContext>()
|
|
511
574
|
const clientAssigners = ref<AimdClientAssignerField[]>([])
|
|
512
575
|
const internalAssignerFieldState = ref<Record<string, AimdFieldState>>({})
|
|
513
576
|
const clientAssignerFieldDefinitions = computed<ClientAssignerFieldDefinitions>(() => {
|
|
@@ -600,18 +663,22 @@ const effectiveFieldMeta = computed<Record<string, AimdFieldMeta>>(() => {
|
|
|
600
663
|
const effectiveFieldState = computed<Record<string, AimdFieldState>>(() => {
|
|
601
664
|
const keys = new Set([
|
|
602
665
|
...Object.keys(internalAssignerFieldState.value),
|
|
666
|
+
...Object.keys(internalValidationFieldState.value),
|
|
603
667
|
...Object.keys(props.fieldState ?? {}),
|
|
604
668
|
])
|
|
605
669
|
const next: Record<string, AimdFieldState> = {}
|
|
606
670
|
|
|
607
671
|
for (const key of keys) {
|
|
608
672
|
const internalState = internalAssignerFieldState.value[key]
|
|
673
|
+
const validationState = internalValidationFieldState.value[key]
|
|
609
674
|
const externalState = props.fieldState?.[key]
|
|
610
675
|
next[key] = {
|
|
611
676
|
...internalState,
|
|
677
|
+
...validationState,
|
|
612
678
|
...externalState,
|
|
613
679
|
loading: externalState?.loading ?? internalState?.loading,
|
|
614
680
|
error: externalState?.error ?? internalState?.error,
|
|
681
|
+
validationError: externalState?.validationError ?? validationState?.validationError,
|
|
615
682
|
}
|
|
616
683
|
}
|
|
617
684
|
|
|
@@ -669,18 +736,124 @@ function scheduleInlineRebuild() {
|
|
|
669
736
|
return
|
|
670
737
|
}
|
|
671
738
|
renderScheduled = true
|
|
672
|
-
Promise.resolve().then(() => {
|
|
739
|
+
inlineRebuildSettled = Promise.resolve().then(async () => {
|
|
673
740
|
renderScheduled = false
|
|
674
741
|
const focusSnapshot = pendingFocusSnapshot
|
|
675
742
|
const inlineRequestId = pendingInlineBuildRequestId ?? inlineBuildRequestId
|
|
676
743
|
pendingFocusSnapshot = null
|
|
677
744
|
pendingInlineBuildRequestId = null
|
|
678
|
-
|
|
745
|
+
await rebuildInlineNodes(undefined, focusSnapshot, inlineRequestId)
|
|
679
746
|
})
|
|
680
747
|
}
|
|
681
748
|
|
|
682
749
|
const { preRenderer: codeBlockPreRenderer } = useCodeBlockRendering(scheduleInlineRebuild)
|
|
683
750
|
|
|
751
|
+
function validationFieldStatesEqual(
|
|
752
|
+
left: Record<string, AimdFieldState>,
|
|
753
|
+
right: Record<string, AimdFieldState>,
|
|
754
|
+
): boolean {
|
|
755
|
+
const leftKeys = Object.keys(left)
|
|
756
|
+
const rightKeys = Object.keys(right)
|
|
757
|
+
return leftKeys.length === rightKeys.length
|
|
758
|
+
&& leftKeys.every(key => left[key]?.validationError === right[key]?.validationError)
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function applyValidationResult(
|
|
762
|
+
result: AimdRecorderValidationResult,
|
|
763
|
+
fieldKeys = result.validatedFieldKeys,
|
|
764
|
+
) {
|
|
765
|
+
const next = fieldKeys?.length ? { ...internalValidationFieldState.value } : {}
|
|
766
|
+
if (fieldKeys?.length) {
|
|
767
|
+
for (const existingKey of Object.keys(next)) {
|
|
768
|
+
if (fieldKeys.some(selector => matchesAimdValidationFieldSelector(existingKey, selector))) {
|
|
769
|
+
delete next[existingKey]
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
Object.assign(next, result.fieldState)
|
|
774
|
+
if (validationFieldStatesEqual(next, internalValidationFieldState.value)) return
|
|
775
|
+
internalValidationFieldState.value = next
|
|
776
|
+
scheduleInlineRebuild()
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function clearValidation(fieldKey?: string) {
|
|
780
|
+
if (Object.keys(internalValidationFieldState.value).length === 0) return
|
|
781
|
+
if (!fieldKey) {
|
|
782
|
+
internalValidationFieldState.value = {}
|
|
783
|
+
scheduleInlineRebuild()
|
|
784
|
+
return
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
const next = { ...internalValidationFieldState.value }
|
|
788
|
+
for (const existingKey of Object.keys(next)) {
|
|
789
|
+
if (matchesAimdValidationFieldSelector(existingKey, fieldKey)) delete next[existingKey]
|
|
790
|
+
}
|
|
791
|
+
if (validationFieldStatesEqual(next, internalValidationFieldState.value)) return
|
|
792
|
+
internalValidationFieldState.value = next
|
|
793
|
+
scheduleInlineRebuild()
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
function focusInvalidField(fieldKey: string): boolean {
|
|
797
|
+
const exactControl = Array.from(contentRoot.value?.querySelectorAll<HTMLElement>("[data-rec-focus-key]") ?? [])
|
|
798
|
+
.find(candidate => candidate.dataset.recFocusKey === fieldKey)
|
|
799
|
+
if (exactControl) {
|
|
800
|
+
exactControl.scrollIntoView({ behavior: "smooth", block: "center" })
|
|
801
|
+
exactControl.focus({ preventScroll: true })
|
|
802
|
+
return true
|
|
803
|
+
}
|
|
804
|
+
const element = Array.from(contentRoot.value?.querySelectorAll<HTMLElement>("[data-aimd-recorder-field]") ?? [])
|
|
805
|
+
.find(candidate => candidate.dataset.aimdRecorderField === fieldKey)
|
|
806
|
+
if (!element) return false
|
|
807
|
+
element.scrollIntoView({ behavior: "smooth", block: "center" })
|
|
808
|
+
element.querySelector<HTMLElement>("input, textarea, select, button, [tabindex]")?.focus({ preventScroll: true })
|
|
809
|
+
return true
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function focusFirstInvalidField(): boolean {
|
|
813
|
+
const fieldKey = Object.keys(internalValidationFieldState.value)[0]
|
|
814
|
+
return fieldKey ? focusInvalidField(fieldKey) : false
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
async function validate(options: { focus?: boolean } = {}): Promise<AimdRecorderValidationResult> {
|
|
818
|
+
const result = validateAimdRecord(extractedFields.value, localRecord, {
|
|
819
|
+
fieldMeta: effectiveFieldMeta.value,
|
|
820
|
+
schema: props.validationSchema,
|
|
821
|
+
messages: resolvedMessages.value.validation,
|
|
822
|
+
})
|
|
823
|
+
applyValidationResult(result)
|
|
824
|
+
emit("validation", result)
|
|
825
|
+
if (!result.valid && options.focus !== false) {
|
|
826
|
+
await inlineRebuildSettled
|
|
827
|
+
focusFirstInvalidField()
|
|
828
|
+
}
|
|
829
|
+
return result
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
async function validateField(
|
|
833
|
+
fieldKey: string,
|
|
834
|
+
options: { focus?: boolean; trigger?: AimdRecorderValidationTrigger } = {},
|
|
835
|
+
): Promise<AimdRecorderValidationResult> {
|
|
836
|
+
const result = validateAimdRecord(extractedFields.value, localRecord, {
|
|
837
|
+
fieldMeta: effectiveFieldMeta.value,
|
|
838
|
+
schema: props.validationSchema,
|
|
839
|
+
fieldKeys: [fieldKey],
|
|
840
|
+
messages: resolvedMessages.value.validation,
|
|
841
|
+
})
|
|
842
|
+
applyValidationResult(result, [fieldKey])
|
|
843
|
+
emit("validation", result)
|
|
844
|
+
if (!result.valid && options.focus === true) {
|
|
845
|
+
await inlineRebuildSettled
|
|
846
|
+
const invalidKey = Object.keys(result.fieldState)[0]
|
|
847
|
+
if (invalidKey) focusInvalidField(invalidKey)
|
|
848
|
+
}
|
|
849
|
+
return result
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function triggerFieldValidation(trigger: Exclude<AimdRecorderValidationTrigger, "submit">, fieldKey: string) {
|
|
853
|
+
if (!props.validationTriggers.includes(trigger)) return
|
|
854
|
+
void validateField(fieldKey, { trigger })
|
|
855
|
+
}
|
|
856
|
+
|
|
684
857
|
function markRecordChanged(options?: { rebuild?: boolean, runClientAssigners?: boolean }) {
|
|
685
858
|
const assignerChanged = options?.runClientAssigners ? clientAssignerRunner.applyCurrentClientAssigners() : false
|
|
686
859
|
emitRecordUpdate()
|
|
@@ -989,6 +1162,19 @@ const fieldRendering = useFieldRendering({
|
|
|
989
1162
|
wrapField: () => props.wrapField,
|
|
990
1163
|
})
|
|
991
1164
|
|
|
1165
|
+
const collectorRuntime = useCollectors({
|
|
1166
|
+
fields: () => extractedFields.value,
|
|
1167
|
+
record: localRecord,
|
|
1168
|
+
providers: () => props.collectorProviders,
|
|
1169
|
+
requestPermission: () => props.requestCollectorPermission,
|
|
1170
|
+
actorId: () => props.collectorActorId,
|
|
1171
|
+
onChange: (fieldId, value) => {
|
|
1172
|
+
localRecord.var[fieldId] = value
|
|
1173
|
+
markRecordChanged({ rebuild: true, runClientAssigners: true })
|
|
1174
|
+
emit("field-change", { section: "var", fieldKey: fieldId, value })
|
|
1175
|
+
},
|
|
1176
|
+
})
|
|
1177
|
+
|
|
992
1178
|
// ---------------------------------------------------------------------------
|
|
993
1179
|
// Inline field renderers
|
|
994
1180
|
// ---------------------------------------------------------------------------
|
|
@@ -1030,10 +1216,12 @@ function renderInlineVar(node: AimdVarNode): VNode {
|
|
|
1030
1216
|
localRecord.var[id] = value
|
|
1031
1217
|
markRecordChanged({ rebuild: inputKind === "file", runClientAssigners: true })
|
|
1032
1218
|
emit("field-change", { section: "var", fieldKey: id, value })
|
|
1219
|
+
triggerFieldValidation("change", fieldKey)
|
|
1033
1220
|
}
|
|
1034
1221
|
|
|
1035
1222
|
function emitVarBlur() {
|
|
1036
1223
|
emit("field-blur", { section: "var", fieldKey: id })
|
|
1224
|
+
triggerFieldValidation("blur", fieldKey)
|
|
1037
1225
|
}
|
|
1038
1226
|
|
|
1039
1227
|
// 2. Initialise value
|
|
@@ -1045,6 +1233,31 @@ function renderInlineVar(node: AimdVarNode): VNode {
|
|
|
1045
1233
|
}
|
|
1046
1234
|
recordInitializedDuringRender = true
|
|
1047
1235
|
}
|
|
1236
|
+
const collectorBinding = collectorRuntime.resolveBinding(id)
|
|
1237
|
+
if (collectorBinding) {
|
|
1238
|
+
const disabled = fieldRendering.isFieldDisabled(fieldKey)
|
|
1239
|
+
const vnode = h(AimdCollectorField, {
|
|
1240
|
+
node,
|
|
1241
|
+
binding: collectorBinding,
|
|
1242
|
+
value: localRecord.var[id],
|
|
1243
|
+
state: collectorRuntime.getState(id),
|
|
1244
|
+
disabled,
|
|
1245
|
+
providerAvailable: collectorRuntime.hasProvider(id),
|
|
1246
|
+
messages: resolvedMessages.value,
|
|
1247
|
+
fieldMeta: meta,
|
|
1248
|
+
extraClasses: [
|
|
1249
|
+
...fieldRendering.fieldStateClasses(fieldKey),
|
|
1250
|
+
...recordSearch.getFieldClasses(fieldKey),
|
|
1251
|
+
],
|
|
1252
|
+
onStart: () => { void collectorRuntime.start(id) },
|
|
1253
|
+
onStop: () => collectorRuntime.stop(id),
|
|
1254
|
+
onManual: (payload: { value: unknown; reason: string }) => {
|
|
1255
|
+
collectorRuntime.writeManual(id, payload.value, payload.reason)
|
|
1256
|
+
},
|
|
1257
|
+
onBlur: emitVarBlur,
|
|
1258
|
+
})
|
|
1259
|
+
return applyFieldAdapter("var", fieldKey, node, localRecord.var[id], vnode)
|
|
1260
|
+
}
|
|
1048
1261
|
if (inputKind === "datetime") {
|
|
1049
1262
|
const norm = normalizeDateTimeValueWithTimezone(localRecord.var[id])
|
|
1050
1263
|
if (norm !== localRecord.var[id]) {
|
|
@@ -1078,7 +1291,7 @@ function renderInlineVar(node: AimdVarNode): VNode {
|
|
|
1078
1291
|
...recordSearch.getFieldClasses(fieldKey),
|
|
1079
1292
|
]
|
|
1080
1293
|
const canUseInternalAssignerControl = Boolean(meta?.enumOptions?.length)
|
|
1081
|
-
|| ["number", "date", "datetime", "time", "text", "textarea", "scalar-list", "checkbox", "boolean-select", "file", "code"].includes(inputKind)
|
|
1294
|
+
|| ["number", "date", "datetime", "time", "text", "textarea", "scalar-list", "entity-ref", "checkbox", "boolean-select", "file", "code"].includes(inputKind)
|
|
1082
1295
|
const fieldAssignerControl = resolveAssignerControl("var", fieldKey)
|
|
1083
1296
|
const internalAssignerControl = canUseInternalAssignerControl ? fieldAssignerControl : null
|
|
1084
1297
|
|
|
@@ -1114,6 +1327,7 @@ function renderInlineVar(node: AimdVarNode): VNode {
|
|
|
1114
1327
|
uploadFile: props.uploadFile,
|
|
1115
1328
|
resolveFile: props.resolveFile,
|
|
1116
1329
|
resolveFileInfo: props.resolveFileInfo,
|
|
1330
|
+
entityResolvers: props.entityResolvers,
|
|
1117
1331
|
emitChange: emitVarChange,
|
|
1118
1332
|
emitBlur: emitVarBlur,
|
|
1119
1333
|
})
|
|
@@ -1147,6 +1361,8 @@ function renderInlineVar(node: AimdVarNode): VNode {
|
|
|
1147
1361
|
uploadFile: props.uploadFile,
|
|
1148
1362
|
resolveFile: props.resolveFile,
|
|
1149
1363
|
resolveFileInfo: props.resolveFileInfo,
|
|
1364
|
+
entityResolvers: props.entityResolvers,
|
|
1365
|
+
record: localRecord,
|
|
1150
1366
|
onChange: (payload: { id: string, value: unknown, type: string, inputKind: string }) => {
|
|
1151
1367
|
emitVarChange(payload.value)
|
|
1152
1368
|
},
|
|
@@ -1193,11 +1409,15 @@ function renderInlineVarTable(node: AimdVarTableNode): VNode {
|
|
|
1193
1409
|
onCellInput: (payload: { tableName: string, column: string, rowIndex: number, value: string, row: Record<string, string> }) => {
|
|
1194
1410
|
payload.row[payload.column] = payload.value
|
|
1195
1411
|
markRecordChanged({ runClientAssigners: true })
|
|
1412
|
+
const validationFieldKey = getAimdVarTableCellFieldKey(payload.tableName, payload.rowIndex, payload.column)
|
|
1196
1413
|
emit("field-change", {
|
|
1197
1414
|
section: "var_table",
|
|
1198
1415
|
fieldKey: `${payload.tableName}:${payload.column}`,
|
|
1199
1416
|
value: payload.value,
|
|
1417
|
+
rowIndex: payload.rowIndex,
|
|
1418
|
+
column: payload.column,
|
|
1200
1419
|
})
|
|
1420
|
+
triggerFieldValidation("change", validationFieldKey)
|
|
1201
1421
|
},
|
|
1202
1422
|
onCellPaste: (payload: { tableName: string, column: string, rowIndex: number, text: string }) => {
|
|
1203
1423
|
const startColumnIndex = columns.indexOf(payload.column)
|
|
@@ -1226,21 +1446,33 @@ function renderInlineVarTable(node: AimdVarTableNode): VNode {
|
|
|
1226
1446
|
emit("table-add-row", { tableName: payload.tableName, columns })
|
|
1227
1447
|
}
|
|
1228
1448
|
for (const cell of result.changedCells) {
|
|
1449
|
+
const validationFieldKey = getAimdVarTableCellFieldKey(payload.tableName, cell.rowIndex, cell.column)
|
|
1229
1450
|
emit("field-change", {
|
|
1230
1451
|
section: "var_table",
|
|
1231
1452
|
fieldKey: `${payload.tableName}:${cell.column}`,
|
|
1232
1453
|
value: cell.value,
|
|
1454
|
+
rowIndex: cell.rowIndex,
|
|
1455
|
+
column: cell.column,
|
|
1233
1456
|
})
|
|
1457
|
+
triggerFieldValidation("change", validationFieldKey)
|
|
1234
1458
|
}
|
|
1235
1459
|
},
|
|
1236
|
-
onCellBlur: (payload: { tableName: string, column: string }) => {
|
|
1237
|
-
emit("field-blur", {
|
|
1460
|
+
onCellBlur: (payload: { tableName: string, column: string, rowIndex: number }) => {
|
|
1461
|
+
emit("field-blur", {
|
|
1462
|
+
section: "var_table",
|
|
1463
|
+
fieldKey: `${payload.tableName}:${payload.column}`,
|
|
1464
|
+
rowIndex: payload.rowIndex,
|
|
1465
|
+
column: payload.column,
|
|
1466
|
+
})
|
|
1467
|
+
triggerFieldValidation("blur", getAimdVarTableCellFieldKey(payload.tableName, payload.rowIndex, payload.column))
|
|
1238
1468
|
},
|
|
1239
1469
|
onAddRow: (payload: { tableName: string, columns: string[] }) => {
|
|
1240
1470
|
tableDragDrop.addVarTableRow(payload.tableName, payload.columns)
|
|
1471
|
+
triggerFieldValidation("change", `var_table:${payload.tableName}`)
|
|
1241
1472
|
},
|
|
1242
1473
|
onRemoveRow: (payload: { tableName: string, rowIndex: number, columns: string[] }) => {
|
|
1243
1474
|
tableDragDrop.removeVarTableRow(payload.tableName, payload.rowIndex, payload.columns)
|
|
1475
|
+
triggerFieldValidation("change", `var_table:${payload.tableName}`)
|
|
1244
1476
|
},
|
|
1245
1477
|
onDragStart: (payload: { tableName: string, rowIndex: number, event: DragEvent }) => {
|
|
1246
1478
|
tableDragDrop.startVarTableRowDrag(payload.tableName, payload.rowIndex, payload.event)
|
|
@@ -1250,6 +1482,7 @@ function renderInlineVarTable(node: AimdVarTableNode): VNode {
|
|
|
1250
1482
|
},
|
|
1251
1483
|
onDragDrop: (payload: { tableName: string, rowIndex: number, columns: string[], event: DragEvent }) => {
|
|
1252
1484
|
tableDragDrop.handleVarTableRowDrop(payload.tableName, payload.rowIndex, payload.columns, payload.event)
|
|
1485
|
+
triggerFieldValidation("change", `var_table:${payload.tableName}`)
|
|
1253
1486
|
},
|
|
1254
1487
|
onDragEnd: () => {
|
|
1255
1488
|
tableDragDrop.endVarTableRowDrag()
|
|
@@ -1426,6 +1659,7 @@ function renderInlineStep(node: AimdStepNode, bodyNodes: VNodeChild[] = []): VNo
|
|
|
1426
1659
|
timerNowMs.value = Date.now()
|
|
1427
1660
|
markRecordChanged()
|
|
1428
1661
|
emit("field-change", { section: "step", fieldKey: payload.id, value: payload.value })
|
|
1662
|
+
triggerFieldValidation("change", fieldKey)
|
|
1429
1663
|
if (wasRunning) {
|
|
1430
1664
|
emit("field-change", { section: "step", fieldKey: `${payload.id}:timer`, value: getStepTimerPayload(state) })
|
|
1431
1665
|
}
|
|
@@ -1461,6 +1695,7 @@ function renderInlineStep(node: AimdStepNode, bodyNodes: VNodeChild[] = []): VNo
|
|
|
1461
1695
|
},
|
|
1462
1696
|
onBlur: (payload: { id: string }) => {
|
|
1463
1697
|
emit("field-blur", { section: "step", fieldKey: payload.id })
|
|
1698
|
+
triggerFieldValidation("blur", fieldKey)
|
|
1464
1699
|
},
|
|
1465
1700
|
})
|
|
1466
1701
|
|
|
@@ -1496,6 +1731,7 @@ function renderInlineCheck(node: AimdCheckNode, bodyNodes: VNodeChild[] = []): V
|
|
|
1496
1731
|
state.checked = payload.value
|
|
1497
1732
|
markRecordChanged()
|
|
1498
1733
|
emit("field-change", { section: "check", fieldKey: payload.id, value: payload.value })
|
|
1734
|
+
triggerFieldValidation("change", fieldKey)
|
|
1499
1735
|
},
|
|
1500
1736
|
onAnnotationChange: (payload: { id: string, value: string }) => {
|
|
1501
1737
|
state.annotation = payload.value
|
|
@@ -1504,6 +1740,7 @@ function renderInlineCheck(node: AimdCheckNode, bodyNodes: VNodeChild[] = []): V
|
|
|
1504
1740
|
},
|
|
1505
1741
|
onBlur: (payload: { id: string }) => {
|
|
1506
1742
|
emit("field-blur", { section: "check", fieldKey: payload.id })
|
|
1743
|
+
triggerFieldValidation("blur", fieldKey)
|
|
1507
1744
|
},
|
|
1508
1745
|
})
|
|
1509
1746
|
|
|
@@ -1553,6 +1790,7 @@ function renderInlineQuiz(node: AimdQuizNode): VNode {
|
|
|
1553
1790
|
localRecord.quiz[quizId] = value
|
|
1554
1791
|
markRecordChanged({ rebuild: true })
|
|
1555
1792
|
emit("field-change", { section: "quiz", fieldKey: quizId, value })
|
|
1793
|
+
triggerFieldValidation("change", fieldKey)
|
|
1556
1794
|
},
|
|
1557
1795
|
})
|
|
1558
1796
|
|
|
@@ -1580,6 +1818,7 @@ async function rebuildInlineNodes(
|
|
|
1580
1818
|
},
|
|
1581
1819
|
blockVarTypes: ["AiralogyMarkdown"],
|
|
1582
1820
|
resolveAssetUrl: props.resolveFile,
|
|
1821
|
+
collectorContext: collectorValidationContext.value,
|
|
1583
1822
|
elementRenderers: {
|
|
1584
1823
|
pre: codeBlockPreRenderer,
|
|
1585
1824
|
},
|
|
@@ -1612,11 +1851,22 @@ async function parseAndBuild() {
|
|
|
1612
1851
|
autoServerAssignerSignatures.clear()
|
|
1613
1852
|
try {
|
|
1614
1853
|
renderError.value = ""
|
|
1615
|
-
const
|
|
1854
|
+
const contextFields = props.protocolContext
|
|
1855
|
+
? parseAndExtract(props.protocolContext)
|
|
1856
|
+
: undefined
|
|
1857
|
+
collectorValidationContext.value = contextFields
|
|
1858
|
+
? {
|
|
1859
|
+
connectors: contextFields.connectors,
|
|
1860
|
+
collectors: contextFields.collectors,
|
|
1861
|
+
step: contextFields.step,
|
|
1862
|
+
}
|
|
1863
|
+
: undefined
|
|
1864
|
+
const extracted = parseAndExtract([props.protocolContext, props.content].filter(Boolean).join("\n\n"))
|
|
1616
1865
|
if (currentRequestId !== buildRequestId) return
|
|
1617
1866
|
|
|
1618
1867
|
extractedFields.value = extracted
|
|
1619
1868
|
clientAssigners.value = extracted.client_assigner || []
|
|
1869
|
+
internalValidationFieldState.value = {}
|
|
1620
1870
|
emit("fields-change", extracted)
|
|
1621
1871
|
|
|
1622
1872
|
const defaultsChanged = ensureDefaultsFromFields(localRecord, extracted)
|
|
@@ -1635,6 +1885,7 @@ async function parseAndBuild() {
|
|
|
1635
1885
|
renderError.value = message
|
|
1636
1886
|
inlineNodes.value = []
|
|
1637
1887
|
extractedFields.value = EMPTY_FIELDS
|
|
1888
|
+
collectorValidationContext.value = undefined
|
|
1638
1889
|
clientAssigners.value = []
|
|
1639
1890
|
emit("fields-change", EMPTY_FIELDS)
|
|
1640
1891
|
emit("error", message)
|
|
@@ -1675,6 +1926,7 @@ watch(hasRunningStepTimer, () => {
|
|
|
1675
1926
|
watch(
|
|
1676
1927
|
() => ({
|
|
1677
1928
|
content: props.content,
|
|
1929
|
+
protocolContext: props.protocolContext,
|
|
1678
1930
|
locale: props.locale,
|
|
1679
1931
|
messages: props.messages,
|
|
1680
1932
|
}),
|
|
@@ -1691,6 +1943,7 @@ watch(
|
|
|
1691
1943
|
now: props.now,
|
|
1692
1944
|
fieldMeta: props.fieldMeta,
|
|
1693
1945
|
fieldState: props.fieldState,
|
|
1946
|
+
validationSchema: props.validationSchema,
|
|
1694
1947
|
serverAssigners: props.serverAssigners,
|
|
1695
1948
|
assigners: props.assigners,
|
|
1696
1949
|
runServerAssigner: props.runServerAssigner,
|
|
@@ -1699,6 +1952,7 @@ watch(
|
|
|
1699
1952
|
customRenderers: props.customRenderers,
|
|
1700
1953
|
fieldAdapters: props.fieldAdapters,
|
|
1701
1954
|
typePlugins: props.typePlugins,
|
|
1955
|
+
collectorProviders: props.collectorProviders,
|
|
1702
1956
|
}),
|
|
1703
1957
|
() => {
|
|
1704
1958
|
scheduleInlineRebuild()
|
|
@@ -1707,6 +1961,23 @@ watch(
|
|
|
1707
1961
|
{ deep: true },
|
|
1708
1962
|
)
|
|
1709
1963
|
|
|
1964
|
+
watch(
|
|
1965
|
+
() => [props.content, props.protocolContext] as const,
|
|
1966
|
+
() => collectorRuntime.stopAll({ resetPermissions: true }),
|
|
1967
|
+
)
|
|
1968
|
+
|
|
1969
|
+
watch(
|
|
1970
|
+
() => props.collectorRecordKey,
|
|
1971
|
+
() => collectorRuntime.stopAll({ resetPermissions: true }),
|
|
1972
|
+
)
|
|
1973
|
+
|
|
1974
|
+
watch(
|
|
1975
|
+
() => props.readonly,
|
|
1976
|
+
readonly => {
|
|
1977
|
+
if (readonly) collectorRuntime.stopAll()
|
|
1978
|
+
},
|
|
1979
|
+
)
|
|
1980
|
+
|
|
1710
1981
|
watch(
|
|
1711
1982
|
() => props.quizGrades,
|
|
1712
1983
|
() => {
|
|
@@ -1737,6 +2008,7 @@ watch(
|
|
|
1737
2008
|
)
|
|
1738
2009
|
|
|
1739
2010
|
onBeforeUnmount(() => {
|
|
2011
|
+
collectorRuntime.stopAll({ resetPermissions: true })
|
|
1740
2012
|
for (const controller of serverAssignerAbortControllers.values()) {
|
|
1741
2013
|
controller.abort()
|
|
1742
2014
|
}
|
|
@@ -1747,8 +2019,14 @@ onBeforeUnmount(() => {
|
|
|
1747
2019
|
})
|
|
1748
2020
|
|
|
1749
2021
|
defineExpose({
|
|
2022
|
+
validate,
|
|
2023
|
+
validateField,
|
|
2024
|
+
clearValidation,
|
|
2025
|
+
focusFirstInvalidField,
|
|
1750
2026
|
runClientAssigner: clientAssignerRunner.triggerClientAssigner,
|
|
1751
2027
|
runManualClientAssigners: clientAssignerRunner.triggerManualClientAssigners,
|
|
2028
|
+
startCollector: collectorRuntime.start,
|
|
2029
|
+
stopCollector: collectorRuntime.stop,
|
|
1752
2030
|
})
|
|
1753
2031
|
</script>
|
|
1754
2032
|
|