@case-framework/survey-core 0.1.0 → 0.2.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 +181 -0
- package/build/editor.d.mts +169 -5
- package/build/editor.d.mts.map +1 -1
- package/build/editor.mjs +429 -8
- package/build/editor.mjs.map +1 -1
- package/build/index.d.mts +189 -6
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +361 -2
- package/build/index.mjs.map +1 -1
- package/build/{package.json/package.json → package.json} +1 -1
- package/build/{survey-TUPUXiXl.d.mts → survey-D3sMutUV.d.mts} +63 -3
- package/build/{survey-TUPUXiXl.d.mts.map → survey-D3sMutUV.d.mts.map} +1 -1
- package/build/{survey-C3ZHI-5z.mjs → survey-DQmpzihl.mjs} +249 -183
- package/build/survey-DQmpzihl.mjs.map +1 -0
- package/package.json +1 -1
- package/build/survey-C3ZHI-5z.mjs.map +0 -1
|
@@ -301,6 +301,12 @@ declare abstract class SurveyItemCore<TType extends string = string, TConfig = u
|
|
|
301
301
|
abstract isInteractive(): boolean;
|
|
302
302
|
abstract getAvailableResponseValueSlots(byType?: ValueType): ValueRefTypeLookup;
|
|
303
303
|
get rawItem(): RawSurveyItem;
|
|
304
|
+
get metadata(): {
|
|
305
|
+
[key: string]: string;
|
|
306
|
+
};
|
|
307
|
+
set metadata(metadata: {
|
|
308
|
+
[key: string]: string;
|
|
309
|
+
});
|
|
304
310
|
updateRawItem(rawItem: RawSurveyItem): void;
|
|
305
311
|
private updateExpressions;
|
|
306
312
|
getReferenceUsages(): ReferenceUsage[];
|
|
@@ -498,10 +504,41 @@ declare class SurveyItemKey {
|
|
|
498
504
|
//#endregion
|
|
499
505
|
//#region src/survey/registry/item-registry.d.ts
|
|
500
506
|
/**
|
|
501
|
-
* Registry maps item type
|
|
507
|
+
* Registry maps item type name → handler constructor.
|
|
502
508
|
* Plugins extend this with their own handler classes.
|
|
503
509
|
*/
|
|
504
510
|
type ItemTypeRegistry = Record<string, new (rawItem: RawSurveyItem) => SurveyItemCore>;
|
|
511
|
+
/** Item type identifier (e.g. "singleChoiceQuestion", "display"). */
|
|
512
|
+
type ItemTypeName = string;
|
|
513
|
+
/** Capabilities of an item type (interactive, supports children). */
|
|
514
|
+
interface ItemTypeCapabilities {
|
|
515
|
+
interactive?: boolean;
|
|
516
|
+
supportsChildren?: boolean;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Definition of an item type: its name, constructor, and optional capabilities.
|
|
520
|
+
* Used by editor/UI layers to compose registries.
|
|
521
|
+
*/
|
|
522
|
+
interface ItemTypeDefinition {
|
|
523
|
+
itemType: ItemTypeName;
|
|
524
|
+
constructor: ItemCoreConstructor;
|
|
525
|
+
capabilities?: ItemTypeCapabilities;
|
|
526
|
+
}
|
|
527
|
+
/** Registry mapping item type name → definition. */
|
|
528
|
+
type ItemTypeDefinitionRegistry = Record<ItemTypeName, ItemTypeDefinition>;
|
|
529
|
+
/** Convert constructor registry to explicit definitions for higher-layer composition. */
|
|
530
|
+
declare function toItemTypeDefinitionRegistry(registry: ItemTypeRegistry): ItemTypeDefinitionRegistry;
|
|
531
|
+
/**
|
|
532
|
+
* Creates a handler instance for a raw survey item.
|
|
533
|
+
* Uses built-in registry for group/page-break, otherwise the provided plugin registry.
|
|
534
|
+
*/
|
|
535
|
+
declare function createItemCore(rawItem: RawSurveyItem, pluginRegistry?: ItemTypeRegistry): SurveyItemCore;
|
|
536
|
+
/**
|
|
537
|
+
* Merge built-in handlers with plugin registry for a complete registry.
|
|
538
|
+
*/
|
|
539
|
+
declare function createFullRegistry(pluginRegistry?: ItemTypeRegistry): ItemTypeRegistry;
|
|
540
|
+
/** Build full registry as explicit definitions for editor/ui composition. */
|
|
541
|
+
declare function createItemTypeDefinitionRegistry(pluginRegistry?: ItemTypeRegistry): ItemTypeDefinitionRegistry;
|
|
505
542
|
//#endregion
|
|
506
543
|
//#region src/survey/registry/built-in-items.d.ts
|
|
507
544
|
/**
|
|
@@ -558,6 +595,23 @@ declare class GroupItemCore extends SurveyItemCore<typeof ReservedSurveyItemType
|
|
|
558
595
|
*/
|
|
559
596
|
moveItemToIndex(id: string, index: number): void;
|
|
560
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Page break item core.
|
|
600
|
+
*/
|
|
601
|
+
type PageBreakConfig = Record<string, never>;
|
|
602
|
+
declare class PageBreakItemCore extends SurveyItemCore<typeof ReservedSurveyItemTypes.PageBreak, PageBreakConfig> {
|
|
603
|
+
readonly type = ReservedSurveyItemTypes.PageBreak;
|
|
604
|
+
parseConfig(_rawConfig: unknown): PageBreakConfig;
|
|
605
|
+
serializeConfig(): unknown;
|
|
606
|
+
isInteractive(): boolean;
|
|
607
|
+
getAvailableResponseValueSlots(): {};
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Built-in item type.
|
|
611
|
+
*/
|
|
612
|
+
type BuiltInItemType = typeof ReservedSurveyItemTypes.Group | typeof ReservedSurveyItemTypes.PageBreak;
|
|
613
|
+
declare const builtInItemCoreRegistry: Record<BuiltInItemType, ItemCoreConstructor>;
|
|
614
|
+
declare const isBuiltInItemType: (itemType: string) => itemType is BuiltInItemType;
|
|
561
615
|
//#endregion
|
|
562
616
|
//#region src/survey/survey.d.ts
|
|
563
617
|
declare class Survey {
|
|
@@ -573,11 +627,17 @@ declare class Survey {
|
|
|
573
627
|
private _templateValues?;
|
|
574
628
|
private _translations?;
|
|
575
629
|
constructor(pluginRegistry?: ItemTypeRegistry | undefined);
|
|
630
|
+
/** Plugin registry used when parsing items. Exposed for editors that re-parse without their own registry. */
|
|
631
|
+
getPluginRegistry(): ItemTypeRegistry | undefined;
|
|
576
632
|
/**
|
|
577
633
|
* Create a survey item from raw JSON data.
|
|
578
634
|
* Uses the survey's plugin registry when available.
|
|
579
635
|
*/
|
|
580
636
|
createItemFromRaw(rawItem: RawSurveyItem): SurveyItemCore;
|
|
637
|
+
/**
|
|
638
|
+
* Create a minimal blank survey with a root group and one empty page.
|
|
639
|
+
*/
|
|
640
|
+
static createBlankSurvey(pluginRegistry?: ItemTypeRegistry, surveyKey?: string): Survey;
|
|
581
641
|
static fromJson(json: RawSurvey, pluginRegistry?: ItemTypeRegistry): Survey;
|
|
582
642
|
serialize(): RawSurvey;
|
|
583
643
|
get surveyKey(): string | undefined;
|
|
@@ -610,5 +670,5 @@ declare class Survey {
|
|
|
610
670
|
isDescendantOf(targetId: string, ancestorId: string): boolean;
|
|
611
671
|
}
|
|
612
672
|
//#endregion
|
|
613
|
-
export {
|
|
614
|
-
//# sourceMappingURL=survey-
|
|
673
|
+
export { Expression as $, CQMContent as A, ValueRefTypeLookup as At, SurveyItemCoreType as B, SurveyCardContent as C, NumberResponse as Ct, validateLocale as D, SlotResponseBase as Dt, SurveyTranslations as E, ResponseValue as Et, TemplateAttribution as F, TemplateValueFormatDate as G, TemplateDefTypes as H, ReservedSurveyItemTypes as I, serializeTemplateValue as J, deserializeTemplateValue as K, RawSurveyItem as L, ContentType as M, MDContent as N, Attribution as O, StringArrayResponse as Ot, StyleAttribution as P, ContextVariableType as Q, ItemCoreConstructor as R, NavigationContent as S, NumberPrecision as St, SurveyItemTranslations as T, ReferenceResponse as Tt, TemplateValueBase as U, JsonTemplateValue as V, TemplateValueDefinition as W, ConstExpression as X, serializeTemplateValues as Y, ContextVariableExpression as Z, toItemTypeDefinitionRegistry as _, DurationArrayResponse as _t, PageBreakConfig as a, JsonContextVariableExpression as at, JsonComponentContent as b, DurationUnits as bt, isBuiltInItemType as c, JsonResponseVariableExpression as ct, ItemTypeDefinitionRegistry as d, ReferenceUsageType as dt, ExpressionEditorConfig as et, ItemTypeName as f, ValueReference as ft, createItemTypeDefinitionRegistry as g, DateResponse as gt, createItemCore as h, DateArrayResponse as ht, GroupItemCore as i, JsonConstExpression as it, Content as j, ValueType as jt, AttributionType as k, StringResponse as kt, ItemTypeCapabilities as l, ResponseVariableExpression as lt, createFullRegistry as m, BooleanResponse as mt, BuiltInItemType as n, FunctionExpression as nt, PageBreakItemCore as o, JsonExpression as ot, ItemTypeRegistry as p, ValueReferenceMethod as pt, deserializeTemplateValues as q, GroupConfig as r, FunctionExpressionNames as rt, builtInItemCoreRegistry as s, JsonFunctionExpression as st, Survey as t, ExpressionType as tt, ItemTypeDefinition as u, ReferenceUsage as ut, SurveyItemKey as v, DurationResponse as vt, SurveyCardTranslations as w, ReferenceArrayResponse as wt, JsonSurveyTranslations as x, NumberArrayResponse as xt, RawSurvey as y, DurationUnit as yt, SurveyItemCore as z };
|
|
674
|
+
//# sourceMappingURL=survey-D3sMutUV.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-TUPUXiXl.d.mts","names":[],"sources":["../src/survey/responses/value-types.ts","../src/survey/utils/value-reference.ts","../src/expressions/expression.ts","../src/expressions/template-value.ts","../src/survey/items/utils.ts","../src/survey/items/survey-item.ts","../src/survey/items/survey-item-json.ts","../src/survey/items/types.ts","../src/survey/utils/content.ts","../src/survey/utils/translations.ts","../src/survey/survey-file-schema.ts","../src/survey/item-key.ts","../src/survey/registry/item-registry.ts","../src/survey/registry/built-in-items.ts","../src/survey/survey.ts"],"mappings":";cAAa,SAAA;EAAA;;;;;;;;;;;;KAcD,SAAA,WAAoB,SAAA,eAAwB,SAAA;AAAA,cAG3C,aAAA;EAAA;;;;;;;;KAUD,YAAA,WAAuB,aAAA,eAA4B,aAAA;AAAA,cAGlD,eAAA;EAAA,SAGH,GAAA;EAAA,SAAA,KAAA;AAAA;AAAA,KAEE,eAAA,WAA0B,eAAA,eAA8B,eAAA;AAAA,UAGnD,gBAAA,oBAAoC,SAAA;EACjD,IAAA,EAAM,UAAA;AAAA;AAAA,UAGO,cAAA,SAAuB,gBAAA,QAAwB,SAAA,CAAU,MAAA;EACtE,KAAA;AAAA;AAAA,UAGa,gBAAA,SAAyB,gBAAA,QAAwB,SAAA,CAAU,QAAA;EACxE,KAAA;EACA,IAAA,EAAM,YAAA;EACN,SAAA,GAAY,eAAA;AAAA;AAAA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ils/value-reference.ts","../src/expressions/expression.ts","../src/expressions/template-value.ts","../src/survey/items/utils.ts","../src/survey/items/survey-item.ts","../src/survey/items/survey-item-json.ts","../src/survey/items/types.ts","../src/survey/utils/content.ts","../src/survey/utils/translations.ts","../src/survey/survey-file-schema.ts","../src/survey/item-key.ts","../src/survey/registry/item-registry.ts","../src/survey/registry/built-in-items.ts","../src/survey/survey.ts"],"mappings":";cAAa,SAAA;EAAA;;;;;;;;;;;;KAcD,SAAA,WAAoB,SAAA,eAAwB,SAAA;AAAA,cAG3C,aAAA;EAAA;;;;;;;;KAUD,YAAA,WAAuB,aAAA,eAA4B,aAAA;AAAA,cAGlD,eAAA;EAAA,SAGH,GAAA;EAAA,SAAA,KAAA;AAAA;AAAA,KAEE,eAAA,WAA0B,eAAA,eAA8B,eAAA;AAAA,UAGnD,gBAAA,oBAAoC,SAAA;EACjD,IAAA,EAAM,UAAA;AAAA;AAAA,UAGO,cAAA,SAAuB,gBAAA,QAAwB,SAAA,CAAU,MAAA;EACtE,KAAA;AAAA;AAAA,UAGa,gBAAA,SAAyB,gBAAA,QAAwB,SAAA,CAAU,QAAA;EACxE,KAAA;EACA,IAAA,EAAM,YAAA;EACN,SAAA,GAAY,eAAA;AAAA;AAAA,UAGC,cAAA,SAAuB,gBAAA,QAAwB,SAAA,CAAU,MAAA;EACtE,KAAA;EACA,SAAA,GAAY,eAAA;AAAA;AAAA,UAGC,eAAA,SAAwB,gBAAA,QAAwB,SAAA,CAAU,OAAA;EACvE,KAAA;AAAA;AAAA,UAGa,iBAAA,SAA0B,gBAAA,QAAwB,SAAA,CAAU,SAAA;EACzE,KAAA;AAAA;AAAA,UAGa,YAAA,SAAqB,gBAAA,QAAwB,SAAA,CAAU,IAAA;EACpE,KAAA;AAAA;AAAA,UAGa,mBAAA,SAA4B,gBAAA,QAAwB,SAAA,CAAU,WAAA;EAC3E,KAAA;AAAA;AAAA,UAKa,qBAAA,SAA8B,gBAAA,QAAwB,SAAA,CAAU,aAAA;EA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AAgB,GAAA;IAAa,OAAA;IAAmB,IAAA;EAAA;EAaxE,WAAA,CAAY,MAAA;EAkBZ,UAAA,CAAW,MAAA,WAAiB,aAAA;EAU5B,aAAA,CAAc,MAAA,WAAiB,aAAA;EAe/B,gBAAA,CAAiB,QAAA,WAAmB,cAAA;EAQpC,WAAA,CAAY,MAAA,WAAiB,cAAA;EAAA,IASzB,YAAA,CAAA,GAAgB,kBAAA;EAOpB,mBAAA,CAAoB,EAAA,WAAa,sBAAA;EASjC,gBAAA,CAAiB,gBAAA,WAA2B,uBAAA;EAI5C,gBAAA,CAAiB,gBAAA,UAA0B,aAAA,EAAe,uBAAA;EAO1D,mBAAA,CAAoB,gBAAA;EAIpB,oBAAA,CAAA;EAIA,8BAAA,CAA+B,MAAA,GAAS,SAAA,GAAY,kBAAA;EdjND;;;;;Ec8NnD,kBAAA,CAAmB,SAAA,YAAqB,cAAA;EAyBxC,cAAA,CAAe,QAAA,UAAkB,UAAA;AAAA"}
|
|
@@ -31,6 +31,19 @@ function generateId() {
|
|
|
31
31
|
for (let i = 0; i < length; i++) randomPart += ALPHABET.charAt(Math.floor(Math.random() * base));
|
|
32
32
|
return randomPart + encodedTimestamp;
|
|
33
33
|
}
|
|
34
|
+
/** Alphanumeric chars without ambiguous ones (0/O, 1/I) for human-readable coding keys. */
|
|
35
|
+
const CODING_KEY_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
36
|
+
/**
|
|
37
|
+
* Generates a short random coding key suitable for item keys in exports/codebooks.
|
|
38
|
+
* @param length - Key length (default 4)
|
|
39
|
+
* @returns A random string of the specified length.
|
|
40
|
+
*/
|
|
41
|
+
function generateCodingKey(length = 4) {
|
|
42
|
+
const base = 32;
|
|
43
|
+
let key = "";
|
|
44
|
+
for (let i = 0; i < length; i++) key += CODING_KEY_ALPHABET.charAt(Math.floor(Math.random() * base));
|
|
45
|
+
return key;
|
|
46
|
+
}
|
|
34
47
|
|
|
35
48
|
//#endregion
|
|
36
49
|
//#region src/survey/utils/value-reference.ts
|
|
@@ -319,6 +332,15 @@ var SurveyItemCore = class {
|
|
|
319
332
|
get rawItem() {
|
|
320
333
|
return this._rawItem;
|
|
321
334
|
}
|
|
335
|
+
get metadata() {
|
|
336
|
+
return this._rawItem.metadata ?? {};
|
|
337
|
+
}
|
|
338
|
+
set metadata(metadata) {
|
|
339
|
+
this.updateRawItem({
|
|
340
|
+
...this._rawItem,
|
|
341
|
+
metadata
|
|
342
|
+
});
|
|
343
|
+
}
|
|
322
344
|
updateRawItem(rawItem) {
|
|
323
345
|
if (rawItem.id !== this.id) throw new Error("Cannot update raw item with a different id");
|
|
324
346
|
this._rawItem = rawItem;
|
|
@@ -408,187 +430,6 @@ var SurveyItemKey = class {
|
|
|
408
430
|
}
|
|
409
431
|
};
|
|
410
432
|
|
|
411
|
-
//#endregion
|
|
412
|
-
//#region src/survey/survey-file-schema.ts
|
|
413
|
-
const CURRENT_SURVEY_SCHEMA = "https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json";
|
|
414
|
-
|
|
415
|
-
//#endregion
|
|
416
|
-
//#region src/survey/utils/translations.ts
|
|
417
|
-
const validateLocale = (locale) => {
|
|
418
|
-
if (locale.trim() === "") throw new Error("Locale cannot be empty");
|
|
419
|
-
};
|
|
420
|
-
var SurveyItemTranslations = class {
|
|
421
|
-
_translations;
|
|
422
|
-
constructor() {
|
|
423
|
-
this._translations = {};
|
|
424
|
-
}
|
|
425
|
-
setContent(locale, contentKey, content) {
|
|
426
|
-
validateLocale(locale);
|
|
427
|
-
if (!this._translations?.[locale]) {
|
|
428
|
-
if (!content) return;
|
|
429
|
-
this._translations[locale] = {};
|
|
430
|
-
}
|
|
431
|
-
if (!content) delete this._translations[locale][contentKey];
|
|
432
|
-
else this._translations[locale][contentKey] = content;
|
|
433
|
-
}
|
|
434
|
-
setAllForLocale(locale, content) {
|
|
435
|
-
validateLocale(locale);
|
|
436
|
-
if (!this._translations?.[locale]) {
|
|
437
|
-
if (!content) return;
|
|
438
|
-
this._translations[locale] = {};
|
|
439
|
-
}
|
|
440
|
-
this._translations[locale] = content || {};
|
|
441
|
-
}
|
|
442
|
-
get locales() {
|
|
443
|
-
return Object.keys(this._translations || {});
|
|
444
|
-
}
|
|
445
|
-
getAllForLocale(locale) {
|
|
446
|
-
return this._translations?.[locale];
|
|
447
|
-
}
|
|
448
|
-
getContent(locale, contentKey, fallbackLocale) {
|
|
449
|
-
const content = this._translations?.[locale]?.[contentKey];
|
|
450
|
-
if (content) return content;
|
|
451
|
-
if (fallbackLocale) return this._translations?.[fallbackLocale]?.[contentKey];
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
var SurveyTranslations = class {
|
|
455
|
-
_translations;
|
|
456
|
-
constructor(translations) {
|
|
457
|
-
this._translations = translations || {};
|
|
458
|
-
}
|
|
459
|
-
serialize() {
|
|
460
|
-
if (this.locales.length === 0) return;
|
|
461
|
-
return this._translations;
|
|
462
|
-
}
|
|
463
|
-
get locales() {
|
|
464
|
-
return Object.keys(this._translations);
|
|
465
|
-
}
|
|
466
|
-
removeLocale(locale) {
|
|
467
|
-
validateLocale(locale);
|
|
468
|
-
delete this._translations[locale];
|
|
469
|
-
}
|
|
470
|
-
renameLocale(oldLocale, newLocale) {
|
|
471
|
-
validateLocale(oldLocale);
|
|
472
|
-
validateLocale(newLocale);
|
|
473
|
-
if (this._translations[oldLocale]) {
|
|
474
|
-
this._translations[newLocale] = this._translations[oldLocale];
|
|
475
|
-
delete this._translations[oldLocale];
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
cloneLocaleAs(locale, newLocale) {
|
|
479
|
-
validateLocale(locale);
|
|
480
|
-
validateLocale(newLocale);
|
|
481
|
-
if (this._translations[locale]) this._translations[newLocale] = structuredCloneMethod(this._translations[locale]);
|
|
482
|
-
}
|
|
483
|
-
get surveyCardContent() {
|
|
484
|
-
const translations = {};
|
|
485
|
-
for (const locale of this.locales) {
|
|
486
|
-
const contentForLocale = this._translations?.[locale]?.surveyCardContent;
|
|
487
|
-
if (contentForLocale) translations[locale] = contentForLocale;
|
|
488
|
-
}
|
|
489
|
-
return translations;
|
|
490
|
-
}
|
|
491
|
-
get navigationContent() {
|
|
492
|
-
const translations = {};
|
|
493
|
-
for (const locale of this.locales) {
|
|
494
|
-
const contentForLocale = this._translations?.[locale]?.navigationContent;
|
|
495
|
-
if (contentForLocale) translations[locale] = contentForLocale;
|
|
496
|
-
}
|
|
497
|
-
return translations;
|
|
498
|
-
}
|
|
499
|
-
get validationMessages() {
|
|
500
|
-
const translations = {};
|
|
501
|
-
for (const locale of this.locales) {
|
|
502
|
-
const contentForLocale = this._translations?.[locale]?.validationMessages;
|
|
503
|
-
if (contentForLocale) translations[locale] = contentForLocale;
|
|
504
|
-
}
|
|
505
|
-
return translations;
|
|
506
|
-
}
|
|
507
|
-
setSurveyCardContent(locale, content) {
|
|
508
|
-
validateLocale(locale);
|
|
509
|
-
if (!this._translations[locale]) {
|
|
510
|
-
if (!content) return;
|
|
511
|
-
this._translations[locale] = {};
|
|
512
|
-
}
|
|
513
|
-
this._translations[locale].surveyCardContent = content;
|
|
514
|
-
}
|
|
515
|
-
setNavigationContent(locale, content) {
|
|
516
|
-
validateLocale(locale);
|
|
517
|
-
if (!this._translations[locale]) {
|
|
518
|
-
if (!content) return;
|
|
519
|
-
this._translations[locale] = {};
|
|
520
|
-
}
|
|
521
|
-
this._translations[locale].navigationContent = content;
|
|
522
|
-
}
|
|
523
|
-
setValidationMessages(locale, content) {
|
|
524
|
-
validateLocale(locale);
|
|
525
|
-
if (!this._translations[locale]) {
|
|
526
|
-
if (!content) return;
|
|
527
|
-
this._translations[locale] = {};
|
|
528
|
-
}
|
|
529
|
-
this._translations[locale].validationMessages = content;
|
|
530
|
-
}
|
|
531
|
-
getItemTranslations(itemId) {
|
|
532
|
-
const itemTranslations = new SurveyItemTranslations();
|
|
533
|
-
for (const locale of this.locales) {
|
|
534
|
-
const contentForLocale = this._translations?.[locale].itemTranslations?.[itemId];
|
|
535
|
-
itemTranslations.setAllForLocale(locale, contentForLocale);
|
|
536
|
-
}
|
|
537
|
-
return itemTranslations;
|
|
538
|
-
}
|
|
539
|
-
setItemTranslations(itemId, itemContent) {
|
|
540
|
-
itemContent?.locales.forEach((locale) => validateLocale(locale));
|
|
541
|
-
if (!itemContent) {
|
|
542
|
-
for (const locale of this.locales) if (this._translations[locale].itemTranslations?.[itemId]) delete this._translations[locale].itemTranslations?.[itemId];
|
|
543
|
-
} else {
|
|
544
|
-
const localesInUpdate = itemContent.locales;
|
|
545
|
-
for (const locale of localesInUpdate) if (!this.locales.includes(locale)) this._translations[locale] = {};
|
|
546
|
-
for (const locale of this.locales) if (localesInUpdate.includes(locale)) {
|
|
547
|
-
if (!this._translations[locale]) this._translations[locale] = {};
|
|
548
|
-
if (!this._translations[locale].itemTranslations) this._translations[locale].itemTranslations = {};
|
|
549
|
-
this._translations[locale].itemTranslations[itemId] = itemContent.getAllForLocale(locale) ?? {};
|
|
550
|
-
} else delete this._translations[locale].itemTranslations[itemId];
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Rename a component key (within an item) - update key in all translations and remove old key
|
|
555
|
-
* @param itemKey - The key of the item
|
|
556
|
-
* @param oldKey - The old key of the component
|
|
557
|
-
* @param newKey - The new key of the component
|
|
558
|
-
*/
|
|
559
|
-
onComponentKeyChanged(itemKey, oldKey, newKey) {
|
|
560
|
-
for (const locale of this.locales) {
|
|
561
|
-
const itemTranslations = this._translations?.[locale].itemTranslations?.[itemKey];
|
|
562
|
-
if (itemTranslations) {
|
|
563
|
-
for (const key of Object.keys(itemTranslations)) if (key.startsWith(oldKey + ".") || key === oldKey) {
|
|
564
|
-
itemTranslations[key.replace(oldKey, newKey)] = { ...itemTranslations[key] };
|
|
565
|
-
delete itemTranslations[key];
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Remove all translations for a component
|
|
572
|
-
* @param itemId - The id of the item
|
|
573
|
-
* @param componentKey - The key of the component
|
|
574
|
-
*/
|
|
575
|
-
onComponentDeleted(itemId, componentKey) {
|
|
576
|
-
for (const locale of this.locales) {
|
|
577
|
-
const itemTranslations = this._translations?.[locale].itemTranslations?.[itemId];
|
|
578
|
-
if (itemTranslations) {
|
|
579
|
-
for (const key of Object.keys(itemTranslations)) if (key.startsWith(componentKey + ".") || key === componentKey) delete itemTranslations[key];
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Remove all translations for an item
|
|
585
|
-
* @param id - The id of the item
|
|
586
|
-
*/
|
|
587
|
-
onItemDeleted(id) {
|
|
588
|
-
for (const locale of this.locales) delete this._translations[locale].itemTranslations?.[id];
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
|
|
592
433
|
//#endregion
|
|
593
434
|
//#region src/survey/utils/group-utils.ts
|
|
594
435
|
/**
|
|
@@ -757,6 +598,13 @@ const isBuiltInItemType = (itemType) => itemType in builtInItemCoreRegistry;
|
|
|
757
598
|
|
|
758
599
|
//#endregion
|
|
759
600
|
//#region src/survey/registry/item-registry.ts
|
|
601
|
+
/** Convert constructor registry to explicit definitions for higher-layer composition. */
|
|
602
|
+
function toItemTypeDefinitionRegistry(registry) {
|
|
603
|
+
return Object.fromEntries(Object.entries(registry).map(([itemType, constructor]) => [itemType, {
|
|
604
|
+
itemType,
|
|
605
|
+
constructor
|
|
606
|
+
}]));
|
|
607
|
+
}
|
|
760
608
|
/**
|
|
761
609
|
* Creates a handler instance for a raw survey item.
|
|
762
610
|
* Uses built-in registry for group/page-break, otherwise the provided plugin registry.
|
|
@@ -772,6 +620,200 @@ function createItemCore(rawItem, pluginRegistry) {
|
|
|
772
620
|
}
|
|
773
621
|
throw new Error(`Unknown item type: ${rawItem.itemType}`);
|
|
774
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Merge built-in handlers with plugin registry for a complete registry.
|
|
625
|
+
*/
|
|
626
|
+
function createFullRegistry(pluginRegistry) {
|
|
627
|
+
return {
|
|
628
|
+
...builtInItemCoreRegistry,
|
|
629
|
+
...pluginRegistry
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
/** Build full registry as explicit definitions for editor/ui composition. */
|
|
633
|
+
function createItemTypeDefinitionRegistry(pluginRegistry) {
|
|
634
|
+
return toItemTypeDefinitionRegistry(createFullRegistry(pluginRegistry));
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/survey/survey-file-schema.ts
|
|
639
|
+
const CURRENT_SURVEY_SCHEMA = "https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json";
|
|
640
|
+
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/survey/utils/translations.ts
|
|
643
|
+
const validateLocale = (locale) => {
|
|
644
|
+
if (locale.trim() === "") throw new Error("Locale cannot be empty");
|
|
645
|
+
};
|
|
646
|
+
var SurveyItemTranslations = class {
|
|
647
|
+
_translations;
|
|
648
|
+
constructor() {
|
|
649
|
+
this._translations = {};
|
|
650
|
+
}
|
|
651
|
+
setContent(locale, contentKey, content) {
|
|
652
|
+
validateLocale(locale);
|
|
653
|
+
if (!this._translations?.[locale]) {
|
|
654
|
+
if (!content) return;
|
|
655
|
+
this._translations[locale] = {};
|
|
656
|
+
}
|
|
657
|
+
if (!content) delete this._translations[locale][contentKey];
|
|
658
|
+
else this._translations[locale][contentKey] = content;
|
|
659
|
+
}
|
|
660
|
+
setAllForLocale(locale, content) {
|
|
661
|
+
validateLocale(locale);
|
|
662
|
+
if (!this._translations?.[locale]) {
|
|
663
|
+
if (!content) return;
|
|
664
|
+
this._translations[locale] = {};
|
|
665
|
+
}
|
|
666
|
+
this._translations[locale] = content || {};
|
|
667
|
+
}
|
|
668
|
+
get locales() {
|
|
669
|
+
return Object.keys(this._translations || {});
|
|
670
|
+
}
|
|
671
|
+
getAllForLocale(locale) {
|
|
672
|
+
return this._translations?.[locale];
|
|
673
|
+
}
|
|
674
|
+
getContent(locale, contentKey, fallbackLocale) {
|
|
675
|
+
const content = this._translations?.[locale]?.[contentKey];
|
|
676
|
+
if (content) return content;
|
|
677
|
+
if (fallbackLocale) return this._translations?.[fallbackLocale]?.[contentKey];
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
var SurveyTranslations = class {
|
|
681
|
+
_translations;
|
|
682
|
+
constructor(translations) {
|
|
683
|
+
this._translations = translations || {};
|
|
684
|
+
}
|
|
685
|
+
serialize() {
|
|
686
|
+
if (this.locales.length === 0) return;
|
|
687
|
+
return this._translations;
|
|
688
|
+
}
|
|
689
|
+
get locales() {
|
|
690
|
+
return Object.keys(this._translations);
|
|
691
|
+
}
|
|
692
|
+
removeLocale(locale) {
|
|
693
|
+
validateLocale(locale);
|
|
694
|
+
delete this._translations[locale];
|
|
695
|
+
}
|
|
696
|
+
renameLocale(oldLocale, newLocale) {
|
|
697
|
+
validateLocale(oldLocale);
|
|
698
|
+
validateLocale(newLocale);
|
|
699
|
+
if (this._translations[oldLocale]) {
|
|
700
|
+
this._translations[newLocale] = this._translations[oldLocale];
|
|
701
|
+
delete this._translations[oldLocale];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
cloneLocaleAs(locale, newLocale) {
|
|
705
|
+
validateLocale(locale);
|
|
706
|
+
validateLocale(newLocale);
|
|
707
|
+
if (this._translations[locale]) this._translations[newLocale] = structuredCloneMethod(this._translations[locale]);
|
|
708
|
+
}
|
|
709
|
+
get surveyCardContent() {
|
|
710
|
+
const translations = {};
|
|
711
|
+
for (const locale of this.locales) {
|
|
712
|
+
const contentForLocale = this._translations?.[locale]?.surveyCardContent;
|
|
713
|
+
if (contentForLocale) translations[locale] = contentForLocale;
|
|
714
|
+
}
|
|
715
|
+
return translations;
|
|
716
|
+
}
|
|
717
|
+
get navigationContent() {
|
|
718
|
+
const translations = {};
|
|
719
|
+
for (const locale of this.locales) {
|
|
720
|
+
const contentForLocale = this._translations?.[locale]?.navigationContent;
|
|
721
|
+
if (contentForLocale) translations[locale] = contentForLocale;
|
|
722
|
+
}
|
|
723
|
+
return translations;
|
|
724
|
+
}
|
|
725
|
+
get validationMessages() {
|
|
726
|
+
const translations = {};
|
|
727
|
+
for (const locale of this.locales) {
|
|
728
|
+
const contentForLocale = this._translations?.[locale]?.validationMessages;
|
|
729
|
+
if (contentForLocale) translations[locale] = contentForLocale;
|
|
730
|
+
}
|
|
731
|
+
return translations;
|
|
732
|
+
}
|
|
733
|
+
setSurveyCardContent(locale, content) {
|
|
734
|
+
validateLocale(locale);
|
|
735
|
+
if (!this._translations[locale]) {
|
|
736
|
+
if (!content) return;
|
|
737
|
+
this._translations[locale] = {};
|
|
738
|
+
}
|
|
739
|
+
this._translations[locale].surveyCardContent = content;
|
|
740
|
+
}
|
|
741
|
+
setNavigationContent(locale, content) {
|
|
742
|
+
validateLocale(locale);
|
|
743
|
+
if (!this._translations[locale]) {
|
|
744
|
+
if (!content) return;
|
|
745
|
+
this._translations[locale] = {};
|
|
746
|
+
}
|
|
747
|
+
this._translations[locale].navigationContent = content;
|
|
748
|
+
}
|
|
749
|
+
setValidationMessages(locale, content) {
|
|
750
|
+
validateLocale(locale);
|
|
751
|
+
if (!this._translations[locale]) {
|
|
752
|
+
if (!content) return;
|
|
753
|
+
this._translations[locale] = {};
|
|
754
|
+
}
|
|
755
|
+
this._translations[locale].validationMessages = content;
|
|
756
|
+
}
|
|
757
|
+
getItemTranslations(itemId) {
|
|
758
|
+
const itemTranslations = new SurveyItemTranslations();
|
|
759
|
+
for (const locale of this.locales) {
|
|
760
|
+
const contentForLocale = this._translations?.[locale].itemTranslations?.[itemId];
|
|
761
|
+
itemTranslations.setAllForLocale(locale, contentForLocale);
|
|
762
|
+
}
|
|
763
|
+
return itemTranslations;
|
|
764
|
+
}
|
|
765
|
+
setItemTranslations(itemId, itemContent) {
|
|
766
|
+
itemContent?.locales.forEach((locale) => validateLocale(locale));
|
|
767
|
+
if (!itemContent) {
|
|
768
|
+
for (const locale of this.locales) if (this._translations[locale].itemTranslations?.[itemId]) delete this._translations[locale].itemTranslations?.[itemId];
|
|
769
|
+
} else {
|
|
770
|
+
const localesInUpdate = itemContent.locales;
|
|
771
|
+
for (const locale of localesInUpdate) if (!this.locales.includes(locale)) this._translations[locale] = {};
|
|
772
|
+
for (const locale of this.locales) if (localesInUpdate.includes(locale)) {
|
|
773
|
+
if (!this._translations[locale]) this._translations[locale] = {};
|
|
774
|
+
if (!this._translations[locale].itemTranslations) this._translations[locale].itemTranslations = {};
|
|
775
|
+
this._translations[locale].itemTranslations[itemId] = itemContent.getAllForLocale(locale) ?? {};
|
|
776
|
+
} else delete this._translations[locale].itemTranslations[itemId];
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Rename a component key (within an item) - update key in all translations and remove old key
|
|
781
|
+
* @param itemKey - The key of the item
|
|
782
|
+
* @param oldKey - The old key of the component
|
|
783
|
+
* @param newKey - The new key of the component
|
|
784
|
+
*/
|
|
785
|
+
onComponentKeyChanged(itemKey, oldKey, newKey) {
|
|
786
|
+
for (const locale of this.locales) {
|
|
787
|
+
const itemTranslations = this._translations?.[locale].itemTranslations?.[itemKey];
|
|
788
|
+
if (itemTranslations) {
|
|
789
|
+
for (const key of Object.keys(itemTranslations)) if (key.startsWith(oldKey + ".") || key === oldKey) {
|
|
790
|
+
itemTranslations[key.replace(oldKey, newKey)] = { ...itemTranslations[key] };
|
|
791
|
+
delete itemTranslations[key];
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Remove all translations for a component
|
|
798
|
+
* @param itemId - The id of the item
|
|
799
|
+
* @param componentKey - The key of the component
|
|
800
|
+
*/
|
|
801
|
+
onComponentDeleted(itemId, componentKey) {
|
|
802
|
+
for (const locale of this.locales) {
|
|
803
|
+
const itemTranslations = this._translations?.[locale].itemTranslations?.[itemId];
|
|
804
|
+
if (itemTranslations) {
|
|
805
|
+
for (const key of Object.keys(itemTranslations)) if (key.startsWith(componentKey + ".") || key === componentKey) delete itemTranslations[key];
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Remove all translations for an item
|
|
811
|
+
* @param id - The id of the item
|
|
812
|
+
*/
|
|
813
|
+
onItemDeleted(id) {
|
|
814
|
+
for (const locale of this.locales) delete this._translations[locale].itemTranslations?.[id];
|
|
815
|
+
}
|
|
816
|
+
};
|
|
775
817
|
|
|
776
818
|
//#endregion
|
|
777
819
|
//#region src/survey/survey.ts
|
|
@@ -785,6 +827,10 @@ var Survey = class Survey {
|
|
|
785
827
|
this.pluginRegistry = pluginRegistry;
|
|
786
828
|
this._translations = new SurveyTranslations();
|
|
787
829
|
}
|
|
830
|
+
/** Plugin registry used when parsing items. Exposed for editors that re-parse without their own registry. */
|
|
831
|
+
getPluginRegistry() {
|
|
832
|
+
return this.pluginRegistry;
|
|
833
|
+
}
|
|
788
834
|
/**
|
|
789
835
|
* Create a survey item from raw JSON data.
|
|
790
836
|
* Uses the survey's plugin registry when available.
|
|
@@ -792,6 +838,26 @@ var Survey = class Survey {
|
|
|
792
838
|
createItemFromRaw(rawItem) {
|
|
793
839
|
return createItemCore(rawItem, this.pluginRegistry);
|
|
794
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* Create a minimal blank survey with a root group and one empty page.
|
|
843
|
+
*/
|
|
844
|
+
static createBlankSurvey(pluginRegistry, surveyKey) {
|
|
845
|
+
const newKey = surveyKey ?? generateCodingKey();
|
|
846
|
+
const rawSurvey = {
|
|
847
|
+
$schema: CURRENT_SURVEY_SCHEMA,
|
|
848
|
+
surveyItems: [{
|
|
849
|
+
id: generateId(),
|
|
850
|
+
key: newKey,
|
|
851
|
+
itemType: ReservedSurveyItemTypes.Group,
|
|
852
|
+
config: {
|
|
853
|
+
isRoot: true,
|
|
854
|
+
items: [],
|
|
855
|
+
shuffleItems: false
|
|
856
|
+
}
|
|
857
|
+
}]
|
|
858
|
+
};
|
|
859
|
+
return Survey.fromJson(rawSurvey, pluginRegistry);
|
|
860
|
+
}
|
|
795
861
|
static fromJson(json, pluginRegistry) {
|
|
796
862
|
const survey = new Survey(pluginRegistry);
|
|
797
863
|
const rawSurvey = json;
|
|
@@ -927,5 +993,5 @@ var Survey = class Survey {
|
|
|
927
993
|
};
|
|
928
994
|
|
|
929
995
|
//#endregion
|
|
930
|
-
export { ValueReference as C,
|
|
931
|
-
//# sourceMappingURL=survey-
|
|
996
|
+
export { ValueReference as A, ContextVariableType as C, FunctionExpressionNames as D, FunctionExpression as E, structuredCloneMethod as F, generateCodingKey as M, generateId as N, ResponseVariableExpression as O, shuffleIndices as P, ContextVariableExpression as S, ExpressionType as T, deserializeTemplateValue as _, createFullRegistry as a, serializeTemplateValues as b, toItemTypeDefinitionRegistry as c, builtInItemCoreRegistry as d, isBuiltInItemType as f, TemplateDefTypes as g, SurveyItemCore as h, validateLocale as i, ValueReferenceMethod as j, ReferenceUsageType as k, GroupItemCore as l, ReservedSurveyItemTypes as m, SurveyItemTranslations as n, createItemCore as o, SurveyItemKey as p, SurveyTranslations as r, createItemTypeDefinitionRegistry as s, Survey as t, PageBreakItemCore as u, deserializeTemplateValues as v, Expression as w, ConstExpression as x, serializeTemplateValue as y };
|
|
997
|
+
//# sourceMappingURL=survey-DQmpzihl.mjs.map
|