@dataclouder/ngx-lessons 0.0.30 → 0.0.32
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/fesm2022/dataclouder-ngx-lessons.mjs +1169 -449
- package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -1
- package/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.d.ts +2 -2
- package/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.d.ts +11 -0
- package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +39 -38
- package/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.d.ts +22 -0
- package/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.d.ts +32 -37
- package/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.d.ts +2 -4
- package/lib/components/lesson-mini-components/components/ComponentBuilder.d.ts +7 -2
- package/lib/components/lesson-mini-components/components/lessons.clases.d.ts +17 -42
- package/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.d.ts +13 -0
- package/lib/components/lesson-mini-components/components/speaker/speaker.component.d.ts +12 -0
- package/lib/services/lesson-ai.service.d.ts +18 -0
- package/lib/services/lesson-notion.service.d.ts +35 -0
- package/lib/services/lesson-utils.service.d.ts +34 -0
- package/package.json +3 -2
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +0 -35
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +0 -107
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +0 -82
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.css +0 -90
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +0 -105
- 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 +0 -318
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +0 -27
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.scss +0 -3
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +0 -271
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.html +0 -5
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.scss +0 -3
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +0 -14
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +0 -30
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.scss +0 -17
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +0 -170
- package/src/lib/components/dc-lessons/lessons.component.ts +0 -10
- package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +0 -74
- package/src/lib/components/lesson-mini-components/components/ComponentWithForm.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/lesson-dynamic.component.ts +0 -13
- package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +0 -254
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +0 -58
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.scss +0 -15
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +0 -70
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +0 -2
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.scss +0 -12
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +0 -47
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +0 -35
- 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 +0 -25
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +0 -27
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +0 -7
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.scss +0 -3
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +0 -29
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.html +0 -24
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.scss +0 -15
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.ts +0 -29
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.html +0 -4
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.scss +0 -8
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.ts +0 -61
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.css +0 -3
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.html +0 -9
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +0 -32
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.css +0 -3
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.html +0 -28
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +0 -30
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.html +0 -18
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.scss +0 -3
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.html +0 -15
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.scss +0 -27
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.ts +0 -46
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.html +0 -19
- 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 +0 -27
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.html +0 -14
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.scss +0 -22
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.ts +0 -51
- package/src/lib/models/lessons.pipes.ts +0 -38
- package/src/lib/models/models.ts +0 -92
- package/src/lib/models/notion.models.ts +0 -43
- package/src/public-api.ts +0 -25
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { UntypedFormControl } from '@angular/forms';
|
|
2
|
-
import { InjectionToken, Type } from '@angular/core';
|
|
3
|
-
import { Provider } from '@angular/core';
|
|
4
|
-
|
|
5
|
-
import { SelectorBuilderComponent } from './selector/selector-builder/selector-builder.component';
|
|
6
|
-
import { SelectorComponent } from './selector/selector.component';
|
|
7
|
-
|
|
8
|
-
import { TextWriterBuiderComponent } from './text-writer/text-writer-buider/text-writer-buider.component';
|
|
9
|
-
import { TextWriterComponent } from './text-writer/text-writer.component';
|
|
10
|
-
import { TranslationSwitcherBuilderComponent } from './translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component';
|
|
11
|
-
import { TranslationSwitcherComponent } from './translationSwitcher/translationSwitcher.component';
|
|
12
|
-
// import { SpeakerComponent } from './speaker/speaker.component';
|
|
13
|
-
|
|
14
|
-
export type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
|
|
15
|
-
|
|
16
|
-
export enum LessonComponentEnum {
|
|
17
|
-
Selector = 'selector',
|
|
18
|
-
Speaker = 'speaker',
|
|
19
|
-
TextWriter = 'textWriter',
|
|
20
|
-
VerbSummary = 'verbSummary',
|
|
21
|
-
WordSummary = 'wordSummary',
|
|
22
|
-
TranslationSwitcher = 'translationSwitcher',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const LessonComponentBuilders = {
|
|
26
|
-
[LessonComponentEnum.Selector]: SelectorBuilderComponent,
|
|
27
|
-
// [LessonComponentEnum.Speaker]: SpeakerBuilderComponent,
|
|
28
|
-
[LessonComponentEnum.TextWriter]: TextWriterBuiderComponent,
|
|
29
|
-
// [LessonComponentEnum.VerbSummary]: VerbSummaryBuilderComponent,
|
|
30
|
-
// [LessonComponentEnum.WordSummary]: WordSummaryBuilderComponent,
|
|
31
|
-
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherBuilderComponent,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const LessonComponents = {
|
|
35
|
-
[LessonComponentEnum.Selector]: SelectorComponent,
|
|
36
|
-
// [LessonComponentEnum.Speaker]: SpeakerComponent,
|
|
37
|
-
[LessonComponentEnum.TextWriter]: TextWriterComponent,
|
|
38
|
-
// [LessonComponentEnum.VerbSummary]: VerbSummaryComponent,
|
|
39
|
-
// [LessonComponentEnum.WordSummary]: WordSummaryComponent,
|
|
40
|
-
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherComponent,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function getLessonComponentClass(type: LessonComponentsType) {
|
|
44
|
-
return LessonComponents[type];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface LessonCompSettings {
|
|
48
|
-
response?: string;
|
|
49
|
-
responses?: string; // en caso de que haya multiples respuestas
|
|
50
|
-
options?: string[]; // optiones para visualizar
|
|
51
|
-
text?: string;
|
|
52
|
-
hint?: string;
|
|
53
|
-
explanation?: string;
|
|
54
|
-
}
|
|
55
|
-
export interface LessonComponentConfiguration {
|
|
56
|
-
id: string;
|
|
57
|
-
component: LessonComponentEnum;
|
|
58
|
-
settings: LessonCompSettings;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface StorageFile {
|
|
62
|
-
bucket: string;
|
|
63
|
-
url: string;
|
|
64
|
-
path: string; // path where the file is in the storage
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface AudioStorage extends StorageFile {
|
|
68
|
-
text?: string;
|
|
69
|
-
voiceType?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface SpeakerCompConfiguration extends LessonComponentConfiguration {
|
|
72
|
-
audio: AudioStorage;
|
|
73
|
-
settings: LessonCompSettings & { voice: string };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface LessonComponentInterface {
|
|
77
|
-
config: LessonComponentConfiguration;
|
|
78
|
-
|
|
79
|
-
control?: UntypedFormControl;
|
|
80
|
-
|
|
81
|
-
validate?(): boolean | null;
|
|
82
|
-
evaluate?(): boolean | null;
|
|
83
|
-
}
|
|
84
|
-
// nuevs
|
|
85
|
-
|
|
86
|
-
// import { UntypedFormControl } from '@angular/forms';
|
|
87
|
-
|
|
88
|
-
// import { LessonComponents } from '../models/lessons.class';
|
|
89
|
-
|
|
90
|
-
export const LESSONS_TOKEN = new InjectionToken<LessonsAbstractService>('Lessons Service');
|
|
91
|
-
|
|
92
|
-
// export enum LessonComponentEnum {
|
|
93
|
-
// Selector = 'selector',
|
|
94
|
-
// Speaker = 'speaker',
|
|
95
|
-
// TextWriter = 'textWriter',
|
|
96
|
-
// VerbSummary = 'verbSummary',
|
|
97
|
-
// WordSummary = 'wordSummary',
|
|
98
|
-
// TranslationSwitcher = 'translationSwitcher',
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
export interface StorageFile {
|
|
102
|
-
bucket: string;
|
|
103
|
-
url: string;
|
|
104
|
-
path: string; // path where the file is in the storage
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface ImgStorageData extends StorageFile {
|
|
108
|
-
fullPath: string; // path + name
|
|
109
|
-
resolutions: any;
|
|
110
|
-
resolution: string;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export type LessonImage = ImgStorageData & { type: string };
|
|
114
|
-
|
|
115
|
-
// export interface LessonCompSettings {
|
|
116
|
-
// response: string;
|
|
117
|
-
// responses: string; // en caso de que haya multiples respuestas
|
|
118
|
-
// options: string[]; // optiones para visualizar
|
|
119
|
-
// text: string;
|
|
120
|
-
// hint: string;
|
|
121
|
-
// explanation: string;
|
|
122
|
-
// }
|
|
123
|
-
|
|
124
|
-
export interface LessonComponentConfiguration {
|
|
125
|
-
id: string;
|
|
126
|
-
component: LessonComponentEnum;
|
|
127
|
-
settings: LessonCompSettings;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
type StorageType = StorageFile & { type: string };
|
|
131
|
-
|
|
132
|
-
export interface Media {
|
|
133
|
-
audios?: StorageType[];
|
|
134
|
-
images?: StorageType[];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface ILessonExtra {
|
|
138
|
-
notionPageId?: string;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface ILesson {
|
|
142
|
-
// me faltan los comentarios
|
|
143
|
-
_id: any;
|
|
144
|
-
id: string;
|
|
145
|
-
title: string;
|
|
146
|
-
description: string;
|
|
147
|
-
isPublished: boolean;
|
|
148
|
-
// isPrivate: boolean;
|
|
149
|
-
textCoded: string;
|
|
150
|
-
authorId: string;
|
|
151
|
-
authorEmail: string;
|
|
152
|
-
tags: string[];
|
|
153
|
-
media: Media;
|
|
154
|
-
components: Array<LessonComponentConfiguration>;
|
|
155
|
-
baseLang: string;
|
|
156
|
-
targetLang: string;
|
|
157
|
-
|
|
158
|
-
generatedByAI: boolean;
|
|
159
|
-
prompt: string;
|
|
160
|
-
level: number;
|
|
161
|
-
extras: ILessonExtra;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface ILessonWithTaken extends ILesson {
|
|
165
|
-
// FIXME: moved to lessons lib
|
|
166
|
-
|
|
167
|
-
taken: any;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Think on someway of getting the toast alerts service
|
|
171
|
-
|
|
172
|
-
export abstract class LessonsAbstractService {
|
|
173
|
-
abstract getLessons(paginator?: any): Promise<any>;
|
|
174
|
-
abstract getLesson(id: string): Promise<any>;
|
|
175
|
-
abstract postLesson(lesson: ILesson): Promise<any>;
|
|
176
|
-
abstract updateLesson(lesson: ILesson): Promise<any>;
|
|
177
|
-
abstract deleteLesson(id: string): Promise<any>;
|
|
178
|
-
abstract generateLesson(lesson: ILesson): Promise<any>;
|
|
179
|
-
abstract postGenerateByAI(id: string): Promise<any>;
|
|
180
|
-
abstract extractTextFromHtml(html: string): string;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// my-service.provider.ts
|
|
184
|
-
export function provideLessonsService(serviceImplementation: Type<LessonsAbstractService>): Provider[] {
|
|
185
|
-
return [
|
|
186
|
-
{
|
|
187
|
-
provide: LESSONS_TOKEN,
|
|
188
|
-
useExisting: serviceImplementation,
|
|
189
|
-
},
|
|
190
|
-
];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// export type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
|
|
194
|
-
|
|
195
|
-
// export function getLessonComponentClass(type: LessonComponentsType) {
|
|
196
|
-
// // return LessonComponents[type];
|
|
197
|
-
// return null;
|
|
198
|
-
// }
|
|
199
|
-
|
|
200
|
-
export interface LessonComponentConfiguration {
|
|
201
|
-
id: string;
|
|
202
|
-
component: LessonComponentEnum;
|
|
203
|
-
settings: LessonCompSettings;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export interface StorageFile {
|
|
207
|
-
bucket: string;
|
|
208
|
-
url: string;
|
|
209
|
-
path: string; // path where the file is in the storage
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface AudioStorage extends StorageFile {
|
|
213
|
-
text?: string;
|
|
214
|
-
voiceType?: string;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export interface SpeakerCompConfiguration extends LessonComponentConfiguration {
|
|
218
|
-
audio: AudioStorage;
|
|
219
|
-
settings: LessonCompSettings & { voice: string };
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export interface LessonComponentInterface {
|
|
223
|
-
config: LessonComponentConfiguration;
|
|
224
|
-
|
|
225
|
-
control?: UntypedFormControl;
|
|
226
|
-
|
|
227
|
-
validate?(): boolean | null;
|
|
228
|
-
evaluate?(): boolean | null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// export const LessonComponents = {
|
|
232
|
-
// [LessonComponentEnum.Selector]: 1,
|
|
233
|
-
// [LessonComponentEnum.Speaker]: 2,
|
|
234
|
-
// [LessonComponentEnum.TextWriter]: 3,
|
|
235
|
-
// [LessonComponentEnum.VerbSummary]: 4,
|
|
236
|
-
// [LessonComponentEnum.WordSummary]: 5,
|
|
237
|
-
// [LessonComponentEnum.TranslationSwitcher]: 6,
|
|
238
|
-
// }
|
|
239
|
-
|
|
240
|
-
export const LangCodeDescription = {
|
|
241
|
-
es: 'Spanish',
|
|
242
|
-
en: 'English',
|
|
243
|
-
it: 'Italian',
|
|
244
|
-
pt: 'Portuguese',
|
|
245
|
-
fr: 'French',
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const LangCodeDescriptionEs = {
|
|
249
|
-
es: 'Español',
|
|
250
|
-
en: 'Inglés',
|
|
251
|
-
it: 'Italiano',
|
|
252
|
-
pt: 'Portugués',
|
|
253
|
-
fr: 'Frances',
|
|
254
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<div>
|
|
3
|
-
<p-message>Construcción del componente de Selección, sirve para hacer una pregunta y mostrar varias opciones, ejemplo:</p-message>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<div>
|
|
7
|
-
<span>En que año llegó cristobal colon a america?</span>
|
|
8
|
-
<app-selector [config]="sampleConfig"></app-selector>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<hr />
|
|
12
|
-
|
|
13
|
-
<div>
|
|
14
|
-
<form class="builder-form" [formGroup]="formGroup">
|
|
15
|
-
<input class="form-input" type="text" pInputText fullWidth formControlName="response" placeholder="Respuesta Correcta..." />
|
|
16
|
-
<br />
|
|
17
|
-
|
|
18
|
-
<input class="form-input" type="" pInputText fullWidth formControlName="hint" placeholder="Escribe una pista para esta pregunta" />
|
|
19
|
-
|
|
20
|
-
<br />
|
|
21
|
-
<input
|
|
22
|
-
class="form-input"
|
|
23
|
-
type="text"
|
|
24
|
-
pInputText
|
|
25
|
-
fullWidth
|
|
26
|
-
formControlName="explanation"
|
|
27
|
-
placeholder="Excribe una explicación para la respuesta" />
|
|
28
|
-
|
|
29
|
-
<hr />
|
|
30
|
-
<h6>Opciones</h6>
|
|
31
|
-
|
|
32
|
-
<div class="form-group" formArrayName="options">
|
|
33
|
-
<div
|
|
34
|
-
style="display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-direction: column"
|
|
35
|
-
*ngFor="let item of optionsForm.controls; let i = index">
|
|
36
|
-
<div>
|
|
37
|
-
<input type="text" pInputText fullWidth [formControlName]="i" />
|
|
38
|
-
<p-button (click)="deleteFormArrayByIndex('options', i)" icon="pi pi-times" severity="danger"></p-button>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<p-button (click)="pushControlToFormArray('options')" label="Agregar Opción" [text]="true" severity="help"></p-button>
|
|
44
|
-
</form>
|
|
45
|
-
|
|
46
|
-
<!-- <button nbButton (click)="isRendered = !isRendered"> Renderizar </button> -->
|
|
47
|
-
|
|
48
|
-
<div *ngIf="isRendered">
|
|
49
|
-
<!-- TODO: probably i need to pass some params -->
|
|
50
|
-
<app-selector></app-selector>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div>
|
|
55
|
-
<p-button (click)="copyToClipboard()" [disabled]="formGroup.invalid" label="Copia Código" [rounded]="true"></p-button>
|
|
56
|
-
<p-button (click)="showCode()" [disabled]="formGroup.invalid" label="Mostrar" [rounded]="true" severity="secondary"></p-button>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SelectorBuilderComponent } from './selector-builder.component';
|
|
4
|
-
|
|
5
|
-
describe('SelectorBuilderComponent', () => {
|
|
6
|
-
let component: SelectorBuilderComponent;
|
|
7
|
-
let fixture: ComponentFixture<SelectorBuilderComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [SelectorBuilderComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(SelectorBuilderComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { UntypedFormArray, FormsModule, ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
|
3
|
-
import { NgFor, NgIf } from '@angular/common';
|
|
4
|
-
|
|
5
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
6
|
-
import { ButtonModule } from 'primeng/button';
|
|
7
|
-
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
-
import { MessageModule } from 'primeng/message';
|
|
9
|
-
|
|
10
|
-
import { ComponentBuilder } from '../../ComponentBuilder';
|
|
11
|
-
import { SelectorComponent } from '../selector.component';
|
|
12
|
-
import { LessonComponentConfiguration, LessonComponentEnum } from '../../lessons.clases';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'app-selector-builder',
|
|
16
|
-
templateUrl: './selector-builder.component.html',
|
|
17
|
-
styleUrls: ['./selector-builder.component.scss'],
|
|
18
|
-
standalone: true,
|
|
19
|
-
imports: [FormsModule, ReactiveFormsModule, NgFor, NgIf, SelectorComponent, InputTextModule, ButtonModule, MessageModule],
|
|
20
|
-
})
|
|
21
|
-
export class SelectorBuilderComponent extends ComponentBuilder implements OnInit {
|
|
22
|
-
constructor(
|
|
23
|
-
protected override formBuilder: FormBuilder,
|
|
24
|
-
// protected override toastrService: ToastService,
|
|
25
|
-
protected override ref: DynamicDialogRef,
|
|
26
|
-
) {
|
|
27
|
-
super(formBuilder, null);
|
|
28
|
-
}
|
|
29
|
-
public sampleConfig: LessonComponentConfiguration = {
|
|
30
|
-
id: '1',
|
|
31
|
-
component: LessonComponentEnum.Selector,
|
|
32
|
-
settings: {
|
|
33
|
-
options: ['fourteen ninety-two', 'fourteen ninety-six', 'fifteen ninety-one'],
|
|
34
|
-
response: 'fourteen ninety-two',
|
|
35
|
-
hint: 'Pista para la respuesta',
|
|
36
|
-
explanation: 'Explicación de la respuesta',
|
|
37
|
-
responses: 'Opción 1, Opción 2, Opción 3',
|
|
38
|
-
text: 'Texto de la pregunta',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// public formGroup = this.formBuilder.group({
|
|
43
|
-
// options: this.formBuilder.array([]),
|
|
44
|
-
// response: ['', Validators.required],
|
|
45
|
-
// hint: [],
|
|
46
|
-
// explanation: [],
|
|
47
|
-
// });
|
|
48
|
-
|
|
49
|
-
ngOnInit(): void {
|
|
50
|
-
this.formGroup.get('response');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public isRendered;
|
|
54
|
-
|
|
55
|
-
//TODO Probablemente estos 3 pueden irse a una clase abstracta
|
|
56
|
-
|
|
57
|
-
public pushControlToFormArray(controlName: string): void {
|
|
58
|
-
this.formGroup.controls.options.push(this.formBuilder.control(''));
|
|
59
|
-
// (this.formGroup.get(controlName) as UntypedFormArray).push(this.formBuilder.control(''));
|
|
60
|
-
console.log(this.formGroup.controls.options);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public deleteFormArrayByIndex(controlName: string, index: number): void {
|
|
64
|
-
(this.formGroup.get(controlName) as UntypedFormArray).removeAt(index);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get optionsForm(): UntypedFormArray {
|
|
68
|
-
return this.formGroup.get('options') as UntypedFormArray;
|
|
69
|
-
}
|
|
70
|
-
}
|
package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SelectorComponent } from './selector.component';
|
|
4
|
-
|
|
5
|
-
describe('SelectorComponent', () => {
|
|
6
|
-
let component: SelectorComponent;
|
|
7
|
-
let fixture: ComponentFixture<SelectorComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [SelectorComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(SelectorComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { DropdownModule } from 'primeng/dropdown';
|
|
5
|
-
|
|
6
|
-
import { ComponentWithForm } from '../ComponentWithForm';
|
|
7
|
-
import { LessonComponentConfiguration, LessonComponentInterface } from '../lessons.clases';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'app-selector',
|
|
11
|
-
templateUrl: './selector.component.html',
|
|
12
|
-
styleUrls: ['./selector.component.scss'],
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [FormsModule, ReactiveFormsModule, DropdownModule],
|
|
15
|
-
})
|
|
16
|
-
export class SelectorComponent extends ComponentWithForm implements LessonComponentInterface {
|
|
17
|
-
public isFilled = false;
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
}
|
|
22
|
-
@Input() config: LessonComponentConfiguration;
|
|
23
|
-
|
|
24
|
-
public evaluate() {
|
|
25
|
-
let result;
|
|
26
|
-
if (this.control.value == null) {
|
|
27
|
-
result = null;
|
|
28
|
-
} else {
|
|
29
|
-
result = this.control.value?.toLowerCase().trim() === this.config.settings.response.toLowerCase().trim();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (result) {
|
|
33
|
-
this.status = 'success';
|
|
34
|
-
} else {
|
|
35
|
-
this.status = 'danger';
|
|
36
|
-
}
|
|
37
|
-
this.isFilled = true;
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public override validate() {
|
|
42
|
-
if (this.control.invalid) {
|
|
43
|
-
this.status = 'warning';
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<div>
|
|
3
|
-
<h5>Constructor de Speaker</h5>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<form [formGroup]="formGroup">
|
|
7
|
-
<input type="text" pInputText fullWidth formControlName="text" placeholder="Texto..." />
|
|
8
|
-
|
|
9
|
-
<br>
|
|
10
|
-
<p-dropdown [options]="voiceOptions" optionLabel="name" optionValue="id" [showClear]="true" placeholder="Voz"
|
|
11
|
-
formControlName="voice">
|
|
12
|
-
|
|
13
|
-
<ng-template let-voice pTemplate="item">
|
|
14
|
-
<div class="flex align-items-center gap-2">
|
|
15
|
-
<div>{{ voice.provider }}</div>
|
|
16
|
-
-
|
|
17
|
-
<div>{{ voice.name }}</div>
|
|
18
|
-
</div>
|
|
19
|
-
</ng-template>
|
|
20
|
-
</p-dropdown>
|
|
21
|
-
|
|
22
|
-
</form>
|
|
23
|
-
|
|
24
|
-
<br>
|
|
25
|
-
<br>
|
|
26
|
-
<br>
|
|
27
|
-
|
|
28
|
-
<br>
|
|
29
|
-
<div>
|
|
30
|
-
<p-button (click)="copyToClipboard()" [disabled]="formGroup.invalid" label="Copia Código"
|
|
31
|
-
[rounded]="true"></p-button>
|
|
32
|
-
<p-button (click)="showCode()" [disabled]="formGroup.invalid" label="Mostrar" [rounded]="true"
|
|
33
|
-
severity="secondary"></p-button>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SpeakerBuilderComponent } from './speaker-builder.component';
|
|
4
|
-
|
|
5
|
-
describe('SpeakerBuilderComponent', () => {
|
|
6
|
-
let component: SpeakerBuilderComponent;
|
|
7
|
-
let fixture: ComponentFixture<SpeakerBuilderComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [SpeakerBuilderComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(SpeakerBuilderComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// import { Component } from '@angular/core';
|
|
2
|
-
// import { UntypedFormBuilder, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
// import { ComponentBuilder } from '../../ComponentBuilder';
|
|
4
|
-
// import { ButtonModule } from 'primeng/button';
|
|
5
|
-
// import { InputTextModule } from 'primeng/inputtext';
|
|
6
|
-
// import { DropdownModule } from 'primeng/dropdown';
|
|
7
|
-
// import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
-
|
|
9
|
-
// @Component({
|
|
10
|
-
// selector: 'app-speaker-builder',
|
|
11
|
-
// templateUrl: './speaker-builder.component.html',
|
|
12
|
-
// styleUrls: ['./speaker-builder.component.scss'],
|
|
13
|
-
// standalone: true,
|
|
14
|
-
// imports: [FormsModule, ReactiveFormsModule, InputTextModule, ButtonModule, DropdownModule],
|
|
15
|
-
// })
|
|
16
|
-
// export class SpeakerBuilderComponent extends ComponentBuilder {
|
|
17
|
-
// public override formGroup = this.formBuilder.group({ text: ['', Validators.required], voice: [''] });
|
|
18
|
-
// public voiceOptions = VoiceOptions;
|
|
19
|
-
|
|
20
|
-
// constructor(
|
|
21
|
-
// protected override formBuilder: UntypedFormBuilder,
|
|
22
|
-
// // protected override toastrService: ToastService, // protected ref: NbDialogRef<ComponentBuilder>,
|
|
23
|
-
// protected override ref: DynamicDialogRef,
|
|
24
|
-
// ) {
|
|
25
|
-
// super(formBuilder, null);
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<!-- <nb-tag (click)="speach()" class="lisen" status="control" size="small" appearance="filled"
|
|
2
|
-
[text]="settings.text"></nb-tag> -->
|
|
3
|
-
|
|
4
|
-
<button pButton style="padding: 0px 2px;" severity="help" size="small" (click)="speach()" [label]="config.settings.text"
|
|
5
|
-
[text]="true" [rounded]="true"></button>
|
|
6
|
-
|
|
7
|
-
<!-- <p-button label="Secondary" [outlined]="true" ></p-button> -->
|
package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SpeakerComponent } from './speaker.component';
|
|
4
|
-
|
|
5
|
-
describe('SpeakerComponent', () => {
|
|
6
|
-
let component: SpeakerComponent;
|
|
7
|
-
let fixture: ComponentFixture<SpeakerComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [SpeakerComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(SpeakerComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// ❌ can use this until i copy services to this lib
|
|
2
|
-
// import { Component, Input, OnInit } from '@angular/core';
|
|
3
|
-
// import { ButtonModule } from 'primeng/button';
|
|
4
|
-
// import { SpeakerCompConfiguration } from '../lessons.clases';
|
|
5
|
-
|
|
6
|
-
// @Component({
|
|
7
|
-
// selector: 'app-speaker',
|
|
8
|
-
// templateUrl: './speaker.component.html',
|
|
9
|
-
// styleUrls: ['./speaker.component.scss'],
|
|
10
|
-
// standalone: true,
|
|
11
|
-
// imports: [ButtonModule],
|
|
12
|
-
// })
|
|
13
|
-
// export class SpeakerComponent implements OnInit {
|
|
14
|
-
// @Input() config: SpeakerCompConfiguration;
|
|
15
|
-
|
|
16
|
-
// voiceOptions = VoiceOptions;
|
|
17
|
-
|
|
18
|
-
// constructor(private speachService: SpeechService, private audioService: AudioService) {}
|
|
19
|
-
|
|
20
|
-
// ngOnInit(): void {}
|
|
21
|
-
|
|
22
|
-
// public speach() {
|
|
23
|
-
// if (this.config.audio) {
|
|
24
|
-
// this.audioService.playAudio(this.config.audio.url);
|
|
25
|
-
// } else {
|
|
26
|
-
// this.speachService.speach(this.config.settings.text);
|
|
27
|
-
// }
|
|
28
|
-
// }
|
|
29
|
-
// }
|