ngx-edyta-entity 0.1.3
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 +63 -0
- package/fesm2022/ngx-edyta-entity.mjs +1795 -0
- package/fesm2022/ngx-edyta-entity.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/canvas.component.d.ts +30 -0
- package/lib/canvas.module.d.ts +34 -0
- package/lib/entity/entity-bottom-pane/entity-bottom-pane.component.d.ts +18 -0
- package/lib/form/form-type/form-type-checkbox/form-type-checkbox.component.d.ts +11 -0
- package/lib/form/form-type/form-type-date/form-type-date.component.d.ts +11 -0
- package/lib/form/form-type/form-type-input/form-type-input.component.d.ts +11 -0
- package/lib/form/form-type/form-type-item/form-type-item.component.d.ts +15 -0
- package/lib/form/form-type/form-type-radio/form-type-radio.component.d.ts +11 -0
- package/lib/form/form-type/form-type-select/form-type-select.component.d.ts +11 -0
- package/lib/form/form-type/form-type-text/form-type-text.component.d.ts +5 -0
- package/lib/form/form-type/form-type-ukulele-chords/form-type-ukulele-chords.component.d.ts +8 -0
- package/lib/form/form.component.d.ts +20 -0
- package/lib/grammar/grammar.component.d.ts +10 -0
- package/lib/grammar/item/grammar-item.component.d.ts +10 -0
- package/lib/model/learning-entity/central-service.d.ts +19 -0
- package/lib/model/learning-entity/convertors/form-learning-entity-content-convertor.d.ts +5 -0
- package/lib/model/learning-entity/convertors/grammar-learning-entity-content-convertor.d.ts +5 -0
- package/lib/model/learning-entity/convertors/learning-entity-content-convertor.d.ts +4 -0
- package/lib/model/learning-entity/convertors/learning-entity-convertor-factory.d.ts +4 -0
- package/lib/model/learning-entity/convertors/puzzle-learning-entity-content-convertor.d.ts +7 -0
- package/lib/model/learning-entity/convertors/riddle-learning-entity-content-convertor.d.ts +5 -0
- package/lib/model/learning-entity/convertors/vocabulary-learning-entity-content-convertor.d.ts +8 -0
- package/lib/model/learning-entity/convertors/yes-no-learning-entity-content-convertor.d.ts +5 -0
- package/lib/model/learning-entity/form-learning-entity.d.ts +11 -0
- package/lib/model/learning-entity/form-learning-entity.type.d.ts +77 -0
- package/lib/model/learning-entity/grammar-learning-entity.d.ts +8 -0
- package/lib/model/learning-entity/grammar-learning-entity.type.d.ts +32 -0
- package/lib/model/learning-entity/interactive-learning-entity.d.ts +14 -0
- package/lib/model/learning-entity/learning-entity-factory.d.ts +12 -0
- package/lib/model/learning-entity/learning-entity-progress-service.d.ts +6 -0
- package/lib/model/learning-entity/learning-entity-service.d.ts +39 -0
- package/lib/model/learning-entity/learning-entity.d.ts +70 -0
- package/lib/model/learning-entity/puzzle-learning-entity.d.ts +11 -0
- package/lib/model/learning-entity/puzzle-learning-entity.type.d.ts +77 -0
- package/lib/model/learning-entity/riddle-learning-entity.d.ts +11 -0
- package/lib/model/learning-entity/riddle-learning-entity.type.d.ts +45 -0
- package/lib/model/learning-entity/vocabulary-learning-entity.d.ts +18 -0
- package/lib/model/learning-entity/vocabulary-learning-entity.type.d.ts +42 -0
- package/lib/model/learning-entity/yes-no-learning-entity.d.ts +11 -0
- package/lib/model/learning-entity/yes-no-learning-entity.type.d.ts +30 -0
- package/lib/puzzle/puzzle-base.component.d.ts +22 -0
- package/lib/puzzle/puzzle-drop-target.component.d.ts +30 -0
- package/lib/puzzle/puzzle-fact/puzzle-fact.component.d.ts +35 -0
- package/lib/puzzle/puzzle-option/puzzle-option-dialog/puzzle-option-dialog.component.d.ts +26 -0
- package/lib/puzzle/puzzle-option/puzzle-option.component.d.ts +27 -0
- package/lib/puzzle/puzzle-option-dialog-base.component.d.ts +16 -0
- package/lib/puzzle/puzzle-target/puzzle-target.component.d.ts +31 -0
- package/lib/puzzle/puzzle.component.d.ts +44 -0
- package/lib/riddle/convertors/riddle-input-convertor.d.ts +4 -0
- package/lib/riddle/riddle.component.d.ts +29 -0
- package/lib/vocabulary/vocabulary-card-base.component.d.ts +22 -0
- package/lib/vocabulary/vocabulary-card-flip/vocabulary-card-flip.component.d.ts +10 -0
- package/lib/vocabulary/vocabulary-card-standard/vocabulary-card-standard.component.d.ts +6 -0
- package/lib/vocabulary/vocabulary.component.d.ts +25 -0
- package/lib/yesno/yes-no.component.d.ts +17 -0
- package/package.json +23 -0
- package/public-api.d.ts +18 -0
|
@@ -0,0 +1,1795 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Output, Component, Input, ViewEncapsulation, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/router';
|
|
6
|
+
import { RouterModule } from '@angular/router';
|
|
7
|
+
import * as i2$1 from '@angular/forms';
|
|
8
|
+
import { FormsModule } from '@angular/forms';
|
|
9
|
+
import * as i2$2 from 'ngx-edyta-fe-elements';
|
|
10
|
+
import { ElementModule } from 'ngx-edyta-fe-elements';
|
|
11
|
+
import * as i2$3 from 'ngx-edyta-chords';
|
|
12
|
+
import { ChordModule } from 'ngx-edyta-chords';
|
|
13
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
14
|
+
|
|
15
|
+
class PuzzleOptionDialogBaseComponent {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._factSelected = new EventEmitter();
|
|
18
|
+
this._back2OptionsSection = new EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
get factSelected() {
|
|
21
|
+
return this._factSelected;
|
|
22
|
+
}
|
|
23
|
+
set factSelected(value) {
|
|
24
|
+
this._factSelected = value;
|
|
25
|
+
}
|
|
26
|
+
get back2OptionsSection() {
|
|
27
|
+
return this._back2OptionsSection;
|
|
28
|
+
}
|
|
29
|
+
set back2OptionsSection(value) {
|
|
30
|
+
this._back2OptionsSection = value;
|
|
31
|
+
}
|
|
32
|
+
onFactSelected(stateItem) {
|
|
33
|
+
this.factSelected.emit(stateItem);
|
|
34
|
+
}
|
|
35
|
+
onBack2OptionsSection(optionId) {
|
|
36
|
+
this.back2OptionsSection.emit(optionId);
|
|
37
|
+
}
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionDialogBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
39
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleOptionDialogBaseComponent, isStandalone: false, selector: "ng-component", outputs: { factSelected: "factSelected", back2OptionsSection: "back2OptionsSection" }, ngImport: i0, template: '', isInline: true }); }
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionDialogBaseComponent, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{
|
|
44
|
+
template: '',
|
|
45
|
+
standalone: false
|
|
46
|
+
}]
|
|
47
|
+
}], ctorParameters: () => [], propDecorators: { factSelected: [{
|
|
48
|
+
type: Output
|
|
49
|
+
}], back2OptionsSection: [{
|
|
50
|
+
type: Output
|
|
51
|
+
}] } });
|
|
52
|
+
|
|
53
|
+
var DragAction;
|
|
54
|
+
(function (DragAction) {
|
|
55
|
+
DragAction["Enter"] = "enter";
|
|
56
|
+
DragAction["Over"] = "over";
|
|
57
|
+
DragAction["Leave"] = "leave";
|
|
58
|
+
})(DragAction || (DragAction = {}));
|
|
59
|
+
class PuzzleDropTargetComponent extends PuzzleOptionDialogBaseComponent {
|
|
60
|
+
static { this._dependencies = {
|
|
61
|
+
EventEmitter
|
|
62
|
+
}; }
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
this._dragTargetActive = false;
|
|
66
|
+
this._dropped = new PuzzleDropTargetComponent._dependencies.EventEmitter();
|
|
67
|
+
}
|
|
68
|
+
get dragTargetActive() {
|
|
69
|
+
return this._dragTargetActive;
|
|
70
|
+
}
|
|
71
|
+
set dragTargetActive(value) {
|
|
72
|
+
this._dragTargetActive = value;
|
|
73
|
+
}
|
|
74
|
+
get dropped() {
|
|
75
|
+
return this._dropped;
|
|
76
|
+
}
|
|
77
|
+
onDrop(event) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
this.dragTargetActive = false;
|
|
80
|
+
const dataTransfer = event.dataTransfer;
|
|
81
|
+
const elementId = dataTransfer.getData('text/plain');
|
|
82
|
+
const id = elementId?.replace('puzzle-item-', '') || '';
|
|
83
|
+
if (!elementId || !id) {
|
|
84
|
+
dataTransfer.clearData();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const possibleDropZones = [
|
|
88
|
+
event.target,
|
|
89
|
+
event.target.parentElement?.parentElement
|
|
90
|
+
];
|
|
91
|
+
const targetDropZone = possibleDropZones.find(dropZone => !!dropZone?.classList.contains('dropzone'));
|
|
92
|
+
if (!targetDropZone) {
|
|
93
|
+
dataTransfer.clearData();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const draggableElement = document.getElementById(elementId).parentElement;
|
|
97
|
+
targetDropZone.appendChild(draggableElement);
|
|
98
|
+
dataTransfer.clearData();
|
|
99
|
+
this._emitDrop(id);
|
|
100
|
+
}
|
|
101
|
+
onDragEnter(event) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
this.dragTargetActive = true;
|
|
104
|
+
}
|
|
105
|
+
onDragOver(event) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
this.dragTargetActive = true;
|
|
108
|
+
}
|
|
109
|
+
onDragLeave(event) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
this.dragTargetActive = false;
|
|
112
|
+
}
|
|
113
|
+
_emitDrop(id) {
|
|
114
|
+
this._dropped.emit(id);
|
|
115
|
+
}
|
|
116
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleDropTargetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
117
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleDropTargetComponent, isStandalone: false, selector: "ng-component", inputs: { dragTargetActive: "dragTargetActive" }, outputs: { dropped: "dropped" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
118
|
+
}
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleDropTargetComponent, decorators: [{
|
|
120
|
+
type: Component,
|
|
121
|
+
args: [{
|
|
122
|
+
template: '',
|
|
123
|
+
standalone: false
|
|
124
|
+
}]
|
|
125
|
+
}], ctorParameters: () => [], propDecorators: { dragTargetActive: [{
|
|
126
|
+
type: Input
|
|
127
|
+
}], dropped: [{
|
|
128
|
+
type: Output
|
|
129
|
+
}] } });
|
|
130
|
+
|
|
131
|
+
class EntityBottomPaneComponent {
|
|
132
|
+
constructor() {
|
|
133
|
+
this._evaluate = new EventEmitter();
|
|
134
|
+
}
|
|
135
|
+
get entity() {
|
|
136
|
+
return this._entity;
|
|
137
|
+
}
|
|
138
|
+
set entity(entity) {
|
|
139
|
+
this._entity = entity;
|
|
140
|
+
}
|
|
141
|
+
get evaluate() {
|
|
142
|
+
return this._evaluate;
|
|
143
|
+
}
|
|
144
|
+
set evaluate(value) {
|
|
145
|
+
this._evaluate = value;
|
|
146
|
+
}
|
|
147
|
+
onEvaluate() {
|
|
148
|
+
this.evaluate.emit();
|
|
149
|
+
}
|
|
150
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EntityBottomPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
151
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: EntityBottomPaneComponent, isStandalone: false, selector: "edyta-entity-bottom-pane", inputs: { checkButtonText: "checkButtonText", previousButtonText: "previousButtonText", nextButtonText: "nextButtonText", entity: "entity" }, outputs: { evaluate: "evaluate" }, ngImport: i0, template: "<div class=\"uk-margin-medium-top\" uk-grid>\n <div class=\"uk-width-auto\">\n <a *ngIf=\"entity.previousEntityId\" [routerLink]=\"['/', entity.organizationKey, 'level', entity.levelId, 'entity', entity.previousEntityId]\" role=\"button\" class=\"uk-button uk-button-secondary\">\n <ng-container [ngTemplateOutlet]=\"previousText\"></ng-container>\n </a>\n <!-- for keeping div width same if the previous entity id is not provided -->\n <div *ngIf=\"!entity.previousEntityId\" class=\"uk-button transparent-button\">\n <ng-container [ngTemplateOutlet]=\"previousText\"></ng-container>\n </div>\n </div>\n <div class=\"uk-width-expand uk-text-center\">\n <button *ngIf=\"entity.isCheckable()\" type=\"button\" class=\"uk-button uk-button-primary\" (click)=\"onEvaluate()\">{{ checkButtonText }}</button>\n </div>\n <div class=\"uk-width-auto uk-text-right\">\n <a *ngIf=\"entity.nextEntityId\" [routerLink]=\"['/', entity.organizationKey, 'level', entity.levelId, 'entity', entity.nextEntityId]\" routerLinkActive=\"router-link-active\" role=\"button\" class=\"uk-button uk-button-secondary\">\n <ng-container [ngTemplateOutlet]=\"nextText\"></ng-container>\n </a>\n <!-- for keeping div width same if the next entity id is not provided -->\n <div *ngIf=\"!entity.nextEntityId\" class=\"uk-button transparent-button\">\n <ng-container [ngTemplateOutlet]=\"nextText\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #previousText>\n <i class=\"mdi mdi-chevron-left\"></i>\n <span class=\"uk-visible@m\">{{ previousButtonText }}</span>\n</ng-template>\n\n<ng-template #nextText>\n <span class=\"uk-visible@m\">{{ nextButtonText }}</span>\n <i class=\"mdi mdi-chevron-right\"></i>\n</ng-template>\n", styles: [".transparent-button{color:transparent;text-decoration:none;cursor:default}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i2.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }] }); }
|
|
152
|
+
}
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EntityBottomPaneComponent, decorators: [{
|
|
154
|
+
type: Component,
|
|
155
|
+
args: [{ selector: 'edyta-entity-bottom-pane', standalone: false, template: "<div class=\"uk-margin-medium-top\" uk-grid>\n <div class=\"uk-width-auto\">\n <a *ngIf=\"entity.previousEntityId\" [routerLink]=\"['/', entity.organizationKey, 'level', entity.levelId, 'entity', entity.previousEntityId]\" role=\"button\" class=\"uk-button uk-button-secondary\">\n <ng-container [ngTemplateOutlet]=\"previousText\"></ng-container>\n </a>\n <!-- for keeping div width same if the previous entity id is not provided -->\n <div *ngIf=\"!entity.previousEntityId\" class=\"uk-button transparent-button\">\n <ng-container [ngTemplateOutlet]=\"previousText\"></ng-container>\n </div>\n </div>\n <div class=\"uk-width-expand uk-text-center\">\n <button *ngIf=\"entity.isCheckable()\" type=\"button\" class=\"uk-button uk-button-primary\" (click)=\"onEvaluate()\">{{ checkButtonText }}</button>\n </div>\n <div class=\"uk-width-auto uk-text-right\">\n <a *ngIf=\"entity.nextEntityId\" [routerLink]=\"['/', entity.organizationKey, 'level', entity.levelId, 'entity', entity.nextEntityId]\" routerLinkActive=\"router-link-active\" role=\"button\" class=\"uk-button uk-button-secondary\">\n <ng-container [ngTemplateOutlet]=\"nextText\"></ng-container>\n </a>\n <!-- for keeping div width same if the next entity id is not provided -->\n <div *ngIf=\"!entity.nextEntityId\" class=\"uk-button transparent-button\">\n <ng-container [ngTemplateOutlet]=\"nextText\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #previousText>\n <i class=\"mdi mdi-chevron-left\"></i>\n <span class=\"uk-visible@m\">{{ previousButtonText }}</span>\n</ng-template>\n\n<ng-template #nextText>\n <span class=\"uk-visible@m\">{{ nextButtonText }}</span>\n <i class=\"mdi mdi-chevron-right\"></i>\n</ng-template>\n", styles: [".transparent-button{color:transparent;text-decoration:none;cursor:default}\n"] }]
|
|
156
|
+
}], ctorParameters: () => [], propDecorators: { checkButtonText: [{
|
|
157
|
+
type: Input,
|
|
158
|
+
args: [{ required: true }]
|
|
159
|
+
}], previousButtonText: [{
|
|
160
|
+
type: Input,
|
|
161
|
+
args: [{ required: true }]
|
|
162
|
+
}], nextButtonText: [{
|
|
163
|
+
type: Input,
|
|
164
|
+
args: [{ required: true }]
|
|
165
|
+
}], entity: [{
|
|
166
|
+
type: Input,
|
|
167
|
+
args: [{ required: true }]
|
|
168
|
+
}], evaluate: [{
|
|
169
|
+
type: Output
|
|
170
|
+
}] } });
|
|
171
|
+
|
|
172
|
+
class PuzzleBaseComponent extends PuzzleOptionDialogBaseComponent {
|
|
173
|
+
get entity() {
|
|
174
|
+
return this._entity;
|
|
175
|
+
}
|
|
176
|
+
set entity(entity) {
|
|
177
|
+
this._entity = entity;
|
|
178
|
+
}
|
|
179
|
+
get text() {
|
|
180
|
+
return this._text;
|
|
181
|
+
}
|
|
182
|
+
set text(value) {
|
|
183
|
+
this._text = value;
|
|
184
|
+
}
|
|
185
|
+
get id() {
|
|
186
|
+
return this._id;
|
|
187
|
+
}
|
|
188
|
+
set id(value) {
|
|
189
|
+
this._id = value;
|
|
190
|
+
}
|
|
191
|
+
get color() {
|
|
192
|
+
return this._color;
|
|
193
|
+
}
|
|
194
|
+
set color(value) {
|
|
195
|
+
this._color = value;
|
|
196
|
+
}
|
|
197
|
+
getTextColor(color) {
|
|
198
|
+
return color.requested.text ? color.text : undefined;
|
|
199
|
+
}
|
|
200
|
+
getBackgroundColor(color) {
|
|
201
|
+
return color.requested.background ? color.background : undefined;
|
|
202
|
+
}
|
|
203
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
204
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleBaseComponent, isStandalone: false, selector: "ng-component", inputs: { entity: "entity", text: "text", id: "id", color: "color" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
205
|
+
}
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleBaseComponent, decorators: [{
|
|
207
|
+
type: Component,
|
|
208
|
+
args: [{
|
|
209
|
+
template: '',
|
|
210
|
+
standalone: false
|
|
211
|
+
}]
|
|
212
|
+
}], propDecorators: { entity: [{
|
|
213
|
+
type: Input,
|
|
214
|
+
args: [{ required: true }]
|
|
215
|
+
}], text: [{
|
|
216
|
+
type: Input,
|
|
217
|
+
args: [{ required: true }]
|
|
218
|
+
}], id: [{
|
|
219
|
+
type: Input,
|
|
220
|
+
args: [{ required: true }]
|
|
221
|
+
}], color: [{
|
|
222
|
+
type: Input,
|
|
223
|
+
args: [{ required: true }]
|
|
224
|
+
}] } });
|
|
225
|
+
|
|
226
|
+
class PuzzleOptionDialogComponent extends PuzzleOptionDialogBaseComponent {
|
|
227
|
+
constructor() {
|
|
228
|
+
super(...arguments);
|
|
229
|
+
this._text = '';
|
|
230
|
+
this._id = '';
|
|
231
|
+
this._selectedFactId = '';
|
|
232
|
+
this._back2OptionsSectionMode = false;
|
|
233
|
+
}
|
|
234
|
+
get entity() {
|
|
235
|
+
return this._entity;
|
|
236
|
+
}
|
|
237
|
+
set entity(entity) {
|
|
238
|
+
this._entity = entity;
|
|
239
|
+
this._selectedFactId = this._entity.content.facts[0].id;
|
|
240
|
+
}
|
|
241
|
+
get text() {
|
|
242
|
+
return this._text;
|
|
243
|
+
}
|
|
244
|
+
set text(value) {
|
|
245
|
+
this._text = value;
|
|
246
|
+
}
|
|
247
|
+
get id() {
|
|
248
|
+
return this._id;
|
|
249
|
+
}
|
|
250
|
+
set id(value) {
|
|
251
|
+
this._id = value;
|
|
252
|
+
}
|
|
253
|
+
get back2OptionsSectionMode() {
|
|
254
|
+
return this._back2OptionsSectionMode;
|
|
255
|
+
}
|
|
256
|
+
set back2OptionsSectionMode(value) {
|
|
257
|
+
this._back2OptionsSectionMode = value;
|
|
258
|
+
}
|
|
259
|
+
get selectedFactId() {
|
|
260
|
+
return this._selectedFactId;
|
|
261
|
+
}
|
|
262
|
+
set selectedFactId(value) {
|
|
263
|
+
this._selectedFactId = value;
|
|
264
|
+
}
|
|
265
|
+
onFactSelected() {
|
|
266
|
+
this.factSelected.emit({ optionId: this.id, factId: this.selectedFactId });
|
|
267
|
+
}
|
|
268
|
+
onBack2OptionsSection() {
|
|
269
|
+
this.back2OptionsSection.emit(this.id);
|
|
270
|
+
}
|
|
271
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionDialogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
272
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleOptionDialogComponent, isStandalone: false, selector: "[edyta-puzzle-option-dialog]", inputs: { assignButtonText: "assignButtonText", back2OptionSelectionButtonText: "back2OptionSelectionButtonText", entity: "entity", text: "text", id: "id", back2OptionsSectionMode: "back2OptionsSectionMode" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-card uk-card-default uk-card-small\">\n <div class=\"uk-card-header\">\n <h3 class=\"uk-card-title\">{{text}}</h3>\n </div>\n <div class=\"uk-card-body\">\n <select class=\"uk-select\" [(ngModel)]=\"selectedFactId\" name=\"{{id}}\">\n <option *ngFor=\"let fact of entity.content.facts\" [value]=\"fact.id\">{{fact.text}}</option>\n </select>\n </div>\n <div class=\"uk-card-footer\">\n <div>\n <button class=\"uk-button uk-button-small uk-button-primary\" (click)=\"onFactSelected()\">{{ assignButtonText }}</button>\n </div>\n <div *ngIf=\"back2OptionsSectionMode\" class=\"uk-margin-small-top\">\n <button class=\"uk-button uk-button-small uk-button-default\" (click)=\"onBack2OptionsSection()\">{{ back2OptionSelectionButtonText }}</button>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
273
|
+
}
|
|
274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionDialogComponent, decorators: [{
|
|
275
|
+
type: Component,
|
|
276
|
+
args: [{ selector: '[edyta-puzzle-option-dialog]', standalone: false, template: "<div class=\"uk-card uk-card-default uk-card-small\">\n <div class=\"uk-card-header\">\n <h3 class=\"uk-card-title\">{{text}}</h3>\n </div>\n <div class=\"uk-card-body\">\n <select class=\"uk-select\" [(ngModel)]=\"selectedFactId\" name=\"{{id}}\">\n <option *ngFor=\"let fact of entity.content.facts\" [value]=\"fact.id\">{{fact.text}}</option>\n </select>\n </div>\n <div class=\"uk-card-footer\">\n <div>\n <button class=\"uk-button uk-button-small uk-button-primary\" (click)=\"onFactSelected()\">{{ assignButtonText }}</button>\n </div>\n <div *ngIf=\"back2OptionsSectionMode\" class=\"uk-margin-small-top\">\n <button class=\"uk-button uk-button-small uk-button-default\" (click)=\"onBack2OptionsSection()\">{{ back2OptionSelectionButtonText }}</button>\n </div>\n </div>\n</div>\n" }]
|
|
277
|
+
}], propDecorators: { assignButtonText: [{
|
|
278
|
+
type: Input,
|
|
279
|
+
args: [{ required: true }]
|
|
280
|
+
}], back2OptionSelectionButtonText: [{
|
|
281
|
+
type: Input,
|
|
282
|
+
args: [{ required: true }]
|
|
283
|
+
}], entity: [{
|
|
284
|
+
type: Input,
|
|
285
|
+
args: [{ required: true }]
|
|
286
|
+
}], text: [{
|
|
287
|
+
type: Input,
|
|
288
|
+
args: [{ required: true }]
|
|
289
|
+
}], id: [{
|
|
290
|
+
type: Input,
|
|
291
|
+
args: [{ required: true }]
|
|
292
|
+
}], back2OptionsSectionMode: [{
|
|
293
|
+
type: Input
|
|
294
|
+
}] } });
|
|
295
|
+
|
|
296
|
+
class PuzzleOptionComponent extends PuzzleBaseComponent {
|
|
297
|
+
static { this._dependencies = {
|
|
298
|
+
EventEmitter
|
|
299
|
+
}; }
|
|
300
|
+
constructor() {
|
|
301
|
+
super();
|
|
302
|
+
this._back2OptionsSectionMode = false;
|
|
303
|
+
this._dragIsActive = false;
|
|
304
|
+
this._dragged = new PuzzleOptionComponent._dependencies.EventEmitter();
|
|
305
|
+
}
|
|
306
|
+
get back2OptionsSectionMode() {
|
|
307
|
+
return this._back2OptionsSectionMode;
|
|
308
|
+
}
|
|
309
|
+
set back2OptionsSectionMode(value) {
|
|
310
|
+
this._back2OptionsSectionMode = value;
|
|
311
|
+
}
|
|
312
|
+
get dragIsActive() {
|
|
313
|
+
return this._dragIsActive;
|
|
314
|
+
}
|
|
315
|
+
set dragIsActive(value) {
|
|
316
|
+
this._dragIsActive = value;
|
|
317
|
+
}
|
|
318
|
+
get dragged() {
|
|
319
|
+
return this._dragged;
|
|
320
|
+
}
|
|
321
|
+
onDragStart(event) {
|
|
322
|
+
const dataTransfer = event.dataTransfer;
|
|
323
|
+
const element = event.target;
|
|
324
|
+
dataTransfer.setData('text/plain', element.id);
|
|
325
|
+
this.dragIsActive = true;
|
|
326
|
+
this._dragged.emit(true);
|
|
327
|
+
}
|
|
328
|
+
onDragEnd() {
|
|
329
|
+
this.dragIsActive = false;
|
|
330
|
+
this._dragged.emit(false);
|
|
331
|
+
}
|
|
332
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
333
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleOptionComponent, isStandalone: false, selector: "edyta-puzzle-option", inputs: { assignButtonText: "assignButtonText", back2OptionSelectionButtonText: "back2OptionSelectionButtonText", back2OptionsSectionMode: "back2OptionsSectionMode" }, outputs: { dragged: "dragged" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin-small-bottom uk-margin-small-top uk-padding-small puzzle-item\" [ngClass]=\"{ 'drag-is-active': dragIsActive }\" id=\"{{ 'puzzle-item-' + id }}\"\n [style.color]=\"getTextColor(color)\" [style.background-color]=\"getBackgroundColor(color)\" draggable=\"true\" (dragstart)=\"onDragStart($event)\" (dragend)=\"onDragEnd()\">\n {{ text }}\n</div>\n<div edyta-puzzle-option-dialog [id]=\"id\" [text]=\"text\" [entity]=\"entity\" [back2OptionsSectionMode]=\"back2OptionsSectionMode\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\" uk-drop=\"mode: click; pos: bottom-center\"></div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: PuzzleOptionDialogComponent, selector: "[edyta-puzzle-option-dialog]", inputs: ["assignButtonText", "back2OptionSelectionButtonText", "entity", "text", "id", "back2OptionsSectionMode"] }] }); }
|
|
334
|
+
}
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleOptionComponent, decorators: [{
|
|
336
|
+
type: Component,
|
|
337
|
+
args: [{ selector: 'edyta-puzzle-option', standalone: false, template: "<div class=\"uk-margin-small-bottom uk-margin-small-top uk-padding-small puzzle-item\" [ngClass]=\"{ 'drag-is-active': dragIsActive }\" id=\"{{ 'puzzle-item-' + id }}\"\n [style.color]=\"getTextColor(color)\" [style.background-color]=\"getBackgroundColor(color)\" draggable=\"true\" (dragstart)=\"onDragStart($event)\" (dragend)=\"onDragEnd()\">\n {{ text }}\n</div>\n<div edyta-puzzle-option-dialog [id]=\"id\" [text]=\"text\" [entity]=\"entity\" [back2OptionsSectionMode]=\"back2OptionsSectionMode\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\" uk-drop=\"mode: click; pos: bottom-center\"></div>\n" }]
|
|
338
|
+
}], ctorParameters: () => [], propDecorators: { assignButtonText: [{
|
|
339
|
+
type: Input,
|
|
340
|
+
args: [{ required: true }]
|
|
341
|
+
}], back2OptionSelectionButtonText: [{
|
|
342
|
+
type: Input,
|
|
343
|
+
args: [{ required: true }]
|
|
344
|
+
}], back2OptionsSectionMode: [{
|
|
345
|
+
type: Input
|
|
346
|
+
}], dragged: [{
|
|
347
|
+
type: Output
|
|
348
|
+
}] } });
|
|
349
|
+
|
|
350
|
+
class PuzzleTargetComponent extends PuzzleDropTargetComponent {
|
|
351
|
+
constructor() {
|
|
352
|
+
super();
|
|
353
|
+
this._text = '';
|
|
354
|
+
this._id = '';
|
|
355
|
+
this._dropTargetActive = false;
|
|
356
|
+
this._assignedOptions = [];
|
|
357
|
+
this._dragged = new PuzzleDropTargetComponent._dependencies.EventEmitter();
|
|
358
|
+
}
|
|
359
|
+
get entity() {
|
|
360
|
+
return this._entity;
|
|
361
|
+
}
|
|
362
|
+
set entity(entity) {
|
|
363
|
+
this._entity = entity;
|
|
364
|
+
}
|
|
365
|
+
get text() {
|
|
366
|
+
return this._text;
|
|
367
|
+
}
|
|
368
|
+
set text(value) {
|
|
369
|
+
this._text = value;
|
|
370
|
+
}
|
|
371
|
+
get id() {
|
|
372
|
+
return this._id;
|
|
373
|
+
}
|
|
374
|
+
set id(value) {
|
|
375
|
+
this._id = value;
|
|
376
|
+
}
|
|
377
|
+
get dropTargetActive() {
|
|
378
|
+
return this._dropTargetActive;
|
|
379
|
+
}
|
|
380
|
+
set dropTargetActive(value) {
|
|
381
|
+
this._dropTargetActive = value;
|
|
382
|
+
}
|
|
383
|
+
get assignedOptions() {
|
|
384
|
+
return this._assignedOptions;
|
|
385
|
+
}
|
|
386
|
+
set assignedOptions(value) {
|
|
387
|
+
this._assignedOptions = value;
|
|
388
|
+
}
|
|
389
|
+
get dragged() {
|
|
390
|
+
return this._dragged;
|
|
391
|
+
}
|
|
392
|
+
set dragged(value) {
|
|
393
|
+
this._dragged = value;
|
|
394
|
+
}
|
|
395
|
+
onDragged(isDragged) {
|
|
396
|
+
this.dragged.emit(isDragged);
|
|
397
|
+
}
|
|
398
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleTargetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
399
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleTargetComponent, isStandalone: false, selector: "edyta-puzzle-target", inputs: { assignButtonText: "assignButtonText", back2OptionSelectionButtonText: "back2OptionSelectionButtonText", entity: "entity", text: "text", id: "id", dropTargetActive: "dropTargetActive", assignedOptions: "assignedOptions" }, outputs: { dragged: "dragged" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-width-1-2 uk-float-right\">\n <div class=\"uk-margin-small-bottom uk-margin-small-top puzzle-item dropzone\"\n [ngClass]=\"{'drop-target-highlight': dropTargetActive, 'drag-target-highlight': dragTargetActive}\"\n (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\">\n <edyta-puzzle-option *ngFor=\"let puzzle of assignedOptions\" [text]=\"puzzle.text\" [id]=\"puzzle.id\" [color]=\"puzzle.color\" [entity]=\"entity\" [back2OptionsSectionMode]=\"true\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\"></edyta-puzzle-option>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PuzzleOptionComponent, selector: "edyta-puzzle-option", inputs: ["assignButtonText", "back2OptionSelectionButtonText", "back2OptionsSectionMode"], outputs: ["dragged"] }] }); }
|
|
400
|
+
}
|
|
401
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleTargetComponent, decorators: [{
|
|
402
|
+
type: Component,
|
|
403
|
+
args: [{ selector: 'edyta-puzzle-target', standalone: false, template: "<div class=\"uk-width-1-2 uk-float-right\">\n <div class=\"uk-margin-small-bottom uk-margin-small-top puzzle-item dropzone\"\n [ngClass]=\"{'drop-target-highlight': dropTargetActive, 'drag-target-highlight': dragTargetActive}\"\n (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\">\n <edyta-puzzle-option *ngFor=\"let puzzle of assignedOptions\" [text]=\"puzzle.text\" [id]=\"puzzle.id\" [color]=\"puzzle.color\" [entity]=\"entity\" [back2OptionsSectionMode]=\"true\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\"></edyta-puzzle-option>\n </div>\n</div>\n" }]
|
|
404
|
+
}], ctorParameters: () => [], propDecorators: { assignButtonText: [{
|
|
405
|
+
type: Input,
|
|
406
|
+
args: [{ required: true }]
|
|
407
|
+
}], back2OptionSelectionButtonText: [{
|
|
408
|
+
type: Input,
|
|
409
|
+
args: [{ required: true }]
|
|
410
|
+
}], entity: [{
|
|
411
|
+
type: Input,
|
|
412
|
+
args: [{ required: true }]
|
|
413
|
+
}], text: [{
|
|
414
|
+
type: Input
|
|
415
|
+
}], id: [{
|
|
416
|
+
type: Input
|
|
417
|
+
}], dropTargetActive: [{
|
|
418
|
+
type: Input
|
|
419
|
+
}], assignedOptions: [{
|
|
420
|
+
type: Input
|
|
421
|
+
}], dragged: [{
|
|
422
|
+
type: Output
|
|
423
|
+
}] } });
|
|
424
|
+
|
|
425
|
+
class PuzzleFactComponent extends PuzzleBaseComponent {
|
|
426
|
+
static { this._dependencies = {
|
|
427
|
+
EventEmitter
|
|
428
|
+
}; }
|
|
429
|
+
constructor() {
|
|
430
|
+
super();
|
|
431
|
+
this._dropTargetActive = false;
|
|
432
|
+
this._assignedOptions = [];
|
|
433
|
+
this._dropped = new PuzzleFactComponent._dependencies.EventEmitter();
|
|
434
|
+
this._dragged = new PuzzleFactComponent._dependencies.EventEmitter();
|
|
435
|
+
}
|
|
436
|
+
get dropTargetActive() {
|
|
437
|
+
return this._dropTargetActive;
|
|
438
|
+
}
|
|
439
|
+
set dropTargetActive(value) {
|
|
440
|
+
this._dropTargetActive = value;
|
|
441
|
+
}
|
|
442
|
+
get assignedOptions() {
|
|
443
|
+
return this._assignedOptions;
|
|
444
|
+
}
|
|
445
|
+
set assignedOptions(value) {
|
|
446
|
+
this._assignedOptions = value;
|
|
447
|
+
}
|
|
448
|
+
get dropped() {
|
|
449
|
+
return this._dropped;
|
|
450
|
+
}
|
|
451
|
+
get dragged() {
|
|
452
|
+
return this._dragged;
|
|
453
|
+
}
|
|
454
|
+
set dragged(value) {
|
|
455
|
+
this._dragged = value;
|
|
456
|
+
}
|
|
457
|
+
onDropped(id) {
|
|
458
|
+
this._dropped.emit({ factId: this.id, optionId: id });
|
|
459
|
+
}
|
|
460
|
+
onDragged(isDragged) {
|
|
461
|
+
this.dragged.emit(isDragged);
|
|
462
|
+
}
|
|
463
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleFactComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
464
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleFactComponent, isStandalone: false, selector: "edyta-puzzle-fact", inputs: { assignButtonText: "assignButtonText", back2OptionSelectionButtonText: "back2OptionSelectionButtonText", dropTargetActive: "dropTargetActive", assignedOptions: "assignedOptions" }, outputs: { dropped: "dropped", dragged: "dragged" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-width-1-2 uk-float-left uk-padding-small uk-padding-remove-vertical\">\n <div class=\"puzzle-fact-item-border\">\n <div class=\"uk-margin-small-bottom uk-margin-small-top puzzle-item\" [style.color]=\"getTextColor(color)\" [style.background-color]=\"getBackgroundColor(color)\">\n {{ text }}\n </div>\n </div>\n</div>\n<edyta-puzzle-target [id]=\"id\" [assignedOptions]=\"assignedOptions\" [dropTargetActive]=\"dropTargetActive\" [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dropped)=\"onDropped($event)\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\">\n</edyta-puzzle-target>\n", styles: [""], dependencies: [{ kind: "component", type: PuzzleTargetComponent, selector: "edyta-puzzle-target", inputs: ["assignButtonText", "back2OptionSelectionButtonText", "entity", "text", "id", "dropTargetActive", "assignedOptions"], outputs: ["dragged"] }] }); }
|
|
465
|
+
}
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleFactComponent, decorators: [{
|
|
467
|
+
type: Component,
|
|
468
|
+
args: [{ selector: 'edyta-puzzle-fact', standalone: false, template: "<div class=\"uk-width-1-2 uk-float-left uk-padding-small uk-padding-remove-vertical\">\n <div class=\"puzzle-fact-item-border\">\n <div class=\"uk-margin-small-bottom uk-margin-small-top puzzle-item\" [style.color]=\"getTextColor(color)\" [style.background-color]=\"getBackgroundColor(color)\">\n {{ text }}\n </div>\n </div>\n</div>\n<edyta-puzzle-target [id]=\"id\" [assignedOptions]=\"assignedOptions\" [dropTargetActive]=\"dropTargetActive\" [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dropped)=\"onDropped($event)\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\">\n</edyta-puzzle-target>\n" }]
|
|
469
|
+
}], ctorParameters: () => [], propDecorators: { assignButtonText: [{
|
|
470
|
+
type: Input,
|
|
471
|
+
args: [{ required: true }]
|
|
472
|
+
}], back2OptionSelectionButtonText: [{
|
|
473
|
+
type: Input,
|
|
474
|
+
args: [{ required: true }]
|
|
475
|
+
}], dropTargetActive: [{
|
|
476
|
+
type: Input
|
|
477
|
+
}], assignedOptions: [{
|
|
478
|
+
type: Input
|
|
479
|
+
}], dropped: [{
|
|
480
|
+
type: Output
|
|
481
|
+
}], dragged: [{
|
|
482
|
+
type: Output
|
|
483
|
+
}] } });
|
|
484
|
+
|
|
485
|
+
class PuzzleComponent extends PuzzleDropTargetComponent {
|
|
486
|
+
constructor() {
|
|
487
|
+
super();
|
|
488
|
+
this._state = [];
|
|
489
|
+
this._dropTargetActive = false;
|
|
490
|
+
this._contentChange = new PuzzleDropTargetComponent._dependencies.EventEmitter();
|
|
491
|
+
this._evaluate = new PuzzleDropTargetComponent._dependencies.EventEmitter();
|
|
492
|
+
}
|
|
493
|
+
get entity() {
|
|
494
|
+
return this._entity;
|
|
495
|
+
}
|
|
496
|
+
set entity(entity) {
|
|
497
|
+
this._process(entity);
|
|
498
|
+
}
|
|
499
|
+
get puzzles() {
|
|
500
|
+
return this._puzzles;
|
|
501
|
+
}
|
|
502
|
+
set puzzles(puzzles) {
|
|
503
|
+
this._puzzles = puzzles;
|
|
504
|
+
}
|
|
505
|
+
get dropTargetActive() {
|
|
506
|
+
return this._dropTargetActive;
|
|
507
|
+
}
|
|
508
|
+
set dropTargetActive(value) {
|
|
509
|
+
this._dropTargetActive = value;
|
|
510
|
+
}
|
|
511
|
+
get contentChange() {
|
|
512
|
+
return this._contentChange;
|
|
513
|
+
}
|
|
514
|
+
set contentChange(value) {
|
|
515
|
+
this._contentChange = value;
|
|
516
|
+
}
|
|
517
|
+
get evaluate() {
|
|
518
|
+
return this._evaluate;
|
|
519
|
+
}
|
|
520
|
+
set evaluate(value) {
|
|
521
|
+
this._evaluate = value;
|
|
522
|
+
}
|
|
523
|
+
onDropped(puzzleDrop) {
|
|
524
|
+
// find dropped elements and remove them from options section (they are not under control of Angular any more)
|
|
525
|
+
const droppedElements = document.querySelectorAll('#puzzle-item-source > edyta-puzzle-option > .drag-is-active');
|
|
526
|
+
for (let i = 0; i < droppedElements.length; i++) {
|
|
527
|
+
droppedElements[i].parentElement?.remove();
|
|
528
|
+
}
|
|
529
|
+
this._stateChanged(puzzleDrop);
|
|
530
|
+
}
|
|
531
|
+
onDragged(isDragged) {
|
|
532
|
+
this._dropTargetActive = isDragged;
|
|
533
|
+
}
|
|
534
|
+
onFactSelected(stateItem) {
|
|
535
|
+
this._stateChanged(stateItem);
|
|
536
|
+
}
|
|
537
|
+
onBack2OptionsSection(optionId) {
|
|
538
|
+
this._stateChanged({ optionId, factId: undefined });
|
|
539
|
+
}
|
|
540
|
+
onEvaluate() {
|
|
541
|
+
this.evaluate.emit();
|
|
542
|
+
}
|
|
543
|
+
_process(entity) {
|
|
544
|
+
this._entity = entity;
|
|
545
|
+
this.puzzles = this._entity.content;
|
|
546
|
+
this._puzzlesOriginal = JSON.parse(JSON.stringify(this.puzzles));
|
|
547
|
+
this._applyProgress();
|
|
548
|
+
}
|
|
549
|
+
_applyProgress() {
|
|
550
|
+
// initialize the state
|
|
551
|
+
this._state = [];
|
|
552
|
+
if (!this._entity.progress) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
this._entity.progress.forEach(item => {
|
|
556
|
+
const fact = this.puzzles.facts.find(({ id }) => id === item.factId);
|
|
557
|
+
const optionIndex = this.puzzles.options.findIndex(({ id }) => id === item.optionId);
|
|
558
|
+
const option = this.puzzles.options[optionIndex];
|
|
559
|
+
if (!fact || !option) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
this._state.push(item);
|
|
563
|
+
fact.assignedOptions.push(option);
|
|
564
|
+
this.puzzles.options.splice(optionIndex, 1);
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
_emitDrop(id) {
|
|
568
|
+
this.onDropped({ factId: undefined, optionId: id });
|
|
569
|
+
}
|
|
570
|
+
_buildProgressSnapshot() {
|
|
571
|
+
return this._state;
|
|
572
|
+
}
|
|
573
|
+
_stateChanged(puzzleDrop) {
|
|
574
|
+
this._recalculateState(puzzleDrop);
|
|
575
|
+
this._dropTargetActive = false;
|
|
576
|
+
this.entity.progress = this._state;
|
|
577
|
+
this.puzzles = JSON.parse(JSON.stringify(this._puzzlesOriginal));
|
|
578
|
+
this._applyProgress(); // updates state based on the progress
|
|
579
|
+
this.contentChange.emit(this._buildProgressSnapshot());
|
|
580
|
+
}
|
|
581
|
+
_recalculateState(stateItem) {
|
|
582
|
+
const { factId, optionId } = stateItem;
|
|
583
|
+
const stateIndexToRemove = this._state.findIndex(state => state['optionId'] === optionId);
|
|
584
|
+
if (stateIndexToRemove >= 0) {
|
|
585
|
+
this._state.splice(stateIndexToRemove, 1);
|
|
586
|
+
}
|
|
587
|
+
if (factId) {
|
|
588
|
+
this._state.push({ factId, optionId });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
592
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: PuzzleComponent, isStandalone: false, selector: "edyta-puzzle", inputs: { assignButtonText: "assignButtonText", back2OptionSelectionButtonText: "back2OptionSelectionButtonText", checkButtonText: "checkButtonText", previousButtonText: "previousButtonText", nextButtonText: "nextButtonText", entity: "entity" }, outputs: { contentChange: "contentChange", evaluate: "evaluate" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"entity && entity.content.description\" class=\"uk-child-width-1 grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\" [innerHTML]=\"entity.content.description\"></div>\n </div>\n</div>\n\n<div class=\"uk-child-width-1 uk-text-center grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\">\n <div class=\"uk-child-width-1-1 uk-text-center puzzle-target-section\" uk-grid\n *ngFor=\"let puzzleFact of puzzles.facts\">\n <div>\n <edyta-puzzle-fact [text]=\"puzzleFact.text\" [id]=\"puzzleFact.id\" [color]=\"puzzleFact.color\" [assignedOptions]=\"puzzleFact.assignedOptions\" [dropTargetActive]=\"dropTargetActive\"\n [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dropped)=\"onDropped($event)\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\"></edyta-puzzle-fact>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"uk-child-width-1 uk-text-center\" uk-grid>\n <div>\n <div id=\"puzzle-item-source\"\n class=\"uk-width-1 uk-flex uk-flex-center uk-card uk-card-default uk-card-body dropzone\"\n [ngClass]=\"{'drop-target-highlight': dropTargetActive, 'drag-target-highlight': dragTargetActive}\"\n (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\">\n\n <edyta-puzzle-option *ngFor=\"let puzzle of puzzles.options\" [text]=\"puzzle.text\" [id]=\"puzzle.id\" [color]=\"puzzle.color\" [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\"\n (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\">\n </edyta-puzzle-option>\n\n </div>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" [checkButtonText]=\"checkButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".grid .puzzle-target-section{margin-top:0}.uk-card.dropzone{display:block}.puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word}.puzzle-item[draggable=true]{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;cursor:grab}.dropzone.puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dotted rgba(102,102,102,.5);margin-top:12px!important}.puzzle-fact-item-border{border:2px solid rgba(0,0,0,0)}.dropzone.puzzle-item:not(:empty){border:2px solid rgba(0,0,0,0);border-radius:.5rem;min-height:1.5rem;padding:0!important;display:block;margin-top:10px!important}.dropzone.puzzle-item.drop-target-highlight{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dashed rgba(102,102,102,.5)}.dropzone.puzzle-item.drag-target-highlight{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dotted #FF7F50}.puzzle-item.dropzone edyta-puzzle-option:first-child .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;margin:0!important}.puzzle-item.dropzone edyta-puzzle-option:last-child .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;margin-bottom:0!important}#puzzle-item-source .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;padding:.3rem;margin:.3rem;display:inline-flex;justify-content:center;min-width:10rem}.drag-is-active{opacity:.5}#puzzle-item-source.dropzone{border:2px solid rgba(0,0,0,0)}#puzzle-item-source.dropzone.drop-target-highlight{border-radius:.5rem;border:2px dashed rgba(102,102,102,.5)}#puzzle-item-source.dropzone.drag-target-highlight{border-radius:.5rem;border:2px dotted #FF7F50}@media only screen and (max-width: 960px){#puzzle-item-source .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;padding:.3rem;margin:.3rem}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }, { kind: "component", type: PuzzleOptionComponent, selector: "edyta-puzzle-option", inputs: ["assignButtonText", "back2OptionSelectionButtonText", "back2OptionsSectionMode"], outputs: ["dragged"] }, { kind: "component", type: PuzzleFactComponent, selector: "edyta-puzzle-fact", inputs: ["assignButtonText", "back2OptionSelectionButtonText", "dropTargetActive", "assignedOptions"], outputs: ["dropped", "dragged"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
593
|
+
}
|
|
594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: PuzzleComponent, decorators: [{
|
|
595
|
+
type: Component,
|
|
596
|
+
args: [{ selector: 'edyta-puzzle', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div *ngIf=\"entity && entity.content.description\" class=\"uk-child-width-1 grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\" [innerHTML]=\"entity.content.description\"></div>\n </div>\n</div>\n\n<div class=\"uk-child-width-1 uk-text-center grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\">\n <div class=\"uk-child-width-1-1 uk-text-center puzzle-target-section\" uk-grid\n *ngFor=\"let puzzleFact of puzzles.facts\">\n <div>\n <edyta-puzzle-fact [text]=\"puzzleFact.text\" [id]=\"puzzleFact.id\" [color]=\"puzzleFact.color\" [assignedOptions]=\"puzzleFact.assignedOptions\" [dropTargetActive]=\"dropTargetActive\"\n [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\" (dropped)=\"onDropped($event)\" (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\"></edyta-puzzle-fact>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"uk-child-width-1 uk-text-center\" uk-grid>\n <div>\n <div id=\"puzzle-item-source\"\n class=\"uk-width-1 uk-flex uk-flex-center uk-card uk-card-default uk-card-body dropzone\"\n [ngClass]=\"{'drop-target-highlight': dropTargetActive, 'drag-target-highlight': dragTargetActive}\"\n (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\">\n\n <edyta-puzzle-option *ngFor=\"let puzzle of puzzles.options\" [text]=\"puzzle.text\" [id]=\"puzzle.id\" [color]=\"puzzle.color\" [entity]=\"entity\" [assignButtonText]=\"assignButtonText\" [back2OptionSelectionButtonText]=\"back2OptionSelectionButtonText\"\n (dragged)=\"onDragged($event)\" (factSelected)=\"onFactSelected($event)\" (back2OptionsSection)=\"onBack2OptionsSection($event)\">\n </edyta-puzzle-option>\n\n </div>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" [checkButtonText]=\"checkButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".grid .puzzle-target-section{margin-top:0}.uk-card.dropzone{display:block}.puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word}.puzzle-item[draggable=true]{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;cursor:grab}.dropzone.puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dotted rgba(102,102,102,.5);margin-top:12px!important}.puzzle-fact-item-border{border:2px solid rgba(0,0,0,0)}.dropzone.puzzle-item:not(:empty){border:2px solid rgba(0,0,0,0);border-radius:.5rem;min-height:1.5rem;padding:0!important;display:block;margin-top:10px!important}.dropzone.puzzle-item.drop-target-highlight{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dashed rgba(102,102,102,.5)}.dropzone.puzzle-item.drag-target-highlight{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;border:2px dotted #FF7F50}.puzzle-item.dropzone edyta-puzzle-option:first-child .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;margin:0!important}.puzzle-item.dropzone edyta-puzzle-option:last-child .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;margin-bottom:0!important}#puzzle-item-source .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;padding:.3rem;margin:.3rem;display:inline-flex;justify-content:center;min-width:10rem}.drag-is-active{opacity:.5}#puzzle-item-source.dropzone{border:2px solid rgba(0,0,0,0)}#puzzle-item-source.dropzone.drop-target-highlight{border-radius:.5rem;border:2px dashed rgba(102,102,102,.5)}#puzzle-item-source.dropzone.drag-target-highlight{border-radius:.5rem;border:2px dotted #FF7F50}@media only screen and (max-width: 960px){#puzzle-item-source .puzzle-item{border:2px solid #666;border-radius:.5rem;min-height:1.5rem;padding:.4rem;display:block;word-wrap:break-word;padding:.3rem;margin:.3rem}}\n"] }]
|
|
597
|
+
}], ctorParameters: () => [], propDecorators: { assignButtonText: [{
|
|
598
|
+
type: Input,
|
|
599
|
+
args: [{ required: true }]
|
|
600
|
+
}], back2OptionSelectionButtonText: [{
|
|
601
|
+
type: Input,
|
|
602
|
+
args: [{ required: true }]
|
|
603
|
+
}], checkButtonText: [{
|
|
604
|
+
type: Input,
|
|
605
|
+
args: [{ required: true }]
|
|
606
|
+
}], previousButtonText: [{
|
|
607
|
+
type: Input,
|
|
608
|
+
args: [{ required: true }]
|
|
609
|
+
}], nextButtonText: [{
|
|
610
|
+
type: Input,
|
|
611
|
+
args: [{ required: true }]
|
|
612
|
+
}], entity: [{
|
|
613
|
+
type: Input,
|
|
614
|
+
args: [{ required: true }]
|
|
615
|
+
}], contentChange: [{
|
|
616
|
+
type: Output
|
|
617
|
+
}], evaluate: [{
|
|
618
|
+
type: Output
|
|
619
|
+
}] } });
|
|
620
|
+
|
|
621
|
+
class CanvasComponent {
|
|
622
|
+
static { this._dependencies = {
|
|
623
|
+
EventEmitter
|
|
624
|
+
}; }
|
|
625
|
+
constructor() {
|
|
626
|
+
this._title = '';
|
|
627
|
+
this._picture = '';
|
|
628
|
+
this._contentChange = new CanvasComponent._dependencies.EventEmitter();
|
|
629
|
+
this._evaluate = new CanvasComponent._dependencies.EventEmitter();
|
|
630
|
+
}
|
|
631
|
+
get contentChange() {
|
|
632
|
+
return this._contentChange;
|
|
633
|
+
}
|
|
634
|
+
set contentChange(value) {
|
|
635
|
+
this._contentChange = value;
|
|
636
|
+
}
|
|
637
|
+
get evaluate() {
|
|
638
|
+
return this._evaluate;
|
|
639
|
+
}
|
|
640
|
+
set evaluate(value) {
|
|
641
|
+
this._evaluate = value;
|
|
642
|
+
}
|
|
643
|
+
get title() {
|
|
644
|
+
return this._title;
|
|
645
|
+
}
|
|
646
|
+
set title(value) {
|
|
647
|
+
this._title = value;
|
|
648
|
+
}
|
|
649
|
+
get picture() {
|
|
650
|
+
return this._picture;
|
|
651
|
+
}
|
|
652
|
+
set picture(value) {
|
|
653
|
+
this._picture = value;
|
|
654
|
+
}
|
|
655
|
+
onEvaluate() {
|
|
656
|
+
this.evaluate.emit();
|
|
657
|
+
}
|
|
658
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CanvasComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
659
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: CanvasComponent, isStandalone: false, selector: "edyta-canvas", inputs: { checkButtonText: "checkButtonText", previousButtonText: "previousButtonText", nextButtonText: "nextButtonText", title: "title", picture: "picture" }, outputs: { contentChange: "contentChange", evaluate: "evaluate" }, ngImport: i0, template: "<div *ngIf=\"!!title\">\n <ng-content select=\"[breadcrumb]\"></ng-content>\n <div class=\"uk-clearfix\" uk-height-match>\n <div class=\"uk-float-left\">\n <h2 class=\"uk-heading-small\">\n <div class=\"uk-margin-small-right picture\" *ngIf=\"picture\">\n <img [src]=\"picture\" class=\"uk-border-rounded\" alt=\"Entity's picture\">\n </div>\n {{ title }}\n </h2>\n </div>\n <div class=\"uk-float-right\">\n <ng-content select=\"[control-panel]\"></ng-content>\n </div>\n </div>\n\n <ng-content></ng-content>\n</div>\n\n<div class=\"uk-position-center\" *ngIf=\"!title\">\n <div uk-spinner=\"ratio: 2\"></div>\n</div>\n", styles: ["li div{display:inline-block}div.picture{width:5rem;display:inline-block}li img{max-width:5rem;max-height:5rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
660
|
+
}
|
|
661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CanvasComponent, decorators: [{
|
|
662
|
+
type: Component,
|
|
663
|
+
args: [{ selector: 'edyta-canvas', standalone: false, template: "<div *ngIf=\"!!title\">\n <ng-content select=\"[breadcrumb]\"></ng-content>\n <div class=\"uk-clearfix\" uk-height-match>\n <div class=\"uk-float-left\">\n <h2 class=\"uk-heading-small\">\n <div class=\"uk-margin-small-right picture\" *ngIf=\"picture\">\n <img [src]=\"picture\" class=\"uk-border-rounded\" alt=\"Entity's picture\">\n </div>\n {{ title }}\n </h2>\n </div>\n <div class=\"uk-float-right\">\n <ng-content select=\"[control-panel]\"></ng-content>\n </div>\n </div>\n\n <ng-content></ng-content>\n</div>\n\n<div class=\"uk-position-center\" *ngIf=\"!title\">\n <div uk-spinner=\"ratio: 2\"></div>\n</div>\n", styles: ["li div{display:inline-block}div.picture{width:5rem;display:inline-block}li img{max-width:5rem;max-height:5rem}\n"] }]
|
|
664
|
+
}], ctorParameters: () => [], propDecorators: { checkButtonText: [{
|
|
665
|
+
type: Input,
|
|
666
|
+
args: [{ required: true }]
|
|
667
|
+
}], previousButtonText: [{
|
|
668
|
+
type: Input,
|
|
669
|
+
args: [{ required: true }]
|
|
670
|
+
}], nextButtonText: [{
|
|
671
|
+
type: Input,
|
|
672
|
+
args: [{ required: true }]
|
|
673
|
+
}], contentChange: [{
|
|
674
|
+
type: Output
|
|
675
|
+
}], evaluate: [{
|
|
676
|
+
type: Output
|
|
677
|
+
}], title: [{
|
|
678
|
+
type: Input
|
|
679
|
+
}], picture: [{
|
|
680
|
+
type: Input
|
|
681
|
+
}] } });
|
|
682
|
+
|
|
683
|
+
class GrammarItemComponent {
|
|
684
|
+
showMedia() {
|
|
685
|
+
return !!this.content.media?.url && !!this.content.media.mimeType;
|
|
686
|
+
}
|
|
687
|
+
showPictureOnLeft() {
|
|
688
|
+
return !!this.content.picture?.url && this.content.picture.position === 'left';
|
|
689
|
+
}
|
|
690
|
+
showPictureOnRight() {
|
|
691
|
+
return !!this.content.picture?.url && (!this.content.picture.position || this.content.picture.position === 'right');
|
|
692
|
+
}
|
|
693
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GrammarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
694
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: GrammarItemComponent, isStandalone: false, selector: "edyta-grammar-item", inputs: { content: "content" }, ngImport: i0, template: "<h3 class=\"uk-card-title\" [style.color]=\"content.color?.text\" *ngIf=\"content.key\">{{ content.key }}</h3>\n<div class=\"grammar-content-wrapper\">\n <div class=\"uk-visible@m uk-width-1-4 grammar-picture-wrapper-left uk-margin-small-right\" *ngIf=\"showPictureOnLeft()\">\n <img class=\"grammar-picture\" [src]=\"content.picture?.url\" [alt]=\"content.key\">\n </div>\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ content.picture?.url ? 'uk-width-3-4@m' : '' ]\">\n <p [innerHTML]=\"content.innerHTML\"></p>\n </div>\n <div class=\"uk-visible@m uk-width-1-4 grammar-picture-wrapper-right uk-margin-small-left\" *ngIf=\"showPictureOnRight()\">\n <img class=\"grammar-picture\" [src]=\"content.picture?.url\" [alt]=\"content.key\">\n </div>\n</div>\n<div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"content.media?.url || ''\" [fileMimeType]=\"content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.MediaElementComponent, selector: "edyta-media-element" }] }); }
|
|
695
|
+
}
|
|
696
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GrammarItemComponent, decorators: [{
|
|
697
|
+
type: Component,
|
|
698
|
+
args: [{ selector: 'edyta-grammar-item', standalone: false, template: "<h3 class=\"uk-card-title\" [style.color]=\"content.color?.text\" *ngIf=\"content.key\">{{ content.key }}</h3>\n<div class=\"grammar-content-wrapper\">\n <div class=\"uk-visible@m uk-width-1-4 grammar-picture-wrapper-left uk-margin-small-right\" *ngIf=\"showPictureOnLeft()\">\n <img class=\"grammar-picture\" [src]=\"content.picture?.url\" [alt]=\"content.key\">\n </div>\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ content.picture?.url ? 'uk-width-3-4@m' : '' ]\">\n <p [innerHTML]=\"content.innerHTML\"></p>\n </div>\n <div class=\"uk-visible@m uk-width-1-4 grammar-picture-wrapper-right uk-margin-small-left\" *ngIf=\"showPictureOnRight()\">\n <img class=\"grammar-picture\" [src]=\"content.picture?.url\" [alt]=\"content.key\">\n </div>\n</div>\n<div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"content.media?.url || ''\" [fileMimeType]=\"content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n</div>\n" }]
|
|
699
|
+
}], propDecorators: { content: [{
|
|
700
|
+
type: Input
|
|
701
|
+
}] } });
|
|
702
|
+
|
|
703
|
+
class GrammarComponent extends CanvasComponent {
|
|
704
|
+
get entity() {
|
|
705
|
+
return this._entity;
|
|
706
|
+
}
|
|
707
|
+
set entity(entity) {
|
|
708
|
+
this._entity = entity;
|
|
709
|
+
}
|
|
710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GrammarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: GrammarComponent, isStandalone: false, selector: "edyta-grammar", inputs: { entity: "entity" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1 uk-margin-bottom\" [style.backgroundColor]=\"grammar.color?.background\" [style.color]=\"grammar.color?.text\" *ngFor=\"let grammar of entity.content\">\n <div class=\"uk-padding uk-padding-remove-vertical\">\n <edyta-grammar-item [content]=\"grammar\"></edyta-grammar-item>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\"></edyta-entity-bottom-pane>\n", styles: [".grammar-content-wrapper{display:flex}img[src$=\".svg\"].grammar-picture{height:100%}.grammar-picture-wrapper-left{text-align:left}.grammar-picture-wrapper-right{text-align:right}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }, { kind: "component", type: GrammarItemComponent, selector: "edyta-grammar-item", inputs: ["content"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
712
|
+
}
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GrammarComponent, decorators: [{
|
|
714
|
+
type: Component,
|
|
715
|
+
args: [{ selector: 'edyta-grammar', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1 uk-margin-bottom\" [style.backgroundColor]=\"grammar.color?.background\" [style.color]=\"grammar.color?.text\" *ngFor=\"let grammar of entity.content\">\n <div class=\"uk-padding uk-padding-remove-vertical\">\n <edyta-grammar-item [content]=\"grammar\"></edyta-grammar-item>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\"></edyta-entity-bottom-pane>\n", styles: [".grammar-content-wrapper{display:flex}img[src$=\".svg\"].grammar-picture{height:100%}.grammar-picture-wrapper-left{text-align:left}.grammar-picture-wrapper-right{text-align:right}\n"] }]
|
|
716
|
+
}], propDecorators: { entity: [{
|
|
717
|
+
type: Input,
|
|
718
|
+
args: [{ required: true }]
|
|
719
|
+
}] } });
|
|
720
|
+
|
|
721
|
+
var Vocabulary;
|
|
722
|
+
(function (Vocabulary) {
|
|
723
|
+
let FrontCardTitleVisibilityMode;
|
|
724
|
+
(function (FrontCardTitleVisibilityMode) {
|
|
725
|
+
FrontCardTitleVisibilityMode["Visible"] = "visible";
|
|
726
|
+
FrontCardTitleVisibilityMode["Blurred"] = "blurred";
|
|
727
|
+
FrontCardTitleVisibilityMode["Invisible"] = "invisible";
|
|
728
|
+
})(FrontCardTitleVisibilityMode = Vocabulary.FrontCardTitleVisibilityMode || (Vocabulary.FrontCardTitleVisibilityMode = {}));
|
|
729
|
+
})(Vocabulary || (Vocabulary = {}));
|
|
730
|
+
|
|
731
|
+
class VocabularyCardBaseComponent {
|
|
732
|
+
constructor() {
|
|
733
|
+
this._titleIsVisible = true;
|
|
734
|
+
}
|
|
735
|
+
get vocabulary() {
|
|
736
|
+
return this._vocabulary;
|
|
737
|
+
}
|
|
738
|
+
set vocabulary(value) {
|
|
739
|
+
this._vocabulary = value;
|
|
740
|
+
}
|
|
741
|
+
get frontCardTitleVisibilityMode() {
|
|
742
|
+
return this._frontCardTitleVisibilityMode;
|
|
743
|
+
}
|
|
744
|
+
set frontCardTitleVisibilityMode(mode) {
|
|
745
|
+
this._frontCardTitleVisibilityMode = mode;
|
|
746
|
+
}
|
|
747
|
+
get titleIsVisible() {
|
|
748
|
+
return this._titleIsVisible;
|
|
749
|
+
}
|
|
750
|
+
set titleIsVisible(visible) {
|
|
751
|
+
this._titleIsVisible = visible;
|
|
752
|
+
}
|
|
753
|
+
calculateHtmlClasses4Title() {
|
|
754
|
+
if (this.titleIsVisible) {
|
|
755
|
+
return {};
|
|
756
|
+
}
|
|
757
|
+
return {
|
|
758
|
+
'card__face-front-blur': this.frontCardTitleVisibilityMode === Vocabulary.FrontCardTitleVisibilityMode.Blurred,
|
|
759
|
+
'card__face-front-invisible': this.frontCardTitleVisibilityMode === Vocabulary.FrontCardTitleVisibilityMode.Invisible
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
763
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VocabularyCardBaseComponent, isStandalone: false, selector: "ng-component", inputs: { vocabulary: "vocabulary", frontCardTitleVisibilityMode: "frontCardTitleVisibilityMode", titleIsVisible: "titleIsVisible" }, ngImport: i0, template: '', isInline: true }); }
|
|
764
|
+
}
|
|
765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardBaseComponent, decorators: [{
|
|
766
|
+
type: Component,
|
|
767
|
+
args: [{
|
|
768
|
+
template: '',
|
|
769
|
+
standalone: false
|
|
770
|
+
}]
|
|
771
|
+
}], propDecorators: { vocabulary: [{
|
|
772
|
+
type: Input,
|
|
773
|
+
args: [{ required: true }]
|
|
774
|
+
}], frontCardTitleVisibilityMode: [{
|
|
775
|
+
type: Input,
|
|
776
|
+
args: [{ required: true }]
|
|
777
|
+
}], titleIsVisible: [{
|
|
778
|
+
type: Input
|
|
779
|
+
}] } });
|
|
780
|
+
|
|
781
|
+
class VocabularyCardFlipComponent extends VocabularyCardBaseComponent {
|
|
782
|
+
constructor() {
|
|
783
|
+
super(...arguments);
|
|
784
|
+
this._flipped = false;
|
|
785
|
+
}
|
|
786
|
+
get flipped() {
|
|
787
|
+
return this._flipped;
|
|
788
|
+
}
|
|
789
|
+
set flipped(value) {
|
|
790
|
+
this._flipped = value;
|
|
791
|
+
}
|
|
792
|
+
onToggleFlip() {
|
|
793
|
+
this.flipped = !this.flipped;
|
|
794
|
+
}
|
|
795
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardFlipComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
796
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VocabularyCardFlipComponent, isStandalone: false, selector: "edyta-vocabulary-card-flip", usesInheritance: true, ngImport: i0, template: "<!-- https://www.w3schools.com/howto/howto_css_flip_card.asp -->\n<div class=\"uk-card uk-card-default uk-card-small card-flip-transition-point\" [ngClass]=\"{ flipped: !!flipped }\">\n <div class=\"card__face card__face-front\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\" [ngClass]=\"calculateHtmlClasses4Title()\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\">\n <p>\n <img [src]=\"vocabulary.picture\" [alt]=\"vocabulary.key\">\n </p>\n </div>\n <div class=\"uk-card-footer\">\n <a (click)=\"onToggleFlip()\"><i class=\"mdi mdi-24px mdi-rotate-right\"></i></a>\n </div>\n </div>\n <div class=\"card__face card__face-back uk-box-shadow-large\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\" style=\"overflow-y: auto;\"> <!-- overflow-y: auto; MUST be applied right here. If it would be applied in CSS class it would destroy the transition -->\n <p [innerHTML]=\"vocabulary.description\"></p>\n </div>\n <div class=\"uk-card-footer\">\n <a (click)=\"onToggleFlip()\"><i class=\"mdi mdi-24px mdi-rotate-right\"></i></a>\n </div>\n </div>\n</div>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.card-flip-transition-point{position:relative;width:100%;min-height:22rem;height:100%;text-align:center;transition:1s ease-in-out;transform-style:preserve-3d}.card-flip-transition-point.flipped{transform:rotateY(181deg)}.card__face-front,.card__face-back{position:absolute;padding:0 20px;min-height:22rem;box-sizing:border-box;left:0;right:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.card__face-front{background-color:#e4e4e4;box-shadow:0 5px 5px #00000040}.card__face-front .uk-card-header{border-bottom-color:#fff!important}.card__face-front .uk-card-footer{border-top-color:#fff!important}.card__face-back{transform:rotateY(-180deg)}.card__face .uk-card-body{height:11.8rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
797
|
+
}
|
|
798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardFlipComponent, decorators: [{
|
|
799
|
+
type: Component,
|
|
800
|
+
args: [{ selector: 'edyta-vocabulary-card-flip', standalone: false, template: "<!-- https://www.w3schools.com/howto/howto_css_flip_card.asp -->\n<div class=\"uk-card uk-card-default uk-card-small card-flip-transition-point\" [ngClass]=\"{ flipped: !!flipped }\">\n <div class=\"card__face card__face-front\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\" [ngClass]=\"calculateHtmlClasses4Title()\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\">\n <p>\n <img [src]=\"vocabulary.picture\" [alt]=\"vocabulary.key\">\n </p>\n </div>\n <div class=\"uk-card-footer\">\n <a (click)=\"onToggleFlip()\"><i class=\"mdi mdi-24px mdi-rotate-right\"></i></a>\n </div>\n </div>\n <div class=\"card__face card__face-back uk-box-shadow-large\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\" style=\"overflow-y: auto;\"> <!-- overflow-y: auto; MUST be applied right here. If it would be applied in CSS class it would destroy the transition -->\n <p [innerHTML]=\"vocabulary.description\"></p>\n </div>\n <div class=\"uk-card-footer\">\n <a (click)=\"onToggleFlip()\"><i class=\"mdi mdi-24px mdi-rotate-right\"></i></a>\n </div>\n </div>\n</div>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.card-flip-transition-point{position:relative;width:100%;min-height:22rem;height:100%;text-align:center;transition:1s ease-in-out;transform-style:preserve-3d}.card-flip-transition-point.flipped{transform:rotateY(181deg)}.card__face-front,.card__face-back{position:absolute;padding:0 20px;min-height:22rem;box-sizing:border-box;left:0;right:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.card__face-front{background-color:#e4e4e4;box-shadow:0 5px 5px #00000040}.card__face-front .uk-card-header{border-bottom-color:#fff!important}.card__face-front .uk-card-footer{border-top-color:#fff!important}.card__face-back{transform:rotateY(-180deg)}.card__face .uk-card-body{height:11.8rem}\n"] }]
|
|
801
|
+
}] });
|
|
802
|
+
|
|
803
|
+
class VocabularyCardStandardComponent extends VocabularyCardBaseComponent {
|
|
804
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardStandardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
805
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VocabularyCardStandardComponent, isStandalone: false, selector: "edyta-vocabulary-card-standard", usesInheritance: true, ngImport: i0, template: "<div class=\"uk-card uk-card-default uk-card-small uk-box-shadow-large\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\" [ngClass]=\"calculateHtmlClasses4Title()\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\">\n <p>\n <img [src]=\"vocabulary.picture\" [alt]=\"vocabulary.key\">\n </p>\n </div>\n <div class=\"uk-card-footer\">\n <i class=\"mdi mdi-24px mdi-map-marker-question-outline\"\n [attr.uk-tooltip]=\"'title:' + vocabulary.meaning +'; pos: bottom; animation: uk-animation-slide-bottom; duration: 200'\"></i>\n </div>\n</div>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.uk-card{padding:0 20px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
806
|
+
}
|
|
807
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyCardStandardComponent, decorators: [{
|
|
808
|
+
type: Component,
|
|
809
|
+
args: [{ selector: 'edyta-vocabulary-card-standard', standalone: false, template: "<div class=\"uk-card uk-card-default uk-card-small uk-box-shadow-large\">\n <div class=\"uk-card-header uk-text-large\">\n <h3 class=\"uk-card-title uk-text-bold\" [ngClass]=\"calculateHtmlClasses4Title()\">{{ vocabulary.key }}</h3>\n </div>\n <div class=\"uk-card-body\">\n <p>\n <img [src]=\"vocabulary.picture\" [alt]=\"vocabulary.key\">\n </p>\n </div>\n <div class=\"uk-card-footer\">\n <i class=\"mdi mdi-24px mdi-map-marker-question-outline\"\n [attr.uk-tooltip]=\"'title:' + vocabulary.meaning +'; pos: bottom; animation: uk-animation-slide-bottom; duration: 200'\"></i>\n </div>\n</div>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.uk-card{padding:0 20px}\n"] }]
|
|
810
|
+
}] });
|
|
811
|
+
|
|
812
|
+
class VocabularyComponent extends CanvasComponent {
|
|
813
|
+
constructor() {
|
|
814
|
+
super(...arguments);
|
|
815
|
+
this._resizeEventListenerRegistered = false;
|
|
816
|
+
this._titleIsVisible = true;
|
|
817
|
+
}
|
|
818
|
+
get entity() {
|
|
819
|
+
return this._entity;
|
|
820
|
+
}
|
|
821
|
+
set entity(entity) {
|
|
822
|
+
this._entity = entity;
|
|
823
|
+
this._titleIsVisible = this.titleIsVisibleByDefault();
|
|
824
|
+
}
|
|
825
|
+
get titleIsVisible() {
|
|
826
|
+
return this._titleIsVisible;
|
|
827
|
+
}
|
|
828
|
+
ngAfterViewChecked() {
|
|
829
|
+
this.fitTextToCardTitle();
|
|
830
|
+
if (!this._resizeEventListenerRegistered) {
|
|
831
|
+
window.addEventListener('resize', this.fitTextToCardTitle.bind(this));
|
|
832
|
+
this._resizeEventListenerRegistered = true;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
ngOnDestroy() {
|
|
836
|
+
if (this._resizeEventListenerRegistered) {
|
|
837
|
+
window.removeEventListener('resize', this.fitTextToCardTitle.bind(this));
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
buttonPaneIsVisible() {
|
|
841
|
+
return this.entity.shuffleButtonEnabled || !this.titleIsVisibleByDefault();
|
|
842
|
+
}
|
|
843
|
+
onToggleTitleVisibility() {
|
|
844
|
+
this._titleIsVisible = !this._titleIsVisible;
|
|
845
|
+
}
|
|
846
|
+
titleIsVisibleByDefault() {
|
|
847
|
+
return this.entity.frontCardTitleVisibilityMode === Vocabulary.FrontCardTitleVisibilityMode.Visible;
|
|
848
|
+
}
|
|
849
|
+
getTitleVisibilityButtonText() {
|
|
850
|
+
return this.titleIsVisible ? this.visibilityButtonHideTitleText : this.visibilityButtonShowTitleText;
|
|
851
|
+
}
|
|
852
|
+
fitTextToCardTitle() {
|
|
853
|
+
this.fitTextToContainer('#vocabulary-card-section .uk-card-header .uk-card-title');
|
|
854
|
+
}
|
|
855
|
+
fitTextToContainer(querySelector) {
|
|
856
|
+
const titleElements = document.querySelectorAll(querySelector);
|
|
857
|
+
titleElements.forEach(item => {
|
|
858
|
+
const element = item;
|
|
859
|
+
const containerWidth = element.offsetWidth;
|
|
860
|
+
let fontSize = 100; // Initial font size percentage
|
|
861
|
+
element.style.fontSize = fontSize + '%';
|
|
862
|
+
while (element.scrollWidth > containerWidth && fontSize > 0) {
|
|
863
|
+
fontSize -= 1;
|
|
864
|
+
element.style.fontSize = fontSize + '%';
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
869
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VocabularyComponent, isStandalone: false, selector: "edyta-vocabulary", inputs: { visibilityButtonShowTitleText: "visibilityButtonShowTitleText", visibilityButtonHideTitleText: "visibilityButtonHideTitleText", shuffleButtonText: "shuffleButtonText", entity: "entity" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin-bottom uk-text-right button-pane\" *ngIf=\"buttonPaneIsVisible()\">\n <button *ngIf=\"!titleIsVisibleByDefault()\" type=\"button\" class=\"uk-button uk-button-default uk-margin-small-right\" (click)=\"onToggleTitleVisibility()\">{{ getTitleVisibilityButtonText() }}</button>\n <button *ngIf=\"entity.shuffleButtonEnabled\" type=\"button\" class=\"uk-button uk-button-primary uk-margin-small-right\" (click)=\"entity.onShuffle()\">{{ shuffleButtonText }}</button>\n</div>\n\n<div class=\"uk-child-width-1-2@s uk-child-width-1-3@m uk-grid-match\" uk-grid uk-height-match=\"target: > div .uk-card-header\">\n <div id=\"vocabulary-card-section\" *ngFor=\"let vocabulary of entity.content\">\n <edyta-vocabulary-card-standard [vocabulary]=\"vocabulary\" [titleIsVisible]=\"titleIsVisible\" [frontCardTitleVisibilityMode]=\"entity.frontCardTitleVisibilityMode\" *ngIf=\"!vocabulary.flip\"></edyta-vocabulary-card-standard>\n <edyta-vocabulary-card-flip [vocabulary]=\"vocabulary\" [titleIsVisible]=\"titleIsVisible\" [frontCardTitleVisibilityMode]=\"entity.frontCardTitleVisibilityMode\" *ngIf=\"vocabulary.flip\"></edyta-vocabulary-card-flip>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\"></edyta-entity-bottom-pane>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.heading .uk-align-right{margin:0!important}.uk-heading-small{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }, { kind: "component", type: VocabularyCardFlipComponent, selector: "edyta-vocabulary-card-flip" }, { kind: "component", type: VocabularyCardStandardComponent, selector: "edyta-vocabulary-card-standard" }] }); }
|
|
870
|
+
}
|
|
871
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VocabularyComponent, decorators: [{
|
|
872
|
+
type: Component,
|
|
873
|
+
args: [{ selector: 'edyta-vocabulary', standalone: false, template: "<div class=\"uk-margin-bottom uk-text-right button-pane\" *ngIf=\"buttonPaneIsVisible()\">\n <button *ngIf=\"!titleIsVisibleByDefault()\" type=\"button\" class=\"uk-button uk-button-default uk-margin-small-right\" (click)=\"onToggleTitleVisibility()\">{{ getTitleVisibilityButtonText() }}</button>\n <button *ngIf=\"entity.shuffleButtonEnabled\" type=\"button\" class=\"uk-button uk-button-primary uk-margin-small-right\" (click)=\"entity.onShuffle()\">{{ shuffleButtonText }}</button>\n</div>\n\n<div class=\"uk-child-width-1-2@s uk-child-width-1-3@m uk-grid-match\" uk-grid uk-height-match=\"target: > div .uk-card-header\">\n <div id=\"vocabulary-card-section\" *ngFor=\"let vocabulary of entity.content\">\n <edyta-vocabulary-card-standard [vocabulary]=\"vocabulary\" [titleIsVisible]=\"titleIsVisible\" [frontCardTitleVisibilityMode]=\"entity.frontCardTitleVisibilityMode\" *ngIf=\"!vocabulary.flip\"></edyta-vocabulary-card-standard>\n <edyta-vocabulary-card-flip [vocabulary]=\"vocabulary\" [titleIsVisible]=\"titleIsVisible\" [frontCardTitleVisibilityMode]=\"entity.frontCardTitleVisibilityMode\" *ngIf=\"vocabulary.flip\"></edyta-vocabulary-card-flip>\n </div>\n</div>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\"></edyta-entity-bottom-pane>\n", styles: [".uk-card,.card__face{border-radius:1.5rem}.uk-card-header,.uk-card-body,.uk-card-footer{text-align:center}.uk-card-body img{max-height:11.8rem}.uk-card-body img[src$=\".svg\"]{filter:opacity(.8) drop-shadow(5px 5px 5px rgba(0,0,0,.7))}.uk-card-title{white-space:nowrap;overflow:hidden}.card__face-front-blur{filter:blur(.5rem)}.card__face-front-invisible{filter:blur(.5rem);color:transparent}.heading .uk-align-right{margin:0!important}.uk-heading-small{display:inline-block}\n"] }]
|
|
874
|
+
}], propDecorators: { visibilityButtonShowTitleText: [{
|
|
875
|
+
type: Input,
|
|
876
|
+
args: [{ required: true }]
|
|
877
|
+
}], visibilityButtonHideTitleText: [{
|
|
878
|
+
type: Input,
|
|
879
|
+
args: [{ required: true }]
|
|
880
|
+
}], shuffleButtonText: [{
|
|
881
|
+
type: Input,
|
|
882
|
+
args: [{ required: true }]
|
|
883
|
+
}], entity: [{
|
|
884
|
+
type: Input,
|
|
885
|
+
args: [{ required: true }]
|
|
886
|
+
}] } });
|
|
887
|
+
|
|
888
|
+
class FormTypeTextComponent {
|
|
889
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
890
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeTextComponent, isStandalone: false, selector: "edyta-form-type-text", ngImport: i0, template: "\n", styles: [""] }); }
|
|
891
|
+
}
|
|
892
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeTextComponent, decorators: [{
|
|
893
|
+
type: Component,
|
|
894
|
+
args: [{ selector: 'edyta-form-type-text', standalone: false, template: "\n" }]
|
|
895
|
+
}] });
|
|
896
|
+
|
|
897
|
+
class FormTypeInputComponent extends CanvasComponent {
|
|
898
|
+
get content() {
|
|
899
|
+
return this._content;
|
|
900
|
+
}
|
|
901
|
+
set content(value) {
|
|
902
|
+
this._content = value;
|
|
903
|
+
}
|
|
904
|
+
onChange() {
|
|
905
|
+
this.contentChange.emit(this.content);
|
|
906
|
+
}
|
|
907
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
908
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeInputComponent, isStandalone: false, selector: "edyta-form-type-input", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <input class=\"uk-input uk-width-1-1@s uk-width-1-3@m\" type=\"text\" placeholder=\"Provide a text\" [(ngModel)]=\"content.state\" (input)=\"onChange()\">\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
909
|
+
}
|
|
910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeInputComponent, decorators: [{
|
|
911
|
+
type: Component,
|
|
912
|
+
args: [{ selector: 'edyta-form-type-input', standalone: false, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <input class=\"uk-input uk-width-1-1@s uk-width-1-3@m\" type=\"text\" placeholder=\"Provide a text\" [(ngModel)]=\"content.state\" (input)=\"onChange()\">\n </div>\n</div>\n" }]
|
|
913
|
+
}], propDecorators: { content: [{
|
|
914
|
+
type: Input
|
|
915
|
+
}] } });
|
|
916
|
+
|
|
917
|
+
class FormTypeSelectComponent extends CanvasComponent {
|
|
918
|
+
get content() {
|
|
919
|
+
return this._content;
|
|
920
|
+
}
|
|
921
|
+
set content(value) {
|
|
922
|
+
this._content = value;
|
|
923
|
+
}
|
|
924
|
+
onChange() {
|
|
925
|
+
this.contentChange.emit(this.content);
|
|
926
|
+
}
|
|
927
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
928
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeSelectComponent, isStandalone: false, selector: "edyta-form-type-select", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <select class=\"uk-select uk-width-1-1@s uk-width-1-3@m uk-width-1-4@l\" [(ngModel)]=\"content.state\" (change)=\"onChange()\">\n <option></option>\n <option *ngFor=\"let option of content.options\" [value]=\"option.id\">{{ option.text }}</option>\n </select>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
929
|
+
}
|
|
930
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeSelectComponent, decorators: [{
|
|
931
|
+
type: Component,
|
|
932
|
+
args: [{ selector: 'edyta-form-type-select', standalone: false, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <select class=\"uk-select uk-width-1-1@s uk-width-1-3@m uk-width-1-4@l\" [(ngModel)]=\"content.state\" (change)=\"onChange()\">\n <option></option>\n <option *ngFor=\"let option of content.options\" [value]=\"option.id\">{{ option.text }}</option>\n </select>\n </div>\n</div>\n" }]
|
|
933
|
+
}], propDecorators: { content: [{
|
|
934
|
+
type: Input
|
|
935
|
+
}] } });
|
|
936
|
+
|
|
937
|
+
class FormTypeRadioComponent extends CanvasComponent {
|
|
938
|
+
get content() {
|
|
939
|
+
return this._content;
|
|
940
|
+
}
|
|
941
|
+
set content(value) {
|
|
942
|
+
this._content = value;
|
|
943
|
+
}
|
|
944
|
+
onChange() {
|
|
945
|
+
this.contentChange.emit(this.content);
|
|
946
|
+
}
|
|
947
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
948
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeRadioComponent, isStandalone: false, selector: "edyta-form-type-radio", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <div *ngFor=\"let option of content.options\">\n <label>\n <input class=\"uk-radio\" type=\"radio\" [name]=\"'radio-' + content.key\" [(ngModel)]=\"content.state\" (change)=\"onChange()\" [value]=\"option.id\"> {{ option.text }}\n </label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
949
|
+
}
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeRadioComponent, decorators: [{
|
|
951
|
+
type: Component,
|
|
952
|
+
args: [{ selector: 'edyta-form-type-radio', standalone: false, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <div *ngFor=\"let option of content.options\">\n <label>\n <input class=\"uk-radio\" type=\"radio\" [name]=\"'radio-' + content.key\" [(ngModel)]=\"content.state\" (change)=\"onChange()\" [value]=\"option.id\"> {{ option.text }}\n </label>\n </div>\n </div>\n</div>\n" }]
|
|
953
|
+
}], propDecorators: { content: [{
|
|
954
|
+
type: Input
|
|
955
|
+
}] } });
|
|
956
|
+
|
|
957
|
+
class FormTypeCheckboxComponent extends CanvasComponent {
|
|
958
|
+
get content() {
|
|
959
|
+
return this._content;
|
|
960
|
+
}
|
|
961
|
+
set content(value) {
|
|
962
|
+
this._content = value;
|
|
963
|
+
}
|
|
964
|
+
onChange() {
|
|
965
|
+
this.contentChange.emit(this.content);
|
|
966
|
+
}
|
|
967
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
968
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeCheckboxComponent, isStandalone: false, selector: "edyta-form-type-checkbox", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <div *ngFor=\"let option of content.options\">\n <label>\n <input class=\"uk-checkbox\" type=\"checkbox\" [(ngModel)]=\"option.checked\" (change)=\"onChange()\" [name]=\"'checkbox-' + content.key\"> {{\n option.text }}\n </label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
969
|
+
}
|
|
970
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeCheckboxComponent, decorators: [{
|
|
971
|
+
type: Component,
|
|
972
|
+
args: [{ selector: 'edyta-form-type-checkbox', standalone: false, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <div *ngFor=\"let option of content.options\">\n <label>\n <input class=\"uk-checkbox\" type=\"checkbox\" [(ngModel)]=\"option.checked\" (change)=\"onChange()\" [name]=\"'checkbox-' + content.key\"> {{\n option.text }}\n </label>\n </div>\n </div>\n</div>\n" }]
|
|
973
|
+
}], propDecorators: { content: [{
|
|
974
|
+
type: Input
|
|
975
|
+
}] } });
|
|
976
|
+
|
|
977
|
+
class FormTypeDateComponent extends CanvasComponent {
|
|
978
|
+
get content() {
|
|
979
|
+
return this._content;
|
|
980
|
+
}
|
|
981
|
+
set content(value) {
|
|
982
|
+
this._content = value;
|
|
983
|
+
}
|
|
984
|
+
onChange() {
|
|
985
|
+
this.contentChange.emit(this.content);
|
|
986
|
+
}
|
|
987
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
988
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeDateComponent, isStandalone: false, selector: "edyta-form-type-date", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <input class=\"uk-input uk-width-1-1@s uk-width-1-3@m uk-width-1-4@l\" type=\"date\" [(ngModel)]=\"content.state\" (input)=\"onChange()\" />\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
989
|
+
}
|
|
990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeDateComponent, decorators: [{
|
|
991
|
+
type: Component,
|
|
992
|
+
args: [{ selector: 'edyta-form-type-date', standalone: false, template: "<div class=\"uk-margin\">\n <div class=\"uk-form-controls\">\n <input class=\"uk-input uk-width-1-1@s uk-width-1-3@m uk-width-1-4@l\" type=\"date\" [(ngModel)]=\"content.state\" (input)=\"onChange()\" />\n </div>\n</div>\n" }]
|
|
993
|
+
}], propDecorators: { content: [{
|
|
994
|
+
type: Input
|
|
995
|
+
}] } });
|
|
996
|
+
|
|
997
|
+
class FormTypeUkuleleChordsComponent extends CanvasComponent {
|
|
998
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeUkuleleChordsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
999
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeUkuleleChordsComponent, isStandalone: false, selector: "edyta-form-type-ukulele-chords", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "\n<div uk-grid>\n <div edyta-chord-ukulele *ngFor=\"let chordKey of content.ukuleleChords\" class=\"uk-width-1-2@s uk-width-1-4@m uk-width-1-6@l\" [chordKey]=\"chordKey\"></div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$3.ChordUkuleleComponent, selector: "[edyta-chord-ukulele]", inputs: ["chordKey"] }] }); }
|
|
1000
|
+
}
|
|
1001
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeUkuleleChordsComponent, decorators: [{
|
|
1002
|
+
type: Component,
|
|
1003
|
+
args: [{ selector: 'edyta-form-type-ukulele-chords', standalone: false, template: "\n<div uk-grid>\n <div edyta-chord-ukulele *ngFor=\"let chordKey of content.ukuleleChords\" class=\"uk-width-1-2@s uk-width-1-4@m uk-width-1-6@l\" [chordKey]=\"chordKey\"></div>\n</div>" }]
|
|
1004
|
+
}], propDecorators: { content: [{
|
|
1005
|
+
type: Input,
|
|
1006
|
+
args: [{ required: true }]
|
|
1007
|
+
}] } });
|
|
1008
|
+
|
|
1009
|
+
class FormTypeItemComponent extends CanvasComponent {
|
|
1010
|
+
get content() {
|
|
1011
|
+
return this._content;
|
|
1012
|
+
}
|
|
1013
|
+
set content(value) {
|
|
1014
|
+
this._content = value;
|
|
1015
|
+
}
|
|
1016
|
+
showDecriptionSection() {
|
|
1017
|
+
return this.content.type === 'text' || !!this.content.description;
|
|
1018
|
+
}
|
|
1019
|
+
showMedia() {
|
|
1020
|
+
return !!this.content.media?.url && !!this.content.media.mimeType;
|
|
1021
|
+
}
|
|
1022
|
+
showPicture() {
|
|
1023
|
+
const pictureType = typeof this.content.picture;
|
|
1024
|
+
if (pictureType === 'string') {
|
|
1025
|
+
return !!this.content.picture;
|
|
1026
|
+
}
|
|
1027
|
+
else if (pictureType === 'object') {
|
|
1028
|
+
return !!this.content.picture.url;
|
|
1029
|
+
}
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
isPictureAlwaysVisible() {
|
|
1033
|
+
if (typeof this.content.picture === 'object') {
|
|
1034
|
+
return !!this.content.picture.alwaysVisible;
|
|
1035
|
+
}
|
|
1036
|
+
return false;
|
|
1037
|
+
}
|
|
1038
|
+
onChange() {
|
|
1039
|
+
this.contentChange.emit(this.content);
|
|
1040
|
+
}
|
|
1041
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1042
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormTypeItemComponent, isStandalone: false, selector: "edyta-form-type-item", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<div [style.backgroundColor]=\"content.color?.background\" [style.color]=\"content.color?.text\">\n <fieldset class=\"uk-fieldset uk-margin-small-left\">\n\n <legend class=\"uk-legend\">\n {{ content.text }} <div class=\"required-indicator\" *ngIf=\"!['text', 'ukuleleChords'].includes(content.type) && content.mandatory\"> *</div>\n </legend>\n\n <div class=\"uk-margin-top\" *ngIf=\"showDecriptionSection()\">\n <div class=\"form-content-wrapper\">\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ showPicture() ? 'uk-width-3-4@m' : '' ]\" *ngIf=\"content.description\">\n <p [innerHTML]=\"content.description\"></p>\n </div>\n <div\n class=\"uk-margin-small-right\"\n [ngClass]=\"[ content.description ? 'uk-width-1-3@m uk-width-1-4@l' : 'uk-width-1-1', content.description && !isPictureAlwaysVisible() ? 'uk-visible@m' : '' ]\"\n *ngIf=\"showPicture()\">\n <img class=\"form-picture\" [src]=\"$any(content.picture)?.url || content.picture\" [alt]=\"content.text\">\n </div>\n </div>\n </div>\n <div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"content.media?.url || ''\" [fileMimeType]=\"content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n </div>\n\n <div class=\"uk-margin form-content-wrapper\">\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ !content.description && showPicture() ? 'uk-width-3-4@m' : '' ]\">\n <edyta-form-type-text *ngIf=\"content.type === 'text'\"></edyta-form-type-text>\n <edyta-form-type-input [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'input'\"></edyta-form-type-input>\n <edyta-form-type-select [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'select'\"></edyta-form-type-select>\n <edyta-form-type-radio [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'radio'\"></edyta-form-type-radio>\n <edyta-form-type-checkbox [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'check'\"></edyta-form-type-checkbox>\n <edyta-form-type-date [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'date'\"></edyta-form-type-date>\n <edyta-form-type-ukulele-chords [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" *ngIf=\"content.type === 'ukuleleChords'\"></edyta-form-type-ukulele-chords>\n </div>\n <div class=\"uk-margin-small-right uk-width-1-3@m uk-width-1-4@l\" [ngClass]=\"[ !isPictureAlwaysVisible() ? 'uk-visible@m' : '' ]\"\n *ngIf=\"!content.description && showPicture()\">\n <img class=\"form-picture\" [src]=\"$any(content.picture)?.url || content.picture\" [alt]=\"content.text\">\n </div>\n </div>\n\n </fieldset>\n</div>\n\n<hr class=\"uk-divider-icon\" *ngIf=\"content.divider\">\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.MediaElementComponent, selector: "edyta-media-element" }, { kind: "component", type: FormTypeTextComponent, selector: "edyta-form-type-text" }, { kind: "component", type: FormTypeInputComponent, selector: "edyta-form-type-input", inputs: ["content"] }, { kind: "component", type: FormTypeSelectComponent, selector: "edyta-form-type-select", inputs: ["content"] }, { kind: "component", type: FormTypeRadioComponent, selector: "edyta-form-type-radio", inputs: ["content"] }, { kind: "component", type: FormTypeCheckboxComponent, selector: "edyta-form-type-checkbox", inputs: ["content"] }, { kind: "component", type: FormTypeDateComponent, selector: "edyta-form-type-date", inputs: ["content"] }, { kind: "component", type: FormTypeUkuleleChordsComponent, selector: "edyta-form-type-ukulele-chords", inputs: ["content"] }] }); }
|
|
1043
|
+
}
|
|
1044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormTypeItemComponent, decorators: [{
|
|
1045
|
+
type: Component,
|
|
1046
|
+
args: [{ selector: 'edyta-form-type-item', standalone: false, template: "<div [style.backgroundColor]=\"content.color?.background\" [style.color]=\"content.color?.text\">\n <fieldset class=\"uk-fieldset uk-margin-small-left\">\n\n <legend class=\"uk-legend\">\n {{ content.text }} <div class=\"required-indicator\" *ngIf=\"!['text', 'ukuleleChords'].includes(content.type) && content.mandatory\"> *</div>\n </legend>\n\n <div class=\"uk-margin-top\" *ngIf=\"showDecriptionSection()\">\n <div class=\"form-content-wrapper\">\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ showPicture() ? 'uk-width-3-4@m' : '' ]\" *ngIf=\"content.description\">\n <p [innerHTML]=\"content.description\"></p>\n </div>\n <div\n class=\"uk-margin-small-right\"\n [ngClass]=\"[ content.description ? 'uk-width-1-3@m uk-width-1-4@l' : 'uk-width-1-1', content.description && !isPictureAlwaysVisible() ? 'uk-visible@m' : '' ]\"\n *ngIf=\"showPicture()\">\n <img class=\"form-picture\" [src]=\"$any(content.picture)?.url || content.picture\" [alt]=\"content.text\">\n </div>\n </div>\n </div>\n <div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"content.media?.url || ''\" [fileMimeType]=\"content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n </div>\n\n <div class=\"uk-margin form-content-wrapper\">\n <div class=\"uk-width-1-1@s\" [ngClass]=\"[ !content.description && showPicture() ? 'uk-width-3-4@m' : '' ]\">\n <edyta-form-type-text *ngIf=\"content.type === 'text'\"></edyta-form-type-text>\n <edyta-form-type-input [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'input'\"></edyta-form-type-input>\n <edyta-form-type-select [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'select'\"></edyta-form-type-select>\n <edyta-form-type-radio [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'radio'\"></edyta-form-type-radio>\n <edyta-form-type-checkbox [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'check'\"></edyta-form-type-checkbox>\n <edyta-form-type-date [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngIf=\"content.type === 'date'\"></edyta-form-type-date>\n <edyta-form-type-ukulele-chords [content]=\"$any(content)\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" *ngIf=\"content.type === 'ukuleleChords'\"></edyta-form-type-ukulele-chords>\n </div>\n <div class=\"uk-margin-small-right uk-width-1-3@m uk-width-1-4@l\" [ngClass]=\"[ !isPictureAlwaysVisible() ? 'uk-visible@m' : '' ]\"\n *ngIf=\"!content.description && showPicture()\">\n <img class=\"form-picture\" [src]=\"$any(content.picture)?.url || content.picture\" [alt]=\"content.text\">\n </div>\n </div>\n\n </fieldset>\n</div>\n\n<hr class=\"uk-divider-icon\" *ngIf=\"content.divider\">\n" }]
|
|
1047
|
+
}], propDecorators: { content: [{
|
|
1048
|
+
type: Input
|
|
1049
|
+
}] } });
|
|
1050
|
+
|
|
1051
|
+
class FormComponent extends CanvasComponent {
|
|
1052
|
+
constructor() {
|
|
1053
|
+
super();
|
|
1054
|
+
}
|
|
1055
|
+
get entity() {
|
|
1056
|
+
return this._entity;
|
|
1057
|
+
}
|
|
1058
|
+
set entity(entity) {
|
|
1059
|
+
this._process(entity);
|
|
1060
|
+
}
|
|
1061
|
+
get formItems() {
|
|
1062
|
+
return this._formItems;
|
|
1063
|
+
}
|
|
1064
|
+
set formItems(form) {
|
|
1065
|
+
this._formItems = form;
|
|
1066
|
+
}
|
|
1067
|
+
onChange() {
|
|
1068
|
+
this.contentChange.emit(this._buildProgressSnapshot());
|
|
1069
|
+
}
|
|
1070
|
+
_process(entity) {
|
|
1071
|
+
this._entity = entity;
|
|
1072
|
+
this.formItems = this._entity.content;
|
|
1073
|
+
this._prepareState();
|
|
1074
|
+
}
|
|
1075
|
+
_prepareState() {
|
|
1076
|
+
this.formItems.forEach(input => {
|
|
1077
|
+
if (input.type === 'text') {
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (input.type === 'check') {
|
|
1081
|
+
input.options = input.options.map(option => {
|
|
1082
|
+
return {
|
|
1083
|
+
...option,
|
|
1084
|
+
checked: false
|
|
1085
|
+
};
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
input.state = '';
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
this._applyProgress2State();
|
|
1093
|
+
}
|
|
1094
|
+
_buildProgressSnapshot() {
|
|
1095
|
+
return this.formItems.filter(({ type }) => type !== 'text').map(item => {
|
|
1096
|
+
if (item.type === 'check') {
|
|
1097
|
+
return { key: item.key, state: item.options.map(({ id, checked }) => ({ id, checked })) };
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
return { key: item.key, state: item.state };
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
_applyProgress2State() {
|
|
1105
|
+
if (!this._entity.progress) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
this._entity.progress.forEach(progressItem => {
|
|
1109
|
+
const formItem = this.formItems.find(({ key }) => key === progressItem.key);
|
|
1110
|
+
if (!formItem) {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
if (formItem.type === 'check') {
|
|
1114
|
+
progressItem.state.forEach((stateItem) => {
|
|
1115
|
+
const optionItem = formItem.options.find(({ id }) => id === stateItem.id);
|
|
1116
|
+
if (optionItem) {
|
|
1117
|
+
optionItem.checked = stateItem.checked;
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
formItem.state = progressItem.state;
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: FormComponent, isStandalone: false, selector: "edyta-form", inputs: { entity: "entity" }, usesInheritance: true, ngImport: i0, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n <edyta-form-type-item [content]=\"item\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngFor=\"let item of formItems\"></edyta-form-type-item>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".required-indicator{color:red;display:inline-block;margin-left:.5rem}.form-content-wrapper{display:flex}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }, { kind: "component", type: FormTypeItemComponent, selector: "edyta-form-type-item", inputs: ["content"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1128
|
+
}
|
|
1129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormComponent, decorators: [{
|
|
1130
|
+
type: Component,
|
|
1131
|
+
args: [{ selector: 'edyta-form', encapsulation: ViewEncapsulation.None, standalone: false, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n <edyta-form-type-item [content]=\"item\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (contentChange)=\"onChange()\" *ngFor=\"let item of formItems\"></edyta-form-type-item>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".required-indicator{color:red;display:inline-block;margin-left:.5rem}.form-content-wrapper{display:flex}\n"] }]
|
|
1132
|
+
}], ctorParameters: () => [], propDecorators: { entity: [{
|
|
1133
|
+
type: Input,
|
|
1134
|
+
args: [{ required: true }]
|
|
1135
|
+
}] } });
|
|
1136
|
+
|
|
1137
|
+
class RiddleInputConvertor {
|
|
1138
|
+
html(entity) {
|
|
1139
|
+
/**
|
|
1140
|
+
* @see https://regex101.com/r/O3XK5H/1
|
|
1141
|
+
*/
|
|
1142
|
+
const regexScript = new RegExp('(<\\s{0,}script.*?>)|(<\\s{0,}[a-zA-Z]+\\s{0,}[a-zA-Z]+=\\s{0,}["\']\\s{0,}javascript:.*?>)', 'mgi');
|
|
1143
|
+
let html = entity.content.innerHTML;
|
|
1144
|
+
if (html.replace(/(\r\n|\n|\r)/gm, '').match(regexScript)?.length) {
|
|
1145
|
+
throw new Error('Content contains dangerous scripts. Cannot be rendered from security reason');
|
|
1146
|
+
}
|
|
1147
|
+
const regexButton = new RegExp('<button .*?data-riddle-item-id="(.*?)">.*?</button>', 'mgi');
|
|
1148
|
+
const riddleItemIds = [];
|
|
1149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1150
|
+
let riddleItem;
|
|
1151
|
+
while ((riddleItem = regexButton.exec(html)) !== null) {
|
|
1152
|
+
riddleItemIds.push(riddleItem[1]);
|
|
1153
|
+
}
|
|
1154
|
+
riddleItemIds.forEach(id => {
|
|
1155
|
+
const riddleItem = entity.content.input.find(item => item.key === id);
|
|
1156
|
+
if (!riddleItem) {
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
const regexItem = new RegExp(`<button .*?data-riddle-item-id="${id}">.*?</button>`, 'mgi');
|
|
1160
|
+
if (['input'].includes(riddleItem.type)) {
|
|
1161
|
+
html = html.replace(regexItem, `<input type="text" class="uk-input uk-form-small uk-form-width-small" data-riddle-item-id="${id}" />`);
|
|
1162
|
+
}
|
|
1163
|
+
else if (['select'].includes(riddleItem.type)) {
|
|
1164
|
+
let optionsHtml = '<option value=""></option>';
|
|
1165
|
+
optionsHtml += riddleItem.options.map(({ id, text }) => `<option value="${id}">${text}</option>`).join('');
|
|
1166
|
+
html = html.replace(regexItem, `<select class="uk-select uk-form-small uk-form-width-small" data-riddle-item-id="${id}">${optionsHtml}</select>`);
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
return html;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
class RiddleComponent extends CanvasComponent {
|
|
1174
|
+
constructor(_sanitizer, _router) {
|
|
1175
|
+
super();
|
|
1176
|
+
this._sanitizer = _sanitizer;
|
|
1177
|
+
this._router = _router;
|
|
1178
|
+
this._html = '';
|
|
1179
|
+
this._eventListenerAdded = [];
|
|
1180
|
+
this.errorReceived = new EventEmitter();
|
|
1181
|
+
}
|
|
1182
|
+
ngAfterViewChecked() {
|
|
1183
|
+
const elements = document.querySelectorAll('[data-riddle-item-id]');
|
|
1184
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1185
|
+
const element = elements[i];
|
|
1186
|
+
const riddleItem = this._deriveRiddleItemByElement(element);
|
|
1187
|
+
if (riddleItem) {
|
|
1188
|
+
element.value = riddleItem.state;
|
|
1189
|
+
}
|
|
1190
|
+
if (this._isEventListenerAdded(element)) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
this._eventListenerAdded.push(element);
|
|
1194
|
+
element.addEventListener(this._determineHTMLEvent(element), (event) => {
|
|
1195
|
+
const element = event.target;
|
|
1196
|
+
const riddleItem = this._deriveRiddleItemByElement(element);
|
|
1197
|
+
if (!riddleItem) {
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
riddleItem.state = element.value;
|
|
1201
|
+
this.contentChange.emit(this._buildProgressSnapshot());
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
get entity() {
|
|
1206
|
+
return this._entity;
|
|
1207
|
+
}
|
|
1208
|
+
set entity(entity) {
|
|
1209
|
+
this._process(entity);
|
|
1210
|
+
}
|
|
1211
|
+
get html() {
|
|
1212
|
+
return this._html;
|
|
1213
|
+
}
|
|
1214
|
+
set html(value) {
|
|
1215
|
+
this._html = value;
|
|
1216
|
+
}
|
|
1217
|
+
_process(entity) {
|
|
1218
|
+
this._entity = entity;
|
|
1219
|
+
try {
|
|
1220
|
+
this.html = this._sanitizer.bypassSecurityTrustHtml(new RiddleInputConvertor().html(this._entity));
|
|
1221
|
+
}
|
|
1222
|
+
catch (error) {
|
|
1223
|
+
this.errorReceived.emit(error);
|
|
1224
|
+
this._router.navigate(['/welcome']);
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
this._prepareState();
|
|
1228
|
+
}
|
|
1229
|
+
_prepareState() {
|
|
1230
|
+
this._entity.content.input.forEach(input => {
|
|
1231
|
+
input.state = '';
|
|
1232
|
+
});
|
|
1233
|
+
this._applyProgress2State();
|
|
1234
|
+
}
|
|
1235
|
+
_applyProgress2State() {
|
|
1236
|
+
if (!this._entity.progress) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
this._entity.progress.forEach(item => {
|
|
1240
|
+
const contentItem = this._entity.content.input.find(({ key }) => key === item.key);
|
|
1241
|
+
if (!contentItem) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
contentItem.state = item.state;
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
_deriveRiddleItemByElement(element) {
|
|
1248
|
+
const riddleItemId = element.dataset['riddleItemId'];
|
|
1249
|
+
if (!riddleItemId) {
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
return this._entity.content.input.find(item => item.key === riddleItemId);
|
|
1253
|
+
}
|
|
1254
|
+
_determineHTMLEvent(element) {
|
|
1255
|
+
switch (element.nodeName) {
|
|
1256
|
+
case 'INPUT':
|
|
1257
|
+
case 'DATE':
|
|
1258
|
+
return 'input';
|
|
1259
|
+
default:
|
|
1260
|
+
return 'change';
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
_isEventListenerAdded(element) {
|
|
1264
|
+
return !!this._eventListenerAdded.find(item => item === element);
|
|
1265
|
+
}
|
|
1266
|
+
_buildProgressSnapshot() {
|
|
1267
|
+
return this._entity.content.input.map(({ key, state }) => ({ key, state }));
|
|
1268
|
+
}
|
|
1269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RiddleComponent, deps: [{ token: i1$1.DomSanitizer }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1270
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: RiddleComponent, isStandalone: false, selector: "edyta-riddle", inputs: { entity: "entity" }, outputs: { errorReceived: "errorReceived" }, usesInheritance: true, ngImport: i0, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n\n <div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1 uk-margin-bottom\" *ngIf=\"entity.content.media.url\">\n <div class=\"uk-child-width-expand\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"entity.content.media.url\" [fileMimeType]=\"entity.content.media.mimeType\"></edyta-media-element>\n </div>\n <div></div>\n </div>\n </div>\n\n <div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1\">\n <div class=\"uk-padding uk-padding-remove-vertical\" [innerHTML]=\"html\"></div>\n </div>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".uk-section>div>*:last-of-type{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2$2.MediaElementComponent, selector: "edyta-media-element" }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1271
|
+
}
|
|
1272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RiddleComponent, decorators: [{
|
|
1273
|
+
type: Component,
|
|
1274
|
+
args: [{ selector: 'edyta-riddle', encapsulation: ViewEncapsulation.None, standalone: false, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n\n <div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1 uk-margin-bottom\" *ngIf=\"entity.content.media.url\">\n <div class=\"uk-child-width-expand\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"entity.content.media.url\" [fileMimeType]=\"entity.content.media.mimeType\"></edyta-media-element>\n </div>\n <div></div>\n </div>\n </div>\n\n <div class=\"uk-section uk-section-small uk-section-muted uk-width-1-1\">\n <div class=\"uk-padding uk-padding-remove-vertical\" [innerHTML]=\"html\"></div>\n </div>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [".uk-section>div>*:last-of-type{margin-bottom:0}\n"] }]
|
|
1275
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }, { type: i2.Router }], propDecorators: { errorReceived: [{
|
|
1276
|
+
type: Output
|
|
1277
|
+
}], entity: [{
|
|
1278
|
+
type: Input,
|
|
1279
|
+
args: [{ required: true }]
|
|
1280
|
+
}] } });
|
|
1281
|
+
|
|
1282
|
+
class YesnoComponent extends CanvasComponent {
|
|
1283
|
+
get entity() {
|
|
1284
|
+
return this._entity;
|
|
1285
|
+
}
|
|
1286
|
+
set entity(entity) {
|
|
1287
|
+
this._process(entity);
|
|
1288
|
+
}
|
|
1289
|
+
onChange() {
|
|
1290
|
+
this.contentChange.emit(this.buildProgressSnapshot());
|
|
1291
|
+
}
|
|
1292
|
+
showMedia() {
|
|
1293
|
+
return !!this.entity.content.media?.url && !!this.entity.content.media.mimeType;
|
|
1294
|
+
}
|
|
1295
|
+
_process(entity) {
|
|
1296
|
+
this._entity = entity;
|
|
1297
|
+
this._prepareState();
|
|
1298
|
+
}
|
|
1299
|
+
_prepareState() {
|
|
1300
|
+
this._entity.content.input.forEach(input => {
|
|
1301
|
+
input.answer = '';
|
|
1302
|
+
});
|
|
1303
|
+
this._applyProgress2State();
|
|
1304
|
+
}
|
|
1305
|
+
_applyProgress2State() {
|
|
1306
|
+
if (!this._entity.progress) {
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
this._entity.progress.forEach(item => {
|
|
1310
|
+
const contentItem = this._entity.content.input.find(({ key }) => key === item.key);
|
|
1311
|
+
if (!contentItem) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
contentItem.answer = item.answer === undefined ? '' : item.answer.toString();
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
buildProgressSnapshot() {
|
|
1318
|
+
return this._entity.content.input.map(({ key, answer }) => ({ key, answer: this.calculateAnswer(answer) }));
|
|
1319
|
+
}
|
|
1320
|
+
calculateAnswer(answer) {
|
|
1321
|
+
if (answer === '') {
|
|
1322
|
+
return undefined;
|
|
1323
|
+
}
|
|
1324
|
+
return answer === 'true' ? true : false;
|
|
1325
|
+
}
|
|
1326
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: YesnoComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1327
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: YesnoComponent, isStandalone: false, selector: "edyta-yes-no", inputs: { entity: "entity" }, usesInheritance: true, ngImport: i0, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n <div *ngIf=\"entity && entity.content.innerHTML\" class=\"uk-child-width-1 grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\" [innerHTML]=\"entity.content.innerHTML\"></div>\n </div>\n </div>\n\n <div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"entity.content.media?.url || ''\" [fileMimeType]=\"entity.content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n </div>\n\n <div class=\"uk-margin-medium-top\">\n <ul class=\"uk-list uk-list-striped\">\n <li *ngFor=\"let item of entity.content.input\">\n <div uk-grid>\n <div class=\"uk-width-expand\">{{ item.question }}</div>\n <div><edyta-boolean-element [(value)]=\"item.answer\" (valueChange)=\"onChange()\"></edyta-boolean-element></div>\n </div>\n </li>\n </ul>\n </div>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2$2.BooleanElementComponent, selector: "edyta-boolean-element", inputs: ["yesButtonText", "noButtonText"] }, { kind: "component", type: i2$2.MediaElementComponent, selector: "edyta-media-element" }, { kind: "component", type: EntityBottomPaneComponent, selector: "edyta-entity-bottom-pane", inputs: ["checkButtonText", "previousButtonText", "nextButtonText", "entity"], outputs: ["evaluate"] }] }); }
|
|
1328
|
+
}
|
|
1329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: YesnoComponent, decorators: [{
|
|
1330
|
+
type: Component,
|
|
1331
|
+
args: [{ selector: 'edyta-yes-no', standalone: false, template: "<form class=\"uk-form-stacked\" (submit)=\"onEvaluate()\">\n <div *ngIf=\"entity && entity.content.innerHTML\" class=\"uk-child-width-1 grid\" uk-grid>\n <div>\n <div class=\"uk-width-1 uk-card uk-card-default uk-card-body\" [innerHTML]=\"entity.content.innerHTML\"></div>\n </div>\n </div>\n\n <div class=\"uk-child-width-expand uk-margin-top\" *ngIf=\"showMedia()\" uk-grid>\n <div></div>\n <div class=\"uk-width-1-1@m uk-width-3-4@l uk-text-center\">\n <edyta-media-element [fileContent]=\"entity.content.media?.url || ''\" [fileMimeType]=\"entity.content.media?.mimeType || ''\" ></edyta-media-element>\n </div>\n <div></div>\n </div>\n\n <div class=\"uk-margin-medium-top\">\n <ul class=\"uk-list uk-list-striped\">\n <li *ngFor=\"let item of entity.content.input\">\n <div uk-grid>\n <div class=\"uk-width-expand\">{{ item.question }}</div>\n <div><edyta-boolean-element [(value)]=\"item.answer\" (valueChange)=\"onChange()\"></edyta-boolean-element></div>\n </div>\n </li>\n </ul>\n </div>\n</form>\n\n<edyta-entity-bottom-pane [entity]=\"entity\" [checkButtonText]=\"checkButtonText\" [previousButtonText]=\"previousButtonText\" [nextButtonText]=\"nextButtonText\" (evaluate)=\"onEvaluate()\"></edyta-entity-bottom-pane>\n" }]
|
|
1332
|
+
}], propDecorators: { entity: [{
|
|
1333
|
+
type: Input,
|
|
1334
|
+
args: [{ required: true }]
|
|
1335
|
+
}] } });
|
|
1336
|
+
|
|
1337
|
+
class CanvasModule {
|
|
1338
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CanvasModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1339
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: CanvasModule, declarations: [CanvasComponent,
|
|
1340
|
+
EntityBottomPaneComponent,
|
|
1341
|
+
PuzzleComponent,
|
|
1342
|
+
PuzzleTargetComponent,
|
|
1343
|
+
PuzzleOptionComponent,
|
|
1344
|
+
PuzzleOptionDialogComponent,
|
|
1345
|
+
PuzzleFactComponent,
|
|
1346
|
+
GrammarComponent,
|
|
1347
|
+
VocabularyComponent,
|
|
1348
|
+
FormComponent,
|
|
1349
|
+
FormTypeTextComponent,
|
|
1350
|
+
FormTypeInputComponent,
|
|
1351
|
+
FormTypeSelectComponent,
|
|
1352
|
+
FormTypeRadioComponent,
|
|
1353
|
+
FormTypeCheckboxComponent,
|
|
1354
|
+
FormTypeDateComponent,
|
|
1355
|
+
FormTypeUkuleleChordsComponent,
|
|
1356
|
+
FormTypeItemComponent,
|
|
1357
|
+
VocabularyCardFlipComponent,
|
|
1358
|
+
VocabularyCardStandardComponent,
|
|
1359
|
+
GrammarItemComponent,
|
|
1360
|
+
RiddleComponent,
|
|
1361
|
+
YesnoComponent], imports: [CommonModule,
|
|
1362
|
+
RouterModule,
|
|
1363
|
+
FormsModule,
|
|
1364
|
+
ElementModule,
|
|
1365
|
+
ChordModule], exports: [CanvasComponent,
|
|
1366
|
+
EntityBottomPaneComponent,
|
|
1367
|
+
PuzzleComponent,
|
|
1368
|
+
GrammarComponent,
|
|
1369
|
+
VocabularyComponent,
|
|
1370
|
+
FormComponent,
|
|
1371
|
+
RiddleComponent,
|
|
1372
|
+
YesnoComponent] }); }
|
|
1373
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CanvasModule, imports: [CommonModule,
|
|
1374
|
+
RouterModule,
|
|
1375
|
+
FormsModule,
|
|
1376
|
+
ElementModule,
|
|
1377
|
+
ChordModule] }); }
|
|
1378
|
+
}
|
|
1379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: CanvasModule, decorators: [{
|
|
1380
|
+
type: NgModule,
|
|
1381
|
+
args: [{
|
|
1382
|
+
declarations: [
|
|
1383
|
+
CanvasComponent,
|
|
1384
|
+
EntityBottomPaneComponent,
|
|
1385
|
+
PuzzleComponent,
|
|
1386
|
+
PuzzleTargetComponent,
|
|
1387
|
+
PuzzleOptionComponent,
|
|
1388
|
+
PuzzleOptionDialogComponent,
|
|
1389
|
+
PuzzleFactComponent,
|
|
1390
|
+
GrammarComponent,
|
|
1391
|
+
VocabularyComponent,
|
|
1392
|
+
FormComponent,
|
|
1393
|
+
FormTypeTextComponent,
|
|
1394
|
+
FormTypeInputComponent,
|
|
1395
|
+
FormTypeSelectComponent,
|
|
1396
|
+
FormTypeRadioComponent,
|
|
1397
|
+
FormTypeCheckboxComponent,
|
|
1398
|
+
FormTypeDateComponent,
|
|
1399
|
+
FormTypeUkuleleChordsComponent,
|
|
1400
|
+
FormTypeItemComponent,
|
|
1401
|
+
VocabularyCardFlipComponent,
|
|
1402
|
+
VocabularyCardStandardComponent,
|
|
1403
|
+
GrammarItemComponent,
|
|
1404
|
+
RiddleComponent,
|
|
1405
|
+
YesnoComponent,
|
|
1406
|
+
],
|
|
1407
|
+
imports: [
|
|
1408
|
+
CommonModule,
|
|
1409
|
+
RouterModule,
|
|
1410
|
+
FormsModule,
|
|
1411
|
+
ElementModule,
|
|
1412
|
+
ChordModule
|
|
1413
|
+
],
|
|
1414
|
+
exports: [
|
|
1415
|
+
CanvasComponent,
|
|
1416
|
+
EntityBottomPaneComponent,
|
|
1417
|
+
PuzzleComponent,
|
|
1418
|
+
GrammarComponent,
|
|
1419
|
+
VocabularyComponent,
|
|
1420
|
+
FormComponent,
|
|
1421
|
+
RiddleComponent,
|
|
1422
|
+
YesnoComponent
|
|
1423
|
+
]
|
|
1424
|
+
}]
|
|
1425
|
+
}] });
|
|
1426
|
+
|
|
1427
|
+
class FormLearningEntityContentConvertor {
|
|
1428
|
+
toInternal(entity) {
|
|
1429
|
+
return entity?.content?.input || [];
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
class GrammarLearningEntityContentConvertor {
|
|
1434
|
+
toInternal(entity) {
|
|
1435
|
+
return entity?.content?.input || [];
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
class PuzzleLearningEntityContentConvertor {
|
|
1440
|
+
toInternal(entity) {
|
|
1441
|
+
if (!entity?.content?.input) {
|
|
1442
|
+
return {
|
|
1443
|
+
facts: [],
|
|
1444
|
+
options: []
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
const input = entity.content.input;
|
|
1448
|
+
const facts = input.front.map(puzzle => ({
|
|
1449
|
+
id: puzzle.id,
|
|
1450
|
+
text: puzzle.text,
|
|
1451
|
+
color: this._calculateColor(puzzle.color),
|
|
1452
|
+
assignedOptions: []
|
|
1453
|
+
}));
|
|
1454
|
+
const options = input.back.map(puzzle => ({
|
|
1455
|
+
id: puzzle.id,
|
|
1456
|
+
text: puzzle.text,
|
|
1457
|
+
color: this._calculateColor(puzzle.color)
|
|
1458
|
+
}));
|
|
1459
|
+
const content = {
|
|
1460
|
+
description: entity.content.description,
|
|
1461
|
+
facts,
|
|
1462
|
+
options
|
|
1463
|
+
};
|
|
1464
|
+
if (entity.content.shuffle) {
|
|
1465
|
+
content.options = this._shuffle(content.options);
|
|
1466
|
+
if (entity.content.shuffleAll) {
|
|
1467
|
+
content.facts = this._shuffle(content.facts);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return content;
|
|
1471
|
+
}
|
|
1472
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1473
|
+
_shuffle(puzzleItems) {
|
|
1474
|
+
return puzzleItems.sort(() => 0.5 - Math.random());
|
|
1475
|
+
}
|
|
1476
|
+
_calculateColor(color) {
|
|
1477
|
+
return {
|
|
1478
|
+
requested: {
|
|
1479
|
+
background: color?.requested.background || false,
|
|
1480
|
+
text: color?.requested.text || false
|
|
1481
|
+
},
|
|
1482
|
+
background: color?.background || '',
|
|
1483
|
+
text: color?.text || ''
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
class RiddleLearningEntityContentConvertor {
|
|
1489
|
+
toInternal(entity) {
|
|
1490
|
+
return entity?.content || {
|
|
1491
|
+
input: [],
|
|
1492
|
+
innerHTML: '',
|
|
1493
|
+
media: {}
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
class VocabularyLearningEntityContentConvertor {
|
|
1499
|
+
toInternal(entity, centralService) {
|
|
1500
|
+
if (!entity?.content?.input) {
|
|
1501
|
+
return [];
|
|
1502
|
+
}
|
|
1503
|
+
const languageService = centralService.getLanguageService();
|
|
1504
|
+
return entity.content.input.filter(({ flip = false, description: descriptions, meaning: meanings }) => flip ? !!descriptions.length : !!meanings.length).map(({ key, meaning: meanings = [], flip = false, description: descriptions = [], picture }) => {
|
|
1505
|
+
const meaning = this._deriveMeaningByLanguage(meanings, languageService);
|
|
1506
|
+
const description = this._deriveDescriptionByLanguage(descriptions, languageService);
|
|
1507
|
+
return {
|
|
1508
|
+
key,
|
|
1509
|
+
meaning,
|
|
1510
|
+
flip: flip && !!description,
|
|
1511
|
+
description,
|
|
1512
|
+
picture: picture || 'https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg'
|
|
1513
|
+
};
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
_deriveMeaningByLanguage(meanings, languageService) {
|
|
1517
|
+
return meanings.find(meaning => meaning.lang === languageService.get())?.text // finds the 'meaning' for the prefered language
|
|
1518
|
+
|| meanings.find(meaning => meaning.lang === languageService.getDefault())?.text // if the meaning does not exist for prefered language, it tries to find the meaning for the default language
|
|
1519
|
+
|| meanings[0]?.text // if meaning for default language does not exist neither then it simply takes the first meaning with no respect to language
|
|
1520
|
+
|| ''; // fallback if no description has been found
|
|
1521
|
+
}
|
|
1522
|
+
_deriveDescriptionByLanguage(descriptions, languageService) {
|
|
1523
|
+
return descriptions.find(description => description.lang === languageService.get())?.text // finds the 'description' for the prefered language
|
|
1524
|
+
|| descriptions.find(description => description.lang === languageService.getDefault())?.text // if the description does not exist for prefered language, it tries to find the description for the default language
|
|
1525
|
+
|| descriptions[0]?.text // if description for default language does not exist neither then it simply takes the first descriptions with no respect to language
|
|
1526
|
+
|| ''; // fallback if no description has been found
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
class YesNoLearningEntityContentConvertor {
|
|
1531
|
+
toInternal(entity) {
|
|
1532
|
+
return entity?.content || {
|
|
1533
|
+
input: [],
|
|
1534
|
+
innerHTML: '',
|
|
1535
|
+
media: {}
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
class LearningEntityConvertorFactory {
|
|
1541
|
+
static getContentConvertor(entityType) {
|
|
1542
|
+
switch (entityType) {
|
|
1543
|
+
case 'vocabulary':
|
|
1544
|
+
return new VocabularyLearningEntityContentConvertor();
|
|
1545
|
+
case 'grammar':
|
|
1546
|
+
return new GrammarLearningEntityContentConvertor();
|
|
1547
|
+
case 'form':
|
|
1548
|
+
return new FormLearningEntityContentConvertor();
|
|
1549
|
+
case 'puzzle':
|
|
1550
|
+
return new PuzzleLearningEntityContentConvertor();
|
|
1551
|
+
case 'riddle':
|
|
1552
|
+
return new RiddleLearningEntityContentConvertor();
|
|
1553
|
+
case 'yesno':
|
|
1554
|
+
return new YesNoLearningEntityContentConvertor();
|
|
1555
|
+
default:
|
|
1556
|
+
throw new Error(`Content convertor for type ${entityType} not implemented!`);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
class LearningEntityBase {
|
|
1562
|
+
constructor(entity, centralService, learningEntityService) {
|
|
1563
|
+
this._id = entity.id;
|
|
1564
|
+
this._title = entity.title;
|
|
1565
|
+
this._type = entity.type.key;
|
|
1566
|
+
this._levelId = entity.level.id;
|
|
1567
|
+
this._organizationKey = entity.organization.key;
|
|
1568
|
+
this._picture = entity.picture;
|
|
1569
|
+
this._previousEntityId = entity.previous;
|
|
1570
|
+
this._nextEntityId = entity.next;
|
|
1571
|
+
this._assignment = {
|
|
1572
|
+
organizationKey: entity.organization.key,
|
|
1573
|
+
levelId: entity.level.id
|
|
1574
|
+
};
|
|
1575
|
+
this._centralService = centralService;
|
|
1576
|
+
this._learningEntityService = learningEntityService;
|
|
1577
|
+
this._init(entity);
|
|
1578
|
+
}
|
|
1579
|
+
get id() {
|
|
1580
|
+
return this._id;
|
|
1581
|
+
}
|
|
1582
|
+
get title() {
|
|
1583
|
+
return this._title;
|
|
1584
|
+
}
|
|
1585
|
+
get type() {
|
|
1586
|
+
return this._type;
|
|
1587
|
+
}
|
|
1588
|
+
get levelId() {
|
|
1589
|
+
return this._levelId;
|
|
1590
|
+
}
|
|
1591
|
+
get organizationKey() {
|
|
1592
|
+
return this._organizationKey;
|
|
1593
|
+
}
|
|
1594
|
+
get assignment() {
|
|
1595
|
+
return this._assignment;
|
|
1596
|
+
}
|
|
1597
|
+
get picture() {
|
|
1598
|
+
return this._picture;
|
|
1599
|
+
}
|
|
1600
|
+
get previousEntityId() {
|
|
1601
|
+
return this._previousEntityId;
|
|
1602
|
+
}
|
|
1603
|
+
get nextEntityId() {
|
|
1604
|
+
return this._nextEntityId;
|
|
1605
|
+
}
|
|
1606
|
+
getCentralService() {
|
|
1607
|
+
return this._centralService;
|
|
1608
|
+
}
|
|
1609
|
+
setCentralService(service) {
|
|
1610
|
+
this._centralService = service;
|
|
1611
|
+
}
|
|
1612
|
+
getLearningEntityService() {
|
|
1613
|
+
return this._learningEntityService;
|
|
1614
|
+
}
|
|
1615
|
+
setLearningEntityService(service) {
|
|
1616
|
+
this._learningEntityService = service;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
class InteractiveLearningEntityBase extends LearningEntityBase {
|
|
1621
|
+
updateProgress() {
|
|
1622
|
+
return this.getLearningEntityService().getProgressService().update(this);
|
|
1623
|
+
}
|
|
1624
|
+
deleteProgress() {
|
|
1625
|
+
return this.getLearningEntityService().getProgressService().delete(this);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
class FormLearningEntity extends InteractiveLearningEntityBase {
|
|
1630
|
+
isCheckable() {
|
|
1631
|
+
return true;
|
|
1632
|
+
}
|
|
1633
|
+
get progress() {
|
|
1634
|
+
return this._progress;
|
|
1635
|
+
}
|
|
1636
|
+
set progress(progress) {
|
|
1637
|
+
this._progress = progress;
|
|
1638
|
+
}
|
|
1639
|
+
get content() {
|
|
1640
|
+
return this._content;
|
|
1641
|
+
}
|
|
1642
|
+
_init(entity) {
|
|
1643
|
+
this._content = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1644
|
+
this._progress = entity.progress;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
class GrammarLearningEntity extends LearningEntityBase {
|
|
1649
|
+
isCheckable() {
|
|
1650
|
+
return false;
|
|
1651
|
+
}
|
|
1652
|
+
get content() {
|
|
1653
|
+
return this._grammars;
|
|
1654
|
+
}
|
|
1655
|
+
_init(entity) {
|
|
1656
|
+
this._grammars = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
class PuzzleLearningEntity extends InteractiveLearningEntityBase {
|
|
1661
|
+
isCheckable() {
|
|
1662
|
+
return true;
|
|
1663
|
+
}
|
|
1664
|
+
get progress() {
|
|
1665
|
+
return this._progress;
|
|
1666
|
+
}
|
|
1667
|
+
set progress(progress) {
|
|
1668
|
+
this._progress = progress;
|
|
1669
|
+
}
|
|
1670
|
+
get content() {
|
|
1671
|
+
return this._content;
|
|
1672
|
+
}
|
|
1673
|
+
_init(entity) {
|
|
1674
|
+
this._content = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1675
|
+
this._progress = entity.progress;
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
class RiddleLearningEntity extends InteractiveLearningEntityBase {
|
|
1680
|
+
isCheckable() {
|
|
1681
|
+
return true;
|
|
1682
|
+
}
|
|
1683
|
+
get progress() {
|
|
1684
|
+
return this._progress;
|
|
1685
|
+
}
|
|
1686
|
+
set progress(progress) {
|
|
1687
|
+
this._progress = progress;
|
|
1688
|
+
}
|
|
1689
|
+
get content() {
|
|
1690
|
+
return this._content;
|
|
1691
|
+
}
|
|
1692
|
+
_init(entity) {
|
|
1693
|
+
this._content = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1694
|
+
this._progress = entity.progress;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
class VocabularyLearningEntity extends LearningEntityBase {
|
|
1699
|
+
isCheckable() {
|
|
1700
|
+
return false;
|
|
1701
|
+
}
|
|
1702
|
+
get shuffleActivated() {
|
|
1703
|
+
return this._shuffleActivated;
|
|
1704
|
+
}
|
|
1705
|
+
set shuffleActivated(activated) {
|
|
1706
|
+
this._shuffleActivated = activated;
|
|
1707
|
+
}
|
|
1708
|
+
get shuffleButtonEnabled() {
|
|
1709
|
+
return this._shuffleButtonEnabled;
|
|
1710
|
+
}
|
|
1711
|
+
set shuffleButtonEnabled(enabled) {
|
|
1712
|
+
this._shuffleButtonEnabled = enabled;
|
|
1713
|
+
}
|
|
1714
|
+
get frontCardTitleVisibilityMode() {
|
|
1715
|
+
return this._frontCardTitleVisibilityMode;
|
|
1716
|
+
}
|
|
1717
|
+
set frontCardTitleVisibilityMode(mode) {
|
|
1718
|
+
this._frontCardTitleVisibilityMode = mode;
|
|
1719
|
+
}
|
|
1720
|
+
get content() {
|
|
1721
|
+
return this._vocabularies;
|
|
1722
|
+
}
|
|
1723
|
+
onShuffle() {
|
|
1724
|
+
// Fisher-Yates shuffle algorithm
|
|
1725
|
+
// https://medium.com/@oldwestaction/randomness-is-hard-e085decbcbb2
|
|
1726
|
+
const length = this._vocabularies.length;
|
|
1727
|
+
for (let i = 0; i < length; i++) {
|
|
1728
|
+
const swapIndex = Math.floor(Math.random() * length);
|
|
1729
|
+
const currentCard = this._vocabularies[i];
|
|
1730
|
+
const vocabularyToSwap = this._vocabularies[swapIndex];
|
|
1731
|
+
this._vocabularies[i] = vocabularyToSwap;
|
|
1732
|
+
this._vocabularies[swapIndex] = currentCard;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
_init(entity) {
|
|
1736
|
+
this.shuffleActivated = !!entity.content?.shuffle;
|
|
1737
|
+
this.shuffleButtonEnabled = this.shuffleActivated && !!entity.content?.shuffleButtonVisible;
|
|
1738
|
+
this.frontCardTitleVisibilityMode = entity.content?.frontCardTitleVisibilityMode || Vocabulary.FrontCardTitleVisibilityMode.Invisible;
|
|
1739
|
+
this._vocabularies = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1740
|
+
if (this.shuffleActivated) {
|
|
1741
|
+
this.onShuffle();
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
class YesNoLearningEntity extends InteractiveLearningEntityBase {
|
|
1747
|
+
isCheckable() {
|
|
1748
|
+
return true;
|
|
1749
|
+
}
|
|
1750
|
+
get progress() {
|
|
1751
|
+
return this._progress;
|
|
1752
|
+
}
|
|
1753
|
+
set progress(progress) {
|
|
1754
|
+
this._progress = progress;
|
|
1755
|
+
}
|
|
1756
|
+
get content() {
|
|
1757
|
+
return this._content;
|
|
1758
|
+
}
|
|
1759
|
+
_init(entity) {
|
|
1760
|
+
this._content = LearningEntityConvertorFactory.getContentConvertor(this.type).toInternal(entity, this.getCentralService());
|
|
1761
|
+
this._progress = entity.progress;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
class LearningEntityFactory {
|
|
1766
|
+
static create(entity, centralService, learningEntityService) {
|
|
1767
|
+
switch (entity.type.key) {
|
|
1768
|
+
case 'vocabulary':
|
|
1769
|
+
return new VocabularyLearningEntity(entity, centralService, learningEntityService);
|
|
1770
|
+
case 'grammar':
|
|
1771
|
+
return new GrammarLearningEntity(entity, centralService, learningEntityService);
|
|
1772
|
+
case 'form':
|
|
1773
|
+
return new FormLearningEntity(entity, centralService, learningEntityService);
|
|
1774
|
+
case 'puzzle':
|
|
1775
|
+
return new PuzzleLearningEntity(entity, centralService, learningEntityService);
|
|
1776
|
+
case 'riddle':
|
|
1777
|
+
return new RiddleLearningEntity(entity, centralService, learningEntityService);
|
|
1778
|
+
case 'yesno':
|
|
1779
|
+
return new YesNoLearningEntity(entity, centralService, learningEntityService);
|
|
1780
|
+
default:
|
|
1781
|
+
throw new Error(`Learning Entity class for type ${entity.type.key} not implemented!`);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/*
|
|
1787
|
+
* Public API Surface of ngx-edyta-entity
|
|
1788
|
+
*/
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Generated bundle index. Do not edit.
|
|
1792
|
+
*/
|
|
1793
|
+
|
|
1794
|
+
export { CanvasComponent, CanvasModule, EntityBottomPaneComponent, FormComponent, FormLearningEntity, GrammarComponent, GrammarLearningEntity, InteractiveLearningEntityBase, LearningEntityBase, LearningEntityFactory, PuzzleComponent, PuzzleLearningEntity, RiddleComponent, RiddleLearningEntity, VocabularyComponent, VocabularyLearningEntity, YesNoLearningEntity, YesnoComponent };
|
|
1795
|
+
//# sourceMappingURL=ngx-edyta-entity.mjs.map
|