@yoobic/yobi 8.3.0-17 → 8.3.0-18
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/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/{form-choice-helpers-1003243c.js → form-choice-helpers-5a83f5c9.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{swiper-fedb543f.js → swiper-bbba57e0.js} +1 -1
- package/dist/cjs/yoo-form-choice-button.cjs.entry.js +2 -2
- package/dist/cjs/yoo-form-choice-card.cjs.entry.js +1 -1
- package/dist/cjs/yoo-form-choice-chat.cjs.entry.js +2 -2
- package/dist/cjs/yoo-form-choice-image.cjs.entry.js +2 -2
- package/dist/cjs/yoo-form-choice-radio.cjs.entry.js +2 -2
- package/dist/cjs/yoo-form-creator-block-expandable.cjs.entry.js +3 -3
- package/dist/cjs/yoo-form-creator.cjs.entry.js +8 -3
- package/dist/cjs/yoo-form-dynamic.cjs.entry.js +2 -0
- package/dist/cjs/yoo-form-swipe-cards.cjs.entry.js +60 -63
- package/dist/cjs/{yoo-ion-slides-ddaabe00.js → yoo-ion-slides-272e7ebb.js} +8 -2
- package/dist/cjs/yoo-ion-slides.cjs.entry.js +1 -1
- package/dist/cjs/yoo-lesson-question-result.cjs.entry.js +4 -3
- package/dist/cjs/yoo-lottie.cjs.entry.js +32 -6
- package/dist/cjs/yoo-points-recap.cjs.entry.js +5 -4
- package/dist/collection/components/2.molecules/points-recap/points-recap.js +23 -4
- package/dist/collection/components/2.molecules/slides/slides.js +7 -1
- package/dist/collection/components/form/form-choice/button/form-choice-button.css +0 -1
- package/dist/collection/components/form/form-choice/card/form-choice-card.css +0 -1
- package/dist/collection/components/form/form-choice/chat/form-choice-chat.css +0 -1
- package/dist/collection/components/form/form-choice/image/form-choice-image.css +0 -1
- package/dist/collection/components/form/form-choice/radio/form-choice-radio.css +0 -1
- package/dist/collection/components/form/form-dynamic/form-dynamic.js +2 -0
- package/dist/collection/components/form/form-swipe-cards/form-swipe-cards.css +80 -58
- package/dist/collection/components/form/form-swipe-cards/form-swipe-cards.js +63 -66
- package/dist/collection/components/form-creator/form-creator/form-creator.js +8 -3
- package/dist/collection/components/form-creator/form-creator-block-expandable/form-creator-block-expandable.js +3 -3
- package/dist/collection/feature-learn/learning/lesson-question-result/lesson-question-result.js +4 -3
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/{esm/form-choice-helpers-ac31afd4.js → design-system/form-choice-helpers-82020d4b.js} +1 -1
- package/dist/design-system/{swiper-28bd92bd.js → swiper-80225cb6.js} +2 -2
- package/dist/design-system/yoo-form-choice-button.entry.js +2 -2
- package/dist/design-system/yoo-form-choice-card.entry.js +1 -1
- package/dist/design-system/yoo-form-choice-chat.entry.js +2 -2
- package/dist/design-system/yoo-form-choice-image.entry.js +2 -2
- package/dist/design-system/yoo-form-choice-radio.entry.js +2 -2
- package/dist/design-system/yoo-form-creator-block-expandable.entry.js +3 -3
- package/dist/design-system/yoo-form-creator.entry.js +8 -3
- package/dist/design-system/yoo-form-dynamic.entry.js +2 -0
- package/dist/design-system/yoo-form-swipe-cards.entry.js +62 -65
- package/dist/design-system/{yoo-ion-slides-ddda50eb.js → yoo-ion-slides-f06207d9.js} +8 -2
- package/dist/design-system/yoo-ion-slides.entry.js +1 -1
- package/dist/design-system/yoo-lesson-question-result.entry.js +4 -3
- package/dist/design-system/yoo-lottie.entry.js +32 -6
- package/dist/design-system/yoo-points-recap.entry.js +5 -4
- package/dist/esm/design-system.js +1 -1
- package/dist/{design-system/form-choice-helpers-ac31afd4.js → esm/form-choice-helpers-82020d4b.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{swiper-28bd92bd.js → swiper-80225cb6.js} +2 -2
- package/dist/esm/yoo-form-choice-button.entry.js +2 -2
- package/dist/esm/yoo-form-choice-card.entry.js +1 -1
- package/dist/esm/yoo-form-choice-chat.entry.js +2 -2
- package/dist/esm/yoo-form-choice-image.entry.js +2 -2
- package/dist/esm/yoo-form-choice-radio.entry.js +2 -2
- package/dist/esm/yoo-form-creator-block-expandable.entry.js +3 -3
- package/dist/esm/yoo-form-creator.entry.js +8 -3
- package/dist/esm/yoo-form-dynamic.entry.js +2 -0
- package/dist/esm/yoo-form-swipe-cards.entry.js +62 -65
- package/dist/esm/{yoo-ion-slides-ddda50eb.js → yoo-ion-slides-f06207d9.js} +8 -2
- package/dist/esm/yoo-ion-slides.entry.js +1 -1
- package/dist/esm/yoo-lesson-question-result.entry.js +4 -3
- package/dist/esm/yoo-lottie.entry.js +32 -6
- package/dist/esm/yoo-points-recap.entry.js +5 -4
- package/dist/types/components/2.molecules/points-recap/points-recap.d.ts +2 -1
- package/dist/types/components/form/form-swipe-cards/form-swipe-cards.d.ts +12 -17
- package/dist/types/components.d.ts +2 -0
- package/dist/types/home/runner/work/yoobic-ng-6/yoobic-ng-6/design-system/stencil/.stencil/shared/interfaces/src/entities/form-field/form-field.interface.d.ts +11 -3
- package/dist/types/home/runner/work/yoobic-ng-6/yoobic-ng-6/design-system/stencil/.stencil/shared/interfaces/src/ui/points-recap/points-recap.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Draggable, findParent, getMedia, getUUID, gsapTimeline, gsapTo, isCloudinaryLink, isWeb, Power1, translate, translateMulti } from '@shared/utils';
|
|
2
|
-
import { Component, Element, Event, h, Host, Prop, Watch } from '@stencil/core';
|
|
2
|
+
import { Component, Element, Event, forceUpdate, h, Host, Prop, Watch } from '@stencil/core';
|
|
3
3
|
import { clamp, inRange, isEqual, shuffle } from 'lodash-es';
|
|
4
4
|
import { getAppContext } from '../../../utils/helpers/common-helpers';
|
|
5
5
|
import { hasDuplicates, showWarningAlert } from '../../../utils/helpers/draggable-tags-helpers';
|
|
@@ -14,25 +14,23 @@ export class YooFormSwipeCardsComponent {
|
|
|
14
14
|
this.shuffled = true;
|
|
15
15
|
this.values = [];
|
|
16
16
|
this.swipeCards = [];
|
|
17
|
-
this.animationDelay = this.animated ? .25 : 0;
|
|
18
17
|
this.cardsElements = [];
|
|
19
18
|
this.swipeButtons = [];
|
|
20
19
|
}
|
|
21
20
|
onCategoriesChanged(nv, ov) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (showAlert) {
|
|
26
|
-
this.showInstructionView = true;
|
|
27
|
-
}
|
|
21
|
+
this.hasDataChanged = !isEqual(nv, ov);
|
|
22
|
+
if (this.hasDataChanged) {
|
|
23
|
+
this.spyOnValuesChanged();
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
onValuesChanged() {
|
|
26
|
+
onValuesChanged(nv, ov) {
|
|
27
|
+
this.hasDataChanged = !isEqual(nv, ov);
|
|
31
28
|
if (!this.isMode.image) {
|
|
32
29
|
this.spyOnValuesChanged();
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
onImagesChanged() {
|
|
32
|
+
onImagesChanged(nv, ov) {
|
|
33
|
+
this.hasDataChanged = !isEqual(nv, ov);
|
|
36
34
|
if (!this.isMode.text) {
|
|
37
35
|
this.spyOnValuesChanged();
|
|
38
36
|
}
|
|
@@ -47,10 +45,11 @@ export class YooFormSwipeCardsComponent {
|
|
|
47
45
|
setTimeout(() => this.displayFooterElement(!this.showInstructionView), 150);
|
|
48
46
|
}
|
|
49
47
|
get isMode() {
|
|
48
|
+
const { image, text, textimage } = SwipeCardsMode;
|
|
50
49
|
return {
|
|
51
|
-
image: this.mode ===
|
|
52
|
-
textimage: this.mode ===
|
|
53
|
-
text: this.mode ===
|
|
50
|
+
image: this.mode === image,
|
|
51
|
+
textimage: this.mode === textimage,
|
|
52
|
+
text: this.mode === text
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
get numberEmptyItems() {
|
|
@@ -73,14 +72,15 @@ export class YooFormSwipeCardsComponent {
|
|
|
73
72
|
}
|
|
74
73
|
get hasAllCardBeenSwiped() {
|
|
75
74
|
var _a;
|
|
76
|
-
return !((_a = this.swipeCards) === null || _a === void 0 ? void 0 : _a.filter(
|
|
75
|
+
return !((_a = this.swipeCards) === null || _a === void 0 ? void 0 : _a.filter(({ swipedDirection }) => !swipedDirection).length);
|
|
77
76
|
}
|
|
78
77
|
get buttons() {
|
|
79
|
-
const
|
|
78
|
+
const { left, right, undo } = SwipeCardsDirection;
|
|
79
|
+
const getButton = (direction) => { var _a, _b; return (_b = (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.filter(({ id }) => id === `swipe-${direction}`)) === null || _b === void 0 ? void 0 : _b[0]; };
|
|
80
80
|
return {
|
|
81
|
-
left: getButton(
|
|
82
|
-
undo: getButton(
|
|
83
|
-
right: getButton(
|
|
81
|
+
left: getButton(left),
|
|
82
|
+
undo: getButton(undo),
|
|
83
|
+
right: getButton(right)
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
get currentCard() {
|
|
@@ -90,12 +90,8 @@ export class YooFormSwipeCardsComponent {
|
|
|
90
90
|
var _a;
|
|
91
91
|
return this.getCardElement((_a = this.currentCard) === null || _a === void 0 ? void 0 : _a.id);
|
|
92
92
|
}
|
|
93
|
-
get formHeight() {
|
|
94
|
-
var _a;
|
|
95
|
-
return ((_a = findParent(this.host, 'form')) === null || _a === void 0 ? void 0 : _a.clientHeight) - 1.5 * 16;
|
|
96
|
-
}
|
|
97
93
|
componentWillLoad() {
|
|
98
|
-
this.
|
|
94
|
+
this.prepareGame();
|
|
99
95
|
}
|
|
100
96
|
componentDidLoad() {
|
|
101
97
|
this.initGame();
|
|
@@ -113,17 +109,15 @@ export class YooFormSwipeCardsComponent {
|
|
|
113
109
|
this.validityChanged.emit(this.validity);
|
|
114
110
|
return this.validity;
|
|
115
111
|
}
|
|
116
|
-
|
|
112
|
+
prepareGame() {
|
|
117
113
|
this.shuffleCardValues();
|
|
114
|
+
this.animationDelay = this.animated ? .25 : 0;
|
|
118
115
|
this.revealCards = !this.showInstructionView;
|
|
119
116
|
this.swipeCards = this.initCards();
|
|
120
117
|
}
|
|
121
118
|
initGame() {
|
|
122
119
|
this.displayFooterElement(false);
|
|
123
|
-
|
|
124
|
-
this.initDraggable();
|
|
125
|
-
}
|
|
126
|
-
this.showWarnings();
|
|
120
|
+
!this.showInstructionView && this.initDraggable();
|
|
127
121
|
}
|
|
128
122
|
updateCardsData() {
|
|
129
123
|
if (this.hasDataChanged) {
|
|
@@ -150,7 +144,7 @@ export class YooFormSwipeCardsComponent {
|
|
|
150
144
|
return (_a = this.cardsElements) === null || _a === void 0 ? void 0 : _a.find((cardElement) => (cardElement === null || cardElement === void 0 ? void 0 : cardElement.id) === id);
|
|
151
145
|
}
|
|
152
146
|
spyOnValuesChanged() {
|
|
153
|
-
this.showWarnings();
|
|
147
|
+
this.hasDataChanged && this.showWarnings();
|
|
154
148
|
}
|
|
155
149
|
showWarnings() {
|
|
156
150
|
var _a;
|
|
@@ -183,7 +177,7 @@ export class YooFormSwipeCardsComponent {
|
|
|
183
177
|
return value;
|
|
184
178
|
};
|
|
185
179
|
const getValuesFromDirection = (direction) => this.swipeCards.filter(c => c.swipedDirection === direction).map(c => formatCardValue(c.value));
|
|
186
|
-
setValueAndValidateInput([
|
|
180
|
+
this.livePreview ? forceUpdate(this) : setValueAndValidateInput([
|
|
187
181
|
getValuesFromDirection(SwipeCardsDirection.left),
|
|
188
182
|
getValuesFromDirection(SwipeCardsDirection.right)
|
|
189
183
|
], this);
|
|
@@ -236,9 +230,11 @@ export class YooFormSwipeCardsComponent {
|
|
|
236
230
|
}
|
|
237
231
|
setSwipingColor(swipingDirection) {
|
|
238
232
|
if (this.currentCardElement) {
|
|
233
|
+
const { left, right } = SwipeCardsDirection;
|
|
234
|
+
const [categoryLeft, categoryRight] = this.categories;
|
|
239
235
|
const categoryContainer = this.currentCardElement.querySelector('.content-category');
|
|
240
|
-
const isThrowable = [
|
|
241
|
-
categoryContainer.textContent =
|
|
236
|
+
const isThrowable = [left, right].includes(swipingDirection);
|
|
237
|
+
categoryContainer.textContent = translateMulti(swipingDirection === left ? categoryLeft : swipingDirection === right ? categoryRight : '');
|
|
242
238
|
[this.gameContainerElement, this.currentCardElement].forEach(e => {
|
|
243
239
|
isThrowable ? e.setAttribute('direction', swipingDirection) : e.removeAttribute('direction');
|
|
244
240
|
});
|
|
@@ -254,13 +250,13 @@ export class YooFormSwipeCardsComponent {
|
|
|
254
250
|
const returnedAnimation = timeline();
|
|
255
251
|
// building swiping animation
|
|
256
252
|
const swipeAnimation = timeline({ paused: true });
|
|
257
|
-
const isSwipeable =
|
|
253
|
+
const isSwipeable = el => el.classList.contains('current');
|
|
258
254
|
swipeAnimation
|
|
259
255
|
.fromTo(this.buttons.left, 1, { scale: 1.5 }, { scale: 1 }, 0)
|
|
260
256
|
.fromTo(this.buttons.right, 1, { scale: 1 }, { scale: 1.5 }, 1)
|
|
261
257
|
.progress(.5);
|
|
262
|
-
const onStartSwiping = (
|
|
263
|
-
if (isSwipeable(
|
|
258
|
+
const onStartSwiping = () => {
|
|
259
|
+
if (isSwipeable(cardElement)) {
|
|
264
260
|
this.blockMoves.emit(true);
|
|
265
261
|
returnedAnimation === null || returnedAnimation === void 0 ? void 0 : returnedAnimation.kill();
|
|
266
262
|
}
|
|
@@ -272,33 +268,35 @@ export class YooFormSwipeCardsComponent {
|
|
|
272
268
|
this.setSwipingColor(this.getSwipedState(swipeProgress).swipedDirection);
|
|
273
269
|
}
|
|
274
270
|
};
|
|
275
|
-
const onThrowing = (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
const onThrowing = () => {
|
|
272
|
+
const baseProps = { left: 0, top: 0 };
|
|
273
|
+
if (isSwipeable(cardElement)) {
|
|
274
|
+
const { isCardThrowable, swipedDirection } = this.getSwipedState(swipeAnimation.progress());
|
|
275
|
+
!isCardThrowable ?
|
|
279
276
|
returnedAnimation
|
|
280
|
-
.to(cardElement, this.animationDelay,
|
|
277
|
+
.to(cardElement, this.animationDelay, baseProps)
|
|
281
278
|
.to([this.buttons.left, this.buttons.right], { scale: 1, ease: Power1.easeInOut }, 0) :
|
|
282
|
-
this.swipeCard(
|
|
279
|
+
this.swipeCard(swipedDirection);
|
|
283
280
|
}
|
|
284
281
|
else {
|
|
285
|
-
gsapTo(cardElement, this.animationDelay,
|
|
282
|
+
gsapTo(cardElement, this.animationDelay, baseProps);
|
|
286
283
|
}
|
|
284
|
+
this.blockMoves.emit(false);
|
|
287
285
|
};
|
|
288
286
|
return (new Draggable(cardElement, {
|
|
289
287
|
bound: this.host,
|
|
290
288
|
type: 'left, top',
|
|
291
289
|
cursor: 'grab',
|
|
292
290
|
zIndexBoost: false,
|
|
293
|
-
onDragStart()
|
|
291
|
+
onDragStart: () => onStartSwiping(),
|
|
294
292
|
onDrag() { onSwiping(this); },
|
|
295
|
-
onDragEnd()
|
|
293
|
+
onDragEnd: () => onThrowing()
|
|
296
294
|
}));
|
|
297
295
|
}
|
|
298
296
|
clickToSwipe(clickedDirection) {
|
|
299
297
|
if (!this.buttons[clickedDirection].disabled) {
|
|
300
298
|
this.setSwipingColor(clickedDirection);
|
|
301
|
-
|
|
299
|
+
this.swipeCard(clickedDirection);
|
|
302
300
|
}
|
|
303
301
|
}
|
|
304
302
|
async undoSwipe() {
|
|
@@ -317,25 +315,23 @@ export class YooFormSwipeCardsComponent {
|
|
|
317
315
|
}
|
|
318
316
|
}
|
|
319
317
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
renderStack() {
|
|
325
|
-
return h("section", { id: "stack" }, this.swipeCards.map((card, i, s) => {
|
|
326
|
-
var _a;
|
|
327
|
-
const currentCardIndex = s.indexOf(this.currentCard) || 0;
|
|
318
|
+
renderCards() {
|
|
319
|
+
return h("section", { id: "cards" }, this.swipeCards.map(({ swipedDirection, value, id }, i, s) => {
|
|
320
|
+
const currentCardIndex = s.indexOf(this.currentCard);
|
|
328
321
|
const hasCurrentCard = currentCardIndex !== -1;
|
|
329
|
-
return h("
|
|
322
|
+
return h("div", { id: id, class: {
|
|
330
323
|
card: true,
|
|
331
324
|
current: i === currentCardIndex,
|
|
332
325
|
second: hasCurrentCard && i === currentCardIndex + 1,
|
|
333
326
|
third: hasCurrentCard && i === currentCardIndex + 2,
|
|
334
327
|
revealing: this.revealCards
|
|
335
|
-
},
|
|
328
|
+
}, ref: el => this.cardsElements[i] = el, ...{
|
|
329
|
+
type: this.mode,
|
|
330
|
+
...(swipedDirection && { direction: swipedDirection })
|
|
331
|
+
} },
|
|
336
332
|
this.hasImage && (h("div", { class: "content-image" },
|
|
337
|
-
h("yoo-img", { instant: true, src: getMedia(
|
|
338
|
-
this.hasText && (h("div", { class: "content-text" }, translateMulti((
|
|
333
|
+
h("yoo-img", { instant: true, src: getMedia(value['_downloadURL']) }))),
|
|
334
|
+
this.hasText && (h("div", { class: "content-text" }, translateMulti((value === null || value === void 0 ? void 0 : value['_filename']) || value))),
|
|
339
335
|
h("div", { class: "content-category" }));
|
|
340
336
|
}));
|
|
341
337
|
}
|
|
@@ -345,14 +341,14 @@ export class YooFormSwipeCardsComponent {
|
|
|
345
341
|
const iconColor = isWeb(this.host) ? categoryColor : 'light';
|
|
346
342
|
const iconSize = isWeb(this.host) ? 'large' : 'medium';
|
|
347
343
|
const category = this.categories && translateMulti(isLeftCategory ? this.categories[0] : this.categories[1]);
|
|
348
|
-
return h("div", { class:
|
|
344
|
+
return h("div", { class: { category: true, [side]: true } },
|
|
349
345
|
h("yoo-tag", { noBackground: isWeb(this.host), color: categoryColor, size: "large", icon: `big-arrow-${side}`, iconOnlyColor: iconColor, iconOnlySize: iconSize }),
|
|
350
346
|
h("p", { class: `${categoryColor}` }, category),
|
|
351
347
|
h("span", { class: "stable" }, translate(`SWIPE${side.toUpperCase()}`)));
|
|
352
348
|
}
|
|
353
349
|
renderTopDescription() {
|
|
354
350
|
return h("div", { id: "header" },
|
|
355
|
-
h("
|
|
351
|
+
h("span", { id: "title", innerHTML: translateMulti(this.label) }),
|
|
356
352
|
h("span", { class: "stable" }, translate(this.description || 'CARDSWIPEDEFAULTINSTRUCTIONS')));
|
|
357
353
|
}
|
|
358
354
|
renderInstructions() {
|
|
@@ -372,7 +368,8 @@ export class YooFormSwipeCardsComponent {
|
|
|
372
368
|
} }, translate('START'))));
|
|
373
369
|
}
|
|
374
370
|
renderSwipeButtons() {
|
|
375
|
-
|
|
371
|
+
const { left, undo, right } = SwipeCardsDirection;
|
|
372
|
+
return h("section", { id: "actions" }, [left, undo, right].map((d, i) => this.renderSwipeAction(d, i)));
|
|
376
373
|
}
|
|
377
374
|
renderSwipeAction(direction, index) {
|
|
378
375
|
var _a;
|
|
@@ -382,23 +379,23 @@ export class YooFormSwipeCardsComponent {
|
|
|
382
379
|
const actionColor = isUndo ? isWeb(this.host) ? 'light' : 'stable-alt' : isLeft ? 'app-color' : 'warning';
|
|
383
380
|
const swipeIcon = isUndo ? 'undo' : `big-arrow-${direction}`;
|
|
384
381
|
const categoryIndex = isLeft ? 0 : 1;
|
|
385
|
-
return (h("div", { class: {
|
|
382
|
+
return (h("div", { class: { action: true, hide: this.hasAllCardBeenSwiped && !isUndo } },
|
|
386
383
|
h("yoo-button", { shape: "circular", rippleType: "unbounded", id: `swipe-${direction}`, size: (isUndo && !isMobile) ? 'medium' : 'large', fill: (isMobile || isUndo) ? 'solid' : 'transparent', color: isUndo ? isMobile ? 'stable-light' : 'text-color' : actionColor.concat('-20'), ref: (element) => (this.swipeButtons[index] = element), onClick: () => isUndo ? this.undoSwipe() : this.clickToSwipe(direction) },
|
|
387
384
|
h("yoo-icon", { name: swipeIcon, color: actionColor, size: isMobile ? 'medium' : isUndo ? 'small' : 'large' })),
|
|
388
385
|
!isUndo && ((_a = this.categories) === null || _a === void 0 ? void 0 : _a.length) && h("span", { class: actionColor }, translateMulti(this.categories[categoryIndex]))));
|
|
389
386
|
}
|
|
390
387
|
renderEndGameMessage() {
|
|
391
|
-
return h("section", { id: "end-message", class: {
|
|
388
|
+
return h("section", { id: "end-message", class: { active: this.hasAllCardBeenSwiped } },
|
|
392
389
|
h("yoo-lottie", { autoplay: this.hasAllCardBeenSwiped, type: "check" }),
|
|
393
390
|
h("div", { innerHTML: translate('ENDSWIPINGCARDSMESSAGE') }),
|
|
394
391
|
h("span", null, translate('CLICKTOCONTINUE', { buttonName: this.nextButtonText })));
|
|
395
392
|
}
|
|
396
|
-
|
|
393
|
+
renderGame() {
|
|
397
394
|
return [
|
|
398
395
|
isWeb(this.host) && !this.livePreview && this.renderTopDescription(),
|
|
399
396
|
h("section", { id: "game", ref: (element) => (this.gameContainerElement = element) },
|
|
400
397
|
this.renderEndGameMessage(),
|
|
401
|
-
this.
|
|
398
|
+
this.renderCards()),
|
|
402
399
|
this.renderSwipeButtons()
|
|
403
400
|
];
|
|
404
401
|
}
|
|
@@ -426,9 +423,9 @@ export class YooFormSwipeCardsComponent {
|
|
|
426
423
|
h("p", { slot: "content" }));
|
|
427
424
|
}
|
|
428
425
|
render() {
|
|
429
|
-
return (h(Host, {
|
|
426
|
+
return (h(Host, { class: { ...getAppContext(this.host), 'swiper-no-swiping': !this.readonly, instructions: this.showInstructionView } },
|
|
430
427
|
this.renderBanner(),
|
|
431
|
-
!this.readonly && (this.showInstructionView ? this.renderInstructions() : this.
|
|
428
|
+
!this.readonly && (this.showInstructionView ? this.renderInstructions() : this.renderGame()),
|
|
432
429
|
this.readonly && this.renderSummary()));
|
|
433
430
|
}
|
|
434
431
|
static get is() { return "yoo-form-swipe-cards"; }
|
|
@@ -242,7 +242,9 @@ export class YooFormCreatorComponent {
|
|
|
242
242
|
return ((_a = this.missionDescription) === null || _a === void 0 ? void 0 : _a.type) === 'lesson';
|
|
243
243
|
}
|
|
244
244
|
onMissionDescriptionUpdated() {
|
|
245
|
-
this.translatePage
|
|
245
|
+
if (this.translatePage) {
|
|
246
|
+
this.translatePage.missionDescription = this.missionDescription;
|
|
247
|
+
}
|
|
246
248
|
}
|
|
247
249
|
onCustomFormFieldsUpdated() {
|
|
248
250
|
if (this.fieldSelectorElement) {
|
|
@@ -288,8 +290,8 @@ export class YooFormCreatorComponent {
|
|
|
288
290
|
if (this.hasAdditionBeenClicked && ((_a = this.newFieldCondition) === null || _a === void 0 ? void 0 : _a.condition)) {
|
|
289
291
|
this.newFieldCondition = null;
|
|
290
292
|
this.overlayElement.initialNewFieldCondition = this.newFieldCondition;
|
|
291
|
-
this.hasAdditionBeenClicked = false;
|
|
292
293
|
}
|
|
294
|
+
this.hasAdditionBeenClicked = false;
|
|
293
295
|
}
|
|
294
296
|
onTranslationsChanged() {
|
|
295
297
|
var _a, _b;
|
|
@@ -863,7 +865,7 @@ export class YooFormCreatorComponent {
|
|
|
863
865
|
this.expandableBlocks[itemIndex].formField.required =
|
|
864
866
|
originalItemIndex === itemIndex && attributesToForceUpdate ? attributesToForceUpdate.required : this.currentSlides[slideIndex].items[itemIndex].required;
|
|
865
867
|
this.expandableBlocks[itemIndex].formField.title;
|
|
866
|
-
const key = title.replace(/%/g, '');
|
|
868
|
+
const key = title === null || title === void 0 ? void 0 : title.replace(/%/g, '');
|
|
867
869
|
const translationIndex = this.translations.findIndex((tran) => tran.key === key);
|
|
868
870
|
if (translationIndex > -1) {
|
|
869
871
|
title = this.translations[translationIndex][getCurrentLanguage()];
|
|
@@ -1498,6 +1500,9 @@ export class YooFormCreatorComponent {
|
|
|
1498
1500
|
const fieldsToMove = [];
|
|
1499
1501
|
const selectedFieldNames = [];
|
|
1500
1502
|
selectedFields.forEach((selectedField) => {
|
|
1503
|
+
if (slideIndex !== selectedField.slideIndex) {
|
|
1504
|
+
this.currentSlides[selectedField.slideIndex].items[selectedField.itemIndex].isExpanded = false;
|
|
1505
|
+
}
|
|
1501
1506
|
fieldsToMove.push(this.currentSlides[selectedField.slideIndex].items[selectedField.itemIndex]);
|
|
1502
1507
|
selectedFieldNames.push(this.currentSlides[selectedField.slideIndex].items[selectedField.itemIndex].name);
|
|
1503
1508
|
});
|
|
@@ -315,9 +315,6 @@ export class YooFormCreatorBlockExpandableComponent {
|
|
|
315
315
|
if (this.contentBottomElement) {
|
|
316
316
|
this.contentBottomElement.style.display = 'flex';
|
|
317
317
|
}
|
|
318
|
-
if (this.arrowElement) {
|
|
319
|
-
this.arrowElement.name = this.isExpanded ? 'arrow-up' : 'arrow-down';
|
|
320
|
-
}
|
|
321
318
|
gsapSet(slotContent, { overflow: 'unset' });
|
|
322
319
|
},
|
|
323
320
|
ease: Power3.easeIn
|
|
@@ -325,6 +322,9 @@ export class YooFormCreatorBlockExpandableComponent {
|
|
|
325
322
|
const animationDelay = 0.5;
|
|
326
323
|
this.isExpanded = shouldExpand;
|
|
327
324
|
this.blockExpanded.emit({ expanded: shouldExpand, name: this.formField.name });
|
|
325
|
+
if (this.arrowElement) {
|
|
326
|
+
this.arrowElement.name = this.isExpanded ? 'arrow-up' : 'arrow-down';
|
|
327
|
+
}
|
|
328
328
|
gsapFromTo(contentBlock, animationDelay, from, to);
|
|
329
329
|
}
|
|
330
330
|
}
|
package/dist/collection/feature-learn/learning/lesson-question-result/lesson-question-result.js
CHANGED
|
@@ -219,7 +219,7 @@ export class YooLessonQuestionResultComponent {
|
|
|
219
219
|
}
|
|
220
220
|
else if (!isContentOnly(this.lessonType)) {
|
|
221
221
|
items = (_b = this.fields) === null || _b === void 0 ? void 0 : _b.map((field, i) => {
|
|
222
|
-
var _a, _b, _c, _d, _e, _f;
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
223
223
|
return ({
|
|
224
224
|
name: `${translate('QUESTION')} ${i + 1}`,
|
|
225
225
|
description: translateMulti(field.sentence || field.description || field.title),
|
|
@@ -231,11 +231,12 @@ export class YooLessonQuestionResultComponent {
|
|
|
231
231
|
? ((_d = this.lessonData[field.name]) === null || _d === void 0 ? void 0 : _d.earnedConfidencePoints) + ((_e = this.lessonData[field.name]) === null || _e === void 0 ? void 0 : _e.earnedQuestionPoints)
|
|
232
232
|
: ((_f = this.lessonData[field.name]) === null || _f === void 0 ? void 0 : _f.fieldValidity)
|
|
233
233
|
? Math.round(this.points)
|
|
234
|
-
: 0
|
|
234
|
+
: 0,
|
|
235
|
+
isCorrect: (_g = this.lessonData[field.name]) === null || _g === void 0 ? void 0 : _g.fieldValidity
|
|
235
236
|
});
|
|
236
237
|
});
|
|
237
238
|
}
|
|
238
|
-
return h("yoo-points-recap", { heading: translate('TOTALPOINTSEARNED'), totalPoints: Math.round(this.earnedPoints), items: items, showItemIcon: showItemIcon });
|
|
239
|
+
return h("yoo-points-recap", { heading: translate('TOTALPOINTSEARNED'), totalPoints: Math.round(this.earnedPoints), items: items, showItemIcon: showItemIcon, forceTotalPoints: true });
|
|
239
240
|
}
|
|
240
241
|
renderProgressBarLessonRecap() {
|
|
241
242
|
var _a;
|