@touchpoll/tp-survey 0.0.38 → 0.0.40

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.
@@ -174,11 +174,11 @@ const answerODValidator = (minValue, maxValue) => (control) => {
174
174
  };
175
175
  const answerOLValidator = (isPhoneNumber, canSkip) => (control) => {
176
176
  const text = typeof control.value !== 'string' ? '' : control.value.trim();
177
- //Нужно чтобы в поле ввели хоть что-то.
177
+ //Нужно, чтобы в поле ввели хоть что-то.
178
178
  if (text.length === 0 && !canSkip) {
179
179
  return { answerOlAnswerError: true };
180
180
  }
181
- if (isPhoneNumber && !canSkip) {
181
+ if (isPhoneNumber) {
182
182
  const res = text.length === 9 && !isNaN(Number(text));
183
183
  if (!res) {
184
184
  return { answerOlTelephoneFormatError: true };
@@ -2386,7 +2386,19 @@ class InsertQuestionCssDirective {
2386
2386
  const renderer = inject(Renderer2);
2387
2387
  const document = inject(DOCUMENT);
2388
2388
  //у каждого вопроса будет свой css класс, чтобы можно было переопределить стили в свойстве вопроса Css
2389
- effect(() => renderer.addClass(nativeElement, `question-${this.question()?.QuestionNum}`));
2389
+ effect(() => {
2390
+ //если вопрос не указан, то удаляем все классы, которые начинаются с question-
2391
+ if (this.question()) {
2392
+ renderer.addClass(nativeElement, `question-${this.question()?.QuestionNum}`);
2393
+ }
2394
+ else {
2395
+ nativeElement.classList.forEach(className => {
2396
+ if (className.startsWith('question-')) {
2397
+ renderer.removeClass(nativeElement, className);
2398
+ }
2399
+ });
2400
+ }
2401
+ });
2390
2402
  //Если у вопроса указан Css, то добавляем его в head страницы. С селектором div.question-N. Где N - номер вопроса
2391
2403
  effect(() => {
2392
2404
  if (this.question()?.Css) {