@airalogy/aimd-recorder 1.21.0 → 1.23.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 +62 -0
- package/README.zh-CN.md +62 -0
- package/dist/{AimdDnaSequenceField-Cp0cgBYl.js → AimdDnaSequenceField-JzxsGmRf.js} +1 -1
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-Dj5y1p3U.js → AimdEditor.vue_vue_type_style_index_0_lang-v82TdP_I.js} +2000 -1897
- package/dist/AimdEntityRefField-O0FwJDC0.js +229 -0
- package/dist/{AimdMarkdownField-Vp72mf5d.js → AimdMarkdownField-Dd6M3zOI.js} +18 -18
- package/dist/{AimdMarkdownNoteField-8AHO9zwW.js → AimdMarkdownNoteField-DCkJg80X.js} +23 -23
- package/dist/aimd-recorder.css +1 -1
- package/dist/{arc-YTgUVhxi.js → arc-Bw7VOW6S.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-BFddgj3h.js → architectureDiagram-3BPJPVTR-B4RdL02h.js} +2 -2
- package/dist/{blockDiagram-GPEHLZMM-BNFU64lo.js → blockDiagram-GPEHLZMM-B5skMgx6.js} +4 -4
- package/dist/{c4Diagram-AAUBKEIU-DDg-ymRq.js → c4Diagram-AAUBKEIU-DDxL4a7C.js} +2 -2
- package/dist/{channel-Cswcnlp1.js → channel-CQ1fnqoz.js} +1 -1
- package/dist/{chunk-2J33WTMH-CP2V6jff.js → chunk-2J33WTMH-B08Yr5NK.js} +1 -1
- package/dist/{chunk-4BX2VUAB-CbWr2vv6.js → chunk-4BX2VUAB-CyCffaPa.js} +1 -1
- package/dist/{chunk-55IACEB6-DQOKhaUL.js → chunk-55IACEB6-CztHyBOI.js} +1 -1
- package/dist/{chunk-727SXJPM-4VuCu0m8.js → chunk-727SXJPM-CEVNkjmn.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-D7Pq-oug.js → chunk-AQP2D5EJ-C9t9hFOg.js} +3 -3
- package/dist/{chunk-FMBD7UC4-slF0wbDn.js → chunk-FMBD7UC4-ulCTg3qb.js} +1 -1
- package/dist/{chunk-ND2GUHAM-BrNrmeyL.js → chunk-ND2GUHAM-D4Cbj52r.js} +1 -1
- package/dist/{chunk-QZHKN3VN-CII3oQmH.js → chunk-QZHKN3VN-Rpw3UPGi.js} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-skT5SNaU.js → classDiagram-4FO5ZUOK-D8dNLFoj.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-skT5SNaU.js → classDiagram-v2-Q7XG4LA2-D8dNLFoj.js} +2 -2
- package/dist/components.js +3935 -3121
- package/dist/composables.js +94 -90
- package/dist/{cose-bilkent-S5V4N54A-CiwUUHaz.js → cose-bilkent-S5V4N54A-CzjADqxr.js} +1 -1
- package/dist/{dagre-BM42HDAG-BzaKejHz.js → dagre-BM42HDAG-C79MwQe7.js} +3 -3
- package/dist/{diagram-2AECGRRQ-B7jPt7Sf.js → diagram-2AECGRRQ-DaQ7DMBK.js} +2 -2
- package/dist/{diagram-5GNKFQAL-z6ygEwZY.js → diagram-5GNKFQAL-BpWKnfL3.js} +3 -3
- package/dist/{diagram-KO2AKTUF-BBQMMIgY.js → diagram-KO2AKTUF-CedxET4p.js} +2 -2
- package/dist/{diagram-LMA3HP47-IFDVFs2m.js → diagram-LMA3HP47-FKe9tb0g.js} +2 -2
- package/dist/{diagram-OG6HWLK6-DjEAxof0.js → diagram-OG6HWLK6-Bmb8IKvp.js} +3 -3
- package/dist/{erDiagram-TEJ5UH35-DxMYC2Iw.js → erDiagram-TEJ5UH35-Chalz_c9.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-EIHEHG32.js → flowDiagram-I6XJVG4X-DPelWotf.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-TEOWSxVA.js → ganttDiagram-6RSMTGT7-o_Jm8a5l.js} +2 -2
- package/dist/{gitGraphDiagram-PVQCEYII-Cwzy4bEc.js → gitGraphDiagram-PVQCEYII-BiwDVfiM.js} +3 -3
- package/dist/{graph-Cyx6ry93.js → graph-_GsibXVP.js} +1 -1
- package/dist/index-CGb0O6x4.js +2660 -0
- package/dist/index.js +118 -112
- package/dist/{infoDiagram-5YYISTIA-DNv6Z1ol.js → infoDiagram-5YYISTIA-CaVHW6oJ.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-D3eaxgy9.js → ishikawaDiagram-YF4QCWOH--qCCMUuo.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-D5g7q2RP.js → journeyDiagram-JHISSGLW-BsT-p1ex.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-C0hUSCKH.js → kanban-definition-UN3LZRKU-oCTOaobR.js} +2 -2
- package/dist/{layout-CpB8OqeJ.js → layout-CAhsv4x8.js} +2 -2
- package/dist/{linear-D55SCqYq.js → linear-CumggsyF.js} +1 -1
- package/dist/{mermaid.core-wqUqC7-u.js → mermaid.core-D4wVfZ2X.js} +34 -34
- package/dist/{mindmap-definition-RKZ34NQL-tCWbcVMf.js → mindmap-definition-RKZ34NQL-NTgweVec.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-JtTllP1a.js → pieDiagram-4H26LBE5-C1UJkrIn.js} +3 -3
- package/dist/{quadrantDiagram-W4KKPZXB-CLL79FuD.js → quadrantDiagram-W4KKPZXB-rCJc8QbP.js} +2 -2
- package/dist/record.js +18 -18
- package/dist/{requirementDiagram-4Y6WPE33-3BVAevi9.js → requirementDiagram-4Y6WPE33-BzHGaPaB.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-BfUuX3gj.js → sankeyDiagram-5OEKKPKP-B--uus9e.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-vTd4YJPb.js → sequenceDiagram-3UESZ5HK-D7javnYQ.js} +3 -3
- package/dist/{stateDiagram-AJRCARHV-BzlMdp-U.js → stateDiagram-AJRCARHV-DPsstQ8f.js} +4 -4
- package/dist/{stateDiagram-v2-BHNVJYJU-Ciwlhuza.js → stateDiagram-v2-BHNVJYJU-BhhRcq6R.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-CySiSuYS.js → timeline-definition-PNZ67QCA-DgnJrK74.js} +2 -2
- package/dist/useCodeBlockRendering-f5pBgZ96.js +5083 -0
- package/dist/{vennDiagram-CIIHVFJN-Bbf0BSAq.js → vennDiagram-CIIHVFJN-D1Q51ENl.js} +1 -1
- package/dist/{wardleyDiagram-YWT4CUSO-J0jnd8EV.js → wardleyDiagram-YWT4CUSO-DMfLoeaa.js} +2 -2
- package/dist/{xychartDiagram-2RQKCTM6-XCPLxT4O.js → xychartDiagram-2RQKCTM6-DzF8t-UA.js} +2 -2
- package/package.json +4 -4
- package/src/__tests__/collector-field.test.ts +269 -0
- package/src/__tests__/record-search-render.test.ts +109 -0
- package/src/__tests__/var-field-render.test.ts +126 -62
- package/src/components/AimdCollectorField.vue +233 -0
- package/src/components/AimdEntityRefField.vue +314 -0
- package/src/components/AimdQuizRecorder.vue +3 -1
- package/src/components/AimdRecorder.vue +160 -2345
- package/src/components/AimdRecorderEditor.vue +23 -0
- package/src/components/AimdRecorderSearchToolbar.vue +258 -0
- package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +31 -0
- package/src/components/AimdVarField.vue +39 -2
- package/src/components/AimdVarTableField.vue +2 -1
- package/src/components/index.ts +5 -0
- package/src/components/recorderMilkdownPlugin.ts +9 -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/useRecordSearch.ts +299 -0
- package/src/composables/useVarHelpers.ts +130 -2
- package/src/index.ts +20 -2
- package/src/locales.ts +144 -0
- package/src/styles/collector-field.css +281 -0
- package/src/styles/recorder-surface.css +2537 -0
- package/src/styles/recorder.css +2 -0
- package/src/types.ts +127 -1
- package/dist/index-Dtvv88SS.js +0 -1308
- package/dist/useCodeBlockRendering-DtcAJyK9.js +0 -6103
|
@@ -9,8 +9,11 @@ import type {
|
|
|
9
9
|
AimdAssignerMap,
|
|
10
10
|
AimdAssignerRunner,
|
|
11
11
|
AimdChoiceOptionExplanationMode,
|
|
12
|
+
AimdCollectorPermissionHandler,
|
|
13
|
+
AimdCollectorProviderMap,
|
|
12
14
|
AimdServerAssignerMap,
|
|
13
15
|
AimdServerAssignerRunner,
|
|
16
|
+
AimdEntityResolverMap,
|
|
14
17
|
AimdFileInfoResolver,
|
|
15
18
|
AimdFileUploadHandler,
|
|
16
19
|
AimdFieldMeta,
|
|
@@ -73,6 +76,11 @@ const props = withDefaults(defineProps<{
|
|
|
73
76
|
wrapField?: (fieldKey: string, fieldType: string, defaultVNode: any) => any
|
|
74
77
|
customRenderers?: Partial<Record<string, AimdComponentRenderer>>
|
|
75
78
|
fieldAdapters?: AimdRecorderFieldAdapters
|
|
79
|
+
entityResolvers?: AimdEntityResolverMap
|
|
80
|
+
collectorProviders?: AimdCollectorProviderMap
|
|
81
|
+
requestCollectorPermission?: AimdCollectorPermissionHandler
|
|
82
|
+
collectorActorId?: string
|
|
83
|
+
collectorRecordKey?: string | number
|
|
76
84
|
resolveFile?: (src: string) => string | null
|
|
77
85
|
resolveFileInfo?: AimdFileInfoResolver
|
|
78
86
|
uploadFile?: AimdFileUploadHandler
|
|
@@ -121,6 +129,11 @@ const props = withDefaults(defineProps<{
|
|
|
121
129
|
wrapField: undefined,
|
|
122
130
|
customRenderers: undefined,
|
|
123
131
|
fieldAdapters: undefined,
|
|
132
|
+
entityResolvers: undefined,
|
|
133
|
+
collectorProviders: undefined,
|
|
134
|
+
requestCollectorPermission: undefined,
|
|
135
|
+
collectorActorId: undefined,
|
|
136
|
+
collectorRecordKey: undefined,
|
|
124
137
|
resolveFile: undefined,
|
|
125
138
|
resolveFileInfo: undefined,
|
|
126
139
|
uploadFile: undefined,
|
|
@@ -1453,6 +1466,11 @@ defineExpose({
|
|
|
1453
1466
|
:wrap-field="wrapField"
|
|
1454
1467
|
:custom-renderers="customRenderers"
|
|
1455
1468
|
:field-adapters="fieldAdapters"
|
|
1469
|
+
:entity-resolvers="entityResolvers"
|
|
1470
|
+
:collector-providers="collectorProviders"
|
|
1471
|
+
:request-collector-permission="requestCollectorPermission"
|
|
1472
|
+
:collector-actor-id="collectorActorId"
|
|
1473
|
+
:collector-record-key="collectorRecordKey"
|
|
1456
1474
|
:resolve-file="resolveFile"
|
|
1457
1475
|
:resolve-file-info="resolveFileInfo"
|
|
1458
1476
|
:upload-file="uploadFile"
|
|
@@ -1497,6 +1515,11 @@ defineExpose({
|
|
|
1497
1515
|
:wrap-field="renderVisualEditWrapper"
|
|
1498
1516
|
:custom-renderers="customRenderers"
|
|
1499
1517
|
:field-adapters="fieldAdapters"
|
|
1518
|
+
:entity-resolvers="entityResolvers"
|
|
1519
|
+
:collector-providers="collectorProviders"
|
|
1520
|
+
:request-collector-permission="requestCollectorPermission"
|
|
1521
|
+
:collector-actor-id="collectorActorId"
|
|
1522
|
+
:collector-record-key="collectorRecordKey"
|
|
1500
1523
|
:resolve-file="resolveFile"
|
|
1501
1524
|
:resolve-file-info="resolveFileInfo"
|
|
1502
1525
|
:upload-file="uploadFile"
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick, ref, watch } from "vue"
|
|
3
|
+
import type { AimdRecordFieldRef } from "@airalogy/aimd-core/utils"
|
|
4
|
+
import type { AimdRecorderMessages } from "../locales"
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
fieldKey: string
|
|
8
|
+
fieldRefs: AimdRecordFieldRef[]
|
|
9
|
+
matchCount: number
|
|
10
|
+
messages: AimdRecorderMessages
|
|
11
|
+
panelVisible: boolean
|
|
12
|
+
query: string
|
|
13
|
+
resultLabel: string
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(event: "clear"): void
|
|
18
|
+
(event: "collapse"): void
|
|
19
|
+
(event: "expand"): void
|
|
20
|
+
(event: "next"): void
|
|
21
|
+
(event: "previous"): void
|
|
22
|
+
(event: "update:fieldKey", value: string): void
|
|
23
|
+
(event: "update:query", value: string): void
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const searchInputRef = ref<HTMLInputElement | null>(null)
|
|
27
|
+
|
|
28
|
+
watch(
|
|
29
|
+
() => props.panelVisible,
|
|
30
|
+
async (panelVisible) => {
|
|
31
|
+
if (!panelVisible) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
await nextTick()
|
|
35
|
+
searchInputRef.value?.focus()
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
class="aimd-protocol-recorder__search-shell"
|
|
43
|
+
:class="{ 'aimd-protocol-recorder__search-shell--expanded': panelVisible }"
|
|
44
|
+
>
|
|
45
|
+
<button
|
|
46
|
+
v-if="!panelVisible"
|
|
47
|
+
type="button"
|
|
48
|
+
class="aimd-protocol-recorder__search-toggle"
|
|
49
|
+
data-rec-search-toggle
|
|
50
|
+
:aria-label="messages.search.label"
|
|
51
|
+
@click="emit('expand')"
|
|
52
|
+
>
|
|
53
|
+
{{ messages.search.label }}
|
|
54
|
+
</button>
|
|
55
|
+
<div v-else class="aimd-protocol-recorder__search">
|
|
56
|
+
<select
|
|
57
|
+
class="aimd-protocol-recorder__search-field"
|
|
58
|
+
:aria-label="messages.search.fieldLabel"
|
|
59
|
+
:value="fieldKey"
|
|
60
|
+
@change="emit('update:fieldKey', ($event.target as HTMLSelectElement).value)"
|
|
61
|
+
>
|
|
62
|
+
<option value="">{{ messages.search.allFields }}</option>
|
|
63
|
+
<option
|
|
64
|
+
v-for="field in fieldRefs"
|
|
65
|
+
:key="field.key"
|
|
66
|
+
:value="field.key"
|
|
67
|
+
>
|
|
68
|
+
{{ field.label }}
|
|
69
|
+
</option>
|
|
70
|
+
</select>
|
|
71
|
+
<input
|
|
72
|
+
ref="searchInputRef"
|
|
73
|
+
class="aimd-protocol-recorder__search-input"
|
|
74
|
+
type="search"
|
|
75
|
+
:value="query"
|
|
76
|
+
:placeholder="messages.search.placeholder"
|
|
77
|
+
:aria-label="messages.search.label"
|
|
78
|
+
@input="emit('update:query', ($event.target as HTMLInputElement).value)"
|
|
79
|
+
@keydown.enter.prevent="emit('next')"
|
|
80
|
+
>
|
|
81
|
+
<span v-if="resultLabel" class="aimd-protocol-recorder__search-count">
|
|
82
|
+
{{ resultLabel }}
|
|
83
|
+
</span>
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
class="aimd-protocol-recorder__search-button"
|
|
87
|
+
:disabled="matchCount === 0"
|
|
88
|
+
:aria-label="messages.search.previous"
|
|
89
|
+
:title="messages.search.previous"
|
|
90
|
+
@click="emit('previous')"
|
|
91
|
+
>
|
|
92
|
+
<
|
|
93
|
+
</button>
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
class="aimd-protocol-recorder__search-button"
|
|
97
|
+
:disabled="matchCount === 0"
|
|
98
|
+
:aria-label="messages.search.next"
|
|
99
|
+
:title="messages.search.next"
|
|
100
|
+
@click="emit('next')"
|
|
101
|
+
>
|
|
102
|
+
>
|
|
103
|
+
</button>
|
|
104
|
+
<button
|
|
105
|
+
v-if="query || fieldKey"
|
|
106
|
+
type="button"
|
|
107
|
+
class="aimd-protocol-recorder__search-button aimd-protocol-recorder__search-button--clear"
|
|
108
|
+
:aria-label="messages.search.clear"
|
|
109
|
+
:title="messages.search.clear"
|
|
110
|
+
@click="emit('clear')"
|
|
111
|
+
>
|
|
112
|
+
x
|
|
113
|
+
</button>
|
|
114
|
+
<button
|
|
115
|
+
v-else
|
|
116
|
+
type="button"
|
|
117
|
+
class="aimd-protocol-recorder__search-button aimd-protocol-recorder__search-button--collapse"
|
|
118
|
+
data-rec-search-collapse
|
|
119
|
+
:aria-label="messages.search.collapse"
|
|
120
|
+
:title="messages.search.collapse"
|
|
121
|
+
@click="emit('collapse')"
|
|
122
|
+
>
|
|
123
|
+
{{ messages.search.collapse }}
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style scoped>
|
|
130
|
+
.aimd-protocol-recorder__search-shell {
|
|
131
|
+
position: sticky;
|
|
132
|
+
top: var(--aimd-recorder-search-sticky-top, 0px);
|
|
133
|
+
z-index: 30;
|
|
134
|
+
display: flex;
|
|
135
|
+
justify-content: flex-end;
|
|
136
|
+
box-sizing: border-box;
|
|
137
|
+
margin-inline: calc(-1 * var(--aimd-recorder-gutter-x));
|
|
138
|
+
margin-bottom: 0;
|
|
139
|
+
padding: 0 var(--aimd-recorder-gutter-x);
|
|
140
|
+
background: transparent;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.aimd-protocol-recorder__search-shell--expanded {
|
|
145
|
+
justify-content: stretch;
|
|
146
|
+
margin-bottom: 8px;
|
|
147
|
+
padding-block: 0;
|
|
148
|
+
padding-inline: var(--aimd-recorder-gutter-x);
|
|
149
|
+
border: 1px solid #d8e4f2;
|
|
150
|
+
border-radius: 0 0 10px 10px;
|
|
151
|
+
background: #f8fbff;
|
|
152
|
+
backdrop-filter: blur(4px);
|
|
153
|
+
box-shadow: 0 1px 0 rgba(23, 45, 77, 0.06);
|
|
154
|
+
pointer-events: auto;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.aimd-protocol-recorder__search {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex: 1 1 auto;
|
|
160
|
+
flex-wrap: wrap;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
padding: 8px;
|
|
164
|
+
border: 0;
|
|
165
|
+
border-radius: 0;
|
|
166
|
+
background: transparent;
|
|
167
|
+
box-shadow: none;
|
|
168
|
+
pointer-events: auto;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.aimd-protocol-recorder__search-toggle {
|
|
172
|
+
display: inline-flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
min-height: 32px;
|
|
176
|
+
padding: 0 12px;
|
|
177
|
+
border: 1px solid #c8d4e3;
|
|
178
|
+
border-radius: 8px;
|
|
179
|
+
background: #fff;
|
|
180
|
+
color: #0b63c7;
|
|
181
|
+
font: inherit;
|
|
182
|
+
font-weight: 700;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
box-shadow: 0 2px 8px rgba(23, 45, 77, 0.06);
|
|
185
|
+
pointer-events: auto;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.aimd-protocol-recorder__search-field,
|
|
189
|
+
.aimd-protocol-recorder__search-input {
|
|
190
|
+
min-height: 32px;
|
|
191
|
+
border: 1px solid #c8d4e3;
|
|
192
|
+
border-radius: 8px;
|
|
193
|
+
background: #fff;
|
|
194
|
+
color: var(--rec-text);
|
|
195
|
+
font: inherit;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.aimd-protocol-recorder__search-field {
|
|
199
|
+
max-width: min(240px, 100%);
|
|
200
|
+
padding: 0 28px 0 10px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.aimd-protocol-recorder__search-input {
|
|
204
|
+
flex: 1 1 240px;
|
|
205
|
+
min-width: min(220px, 100%);
|
|
206
|
+
padding: 0 10px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.aimd-protocol-recorder__search-field:focus,
|
|
210
|
+
.aimd-protocol-recorder__search-input:focus,
|
|
211
|
+
.aimd-protocol-recorder__search-toggle:focus,
|
|
212
|
+
.aimd-protocol-recorder__search-button:focus {
|
|
213
|
+
outline: 2px solid color-mix(in srgb, var(--rec-focus) 26%, transparent);
|
|
214
|
+
outline-offset: 1px;
|
|
215
|
+
border-color: #75b7ff;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.aimd-protocol-recorder__search-count {
|
|
219
|
+
min-width: 72px;
|
|
220
|
+
color: var(--rec-muted);
|
|
221
|
+
font-size: 12px;
|
|
222
|
+
font-weight: 600;
|
|
223
|
+
text-align: center;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.aimd-protocol-recorder__search-button {
|
|
227
|
+
display: inline-flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
justify-content: center;
|
|
230
|
+
width: 32px;
|
|
231
|
+
height: 32px;
|
|
232
|
+
border: 1px solid #c8d4e3;
|
|
233
|
+
border-radius: 8px;
|
|
234
|
+
background: #fff;
|
|
235
|
+
color: #0b63c7;
|
|
236
|
+
font: inherit;
|
|
237
|
+
font-weight: 700;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.aimd-protocol-recorder__search-button:disabled {
|
|
242
|
+
color: #98a2b3;
|
|
243
|
+
cursor: default;
|
|
244
|
+
opacity: 0.65;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.aimd-protocol-recorder__search-button--clear {
|
|
248
|
+
color: #475467;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.aimd-protocol-recorder__search-button--collapse {
|
|
252
|
+
width: auto;
|
|
253
|
+
min-width: 48px;
|
|
254
|
+
padding: 0 10px;
|
|
255
|
+
color: #475467;
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
}
|
|
258
|
+
</style>
|
|
@@ -41,6 +41,12 @@ const renderedContent = computed(() => (
|
|
|
41
41
|
:wrap-field="surfaceState.wrapField"
|
|
42
42
|
:custom-renderers="surfaceState.customRenderers"
|
|
43
43
|
:field-adapters="surfaceState.fieldAdapters"
|
|
44
|
+
:entity-resolvers="surfaceState.entityResolvers"
|
|
45
|
+
:collector-providers="surfaceState.collectorProviders"
|
|
46
|
+
:request-collector-permission="surfaceState.requestCollectorPermission"
|
|
47
|
+
:collector-actor-id="surfaceState.collectorActorId"
|
|
48
|
+
:collector-record-key="surfaceState.collectorRecordKey"
|
|
49
|
+
:protocol-context="surfaceState.protocolContext"
|
|
44
50
|
:resolve-file="surfaceState.resolveFile"
|
|
45
51
|
:resolve-file-info="surfaceState.resolveFileInfo"
|
|
46
52
|
:upload-file="surfaceState.uploadFile"
|
|
@@ -19,8 +19,11 @@ import type {
|
|
|
19
19
|
AimdAssignerMap,
|
|
20
20
|
AimdAssignerRunner,
|
|
21
21
|
AimdChoiceOptionExplanationMode,
|
|
22
|
+
AimdCollectorPermissionHandler,
|
|
23
|
+
AimdCollectorProviderMap,
|
|
22
24
|
AimdServerAssignerMap,
|
|
23
25
|
AimdServerAssignerRunner,
|
|
26
|
+
AimdEntityResolverMap,
|
|
24
27
|
AimdFileInfoResolver,
|
|
25
28
|
AimdFileUploadHandler,
|
|
26
29
|
AimdFieldMeta,
|
|
@@ -72,6 +75,11 @@ const props = withDefaults(defineProps<{
|
|
|
72
75
|
wrapField?: (fieldKey: string, fieldType: string, defaultVNode: any) => any
|
|
73
76
|
customRenderers?: Partial<Record<string, AimdComponentRenderer>>
|
|
74
77
|
fieldAdapters?: AimdRecorderFieldAdapters
|
|
78
|
+
entityResolvers?: AimdEntityResolverMap
|
|
79
|
+
collectorProviders?: AimdCollectorProviderMap
|
|
80
|
+
requestCollectorPermission?: AimdCollectorPermissionHandler
|
|
81
|
+
collectorActorId?: string
|
|
82
|
+
collectorRecordKey?: string | number
|
|
75
83
|
resolveFile?: (src: string) => string | null
|
|
76
84
|
resolveFileInfo?: AimdFileInfoResolver
|
|
77
85
|
uploadFile?: AimdFileUploadHandler
|
|
@@ -100,6 +108,11 @@ const props = withDefaults(defineProps<{
|
|
|
100
108
|
wrapField: undefined,
|
|
101
109
|
customRenderers: undefined,
|
|
102
110
|
fieldAdapters: undefined,
|
|
111
|
+
entityResolvers: undefined,
|
|
112
|
+
collectorProviders: undefined,
|
|
113
|
+
requestCollectorPermission: undefined,
|
|
114
|
+
collectorActorId: undefined,
|
|
115
|
+
collectorRecordKey: undefined,
|
|
103
116
|
resolveFile: undefined,
|
|
104
117
|
resolveFileInfo: undefined,
|
|
105
118
|
uploadFile: undefined,
|
|
@@ -173,6 +186,12 @@ watch(content, (value) => {
|
|
|
173
186
|
|
|
174
187
|
const recordState = reactive(createEmptyProtocolRecordData())
|
|
175
188
|
|
|
189
|
+
function extractProtocolContext(source: string): string {
|
|
190
|
+
const registryBlocks = source.match(/```(?:connectors|collectors)(?:[^\n]*)\n[\s\S]*?```/g) ?? []
|
|
191
|
+
const stepFields = source.match(/\{\{step\|[\s\S]*?\}\}/g) ?? []
|
|
192
|
+
return [...registryBlocks, ...stepFields].join('\n\n')
|
|
193
|
+
}
|
|
194
|
+
|
|
176
195
|
watch(() => props.modelValue, (value) => {
|
|
177
196
|
const normalized = normalizeIncomingRecord(value)
|
|
178
197
|
if (getRecordDataSignature(normalized) === getRecordDataSignature(recordState)) {
|
|
@@ -206,6 +225,12 @@ const surfaceState = reactive<RecorderMilkdownSurfaceState>({
|
|
|
206
225
|
wrapField: props.wrapField,
|
|
207
226
|
customRenderers: props.customRenderers,
|
|
208
227
|
fieldAdapters: props.fieldAdapters,
|
|
228
|
+
entityResolvers: props.entityResolvers,
|
|
229
|
+
collectorProviders: props.collectorProviders,
|
|
230
|
+
requestCollectorPermission: props.requestCollectorPermission,
|
|
231
|
+
collectorActorId: props.collectorActorId,
|
|
232
|
+
collectorRecordKey: props.collectorRecordKey,
|
|
233
|
+
protocolContext: extractProtocolContext(content.value),
|
|
209
234
|
resolveFile: props.resolveFile,
|
|
210
235
|
resolveFileInfo: props.resolveFileInfo,
|
|
211
236
|
uploadFile: props.uploadFile,
|
|
@@ -240,6 +265,12 @@ watchEffect(() => {
|
|
|
240
265
|
surfaceState.wrapField = props.wrapField
|
|
241
266
|
surfaceState.customRenderers = props.customRenderers
|
|
242
267
|
surfaceState.fieldAdapters = props.fieldAdapters
|
|
268
|
+
surfaceState.entityResolvers = props.entityResolvers
|
|
269
|
+
surfaceState.collectorProviders = props.collectorProviders
|
|
270
|
+
surfaceState.requestCollectorPermission = props.requestCollectorPermission
|
|
271
|
+
surfaceState.collectorActorId = props.collectorActorId
|
|
272
|
+
surfaceState.collectorRecordKey = props.collectorRecordKey
|
|
273
|
+
surfaceState.protocolContext = extractProtocolContext(content.value)
|
|
243
274
|
surfaceState.resolveFile = props.resolveFile
|
|
244
275
|
surfaceState.resolveFileInfo = props.resolveFileInfo
|
|
245
276
|
surfaceState.uploadFile = props.uploadFile
|
|
@@ -10,9 +10,11 @@ import {
|
|
|
10
10
|
} from "@airalogy/aimd-core/utils"
|
|
11
11
|
import type {
|
|
12
12
|
AimdFieldMeta,
|
|
13
|
+
AimdEntityResolverMap,
|
|
13
14
|
AimdFileInfoResolver,
|
|
14
15
|
AimdFileResolveContext,
|
|
15
16
|
AimdFileUploadHandler,
|
|
17
|
+
AimdProtocolRecordData,
|
|
16
18
|
AimdResolvedFileInfo,
|
|
17
19
|
AimdTypePlugin,
|
|
18
20
|
AimdVarInputKind,
|
|
@@ -34,6 +36,7 @@ import {
|
|
|
34
36
|
getFileInputConfig,
|
|
35
37
|
getScalarListInputItems,
|
|
36
38
|
getScalarListItemType,
|
|
39
|
+
getEntityRefTypeConfig,
|
|
37
40
|
getVarEnumSelectValue,
|
|
38
41
|
getVarEnumValueFromSelectValue,
|
|
39
42
|
isNullableVarType,
|
|
@@ -44,6 +47,7 @@ import {
|
|
|
44
47
|
} from "../composables/useVarHelpers"
|
|
45
48
|
|
|
46
49
|
const AimdCodeField = defineAsyncComponent(() => import("./AimdCodeField.vue"))
|
|
50
|
+
const AimdEntityRefField = defineAsyncComponent(() => import("./AimdEntityRefField.vue"))
|
|
47
51
|
|
|
48
52
|
function normalizeMetaString(value: unknown): string | undefined {
|
|
49
53
|
return typeof value === "string" && value.trim() ? value.trim() : undefined
|
|
@@ -494,6 +498,11 @@ export default defineComponent({
|
|
|
494
498
|
uploadFile: { type: Function as PropType<AimdFileUploadHandler | undefined>, default: undefined },
|
|
495
499
|
resolveFile: { type: Function as PropType<((src: string) => string | null) | undefined>, default: undefined },
|
|
496
500
|
resolveFileInfo: { type: Function as PropType<AimdFileInfoResolver | undefined>, default: undefined },
|
|
501
|
+
entityResolvers: { type: Object as PropType<AimdEntityResolverMap | undefined>, default: undefined },
|
|
502
|
+
record: {
|
|
503
|
+
type: Object as PropType<AimdProtocolRecordData>,
|
|
504
|
+
default: () => ({ var: {}, step: {}, check: {}, quiz: {} }),
|
|
505
|
+
},
|
|
497
506
|
},
|
|
498
507
|
emits: ["change", "blur"],
|
|
499
508
|
setup(props, { emit }) {
|
|
@@ -674,7 +683,10 @@ export default defineComponent({
|
|
|
674
683
|
}
|
|
675
684
|
}
|
|
676
685
|
|
|
677
|
-
function syncCompositeControlLayout(control:
|
|
686
|
+
function syncCompositeControlLayout(control: Element | null | undefined) {
|
|
687
|
+
if (!(control instanceof HTMLElement)) {
|
|
688
|
+
return
|
|
689
|
+
}
|
|
678
690
|
applyVarStackWidth(control, inputKind)
|
|
679
691
|
}
|
|
680
692
|
|
|
@@ -720,7 +732,7 @@ export default defineComponent({
|
|
|
720
732
|
}
|
|
721
733
|
|
|
722
734
|
const renderHeaderAssignerActions = (headerAction?: VNode | null): VNode | null => {
|
|
723
|
-
const hasAssignerActions = ["file", "code", "scalar-list"].includes(inputKind) && Boolean(props.assignerControl || props.assignerStatus)
|
|
735
|
+
const hasAssignerActions = ["file", "code", "scalar-list", "entity-ref"].includes(inputKind) && Boolean(props.assignerControl || props.assignerStatus)
|
|
724
736
|
if (!headerAction && !hasAssignerActions) {
|
|
725
737
|
return null
|
|
726
738
|
}
|
|
@@ -926,6 +938,31 @@ export default defineComponent({
|
|
|
926
938
|
)
|
|
927
939
|
}
|
|
928
940
|
|
|
941
|
+
if (inputKind === "entity-ref") {
|
|
942
|
+
const entityConfig = getEntityRefTypeConfig(type, node.definition?.kwargs, meta) ?? { multiple: false }
|
|
943
|
+
return renderStackedVar(
|
|
944
|
+
h(AimdEntityRefField, {
|
|
945
|
+
node,
|
|
946
|
+
value: props.value,
|
|
947
|
+
disabled,
|
|
948
|
+
messages: props.messages,
|
|
949
|
+
fieldMeta: meta,
|
|
950
|
+
type,
|
|
951
|
+
entityConfig,
|
|
952
|
+
entityResolvers: props.entityResolvers,
|
|
953
|
+
record: props.record,
|
|
954
|
+
onVnodeMounted: (vnode: any) => syncCompositeControlLayout(vnode.el as HTMLElement),
|
|
955
|
+
onVnodeUpdated: (vnode: any) => syncCompositeControlLayout(vnode.el as HTMLElement),
|
|
956
|
+
onChange: (payload: { value: unknown }) => {
|
|
957
|
+
emit("change", { id, value: payload.value, type, inputKind })
|
|
958
|
+
},
|
|
959
|
+
onBlur: onVarBlur,
|
|
960
|
+
}),
|
|
961
|
+
"aimd-rec-inline--var-stacked--entity-ref",
|
|
962
|
+
{ controlRow: false },
|
|
963
|
+
)
|
|
964
|
+
}
|
|
965
|
+
|
|
929
966
|
if (inputKind === "file") {
|
|
930
967
|
const fileConfig = getFileInputConfig(type, node.definition?.kwargs, meta)
|
|
931
968
|
const fileId = getFileValueId(props.value)
|
|
@@ -143,6 +143,7 @@ export default defineComponent({
|
|
|
143
143
|
columns: { type: Array as PropType<string[]>, required: true },
|
|
144
144
|
disabled: { type: Boolean, default: false },
|
|
145
145
|
readonly: { type: Boolean, default: false },
|
|
146
|
+
extraClasses: { type: Array as PropType<string[]>, default: () => [] },
|
|
146
147
|
settlingRowKey: { type: String as PropType<string | null>, default: null },
|
|
147
148
|
messages: { type: Object as PropType<AimdRecorderMessages>, required: true },
|
|
148
149
|
fieldMeta: { type: Object as PropType<Record<string, AimdFieldMeta> | undefined>, default: undefined },
|
|
@@ -534,7 +535,7 @@ export default defineComponent({
|
|
|
534
535
|
|
|
535
536
|
return h("div", {
|
|
536
537
|
ref: wrapperRef,
|
|
537
|
-
class: "aimd-field aimd-field--var-table aimd-rec-inline-table",
|
|
538
|
+
class: ["aimd-field aimd-field--var-table aimd-rec-inline-table", ...props.extraClasses],
|
|
538
539
|
"data-aimd-table-name": tableName,
|
|
539
540
|
"data-aimd-table-layout": layoutReady.value && isOverflow.value ? "cards" : "table",
|
|
540
541
|
}, [
|
package/src/components/index.ts
CHANGED
|
@@ -6,19 +6,24 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { defineAsyncComponent } from "vue"
|
|
9
|
+
import "../styles/recorder.css"
|
|
9
10
|
import AimdAssignerGraph from "./AimdAssignerGraph.vue"
|
|
11
|
+
import AimdCollectorField from "./AimdCollectorField.vue"
|
|
10
12
|
import AimdRecorder from "./AimdRecorder.vue"
|
|
11
13
|
import AimdRecorderEditor from "./AimdRecorderEditor.vue"
|
|
12
14
|
import AimdQuizRecorder from "./AimdQuizRecorder.vue"
|
|
13
15
|
|
|
14
16
|
const AimdDnaSequenceField = defineAsyncComponent(() => import("./AimdDnaSequenceField.vue"))
|
|
15
17
|
const AimdMarkdownField = defineAsyncComponent(() => import("./AimdMarkdownField.vue"))
|
|
18
|
+
const AimdEntityRefField = defineAsyncComponent(() => import("./AimdEntityRefField.vue"))
|
|
16
19
|
|
|
17
20
|
export {
|
|
18
21
|
AimdAssignerGraph,
|
|
22
|
+
AimdCollectorField,
|
|
19
23
|
AimdRecorder,
|
|
20
24
|
AimdRecorderEditor,
|
|
21
25
|
AimdQuizRecorder,
|
|
26
|
+
AimdEntityRefField,
|
|
22
27
|
AimdDnaSequenceField,
|
|
23
28
|
AimdMarkdownField,
|
|
24
29
|
}
|
|
@@ -19,8 +19,11 @@ import type {
|
|
|
19
19
|
AimdAssignerMap,
|
|
20
20
|
AimdAssignerRunner,
|
|
21
21
|
AimdChoiceOptionExplanationMode,
|
|
22
|
+
AimdCollectorPermissionHandler,
|
|
23
|
+
AimdCollectorProviderMap,
|
|
22
24
|
AimdServerAssignerMap,
|
|
23
25
|
AimdServerAssignerRunner,
|
|
26
|
+
AimdEntityResolverMap,
|
|
24
27
|
AimdFileInfoResolver,
|
|
25
28
|
AimdFileUploadHandler,
|
|
26
29
|
AimdFieldMeta,
|
|
@@ -63,6 +66,12 @@ export interface RecorderMilkdownSurfaceState {
|
|
|
63
66
|
wrapField?: (fieldKey: string, fieldType: string, defaultVNode: any) => any
|
|
64
67
|
customRenderers?: Partial<Record<string, AimdComponentRenderer>>
|
|
65
68
|
fieldAdapters?: AimdRecorderFieldAdapters
|
|
69
|
+
entityResolvers?: AimdEntityResolverMap
|
|
70
|
+
collectorProviders?: AimdCollectorProviderMap
|
|
71
|
+
requestCollectorPermission?: AimdCollectorPermissionHandler
|
|
72
|
+
collectorActorId?: string
|
|
73
|
+
collectorRecordKey?: string | number
|
|
74
|
+
protocolContext?: string
|
|
66
75
|
resolveFile?: (src: string) => string | null
|
|
67
76
|
resolveFileInfo?: AimdFileInfoResolver
|
|
68
77
|
uploadFile?: AimdFileUploadHandler
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
getVarInputKind,
|
|
7
7
|
getScalarListInputItems,
|
|
8
8
|
getScalarListItemType,
|
|
9
|
+
getEntityRefTypeConfig,
|
|
9
10
|
isNullableVarType,
|
|
11
|
+
isEntityRefVarType,
|
|
10
12
|
isScalarListVarType,
|
|
11
13
|
isStructuredVarType,
|
|
12
14
|
normalizeScalarListInputItems,
|
|
@@ -134,6 +136,15 @@ describe('getVarInputKind', () => {
|
|
|
134
136
|
expect(getVarInputKind('int[]')).toBe('scalar-list')
|
|
135
137
|
})
|
|
136
138
|
|
|
139
|
+
it('returns "entity-ref" for EntityRef types before structured list fallback', () => {
|
|
140
|
+
expect(getVarInputKind('EntityRef')).toBe('entity-ref')
|
|
141
|
+
expect(getVarInputKind('EntityRef | None')).toBe('entity-ref')
|
|
142
|
+
expect(getVarInputKind('Optional[EntityRef]')).toBe('entity-ref')
|
|
143
|
+
expect(getVarInputKind('list[EntityRef] | None')).toBe('entity-ref')
|
|
144
|
+
expect(getVarInputKind('EntityRef["plasmid"]')).toBe('entity-ref')
|
|
145
|
+
expect(getVarInputKind('list[EntityRef["plasmid"]]')).toBe('entity-ref')
|
|
146
|
+
})
|
|
147
|
+
|
|
137
148
|
it('returns "textarea" for structured non-scalar list and object types', () => {
|
|
138
149
|
expect(getVarInputKind('list')).toBe('textarea')
|
|
139
150
|
expect(getVarInputKind('list[bool]')).toBe('textarea')
|
|
@@ -170,6 +181,27 @@ describe('getVarInputKind', () => {
|
|
|
170
181
|
})
|
|
171
182
|
})
|
|
172
183
|
|
|
184
|
+
describe('EntityRef helpers', () => {
|
|
185
|
+
it('detects single and list EntityRef annotations', () => {
|
|
186
|
+
expect(isEntityRefVarType('EntityRef')).toBe(true)
|
|
187
|
+
expect(isEntityRefVarType('list[EntityRef]')).toBe(true)
|
|
188
|
+
expect(isEntityRefVarType('list[str]')).toBe(false)
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('extracts entity and source metadata from kwargs and generic syntax', () => {
|
|
192
|
+
expect(getEntityRefTypeConfig('EntityRef', { entity: 'plasmid', source: 'lab_plasmid_registry' })).toEqual({
|
|
193
|
+
multiple: false,
|
|
194
|
+
entity: 'plasmid',
|
|
195
|
+
source: 'lab_plasmid_registry',
|
|
196
|
+
})
|
|
197
|
+
expect(getEntityRefTypeConfig('list[EntityRef["plasmid"]] | None')).toEqual({
|
|
198
|
+
multiple: true,
|
|
199
|
+
entity: 'plasmid',
|
|
200
|
+
source: undefined,
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
|
|
173
205
|
// ---------------------------------------------------------------------------
|
|
174
206
|
// File-like vars
|
|
175
207
|
// ---------------------------------------------------------------------------
|
package/src/composables/index.ts
CHANGED
|
@@ -117,6 +117,18 @@ export {
|
|
|
117
117
|
} from './useVarTableDragDrop'
|
|
118
118
|
export type { VarTableDragState, VarTableDragDropOptions } from './useVarTableDragDrop'
|
|
119
119
|
|
|
120
|
+
export {
|
|
121
|
+
getAimdCollectorBinding,
|
|
122
|
+
getAimdCollectorManualValueType,
|
|
123
|
+
parseAimdCollectorManualValue,
|
|
124
|
+
useCollectors,
|
|
125
|
+
} from './useCollectors'
|
|
126
|
+
export type {
|
|
127
|
+
AimdCollectorBinding,
|
|
128
|
+
AimdCollectorManualValueResult,
|
|
129
|
+
AimdCollectorRuntimeOptions,
|
|
130
|
+
} from './useCollectors'
|
|
131
|
+
|
|
120
132
|
export { useFieldRendering } from './useFieldRendering'
|
|
121
133
|
export type { VarInputDisplayOverride, FieldRenderingOptions } from './useFieldRendering'
|
|
122
134
|
|