@petrarca/sonnet-playground 0.8.0 → 0.9.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 +10 -8
- package/dist/{PlayAdvancedComponents-ZYK66UII.js → PlayAdvancedComponents-VMUI472R.js} +2 -2
- package/dist/PlayCodeEditor-AMTFE5SW.js +8 -0
- package/dist/PlayCodedValues-G2EVIVMO.js +9 -0
- package/dist/{PlayCoreComponents-YTEAS3GL.js → PlayCoreComponents-EQ2BMY2S.js} +2 -2
- package/dist/{PlayDataComponents-W44OITT5.js → PlayDataComponents-W2KQHOI7.js} +2 -2
- package/dist/PlayFhirQuestionnaire-TO35Q7CP.js +8 -0
- package/dist/{PlayFormWidgets-6JYFRTAL.js → PlayFormWidgets-HP3VF2LK.js} +2 -2
- package/dist/PlayForms-4CQNEBLS.js +7 -0
- package/dist/PlayGraph-25ZKQAQR.js +7 -0
- package/dist/PlayGraph-25ZKQAQR.js.map +1 -0
- package/dist/PlayMarkdownViewer-X6AIFO2U.js +8 -0
- package/dist/PlayMarkdownViewer-X6AIFO2U.js.map +1 -0
- package/dist/PlayQuestionnaireDesigner-IR7TKSOT.js +9 -0
- package/dist/PlayQuestionnaireDesigner-IR7TKSOT.js.map +1 -0
- package/dist/PlaySchemaDesigner-ZQBA7AYO.js +8 -0
- package/dist/PlaySchemaDesigner-ZQBA7AYO.js.map +1 -0
- package/dist/{PlayShellApi-5O6VYR2X.js → PlayShellApi-MMCQ2AKK.js} +2 -2
- package/dist/PlayShellApi-MMCQ2AKK.js.map +1 -0
- package/dist/chunk-3FYM6B3E.js +1163 -0
- package/dist/chunk-3FYM6B3E.js.map +1 -0
- package/dist/{chunk-CQ6PGFRV.js → chunk-3RZHYZRL.js} +57 -1
- package/dist/chunk-3RZHYZRL.js.map +1 -0
- package/dist/chunk-7IMCPUSI.js +100 -0
- package/dist/chunk-7IMCPUSI.js.map +1 -0
- package/dist/{chunk-2XMWOZ5O.js → chunk-EPCUUTBZ.js} +48 -41
- package/dist/chunk-EPCUUTBZ.js.map +1 -0
- package/dist/{chunk-BRH3FFFT.js → chunk-LDCNLHO2.js} +15 -1
- package/dist/chunk-LDCNLHO2.js.map +1 -0
- package/dist/chunk-LVV32F7G.js +104 -0
- package/dist/chunk-LVV32F7G.js.map +1 -0
- package/dist/chunk-OUL3DN2E.js +510 -0
- package/dist/chunk-OUL3DN2E.js.map +1 -0
- package/dist/chunk-QKFQI4VX.js +83 -0
- package/dist/chunk-QKFQI4VX.js.map +1 -0
- package/dist/{chunk-6WI3N7JI.js → chunk-RGBSHXS5.js} +145 -4
- package/dist/chunk-RGBSHXS5.js.map +1 -0
- package/dist/{chunk-UB7462QG.js → chunk-RLJI5VMP.js} +72 -1
- package/dist/chunk-RLJI5VMP.js.map +1 -0
- package/dist/chunk-VGAS5Z6X.js +543 -0
- package/dist/chunk-VGAS5Z6X.js.map +1 -0
- package/dist/chunk-VKZ2RJFL.js +647 -0
- package/dist/chunk-VKZ2RJFL.js.map +1 -0
- package/dist/chunk-WR74TMW4.js +219 -0
- package/dist/chunk-WR74TMW4.js.map +1 -0
- package/dist/{chunk-E5X7GVLU.js → chunk-XNDD4UN4.js} +2 -2
- package/dist/chunk-XNDD4UN4.js.map +1 -0
- package/dist/chunk-YTGQRDD2.js +343 -0
- package/dist/chunk-YTGQRDD2.js.map +1 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.js +72 -11
- package/dist/index.js.map +1 -1
- package/dist/pages/index.d.ts +56 -20
- package/dist/pages/index.js +39 -17
- package/package.json +15 -14
- package/dist/PlayForms-U2TWUX5L.js +0 -7
- package/dist/PlayGraph-M4KQSFI7.js +0 -7
- package/dist/PlaySchemaDesigner-S4DBB53G.js +0 -7
- package/dist/chunk-2XMWOZ5O.js.map +0 -1
- package/dist/chunk-4Y4JFKAK.js +0 -240
- package/dist/chunk-4Y4JFKAK.js.map +0 -1
- package/dist/chunk-6WI3N7JI.js.map +0 -1
- package/dist/chunk-BRH3FFFT.js.map +0 -1
- package/dist/chunk-CQ6PGFRV.js.map +0 -1
- package/dist/chunk-E5X7GVLU.js.map +0 -1
- package/dist/chunk-O2QMWJZI.js +0 -881
- package/dist/chunk-O2QMWJZI.js.map +0 -1
- package/dist/chunk-UB7462QG.js.map +0 -1
- /package/dist/{PlayAdvancedComponents-ZYK66UII.js.map → PlayAdvancedComponents-VMUI472R.js.map} +0 -0
- /package/dist/{PlayCoreComponents-YTEAS3GL.js.map → PlayCodeEditor-AMTFE5SW.js.map} +0 -0
- /package/dist/{PlayDataComponents-W44OITT5.js.map → PlayCodedValues-G2EVIVMO.js.map} +0 -0
- /package/dist/{PlayFormWidgets-6JYFRTAL.js.map → PlayCoreComponents-EQ2BMY2S.js.map} +0 -0
- /package/dist/{PlayForms-U2TWUX5L.js.map → PlayDataComponents-W2KQHOI7.js.map} +0 -0
- /package/dist/{PlayGraph-M4KQSFI7.js.map → PlayFhirQuestionnaire-TO35Q7CP.js.map} +0 -0
- /package/dist/{PlaySchemaDesigner-S4DBB53G.js.map → PlayFormWidgets-HP3VF2LK.js.map} +0 -0
- /package/dist/{PlayShellApi-5O6VYR2X.js.map → PlayForms-4CQNEBLS.js.map} +0 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CWE,
|
|
3
|
+
HTTP_STATUS,
|
|
4
|
+
PLAYGROUND_TERMINOLOGY,
|
|
5
|
+
SPDX
|
|
6
|
+
} from "./chunk-WR74TMW4.js";
|
|
7
|
+
import {
|
|
8
|
+
DesignerControls
|
|
9
|
+
} from "./chunk-QKFQI4VX.js";
|
|
10
|
+
|
|
11
|
+
// src/pages/PlayQuestionnaireDesigner.tsx
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
import {
|
|
14
|
+
QuestionnaireDesigner,
|
|
15
|
+
SchemaDesigner
|
|
16
|
+
} from "@petrarca/sonnet-schema-designer";
|
|
17
|
+
import { ViewSwitch } from "@petrarca/sonnet-ui";
|
|
18
|
+
import { ClipboardList, PencilRuler } from "lucide-react";
|
|
19
|
+
import { TerminologyProvider } from "@petrarca/sonnet-core/terminology";
|
|
20
|
+
|
|
21
|
+
// src/pages/questionnaires/examples.ts
|
|
22
|
+
import {
|
|
23
|
+
CODING_TYPE_ID,
|
|
24
|
+
QUANTITY_TYPE_ID
|
|
25
|
+
} from "@petrarca/sonnet-core/schema";
|
|
26
|
+
import { CHOICE_WITH_TEXT_WIDGET } from "@petrarca/sonnet-schema-designer";
|
|
27
|
+
var FEEDBACK = {
|
|
28
|
+
schema: {
|
|
29
|
+
title: "Event feedback",
|
|
30
|
+
description: "Tell us how the meetup went.",
|
|
31
|
+
type: "object",
|
|
32
|
+
required: ["name"],
|
|
33
|
+
properties: {
|
|
34
|
+
name: { type: "string", title: "Your name" },
|
|
35
|
+
rating: {
|
|
36
|
+
type: "string",
|
|
37
|
+
title: "How was it?",
|
|
38
|
+
enum: ["poor", "fair", "good", "excellent"]
|
|
39
|
+
},
|
|
40
|
+
again: { type: "boolean", title: "I would come again" },
|
|
41
|
+
comments: { type: "string", title: "Comments" }
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
uiSchema: {
|
|
45
|
+
rating: {
|
|
46
|
+
"x-ui-widget": "radio",
|
|
47
|
+
"x-ui-options": {
|
|
48
|
+
enumNames: {
|
|
49
|
+
poor: "Poor",
|
|
50
|
+
fair: "Fair",
|
|
51
|
+
good: "Good",
|
|
52
|
+
excellent: "Excellent"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
comments: { "x-ui-widget": "textarea" }
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var BUG_REPORT = {
|
|
60
|
+
schema: {
|
|
61
|
+
title: "Bug report",
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
reporter: {
|
|
65
|
+
type: "object",
|
|
66
|
+
title: "Reporter",
|
|
67
|
+
required: ["name"],
|
|
68
|
+
properties: {
|
|
69
|
+
name: { type: "string", title: "Name" },
|
|
70
|
+
email: {
|
|
71
|
+
type: "string",
|
|
72
|
+
title: "Email",
|
|
73
|
+
pattern: "^[^@\\s]+@[^@\\s]+$"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
issue: {
|
|
78
|
+
type: "object",
|
|
79
|
+
title: "Issue",
|
|
80
|
+
required: ["summary"],
|
|
81
|
+
properties: {
|
|
82
|
+
summary: { type: "string", title: "Summary", maxLength: 120 },
|
|
83
|
+
severity: {
|
|
84
|
+
type: "string",
|
|
85
|
+
title: "Severity",
|
|
86
|
+
enum: ["low", "medium", "high", "critical"]
|
|
87
|
+
},
|
|
88
|
+
status: {
|
|
89
|
+
$ref: CODING_TYPE_ID,
|
|
90
|
+
title: "Error response, if any",
|
|
91
|
+
"x-binding": { system: HTTP_STATUS, strength: "required" }
|
|
92
|
+
},
|
|
93
|
+
browser: {
|
|
94
|
+
type: "object",
|
|
95
|
+
title: "Browser",
|
|
96
|
+
properties: {
|
|
97
|
+
choice: {
|
|
98
|
+
type: "string",
|
|
99
|
+
enum: ["chrome", "firefox", "safari", "edge"]
|
|
100
|
+
},
|
|
101
|
+
text: { type: "string", title: "Version" }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
steps: {
|
|
105
|
+
type: "array",
|
|
106
|
+
title: "Steps to reproduce",
|
|
107
|
+
items: { type: "string" }
|
|
108
|
+
},
|
|
109
|
+
production: { type: "boolean", title: "Happens in production" }
|
|
110
|
+
},
|
|
111
|
+
allOf: [
|
|
112
|
+
{
|
|
113
|
+
if: {
|
|
114
|
+
properties: { production: { const: true } },
|
|
115
|
+
required: ["production"]
|
|
116
|
+
},
|
|
117
|
+
then: {
|
|
118
|
+
properties: {
|
|
119
|
+
since: {
|
|
120
|
+
type: "string",
|
|
121
|
+
format: "date",
|
|
122
|
+
title: "Seen in production since"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
uiSchema: {
|
|
132
|
+
issue: {
|
|
133
|
+
"x-ui-fields": {
|
|
134
|
+
severity: {
|
|
135
|
+
"x-ui-widget": "radio",
|
|
136
|
+
"x-ui-options": {
|
|
137
|
+
enumNames: {
|
|
138
|
+
low: "Low",
|
|
139
|
+
medium: "Medium",
|
|
140
|
+
high: "High",
|
|
141
|
+
critical: "Critical"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
browser: {
|
|
146
|
+
"x-ui-widget": CHOICE_WITH_TEXT_WIDGET,
|
|
147
|
+
"x-ui-fields": {
|
|
148
|
+
choice: {
|
|
149
|
+
"x-ui-options": {
|
|
150
|
+
enumNames: {
|
|
151
|
+
chrome: "Chrome",
|
|
152
|
+
firefox: "Firefox",
|
|
153
|
+
safari: "Safari",
|
|
154
|
+
edge: "Edge"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var REASONS = {
|
|
165
|
+
type: "object",
|
|
166
|
+
title: "Not answered",
|
|
167
|
+
additionalProperties: {
|
|
168
|
+
type: "string",
|
|
169
|
+
enum: ["not_defined", "unknown", "none"]
|
|
170
|
+
},
|
|
171
|
+
"x-ui-widget": "absent-reasons",
|
|
172
|
+
"x-ui-options": {
|
|
173
|
+
enumNames: {
|
|
174
|
+
not_defined: "Not defined",
|
|
175
|
+
unknown: "Unknown",
|
|
176
|
+
none: "None"
|
|
177
|
+
},
|
|
178
|
+
immediate: true
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var requiredUnlessReason = (key) => ({
|
|
182
|
+
if: {
|
|
183
|
+
not: {
|
|
184
|
+
properties: { absent: { required: [key] } },
|
|
185
|
+
required: ["absent"]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
then: { required: [key] }
|
|
189
|
+
});
|
|
190
|
+
var ASSESSMENT_SCHEMA = {
|
|
191
|
+
title: "Product assessment",
|
|
192
|
+
description: "Facts and targets about the product that its source code cannot show. Where you have no answer, give a reason.",
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
overview: {
|
|
196
|
+
type: "object",
|
|
197
|
+
title: "Product overview",
|
|
198
|
+
properties: {
|
|
199
|
+
intro: {
|
|
200
|
+
type: "null",
|
|
201
|
+
title: "About the product",
|
|
202
|
+
description: "State facts and targets, never a verdict."
|
|
203
|
+
},
|
|
204
|
+
product_type: {
|
|
205
|
+
type: "string",
|
|
206
|
+
title: "Product type",
|
|
207
|
+
description: "What is the product, in one sentence?",
|
|
208
|
+
maxLength: 200
|
|
209
|
+
},
|
|
210
|
+
industry: {
|
|
211
|
+
type: "object",
|
|
212
|
+
title: "Industry",
|
|
213
|
+
properties: {
|
|
214
|
+
choice: {
|
|
215
|
+
type: "string",
|
|
216
|
+
enum: ["finance", "logistics", "retail", "public", "other"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
allOf: [
|
|
220
|
+
{
|
|
221
|
+
if: {
|
|
222
|
+
properties: { choice: { const: "other" } },
|
|
223
|
+
required: ["choice"]
|
|
224
|
+
},
|
|
225
|
+
then: {
|
|
226
|
+
properties: {
|
|
227
|
+
text: { type: "string", title: "Please describe" }
|
|
228
|
+
},
|
|
229
|
+
required: ["text"]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
users: {
|
|
235
|
+
type: "string",
|
|
236
|
+
title: "Users",
|
|
237
|
+
description: "Who works with the product -- the roles?"
|
|
238
|
+
},
|
|
239
|
+
user_count: {
|
|
240
|
+
type: "integer",
|
|
241
|
+
title: "People working with it, roughly",
|
|
242
|
+
minimum: 0
|
|
243
|
+
},
|
|
244
|
+
languages: {
|
|
245
|
+
type: "array",
|
|
246
|
+
title: "Languages",
|
|
247
|
+
uniqueItems: true,
|
|
248
|
+
items: { type: "string", enum: ["en", "de", "fr", "es"] }
|
|
249
|
+
},
|
|
250
|
+
license: {
|
|
251
|
+
title: "License",
|
|
252
|
+
anyOf: [{ $ref: CODING_TYPE_ID }, { type: "string" }],
|
|
253
|
+
"x-binding": { system: SPDX, strength: "extensible" }
|
|
254
|
+
},
|
|
255
|
+
absent: REASONS
|
|
256
|
+
},
|
|
257
|
+
allOf: [requiredUnlessReason("product_type")]
|
|
258
|
+
},
|
|
259
|
+
maturity: {
|
|
260
|
+
type: "object",
|
|
261
|
+
title: "Maturity",
|
|
262
|
+
properties: {
|
|
263
|
+
lifecycle: {
|
|
264
|
+
type: "string",
|
|
265
|
+
title: "Lifecycle stage",
|
|
266
|
+
enum: ["introduction", "growth", "maturity", "decline", "retired"]
|
|
267
|
+
},
|
|
268
|
+
phase: {
|
|
269
|
+
type: "object",
|
|
270
|
+
title: "Development phase",
|
|
271
|
+
properties: {
|
|
272
|
+
choice: {
|
|
273
|
+
type: "string",
|
|
274
|
+
enum: ["features", "maintenance", "modernization", "end_of_life"]
|
|
275
|
+
},
|
|
276
|
+
text: { type: "string", title: "Details" }
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
ai_tools: { type: "boolean", title: "Teams use AI coding tools" },
|
|
280
|
+
goals: {
|
|
281
|
+
type: "array",
|
|
282
|
+
title: "Key goals for the next years",
|
|
283
|
+
items: { type: "string" }
|
|
284
|
+
},
|
|
285
|
+
absent: REASONS
|
|
286
|
+
},
|
|
287
|
+
allOf: [requiredUnlessReason("lifecycle")]
|
|
288
|
+
},
|
|
289
|
+
architecture: {
|
|
290
|
+
type: "object",
|
|
291
|
+
title: "Architecture boundary",
|
|
292
|
+
properties: {
|
|
293
|
+
deployment: {
|
|
294
|
+
type: "string",
|
|
295
|
+
title: "Deployment model",
|
|
296
|
+
enum: ["cloud_native", "hosted", "on_premises"]
|
|
297
|
+
},
|
|
298
|
+
tenancy: {
|
|
299
|
+
type: "string",
|
|
300
|
+
title: "Tenancy",
|
|
301
|
+
enum: ["multi_tenant", "single_tenant"]
|
|
302
|
+
},
|
|
303
|
+
absent: REASONS
|
|
304
|
+
},
|
|
305
|
+
allOf: [
|
|
306
|
+
requiredUnlessReason("deployment"),
|
|
307
|
+
{
|
|
308
|
+
if: {
|
|
309
|
+
properties: { deployment: { not: { const: "cloud_native" } } },
|
|
310
|
+
required: ["deployment"]
|
|
311
|
+
},
|
|
312
|
+
then: {
|
|
313
|
+
properties: {
|
|
314
|
+
planned_change: {
|
|
315
|
+
type: "string",
|
|
316
|
+
format: "date",
|
|
317
|
+
title: "Planned move to the cloud, by"
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
integrations: {
|
|
325
|
+
type: "array",
|
|
326
|
+
title: "External integrations",
|
|
327
|
+
description: "One entry per system the product must connect to.",
|
|
328
|
+
items: {
|
|
329
|
+
type: "object",
|
|
330
|
+
properties: {
|
|
331
|
+
system: { type: "string", title: "System" },
|
|
332
|
+
interface: { type: "string", title: "Interface or standard" }
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
targets: {
|
|
337
|
+
type: "object",
|
|
338
|
+
title: "Operational targets",
|
|
339
|
+
properties: {
|
|
340
|
+
users_per_customer: {
|
|
341
|
+
type: "object",
|
|
342
|
+
title: "Users per customer",
|
|
343
|
+
properties: {
|
|
344
|
+
today: { type: "integer", title: "Today" },
|
|
345
|
+
target: { type: "integer", title: "Target" }
|
|
346
|
+
},
|
|
347
|
+
"x-ui-layout": { rows: [{ fields: ["today", "target"] }] }
|
|
348
|
+
},
|
|
349
|
+
response_time: {
|
|
350
|
+
$ref: QUANTITY_TYPE_ID,
|
|
351
|
+
title: "Response time of the main actions",
|
|
352
|
+
properties: { unit: { enum: ["ms", "s"] } }
|
|
353
|
+
},
|
|
354
|
+
availability: {
|
|
355
|
+
type: "number",
|
|
356
|
+
title: "Availability, in percent",
|
|
357
|
+
minimum: 0,
|
|
358
|
+
maximum: 100
|
|
359
|
+
},
|
|
360
|
+
absent: REASONS
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
security: {
|
|
364
|
+
type: "object",
|
|
365
|
+
title: "Security",
|
|
366
|
+
properties: {
|
|
367
|
+
weakness: {
|
|
368
|
+
$ref: CODING_TYPE_ID,
|
|
369
|
+
title: "Weakness found most often",
|
|
370
|
+
"x-binding": { system: CWE, strength: "required" }
|
|
371
|
+
},
|
|
372
|
+
error_status: {
|
|
373
|
+
type: "string",
|
|
374
|
+
title: "Most frequent error response",
|
|
375
|
+
"x-binding": { system: HTTP_STATUS, strength: "required" }
|
|
376
|
+
},
|
|
377
|
+
absent: REASONS
|
|
378
|
+
},
|
|
379
|
+
allOf: [
|
|
380
|
+
{
|
|
381
|
+
if: {
|
|
382
|
+
properties: {
|
|
383
|
+
weakness: {
|
|
384
|
+
type: "object",
|
|
385
|
+
properties: {
|
|
386
|
+
system: { const: CWE },
|
|
387
|
+
code: { const: "CWE-89" }
|
|
388
|
+
},
|
|
389
|
+
required: ["code"]
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
required: ["weakness"]
|
|
393
|
+
},
|
|
394
|
+
then: {
|
|
395
|
+
properties: {
|
|
396
|
+
sql_prevention: {
|
|
397
|
+
type: "string",
|
|
398
|
+
title: "How is SQL injection prevented?"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
questions: {
|
|
406
|
+
type: "array",
|
|
407
|
+
title: "Specific questions",
|
|
408
|
+
description: "One question per entry.",
|
|
409
|
+
items: { type: "string" }
|
|
410
|
+
},
|
|
411
|
+
reviewed_by: {
|
|
412
|
+
title: "Reviewed by",
|
|
413
|
+
oneOf: [
|
|
414
|
+
{ type: "string", title: "Name" },
|
|
415
|
+
{
|
|
416
|
+
type: "object",
|
|
417
|
+
title: "Team",
|
|
418
|
+
properties: { name: { type: "string" } }
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
absent: REASONS
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
var ASSESSMENT_UI_SCHEMA = {
|
|
426
|
+
overview: {
|
|
427
|
+
"x-ui-fields": {
|
|
428
|
+
product_type: { "x-ui-placeholder": "A web application for ..." },
|
|
429
|
+
industry: {
|
|
430
|
+
"x-ui-widget": CHOICE_WITH_TEXT_WIDGET,
|
|
431
|
+
"x-ui-fields": {
|
|
432
|
+
choice: {
|
|
433
|
+
"x-ui-options": {
|
|
434
|
+
enumNames: {
|
|
435
|
+
finance: "Finance",
|
|
436
|
+
logistics: "Logistics",
|
|
437
|
+
retail: "Retail",
|
|
438
|
+
public: "Public sector",
|
|
439
|
+
other: "Other"
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
users: { "x-ui-widget": "textarea" },
|
|
446
|
+
languages: {
|
|
447
|
+
"x-ui-widget": "checkbox-group",
|
|
448
|
+
"x-ui-options": {
|
|
449
|
+
enumNames: {
|
|
450
|
+
en: "English",
|
|
451
|
+
de: "German",
|
|
452
|
+
fr: "French",
|
|
453
|
+
es: "Spanish"
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
maturity: {
|
|
460
|
+
"x-ui-fields": {
|
|
461
|
+
lifecycle: {
|
|
462
|
+
"x-ui-options": {
|
|
463
|
+
enumNames: {
|
|
464
|
+
introduction: "Introduction",
|
|
465
|
+
growth: "Growth",
|
|
466
|
+
maturity: "Maturity",
|
|
467
|
+
decline: "Decline",
|
|
468
|
+
retired: "Retired"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
phase: {
|
|
473
|
+
"x-ui-widget": CHOICE_WITH_TEXT_WIDGET,
|
|
474
|
+
"x-ui-fields": {
|
|
475
|
+
choice: {
|
|
476
|
+
"x-ui-options": {
|
|
477
|
+
enumNames: {
|
|
478
|
+
features: "Feature development",
|
|
479
|
+
maintenance: "Maintenance",
|
|
480
|
+
modernization: "Modernization",
|
|
481
|
+
end_of_life: "End of life"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
architecture: {
|
|
490
|
+
"x-ui-fields": {
|
|
491
|
+
deployment: {
|
|
492
|
+
"x-ui-widget": "radio",
|
|
493
|
+
"x-ui-options": {
|
|
494
|
+
enumNames: {
|
|
495
|
+
cloud_native: "Cloud-native",
|
|
496
|
+
hosted: "Hosted",
|
|
497
|
+
on_premises: "On-premises"
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
tenancy: {
|
|
502
|
+
"x-ui-widget": "radio",
|
|
503
|
+
"x-ui-options": {
|
|
504
|
+
enumNames: {
|
|
505
|
+
multi_tenant: "Customers share one installation",
|
|
506
|
+
single_tenant: "One installation per customer"
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
targets: {
|
|
513
|
+
"x-ui-fields": {
|
|
514
|
+
response_time: {
|
|
515
|
+
"x-ui-options": {
|
|
516
|
+
units: [
|
|
517
|
+
{ value: "ms", label: "ms" },
|
|
518
|
+
{ value: "s", label: "s" }
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
var ASSESSMENT = {
|
|
526
|
+
schema: ASSESSMENT_SCHEMA,
|
|
527
|
+
uiSchema: ASSESSMENT_UI_SCHEMA
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
// src/pages/PlayQuestionnaireDesigner.tsx
|
|
531
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
532
|
+
var EXAMPLES = {
|
|
533
|
+
simple: { label: "Simple -- event feedback", ...FEEDBACK },
|
|
534
|
+
medium: { label: "Medium -- bug report", ...BUG_REPORT },
|
|
535
|
+
advanced: { label: "Advanced -- product assessment", ...ASSESSMENT }
|
|
536
|
+
};
|
|
537
|
+
var PROFILES = {
|
|
538
|
+
full: {
|
|
539
|
+
label: "Full",
|
|
540
|
+
description: "Every capability: all answer types, sections, show-if, reasons for no answer, the way to the schema designer.",
|
|
541
|
+
capabilities: { previews: ["form", "json", "capabilities"] }
|
|
542
|
+
},
|
|
543
|
+
standard: {
|
|
544
|
+
label: "Standard",
|
|
545
|
+
description: "Sections and show-if; no reasons for no answer, no way to the schema designer.",
|
|
546
|
+
capabilities: {
|
|
547
|
+
reasons: false,
|
|
548
|
+
switchToDesigner: false,
|
|
549
|
+
previews: ["form", "json", "capabilities"]
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
simple: {
|
|
553
|
+
label: "Simple",
|
|
554
|
+
description: "A few answer types; no sections, no logic, no reasons -- parts beyond it stay locked.",
|
|
555
|
+
capabilities: {
|
|
556
|
+
answerTypes: ["shortText", "longText", "yesNo", "singleChoice", "date"],
|
|
557
|
+
sections: false,
|
|
558
|
+
logic: false,
|
|
559
|
+
reasons: false,
|
|
560
|
+
previews: ["form", "capabilities"]
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
structure: {
|
|
564
|
+
label: "Structure only (no preview)",
|
|
565
|
+
description: "Question list and panel only; the centre preview is hidden.",
|
|
566
|
+
capabilities: { previews: [] }
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
function PlayQuestionnaireDesigner() {
|
|
570
|
+
const [exampleKey, setExampleKey] = useState("advanced");
|
|
571
|
+
const [profileKey, setProfileKey] = useState("full");
|
|
572
|
+
const [schema, setSchema] = useState(EXAMPLES.advanced.schema);
|
|
573
|
+
const [uiSchema, setUiSchema] = useState(
|
|
574
|
+
EXAMPLES.advanced.uiSchema
|
|
575
|
+
);
|
|
576
|
+
const selectExample = (key) => {
|
|
577
|
+
setExampleKey(key);
|
|
578
|
+
setSchema(EXAMPLES[key].schema);
|
|
579
|
+
setUiSchema(EXAMPLES[key].uiSchema);
|
|
580
|
+
};
|
|
581
|
+
const [designer, setDesigner] = useState("questionnaire");
|
|
582
|
+
const onChange = (nextSchema, nextUiSchema) => {
|
|
583
|
+
setSchema(nextSchema);
|
|
584
|
+
setUiSchema(nextUiSchema);
|
|
585
|
+
};
|
|
586
|
+
return /* @__PURE__ */ jsx(TerminologyProvider, { service: PLAYGROUND_TERMINOLOGY, children: /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-3 h-[calc(100vh-8rem)]", children: [
|
|
587
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
588
|
+
/* @__PURE__ */ jsx("h1", { children: "Questionnaire Designer" }),
|
|
589
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: "Author a questionnaire as sections and questions. It edits the same JSON Schema and uiSchema as the Schema Designer, and keeps every part it does not understand as it is -- switch between the two and back." })
|
|
590
|
+
] }),
|
|
591
|
+
/* @__PURE__ */ jsx(
|
|
592
|
+
DesignerControls,
|
|
593
|
+
{
|
|
594
|
+
examples: EXAMPLES,
|
|
595
|
+
example: exampleKey,
|
|
596
|
+
onExample: selectExample,
|
|
597
|
+
profiles: PROFILES,
|
|
598
|
+
profile: profileKey,
|
|
599
|
+
onProfile: setProfileKey,
|
|
600
|
+
right: /* @__PURE__ */ jsx(
|
|
601
|
+
ViewSwitch,
|
|
602
|
+
{
|
|
603
|
+
label: "Designer",
|
|
604
|
+
value: designer,
|
|
605
|
+
onChange: setDesigner,
|
|
606
|
+
options: [
|
|
607
|
+
{
|
|
608
|
+
value: "questionnaire",
|
|
609
|
+
label: "Questionnaire designer",
|
|
610
|
+
icon: /* @__PURE__ */ jsx(ClipboardList, {})
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
value: "schema",
|
|
614
|
+
label: "Schema designer",
|
|
615
|
+
icon: /* @__PURE__ */ jsx(PencilRuler, {})
|
|
616
|
+
}
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
)
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 0 }, children: designer === "questionnaire" ? /* @__PURE__ */ jsx(
|
|
623
|
+
QuestionnaireDesigner,
|
|
624
|
+
{
|
|
625
|
+
schema,
|
|
626
|
+
uiSchema,
|
|
627
|
+
onChange,
|
|
628
|
+
capabilities: PROFILES[profileKey].capabilities,
|
|
629
|
+
onOpenSchemaDesigner: () => setDesigner("schema")
|
|
630
|
+
},
|
|
631
|
+
`${exampleKey}-${profileKey}`
|
|
632
|
+
) : /* @__PURE__ */ jsx(
|
|
633
|
+
SchemaDesigner,
|
|
634
|
+
{
|
|
635
|
+
schema,
|
|
636
|
+
uiSchema,
|
|
637
|
+
onChange
|
|
638
|
+
},
|
|
639
|
+
exampleKey
|
|
640
|
+
) })
|
|
641
|
+
] }) });
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export {
|
|
645
|
+
PlayQuestionnaireDesigner
|
|
646
|
+
};
|
|
647
|
+
//# sourceMappingURL=chunk-VKZ2RJFL.js.map
|