@dataclouder/ngx-lessons 0.0.26
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 +28 -0
- package/fesm2022/dataclouder-ngx-lessons.mjs +1194 -0
- package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.d.ts +26 -0
- package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +59 -0
- package/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.d.ts +42 -0
- package/lib/components/dc-lessons/lesson-form/lesson-form.component.d.ts +5 -0
- package/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.d.ts +45 -0
- package/lib/components/lesson-mini-components/components/ComponentBuilder.d.ts +26 -0
- package/lib/components/lesson-mini-components/components/ComponentWithForm.d.ts +12 -0
- package/lib/components/lesson-mini-components/components/lesson-dynamic.component.d.ts +7 -0
- package/lib/components/lesson-mini-components/components/lessons.clases.d.ts +166 -0
- package/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.d.ts +19 -0
- package/lib/components/lesson-mini-components/components/selector/selector.component.d.ts +12 -0
- package/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.d.ts +14 -0
- package/lib/components/lesson-mini-components/components/text-writer/text-writer.component.d.ts +16 -0
- package/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.d.ts +11 -0
- package/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.d.ts +13 -0
- package/lib/models/lessons.pipes.d.ts +12 -0
- package/lib/models/notion.models.d.ts +41 -0
- package/package.json +37 -0
- package/public-api.d.ts +17 -0
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +44 -0
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +235 -0
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +83 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.css +90 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +105 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.scss +0 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.ts +318 -0
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +27 -0
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.scss +3 -0
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +271 -0
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.html +5 -0
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.scss +3 -0
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +14 -0
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +26 -0
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.scss +17 -0
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +159 -0
- package/src/lib/components/dc-lessons/lessons.component.ts +10 -0
- package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +74 -0
- package/src/lib/components/lesson-mini-components/components/ComponentWithForm.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/lesson-dynamic.component.ts +13 -0
- package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +254 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +58 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.scss +15 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +70 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +2 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.scss +12 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +47 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +35 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.scss +0 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +27 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +7 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.scss +3 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +29 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.html +24 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.scss +15 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.ts +29 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.html +4 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.scss +8 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.ts +61 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.css +3 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.html +9 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +32 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.css +3 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.html +28 -0
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +30 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.html +18 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.scss +3 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.html +15 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.scss +27 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.spec.ts +25 -0
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.ts +46 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.html +19 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.scss +0 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.ts +27 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.html +14 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.scss +22 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.ts +51 -0
- package/src/lib/models/lessons.pipes.ts +38 -0
- package/src/lib/models/models.ts +92 -0
- package/src/lib/models/notion.models.ts +43 -0
- package/src/public-api.ts +25 -0
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input, ChangeDetectionStrategy, InjectionToken, Pipe, EventEmitter, Output, Inject, ViewChildren, ViewChild, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormControl, UntypedFormControl, FormsModule, ReactiveFormsModule, Validators, UntypedFormGroup } from '@angular/forms';
|
|
5
|
+
import * as i2$3 from '@angular/common';
|
|
6
|
+
import { NgFor, NgIf, CommonModule, DatePipe, NgComponentOutlet, KeyValuePipe } from '@angular/common';
|
|
7
|
+
import * as i4 from 'primeng/inputtext';
|
|
8
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
9
|
+
import * as i3 from 'primeng/button';
|
|
10
|
+
import { ButtonModule } from 'primeng/button';
|
|
11
|
+
import * as i5 from 'primeng/message';
|
|
12
|
+
import { MessageModule } from 'primeng/message';
|
|
13
|
+
import * as i2 from 'primeng/dynamicdialog';
|
|
14
|
+
import * as i2$1 from 'primeng/dropdown';
|
|
15
|
+
import { DropdownModule } from 'primeng/dropdown';
|
|
16
|
+
import * as i3$1 from 'primeng/paginator';
|
|
17
|
+
import { PaginatorModule } from 'primeng/paginator';
|
|
18
|
+
import * as i1$1 from '@angular/router';
|
|
19
|
+
import { RouterModule } from '@angular/router';
|
|
20
|
+
import * as i5$1 from '@dataclouder/ngx-core';
|
|
21
|
+
import { PaginationBase, TOAST_ALERTS_TOKEN, DCFilterBarComponent } from '@dataclouder/ngx-core';
|
|
22
|
+
import { PopoverModule } from 'primeng/popover';
|
|
23
|
+
import * as i2$2 from 'primeng/speeddial';
|
|
24
|
+
import { SpeedDialModule } from 'primeng/speeddial';
|
|
25
|
+
import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block';
|
|
26
|
+
import * as i4$2 from '@ckeditor/ckeditor5-angular';
|
|
27
|
+
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
|
|
28
|
+
import * as i8 from 'primeng/splitter';
|
|
29
|
+
import { SplitterModule } from 'primeng/splitter';
|
|
30
|
+
import * as i9 from 'primeng/tooltip';
|
|
31
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
32
|
+
import { AspectType, ResolutionType, CropperComponentModal } from '@dataclouder/ngx-cloud-storage';
|
|
33
|
+
import * as i2$4 from '@dataclouder/ngx-agent-cards';
|
|
34
|
+
import { ConversationType, TextEngines, CONVERSATION_AI_TOKEN, DCChatComponent } from '@dataclouder/ngx-agent-cards';
|
|
35
|
+
import * as i4$1 from 'primeng/drawer';
|
|
36
|
+
import { DrawerModule } from 'primeng/drawer';
|
|
37
|
+
import * as i6 from 'primeng/api';
|
|
38
|
+
|
|
39
|
+
class ComponentBuilder {
|
|
40
|
+
constructor(formBuilder,
|
|
41
|
+
// protected toastrService: ToastService, // protected ref: NbDialogRef<ComponentBuilder>,
|
|
42
|
+
ref) {
|
|
43
|
+
this.formBuilder = formBuilder;
|
|
44
|
+
this.ref = ref;
|
|
45
|
+
// Sobreescribir si es necesario
|
|
46
|
+
// public formGroup = this.formBuilder.group<LessonCompSettings>({});
|
|
47
|
+
this.formGroup = this.formBuilder.group({
|
|
48
|
+
response: new FormControl(null),
|
|
49
|
+
responses: new FormControl(null),
|
|
50
|
+
options: this.formBuilder.array([]),
|
|
51
|
+
text: new FormControl(null),
|
|
52
|
+
hint: new FormControl(null),
|
|
53
|
+
explanation: new FormControl(null),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Every component knows its type by comparing agains LessonComponentBuilders
|
|
57
|
+
get questionType() {
|
|
58
|
+
const self = this;
|
|
59
|
+
const name = Object.keys(LessonComponentBuilders).find((componentName) => {
|
|
60
|
+
const componentClass = LessonComponentBuilders[componentName];
|
|
61
|
+
if (self instanceof componentClass) {
|
|
62
|
+
return componentName;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return name;
|
|
66
|
+
}
|
|
67
|
+
getCode() {
|
|
68
|
+
const data = this.formGroup.value;
|
|
69
|
+
// Deleting null values
|
|
70
|
+
Object.keys(data).forEach((key) => {
|
|
71
|
+
if (data[key] === null) {
|
|
72
|
+
delete data[key];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const id = Math.random().toString(36).substring(7);
|
|
76
|
+
const code = { id: id, component: this.questionType, settings: { ...data } };
|
|
77
|
+
return `~${JSON.stringify(code)}~`;
|
|
78
|
+
}
|
|
79
|
+
showCode() {
|
|
80
|
+
const code = this.getCode();
|
|
81
|
+
alert(code);
|
|
82
|
+
}
|
|
83
|
+
async copyToClipboard() {
|
|
84
|
+
const code = this.getCode();
|
|
85
|
+
await navigator.clipboard.writeText(code);
|
|
86
|
+
// this.toastrService.info('Control + V para pegar', 'Se copió al portapapeles');
|
|
87
|
+
// this.ref.close();
|
|
88
|
+
this.ref.close(code);
|
|
89
|
+
}
|
|
90
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ComponentBuilder, deps: [{ token: i1.FormBuilder }, { token: i2.DynamicDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
91
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: ComponentBuilder, isStandalone: true, selector: "app-component-builder", ngImport: i0, template: '<div>no template</div>', isInline: true }); }
|
|
92
|
+
}
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ComponentBuilder, decorators: [{
|
|
94
|
+
type: Component,
|
|
95
|
+
args: [{
|
|
96
|
+
selector: 'app-component-builder',
|
|
97
|
+
template: '<div>no template</div>',
|
|
98
|
+
}]
|
|
99
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.DynamicDialogRef }] });
|
|
100
|
+
|
|
101
|
+
class ComponentWithForm {
|
|
102
|
+
constructor() {
|
|
103
|
+
// @Input() settings: LessonCompSettings;
|
|
104
|
+
this.control = new UntypedFormControl();
|
|
105
|
+
}
|
|
106
|
+
ngOnInit() {
|
|
107
|
+
this.control.valueChanges.subscribe(() => {
|
|
108
|
+
this.status = 'basic';
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
validate() {
|
|
112
|
+
// TODO: generic method to evaluate
|
|
113
|
+
}
|
|
114
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ComponentWithForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
115
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: ComponentWithForm, isStandalone: true, selector: "app-component-form", ngImport: i0, template: '<div>no template</div>', isInline: true }); }
|
|
116
|
+
}
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ComponentWithForm, decorators: [{
|
|
118
|
+
type: Component,
|
|
119
|
+
args: [{
|
|
120
|
+
selector: 'app-component-form',
|
|
121
|
+
template: '<div>no template</div>',
|
|
122
|
+
}]
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
class SelectorComponent extends ComponentWithForm {
|
|
126
|
+
constructor() {
|
|
127
|
+
super();
|
|
128
|
+
this.isFilled = false;
|
|
129
|
+
}
|
|
130
|
+
evaluate() {
|
|
131
|
+
let result;
|
|
132
|
+
if (this.control.value == null) {
|
|
133
|
+
result = null;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
result = this.control.value?.toLowerCase().trim() === this.config.settings.response.toLowerCase().trim();
|
|
137
|
+
}
|
|
138
|
+
if (result) {
|
|
139
|
+
this.status = 'success';
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.status = 'danger';
|
|
143
|
+
}
|
|
144
|
+
this.isFilled = true;
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
validate() {
|
|
148
|
+
if (this.control.invalid) {
|
|
149
|
+
this.status = 'warning';
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
154
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: SelectorComponent, isStandalone: true, selector: "app-selector", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<p-dropdown [class]=\"status\" placeholder=\"Selecciona\" [options]=\"config.settings.options\" [formControl]=\"control\"\r\n [showClear]=\"true\"></p-dropdown>", styles: ["::ng-deep .comp-selector button{min-width:80px}.warning{border-color:#f0ad4e}.danger{border-color:#e1211b}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "component", type: i2$1.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
|
155
|
+
}
|
|
156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SelectorComponent, decorators: [{
|
|
157
|
+
type: Component,
|
|
158
|
+
args: [{ selector: 'app-selector', standalone: true, imports: [FormsModule, ReactiveFormsModule, DropdownModule], template: "<p-dropdown [class]=\"status\" placeholder=\"Selecciona\" [options]=\"config.settings.options\" [formControl]=\"control\"\r\n [showClear]=\"true\"></p-dropdown>", styles: ["::ng-deep .comp-selector button{min-width:80px}.warning{border-color:#f0ad4e}.danger{border-color:#e1211b}\n"] }]
|
|
159
|
+
}], ctorParameters: () => [], propDecorators: { config: [{
|
|
160
|
+
type: Input
|
|
161
|
+
}] } });
|
|
162
|
+
|
|
163
|
+
class SelectorBuilderComponent extends ComponentBuilder {
|
|
164
|
+
constructor(formBuilder,
|
|
165
|
+
// protected override toastrService: ToastService,
|
|
166
|
+
ref) {
|
|
167
|
+
super(formBuilder, null);
|
|
168
|
+
this.formBuilder = formBuilder;
|
|
169
|
+
this.ref = ref;
|
|
170
|
+
this.sampleConfig = {
|
|
171
|
+
id: '1',
|
|
172
|
+
component: LessonComponentEnum.Selector,
|
|
173
|
+
settings: {
|
|
174
|
+
options: ['fourteen ninety-two', 'fourteen ninety-six', 'fifteen ninety-one'],
|
|
175
|
+
response: 'fourteen ninety-two',
|
|
176
|
+
hint: 'Pista para la respuesta',
|
|
177
|
+
explanation: 'Explicación de la respuesta',
|
|
178
|
+
responses: 'Opción 1, Opción 2, Opción 3',
|
|
179
|
+
text: 'Texto de la pregunta',
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
// public formGroup = this.formBuilder.group({
|
|
184
|
+
// options: this.formBuilder.array([]),
|
|
185
|
+
// response: ['', Validators.required],
|
|
186
|
+
// hint: [],
|
|
187
|
+
// explanation: [],
|
|
188
|
+
// });
|
|
189
|
+
ngOnInit() {
|
|
190
|
+
this.formGroup.get('response');
|
|
191
|
+
}
|
|
192
|
+
//TODO Probablemente estos 3 pueden irse a una clase abstracta
|
|
193
|
+
pushControlToFormArray(controlName) {
|
|
194
|
+
this.formGroup.controls.options.push(this.formBuilder.control(''));
|
|
195
|
+
// (this.formGroup.get(controlName) as UntypedFormArray).push(this.formBuilder.control(''));
|
|
196
|
+
console.log(this.formGroup.controls.options);
|
|
197
|
+
}
|
|
198
|
+
deleteFormArrayByIndex(controlName, index) {
|
|
199
|
+
this.formGroup.get(controlName).removeAt(index);
|
|
200
|
+
}
|
|
201
|
+
get optionsForm() {
|
|
202
|
+
return this.formGroup.get('options');
|
|
203
|
+
}
|
|
204
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SelectorBuilderComponent, deps: [{ token: i1.FormBuilder }, { token: i2.DynamicDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
205
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: SelectorBuilderComponent, isStandalone: true, selector: "app-selector-builder", usesInheritance: true, ngImport: i0, template: "<div>\r\n <div>\r\n <p-message>Construcci\u00F3n del componente de Selecci\u00F3n, sirve para hacer una pregunta y mostrar varias opciones, ejemplo:</p-message>\r\n </div>\r\n\r\n <div>\r\n <span>En que a\u00F1o lleg\u00F3 cristobal colon a america?</span>\r\n <app-selector [config]=\"sampleConfig\"></app-selector>\r\n </div>\r\n\r\n <hr />\r\n\r\n <div>\r\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\r\n <input class=\"form-input\" type=\"text\" pInputText fullWidth formControlName=\"response\" placeholder=\"Respuesta Correcta...\" />\r\n <br />\r\n\r\n <input class=\"form-input\" type=\"\" pInputText fullWidth formControlName=\"hint\" placeholder=\"Escribe una pista para esta pregunta\" />\r\n\r\n <br />\r\n <input\r\n class=\"form-input\"\r\n type=\"text\"\r\n pInputText\r\n fullWidth\r\n formControlName=\"explanation\"\r\n placeholder=\"Excribe una explicaci\u00F3n para la respuesta\" />\r\n\r\n <hr />\r\n <h6>Opciones</h6>\r\n\r\n <div class=\"form-group\" formArrayName=\"options\">\r\n <div\r\n style=\"display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-direction: column\"\r\n *ngFor=\"let item of optionsForm.controls; let i = index\">\r\n <div>\r\n <input type=\"text\" pInputText fullWidth [formControlName]=\"i\" />\r\n <p-button (click)=\"deleteFormArrayByIndex('options', i)\" icon=\"pi pi-times\" severity=\"danger\"></p-button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <p-button (click)=\"pushControlToFormArray('options')\" label=\"Agregar Opci\u00F3n\" [text]=\"true\" severity=\"help\"></p-button>\r\n </form>\r\n\r\n <!-- <button nbButton (click)=\"isRendered = !isRendered\"> Renderizar </button> -->\r\n\r\n <div *ngIf=\"isRendered\">\r\n <!-- TODO: probably i need to pass some params -->\r\n <app-selector></app-selector>\r\n </div>\r\n </div>\r\n\r\n <div>\r\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\" [rounded]=\"true\"></p-button>\r\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\" severity=\"secondary\"></p-button>\r\n </div>\r\n</div>\r\n", styles: ["nb-card{width:60vw}.builder-form{padding:5px}.form-input{margin-top:10px}.mar-top{margin:5px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SelectorComponent, selector: "app-selector", inputs: ["config"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i5.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }] }); }
|
|
206
|
+
}
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SelectorBuilderComponent, decorators: [{
|
|
208
|
+
type: Component,
|
|
209
|
+
args: [{ selector: 'app-selector-builder', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgFor, NgIf, SelectorComponent, InputTextModule, ButtonModule, MessageModule], template: "<div>\r\n <div>\r\n <p-message>Construcci\u00F3n del componente de Selecci\u00F3n, sirve para hacer una pregunta y mostrar varias opciones, ejemplo:</p-message>\r\n </div>\r\n\r\n <div>\r\n <span>En que a\u00F1o lleg\u00F3 cristobal colon a america?</span>\r\n <app-selector [config]=\"sampleConfig\"></app-selector>\r\n </div>\r\n\r\n <hr />\r\n\r\n <div>\r\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\r\n <input class=\"form-input\" type=\"text\" pInputText fullWidth formControlName=\"response\" placeholder=\"Respuesta Correcta...\" />\r\n <br />\r\n\r\n <input class=\"form-input\" type=\"\" pInputText fullWidth formControlName=\"hint\" placeholder=\"Escribe una pista para esta pregunta\" />\r\n\r\n <br />\r\n <input\r\n class=\"form-input\"\r\n type=\"text\"\r\n pInputText\r\n fullWidth\r\n formControlName=\"explanation\"\r\n placeholder=\"Excribe una explicaci\u00F3n para la respuesta\" />\r\n\r\n <hr />\r\n <h6>Opciones</h6>\r\n\r\n <div class=\"form-group\" formArrayName=\"options\">\r\n <div\r\n style=\"display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-direction: column\"\r\n *ngFor=\"let item of optionsForm.controls; let i = index\">\r\n <div>\r\n <input type=\"text\" pInputText fullWidth [formControlName]=\"i\" />\r\n <p-button (click)=\"deleteFormArrayByIndex('options', i)\" icon=\"pi pi-times\" severity=\"danger\"></p-button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <p-button (click)=\"pushControlToFormArray('options')\" label=\"Agregar Opci\u00F3n\" [text]=\"true\" severity=\"help\"></p-button>\r\n </form>\r\n\r\n <!-- <button nbButton (click)=\"isRendered = !isRendered\"> Renderizar </button> -->\r\n\r\n <div *ngIf=\"isRendered\">\r\n <!-- TODO: probably i need to pass some params -->\r\n <app-selector></app-selector>\r\n </div>\r\n </div>\r\n\r\n <div>\r\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\" [rounded]=\"true\"></p-button>\r\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\" severity=\"secondary\"></p-button>\r\n </div>\r\n</div>\r\n", styles: ["nb-card{width:60vw}.builder-form{padding:5px}.form-input{margin-top:10px}.mar-top{margin:5px}\n"] }]
|
|
210
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.DynamicDialogRef }] });
|
|
211
|
+
|
|
212
|
+
class TextWriterBuiderComponent extends ComponentBuilder {
|
|
213
|
+
constructor(formBuilder,
|
|
214
|
+
// protected override toastrService: ToastService,
|
|
215
|
+
ref) {
|
|
216
|
+
super(formBuilder, null);
|
|
217
|
+
this.formBuilder = formBuilder;
|
|
218
|
+
this.ref = ref;
|
|
219
|
+
this.formGroup = this.formBuilder.group({ response: ['', Validators.required], hint: [], explanation: [] });
|
|
220
|
+
}
|
|
221
|
+
ngOnInit() { }
|
|
222
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextWriterBuiderComponent, deps: [{ token: i1.UntypedFormBuilder }, { token: i2.DynamicDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
223
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TextWriterBuiderComponent, isStandalone: true, selector: "app-text-writer-buider", usesInheritance: true, ngImport: i0, template: "<div>\r\n <div>\r\n <h5>Constructor de formulario con texto</h5>\r\n </div>\r\n\r\n <div>\r\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\r\n <input pInputText type=\"text\" nbInput fullWidth formControlName=\"response\" placeholder=\"Respuesta\" />\r\n\r\n <input pInputText class=\"form-input\" type=\"\" nbInput fullWidth formControlName=\"hint\"\r\n placeholder=\"Escribe una pista para esta pregunta\" />\r\n\r\n <input pInputText class=\"form-input\" type=\"text\" nbInput fullWidth formControlName=\"explanation\"\r\n placeholder=\"Excribe una explicaci\u00F3n para la respuesta\" />\r\n </form>\r\n </div>\r\n\r\n <div>\r\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\"\r\n [rounded]=\"true\"></p-button>\r\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\"\r\n severity=\"secondary\"></p-button>\r\n </div>\r\n</div>", styles: ["nb-card{width:60vw}.builder-form{padding:5px}.form-input{margin-top:10px}.mar-top{margin:5px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }] }); }
|
|
224
|
+
}
|
|
225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextWriterBuiderComponent, decorators: [{
|
|
226
|
+
type: Component,
|
|
227
|
+
args: [{ selector: 'app-text-writer-buider', standalone: true, imports: [FormsModule, ReactiveFormsModule, ButtonModule, InputTextModule], template: "<div>\r\n <div>\r\n <h5>Constructor de formulario con texto</h5>\r\n </div>\r\n\r\n <div>\r\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\r\n <input pInputText type=\"text\" nbInput fullWidth formControlName=\"response\" placeholder=\"Respuesta\" />\r\n\r\n <input pInputText class=\"form-input\" type=\"\" nbInput fullWidth formControlName=\"hint\"\r\n placeholder=\"Escribe una pista para esta pregunta\" />\r\n\r\n <input pInputText class=\"form-input\" type=\"text\" nbInput fullWidth formControlName=\"explanation\"\r\n placeholder=\"Excribe una explicaci\u00F3n para la respuesta\" />\r\n </form>\r\n </div>\r\n\r\n <div>\r\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\"\r\n [rounded]=\"true\"></p-button>\r\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\"\r\n severity=\"secondary\"></p-button>\r\n </div>\r\n</div>", styles: ["nb-card{width:60vw}.builder-form{padding:5px}.form-input{margin-top:10px}.mar-top{margin:5px}\n"] }]
|
|
228
|
+
}], ctorParameters: () => [{ type: i1.UntypedFormBuilder }, { type: i2.DynamicDialogRef }] });
|
|
229
|
+
|
|
230
|
+
class TextWriterComponent extends ComponentWithForm {
|
|
231
|
+
constructor() {
|
|
232
|
+
super();
|
|
233
|
+
}
|
|
234
|
+
ngOnInit() {
|
|
235
|
+
super.ngOnInit();
|
|
236
|
+
this.size = this.getSize();
|
|
237
|
+
}
|
|
238
|
+
getSize() {
|
|
239
|
+
return this.config.settings.response.length < 20 ? this.config.settings.response.length : 20;
|
|
240
|
+
}
|
|
241
|
+
evaluate() {
|
|
242
|
+
let result;
|
|
243
|
+
if (this.control.value == null) {
|
|
244
|
+
result = null;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
result = this.control.value.toLowerCase().trim() == this.config.settings.response.toLowerCase().trim();
|
|
248
|
+
}
|
|
249
|
+
if (result) {
|
|
250
|
+
this.status = 'success';
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
this.status = 'danger';
|
|
254
|
+
this.hint = this.config.settings.explanation;
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
validate() {
|
|
259
|
+
if (this.control.invalid) {
|
|
260
|
+
this.status = 'warning';
|
|
261
|
+
this.hint = this.config.settings.hint;
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextWriterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
266
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TextWriterComponent, isStandalone: true, selector: "app-text-writer", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<input [class]=\"this.status\" pInputText [formControl]=\"control\" fieldSize=\"small\" type=\"text\" placeholder=\"Respuesta\"\n [size]=\"size\" />\n\n<!-- [ngClass]=\"{ 'selected-radio': 'true']}\" -->", styles: [".warning{border-color:#f0ad4e}.danger{border-color:#e1211b}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }] }); }
|
|
267
|
+
}
|
|
268
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TextWriterComponent, decorators: [{
|
|
269
|
+
type: Component,
|
|
270
|
+
args: [{ selector: 'app-text-writer', standalone: true, imports: [FormsModule, ReactiveFormsModule, InputTextModule], template: "<input [class]=\"this.status\" pInputText [formControl]=\"control\" fieldSize=\"small\" type=\"text\" placeholder=\"Respuesta\"\n [size]=\"size\" />\n\n<!-- [ngClass]=\"{ 'selected-radio': 'true']}\" -->", styles: [".warning{border-color:#f0ad4e}.danger{border-color:#e1211b}\n"] }]
|
|
271
|
+
}], ctorParameters: () => [], propDecorators: { config: [{
|
|
272
|
+
type: Input
|
|
273
|
+
}] } });
|
|
274
|
+
|
|
275
|
+
class TranslationSwitcherBuilderComponent extends ComponentBuilder {
|
|
276
|
+
constructor(formBuilder,
|
|
277
|
+
// protected override toastrService: ToastService,
|
|
278
|
+
ref) {
|
|
279
|
+
super(formBuilder, null);
|
|
280
|
+
this.formBuilder = formBuilder;
|
|
281
|
+
this.ref = ref;
|
|
282
|
+
}
|
|
283
|
+
// Este componente reutiliza completamente el form del padre y todos los métodos
|
|
284
|
+
ngOnInit() { }
|
|
285
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TranslationSwitcherBuilderComponent, deps: [{ token: i1.FormBuilder }, { token: i2.DynamicDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
286
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TranslationSwitcherBuilderComponent, isStandalone: true, selector: "app-translation-switcher-builder", usesInheritance: true, ngImport: i0, template: "<div>\n <div>\n <h5>Constructor de translation switcher</h5>\n </div>\n\n <div>\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\n <input style=\"width: 100%\" pInputText type=\"text\" nbInput fullWidth formControlName=\"text\" placeholder=\"Texto para visualizar\" />\n\n <br /><br />\n\n <input\n style=\"width: 100%\"\n pInputText\n class=\"form-input\"\n type=\"\"\n nbInput\n fullWidth\n formControlName=\"response\"\n placeholder=\"Traducci\u00F3n al hacer clic\" />\n </form>\n </div>\n <br />\n <div>\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\" [rounded]=\"true\"></p-button>\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\" severity=\"secondary\"></p-button>\n </div>\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TranslationSwitcherBuilderComponent, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{ selector: 'app-translation-switcher-builder', standalone: true, imports: [CommonModule, FormsModule, ReactiveFormsModule, ButtonModule, InputTextModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <div>\n <h5>Constructor de translation switcher</h5>\n </div>\n\n <div>\n <form class=\"builder-form\" [formGroup]=\"formGroup\">\n <input style=\"width: 100%\" pInputText type=\"text\" nbInput fullWidth formControlName=\"text\" placeholder=\"Texto para visualizar\" />\n\n <br /><br />\n\n <input\n style=\"width: 100%\"\n pInputText\n class=\"form-input\"\n type=\"\"\n nbInput\n fullWidth\n formControlName=\"response\"\n placeholder=\"Traducci\u00F3n al hacer clic\" />\n </form>\n </div>\n <br />\n <div>\n <p-button (click)=\"copyToClipboard()\" [disabled]=\"formGroup.invalid\" label=\"Copia C\u00F3digo\" [rounded]=\"true\"></p-button>\n <p-button (click)=\"showCode()\" [disabled]=\"formGroup.invalid\" label=\"Mostrar\" [rounded]=\"true\" severity=\"secondary\"></p-button>\n </div>\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
291
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.DynamicDialogRef }] });
|
|
292
|
+
|
|
293
|
+
class TranslationSwitcherComponent {
|
|
294
|
+
constructor() {
|
|
295
|
+
this.visibleText = '';
|
|
296
|
+
}
|
|
297
|
+
ngOnInit() {
|
|
298
|
+
this.visibleText = this.config.settings.text;
|
|
299
|
+
console.log('config', this.config);
|
|
300
|
+
}
|
|
301
|
+
switchTranslation() {
|
|
302
|
+
if (this.visibleText === this.config.settings.text) {
|
|
303
|
+
this.visibleText = this.config.settings.response;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.visibleText = this.config.settings.text;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TranslationSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
310
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TranslationSwitcherComponent, isStandalone: true, selector: "app-translation-switcher", inputs: { config: "config" }, ngImport: i0, template: "<button\n pButton\n style=\"padding: 0px 2px\"\n severity=\"help\"\n size=\"small\"\n (click)=\"switchTranslation()\"\n [label]=\"visibleText\"\n [text]=\"true\"\n [rounded]=\"true\"></button>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
311
|
+
}
|
|
312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TranslationSwitcherComponent, decorators: [{
|
|
313
|
+
type: Component,
|
|
314
|
+
args: [{ selector: 'app-translation-switcher', standalone: true, imports: [CommonModule, ButtonModule], changeDetection: ChangeDetectionStrategy.Default, template: "<button\n pButton\n style=\"padding: 0px 2px\"\n severity=\"help\"\n size=\"small\"\n (click)=\"switchTranslation()\"\n [label]=\"visibleText\"\n [text]=\"true\"\n [rounded]=\"true\"></button>\n", styles: [":host{display:block}\n"] }]
|
|
315
|
+
}], propDecorators: { config: [{
|
|
316
|
+
type: Input
|
|
317
|
+
}] } });
|
|
318
|
+
|
|
319
|
+
var LessonComponentEnum;
|
|
320
|
+
(function (LessonComponentEnum) {
|
|
321
|
+
LessonComponentEnum["Selector"] = "selector";
|
|
322
|
+
LessonComponentEnum["Speaker"] = "speaker";
|
|
323
|
+
LessonComponentEnum["TextWriter"] = "textWriter";
|
|
324
|
+
LessonComponentEnum["VerbSummary"] = "verbSummary";
|
|
325
|
+
LessonComponentEnum["WordSummary"] = "wordSummary";
|
|
326
|
+
LessonComponentEnum["TranslationSwitcher"] = "translationSwitcher";
|
|
327
|
+
})(LessonComponentEnum || (LessonComponentEnum = {}));
|
|
328
|
+
const LessonComponentBuilders = {
|
|
329
|
+
[LessonComponentEnum.Selector]: SelectorBuilderComponent,
|
|
330
|
+
// [LessonComponentEnum.Speaker]: SpeakerBuilderComponent,
|
|
331
|
+
[LessonComponentEnum.TextWriter]: TextWriterBuiderComponent,
|
|
332
|
+
// [LessonComponentEnum.VerbSummary]: VerbSummaryBuilderComponent,
|
|
333
|
+
// [LessonComponentEnum.WordSummary]: WordSummaryBuilderComponent,
|
|
334
|
+
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherBuilderComponent,
|
|
335
|
+
};
|
|
336
|
+
const LessonComponents = {
|
|
337
|
+
[LessonComponentEnum.Selector]: SelectorComponent,
|
|
338
|
+
// [LessonComponentEnum.Speaker]: SpeakerComponent,
|
|
339
|
+
[LessonComponentEnum.TextWriter]: TextWriterComponent,
|
|
340
|
+
// [LessonComponentEnum.VerbSummary]: VerbSummaryComponent,
|
|
341
|
+
// [LessonComponentEnum.WordSummary]: WordSummaryComponent,
|
|
342
|
+
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherComponent,
|
|
343
|
+
};
|
|
344
|
+
function getLessonComponentClass(type) {
|
|
345
|
+
return LessonComponents[type];
|
|
346
|
+
}
|
|
347
|
+
// nuevs
|
|
348
|
+
// import { UntypedFormControl } from '@angular/forms';
|
|
349
|
+
// import { LessonComponents } from '../models/lessons.class';
|
|
350
|
+
const LESSONS_TOKEN = new InjectionToken('Lessons Service');
|
|
351
|
+
// Think on someway of getting the toast alerts service
|
|
352
|
+
class LessonsAbstractService {
|
|
353
|
+
}
|
|
354
|
+
// my-service.provider.ts
|
|
355
|
+
function provideLessonsService(serviceImplementation) {
|
|
356
|
+
return [
|
|
357
|
+
{
|
|
358
|
+
provide: LESSONS_TOKEN,
|
|
359
|
+
useExisting: serviceImplementation,
|
|
360
|
+
},
|
|
361
|
+
];
|
|
362
|
+
}
|
|
363
|
+
// export const LessonComponents = {
|
|
364
|
+
// [LessonComponentEnum.Selector]: 1,
|
|
365
|
+
// [LessonComponentEnum.Speaker]: 2,
|
|
366
|
+
// [LessonComponentEnum.TextWriter]: 3,
|
|
367
|
+
// [LessonComponentEnum.VerbSummary]: 4,
|
|
368
|
+
// [LessonComponentEnum.WordSummary]: 5,
|
|
369
|
+
// [LessonComponentEnum.TranslationSwitcher]: 6,
|
|
370
|
+
// }
|
|
371
|
+
const LangCodeDescription = {
|
|
372
|
+
es: 'Spanish',
|
|
373
|
+
en: 'English',
|
|
374
|
+
it: 'Italian',
|
|
375
|
+
pt: 'Portuguese',
|
|
376
|
+
fr: 'French',
|
|
377
|
+
};
|
|
378
|
+
const LangCodeDescriptionEs = {
|
|
379
|
+
es: 'Español',
|
|
380
|
+
en: 'Inglés',
|
|
381
|
+
it: 'Italiano',
|
|
382
|
+
pt: 'Portugués',
|
|
383
|
+
fr: 'Frances',
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
class LangDescTranslationPipe {
|
|
387
|
+
transform(value, lang) {
|
|
388
|
+
if (lang === 'es') {
|
|
389
|
+
return LangCodeDescriptionEs[value];
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
return LangCodeDescription[value];
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: LangDescTranslationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
396
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.1.1", ngImport: i0, type: LangDescTranslationPipe, isStandalone: true, name: "langDesc" }); }
|
|
397
|
+
}
|
|
398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: LangDescTranslationPipe, decorators: [{
|
|
399
|
+
type: Pipe,
|
|
400
|
+
args: [{
|
|
401
|
+
name: 'langDesc',
|
|
402
|
+
standalone: true,
|
|
403
|
+
}]
|
|
404
|
+
}] });
|
|
405
|
+
class FlagLanguagePipe {
|
|
406
|
+
transform(lang) {
|
|
407
|
+
if (lang === 'en') {
|
|
408
|
+
return '🇺🇸';
|
|
409
|
+
}
|
|
410
|
+
else if (lang === 'es') {
|
|
411
|
+
return '🇲🇽';
|
|
412
|
+
}
|
|
413
|
+
else if (lang === 'fr') {
|
|
414
|
+
return '🇫🇷';
|
|
415
|
+
}
|
|
416
|
+
else if (lang === 'it') {
|
|
417
|
+
return '🇮🇹';
|
|
418
|
+
}
|
|
419
|
+
else if (lang === 'pt') {
|
|
420
|
+
return '🇧🇷';
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
return '';
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: FlagLanguagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
427
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.1.1", ngImport: i0, type: FlagLanguagePipe, isStandalone: true, name: "flagEmoji" }); }
|
|
428
|
+
}
|
|
429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: FlagLanguagePipe, decorators: [{
|
|
430
|
+
type: Pipe,
|
|
431
|
+
args: [{
|
|
432
|
+
name: 'flagEmoji',
|
|
433
|
+
standalone: true,
|
|
434
|
+
}]
|
|
435
|
+
}] });
|
|
436
|
+
|
|
437
|
+
// NOTE: what to do? IAgent Deponds on ngx-agent-cards but lessons don't
|
|
438
|
+
// import { IAgentCard } from '@dataclouder/ngx-agent-cards';
|
|
439
|
+
const NOTION_SERVICE_TOKEN = new InjectionToken('notion.service');
|
|
440
|
+
class NotionAbstractService {
|
|
441
|
+
}
|
|
442
|
+
function provideNotionService(serviceImplementation) {
|
|
443
|
+
return [
|
|
444
|
+
{
|
|
445
|
+
provide: NOTION_SERVICE_TOKEN,
|
|
446
|
+
useExisting: serviceImplementation,
|
|
447
|
+
},
|
|
448
|
+
];
|
|
449
|
+
}
|
|
450
|
+
var NotionExportType;
|
|
451
|
+
(function (NotionExportType) {
|
|
452
|
+
NotionExportType["HTML"] = "html";
|
|
453
|
+
NotionExportType["MARKDOWN"] = "markdown";
|
|
454
|
+
NotionExportType["PLAIN_TEXT"] = "plain_text";
|
|
455
|
+
NotionExportType["SIMPLE_BLOCKS"] = "simple_blocks";
|
|
456
|
+
})(NotionExportType || (NotionExportType = {}));
|
|
457
|
+
|
|
458
|
+
var EventCard;
|
|
459
|
+
(function (EventCard) {
|
|
460
|
+
EventCard["Edit"] = "edit";
|
|
461
|
+
EventCard["Remove"] = "remove";
|
|
462
|
+
EventCard["Take"] = "take";
|
|
463
|
+
EventCard["Qr"] = "qr";
|
|
464
|
+
})(EventCard || (EventCard = {}));
|
|
465
|
+
class DcLessonCardComponent {
|
|
466
|
+
constructor() {
|
|
467
|
+
this.isAdmin = true;
|
|
468
|
+
// TODO: i think i can refactor this to create actions, so only one event emitting actions.
|
|
469
|
+
this.take = new EventEmitter();
|
|
470
|
+
this.edit = new EventEmitter();
|
|
471
|
+
this.remove = new EventEmitter();
|
|
472
|
+
this.qr = new EventEmitter();
|
|
473
|
+
this.coverUrl = 'assets/background/default-background.webp';
|
|
474
|
+
this.eventType = EventCard;
|
|
475
|
+
this.items = [
|
|
476
|
+
{
|
|
477
|
+
label: 'Editar',
|
|
478
|
+
icon: 'pi pi-pencil',
|
|
479
|
+
command: () => {
|
|
480
|
+
this.eventCard(EventCard.Edit);
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
label: 'Eliminar',
|
|
485
|
+
icon: 'pi pi-trash',
|
|
486
|
+
command: () => {
|
|
487
|
+
this.eventCard(EventCard.Remove);
|
|
488
|
+
},
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
label: 'Tomar lección',
|
|
492
|
+
icon: 'pi pi-play',
|
|
493
|
+
command: () => {
|
|
494
|
+
this.eventCard(EventCard.Take);
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
];
|
|
498
|
+
}
|
|
499
|
+
ngOnInit() {
|
|
500
|
+
if (this.lesson?.media?.images[0]?.url) {
|
|
501
|
+
this.coverUrl = this.lesson.media.images[0].url;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
eventCard(eventType) {
|
|
505
|
+
switch (eventType) {
|
|
506
|
+
case EventCard.Edit:
|
|
507
|
+
this.edit.emit(this.lesson);
|
|
508
|
+
break;
|
|
509
|
+
case EventCard.Remove:
|
|
510
|
+
this.remove.emit(this.lesson);
|
|
511
|
+
break;
|
|
512
|
+
case EventCard.Take:
|
|
513
|
+
this.take.emit(this.lesson);
|
|
514
|
+
break;
|
|
515
|
+
case EventCard.Qr:
|
|
516
|
+
this.qr.emit(this.lesson);
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DcLessonCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
521
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: DcLessonCardComponent, isStandalone: true, selector: "dc-lesson-card", inputs: { lesson: "lesson", isAdmin: "isAdmin" }, outputs: { take: "take", edit: "edit", remove: "remove", qr: "qr" }, ngImport: i0, template: "<div class=\"card-container\">\r\n <p-speeddial\r\n class=\"dial-button\"\r\n [model]=\"items\"\r\n [radius]=\"70\"\r\n type=\"quarter-circle\"\r\n direction=\"down-left\"\r\n [buttonProps]=\"{ severity: 'primary', rounded: true, outlined: true, raised: true }\" />\r\n\r\n <div class=\"blog-card\">\r\n <div class=\"meta\">\r\n <div class=\"photo\" [style.backgroundImage]=\"'url(' + coverUrl + ')'\"></div>\r\n <ul class=\"details\">\r\n <li class=\"author\">\r\n <a>{{ lesson.authorEmail }}</a>\r\n </li>\r\n <li class=\"date\">{{ lesson.createdDate | date : 'dd/MM/yyyy' }}</li>\r\n <li class=\"tags\">\r\n <ul>\r\n <li *ngFor=\"let tag of lesson.tags\">\r\n <a>{{ tag }}</a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <div class=\"description\">\r\n <h1>{{ lesson.title }}</h1>\r\n <p>{{ lesson.description }}</p>\r\n <div class=\"card-footer\">\r\n <div class=\"status-tags\">\r\n <span class=\"level-tag\">Nivel {{ lesson.level }}</span>\r\n <span *ngIf=\"lesson.taken?.status == 'passed'\" class=\"status-tag success\">Tomada</span>\r\n <span *ngIf=\"lesson.taken?.status == 'failed'\" class=\"status-tag danger\">Fallida</span>\r\n </div>\r\n\r\n <div class=\"actions\">\r\n <p-button label=\"Tomar lecci\u00F3n\" (onClick)=\"eventCard(eventType.Take)\" severity=\"primary\"> </p-button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".card-container{position:relative}.dial-button{position:absolute;top:10px;right:20px;z-index:10}.blog-card{position:relative;display:flex;flex-direction:row;background:#fff;background:#ffffff1a;border-radius:12px;box-shadow:0 0 20px var(--primary-color);margin:1rem;overflow:hidden;transition:all .3s ease}.blog-card:hover{box-shadow:0 5px 15px #00000080;transform:translateY(-2px)}.blog-card:hover:before{opacity:1;box-shadow:0 0 15px var(--blue-color)}.blog-card .meta{position:relative;flex:1;max-width:300px}.blog-card .meta .photo{position:absolute;inset:0;background-size:cover;background-position:center}.blog-card .meta .photo:before{content:\"\";position:absolute;inset:0;background:#0000004d}.blog-card .meta .details{position:relative;z-index:1;list-style:none;padding:1rem;color:#fff}.blog-card .meta .details li{margin-bottom:.5rem}.blog-card .meta .details li.author a{color:#fff;font-weight:700}.blog-card .meta .details li.date{font-size:.9rem;opacity:.8}.blog-card .meta .details li.tags ul{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:.5rem}.blog-card .meta .details li.tags ul li a{color:#fff;font-size:.8rem;opacity:.8}.blog-card .description{flex:2;padding:1.5rem;background:#fff}.blog-card .description h1{margin:0 0 1rem;font-size:1.5rem;color:#333}.blog-card .description p{color:#666;line-height:1.5;margin-bottom:1rem}.blog-card .description .card-footer{display:flex;justify-content:space-between;align-items:center;margin-top:1rem}.blog-card .description .card-footer .status-tags{display:flex;gap:.5rem}.blog-card .description .card-footer .status-tags .level-tag{background:#e0e7ff;color:#4338ca;padding:.3rem .8rem;border-radius:4px;font-size:.9rem}.blog-card .description .card-footer .status-tags .status-tag{padding:.3rem .8rem;border-radius:4px;font-size:.9rem}.blog-card .description .card-footer .status-tags .status-tag.success{background:#dcfce7;color:#166534}.blog-card .description .card-footer .status-tags .status-tag.danger{background:#fee2e2;color:#991b1b}.blog-card .description .card-footer .actions{display:flex;align-items:center;gap:1rem}.blog-card .description .card-footer .actions .admin-actions{display:flex;gap:.5rem}.blog-card .description .card-footer .actions .admin-actions .icon-button{background:none;border:none;padding:.5rem;cursor:pointer;border-radius:4px;transition:background .2s}.blog-card .description .card-footer .actions .admin-actions .icon-button.edit{color:#4338ca}.blog-card .description .card-footer .actions .admin-actions .icon-button.edit:hover{background:#e0e7ff}.blog-card .description .card-footer .actions .admin-actions .icon-button.delete{color:#dc2626}.blog-card .description .card-footer .actions .admin-actions .icon-button.delete:hover{background:#fee2e2}.blog-card .description .card-footer .actions .take-lesson{background:#4338ca;color:#fff;border:none;padding:.5rem 1rem;border-radius:4px;cursor:pointer;transition:background .2s}.blog-card .description .card-footer .actions .take-lesson:hover{background:#3730a3}@media (max-width: 768px){.blog-card{flex-direction:column}.blog-card .meta{max-width:100%;min-height:200px}}span[class^=p-]{position:absolute;top:10px;right:10px;cursor:pointer;z-index:30}.blog-card.glow-effect:before{content:\"\";position:absolute;inset:-5px;border-radius:12px;background:#ffffff1a;z-index:-2;transition:all .3s ease;opacity:.5;box-shadow:0 0 45px #007bffb0}.blog-card.glow-effect:hover:before{opacity:1;box-shadow:0 0 60px #007bffcc}\n"], dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "ngmodule", type: SpeedDialModule }, { kind: "component", type: i2$2.SpeedDial, selector: "p-speeddial, p-speedDial, p-speed-dial", inputs: ["id", "model", "visible", "style", "className", "direction", "transitionDelay", "type", "radius", "mask", "disabled", "hideOnClickOutside", "buttonStyle", "buttonClassName", "maskStyle", "maskClassName", "showIcon", "hideIcon", "rotateAnimation", "ariaLabel", "ariaLabelledBy", "tooltipOptions", "buttonProps"], outputs: ["onVisibleChange", "visibleChange", "onClick", "onShow", "onHide"] }] }); }
|
|
522
|
+
}
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DcLessonCardComponent, decorators: [{
|
|
524
|
+
type: Component,
|
|
525
|
+
args: [{ selector: 'dc-lesson-card', standalone: true, imports: [NgFor, NgIf, DatePipe, ButtonModule, PopoverModule, SpeedDialModule], template: "<div class=\"card-container\">\r\n <p-speeddial\r\n class=\"dial-button\"\r\n [model]=\"items\"\r\n [radius]=\"70\"\r\n type=\"quarter-circle\"\r\n direction=\"down-left\"\r\n [buttonProps]=\"{ severity: 'primary', rounded: true, outlined: true, raised: true }\" />\r\n\r\n <div class=\"blog-card\">\r\n <div class=\"meta\">\r\n <div class=\"photo\" [style.backgroundImage]=\"'url(' + coverUrl + ')'\"></div>\r\n <ul class=\"details\">\r\n <li class=\"author\">\r\n <a>{{ lesson.authorEmail }}</a>\r\n </li>\r\n <li class=\"date\">{{ lesson.createdDate | date : 'dd/MM/yyyy' }}</li>\r\n <li class=\"tags\">\r\n <ul>\r\n <li *ngFor=\"let tag of lesson.tags\">\r\n <a>{{ tag }}</a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <div class=\"description\">\r\n <h1>{{ lesson.title }}</h1>\r\n <p>{{ lesson.description }}</p>\r\n <div class=\"card-footer\">\r\n <div class=\"status-tags\">\r\n <span class=\"level-tag\">Nivel {{ lesson.level }}</span>\r\n <span *ngIf=\"lesson.taken?.status == 'passed'\" class=\"status-tag success\">Tomada</span>\r\n <span *ngIf=\"lesson.taken?.status == 'failed'\" class=\"status-tag danger\">Fallida</span>\r\n </div>\r\n\r\n <div class=\"actions\">\r\n <p-button label=\"Tomar lecci\u00F3n\" (onClick)=\"eventCard(eventType.Take)\" severity=\"primary\"> </p-button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".card-container{position:relative}.dial-button{position:absolute;top:10px;right:20px;z-index:10}.blog-card{position:relative;display:flex;flex-direction:row;background:#fff;background:#ffffff1a;border-radius:12px;box-shadow:0 0 20px var(--primary-color);margin:1rem;overflow:hidden;transition:all .3s ease}.blog-card:hover{box-shadow:0 5px 15px #00000080;transform:translateY(-2px)}.blog-card:hover:before{opacity:1;box-shadow:0 0 15px var(--blue-color)}.blog-card .meta{position:relative;flex:1;max-width:300px}.blog-card .meta .photo{position:absolute;inset:0;background-size:cover;background-position:center}.blog-card .meta .photo:before{content:\"\";position:absolute;inset:0;background:#0000004d}.blog-card .meta .details{position:relative;z-index:1;list-style:none;padding:1rem;color:#fff}.blog-card .meta .details li{margin-bottom:.5rem}.blog-card .meta .details li.author a{color:#fff;font-weight:700}.blog-card .meta .details li.date{font-size:.9rem;opacity:.8}.blog-card .meta .details li.tags ul{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:.5rem}.blog-card .meta .details li.tags ul li a{color:#fff;font-size:.8rem;opacity:.8}.blog-card .description{flex:2;padding:1.5rem;background:#fff}.blog-card .description h1{margin:0 0 1rem;font-size:1.5rem;color:#333}.blog-card .description p{color:#666;line-height:1.5;margin-bottom:1rem}.blog-card .description .card-footer{display:flex;justify-content:space-between;align-items:center;margin-top:1rem}.blog-card .description .card-footer .status-tags{display:flex;gap:.5rem}.blog-card .description .card-footer .status-tags .level-tag{background:#e0e7ff;color:#4338ca;padding:.3rem .8rem;border-radius:4px;font-size:.9rem}.blog-card .description .card-footer .status-tags .status-tag{padding:.3rem .8rem;border-radius:4px;font-size:.9rem}.blog-card .description .card-footer .status-tags .status-tag.success{background:#dcfce7;color:#166534}.blog-card .description .card-footer .status-tags .status-tag.danger{background:#fee2e2;color:#991b1b}.blog-card .description .card-footer .actions{display:flex;align-items:center;gap:1rem}.blog-card .description .card-footer .actions .admin-actions{display:flex;gap:.5rem}.blog-card .description .card-footer .actions .admin-actions .icon-button{background:none;border:none;padding:.5rem;cursor:pointer;border-radius:4px;transition:background .2s}.blog-card .description .card-footer .actions .admin-actions .icon-button.edit{color:#4338ca}.blog-card .description .card-footer .actions .admin-actions .icon-button.edit:hover{background:#e0e7ff}.blog-card .description .card-footer .actions .admin-actions .icon-button.delete{color:#dc2626}.blog-card .description .card-footer .actions .admin-actions .icon-button.delete:hover{background:#fee2e2}.blog-card .description .card-footer .actions .take-lesson{background:#4338ca;color:#fff;border:none;padding:.5rem 1rem;border-radius:4px;cursor:pointer;transition:background .2s}.blog-card .description .card-footer .actions .take-lesson:hover{background:#3730a3}@media (max-width: 768px){.blog-card{flex-direction:column}.blog-card .meta{max-width:100%;min-height:200px}}span[class^=p-]{position:absolute;top:10px;right:10px;cursor:pointer;z-index:30}.blog-card.glow-effect:before{content:\"\";position:absolute;inset:-5px;border-radius:12px;background:#ffffff1a;z-index:-2;transition:all .3s ease;opacity:.5;box-shadow:0 0 45px #007bffb0}.blog-card.glow-effect:hover:before{opacity:1;box-shadow:0 0 60px #007bffcc}\n"] }]
|
|
526
|
+
}], propDecorators: { lesson: [{
|
|
527
|
+
type: Input
|
|
528
|
+
}], isAdmin: [{
|
|
529
|
+
type: Input
|
|
530
|
+
}], take: [{
|
|
531
|
+
type: Output
|
|
532
|
+
}], edit: [{
|
|
533
|
+
type: Output
|
|
534
|
+
}], remove: [{
|
|
535
|
+
type: Output
|
|
536
|
+
}], qr: [{
|
|
537
|
+
type: Output
|
|
538
|
+
}] } });
|
|
539
|
+
|
|
540
|
+
const returnProperties = { id: 1, title: 1, assets: 1 };
|
|
541
|
+
class DCLessonListComponent extends PaginationBase {
|
|
542
|
+
constructor(cdr, router, route, lessonsService, toastrService) {
|
|
543
|
+
super(route, router);
|
|
544
|
+
this.cdr = cdr;
|
|
545
|
+
this.router = router;
|
|
546
|
+
this.route = route;
|
|
547
|
+
this.lessonsService = lessonsService;
|
|
548
|
+
this.toastrService = toastrService;
|
|
549
|
+
this.isAdmin = false;
|
|
550
|
+
this.customFilters = [];
|
|
551
|
+
this.onTakeLesson = new EventEmitter();
|
|
552
|
+
this.onEditLesson = new EventEmitter();
|
|
553
|
+
this.onRemoveLesson = new EventEmitter();
|
|
554
|
+
this.qr = new EventEmitter();
|
|
555
|
+
this.onNewLesson = new EventEmitter();
|
|
556
|
+
this.cardComponent = null;
|
|
557
|
+
this.cardEventSubs = [];
|
|
558
|
+
this.lessons = [];
|
|
559
|
+
this.isLoadingLessons = false;
|
|
560
|
+
}
|
|
561
|
+
ngOnInit() {
|
|
562
|
+
this.filterConfig.returnProps = returnProperties;
|
|
563
|
+
this.cardComponent = this.customCardComponent || DcLessonCardComponent;
|
|
564
|
+
this.getPaginatedLessons(this.filterConfig);
|
|
565
|
+
}
|
|
566
|
+
subscribeDinamicInstantToEvents() {
|
|
567
|
+
this.clearcardEventSubs();
|
|
568
|
+
this.subscribeToCardEvents();
|
|
569
|
+
}
|
|
570
|
+
subscribeToCardEvents() {
|
|
571
|
+
this.outlets.forEach((outlet) => {
|
|
572
|
+
const instance = outlet.componentInstance;
|
|
573
|
+
this.cardEventSubs.push(instance.take.subscribe((lesson) => {
|
|
574
|
+
this.takeLesson(lesson);
|
|
575
|
+
}), instance.edit.subscribe((lesson) => {
|
|
576
|
+
this.editLesson(lesson);
|
|
577
|
+
}), instance.remove.subscribe((lesson) => {
|
|
578
|
+
this.removeLesson(lesson);
|
|
579
|
+
}), instance.qr.subscribe((lesson) => {
|
|
580
|
+
this.generateQR(lesson);
|
|
581
|
+
}));
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
clearcardEventSubs() {
|
|
585
|
+
this.cardEventSubs.forEach((sub) => sub.unsubscribe());
|
|
586
|
+
this.cardEventSubs = [];
|
|
587
|
+
}
|
|
588
|
+
ngOnDestroy() {
|
|
589
|
+
this.clearcardEventSubs();
|
|
590
|
+
}
|
|
591
|
+
async getPaginatedLessons(paginator) {
|
|
592
|
+
try {
|
|
593
|
+
this.lessons = null;
|
|
594
|
+
this.isLoadingLessons = true;
|
|
595
|
+
this.cdr.detectChanges();
|
|
596
|
+
const lessons = await this.lessonsService.getLessons(paginator);
|
|
597
|
+
this.lessons = lessons['rows'] || lessons;
|
|
598
|
+
this.totalRecords = lessons['count'] || this.lessons.length;
|
|
599
|
+
console.log('lessons', lessons);
|
|
600
|
+
setTimeout(() => {
|
|
601
|
+
this.subscribeDinamicInstantToEvents();
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
finally {
|
|
605
|
+
this.isLoadingLessons = false;
|
|
606
|
+
this.cdr.detectChanges();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
goToLessonDetails(id) {
|
|
610
|
+
// this.router.navigate([`${RouteNames.App}/${RouteNames.LessonsV2}/details/${id}`]);
|
|
611
|
+
alert('TODO: goToLessonDetails');
|
|
612
|
+
}
|
|
613
|
+
search(searchText) {
|
|
614
|
+
this.filterConfig['text'] = searchText;
|
|
615
|
+
this.getPaginatedLessons(this.filterConfig);
|
|
616
|
+
}
|
|
617
|
+
generateQR(lesson) {
|
|
618
|
+
this.qr.emit(lesson);
|
|
619
|
+
}
|
|
620
|
+
takeLesson(lesson) {
|
|
621
|
+
this.onTakeLesson.emit(lesson);
|
|
622
|
+
}
|
|
623
|
+
editLesson(lesson) {
|
|
624
|
+
this.onEditLesson.emit(lesson);
|
|
625
|
+
}
|
|
626
|
+
removeLesson(lesson) {
|
|
627
|
+
const response = confirm('¿Estás seguro de querer eliminar esta lección?');
|
|
628
|
+
if (response) {
|
|
629
|
+
this.lessonsService.deleteLesson(lesson._id);
|
|
630
|
+
this.lessons = this.lessons.filter((l) => l._id !== lesson._id);
|
|
631
|
+
this.cdr.detectChanges();
|
|
632
|
+
this.toastrService.success({ title: 'Adios a la lección', subtitle: 'La lección ha sido eliminada correctamente' });
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
newLesson() {
|
|
636
|
+
this.onNewLesson.emit();
|
|
637
|
+
}
|
|
638
|
+
filterChanged(filters) {
|
|
639
|
+
console.log('filterChanged in dc-lesson-list', filters);
|
|
640
|
+
this.filterConfig = filters;
|
|
641
|
+
this.filterConfig.returnProps = returnProperties;
|
|
642
|
+
this.getPaginatedLessons(this.filterConfig);
|
|
643
|
+
}
|
|
644
|
+
loadData() {
|
|
645
|
+
return this.getPaginatedLessons(this.filterConfig);
|
|
646
|
+
}
|
|
647
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: LESSONS_TOKEN }, { token: TOAST_ALERTS_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
648
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.1", type: DCLessonListComponent, isStandalone: true, selector: "dc-lesson-list", inputs: { isAdmin: "isAdmin", customCardComponent: "customCardComponent", customFilters: "customFilters" }, outputs: { onTakeLesson: "onTakeLesson", onEditLesson: "onEditLesson", onRemoveLesson: "onRemoveLesson", qr: "qr", onNewLesson: "onNewLesson" }, viewQueries: [{ propertyName: "outlets", predicate: ["outlet"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<dc-filter-bar [customFilters]=\"customFilters\" (onSearch)=\"search($event)\" (onFilterChange)=\"filterChanged($event)\" (onNew)=\"newLesson()\"></dc-filter-bar>\n\n<div class=\"lesson-list-container\">\n @if (!isLoadingLessons && lessons?.length > 0) { @for (lesson of lessons; track lesson._id) {\n <ng-container\n #outlet=\"ngComponentOutlet\"\n [ngComponentOutlet]=\"cardComponent\"\n [ngComponentOutletInputs]=\"{\n lesson: lesson,\n isAdmin: isAdmin\n }\">\n </ng-container>\n } } @else {\n <p>No se encontraron lecciones disponibles</p>\n }\n</div>\n\n<p-paginator\n currentPageReportTemplate=\"{{ totalRecords }} lecciones\"\n [showCurrentPageReport]=\"true\"\n (onPageChange)=\"onPageChange($event)\"\n [first]=\"paginatorFirst\"\n [rows]=\"paginatorRows\"\n [totalRecords]=\"totalRecords\"\n [rowsPerPageOptions]=\"[10, 20, 30]\">\n</p-paginator>\n", styles: [":host{display:flex;flex-direction:column;height:100%}.lesson-list-container{padding:1rem;flex:1;overflow-y:auto;min-height:0}p-paginator{margin-top:auto;padding:.5rem 1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$3.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: DCFilterBarComponent, selector: "dc-filter-bar", inputs: ["isAdmin", "customFilters"], outputs: ["onChangeSort", "onNew", "onSearch", "onFilterChange"] }, { kind: "ngmodule", type: PaginatorModule }, { kind: "component", type: i3$1.Paginator, selector: "p-paginator", inputs: ["pageLinkSize", "style", "styleClass", "alwaysShow", "dropdownAppendTo", "templateLeft", "templateRight", "appendTo", "dropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showFirstLastIcon", "totalRecords", "rows", "rowsPerPageOptions", "showJumpToPageDropdown", "showJumpToPageInput", "jumpToPageItemTemplate", "showPageLinks", "locale", "dropdownItemTemplate", "first"], outputs: ["onPageChange"] }] }); }
|
|
649
|
+
}
|
|
650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonListComponent, decorators: [{
|
|
651
|
+
type: Component,
|
|
652
|
+
args: [{ selector: 'dc-lesson-list', standalone: true, imports: [CommonModule, RouterModule, DCFilterBarComponent, PaginatorModule, NgComponentOutlet], template: "<dc-filter-bar [customFilters]=\"customFilters\" (onSearch)=\"search($event)\" (onFilterChange)=\"filterChanged($event)\" (onNew)=\"newLesson()\"></dc-filter-bar>\n\n<div class=\"lesson-list-container\">\n @if (!isLoadingLessons && lessons?.length > 0) { @for (lesson of lessons; track lesson._id) {\n <ng-container\n #outlet=\"ngComponentOutlet\"\n [ngComponentOutlet]=\"cardComponent\"\n [ngComponentOutletInputs]=\"{\n lesson: lesson,\n isAdmin: isAdmin\n }\">\n </ng-container>\n } } @else {\n <p>No se encontraron lecciones disponibles</p>\n }\n</div>\n\n<p-paginator\n currentPageReportTemplate=\"{{ totalRecords }} lecciones\"\n [showCurrentPageReport]=\"true\"\n (onPageChange)=\"onPageChange($event)\"\n [first]=\"paginatorFirst\"\n [rows]=\"paginatorRows\"\n [totalRecords]=\"totalRecords\"\n [rowsPerPageOptions]=\"[10, 20, 30]\">\n</p-paginator>\n", styles: [":host{display:flex;flex-direction:column;height:100%}.lesson-list-container{padding:1rem;flex:1;overflow-y:auto;min-height:0}p-paginator{margin-top:auto;padding:.5rem 1rem}\n"] }]
|
|
653
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: LessonsAbstractService, decorators: [{
|
|
654
|
+
type: Inject,
|
|
655
|
+
args: [LESSONS_TOKEN]
|
|
656
|
+
}] }, { type: i5$1.ToastAlertsAbstractService, decorators: [{
|
|
657
|
+
type: Inject,
|
|
658
|
+
args: [TOAST_ALERTS_TOKEN]
|
|
659
|
+
}] }], propDecorators: { isAdmin: [{
|
|
660
|
+
type: Input
|
|
661
|
+
}], customCardComponent: [{
|
|
662
|
+
type: Input
|
|
663
|
+
}], customFilters: [{
|
|
664
|
+
type: Input
|
|
665
|
+
}], onTakeLesson: [{
|
|
666
|
+
type: Output
|
|
667
|
+
}], onEditLesson: [{
|
|
668
|
+
type: Output
|
|
669
|
+
}], onRemoveLesson: [{
|
|
670
|
+
type: Output
|
|
671
|
+
}], qr: [{
|
|
672
|
+
type: Output
|
|
673
|
+
}], onNewLesson: [{
|
|
674
|
+
type: Output
|
|
675
|
+
}], outlets: [{
|
|
676
|
+
type: ViewChildren,
|
|
677
|
+
args: ['outlet']
|
|
678
|
+
}] } });
|
|
679
|
+
|
|
680
|
+
class DCLessonFormComponent {
|
|
681
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
682
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: DCLessonFormComponent, isStandalone: true, selector: "dc-lesson-form", ngImport: i0, template: "<div class=\"lesson-form-container\">\n <h2>Lesson Form</h2>\n <p>Esto es dentro del componente de la leccion</p>\n <!-- Form implementation will go here -->\n</div>\n", styles: [".lesson-form-container{padding:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }] }); }
|
|
683
|
+
}
|
|
684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonFormComponent, decorators: [{
|
|
685
|
+
type: Component,
|
|
686
|
+
args: [{ selector: 'dc-lesson-form', standalone: true, imports: [CommonModule, ReactiveFormsModule], template: "<div class=\"lesson-form-container\">\n <h2>Lesson Form</h2>\n <p>Esto es dentro del componente de la leccion</p>\n <!-- Form implementation will go here -->\n</div>\n", styles: [".lesson-form-container{padding:1rem}\n"] }]
|
|
687
|
+
}] });
|
|
688
|
+
|
|
689
|
+
// TODO: i need strategy to create prompt dinamically dpending on user language and level.
|
|
690
|
+
const DefaultLessonAgentCard = {
|
|
691
|
+
conversationSettings: {
|
|
692
|
+
conversationType: ConversationType.General,
|
|
693
|
+
textEngine: TextEngines.SimpleText,
|
|
694
|
+
autoStart: true,
|
|
695
|
+
},
|
|
696
|
+
characterCard: {
|
|
697
|
+
data: {
|
|
698
|
+
name: 'Lesson Master',
|
|
699
|
+
description: 'You are an AI developed by Polilan Company, you are a lesson master, you are going to help the user to learn english',
|
|
700
|
+
tags: ['lesson', 'master', 'ai'],
|
|
701
|
+
post_history_instructions: 'Your reply should be always short, 1 or 2 paragraphs at most, and to the point, and you should ask friendly questions all the time',
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
model: { provider: 'google' },
|
|
705
|
+
};
|
|
706
|
+
class DCLessonRendererComponent {
|
|
707
|
+
constructor(renderer, viewContainerRef, activatedRoute, toastrService, lessonService, agentCardsService, conversationBuilder) {
|
|
708
|
+
this.renderer = renderer;
|
|
709
|
+
this.viewContainerRef = viewContainerRef;
|
|
710
|
+
this.activatedRoute = activatedRoute;
|
|
711
|
+
this.toastrService = toastrService;
|
|
712
|
+
this.lessonService = lessonService;
|
|
713
|
+
this.agentCardsService = agentCardsService;
|
|
714
|
+
this.conversationBuilder = conversationBuilder;
|
|
715
|
+
this.lessonId = this.activatedRoute.snapshot.paramMap.get('id');
|
|
716
|
+
this.dataText = `<h1>Nueva lección </h1> <p> Texto aquí</p>`;
|
|
717
|
+
this.components = {};
|
|
718
|
+
this.mainForm = new UntypedFormGroup({});
|
|
719
|
+
this.chatVisible = false;
|
|
720
|
+
}
|
|
721
|
+
ngOnInit() {
|
|
722
|
+
this.initLesson();
|
|
723
|
+
}
|
|
724
|
+
async initLesson() {
|
|
725
|
+
await this.getLessonIfId();
|
|
726
|
+
this.renderLesson();
|
|
727
|
+
}
|
|
728
|
+
async getLessonIfId() {
|
|
729
|
+
if (this.lesson) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
if (!this.lessonId) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
this.dataText = `<h1>Cargando </h1> <p>...</p>`;
|
|
736
|
+
this.lesson = await this.lessonService.getLesson(this.lessonId);
|
|
737
|
+
console.log('lesson', this.lesson);
|
|
738
|
+
}
|
|
739
|
+
renderLesson() {
|
|
740
|
+
this.imageCover = this.lesson.media?.images?.find((img) => img.type === 'cover')?.url;
|
|
741
|
+
console.log('imageCover', this.imageCover);
|
|
742
|
+
// Pasos para renderizar,
|
|
743
|
+
// 0) Usar la expresión regular para sustitur los componentes por un span con un id
|
|
744
|
+
// 1) En el mismo proceso de remplazar se contruyen dinamicamente los componentes
|
|
745
|
+
// 2) Agregar componentes al DOM en su respectivo spanid
|
|
746
|
+
// TODO Optimización, es posible agregar el componente al DOM en el mismo paso en que se crea el span?
|
|
747
|
+
const r1 = new RegExp('~(.+?)~', 'g');
|
|
748
|
+
let count = 0;
|
|
749
|
+
this.components = {}; //Si se destruye la lección, se destruyen todos los componentes dinamicis? tODO necesito reiniciar?
|
|
750
|
+
const lessonHtml = this.lesson.textCoded.replace(r1, (_matching, jsonCoded) => {
|
|
751
|
+
const componentName = `dynamicComp${count}`;
|
|
752
|
+
count++;
|
|
753
|
+
const componentRef = this.createComponentReferenceWithJson(jsonCoded);
|
|
754
|
+
if (!componentRef) {
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
this.components[componentName] = componentRef;
|
|
758
|
+
if (componentRef.instance.control) {
|
|
759
|
+
// Algunos componentes tienen formularios, estos se copian en mainForm como un unico control
|
|
760
|
+
this.mainForm.addControl(componentName, componentRef.instance.control);
|
|
761
|
+
this.mainForm.get(componentName).setValidators([Validators.required]);
|
|
762
|
+
}
|
|
763
|
+
return `<span id="${componentName}"></span>`;
|
|
764
|
+
});
|
|
765
|
+
this.dynamicLesson.nativeElement.innerHTML = lessonHtml;
|
|
766
|
+
for (let compName of Object.keys(this.components)) {
|
|
767
|
+
// Interpolar componentes dentro del lugar correspondiente
|
|
768
|
+
const elementRef = document.getElementById(compName);
|
|
769
|
+
this.addComponentToNode(this.components[compName], elementRef);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
addComponentToNode(componentRef, nodeDOM) {
|
|
773
|
+
this.renderer.appendChild(nodeDOM, componentRef.location.nativeElement);
|
|
774
|
+
}
|
|
775
|
+
createComponentReferenceWithJson(json) {
|
|
776
|
+
const lessonCodedConfig = JSON.parse(json);
|
|
777
|
+
let componentConfig;
|
|
778
|
+
if (this.lesson.components && lessonCodedConfig.id) {
|
|
779
|
+
// TODO: retomar, Creo que esta linea es para reutilziar los componentes por id, pero si no tiene,
|
|
780
|
+
componentConfig = this.lesson.components.find((comp) => comp.id === lessonCodedConfig.id);
|
|
781
|
+
}
|
|
782
|
+
const LessonClass = getLessonComponentClass(lessonCodedConfig.component);
|
|
783
|
+
if (!LessonClass) {
|
|
784
|
+
console.error('No existe este componente, revisa el codigo insertado' + json);
|
|
785
|
+
// throw new Error('No existe este com revisa el codigo insertado');
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
const componentRef = this.viewContainerRef.createComponent(LessonClass);
|
|
789
|
+
componentRef.instance.config = componentConfig || lessonCodedConfig;
|
|
790
|
+
return componentRef;
|
|
791
|
+
}
|
|
792
|
+
async evaluateForms() {
|
|
793
|
+
if (!this.mainForm.valid) {
|
|
794
|
+
for (let controlName of Object.keys(this.mainForm.controls)) {
|
|
795
|
+
this.components[controlName].instance.validate();
|
|
796
|
+
}
|
|
797
|
+
this.toastrService.warn({ subtitle: 'Por favor completa todos los formularios', title: 'Espera' });
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const rates = { correct: 0, incorrect: 0, score: 0 };
|
|
801
|
+
for (let controlName of Object.keys(this.mainForm.controls)) {
|
|
802
|
+
const instance = this.components[controlName].instance;
|
|
803
|
+
if (instance instanceof ComponentWithForm) {
|
|
804
|
+
// TODO: quizá no necesito validar instanceof ComponentWithForm ya que se garantiza que todo en mainform tiene un control.
|
|
805
|
+
try {
|
|
806
|
+
const result = instance.evaluate();
|
|
807
|
+
if (result) {
|
|
808
|
+
rates.correct++;
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
rates.incorrect++;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
catch (err) {
|
|
815
|
+
console.error('Validation method for instance is failing', instance);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
if (this.test) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
rates.score = rates.correct / (rates.correct + rates.incorrect);
|
|
823
|
+
const status = rates.score > 0.7 ? 'passed' : 'failed';
|
|
824
|
+
const takenLesson = { lessonId: this.lesson.id, status: status, score: rates.score };
|
|
825
|
+
// TODO: implementar el servicio para guardar la lección tomada
|
|
826
|
+
// await this.lessonService.saveTakenLesson(takenLesson);
|
|
827
|
+
if (status === 'passed') {
|
|
828
|
+
this.toastrService.success({ subtitle: 'Aprobaste, se guardó tu calificación', title: 'Muy bien' });
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
this.toastrService.warn({ subtitle: 'Revisa tus respuestas', title: 'Algunas preguntas no son correctas' });
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
async startAI() {
|
|
835
|
+
// TODO: para refactorizar y utilizar las lecciones en otro componente, voy a necesitar pasar esto al servicio abstracto asi cada aplicación lo implementa.
|
|
836
|
+
const lessonText = this.lessonService.extractTextFromHtml(this.lesson.textCoded);
|
|
837
|
+
const scenario = `The user is reading lessons through this app interface. They will now talk with you, and you need to evaluate their understanding of the lesson.
|
|
838
|
+
Ask friendly questions throughout the conversation and help them learn English. Here is the lesson text the user just read:
|
|
839
|
+
${lessonText}
|
|
840
|
+
In your next reply, start by greeting the user, asking something about the lesson, and then continue the conversation.`;
|
|
841
|
+
// const user = this.userService.getUserSnapshot();
|
|
842
|
+
alert('i need to fix this, need to find a way to pass user throug the service not the library, i think i already started something.');
|
|
843
|
+
const user = {};
|
|
844
|
+
const targetLevel = parseInt(user.languageProgress[user.settings.targetLanguage].level);
|
|
845
|
+
const langTargetDesc = LangCodeDescription[user.settings.targetLanguage];
|
|
846
|
+
const langBaseDesc = LangCodeDescription[user.settings.baseLanguage];
|
|
847
|
+
let userInformationPrompt = `
|
|
848
|
+
User information: user name is ${user.personalData.firstname} ${user.personalData.lastname}, their native language is ${langBaseDesc},
|
|
849
|
+
and right now is learning ${langTargetDesc}, their current level is ${user.languageProgress[user.settings.targetLanguage].level} out of 5.`;
|
|
850
|
+
if (targetLevel <= 2) {
|
|
851
|
+
userInformationPrompt += `\nUser is a beginner in english, always reply in ${langBaseDesc}, but during the conversation use simple words in ${langTargetDesc}`;
|
|
852
|
+
}
|
|
853
|
+
console.log('lessonText', lessonText);
|
|
854
|
+
const lessonAgentCard = DefaultLessonAgentCard;
|
|
855
|
+
lessonAgentCard.characterCard.data.scenario = scenario;
|
|
856
|
+
lessonAgentCard.characterCard.data.post_history_instructions += `\n${userInformationPrompt}`;
|
|
857
|
+
this.agentMasterLesson = lessonAgentCard;
|
|
858
|
+
this.evaluatorAgentCard = this.getDefualtLessonEvaluatorAgentCard(lessonText);
|
|
859
|
+
this.chatVisible = true;
|
|
860
|
+
}
|
|
861
|
+
getDefualtLessonEvaluatorAgentCard(lessonText) {
|
|
862
|
+
return {
|
|
863
|
+
expectedResponseType: `interface EvalResult {
|
|
864
|
+
score: number; // Score of the user's response 0 to 3
|
|
865
|
+
feedback: string; // Feedback of the user's understanding of the conversation
|
|
866
|
+
}`,
|
|
867
|
+
messages: [],
|
|
868
|
+
model: { id: 'gpt-4o-mini', provider: 'openai' },
|
|
869
|
+
sources: [lessonText],
|
|
870
|
+
task: `User is reading a taking a lesson, now their are having a conversation,
|
|
871
|
+
you have to evaluate the current conversation, and give a feedback of the user understanding of the lesson,
|
|
872
|
+
this is the lesson: ${lessonText}`,
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonRendererComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i1$1.ActivatedRoute }, { token: TOAST_ALERTS_TOKEN }, { token: LESSONS_TOKEN }, { token: CONVERSATION_AI_TOKEN }, { token: i2$4.DCConversationPromptBuilderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
876
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.1", type: DCLessonRendererComponent, isStandalone: true, selector: "dc-lesson-renderer", inputs: { lesson: "lesson", test: "test" }, viewQueries: [{ propertyName: "dynamicLesson", first: true, predicate: ["dynamicLesson"], descendants: true, static: true }], ngImport: i0, template: "<div>\r\n <!-- <div *ngIf=\"lesson\">\r\n {lesson.title }} \r\n <br>\r\n <img [src]=\"imageCover\" alt=\"\">\r\n </div> -->\r\n\r\n <div #dynamicLesson class=\"targetclass\">\r\n <ng-template #target></ng-template>\r\n </div>\r\n</div>\r\n\r\n<br />\r\n<div style=\"display: flex; gap: 10px\">\r\n <div *ngIf=\"(mainForm.controls | keyvalue)?.length\">\r\n <p-button label=\"Calificar Lecci\u00F3n\" icon=\"pi pi-check-circle\" (click)=\"evaluateForms()\" [rounded]=\"true\"></p-button>\r\n </div>\r\n\r\n <p-button icon=\"pi pi-verified\" [rounded]=\"true\" (click)=\"startAI()\" label=\"Repasar con IA\" />\r\n</div>\r\n<br /><br />\r\n\r\n@if(chatVisible) {\r\n<p-drawer header=\"Conversation\" [(visible)]=\"chatVisible\" position=\"bottom\" styleClass=\"app-bottom-overlay\">\r\n <dc-chat [agentCard]=\"agentMasterLesson\" [evaluatorAgentCard]=\"evaluatorAgentCard\"></dc-chat>\r\n</p-drawer>\r\n}\r\n", styles: [".evaluate{float:right}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: DCChatComponent, selector: "dc-chat", inputs: ["chatUserSettings", "agentCard", "evaluatorAgentCard", "parseDict"], outputs: ["sendMessage"] }, { kind: "ngmodule", type: DrawerModule }, { kind: "component", type: i4$1.Drawer, selector: "p-drawer", inputs: ["appendTo", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }] }); }
|
|
877
|
+
}
|
|
878
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonRendererComponent, decorators: [{
|
|
879
|
+
type: Component,
|
|
880
|
+
args: [{ selector: 'dc-lesson-renderer', standalone: true, imports: [NgIf, KeyValuePipe, ButtonModule, DCChatComponent, DrawerModule], template: "<div>\r\n <!-- <div *ngIf=\"lesson\">\r\n {lesson.title }} \r\n <br>\r\n <img [src]=\"imageCover\" alt=\"\">\r\n </div> -->\r\n\r\n <div #dynamicLesson class=\"targetclass\">\r\n <ng-template #target></ng-template>\r\n </div>\r\n</div>\r\n\r\n<br />\r\n<div style=\"display: flex; gap: 10px\">\r\n <div *ngIf=\"(mainForm.controls | keyvalue)?.length\">\r\n <p-button label=\"Calificar Lecci\u00F3n\" icon=\"pi pi-check-circle\" (click)=\"evaluateForms()\" [rounded]=\"true\"></p-button>\r\n </div>\r\n\r\n <p-button icon=\"pi pi-verified\" [rounded]=\"true\" (click)=\"startAI()\" label=\"Repasar con IA\" />\r\n</div>\r\n<br /><br />\r\n\r\n@if(chatVisible) {\r\n<p-drawer header=\"Conversation\" [(visible)]=\"chatVisible\" position=\"bottom\" styleClass=\"app-bottom-overlay\">\r\n <dc-chat [agentCard]=\"agentMasterLesson\" [evaluatorAgentCard]=\"evaluatorAgentCard\"></dc-chat>\r\n</p-drawer>\r\n}\r\n", styles: [".evaluate{float:right}\n"] }]
|
|
881
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i1$1.ActivatedRoute }, { type: i5$1.ToastAlertsAbstractService, decorators: [{
|
|
882
|
+
type: Inject,
|
|
883
|
+
args: [TOAST_ALERTS_TOKEN]
|
|
884
|
+
}] }, { type: LessonsAbstractService, decorators: [{
|
|
885
|
+
type: Inject,
|
|
886
|
+
args: [LESSONS_TOKEN]
|
|
887
|
+
}] }, { type: i2$4.AgentCardsAbstractService, decorators: [{
|
|
888
|
+
type: Inject,
|
|
889
|
+
args: [CONVERSATION_AI_TOKEN]
|
|
890
|
+
}] }, { type: i2$4.DCConversationPromptBuilderService }], propDecorators: { lesson: [{
|
|
891
|
+
type: Input
|
|
892
|
+
}], test: [{
|
|
893
|
+
type: Input
|
|
894
|
+
}], dynamicLesson: [{
|
|
895
|
+
type: ViewChild,
|
|
896
|
+
args: ['dynamicLesson', { static: true }]
|
|
897
|
+
}] } });
|
|
898
|
+
|
|
899
|
+
const GradientCss = 'linear-gradient(to bottom,var(--primary-color), rgba(213, 238, 239, 0.31))';
|
|
900
|
+
class DCLessonEditorComponent {
|
|
901
|
+
constructor(lessonService, toastService, notionService, _activatedRoute, router, cdr, dialogService) {
|
|
902
|
+
this.lessonService = lessonService;
|
|
903
|
+
this.toastService = toastService;
|
|
904
|
+
this.notionService = notionService;
|
|
905
|
+
this._activatedRoute = _activatedRoute;
|
|
906
|
+
this.router = router;
|
|
907
|
+
this.cdr = cdr;
|
|
908
|
+
this.dialogService = dialogService;
|
|
909
|
+
this.editor = BalloonEditor;
|
|
910
|
+
this.coverStorageSettings = {
|
|
911
|
+
path: 'lessons/covers',
|
|
912
|
+
fileName: 'cover',
|
|
913
|
+
cropSettings: { resizeToWidth: 850, aspectRatio: AspectType.RectangleLarge, resolutions: [ResolutionType.Medium] },
|
|
914
|
+
};
|
|
915
|
+
this.lessonComponentEnum = LessonComponentEnum;
|
|
916
|
+
this.lessonId = this._activatedRoute.snapshot.paramMap.get('id');
|
|
917
|
+
this.lesson = { textCoded: `<h1>Nueva lección </h1> <p> Texto aquí</p>`, tags: [] };
|
|
918
|
+
this.components = {};
|
|
919
|
+
this.isRendered = false;
|
|
920
|
+
this.cover = '';
|
|
921
|
+
this.isCropperVisible = false;
|
|
922
|
+
this.isLoadingLesson = false;
|
|
923
|
+
}
|
|
924
|
+
ngOnInit() {
|
|
925
|
+
this.getLessonIfId();
|
|
926
|
+
this.items = [
|
|
927
|
+
{
|
|
928
|
+
tooltipOptions: { tooltipLabel: 'Reparar con IA: Repara la lección con IA', tooltipPosition: 'bottom' },
|
|
929
|
+
icon: 'pi pi-magic',
|
|
930
|
+
command: () => this.generateByAI(),
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
tooltipOptions: { tooltipLabel: 'Selector: Agrega un selector con multiples opciones', tooltipPosition: 'bottom' },
|
|
934
|
+
icon: 'pi pi-caret-down',
|
|
935
|
+
command: () => this.openComponentBuilder('selector'),
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
tooltipOptions: { tooltipLabel: 'Hablar: Para que una palabra o frase sea reproducible', tooltipPosition: 'bottom' },
|
|
939
|
+
icon: 'pi pi-megaphone',
|
|
940
|
+
command: () => this.openComponentBuilder('speaker'),
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
tooltipOptions: {
|
|
944
|
+
tooltipLabel: 'Entrada de texto: Escribe una respuesta en un cuadro de texto',
|
|
945
|
+
tooltipPosition: 'bottom',
|
|
946
|
+
},
|
|
947
|
+
icon: 'pi pi-pencil',
|
|
948
|
+
command: () => this.openComponentBuilder('textWriter'),
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
tooltipOptions: { tooltipLabel: 'Verbo: Para ver datos de un verbo', tooltipPosition: 'bottom' },
|
|
952
|
+
icon: 'pi pi-eye',
|
|
953
|
+
command: () => this.openComponentBuilder('verbSummary'),
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
tooltipOptions: { tooltipLabel: 'Palabra: Para ver datos de una palabra', tooltipPosition: 'bottom' },
|
|
957
|
+
icon: 'pi pi-file-word',
|
|
958
|
+
command: () => this.openComponentBuilder('wordSummary'),
|
|
959
|
+
},
|
|
960
|
+
];
|
|
961
|
+
}
|
|
962
|
+
async getLessonIfId() {
|
|
963
|
+
if (!this.lessonId) {
|
|
964
|
+
this.cover = `${GradientCss}, url("/assets/images/default_banner.webp")`;
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
this.lesson = await this.lessonService.getLesson(this.lessonId);
|
|
968
|
+
console.log('lesson', this.lesson);
|
|
969
|
+
if (!this.lesson) {
|
|
970
|
+
this.toastService.warn({ title: 'No se encontró la lección', subtitle: 'Quiza el id es incorrecto' });
|
|
971
|
+
}
|
|
972
|
+
this.togleRender();
|
|
973
|
+
this.updateCover();
|
|
974
|
+
}
|
|
975
|
+
updateCover() {
|
|
976
|
+
const cover = this.lesson.media?.images?.find((img) => img.type === 'cover');
|
|
977
|
+
if (cover) {
|
|
978
|
+
this.cover = `${GradientCss}, url('${cover.url}')`;
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
this.cover = `${GradientCss}, url("/assets/images/default_banner.webp")`;
|
|
982
|
+
}
|
|
983
|
+
this.cdr.detectChanges();
|
|
984
|
+
}
|
|
985
|
+
onTagRemove(tag) {
|
|
986
|
+
this.lesson.tags = this.lesson.tags.filter((text) => text !== tag.text);
|
|
987
|
+
}
|
|
988
|
+
onTagAdd(tag) {
|
|
989
|
+
if (tag.value) {
|
|
990
|
+
this.lesson.tags.push(tag.value);
|
|
991
|
+
}
|
|
992
|
+
tag.input.nativeElement.value = '';
|
|
993
|
+
}
|
|
994
|
+
async saveLesson(event = null) {
|
|
995
|
+
if (event) {
|
|
996
|
+
event.preventDefault();
|
|
997
|
+
}
|
|
998
|
+
// TODO: Optimización importante, guardar una lección guarda todos los datos de nuevo, y no solo los que se modificaron, encontrar una forma de optimizar.
|
|
999
|
+
const lesson = await this.lessonService.postLesson(this.lesson);
|
|
1000
|
+
if (!this.lessonId) {
|
|
1001
|
+
this.toastService.success({ title: 'Se creó la lección', subtitle: 'Éxito' });
|
|
1002
|
+
this.router.navigate([lesson.id], { relativeTo: this._activatedRoute });
|
|
1003
|
+
}
|
|
1004
|
+
else {
|
|
1005
|
+
this.toastService.info({ title: 'Se guadarón los cambios en la lección', subtitle: 'Guardado' });
|
|
1006
|
+
this.lesson = lesson;
|
|
1007
|
+
this.validateAudios();
|
|
1008
|
+
}
|
|
1009
|
+
this.togleRender();
|
|
1010
|
+
return lesson;
|
|
1011
|
+
}
|
|
1012
|
+
async validateAudios() {
|
|
1013
|
+
if (!this.lesson.components) {
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
// al menos un audio sin generar.
|
|
1017
|
+
// agregar más condigciones después
|
|
1018
|
+
// this.lesson.components.forEach((component: SpeakerCompConfiguration) => {
|
|
1019
|
+
// if (component.component === 'speaker') {
|
|
1020
|
+
// if (component.settings.voice && !component.audio) {
|
|
1021
|
+
// // this.toastrService.warn('Se encontraron audios por generar', 'Será rápido');
|
|
1022
|
+
// // TODO call backend.
|
|
1023
|
+
// this.lessonService.generateAudiosForLesson(this.lesson.id).then((res) => {
|
|
1024
|
+
// // this.toastrService.success('Se generaron los audios', 'Listo');
|
|
1025
|
+
// console.log(res);
|
|
1026
|
+
// });
|
|
1027
|
+
// return;
|
|
1028
|
+
// }
|
|
1029
|
+
// }
|
|
1030
|
+
// });
|
|
1031
|
+
}
|
|
1032
|
+
togleRender(_event = null) {
|
|
1033
|
+
this.isRendered = false;
|
|
1034
|
+
setTimeout(() => {
|
|
1035
|
+
this.isRendered = true;
|
|
1036
|
+
this.cdr.detectChanges();
|
|
1037
|
+
}, 400);
|
|
1038
|
+
this.cdr.detectChanges();
|
|
1039
|
+
}
|
|
1040
|
+
openComponentBuilder(type) {
|
|
1041
|
+
return this.dialogService.open(LessonComponentBuilders[type], { width: '550px', header: 'Agregar componente', closable: true }).onClose.pipe();
|
|
1042
|
+
}
|
|
1043
|
+
uploadCover(imageUploaded) {
|
|
1044
|
+
const image = { type: 'cover', ...imageUploaded };
|
|
1045
|
+
if (!this.lesson.media) {
|
|
1046
|
+
// puede que no exista media
|
|
1047
|
+
this.lesson.media = {};
|
|
1048
|
+
this.lesson.media.images = [image];
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
// solo sustituir el cover si ya existe, como siempre utilizo el mismo nombre, no tengo que eliminar la anterior si actualizo.
|
|
1052
|
+
// const currentCover = this.lesson.media.images.find((img) => img.type === 'cover');
|
|
1053
|
+
this.lesson.media.images = this.lesson.media.images.filter((img) => img.type !== 'cover');
|
|
1054
|
+
this.lesson.media.images.push(image);
|
|
1055
|
+
}
|
|
1056
|
+
this.updateCover();
|
|
1057
|
+
this.saveLesson();
|
|
1058
|
+
}
|
|
1059
|
+
openCropper() {
|
|
1060
|
+
this.isCropperVisible = true;
|
|
1061
|
+
}
|
|
1062
|
+
async generateByAI() {
|
|
1063
|
+
this.isLoadingLesson = true;
|
|
1064
|
+
try {
|
|
1065
|
+
await this.saveLesson();
|
|
1066
|
+
await this.lessonService.postGenerateByAI(this.lesson.id);
|
|
1067
|
+
await this.getLessonIfId();
|
|
1068
|
+
}
|
|
1069
|
+
finally {
|
|
1070
|
+
this.isLoadingLesson = false;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
onImageSelected(event) {
|
|
1074
|
+
console.log(event);
|
|
1075
|
+
}
|
|
1076
|
+
async onImageUploaded(event) {
|
|
1077
|
+
this.uploadCover(event);
|
|
1078
|
+
this.cdr.detectChanges();
|
|
1079
|
+
}
|
|
1080
|
+
async importFromNotion() {
|
|
1081
|
+
let notionPageId;
|
|
1082
|
+
if (this.lesson?.extras?.notionPageId) {
|
|
1083
|
+
const response = confirm(`Ya tenemos el id ${this.lesson.extras?.notionPageId} ¿Quieres usar este id?`);
|
|
1084
|
+
if (!response) {
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
notionPageId = this.lesson.extras?.notionPageId;
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
const response = prompt('Ingresa el url de notion para importar la lección, se guardará este id');
|
|
1091
|
+
if (!response) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
notionPageId = this.extractNotionPageId(response);
|
|
1095
|
+
if (!notionPageId)
|
|
1096
|
+
return;
|
|
1097
|
+
this.linkWithNotion(notionPageId);
|
|
1098
|
+
}
|
|
1099
|
+
this.toastService.info({ title: 'Importando lección...', subtitle: 'Espera unos segundos' });
|
|
1100
|
+
const md = await this.notionService.getPageInSpecificFormat(notionPageId, NotionExportType.HTML);
|
|
1101
|
+
console.log(md);
|
|
1102
|
+
this.lesson.textCoded = md.content;
|
|
1103
|
+
this.togleRender();
|
|
1104
|
+
this.toastService.success({ title: 'Listo', subtitle: 'La lección se importó correctamente' });
|
|
1105
|
+
}
|
|
1106
|
+
extractNotionPageId(url) {
|
|
1107
|
+
const notionIdRegex = /[a-f0-9]{32}(?=\?|$)/;
|
|
1108
|
+
const match = url.match(notionIdRegex);
|
|
1109
|
+
const notionId = match ? match[0] : null;
|
|
1110
|
+
if (!notionId) {
|
|
1111
|
+
this.toastService.error({
|
|
1112
|
+
title: 'URL inválido',
|
|
1113
|
+
subtitle: 'Por favor ingresa una URL válida de Notion',
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
return notionId;
|
|
1117
|
+
}
|
|
1118
|
+
async linkWithNotion(notionPageId) {
|
|
1119
|
+
const extra = this.lesson.extras || {};
|
|
1120
|
+
extra.notionPageId = notionPageId;
|
|
1121
|
+
await this.lessonService.postLesson({ ...this.lesson, extras: extra });
|
|
1122
|
+
this.toastService.success({ title: 'Listo', subtitle: 'Se enlazó la lección con Notion' });
|
|
1123
|
+
}
|
|
1124
|
+
async improveNotionWithAI() {
|
|
1125
|
+
const md = await this.notionService.getPageInSpecificFormat(this.lesson.extras.notionPageId, NotionExportType.HTML);
|
|
1126
|
+
console.log(md);
|
|
1127
|
+
// this.lesson.textCoded = md.content;
|
|
1128
|
+
// this.togleRender();
|
|
1129
|
+
// this.toastService.success({ title: 'Listo', subtitle: 'La lección se mejoró con AI' });
|
|
1130
|
+
}
|
|
1131
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonEditorComponent, deps: [{ token: LESSONS_TOKEN }, { token: TOAST_ALERTS_TOKEN }, { token: NOTION_SERVICE_TOKEN }, { token: i1$1.ActivatedRoute }, { token: i1$1.Router }, { token: i0.ChangeDetectorRef }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1132
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.1", type: DCLessonEditorComponent, isStandalone: true, selector: "dc-lesson-editor", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef }, { propertyName: "dhtml", first: true, predicate: ["dhtml"], descendants: true, static: true }], ngImport: i0, template: "<div style=\"position: relative; margin-bottom: 20px\">\n <div class=\"header-cover\" [style.background-image]=\"cover\"></div>\n\n <dc-cropper-modal\n style=\"position: absolute; top: 10px; left: 20px\"\n [buttonLabel]=\"'Carga una portada'\"\n [imgStorageSettings]=\"coverStorageSettings\"\n (imageUploaded)=\"onImageUploaded($event)\"></dc-cropper-modal>\n</div>\n\n<br />\n\n<div>\n <div>\n <div>\n <div style=\"display: flex; gap: 10px; padding: 10px\">\n <p-button label=\"Guardar\" severity=\"primary\" (click)=\"saveLesson()\" />\n\n <p-button label=\"Previsualizar\" severity=\"secondary\" (click)=\"togleRender()\" />\n <p-button label=\"Importar de Notion\" severity=\"help\" (click)=\"importFromNotion()\" />\n <p-button label=\"Mejorar Notion con AI\" severity=\"help\" (click)=\"improveNotionWithAI()\" />\n </div>\n\n <div>\n <input pInputText style=\"width: 100%\" [(ngModel)]=\"lesson.title\" type=\"text\" placeholder=\"Agrega un t\u00EDtulo\" />\n </div>\n <div style=\"margin-top: 4px\">\n <input pInputText style=\"width: 100%\" [(ngModel)]=\"lesson.description\" type=\"text\" placeholder=\"Agrega una descripci\u00F3n\" />\n </div>\n\n <div style=\"display: flex; align-items: center\">\n <br />\n <br />\n <input pInputText style=\"flex: auto\" [(ngModel)]=\"lesson.prompt\" type=\"text\" placeholder=\"Prompt\" />\n <p-button severity=\"primary\" [disabled]=\"isLoadingLesson\" (click)=\"generateByAI()\"> Generar </p-button>\n </div>\n\n <div>\n <label class=\"checkbox-container\">\n <input type=\"checkbox\" [(ngModel)]=\"lesson.isPublished\" title=\"Cuando termines la edici\u00F3n marca esta casilla\" />\n <span class=\"checkmark\"></span>\n Lecci\u00F3n publicada\n </label>\n <br />\n\n <input pInputText [(ngModel)]=\"lesson.level\" type=\"number\" placeholder=\"Level\" />\n </div>\n\n <div>\n {{ lesson.baseLang | flagEmoji }} -> {{ lesson.targetLang | flagEmoji }} Lecci\u00F3n para hablantes de {{ lesson.baseLang | langDesc : 'es' }} que aprenden\n {{ lesson.targetLang | langDesc : 'es' }}\n </div>\n </div>\n </div>\n\n <hr />\n <span>Componentes: </span>\n <div style=\"display: flex; gap: 10px\">\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.Selector)\" pTooltip=\"Agrega un selector con multiples opciones\">\n Selector\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.Speaker)\" pTooltip=\"Para que una palabra o frase sea reproducible\">\n Speaker\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.TextWriter)\" pTooltip=\"Escribe una respuesta en un cuadro de texto\">\n Text\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.VerbSummary)\" pTooltip=\"Muestra la informaci\u00F3n de un verbo\"> Text </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.VerbSummary)\" pTooltip=\"Muestra la informaci\u00F3n de un verbo\"> Verb </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.WordSummary)\" pTooltip=\"Muestra la informaci\u00F3n de una palabra\">\n Palabra\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.TranslationSwitcher)\" pTooltip=\"Muestra el texto pero al pica cambia de idioma\">\n Traducci\u00F3n\n </p-button>\n </div>\n\n <hr />\n\n <p-splitter [style]=\"{ height: '80vh' }\" styleClass=\"mb-8\">\n <ng-template pTemplate>\n <ckeditor\n (keydown.control.s)=\"saveLesson($event)\"\n (keydown.control.space)=\"togleRender($event)\"\n class=\"text-editor\"\n [editor]=\"editor\"\n [(ngModel)]=\"lesson.textCoded\">\n </ckeditor>\n </ng-template>\n\n <ng-template pTemplate>\n @if (isRendered) {\n <dc-lesson-renderer class=\"text-editor\" [lesson]=\"lesson\" [test]=\"true\"></dc-lesson-renderer>\n }\n </ng-template>\n </p-splitter>\n\n <div class=\"float-button\">\n <p-speeddial [model]=\"items\" [radius]=\"120\" type=\"quarter-circle\" direction=\"up-left\" />\n\n <p-button icon=\"pi pi-save\" (click)=\"saveLesson()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n\n <hr />\n</div>\n", styles: [".btn{padding:.5rem 1rem;border-radius:4px;border:1px solid transparent;cursor:pointer}.btn-primary{background-color:#007bff;color:#fff}.btn-outline-primary{border-color:#007bff;color:#007bff}.btn-secondary{background-color:#6c757d;color:#fff}.btn-outline-secondary{border-color:#6c757d;color:#6c757d}.btn-rounded{border-radius:50%}.form-control{padding:.375rem .75rem;border:1px solid #ced4da;border-radius:.25rem}.splitter{display:flex;gap:1rem}.splitter-panel{flex:1}.checkbox-container{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.mr-2{margin-right:.5rem}.header-cover{width:100%;height:250px;background-position:center;background-repeat:no-repeat;background-size:cover;position:relative}.float-button{position:fixed;bottom:3.5rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}.text-editor{width:-webkit-fill-available;overflow-y:auto}:host ::ng-deep .p-inputtext{background:#fff3}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i4$2.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "component", type: CropperComponentModal, selector: "dc-cropper-modal", inputs: ["imgStorageSettings", "buttonLabel", "currentStorage"], outputs: ["imageUploaded", "onImageCropped", "onFileSelected"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i6.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: SplitterModule }, { kind: "component", type: i8.Splitter, selector: "p-splitter", inputs: ["styleClass", "panelStyleClass", "style", "panelStyle", "stateStorage", "stateKey", "layout", "gutterSize", "step", "minSizes", "panelSizes"], outputs: ["onResizeEnd", "onResizeStart"] }, { kind: "component", type: DCLessonRendererComponent, selector: "dc-lesson-renderer", inputs: ["lesson", "test"] }, { kind: "pipe", type: LangDescTranslationPipe, name: "langDesc" }, { kind: "pipe", type: FlagLanguagePipe, name: "flagEmoji" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i9.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: SpeedDialModule }, { kind: "component", type: i2$2.SpeedDial, selector: "p-speeddial, p-speedDial, p-speed-dial", inputs: ["id", "model", "visible", "style", "className", "direction", "transitionDelay", "type", "radius", "mask", "disabled", "hideOnClickOutside", "buttonStyle", "buttonClassName", "maskStyle", "maskClassName", "showIcon", "hideIcon", "rotateAnimation", "ariaLabel", "ariaLabelledBy", "tooltipOptions", "buttonProps"], outputs: ["onVisibleChange", "visibleChange", "onClick", "onShow", "onHide"] }] }); }
|
|
1133
|
+
}
|
|
1134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DCLessonEditorComponent, decorators: [{
|
|
1135
|
+
type: Component,
|
|
1136
|
+
args: [{ selector: 'dc-lesson-editor', standalone: true, imports: [
|
|
1137
|
+
FormsModule,
|
|
1138
|
+
CKEditorModule,
|
|
1139
|
+
CropperComponentModal,
|
|
1140
|
+
ButtonModule,
|
|
1141
|
+
InputTextModule,
|
|
1142
|
+
SplitterModule,
|
|
1143
|
+
DCLessonRendererComponent,
|
|
1144
|
+
LangDescTranslationPipe,
|
|
1145
|
+
FlagLanguagePipe,
|
|
1146
|
+
TooltipModule,
|
|
1147
|
+
SpeedDialModule,
|
|
1148
|
+
], template: "<div style=\"position: relative; margin-bottom: 20px\">\n <div class=\"header-cover\" [style.background-image]=\"cover\"></div>\n\n <dc-cropper-modal\n style=\"position: absolute; top: 10px; left: 20px\"\n [buttonLabel]=\"'Carga una portada'\"\n [imgStorageSettings]=\"coverStorageSettings\"\n (imageUploaded)=\"onImageUploaded($event)\"></dc-cropper-modal>\n</div>\n\n<br />\n\n<div>\n <div>\n <div>\n <div style=\"display: flex; gap: 10px; padding: 10px\">\n <p-button label=\"Guardar\" severity=\"primary\" (click)=\"saveLesson()\" />\n\n <p-button label=\"Previsualizar\" severity=\"secondary\" (click)=\"togleRender()\" />\n <p-button label=\"Importar de Notion\" severity=\"help\" (click)=\"importFromNotion()\" />\n <p-button label=\"Mejorar Notion con AI\" severity=\"help\" (click)=\"improveNotionWithAI()\" />\n </div>\n\n <div>\n <input pInputText style=\"width: 100%\" [(ngModel)]=\"lesson.title\" type=\"text\" placeholder=\"Agrega un t\u00EDtulo\" />\n </div>\n <div style=\"margin-top: 4px\">\n <input pInputText style=\"width: 100%\" [(ngModel)]=\"lesson.description\" type=\"text\" placeholder=\"Agrega una descripci\u00F3n\" />\n </div>\n\n <div style=\"display: flex; align-items: center\">\n <br />\n <br />\n <input pInputText style=\"flex: auto\" [(ngModel)]=\"lesson.prompt\" type=\"text\" placeholder=\"Prompt\" />\n <p-button severity=\"primary\" [disabled]=\"isLoadingLesson\" (click)=\"generateByAI()\"> Generar </p-button>\n </div>\n\n <div>\n <label class=\"checkbox-container\">\n <input type=\"checkbox\" [(ngModel)]=\"lesson.isPublished\" title=\"Cuando termines la edici\u00F3n marca esta casilla\" />\n <span class=\"checkmark\"></span>\n Lecci\u00F3n publicada\n </label>\n <br />\n\n <input pInputText [(ngModel)]=\"lesson.level\" type=\"number\" placeholder=\"Level\" />\n </div>\n\n <div>\n {{ lesson.baseLang | flagEmoji }} -> {{ lesson.targetLang | flagEmoji }} Lecci\u00F3n para hablantes de {{ lesson.baseLang | langDesc : 'es' }} que aprenden\n {{ lesson.targetLang | langDesc : 'es' }}\n </div>\n </div>\n </div>\n\n <hr />\n <span>Componentes: </span>\n <div style=\"display: flex; gap: 10px\">\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.Selector)\" pTooltip=\"Agrega un selector con multiples opciones\">\n Selector\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.Speaker)\" pTooltip=\"Para que una palabra o frase sea reproducible\">\n Speaker\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.TextWriter)\" pTooltip=\"Escribe una respuesta en un cuadro de texto\">\n Text\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.VerbSummary)\" pTooltip=\"Muestra la informaci\u00F3n de un verbo\"> Text </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.VerbSummary)\" pTooltip=\"Muestra la informaci\u00F3n de un verbo\"> Verb </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.WordSummary)\" pTooltip=\"Muestra la informaci\u00F3n de una palabra\">\n Palabra\n </p-button>\n <p-button severity=\"info\" (click)=\"openComponentBuilder(lessonComponentEnum.TranslationSwitcher)\" pTooltip=\"Muestra el texto pero al pica cambia de idioma\">\n Traducci\u00F3n\n </p-button>\n </div>\n\n <hr />\n\n <p-splitter [style]=\"{ height: '80vh' }\" styleClass=\"mb-8\">\n <ng-template pTemplate>\n <ckeditor\n (keydown.control.s)=\"saveLesson($event)\"\n (keydown.control.space)=\"togleRender($event)\"\n class=\"text-editor\"\n [editor]=\"editor\"\n [(ngModel)]=\"lesson.textCoded\">\n </ckeditor>\n </ng-template>\n\n <ng-template pTemplate>\n @if (isRendered) {\n <dc-lesson-renderer class=\"text-editor\" [lesson]=\"lesson\" [test]=\"true\"></dc-lesson-renderer>\n }\n </ng-template>\n </p-splitter>\n\n <div class=\"float-button\">\n <p-speeddial [model]=\"items\" [radius]=\"120\" type=\"quarter-circle\" direction=\"up-left\" />\n\n <p-button icon=\"pi pi-save\" (click)=\"saveLesson()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n\n <hr />\n</div>\n", styles: [".btn{padding:.5rem 1rem;border-radius:4px;border:1px solid transparent;cursor:pointer}.btn-primary{background-color:#007bff;color:#fff}.btn-outline-primary{border-color:#007bff;color:#007bff}.btn-secondary{background-color:#6c757d;color:#fff}.btn-outline-secondary{border-color:#6c757d;color:#6c757d}.btn-rounded{border-radius:50%}.form-control{padding:.375rem .75rem;border:1px solid #ced4da;border-radius:.25rem}.splitter{display:flex;gap:1rem}.splitter-panel{flex:1}.checkbox-container{display:inline-flex;align-items:center;gap:.5rem;cursor:pointer}.mr-2{margin-right:.5rem}.header-cover{width:100%;height:250px;background-position:center;background-repeat:no-repeat;background-size:cover;position:relative}.float-button{position:fixed;bottom:3.5rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}.text-editor{width:-webkit-fill-available;overflow-y:auto}:host ::ng-deep .p-inputtext{background:#fff3}\n"] }]
|
|
1149
|
+
}], ctorParameters: () => [{ type: LessonsAbstractService, decorators: [{
|
|
1150
|
+
type: Inject,
|
|
1151
|
+
args: [LESSONS_TOKEN]
|
|
1152
|
+
}] }, { type: i5$1.ToastAlertsAbstractService, decorators: [{
|
|
1153
|
+
type: Inject,
|
|
1154
|
+
args: [TOAST_ALERTS_TOKEN]
|
|
1155
|
+
}] }, { type: NotionAbstractService, decorators: [{
|
|
1156
|
+
type: Inject,
|
|
1157
|
+
args: [NOTION_SERVICE_TOKEN]
|
|
1158
|
+
}] }, { type: i1$1.ActivatedRoute }, { type: i1$1.Router }, { type: i0.ChangeDetectorRef }, { type: i2.DialogService }], propDecorators: { target: [{
|
|
1159
|
+
type: ViewChild,
|
|
1160
|
+
args: ['target', { read: ViewContainerRef }]
|
|
1161
|
+
}], dhtml: [{
|
|
1162
|
+
type: ViewChild,
|
|
1163
|
+
args: ['dhtml', { static: true }]
|
|
1164
|
+
}] } });
|
|
1165
|
+
|
|
1166
|
+
// This is the base class for all the components that are going to be used in the lessons.
|
|
1167
|
+
class LessonDynamicComponent {
|
|
1168
|
+
constructor() {
|
|
1169
|
+
this.settings = {};
|
|
1170
|
+
}
|
|
1171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: LessonDynamicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1172
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: LessonDynamicComponent, isStandalone: true, selector: "app-lesson-component", inputs: { settings: "settings" }, ngImport: i0, template: '<div>no template</div>', isInline: true }); }
|
|
1173
|
+
}
|
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: LessonDynamicComponent, decorators: [{
|
|
1175
|
+
type: Component,
|
|
1176
|
+
args: [{
|
|
1177
|
+
selector: 'app-lesson-component',
|
|
1178
|
+
template: '<div>no template</div>',
|
|
1179
|
+
standalone: true,
|
|
1180
|
+
}]
|
|
1181
|
+
}], propDecorators: { settings: [{
|
|
1182
|
+
type: Input
|
|
1183
|
+
}] } });
|
|
1184
|
+
|
|
1185
|
+
/*
|
|
1186
|
+
* Public API Surface of lessons
|
|
1187
|
+
*/
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Generated bundle index. Do not edit.
|
|
1191
|
+
*/
|
|
1192
|
+
|
|
1193
|
+
export { ComponentBuilder, ComponentWithForm, DCLessonEditorComponent, DCLessonFormComponent, DCLessonListComponent, DCLessonRendererComponent, DcLessonCardComponent, FlagLanguagePipe, LESSONS_TOKEN, LangCodeDescription, LangCodeDescriptionEs, LangDescTranslationPipe, LessonComponentBuilders, LessonComponentEnum, LessonComponents, LessonDynamicComponent, LessonsAbstractService, NOTION_SERVICE_TOKEN, NotionAbstractService, NotionExportType, SelectorBuilderComponent, SelectorComponent, TextWriterBuiderComponent, TextWriterComponent, TranslationSwitcherBuilderComponent, TranslationSwitcherComponent, getLessonComponentClass, provideLessonsService, provideNotionService };
|
|
1194
|
+
//# sourceMappingURL=dataclouder-ngx-lessons.mjs.map
|