@airalogy/aimd-recorder 1.25.1 → 1.26.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 +16 -0
- package/README.zh-CN.md +16 -0
- package/dist/{AimdDnaSequenceField-WZF4SAj2.js → AimdDnaSequenceField-CKfd3-_9.js} +1 -1
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-COQDWC8R.js → AimdEditor.vue_vue_type_style_index_0_lang-C1XlvrNT.js} +8311 -7173
- package/dist/{AimdEntityRefField-CWVj0vPF.js → AimdEntityRefField-CX67car3.js} +1 -1
- package/dist/{AimdEntityRefField.vue_vue_type_script_setup_true_lang-CaKfY8iu.js → AimdEntityRefField.vue_vue_type_script_setup_true_lang-JISqbfKY.js} +1 -1
- package/dist/{AimdMarkdownField-BeDCefoQ.js → AimdMarkdownField-BuRsjOB5.js} +9 -9
- package/dist/{AimdMarkdownNoteField-BKrlgUYP.js → AimdMarkdownNoteField-NRA9ut3_.js} +6 -6
- package/dist/{AimdResourceRefField-DUlNcU3q.js → AimdResourceRefField-B71MVFFK.js} +2 -2
- package/dist/aimd-recorder.css +1 -1
- package/dist/{arc-DYnxKzGE.js → arc-2NNDEUZL.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-CjOI8IqA.js → architectureDiagram-3BPJPVTR-BGU_a_9z.js} +2 -2
- package/dist/{blockDiagram-GPEHLZMM-B8xNjZYk.js → blockDiagram-GPEHLZMM-ChLqLSJn.js} +4 -4
- package/dist/{c4Diagram-AAUBKEIU-TpIYY3Qn.js → c4Diagram-AAUBKEIU-BXt823OA.js} +2 -2
- package/dist/{channel-BYLaVK3q.js → channel-D1EuKFn5.js} +1 -1
- package/dist/{chunk-2J33WTMH-YwB0nZYk.js → chunk-2J33WTMH-XJPmqQtr.js} +1 -1
- package/dist/{chunk-4BX2VUAB-6QDBanOQ.js → chunk-4BX2VUAB-CbV5jCeG.js} +1 -1
- package/dist/{chunk-55IACEB6-7rwKJBSZ.js → chunk-55IACEB6-C8gv1Mc0.js} +1 -1
- package/dist/{chunk-727SXJPM-Ba_FZJwp.js → chunk-727SXJPM-Bs2EpCWN.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-reuQpvqF.js → chunk-AQP2D5EJ-CngahRo6.js} +3 -3
- package/dist/{chunk-FMBD7UC4-D35dlx01.js → chunk-FMBD7UC4-DPBfEP1E.js} +1 -1
- package/dist/{chunk-ND2GUHAM-D7604ZCl.js → chunk-ND2GUHAM-BlEzeiST.js} +1 -1
- package/dist/{chunk-QZHKN3VN-CKYkktao.js → chunk-QZHKN3VN-DGOFj8Bc.js} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-BNKRYoAB.js → classDiagram-4FO5ZUOK-BUQqoFF9.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-BNKRYoAB.js → classDiagram-v2-Q7XG4LA2-BUQqoFF9.js} +2 -2
- package/dist/components.js +3885 -3650
- package/dist/composables.js +3 -3
- package/dist/{cose-bilkent-S5V4N54A-Dq12egzW.js → cose-bilkent-S5V4N54A-Qxs9suxa.js} +1 -1
- package/dist/{dagre-BM42HDAG-CRwAbNsB.js → dagre-BM42HDAG-CqV8IXIy.js} +3 -3
- package/dist/{diagram-2AECGRRQ--WYmW1Cd.js → diagram-2AECGRRQ-D0mYOaE1.js} +2 -2
- package/dist/{diagram-5GNKFQAL-C7KgsBJW.js → diagram-5GNKFQAL-Dvjcs9SL.js} +3 -3
- package/dist/{diagram-KO2AKTUF-B_6YtDZt.js → diagram-KO2AKTUF-rSovr72L.js} +2 -2
- package/dist/{diagram-LMA3HP47-DARH_IPq.js → diagram-LMA3HP47-CirCeq88.js} +2 -2
- package/dist/{diagram-OG6HWLK6-CRdh6xnM.js → diagram-OG6HWLK6-rk46c1hT.js} +3 -3
- package/dist/{erDiagram-TEJ5UH35-CoC8CHnh.js → erDiagram-TEJ5UH35--_m5yDSV.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-BvOa5j4A.js → flowDiagram-I6XJVG4X-DU-TlDfY.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-CVXhLTr6.js → ganttDiagram-6RSMTGT7-CrMwQSQi.js} +2 -2
- package/dist/{gitGraphDiagram-PVQCEYII-DFhjJRYR.js → gitGraphDiagram-PVQCEYII-Q-bwtX2H.js} +3 -3
- package/dist/{graph-DEn_dxZa.js → graph-CvyYQarK.js} +58 -58
- package/dist/index.js +124 -123
- package/dist/{infoDiagram-5YYISTIA-uEUHa5YE.js → infoDiagram-5YYISTIA-BejjAcMI.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-BqGYvdVJ.js → ishikawaDiagram-YF4QCWOH-CbRBA5Ak.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-BkKJZduM.js → journeyDiagram-JHISSGLW-D_6-qOB8.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-CEsZIhW3.js → kanban-definition-UN3LZRKU-DyGjEqu5.js} +2 -2
- package/dist/{layout-Dk4utAZD.js → layout-Z5g42JDg.js} +93 -93
- package/dist/{linear-pw3I09nb.js → linear-DSunMwcT.js} +1 -1
- package/dist/{mermaid.core-iJ2XgYy9.js → mermaid.core-B-O2uDZ3.js} +34 -34
- package/dist/{mindmap-definition-RKZ34NQL-ChQ5---t.js → mindmap-definition-RKZ34NQL-CC_NhwV9.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-DRIV2FNb.js → pieDiagram-4H26LBE5-CHlBAazu.js} +3 -3
- package/dist/{quadrantDiagram-W4KKPZXB-C57biOpe.js → quadrantDiagram-W4KKPZXB-BM6pMzVZ.js} +2 -2
- package/dist/record.js +2 -2
- package/dist/{requirementDiagram-4Y6WPE33-KjKJuN09.js → requirementDiagram-4Y6WPE33-CNkZDYpb.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-BFubJDRS.js → sankeyDiagram-5OEKKPKP-Cq6DjItn.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-B7vg6NfP.js → sequenceDiagram-3UESZ5HK-BIzn9dmF.js} +3 -3
- package/dist/{stateDiagram-AJRCARHV-BRs_mbra.js → stateDiagram-AJRCARHV-DbSpH-v9.js} +4 -4
- package/dist/{stateDiagram-v2-BHNVJYJU-4w8m6dxi.js → stateDiagram-v2-BHNVJYJU-Cnv8BTgy.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-vrEAExRb.js → timeline-definition-PNZ67QCA-Bhs5_-8Z.js} +2 -2
- package/dist/useCodeBlockRendering-IjoDTQ64.js +35 -0
- package/dist/{useFieldRendering-B3Vm2XT8.js → useFieldRendering-r1bAnHjk.js} +239 -240
- package/dist/useVarHelpers-xrbf4f60.js +7008 -0
- package/dist/{validation-IAiGnEKX.js → validation-ZmPcMCY0.js} +991 -989
- package/dist/{vennDiagram-CIIHVFJN-CFtQv4Ta.js → vennDiagram-CIIHVFJN-DJSLUotN.js} +1 -1
- package/dist/{wardleyDiagram-YWT4CUSO-BxzaCMou.js → wardleyDiagram-YWT4CUSO-Bk66hVLg.js} +2 -2
- package/dist/{xychartDiagram-2RQKCTM6-DhTuG8MO.js → xychartDiagram-2RQKCTM6-Bss5MLVp.js} +2 -2
- package/package.json +4 -4
- package/src/__tests__/check-field-render.test.ts +65 -0
- package/src/__tests__/compact-field-types.test.ts +181 -0
- package/src/__tests__/compact-fields.test.ts +31 -0
- package/src/__tests__/multi-select-field.test.ts +54 -0
- package/src/__tests__/quoted-check-wysiwyg.test.ts +56 -0
- package/src/__tests__/recorder-field-authoring.test.ts +92 -0
- package/src/__tests__/recorder-wysiwyg-field-host.test.ts +115 -1
- package/src/__tests__/step-field.test.ts +54 -1
- package/src/components/AimdMultiSelectField.vue +56 -0
- package/src/components/AimdRecorder.vue +21 -4
- package/src/components/AimdRecorderEditor.vue +4 -0
- package/src/components/AimdRecorderWysiwygFieldHost.vue +8 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +220 -8
- package/src/components/AimdStepCheckField.vue +36 -7
- package/src/components/AimdVarField.vue +48 -4
- package/src/components/AimdVarTableField.vue +3 -0
- package/src/components/index.ts +2 -0
- package/src/components/recorderMilkdownPlugin.ts +36 -6
- package/src/composables/__tests__/useVarHelpers.test.ts +15 -0
- package/src/composables/__tests__/workbenchFieldEditing.test.ts +10 -0
- package/src/composables/useFieldPresentation.ts +7 -0
- package/src/composables/useFieldRendering.ts +1 -0
- package/src/composables/useVarHelpers.ts +20 -101
- package/src/composables/workbenchFieldEditing.ts +5 -7
- package/src/index.ts +1 -0
- package/src/record/validation.ts +6 -0
- package/src/styles/recorder-compact.css +45 -0
- package/src/styles/recorder-surface.css +14 -5
- package/src/styles/recorder.css +4 -0
- package/src/type-utils.ts +5 -1
- package/src/types.ts +1 -1
- package/dist/useCodeBlockRendering-D2viVPtA.js +0 -3158
- package/dist/useVarHelpers-DzhBBFdk.js +0 -3525
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, getCurrentInstance, nextTick, reactive, ref, watch, watchEffect } from 'vue'
|
|
3
|
+
import { getMarkdown } from '@milkdown/kit/utils'
|
|
3
4
|
import { parseAndExtract } from '@airalogy/aimd-renderer'
|
|
5
|
+
import { parseVarDefinition } from '@airalogy/aimd-core/parser'
|
|
6
|
+
import { collectAimdFieldIds, createAimdFieldId } from '@airalogy/aimd-editor/authoring'
|
|
4
7
|
import {
|
|
5
8
|
AimdEditorToolbar,
|
|
6
9
|
AimdFieldDialog,
|
|
10
|
+
AimdInputFieldDialog,
|
|
11
|
+
AimdStepFieldDialog,
|
|
7
12
|
AimdWysiwygEditor,
|
|
8
13
|
createAimdEditorMessages,
|
|
9
14
|
createAimdFieldTypes,
|
|
@@ -11,7 +16,7 @@ import {
|
|
|
11
16
|
getQuickAimdSyntax,
|
|
12
17
|
useEditorContent,
|
|
13
18
|
} from '@airalogy/aimd-editor/vue'
|
|
14
|
-
import type { AimdVarTypePresetOption } from '@airalogy/aimd-editor/vue'
|
|
19
|
+
import type { AimdVarTypePresetOption, AimdEditorImageRequest } from '@airalogy/aimd-editor/vue'
|
|
15
20
|
import type { AimdQuizGradeResult, ExtractedAimdFields } from '@airalogy/aimd-core/types'
|
|
16
21
|
import type { AimdComponentRenderer } from '@airalogy/aimd-renderer'
|
|
17
22
|
import { createAimdRecorderMessages } from '../locales'
|
|
@@ -68,6 +73,9 @@ const props = withDefaults(defineProps<{
|
|
|
68
73
|
minHeight?: number
|
|
69
74
|
locale?: string
|
|
70
75
|
readonly?: boolean
|
|
76
|
+
fieldDisplay?: 'compact' | 'detailed'
|
|
77
|
+
showModeSwitch?: boolean
|
|
78
|
+
imageToolbarAction?: 'markdown' | 'custom'
|
|
71
79
|
currentUserName?: string
|
|
72
80
|
now?: Date | string | number
|
|
73
81
|
messages?: AimdRecorderMessagesInput
|
|
@@ -105,6 +113,9 @@ const props = withDefaults(defineProps<{
|
|
|
105
113
|
minHeight: 560,
|
|
106
114
|
locale: undefined,
|
|
107
115
|
readonly: false,
|
|
116
|
+
fieldDisplay: 'detailed',
|
|
117
|
+
showModeSwitch: false,
|
|
118
|
+
imageToolbarAction: 'markdown',
|
|
108
119
|
currentUserName: undefined,
|
|
109
120
|
now: undefined,
|
|
110
121
|
messages: undefined,
|
|
@@ -152,6 +163,8 @@ const emit = defineEmits<{
|
|
|
152
163
|
(e: 'validation', result: AimdRecorderValidationResult): void
|
|
153
164
|
(e: 'edit-field', field: RecorderMilkdownFieldIdentity): void
|
|
154
165
|
(e: 'delete-field', field: RecorderMilkdownFieldIdentity): void
|
|
166
|
+
(e: 'switch-mode', mode: 'source' | 'wysiwyg'): void
|
|
167
|
+
(e: 'request-image', request: AimdEditorImageRequest): void
|
|
155
168
|
}>()
|
|
156
169
|
|
|
157
170
|
const resolvedEditorMessages = computed(() => createAimdEditorMessages(props.locale))
|
|
@@ -332,6 +345,7 @@ function handleRecordUpdate(value: AimdProtocolRecordData) {
|
|
|
332
345
|
const surfaceState = reactive<RecorderMilkdownSurfaceState>({
|
|
333
346
|
record: recordState,
|
|
334
347
|
readonly: props.readonly,
|
|
348
|
+
fieldDisplay: props.fieldDisplay,
|
|
335
349
|
currentUserName: props.currentUserName,
|
|
336
350
|
now: props.now,
|
|
337
351
|
locale: props.locale,
|
|
@@ -377,6 +391,7 @@ const surfaceState = reactive<RecorderMilkdownSurfaceState>({
|
|
|
377
391
|
|
|
378
392
|
watchEffect(() => {
|
|
379
393
|
surfaceState.readonly = props.readonly
|
|
394
|
+
surfaceState.fieldDisplay = props.fieldDisplay
|
|
380
395
|
surfaceState.currentUserName = props.currentUserName
|
|
381
396
|
surfaceState.now = props.now
|
|
382
397
|
surfaceState.locale = props.locale
|
|
@@ -416,8 +431,24 @@ const recorderMilkdownPlugins = [
|
|
|
416
431
|
...createRecorderMilkdownPlugins({
|
|
417
432
|
appContext: instance?.appContext ?? null,
|
|
418
433
|
surfaceState,
|
|
419
|
-
onEditField:
|
|
420
|
-
|
|
434
|
+
onEditField: (field, apply) => {
|
|
435
|
+
if (props.readonly) return
|
|
436
|
+
if (field.fieldType === 'step' || field.fieldType === 'check') {
|
|
437
|
+
stepDialogType.value = field.fieldType
|
|
438
|
+
stepEdit.value = { content: field.raw.slice(field.raw.indexOf('|') + 1, -2), apply }
|
|
439
|
+
showStepDialog.value = true
|
|
440
|
+
return
|
|
441
|
+
}
|
|
442
|
+
if (field.fieldType !== 'var') { emit('edit-field', field); return }
|
|
443
|
+
const fieldContent = field.raw.slice(field.raw.indexOf('|') + 1, -2)
|
|
444
|
+
if (parseVarDefinition(fieldContent).subvars) { emit('edit-field', field); return }
|
|
445
|
+
inputEdit.value = { content: fieldContent, apply }
|
|
446
|
+
showInputDialog.value = true
|
|
447
|
+
},
|
|
448
|
+
onDeleteField: (field, remove) => {
|
|
449
|
+
if (instance?.vnode.props?.onDeleteField) emit('delete-field', field)
|
|
450
|
+
else remove()
|
|
451
|
+
},
|
|
421
452
|
}),
|
|
422
453
|
]
|
|
423
454
|
|
|
@@ -432,24 +463,85 @@ const refSuggestions = computed(() => {
|
|
|
432
463
|
|
|
433
464
|
const showAimdDialog = ref(false)
|
|
434
465
|
const aimdDialogType = ref<string>('var')
|
|
466
|
+
const showInputDialog = ref(false)
|
|
467
|
+
const inputPreset = ref('str')
|
|
468
|
+
const inputEdit = ref<{ content: string; apply: (content: string) => boolean }>()
|
|
469
|
+
const showStepDialog = ref(false)
|
|
470
|
+
const stepDialogType = ref<'step' | 'check'>('step')
|
|
471
|
+
const stepEdit = ref<{ content: string; apply: (content: string) => boolean }>()
|
|
472
|
+
|
|
473
|
+
function saveStep(value: string) {
|
|
474
|
+
if (props.readonly) return
|
|
475
|
+
if (stepEdit.value) stepEdit.value.apply(value)
|
|
476
|
+
else insertTextIntoActiveEditor(`{{${stepDialogType.value}|${value}}}${stepDialogType.value === 'step' ? '\n\n' : ' '}`)
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function saveInputField(value: string) {
|
|
480
|
+
if (props.readonly) return
|
|
481
|
+
if (inputEdit.value) {
|
|
482
|
+
const oldId = parseVarDefinition(inputEdit.value.content).id
|
|
483
|
+
const newId = parseVarDefinition(value).id
|
|
484
|
+
if (!inputEdit.value.apply(value)) return
|
|
485
|
+
if (newId !== oldId && Object.prototype.hasOwnProperty.call(recordState.var, oldId)) {
|
|
486
|
+
// Retain the old key as detached data so undoing the rename cannot lose a filled value.
|
|
487
|
+
recordState.var[newId] = cloneRecordData(recordState).var[oldId]
|
|
488
|
+
emit('update:modelValue', cloneRecordData(recordState))
|
|
489
|
+
}
|
|
490
|
+
} else {
|
|
491
|
+
insertTextIntoActiveEditor(`{{var|${value}}}`)
|
|
492
|
+
}
|
|
493
|
+
}
|
|
435
494
|
|
|
436
495
|
function openAimdDialog(type: string) {
|
|
496
|
+
if (props.readonly) return
|
|
497
|
+
if (type === 'step' || type === 'check') {
|
|
498
|
+
stepDialogType.value = type
|
|
499
|
+
stepEdit.value = undefined
|
|
500
|
+
showStepDialog.value = true
|
|
501
|
+
return
|
|
502
|
+
}
|
|
503
|
+
if (type === 'var') {
|
|
504
|
+
insertInput('str')
|
|
505
|
+
return
|
|
506
|
+
}
|
|
437
507
|
aimdDialogType.value = RECORDER_EDITABLE_FIELD_SET.has(type) ? type : 'var'
|
|
438
508
|
showAimdDialog.value = true
|
|
439
509
|
}
|
|
440
510
|
|
|
511
|
+
function insertInput(preset: string) {
|
|
512
|
+
if (props.readonly) return
|
|
513
|
+
inputEdit.value = undefined
|
|
514
|
+
inputPreset.value = preset
|
|
515
|
+
showInputDialog.value = true
|
|
516
|
+
}
|
|
517
|
+
|
|
441
518
|
function quickInsertAimd(type: string) {
|
|
442
|
-
if (!RECORDER_EDITABLE_FIELD_SET.has(type)) {
|
|
519
|
+
if (props.readonly || !RECORDER_EDITABLE_FIELD_SET.has(type)) {
|
|
443
520
|
return
|
|
444
521
|
}
|
|
445
522
|
|
|
446
|
-
insertTextIntoActiveEditor(
|
|
523
|
+
insertTextIntoActiveEditor(type === 'var'
|
|
524
|
+
? `{{var|${createAimdFieldId([...collectAimdFieldIds(content.value), ...Object.keys(recordState.var)])}: str}}`
|
|
525
|
+
: type === 'step'
|
|
526
|
+
? `{{step|${createAimdFieldId([...collectAimdFieldIds(content.value), ...Object.keys(recordState.step)], 'step')}, check=True}}\n\n`
|
|
527
|
+
: getQuickAimdSyntax(type, resolvedEditorMessages.value))
|
|
447
528
|
}
|
|
448
529
|
|
|
449
530
|
function onDialogInsert(syntax: string) {
|
|
531
|
+
if (props.readonly) return
|
|
450
532
|
insertTextIntoActiveEditor(syntax)
|
|
451
533
|
}
|
|
452
534
|
|
|
535
|
+
function onMdAction(action: string, event: MouseEvent) {
|
|
536
|
+
if (props.readonly) return
|
|
537
|
+
if (action === 'image' && props.imageToolbarAction === 'custom') {
|
|
538
|
+
const rect = (event.currentTarget as HTMLElement | null)?.getBoundingClientRect()
|
|
539
|
+
emit('request-image', { buttonRect: rect ? { top: rect.top, right: rect.right, bottom: rect.bottom, left: rect.left, width: rect.width, height: rect.height } : undefined })
|
|
540
|
+
return
|
|
541
|
+
}
|
|
542
|
+
handleMdAction(action)
|
|
543
|
+
}
|
|
544
|
+
|
|
453
545
|
function handleWysiwygReady(editor: any) {
|
|
454
546
|
onMilkdownReady(editor)
|
|
455
547
|
emit('ready', { milkdown: editor })
|
|
@@ -457,8 +549,20 @@ function handleWysiwygReady(editor: any) {
|
|
|
457
549
|
|
|
458
550
|
const wysiwygEditorRef = ref<InstanceType<typeof AimdWysiwygEditor> | null>(null)
|
|
459
551
|
|
|
552
|
+
function switchEditorMode(mode: 'source' | 'wysiwyg') {
|
|
553
|
+
if (mode === 'wysiwyg') return
|
|
554
|
+
const editor = wysiwygEditorRef.value?.getEditor?.()
|
|
555
|
+
if (editor) {
|
|
556
|
+
// Flush the current document before the host unmounts this surface.
|
|
557
|
+
const markdown = editor.action(getMarkdown())
|
|
558
|
+
onMilkdownMarkdownUpdated(null, markdown, content.value)
|
|
559
|
+
}
|
|
560
|
+
emit('switch-mode', mode)
|
|
561
|
+
}
|
|
562
|
+
|
|
460
563
|
defineExpose({
|
|
461
564
|
getEditor: () => wysiwygEditorRef.value?.getEditor?.(),
|
|
565
|
+
insertText: onDialogInsert,
|
|
462
566
|
validate,
|
|
463
567
|
validateField,
|
|
464
568
|
clearValidation,
|
|
@@ -467,18 +571,20 @@ defineExpose({
|
|
|
467
571
|
</script>
|
|
468
572
|
|
|
469
573
|
<template>
|
|
470
|
-
<div ref="surfaceRoot" class="aimd-recorder-wysiwyg-surface" :style="surfaceCssVars">
|
|
574
|
+
<div ref="surfaceRoot" class="aimd-recorder-wysiwyg-surface" :class="{ 'aimd-recorder-wysiwyg-surface--compact': fieldDisplay === 'compact' }" :style="surfaceCssVars">
|
|
471
575
|
<AimdEditorToolbar
|
|
472
|
-
:show-top-bar="
|
|
576
|
+
:show-top-bar="showModeSwitch"
|
|
473
577
|
:show-md-toolbar="true"
|
|
474
578
|
:show-aimd-toolbar="true"
|
|
475
579
|
editor-mode="wysiwyg"
|
|
476
580
|
:resolved-messages="resolvedEditorMessages"
|
|
477
581
|
:localized-field-types="localizedFieldTypes"
|
|
478
582
|
:localized-md-toolbar-items="localizedMdToolbarItems"
|
|
479
|
-
@md-action="
|
|
583
|
+
@md-action="onMdAction"
|
|
584
|
+
@switch-mode="switchEditorMode"
|
|
480
585
|
@open-aimd-dialog="openAimdDialog"
|
|
481
586
|
@quick-insert-aimd="quickInsertAimd"
|
|
587
|
+
@insert-input="insertInput"
|
|
482
588
|
/>
|
|
483
589
|
|
|
484
590
|
<AimdWysiwygEditor
|
|
@@ -496,6 +602,19 @@ defineExpose({
|
|
|
496
602
|
@open-aimd-dialog="openAimdDialog"
|
|
497
603
|
/>
|
|
498
604
|
|
|
605
|
+
<AimdStepFieldDialog v-model:visible="showStepDialog" :field-type="stepDialogType" :content="content" :field-content="stepEdit?.content" :reserved-ids="Object.keys(recordState[stepDialogType])" :messages="resolvedEditorMessages" @save="saveStep" />
|
|
606
|
+
|
|
607
|
+
<AimdInputFieldDialog
|
|
608
|
+
v-model:visible="showInputDialog"
|
|
609
|
+
:content="content"
|
|
610
|
+
:field-content="inputEdit?.content"
|
|
611
|
+
:initial-preset="inputPreset"
|
|
612
|
+
:reserved-ids="Object.keys(recordState.var)"
|
|
613
|
+
:messages="resolvedEditorMessages"
|
|
614
|
+
:var-type-plugins="dialogVarTypePlugins"
|
|
615
|
+
@save="saveInputField"
|
|
616
|
+
/>
|
|
617
|
+
|
|
499
618
|
<AimdFieldDialog
|
|
500
619
|
:visible="showAimdDialog"
|
|
501
620
|
:initial-type="aimdDialogType"
|
|
@@ -516,6 +635,29 @@ defineExpose({
|
|
|
516
635
|
flex-direction: column;
|
|
517
636
|
}
|
|
518
637
|
|
|
638
|
+
.aimd-recorder-wysiwyg-surface--compact :deep(.aimd-recorder-wysiwyg-node__summary) { display: none; }
|
|
639
|
+
.aimd-recorder-wysiwyg-surface.aimd-recorder-wysiwyg-surface--compact :deep(.aimd-recorder-wysiwyg-node__chrome),
|
|
640
|
+
.aimd-recorder-wysiwyg-surface.aimd-recorder-wysiwyg-surface--compact :deep(.aimd-recorder-wysiwyg-node__action),
|
|
641
|
+
.aimd-recorder-wysiwyg-surface.aimd-recorder-wysiwyg-surface--compact :deep(.aimd-recorder-wysiwyg-node__drag) { border-radius: 4px; }
|
|
642
|
+
.aimd-recorder-wysiwyg-surface.aimd-recorder-wysiwyg-surface--compact :deep(.aimd-recorder-wysiwyg-node) { margin: 2px; }
|
|
643
|
+
|
|
644
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node:has(.aimd-rec-inline--var-stacked--scalar-list, .aimd-code-field, .aimd-markdown-field, .aimd-rec-inline--var-dna, .aimd-rec-inline-table, .aimd-rec-collector)),
|
|
645
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-field-host:has(.aimd-rec-inline--var-stacked--scalar-list, .aimd-code-field, .aimd-markdown-field, .aimd-rec-inline--var-dna, .aimd-rec-inline-table, .aimd-rec-collector)) {
|
|
646
|
+
display: flex;
|
|
647
|
+
width: 100%;
|
|
648
|
+
max-width: 100%;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node__body:has(.aimd-rec-inline--var-stacked--scalar-list, .aimd-code-field, .aimd-markdown-field, .aimd-rec-inline--var-dna, .aimd-rec-inline-table, .aimd-rec-collector)) {
|
|
652
|
+
width: 100%;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-field-host:has(.aimd-rec-inline--var-stacked--scalar-list, .aimd-code-field, .aimd-markdown-field, .aimd-rec-inline--var-dna, .aimd-rec-inline-table, .aimd-rec-collector) > .aimd-protocol-recorder) {
|
|
656
|
+
width: 100%;
|
|
657
|
+
min-width: 0;
|
|
658
|
+
max-width: 100%;
|
|
659
|
+
}
|
|
660
|
+
|
|
519
661
|
.aimd-recorder-wysiwyg-surface :deep(.aimd-editor-wysiwyg-mode) {
|
|
520
662
|
position: relative;
|
|
521
663
|
border: 1px solid #e0e7f1;
|
|
@@ -538,7 +680,75 @@ defineExpose({
|
|
|
538
680
|
width: 100%;
|
|
539
681
|
}
|
|
540
682
|
|
|
683
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node.aimd-recorder-wysiwyg-node--step) {
|
|
684
|
+
display: flex;
|
|
685
|
+
width: 100%;
|
|
686
|
+
min-width: 0;
|
|
687
|
+
margin: 8px 0 6px;
|
|
688
|
+
container: aimd-step-authoring / inline-size;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step > .aimd-recorder-wysiwyg-node__body) {
|
|
692
|
+
width: 100%;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-rec-inline--step) {
|
|
696
|
+
margin: 0;
|
|
697
|
+
padding: 8px 12px;
|
|
698
|
+
gap: 8px;
|
|
699
|
+
border: 0;
|
|
700
|
+
border-left: 3px solid #d5a55e;
|
|
701
|
+
border-radius: 0;
|
|
702
|
+
background: #f8fafc;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__main) {
|
|
706
|
+
display: grid;
|
|
707
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
708
|
+
align-items: center;
|
|
709
|
+
gap: 8px 12px;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__main-meta) {
|
|
713
|
+
max-width: 100%;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-rec-inline__check-wrap) {
|
|
717
|
+
flex-wrap: nowrap;
|
|
718
|
+
max-width: 100%;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-rec-inline__check-wrap > :not(.aimd-step-field__identity)) {
|
|
722
|
+
flex-shrink: 0;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__title) {
|
|
726
|
+
min-width: 0;
|
|
727
|
+
font-size: 14px;
|
|
728
|
+
font-weight: 600;
|
|
729
|
+
color: #24292f;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__main-actions) {
|
|
733
|
+
margin-left: auto;
|
|
734
|
+
align-items: center;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__toggle) {
|
|
738
|
+
min-height: 28px;
|
|
739
|
+
border-radius: 4px;
|
|
740
|
+
font-size: 12px;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
@container aimd-step-authoring (max-width: 480px) {
|
|
744
|
+
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node--step .aimd-step-field__main) {
|
|
745
|
+
grid-template-columns: minmax(0, 1fr);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
541
749
|
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node__chrome) {
|
|
750
|
+
width: max-content;
|
|
751
|
+
white-space: nowrap;
|
|
542
752
|
position: absolute;
|
|
543
753
|
top: -12px;
|
|
544
754
|
right: -2px;
|
|
@@ -567,6 +777,8 @@ defineExpose({
|
|
|
567
777
|
}
|
|
568
778
|
|
|
569
779
|
.aimd-recorder-wysiwyg-surface :deep(.aimd-recorder-wysiwyg-node__chrome--inline) {
|
|
780
|
+
top: auto;
|
|
781
|
+
bottom: calc(100% + 2px);
|
|
570
782
|
padding: 3px 5px;
|
|
571
783
|
}
|
|
572
784
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { computed, defineAsyncComponent, defineComponent, h, nextTick, onBeforeUnmount, ref, watch, type PropType, type VNodeChild } from "vue"
|
|
2
|
+
import { Comment, Fragment, Text, computed, defineAsyncComponent, defineComponent, h, isVNode, nextTick, onBeforeUnmount, ref, watch, type PropType, type VNodeChild } from "vue"
|
|
3
3
|
import type { AimdStepNode, AimdCheckNode, AimdStepTimerMode } from "@airalogy/aimd-core/types"
|
|
4
4
|
import type { AimdRecorderMessages } from "../locales"
|
|
5
5
|
import { getAimdRecorderScopeLabel } from "../locales"
|
|
@@ -14,9 +14,25 @@ import {
|
|
|
14
14
|
resolveStepTimerMode,
|
|
15
15
|
} from "../composables/useStepTimers"
|
|
16
16
|
import AimdRequiredMarker from "./AimdRequiredMarker.vue"
|
|
17
|
+
import { useFieldPresentation } from "../composables/useFieldPresentation"
|
|
17
18
|
|
|
18
19
|
const AimdMarkdownNoteField = defineAsyncComponent(() => import("./AimdMarkdownNoteField.vue"))
|
|
19
20
|
|
|
21
|
+
function hasStepBodyContent(node: VNodeChild): boolean {
|
|
22
|
+
if (node == null || typeof node === "boolean") return false
|
|
23
|
+
if (typeof node === "string") return node.trim().length > 0
|
|
24
|
+
if (Array.isArray(node)) return node.some(hasStepBodyContent)
|
|
25
|
+
if (!isVNode(node)) return true
|
|
26
|
+
if (node.type === Comment) return false
|
|
27
|
+
// A standalone step can receive an empty paragraph from the Markdown renderer.
|
|
28
|
+
if (node.type === "p" || node.type === Text || node.type === Fragment) {
|
|
29
|
+
if (node.children == null || typeof node.children === "string" || Array.isArray(node.children)) {
|
|
30
|
+
return hasStepBodyContent(node.children)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
export const AimdStepField = defineComponent({
|
|
21
37
|
name: "AimdStepField",
|
|
22
38
|
props: {
|
|
@@ -32,6 +48,7 @@ export const AimdStepField = defineComponent({
|
|
|
32
48
|
},
|
|
33
49
|
emits: ["check-change", "annotation-change", "timer-start", "timer-pause", "timer-reset", "blur"],
|
|
34
50
|
setup(props, { emit }) {
|
|
51
|
+
const fieldDisplay = useFieldPresentation()
|
|
35
52
|
const nowMs = ref(Date.now())
|
|
36
53
|
const rootEl = ref<HTMLElement | null>(null)
|
|
37
54
|
const annotationDetailsEl = ref<HTMLElement | null>(null)
|
|
@@ -199,7 +216,8 @@ export const AimdStepField = defineComponent({
|
|
|
199
216
|
const state = props.state
|
|
200
217
|
const stepNumber = node.step || "?"
|
|
201
218
|
const hasCheck = Boolean(node.check)
|
|
202
|
-
const
|
|
219
|
+
const bodyNodes = props.bodyNodes.filter(hasStepBodyContent)
|
|
220
|
+
const hasBody = bodyNodes.length > 0
|
|
203
221
|
const disabled = props.disabled
|
|
204
222
|
const extraClasses = props.extraClasses
|
|
205
223
|
const canResetTimer = hasRecordedDuration.value || timerRunning.value
|
|
@@ -298,6 +316,7 @@ export const AimdStepField = defineComponent({
|
|
|
298
316
|
hasCheck
|
|
299
317
|
? h("input", {
|
|
300
318
|
"data-rec-focus-key": `step:${id}:checked`,
|
|
319
|
+
"aria-label": `${getAimdRecorderScopeLabel("step", props.messages)} ${stepNumber}${node.title ? `: ${node.title}` : ""}`,
|
|
301
320
|
type: "checkbox",
|
|
302
321
|
disabled,
|
|
303
322
|
checked: Boolean(state.checked),
|
|
@@ -312,7 +331,10 @@ export const AimdStepField = defineComponent({
|
|
|
312
331
|
: null,
|
|
313
332
|
h("span", { class: "aimd-field__scope" }, getAimdRecorderScopeLabel("step", props.messages)),
|
|
314
333
|
h("span", { class: "aimd-rec-inline__step-num" }, stepNumber),
|
|
315
|
-
h("span", { class: "aimd-
|
|
334
|
+
h("span", { class: "aimd-step-field__identity" }, [
|
|
335
|
+
node.title?.trim() ? h("span", { class: "aimd-step-field__title" }, node.title.trim()) : null,
|
|
336
|
+
fieldDisplay.value === "detailed" ? h("span", { class: "aimd-step-field__id" }, id) : null,
|
|
337
|
+
]),
|
|
316
338
|
props.required ? h(AimdRequiredMarker, { label: props.messages.common.required }) : null,
|
|
317
339
|
]),
|
|
318
340
|
)
|
|
@@ -361,8 +383,8 @@ export const AimdStepField = defineComponent({
|
|
|
361
383
|
)
|
|
362
384
|
}
|
|
363
385
|
|
|
364
|
-
const bodyChildren =
|
|
365
|
-
? h("div", { key: "body", class: "aimd-step-field__body" },
|
|
386
|
+
const bodyChildren = hasBody
|
|
387
|
+
? h("div", { key: "body", class: "aimd-step-field__body" }, bodyNodes)
|
|
366
388
|
: null
|
|
367
389
|
const bodyAnnotationAction = hasBody && !disabled && !showAnnotationEditor.value
|
|
368
390
|
? h("div", {
|
|
@@ -437,6 +459,7 @@ export const AimdCheckField = defineComponent({
|
|
|
437
459
|
},
|
|
438
460
|
emits: ["check-change", "annotation-change", "blur"],
|
|
439
461
|
setup(props, { emit }) {
|
|
462
|
+
const fieldDisplay = useFieldPresentation()
|
|
440
463
|
const rootEl = ref<HTMLElement | null>(null)
|
|
441
464
|
const detailsEl = ref<HTMLElement | null>(null)
|
|
442
465
|
const annotationExpanded = ref(false)
|
|
@@ -566,6 +589,7 @@ export const AimdCheckField = defineComponent({
|
|
|
566
589
|
h("label", { class: "aimd-rec-inline__check-wrap aimd-check-field__toggle" }, [
|
|
567
590
|
h("input", {
|
|
568
591
|
"data-rec-focus-key": `check:${id}:checked`,
|
|
592
|
+
"aria-label": `${getAimdRecorderScopeLabel("check", props.messages)} ${node.title || fallbackLabel}`,
|
|
569
593
|
type: "checkbox",
|
|
570
594
|
class: "aimd-checkbox",
|
|
571
595
|
disabled,
|
|
@@ -579,13 +603,18 @@ export const AimdCheckField = defineComponent({
|
|
|
579
603
|
onBlur: () => emit("blur", { id }),
|
|
580
604
|
}),
|
|
581
605
|
h("span", { class: "aimd-field__scope" }, getAimdRecorderScopeLabel("check", props.messages)),
|
|
582
|
-
|
|
606
|
+
node.title
|
|
607
|
+
? h("span", { class: "aimd-check-field__identity" }, [
|
|
608
|
+
h("span", { class: "aimd-check-field__title" }, node.title),
|
|
609
|
+
fieldDisplay.value === "detailed" ? h("small", { class: "aimd-check-field__key" }, id) : null,
|
|
610
|
+
])
|
|
611
|
+
: !hasBody
|
|
583
612
|
? h("span", { class: "aimd-field__name aimd-check-field__key" }, [
|
|
584
613
|
fallbackLabel,
|
|
585
614
|
props.required ? h(AimdRequiredMarker, { label: props.messages.common.required }) : null,
|
|
586
615
|
])
|
|
587
616
|
: null,
|
|
588
|
-
hasBody && props.required
|
|
617
|
+
(hasBody || node.title) && props.required
|
|
589
618
|
? h(AimdRequiredMarker, { label: props.messages.common.required })
|
|
590
619
|
: null,
|
|
591
620
|
]),
|
|
@@ -49,6 +49,9 @@ import {
|
|
|
49
49
|
type ScalarListItemType,
|
|
50
50
|
} from "../composables/useVarHelpers"
|
|
51
51
|
import AimdRequiredMarker from "./AimdRequiredMarker.vue"
|
|
52
|
+
import { useFieldPresentation } from "../composables/useFieldPresentation"
|
|
53
|
+
import { parseVarListEnumValues } from '@airalogy/aimd-core/parser'
|
|
54
|
+
import AimdMultiSelectField from './AimdMultiSelectField.vue'
|
|
52
55
|
|
|
53
56
|
const AimdCodeField = defineAsyncComponent(() => import("./AimdCodeField.vue"))
|
|
54
57
|
const AimdEntityRefField = defineAsyncComponent(() => import("./AimdEntityRefField.vue"))
|
|
@@ -279,7 +282,7 @@ function getScalarListTextMeasureContext(): CanvasRenderingContext2D | null {
|
|
|
279
282
|
function getComputedFontShorthand(style: CSSStyleDeclaration): string {
|
|
280
283
|
return style.font && style.font !== ""
|
|
281
284
|
? style.font
|
|
282
|
-
: `${style.fontStyle
|
|
285
|
+
: `${style.fontStyle || 'normal'} ${style.fontWeight || '400'} ${style.fontSize || '14px'} ${style.fontFamily || 'sans-serif'}`
|
|
283
286
|
}
|
|
284
287
|
|
|
285
288
|
function getCssPixelValue(value: string): number {
|
|
@@ -513,6 +516,9 @@ export default defineComponent({
|
|
|
513
516
|
},
|
|
514
517
|
emits: ["change", "blur"],
|
|
515
518
|
setup(props, { emit }) {
|
|
519
|
+
const fieldDisplay = useFieldPresentation()
|
|
520
|
+
const checkboxValue = ref(toBooleanValue(props.value))
|
|
521
|
+
watch(() => props.value, value => { checkboxValue.value = toBooleanValue(value) })
|
|
516
522
|
const fileUploadError = ref("")
|
|
517
523
|
const csvPreview = ref<CsvPreviewState | null>(null)
|
|
518
524
|
const resolvedFileInfo = ref<FileDisplayInfo | null>(null)
|
|
@@ -660,9 +666,11 @@ export default defineComponent({
|
|
|
660
666
|
const isIntegerInput = isIntegerVarType(type)
|
|
661
667
|
const usesDecimalTextInput = inputKind === "number" && !isIntegerInput
|
|
662
668
|
const meta = props.fieldMeta
|
|
669
|
+
const accessibleLabel = normalizeMetaString(meta?.title) ?? getAimdFieldDisplayLabel(id, node.definition)
|
|
663
670
|
const disabled = props.disabled
|
|
664
671
|
const extraClasses = props.extraClasses
|
|
665
672
|
const placeholder = meta?.placeholder ?? getVarPlaceholder(node, meta)
|
|
673
|
+
?? (fieldDisplay.value === "compact" ? normalizeMetaString(meta?.title ?? node.definition?.kwargs?.title) : undefined)
|
|
666
674
|
const displayValue = props.displayValue
|
|
667
675
|
const codeLanguage = resolveAimdCodeEditorLanguage(type, meta) ?? "plaintext"
|
|
668
676
|
const numericInputAttributes: NumericInputAttributes = inputKind === "number"
|
|
@@ -757,7 +765,11 @@ export default defineComponent({
|
|
|
757
765
|
])
|
|
758
766
|
}
|
|
759
767
|
|
|
760
|
-
const renderVarLabel = (headerAction?: VNode | null): VNode => {
|
|
768
|
+
const renderVarLabel = (headerAction?: VNode | null): VNode | null => {
|
|
769
|
+
if (fieldDisplay.value === 'compact') {
|
|
770
|
+
const actions = renderHeaderAssignerActions(headerAction)
|
|
771
|
+
return actions ? h('span', { class: 'aimd-rec-inline__compact-actions' }, [actions]) : null
|
|
772
|
+
}
|
|
761
773
|
const metaTitle = normalizeMetaString(meta?.title)
|
|
762
774
|
const definitionTitle = getAimdFieldTitle(node.definition)
|
|
763
775
|
const displayTitle = metaTitle ?? getAimdFieldDisplayLabel(id, node.definition)
|
|
@@ -839,6 +851,8 @@ export default defineComponent({
|
|
|
839
851
|
renderControlRow(h("select", {
|
|
840
852
|
"data-rec-focus-key": `var:${id}`,
|
|
841
853
|
class: "aimd-rec-inline__value-control aimd-rec-inline__input aimd-rec-inline__input--stacked aimd-rec-inline__select",
|
|
854
|
+
"aria-label": accessibleLabel,
|
|
855
|
+
"aria-required": props.required,
|
|
842
856
|
disabled,
|
|
843
857
|
value: selectedEnumValue,
|
|
844
858
|
onChange: (e: Event) => {
|
|
@@ -876,22 +890,42 @@ export default defineComponent({
|
|
|
876
890
|
renderAssignerError(),
|
|
877
891
|
])
|
|
878
892
|
|
|
893
|
+
if (inputKind === "multi-select") {
|
|
894
|
+
return renderStackedVar(h(AimdMultiSelectField, {
|
|
895
|
+
modelValue: props.value,
|
|
896
|
+
options: parseVarListEnumValues(type),
|
|
897
|
+
label: accessibleLabel,
|
|
898
|
+
fieldId: id,
|
|
899
|
+
disabled,
|
|
900
|
+
nullable: isNullableVarType(type),
|
|
901
|
+
emptyLabel: getAimdRecorderEmptyValueLabel(props.messages),
|
|
902
|
+
'onUpdate:modelValue': (value: unknown[] | null) => emit('change', { id, value, type, inputKind }),
|
|
903
|
+
onBlur: onVarBlur,
|
|
904
|
+
}), 'aimd-rec-inline--multi-select')
|
|
905
|
+
}
|
|
906
|
+
|
|
879
907
|
if (inputKind === "checkbox") {
|
|
880
908
|
return renderStackedVar(
|
|
881
|
-
h("
|
|
909
|
+
h("label", { class: "aimd-rec-inline__checkbox-row" }, [
|
|
882
910
|
h("input", {
|
|
883
911
|
"data-rec-focus-key": `var:${id}`,
|
|
884
912
|
type: "checkbox",
|
|
913
|
+
"aria-label": accessibleLabel,
|
|
914
|
+
"aria-required": props.required,
|
|
885
915
|
disabled,
|
|
886
|
-
checked:
|
|
916
|
+
checked: checkboxValue.value,
|
|
887
917
|
onVnodeMounted: (vnode: any) => applyVarStackWidth(vnode.el as HTMLElement, inputKind),
|
|
888
918
|
onVnodeUpdated: (vnode: any) => applyVarStackWidth(vnode.el as HTMLElement, inputKind),
|
|
889
919
|
onChange: (event: Event) => {
|
|
890
920
|
const val = (event.target as HTMLInputElement).checked
|
|
921
|
+
checkboxValue.value = val
|
|
891
922
|
emit("change", { id, value: val, type, inputKind })
|
|
892
923
|
},
|
|
893
924
|
onBlur: onVarBlur,
|
|
894
925
|
}),
|
|
926
|
+
fieldDisplay.value === 'compact'
|
|
927
|
+
? h('span', { class: 'aimd-rec-inline__boolean-state' }, checkboxValue.value ? props.messages.boolean.true : props.messages.boolean.false)
|
|
928
|
+
: null,
|
|
895
929
|
]),
|
|
896
930
|
"aimd-rec-inline--var-stacked--checkbox",
|
|
897
931
|
)
|
|
@@ -902,6 +936,8 @@ export default defineComponent({
|
|
|
902
936
|
h("select", {
|
|
903
937
|
"data-rec-focus-key": `var:${id}`,
|
|
904
938
|
class: "aimd-rec-inline__value-control aimd-rec-inline__input aimd-rec-inline__input--stacked aimd-rec-inline__select aimd-rec-inline__boolean-select",
|
|
939
|
+
"aria-label": accessibleLabel,
|
|
940
|
+
"aria-required": props.required,
|
|
905
941
|
disabled,
|
|
906
942
|
value: String(displayValue),
|
|
907
943
|
onVnodeMounted: (vnode: any) => applyVarStackWidth(vnode.el as HTMLElement, inputKind),
|
|
@@ -922,6 +958,8 @@ export default defineComponent({
|
|
|
922
958
|
h("textarea", {
|
|
923
959
|
"data-rec-focus-key": `var:${id}`,
|
|
924
960
|
class: "aimd-rec-inline__value-control aimd-rec-inline__textarea aimd-rec-inline__textarea--stacked",
|
|
961
|
+
"aria-label": accessibleLabel,
|
|
962
|
+
"aria-required": props.required,
|
|
925
963
|
disabled,
|
|
926
964
|
placeholder,
|
|
927
965
|
value: displayValue,
|
|
@@ -1020,6 +1058,7 @@ export default defineComponent({
|
|
|
1020
1058
|
const fileInput = h("input", {
|
|
1021
1059
|
"data-rec-focus-key": `var:${id}`,
|
|
1022
1060
|
class: "aimd-rec-file-field__input",
|
|
1061
|
+
"aria-label": accessibleLabel,
|
|
1023
1062
|
type: "file",
|
|
1024
1063
|
accept: fileConfig.accept,
|
|
1025
1064
|
disabled,
|
|
@@ -1321,6 +1360,7 @@ export default defineComponent({
|
|
|
1321
1360
|
const isExplicitMultilineItem = !isNumericScalarList && hasExplicitLineBreak(item)
|
|
1322
1361
|
const isWideTextItem = !isNumericScalarList && isWideScalarListTextItem(item, itemPlaceholder)
|
|
1323
1362
|
const itemControlProps = {
|
|
1363
|
+
"aria-label": `${accessibleLabel}: ${itemIndexLabel}`,
|
|
1324
1364
|
"data-rec-focus-key": rowIndex === 0 ? `var:${id}` : `var:${id}:${rowIndex}`,
|
|
1325
1365
|
class: [
|
|
1326
1366
|
"aimd-rec-scalar-list__input",
|
|
@@ -1476,6 +1516,8 @@ export default defineComponent({
|
|
|
1476
1516
|
h("textarea", {
|
|
1477
1517
|
"data-rec-focus-key": `var:${id}`,
|
|
1478
1518
|
class: "aimd-rec-inline__value-control aimd-rec-inline__textarea aimd-rec-inline__textarea--stacked aimd-rec-inline__textarea--stacked-text",
|
|
1519
|
+
"aria-label": accessibleLabel,
|
|
1520
|
+
"aria-required": props.required,
|
|
1479
1521
|
rows: 1,
|
|
1480
1522
|
disabled,
|
|
1481
1523
|
placeholder,
|
|
@@ -1518,6 +1560,8 @@ export default defineComponent({
|
|
|
1518
1560
|
h("input", {
|
|
1519
1561
|
"data-rec-focus-key": `var:${id}`,
|
|
1520
1562
|
class: "aimd-rec-inline__value-control aimd-rec-inline__input aimd-rec-inline__input--stacked",
|
|
1563
|
+
"aria-label": accessibleLabel,
|
|
1564
|
+
"aria-required": props.required,
|
|
1521
1565
|
type: htmlInputType,
|
|
1522
1566
|
inputmode: inputKind === "number" ? (isIntegerInput ? "numeric" : "decimal") : undefined,
|
|
1523
1567
|
min: nativeNumericAttrs.min,
|
|
@@ -353,6 +353,7 @@ export default defineComponent({
|
|
|
353
353
|
const focusKey = `var_table:${tableName}:${rowIndex}:${column}`
|
|
354
354
|
const disabled = isColumnDisabled(column)
|
|
355
355
|
const placeholder = getColumnPlaceholder(column)
|
|
356
|
+
const accessibleLabel = `${getAimdFieldDisplayLabel(column, getColumnDefinition(column))}: ${rowIndex + 1}`
|
|
356
357
|
|
|
357
358
|
if (enumOptions.length > 0) {
|
|
358
359
|
const selectedEnumValue = getVarEnumSelectValue(enumOptions, row[column])
|
|
@@ -363,6 +364,7 @@ export default defineComponent({
|
|
|
363
364
|
: placeholder
|
|
364
365
|
return h("select", {
|
|
365
366
|
"data-rec-focus-key": focusKey,
|
|
367
|
+
"aria-label": accessibleLabel,
|
|
366
368
|
class: [className, "aimd-rec-enum-select"],
|
|
367
369
|
disabled,
|
|
368
370
|
value: selectedEnumValue,
|
|
@@ -389,6 +391,7 @@ export default defineComponent({
|
|
|
389
391
|
|
|
390
392
|
return h("input", {
|
|
391
393
|
"data-rec-focus-key": focusKey,
|
|
394
|
+
"aria-label": accessibleLabel,
|
|
392
395
|
class: className,
|
|
393
396
|
disabled,
|
|
394
397
|
placeholder,
|
package/src/components/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import AimdAssignerGraph from "./AimdAssignerGraph.vue"
|
|
|
11
11
|
import AimdCollectorField from "./AimdCollectorField.vue"
|
|
12
12
|
import AimdRecorder from "./AimdRecorder.vue"
|
|
13
13
|
import AimdRecorderEditor from "./AimdRecorderEditor.vue"
|
|
14
|
+
import AimdRecorderWysiwygSurface from "./AimdRecorderWysiwygSurface.vue"
|
|
14
15
|
import AimdQuizRecorder from "./AimdQuizRecorder.vue"
|
|
15
16
|
import AimdRequiredMarker from "./AimdRequiredMarker.vue"
|
|
16
17
|
import AimdResourceForm from "./AimdResourceForm.vue"
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
AimdCollectorField,
|
|
26
27
|
AimdRecorder,
|
|
27
28
|
AimdRecorderEditor,
|
|
29
|
+
AimdRecorderWysiwygSurface,
|
|
28
30
|
AimdQuizRecorder,
|
|
29
31
|
AimdRequiredMarker,
|
|
30
32
|
AimdResourceForm,
|