@yoobic/yobi 8.4.2 → 8.4.4
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/yoo-card-list.cjs.entry.js +4 -1
- package/dist/cjs/yoo-form-capture.cjs.entry.js +58 -116
- package/dist/cjs/yoo-form-dynamic.cjs.entry.js +1 -1
- package/dist/cjs/yoo-form-text-area.cjs.entry.js +1 -1
- package/dist/collection/components/entities/card-list/default/card-list.js +5 -2
- package/dist/collection/components/form/form-capture/form-capture.js +59 -120
- package/dist/collection/components/form/form-dynamic/form-dynamic.js +1 -1
- package/dist/collection/components/form/form-text-area/form-text-area.js +1 -1
- package/dist/design-system/yoo-card-list.entry.js +5 -2
- package/dist/design-system/yoo-form-capture.entry.js +59 -117
- package/dist/design-system/yoo-form-dynamic.entry.js +1 -1
- package/dist/design-system/yoo-form-text-area.entry.js +1 -1
- package/dist/esm/yoo-card-list.entry.js +5 -2
- package/dist/esm/yoo-form-capture.entry.js +59 -117
- package/dist/esm/yoo-form-dynamic.entry.js +1 -1
- package/dist/esm/yoo-form-text-area.entry.js +1 -1
- package/dist/types/components/form/form-capture/form-capture.d.ts +4 -4
- package/dist/types/components.d.ts +1 -1
- package/package.json +1 -1
|
@@ -276,8 +276,11 @@ const YooCardListComponent = class {
|
|
|
276
276
|
!((_e = (_d = this.host) === null || _d === void 0 ? void 0 : _d.classList) === null || _e === void 0 ? void 0 : _e.contains('map')) &&
|
|
277
277
|
!((_g = (_f = this.host) === null || _f === void 0 ? void 0 : _f.classList) === null || _g === void 0 ? void 0 : _g.contains('grid-cell'))) {
|
|
278
278
|
return (index.h("div", { class: "uifield-container" }, index.h("yoo-form-dynamic", { class: "inline in-card secondary transparent", scrollable: false, forceReadonly: !((_j = (_h = this.host) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.contains('form')), slides: [{ title: '', items: this.entry.uiFields.fields }], data: this.entry.uiFields.data, suffix: this.entry.uiFieldsSuffix, showTabs: false, formInputSize: "medium", showRecap: false, isPdf: this.entry.isPdf, onDataChanged: (ev) => {
|
|
279
|
+
var _a, _b;
|
|
279
280
|
ev.stopPropagation();
|
|
280
|
-
this.
|
|
281
|
+
if (!lodash.isEqual((_b = (_a = this.entry) === null || _a === void 0 ? void 0 : _a.uiFields) === null || _b === void 0 ? void 0 : _b.data, ev === null || ev === void 0 ? void 0 : ev.detail)) {
|
|
282
|
+
this.uiFieldsChanged.emit({ newdata: ev.detail });
|
|
283
|
+
}
|
|
281
284
|
} })));
|
|
282
285
|
}
|
|
283
286
|
}
|
|
@@ -62,15 +62,9 @@ const YooFormCaptureComponent = class {
|
|
|
62
62
|
this.updateExtraData(extraData);
|
|
63
63
|
}
|
|
64
64
|
/** If there is index, the field is a multiphoto */
|
|
65
|
-
async setFieldValue(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const newValue = this.value ? [...this.value] : [];
|
|
71
|
-
newValue[index] = data;
|
|
72
|
-
formInputHelpers.setValueAndValidateInput(newValue, this);
|
|
73
|
-
}
|
|
65
|
+
async setFieldValue(data) {
|
|
66
|
+
this.multiple ? this.value.push(data) : this.value = data;
|
|
67
|
+
formInputHelpers.setValueAndValidateInput(this.value, this);
|
|
74
68
|
}
|
|
75
69
|
async stopImageRecognitionProcess(isCancelled = false) {
|
|
76
70
|
this.imageRecoCancelled = isCancelled;
|
|
@@ -262,7 +256,7 @@ const YooFormCaptureComponent = class {
|
|
|
262
256
|
}
|
|
263
257
|
allowCrop(file) {
|
|
264
258
|
var _a;
|
|
265
|
-
return (((_a = this.cropperOptions) === null || _a === void 0 ? void 0 : _a.cropRatio) > 0 || this.showCropper) && overlays.
|
|
259
|
+
return (((_a = this.cropperOptions) === null || _a === void 0 ? void 0 : _a.cropRatio) > 0 || this.showCropper) && overlays.isImage(file) && !overlays.isGif(file) && (!(typeof file === 'string' && overlays.isUnsplashUrl(file)) || overlays.isWeb(this.host));
|
|
266
260
|
}
|
|
267
261
|
removeAllCapture() {
|
|
268
262
|
this.value = [];
|
|
@@ -321,50 +315,34 @@ const YooFormCaptureComponent = class {
|
|
|
321
315
|
}
|
|
322
316
|
}
|
|
323
317
|
}
|
|
324
|
-
processMediaData(mediaData, index
|
|
325
|
-
|
|
326
|
-
if (!mediaData) {
|
|
327
|
-
return (promise = Promise.resolve(mediaData));
|
|
328
|
-
}
|
|
329
|
-
if (mediaData && mediaData.indexOf('?') > 0) {
|
|
318
|
+
async processMediaData(mediaData, index) {
|
|
319
|
+
if (mediaData === null || mediaData === void 0 ? void 0 : mediaData.includes('?')) {
|
|
330
320
|
mediaData = mediaData.substring(0, mediaData.indexOf('?'));
|
|
331
321
|
}
|
|
332
|
-
if (mediaData &&
|
|
333
|
-
promise = Promise.resolve(mediaData);
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
322
|
+
else if (mediaData && !overlays.isImageUrl(mediaData)) {
|
|
336
323
|
mediaData = overlays.addFilePrefix(mediaData);
|
|
337
|
-
if (overlays.isAndroid() &&
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
324
|
+
if (!overlays.isAndroid() && ['cache', 'tmp'].includes(mediaData)) {
|
|
325
|
+
try {
|
|
326
|
+
mediaData = await overlays.moveToImageDirectory(mediaData, overlays.getSession().user ? overlays.getSession().user.disablePhotoOrientationAutoFix : false);
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
throw new Error(err);
|
|
330
|
+
}
|
|
342
331
|
}
|
|
343
332
|
}
|
|
344
|
-
|
|
345
|
-
if (preventUpdateValue) {
|
|
346
|
-
return Promise.resolve(newPath);
|
|
347
|
-
}
|
|
333
|
+
try {
|
|
348
334
|
if (this.shouldTagImage()) {
|
|
349
|
-
this.showPhotoTagDialog(
|
|
350
|
-
|
|
351
|
-
this.updateTagData(tag, index);
|
|
352
|
-
this.setFieldValue(index, newPath);
|
|
353
|
-
this.clearPhotoEdit(index);
|
|
354
|
-
if (this.saveGeoloc) {
|
|
355
|
-
this.captureGeoloc(index);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
this.setFieldValue(index, newPath);
|
|
362
|
-
this.clearPhotoEdit(index);
|
|
363
|
-
if (this.saveGeoloc) {
|
|
364
|
-
this.captureGeoloc(index);
|
|
365
|
-
}
|
|
335
|
+
const tag = await this.showPhotoTagDialog(mediaData);
|
|
336
|
+
(tag === null || tag === void 0 ? void 0 : tag.data) && this.updateTagData(tag, index);
|
|
366
337
|
}
|
|
367
|
-
|
|
338
|
+
await this.setFieldValue(mediaData);
|
|
339
|
+
this.clearPhotoEdit(index);
|
|
340
|
+
this.saveGeoloc && this.captureGeoloc(index);
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
throw new Error(err);
|
|
344
|
+
}
|
|
345
|
+
return mediaData;
|
|
368
346
|
}
|
|
369
347
|
showPhotoTagDialog(imageSrc, value) {
|
|
370
348
|
const imageTag = document.createElement('yoo-form-capture-tag-dialog');
|
|
@@ -491,75 +469,37 @@ const YooFormCaptureComponent = class {
|
|
|
491
469
|
this.showImageLoader = false;
|
|
492
470
|
return;
|
|
493
471
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const hasUnsplash = imagesData.some(d => overlays.isUnsplashUrl(d));
|
|
498
|
-
if (!imageData && this.showImageLoader) {
|
|
472
|
+
try {
|
|
473
|
+
const res = await promise;
|
|
474
|
+
if (!res && this.showImageLoader) {
|
|
499
475
|
this.showImageLoader = false;
|
|
500
476
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
let newIndex = index;
|
|
516
|
-
if (index < 0) {
|
|
517
|
-
newIndex = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
518
|
-
}
|
|
519
|
-
if (isMultiMode || useMediaCapture) {
|
|
520
|
-
const promises = imageData.map((d, ind) => {
|
|
521
|
-
return this.processMediaData(d.fullPath, newIndex >= 0 ? ind + newIndex : newIndex);
|
|
522
|
-
});
|
|
523
|
-
return Promise.all(promises).then(() => { });
|
|
524
|
-
}
|
|
525
|
-
else if (lodash.isArray(imageData)) {
|
|
526
|
-
const newArr = [];
|
|
527
|
-
let promises = [];
|
|
528
|
-
const preventUpdate = imageData.length !== 1;
|
|
529
|
-
if (preventUpdate) {
|
|
530
|
-
promises = imageData.map((imageSrc, i) => {
|
|
531
|
-
return this.processMediaData(imageSrc, null, preventUpdate).then((newImageSrc) => {
|
|
532
|
-
newArr[i] = newImageSrc;
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
promises = imageData.map((d, ind) => {
|
|
538
|
-
return this.processMediaData(d, ind + newIndex);
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
return Promise.all(promises).then(() => {
|
|
542
|
-
if (preventUpdate) {
|
|
543
|
-
this.value = [...[].concat(this.value), ...newArr];
|
|
544
|
-
formInputHelpers.setValueAndValidateInput(this.value, this);
|
|
477
|
+
const imagesData = Array.isArray(res) ? res : [res];
|
|
478
|
+
const hasUnsplash = imagesData.some(d => overlays.isUnsplashUrl(d));
|
|
479
|
+
const processImage = async (imageData, index) => {
|
|
480
|
+
var _a;
|
|
481
|
+
try {
|
|
482
|
+
let extractedData = (imageData === null || imageData === void 0 ? void 0 : imageData['data']) || (imageData === null || imageData === void 0 ? void 0 : imageData['path']) || (imageData === null || imageData === void 0 ? void 0 : imageData['fullPath']) || imageData;
|
|
483
|
+
if (!this.shouldTagImage()) {
|
|
484
|
+
const shouldOpenCropper = !hasUnsplash && imagesData.length === 1 && this.allowCrop(imageData);
|
|
485
|
+
const newIndex = Array.isArray(this.value) ? (_a = this.value) === null || _a === void 0 ? void 0 : _a.length : index;
|
|
486
|
+
if (shouldOpenCropper) {
|
|
487
|
+
extractedData = await this.onOpenCropper(imageData);
|
|
545
488
|
}
|
|
546
|
-
this.
|
|
547
|
-
}
|
|
489
|
+
await this.processMediaData(extractedData, newIndex);
|
|
490
|
+
}
|
|
548
491
|
}
|
|
549
|
-
|
|
492
|
+
catch (err) {
|
|
550
493
|
this.showImageLoader = false;
|
|
551
|
-
if (imageData && imageData['data']) {
|
|
552
|
-
return this.processMediaData(imageData['data'], newIndex);
|
|
553
|
-
}
|
|
554
|
-
if (imageData && imageData['path']) {
|
|
555
|
-
return this.processMediaData(imageData['path'], newIndex);
|
|
556
|
-
}
|
|
557
|
-
return this.processMediaData(imageData, newIndex);
|
|
558
494
|
}
|
|
559
|
-
}
|
|
560
|
-
|
|
495
|
+
};
|
|
496
|
+
await Promise.all(imagesData.map((data, index) => processImage(data, index)));
|
|
561
497
|
this.showImageLoader = false;
|
|
562
|
-
}
|
|
498
|
+
}
|
|
499
|
+
catch (err) {
|
|
500
|
+
this.showImageLoader = false;
|
|
501
|
+
throw new Error(err);
|
|
502
|
+
}
|
|
563
503
|
}
|
|
564
504
|
captureVideo(index) {
|
|
565
505
|
const options = { limit: 1, duration: this.duration || 60, saveToPhotoAlbum: true };
|
|
@@ -627,7 +567,7 @@ const YooFormCaptureComponent = class {
|
|
|
627
567
|
this.showPhotoTagDialog(ret.data).then((tag) => {
|
|
628
568
|
if (!overlays.isNullOrUndefined(tag === null || tag === void 0 ? void 0 : tag.data)) {
|
|
629
569
|
this.updateTagData(tag, index);
|
|
630
|
-
this.setFieldValue(
|
|
570
|
+
this.setFieldValue(ret.data);
|
|
631
571
|
this.clearPhotoEdit(index);
|
|
632
572
|
if (this.saveGeoloc) {
|
|
633
573
|
this.captureGeoloc();
|
|
@@ -636,7 +576,7 @@ const YooFormCaptureComponent = class {
|
|
|
636
576
|
});
|
|
637
577
|
}
|
|
638
578
|
else {
|
|
639
|
-
this.setFieldValue(
|
|
579
|
+
this.setFieldValue(ret.data);
|
|
640
580
|
this.clearPhotoEdit(index);
|
|
641
581
|
if (this.saveGeoloc) {
|
|
642
582
|
this.captureGeoloc();
|
|
@@ -736,7 +676,7 @@ const YooFormCaptureComponent = class {
|
|
|
736
676
|
}
|
|
737
677
|
else {
|
|
738
678
|
if (this.multiple && (newImages === null || newImages === void 0 ? void 0 : newImages.length) > 0) {
|
|
739
|
-
this.setFieldValue(
|
|
679
|
+
this.setFieldValue(newImages);
|
|
740
680
|
}
|
|
741
681
|
else if (newImages === null || newImages === void 0 ? void 0 : newImages.length) {
|
|
742
682
|
this.value = newImages[0];
|
|
@@ -799,17 +739,17 @@ const YooFormCaptureComponent = class {
|
|
|
799
739
|
const tag = await this.showPhotoTagDialog(data);
|
|
800
740
|
if (!overlays.isNullOrUndefined(tag === null || tag === void 0 ? void 0 : tag.data)) {
|
|
801
741
|
this.updateTagData(tag, index);
|
|
802
|
-
this.setFieldValue(
|
|
742
|
+
this.setFieldValue(data);
|
|
803
743
|
this.clearPhotoEdit(index);
|
|
804
744
|
}
|
|
805
745
|
}
|
|
806
746
|
else {
|
|
807
|
-
this.setFieldValue(
|
|
747
|
+
this.setFieldValue(data);
|
|
808
748
|
this.clearPhotoEdit(index);
|
|
809
749
|
}
|
|
810
750
|
}
|
|
811
751
|
else {
|
|
812
|
-
this.setFieldValue(
|
|
752
|
+
this.setFieldValue(f);
|
|
813
753
|
this.clearPhotoEdit(index);
|
|
814
754
|
}
|
|
815
755
|
targetElement.value = null;
|
|
@@ -1054,6 +994,8 @@ const YooFormCaptureComponent = class {
|
|
|
1054
994
|
overlays.showAlert('', [overlays.translate('YOOBICOK')], description);
|
|
1055
995
|
}
|
|
1056
996
|
async onShowActionSheet(value, index, event) {
|
|
997
|
+
var _a, _b, _c;
|
|
998
|
+
event === null || event === void 0 ? void 0 : event.stopImmediatePropagation();
|
|
1057
999
|
if (index && index < 0 && this.max && this.value && this.value.length === this.max) {
|
|
1058
1000
|
this.onShowMaximumCaptureReached();
|
|
1059
1001
|
return;
|
|
@@ -1161,7 +1103,7 @@ const YooFormCaptureComponent = class {
|
|
|
1161
1103
|
}
|
|
1162
1104
|
else if (buttons.length > 0) {
|
|
1163
1105
|
if (overlays.isWeb(this.host)) {
|
|
1164
|
-
overlays.showContextMenu(event, { multipleSelection: false, contentButtons: buttons, className: 'width-unset', hostElement: this.cameraContainerElement });
|
|
1106
|
+
overlays.showContextMenu(event, { multipleSelection: false, contentButtons: buttons, className: 'width-unset', hostElement: this.cameraContainerElement || ((_c = (_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector) === null || _c === void 0 ? void 0 : _c.call(_b, '.camera-container')) });
|
|
1165
1107
|
}
|
|
1166
1108
|
else {
|
|
1167
1109
|
overlays.showActionSheet(buttons, null, { heading: actionSheetTitle });
|
|
@@ -495,7 +495,7 @@ const YooFormDynamicComponent = class {
|
|
|
495
495
|
const videoValue = fieldData.value;
|
|
496
496
|
const videoElement = el;
|
|
497
497
|
if (videoValue) {
|
|
498
|
-
videoElement.setFieldValue(
|
|
498
|
+
videoElement.setFieldValue(videoValue);
|
|
499
499
|
}
|
|
500
500
|
break;
|
|
501
501
|
}
|
|
@@ -169,7 +169,7 @@ const YooFormTextAreaComponent = class {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
//Timeout here to wait until the content on the textarea get loaded and the textarea got its final size (to be refactored alongside with the component later on
|
|
172
|
-
setTimeout(() => {
|
|
172
|
+
!this.isRichText && setTimeout(() => {
|
|
173
173
|
this.updateTextareaSize();
|
|
174
174
|
}, 1000);
|
|
175
175
|
if (this.focusOnRendered) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cloudinary, downloadFile, getSession, isCloudinaryLink, isFieldWithNoValue, isFirefox, isImage, isNullOrUndefined, isPresent, isUnsplashUrl, isVideo, isWeb, parseMarkDown, replaceAllLinks, translate, translateMulti } from '@shared/utils';
|
|
2
2
|
import { Component, Element, Event, h, Host, Prop, State } from '@stencil/core';
|
|
3
|
-
import { compact, isEmpty, isNumber, isString } from 'lodash-es';
|
|
3
|
+
import { compact, isEmpty, isEqual, isNumber, isString } from 'lodash-es';
|
|
4
4
|
import { toggleElementTapped } from '../../../../utils/helpers/card-list-helpers';
|
|
5
5
|
import { execHandlerAndStopEvent, getAppContext, removeHtmlFromString, showPhotoEditor } from '../../../../utils/helpers/common-helpers';
|
|
6
6
|
const MAX_AVATAR_DISPLAY = 3;
|
|
@@ -319,8 +319,11 @@ export class YooCardListComponent {
|
|
|
319
319
|
!((_g = (_f = this.host) === null || _f === void 0 ? void 0 : _f.classList) === null || _g === void 0 ? void 0 : _g.contains('grid-cell'))) {
|
|
320
320
|
return (h("div", { class: "uifield-container" },
|
|
321
321
|
h("yoo-form-dynamic", { class: "inline in-card secondary transparent", scrollable: false, forceReadonly: !((_j = (_h = this.host) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.contains('form')), slides: [{ title: '', items: this.entry.uiFields.fields }], data: this.entry.uiFields.data, suffix: this.entry.uiFieldsSuffix, showTabs: false, formInputSize: "medium", showRecap: false, isPdf: this.entry.isPdf, onDataChanged: (ev) => {
|
|
322
|
+
var _a, _b;
|
|
322
323
|
ev.stopPropagation();
|
|
323
|
-
this.
|
|
324
|
+
if (!isEqual((_b = (_a = this.entry) === null || _a === void 0 ? void 0 : _a.uiFields) === null || _b === void 0 ? void 0 : _b.data, ev === null || ev === void 0 ? void 0 : ev.detail)) {
|
|
325
|
+
this.uiFieldsChanged.emit({ newdata: ev.detail });
|
|
326
|
+
}
|
|
324
327
|
} })));
|
|
325
328
|
}
|
|
326
329
|
}
|
|
@@ -37,15 +37,9 @@ export class YooFormCaptureComponent {
|
|
|
37
37
|
this.updateExtraData(extraData);
|
|
38
38
|
}
|
|
39
39
|
/** If there is index, the field is a multiphoto */
|
|
40
|
-
async setFieldValue(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const newValue = this.value ? [...this.value] : [];
|
|
46
|
-
newValue[index] = data;
|
|
47
|
-
setValueAndValidateInput(newValue, this);
|
|
48
|
-
}
|
|
40
|
+
async setFieldValue(data) {
|
|
41
|
+
this.multiple ? this.value.push(data) : this.value = data;
|
|
42
|
+
setValueAndValidateInput(this.value, this);
|
|
49
43
|
}
|
|
50
44
|
async stopImageRecognitionProcess(isCancelled = false) {
|
|
51
45
|
this.imageRecoCancelled = isCancelled;
|
|
@@ -237,7 +231,7 @@ export class YooFormCaptureComponent {
|
|
|
237
231
|
}
|
|
238
232
|
allowCrop(file) {
|
|
239
233
|
var _a;
|
|
240
|
-
return (((_a = this.cropperOptions) === null || _a === void 0 ? void 0 : _a.cropRatio) > 0 || this.showCropper) &&
|
|
234
|
+
return (((_a = this.cropperOptions) === null || _a === void 0 ? void 0 : _a.cropRatio) > 0 || this.showCropper) && isImage(file) && !isGif(file) && (!(typeof file === 'string' && isUnsplashUrl(file)) || isWeb(this.host));
|
|
241
235
|
}
|
|
242
236
|
removeAllCapture() {
|
|
243
237
|
this.value = [];
|
|
@@ -296,50 +290,34 @@ export class YooFormCaptureComponent {
|
|
|
296
290
|
}
|
|
297
291
|
}
|
|
298
292
|
}
|
|
299
|
-
processMediaData(mediaData, index
|
|
300
|
-
|
|
301
|
-
if (!mediaData) {
|
|
302
|
-
return (promise = Promise.resolve(mediaData));
|
|
303
|
-
}
|
|
304
|
-
if (mediaData && mediaData.indexOf('?') > 0) {
|
|
293
|
+
async processMediaData(mediaData, index) {
|
|
294
|
+
if (mediaData === null || mediaData === void 0 ? void 0 : mediaData.includes('?')) {
|
|
305
295
|
mediaData = mediaData.substring(0, mediaData.indexOf('?'));
|
|
306
296
|
}
|
|
307
|
-
if (mediaData && mediaData
|
|
308
|
-
promise = Promise.resolve(mediaData);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
297
|
+
else if (mediaData && !isImageUrl(mediaData)) {
|
|
311
298
|
mediaData = addFilePrefix(mediaData);
|
|
312
|
-
if (isAndroid() &&
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
299
|
+
if (!isAndroid() && ['cache', 'tmp'].includes(mediaData)) {
|
|
300
|
+
try {
|
|
301
|
+
mediaData = await moveToImageDirectory(mediaData, getSession().user ? getSession().user.disablePhotoOrientationAutoFix : false);
|
|
302
|
+
}
|
|
303
|
+
catch (err) {
|
|
304
|
+
throw new Error(err);
|
|
305
|
+
}
|
|
317
306
|
}
|
|
318
307
|
}
|
|
319
|
-
|
|
320
|
-
if (preventUpdateValue) {
|
|
321
|
-
return Promise.resolve(newPath);
|
|
322
|
-
}
|
|
308
|
+
try {
|
|
323
309
|
if (this.shouldTagImage()) {
|
|
324
|
-
this.showPhotoTagDialog(
|
|
325
|
-
|
|
326
|
-
this.updateTagData(tag, index);
|
|
327
|
-
this.setFieldValue(index, newPath);
|
|
328
|
-
this.clearPhotoEdit(index);
|
|
329
|
-
if (this.saveGeoloc) {
|
|
330
|
-
this.captureGeoloc(index);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
});
|
|
310
|
+
const tag = await this.showPhotoTagDialog(mediaData);
|
|
311
|
+
(tag === null || tag === void 0 ? void 0 : tag.data) && this.updateTagData(tag, index);
|
|
334
312
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
313
|
+
await this.setFieldValue(mediaData);
|
|
314
|
+
this.clearPhotoEdit(index);
|
|
315
|
+
this.saveGeoloc && this.captureGeoloc(index);
|
|
316
|
+
}
|
|
317
|
+
catch (err) {
|
|
318
|
+
throw new Error(err);
|
|
319
|
+
}
|
|
320
|
+
return mediaData;
|
|
343
321
|
}
|
|
344
322
|
showPhotoTagDialog(imageSrc, value) {
|
|
345
323
|
const imageTag = document.createElement('yoo-form-capture-tag-dialog');
|
|
@@ -466,75 +444,37 @@ export class YooFormCaptureComponent {
|
|
|
466
444
|
this.showImageLoader = false;
|
|
467
445
|
return;
|
|
468
446
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
const hasUnsplash = imagesData.some(d => isUnsplashUrl(d));
|
|
473
|
-
if (!imageData && this.showImageLoader) {
|
|
447
|
+
try {
|
|
448
|
+
const res = await promise;
|
|
449
|
+
if (!res && this.showImageLoader) {
|
|
474
450
|
this.showImageLoader = false;
|
|
475
451
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
let newIndex = index;
|
|
491
|
-
if (index < 0) {
|
|
492
|
-
newIndex = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
493
|
-
}
|
|
494
|
-
if (isMultiMode || useMediaCapture) {
|
|
495
|
-
const promises = imageData.map((d, ind) => {
|
|
496
|
-
return this.processMediaData(d.fullPath, newIndex >= 0 ? ind + newIndex : newIndex);
|
|
497
|
-
});
|
|
498
|
-
return Promise.all(promises).then(() => { });
|
|
499
|
-
}
|
|
500
|
-
else if (isArray(imageData)) {
|
|
501
|
-
const newArr = [];
|
|
502
|
-
let promises = [];
|
|
503
|
-
const preventUpdate = imageData.length !== 1;
|
|
504
|
-
if (preventUpdate) {
|
|
505
|
-
promises = imageData.map((imageSrc, i) => {
|
|
506
|
-
return this.processMediaData(imageSrc, null, preventUpdate).then((newImageSrc) => {
|
|
507
|
-
newArr[i] = newImageSrc;
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
promises = imageData.map((d, ind) => {
|
|
513
|
-
return this.processMediaData(d, ind + newIndex);
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
return Promise.all(promises).then(() => {
|
|
517
|
-
if (preventUpdate) {
|
|
518
|
-
this.value = [...[].concat(this.value), ...newArr];
|
|
519
|
-
setValueAndValidateInput(this.value, this);
|
|
452
|
+
const imagesData = Array.isArray(res) ? res : [res];
|
|
453
|
+
const hasUnsplash = imagesData.some(d => isUnsplashUrl(d));
|
|
454
|
+
const processImage = async (imageData, index) => {
|
|
455
|
+
var _a;
|
|
456
|
+
try {
|
|
457
|
+
let extractedData = (imageData === null || imageData === void 0 ? void 0 : imageData['data']) || (imageData === null || imageData === void 0 ? void 0 : imageData['path']) || (imageData === null || imageData === void 0 ? void 0 : imageData['fullPath']) || imageData;
|
|
458
|
+
if (!this.shouldTagImage()) {
|
|
459
|
+
const shouldOpenCropper = !hasUnsplash && imagesData.length === 1 && this.allowCrop(imageData);
|
|
460
|
+
const newIndex = Array.isArray(this.value) ? (_a = this.value) === null || _a === void 0 ? void 0 : _a.length : index;
|
|
461
|
+
if (shouldOpenCropper) {
|
|
462
|
+
extractedData = await this.onOpenCropper(imageData);
|
|
520
463
|
}
|
|
521
|
-
this.
|
|
522
|
-
}
|
|
464
|
+
await this.processMediaData(extractedData, newIndex);
|
|
465
|
+
}
|
|
523
466
|
}
|
|
524
|
-
|
|
467
|
+
catch (err) {
|
|
525
468
|
this.showImageLoader = false;
|
|
526
|
-
if (imageData && imageData['data']) {
|
|
527
|
-
return this.processMediaData(imageData['data'], newIndex);
|
|
528
|
-
}
|
|
529
|
-
if (imageData && imageData['path']) {
|
|
530
|
-
return this.processMediaData(imageData['path'], newIndex);
|
|
531
|
-
}
|
|
532
|
-
return this.processMediaData(imageData, newIndex);
|
|
533
469
|
}
|
|
534
|
-
}
|
|
535
|
-
|
|
470
|
+
};
|
|
471
|
+
await Promise.all(imagesData.map((data, index) => processImage(data, index)));
|
|
536
472
|
this.showImageLoader = false;
|
|
537
|
-
}
|
|
473
|
+
}
|
|
474
|
+
catch (err) {
|
|
475
|
+
this.showImageLoader = false;
|
|
476
|
+
throw new Error(err);
|
|
477
|
+
}
|
|
538
478
|
}
|
|
539
479
|
captureVideo(index) {
|
|
540
480
|
const options = { limit: 1, duration: this.duration || 60, saveToPhotoAlbum: true };
|
|
@@ -602,7 +542,7 @@ export class YooFormCaptureComponent {
|
|
|
602
542
|
this.showPhotoTagDialog(ret.data).then((tag) => {
|
|
603
543
|
if (!isNullOrUndefined(tag === null || tag === void 0 ? void 0 : tag.data)) {
|
|
604
544
|
this.updateTagData(tag, index);
|
|
605
|
-
this.setFieldValue(
|
|
545
|
+
this.setFieldValue(ret.data);
|
|
606
546
|
this.clearPhotoEdit(index);
|
|
607
547
|
if (this.saveGeoloc) {
|
|
608
548
|
this.captureGeoloc();
|
|
@@ -611,7 +551,7 @@ export class YooFormCaptureComponent {
|
|
|
611
551
|
});
|
|
612
552
|
}
|
|
613
553
|
else {
|
|
614
|
-
this.setFieldValue(
|
|
554
|
+
this.setFieldValue(ret.data);
|
|
615
555
|
this.clearPhotoEdit(index);
|
|
616
556
|
if (this.saveGeoloc) {
|
|
617
557
|
this.captureGeoloc();
|
|
@@ -711,7 +651,7 @@ export class YooFormCaptureComponent {
|
|
|
711
651
|
}
|
|
712
652
|
else {
|
|
713
653
|
if (this.multiple && (newImages === null || newImages === void 0 ? void 0 : newImages.length) > 0) {
|
|
714
|
-
this.setFieldValue(
|
|
654
|
+
this.setFieldValue(newImages);
|
|
715
655
|
}
|
|
716
656
|
else if (newImages === null || newImages === void 0 ? void 0 : newImages.length) {
|
|
717
657
|
this.value = newImages[0];
|
|
@@ -774,17 +714,17 @@ export class YooFormCaptureComponent {
|
|
|
774
714
|
const tag = await this.showPhotoTagDialog(data);
|
|
775
715
|
if (!isNullOrUndefined(tag === null || tag === void 0 ? void 0 : tag.data)) {
|
|
776
716
|
this.updateTagData(tag, index);
|
|
777
|
-
this.setFieldValue(
|
|
717
|
+
this.setFieldValue(data);
|
|
778
718
|
this.clearPhotoEdit(index);
|
|
779
719
|
}
|
|
780
720
|
}
|
|
781
721
|
else {
|
|
782
|
-
this.setFieldValue(
|
|
722
|
+
this.setFieldValue(data);
|
|
783
723
|
this.clearPhotoEdit(index);
|
|
784
724
|
}
|
|
785
725
|
}
|
|
786
726
|
else {
|
|
787
|
-
this.setFieldValue(
|
|
727
|
+
this.setFieldValue(f);
|
|
788
728
|
this.clearPhotoEdit(index);
|
|
789
729
|
}
|
|
790
730
|
targetElement.value = null;
|
|
@@ -1029,6 +969,8 @@ export class YooFormCaptureComponent {
|
|
|
1029
969
|
showAlert('', [translate('YOOBICOK')], description);
|
|
1030
970
|
}
|
|
1031
971
|
async onShowActionSheet(value, index, event) {
|
|
972
|
+
var _a, _b, _c;
|
|
973
|
+
event === null || event === void 0 ? void 0 : event.stopImmediatePropagation();
|
|
1032
974
|
if (index && index < 0 && this.max && this.value && this.value.length === this.max) {
|
|
1033
975
|
this.onShowMaximumCaptureReached();
|
|
1034
976
|
return;
|
|
@@ -1136,7 +1078,7 @@ export class YooFormCaptureComponent {
|
|
|
1136
1078
|
}
|
|
1137
1079
|
else if (buttons.length > 0) {
|
|
1138
1080
|
if (isWeb(this.host)) {
|
|
1139
|
-
showContextMenu(event, { multipleSelection: false, contentButtons: buttons, className: 'width-unset', hostElement: this.cameraContainerElement });
|
|
1081
|
+
showContextMenu(event, { multipleSelection: false, contentButtons: buttons, className: 'width-unset', hostElement: this.cameraContainerElement || ((_c = (_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector) === null || _c === void 0 ? void 0 : _c.call(_b, '.camera-container')) });
|
|
1140
1082
|
}
|
|
1141
1083
|
else {
|
|
1142
1084
|
showActionSheet(buttons, null, { heading: actionSheetTitle });
|
|
@@ -2837,13 +2779,10 @@ export class YooFormCaptureComponent {
|
|
|
2837
2779
|
},
|
|
2838
2780
|
"setFieldValue": {
|
|
2839
2781
|
"complexType": {
|
|
2840
|
-
"signature": "(
|
|
2782
|
+
"signature": "(data: any) => Promise<void>",
|
|
2841
2783
|
"parameters": [{
|
|
2842
2784
|
"tags": [],
|
|
2843
2785
|
"text": ""
|
|
2844
|
-
}, {
|
|
2845
|
-
"tags": [],
|
|
2846
|
-
"text": ""
|
|
2847
2786
|
}],
|
|
2848
2787
|
"references": {
|
|
2849
2788
|
"Promise": {
|
|
@@ -150,7 +150,7 @@ export class YooFormTextAreaComponent {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
//Timeout here to wait until the content on the textarea get loaded and the textarea got its final size (to be refactored alongside with the component later on
|
|
153
|
-
setTimeout(() => {
|
|
153
|
+
!this.isRichText && setTimeout(() => {
|
|
154
154
|
this.updateTextareaSize();
|
|
155
155
|
}, 1000);
|
|
156
156
|
if (this.focusOnRendered) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-53ad1641.js';
|
|
2
2
|
import './index-1abbeecd.js';
|
|
3
|
-
import { n as compact, y as isEmpty, q as isString, a as isNumber } from './lodash-653c0bcd.js';
|
|
3
|
+
import { n as compact, y as isEmpty, q as isString, a as isNumber, A as isEqual } from './lodash-653c0bcd.js';
|
|
4
4
|
import { t as toggleElementTapped } from './card-list-helpers-4e01192d.js';
|
|
5
5
|
import { e as showPhotoEditor, t as removeHtmlFromString, h as execHandlerAndStopEvent, g as getAppContext } from './common-helpers-bda026b8.js';
|
|
6
6
|
import { ai as isImage, ag as isVideo, aj as downloadFile, t as translate, A as isWeb, Z as translateMulti, ap as replaceAllLinks, av as isCloudinaryLink, dG as isUnsplashUrl, a3 as getSession, ax as parseMarkDown, aI as isPresent, U as Cloudinary, ej as isFieldWithNoValue, X as isNullOrUndefined, dT as isFirefox } from './overlays-0e0fc170.js';
|
|
@@ -272,8 +272,11 @@ const YooCardListComponent = class {
|
|
|
272
272
|
!((_e = (_d = this.host) === null || _d === void 0 ? void 0 : _d.classList) === null || _e === void 0 ? void 0 : _e.contains('map')) &&
|
|
273
273
|
!((_g = (_f = this.host) === null || _f === void 0 ? void 0 : _f.classList) === null || _g === void 0 ? void 0 : _g.contains('grid-cell'))) {
|
|
274
274
|
return (h("div", { class: "uifield-container" }, h("yoo-form-dynamic", { class: "inline in-card secondary transparent", scrollable: false, forceReadonly: !((_j = (_h = this.host) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.contains('form')), slides: [{ title: '', items: this.entry.uiFields.fields }], data: this.entry.uiFields.data, suffix: this.entry.uiFieldsSuffix, showTabs: false, formInputSize: "medium", showRecap: false, isPdf: this.entry.isPdf, onDataChanged: (ev) => {
|
|
275
|
+
var _a, _b;
|
|
275
276
|
ev.stopPropagation();
|
|
276
|
-
this.
|
|
277
|
+
if (!isEqual((_b = (_a = this.entry) === null || _a === void 0 ? void 0 : _a.uiFields) === null || _b === void 0 ? void 0 : _b.data, ev === null || ev === void 0 ? void 0 : ev.detail)) {
|
|
278
|
+
this.uiFieldsChanged.emit({ newdata: ev.detail });
|
|
279
|
+
}
|
|
277
280
|
} })));
|
|
278
281
|
}
|
|
279
282
|
}
|