@yoobic/yobi 8.2.0-57 → 8.2.0-58
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/loader.cjs.js +1 -1
- package/dist/cjs/yoo-form-autocomplete.cjs.entry.js +25 -4
- package/dist/cjs/yoo-form-dynamic.cjs.entry.js +3 -2
- package/dist/collection/components/form/form-autocomplete/form-autocomplete.js +43 -4
- package/dist/collection/components/form/form-dynamic/form-dynamic.js +3 -2
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/yoo-form-autocomplete.entry.js +25 -4
- package/dist/design-system/yoo-form-dynamic.entry.js +3 -2
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/yoo-form-autocomplete.entry.js +25 -4
- package/dist/esm/yoo-form-dynamic.entry.js +3 -2
- package/dist/types/components/form/form-autocomplete/form-autocomplete.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
|
@@ -50,6 +50,7 @@ const YooFormAutocompleteComponent = class {
|
|
|
50
50
|
this.values = [];
|
|
51
51
|
this.pageSize = 20;
|
|
52
52
|
this.readonlyDisplay = 'inline';
|
|
53
|
+
this.preventUpload = false;
|
|
53
54
|
this.showDropdownContent = false;
|
|
54
55
|
this.selection = [];
|
|
55
56
|
this.showEmptyItemsAddNewTag = false;
|
|
@@ -735,6 +736,9 @@ const YooFormAutocompleteComponent = class {
|
|
|
735
736
|
let files = [].concat((ev === null || ev === void 0 ? void 0 : ev.detail) || []);
|
|
736
737
|
files = files.filter((f) => !f.invalid);
|
|
737
738
|
await this.uploadFiles(files);
|
|
739
|
+
if (this.preventUpload) {
|
|
740
|
+
this.fileUploader.removeFiles();
|
|
741
|
+
}
|
|
738
742
|
}
|
|
739
743
|
onFileSelect(ev) {
|
|
740
744
|
if (ev) {
|
|
@@ -753,11 +757,11 @@ const YooFormAutocompleteComponent = class {
|
|
|
753
757
|
promise = commonHelpers.showImageCropper({ file }).then((retVal) => retVal);
|
|
754
758
|
}
|
|
755
759
|
else {
|
|
756
|
-
promise = index$1.resizeImage(file, this.maxWidth, this.maxHeight).then(f => f);
|
|
760
|
+
promise = index$1.resizeImage(file, this.maxWidth, this.maxHeight).then(f => this.preventUpload ? f : { data: f });
|
|
757
761
|
}
|
|
758
762
|
}
|
|
759
763
|
else {
|
|
760
|
-
promise = Promise.resolve(file);
|
|
764
|
+
promise = Promise.resolve(this.preventUpload ? file : { data: file });
|
|
761
765
|
}
|
|
762
766
|
}
|
|
763
767
|
else {
|
|
@@ -773,11 +777,28 @@ const YooFormAutocompleteComponent = class {
|
|
|
773
777
|
}
|
|
774
778
|
const filePromises = files.map((file) => {
|
|
775
779
|
file.filename = index$1.getRandomFileName(file.filename);
|
|
776
|
-
|
|
780
|
+
if (this.preventUpload) {
|
|
781
|
+
file.tag = index$2.FormFieldType.documentuploader;
|
|
782
|
+
}
|
|
777
783
|
return () => imageProcessPromise(file);
|
|
778
784
|
});
|
|
779
785
|
return index$1.asyncWaterfall(filePromises)
|
|
780
|
-
.then(retVal =>
|
|
786
|
+
.then(retVal => {
|
|
787
|
+
if (retVal && !this.preventUpload) {
|
|
788
|
+
if (this.multiple) {
|
|
789
|
+
this.fetchCustomData.emit(retVal === null || retVal === void 0 ? void 0 : retVal.map((item) => (item === null || item === void 0 ? void 0 : item.data) || item));
|
|
790
|
+
}
|
|
791
|
+
else if (retVal[0]) {
|
|
792
|
+
this.fetchCustomData.emit(retVal[0].data || retVal[0]);
|
|
793
|
+
}
|
|
794
|
+
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
795
|
+
this.isUploading = true;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
else if (retVal) {
|
|
799
|
+
this.setValueAndValidateInput(this.multiple ? [...(this.selection || []), ...retVal] : retVal[0]);
|
|
800
|
+
}
|
|
801
|
+
})
|
|
781
802
|
.catch(async () => await index$1.showAlert(index$1.translate('FILE'), [index$1.translate('YOOBICOK')], index$1.translate('FILEERROR')));
|
|
782
803
|
}
|
|
783
804
|
getReadonlyItemSelection() {
|
|
@@ -3420,7 +3420,8 @@ const YooFormDynamicComponent = class {
|
|
|
3420
3420
|
'extraClass',
|
|
3421
3421
|
'dynamicOrdering',
|
|
3422
3422
|
'origin',
|
|
3423
|
-
'entityMapping'
|
|
3423
|
+
'entityMapping',
|
|
3424
|
+
'preventUpload'
|
|
3424
3425
|
];
|
|
3425
3426
|
let extraClass = this.isLivePreview() ? 'live-preview-autocomplete' : null;
|
|
3426
3427
|
if (this.isPdf) {
|
|
@@ -4099,7 +4100,7 @@ const YooFormDynamicComponent = class {
|
|
|
4099
4100
|
}
|
|
4100
4101
|
else {
|
|
4101
4102
|
TagType = 'yoo-form-document';
|
|
4102
|
-
const document = (field.type === index.FormFieldType.document || field.type === index.FormFieldType.podcast ? field.document : field.image) || value;
|
|
4103
|
+
const document = (field.type === index.FormFieldType.document || field.type === index.FormFieldType.podcast ? field.document : field.image) || (lodash.isObject(value) ? value : null);
|
|
4103
4104
|
extraAttrs = {
|
|
4104
4105
|
allowOrientation: this.isLesson(),
|
|
4105
4106
|
type: field.type === index.FormFieldType.document || field.type === index.FormFieldType.podcast ? 'document' : 'image',
|
|
@@ -30,6 +30,7 @@ export class YooFormAutocompleteComponent {
|
|
|
30
30
|
this.values = [];
|
|
31
31
|
this.pageSize = 20;
|
|
32
32
|
this.readonlyDisplay = 'inline';
|
|
33
|
+
this.preventUpload = false;
|
|
33
34
|
this.showDropdownContent = false;
|
|
34
35
|
this.selection = [];
|
|
35
36
|
this.showEmptyItemsAddNewTag = false;
|
|
@@ -715,6 +716,9 @@ export class YooFormAutocompleteComponent {
|
|
|
715
716
|
let files = [].concat((ev === null || ev === void 0 ? void 0 : ev.detail) || []);
|
|
716
717
|
files = files.filter((f) => !f.invalid);
|
|
717
718
|
await this.uploadFiles(files);
|
|
719
|
+
if (this.preventUpload) {
|
|
720
|
+
this.fileUploader.removeFiles();
|
|
721
|
+
}
|
|
718
722
|
}
|
|
719
723
|
onFileSelect(ev) {
|
|
720
724
|
if (ev) {
|
|
@@ -733,11 +737,11 @@ export class YooFormAutocompleteComponent {
|
|
|
733
737
|
promise = showImageCropper({ file }).then((retVal) => retVal);
|
|
734
738
|
}
|
|
735
739
|
else {
|
|
736
|
-
promise = resizeImage(file, this.maxWidth, this.maxHeight).then(f => f);
|
|
740
|
+
promise = resizeImage(file, this.maxWidth, this.maxHeight).then(f => this.preventUpload ? f : { data: f });
|
|
737
741
|
}
|
|
738
742
|
}
|
|
739
743
|
else {
|
|
740
|
-
promise = Promise.resolve(file);
|
|
744
|
+
promise = Promise.resolve(this.preventUpload ? file : { data: file });
|
|
741
745
|
}
|
|
742
746
|
}
|
|
743
747
|
else {
|
|
@@ -753,11 +757,28 @@ export class YooFormAutocompleteComponent {
|
|
|
753
757
|
}
|
|
754
758
|
const filePromises = files.map((file) => {
|
|
755
759
|
file.filename = getRandomFileName(file.filename);
|
|
756
|
-
|
|
760
|
+
if (this.preventUpload) {
|
|
761
|
+
file.tag = FormFieldType.documentuploader;
|
|
762
|
+
}
|
|
757
763
|
return () => imageProcessPromise(file);
|
|
758
764
|
});
|
|
759
765
|
return asyncWaterfall(filePromises)
|
|
760
|
-
.then(retVal =>
|
|
766
|
+
.then(retVal => {
|
|
767
|
+
if (retVal && !this.preventUpload) {
|
|
768
|
+
if (this.multiple) {
|
|
769
|
+
this.fetchCustomData.emit(retVal === null || retVal === void 0 ? void 0 : retVal.map((item) => (item === null || item === void 0 ? void 0 : item.data) || item));
|
|
770
|
+
}
|
|
771
|
+
else if (retVal[0]) {
|
|
772
|
+
this.fetchCustomData.emit(retVal[0].data || retVal[0]);
|
|
773
|
+
}
|
|
774
|
+
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
775
|
+
this.isUploading = true;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else if (retVal) {
|
|
779
|
+
this.setValueAndValidateInput(this.multiple ? [...(this.selection || []), ...retVal] : retVal[0]);
|
|
780
|
+
}
|
|
781
|
+
})
|
|
761
782
|
.catch(async () => await showAlert(translate('FILE'), [translate('YOOBICOK')], translate('FILEERROR')));
|
|
762
783
|
}
|
|
763
784
|
getReadonlyItemSelection() {
|
|
@@ -2528,6 +2549,24 @@ export class YooFormAutocompleteComponent {
|
|
|
2528
2549
|
"tags": [],
|
|
2529
2550
|
"text": ""
|
|
2530
2551
|
}
|
|
2552
|
+
},
|
|
2553
|
+
"preventUpload": {
|
|
2554
|
+
"type": "boolean",
|
|
2555
|
+
"mutable": false,
|
|
2556
|
+
"complexType": {
|
|
2557
|
+
"original": "boolean",
|
|
2558
|
+
"resolved": "boolean",
|
|
2559
|
+
"references": {}
|
|
2560
|
+
},
|
|
2561
|
+
"required": false,
|
|
2562
|
+
"optional": true,
|
|
2563
|
+
"docs": {
|
|
2564
|
+
"tags": [],
|
|
2565
|
+
"text": ""
|
|
2566
|
+
},
|
|
2567
|
+
"attribute": "prevent-upload",
|
|
2568
|
+
"reflect": false,
|
|
2569
|
+
"defaultValue": "false"
|
|
2531
2570
|
}
|
|
2532
2571
|
}; }
|
|
2533
2572
|
static get states() { return {
|
|
@@ -3283,7 +3283,8 @@ export class YooFormDynamicComponent {
|
|
|
3283
3283
|
'extraClass',
|
|
3284
3284
|
'dynamicOrdering',
|
|
3285
3285
|
'origin',
|
|
3286
|
-
'entityMapping'
|
|
3286
|
+
'entityMapping',
|
|
3287
|
+
'preventUpload'
|
|
3287
3288
|
];
|
|
3288
3289
|
let extraClass = this.isLivePreview() ? 'live-preview-autocomplete' : null;
|
|
3289
3290
|
if (this.isPdf) {
|
|
@@ -3964,7 +3965,7 @@ export class YooFormDynamicComponent {
|
|
|
3964
3965
|
}
|
|
3965
3966
|
else {
|
|
3966
3967
|
TagType = 'yoo-form-document';
|
|
3967
|
-
const document = (field.type === FormFieldType.document || field.type === FormFieldType.podcast ? field.document : field.image) || value;
|
|
3968
|
+
const document = (field.type === FormFieldType.document || field.type === FormFieldType.podcast ? field.document : field.image) || (isObject(value) ? value : null);
|
|
3968
3969
|
extraAttrs = {
|
|
3969
3970
|
allowOrientation: this.isLesson(),
|
|
3970
3971
|
type: field.type === FormFieldType.document || field.type === FormFieldType.podcast ? 'document' : 'image',
|