@fuentis/phoenix-ui 0.0.9-alpha.301 → 0.0.9-alpha.302
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.
|
@@ -3531,8 +3531,6 @@ class BaseMetaField {
|
|
|
3531
3531
|
changeSubs$;
|
|
3532
3532
|
ngOnInit() {
|
|
3533
3533
|
this.ctrl = this.parentForm.get(this.control.configuration.key);
|
|
3534
|
-
console.log(this.ctrl);
|
|
3535
|
-
console.log(this.value);
|
|
3536
3534
|
}
|
|
3537
3535
|
getInputValue(event) {
|
|
3538
3536
|
if (event.value) {
|
|
@@ -5885,15 +5883,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5885
5883
|
|
|
5886
5884
|
class MetaUploadComponentDragDrop extends BaseMetaField {
|
|
5887
5885
|
fileInput;
|
|
5886
|
+
fakeFile;
|
|
5887
|
+
createFakeFile(name, size, type = 'application/pdf') {
|
|
5888
|
+
const emptyBuffer = new ArrayBuffer(size);
|
|
5889
|
+
const blob = new Blob([emptyBuffer], { type });
|
|
5890
|
+
return new File([blob], name, {
|
|
5891
|
+
type: type,
|
|
5892
|
+
lastModified: Date.now(),
|
|
5893
|
+
});
|
|
5894
|
+
}
|
|
5888
5895
|
choose(event, callback) {
|
|
5889
5896
|
callback();
|
|
5890
5897
|
}
|
|
5898
|
+
ngAfterViewInit() {
|
|
5899
|
+
const { fileName, size, type } = this.ctrl.value;
|
|
5900
|
+
console.log(this.ctrl.value);
|
|
5901
|
+
this.fakeFile = this.createFakeFile(fileName, size, type);
|
|
5902
|
+
console.log(this.fakeFile);
|
|
5903
|
+
this.file = this.fakeFile;
|
|
5904
|
+
}
|
|
5891
5905
|
onFileSelect(event) {
|
|
5892
|
-
// Get the first file from the selection
|
|
5893
5906
|
const selectedFile = event.files?.[0] || event.currentFiles?.[0];
|
|
5894
5907
|
if (selectedFile) {
|
|
5895
5908
|
this.file = selectedFile;
|
|
5896
|
-
// Important: Update the form control value
|
|
5897
5909
|
this.onChanged(selectedFile);
|
|
5898
5910
|
this.onTouched();
|
|
5899
5911
|
}
|
|
@@ -5919,7 +5931,7 @@ class MetaUploadComponentDragDrop extends BaseMetaField {
|
|
|
5919
5931
|
this.fileInput.nativeElement.click();
|
|
5920
5932
|
}
|
|
5921
5933
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MetaUploadComponentDragDrop, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
5922
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
5934
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: MetaUploadComponentDragDrop, isStandalone: true, selector: "phoenix-meta-upload-dragdrop", providers: [
|
|
5923
5935
|
{
|
|
5924
5936
|
provide: NG_VALUE_ACCESSOR,
|
|
5925
5937
|
useExisting: forwardRef(() => MetaUploadComponentDragDrop),
|
|
@@ -5966,6 +5978,22 @@ class MetaUploadComponentDragDrop extends BaseMetaField {
|
|
|
5966
5978
|
</div>
|
|
5967
5979
|
</ng-template>
|
|
5968
5980
|
<ng-template #empty>
|
|
5981
|
+
@if(ctrl.value){
|
|
5982
|
+
<div class="flex align-items-center justify-content-between w-full">
|
|
5983
|
+
<div>
|
|
5984
|
+
<div>{{ ctrl.value['fileName'] }}</div>
|
|
5985
|
+
<div>{{ ctrl.value['size'] }} KB</div>
|
|
5986
|
+
</div>
|
|
5987
|
+
<p-button
|
|
5988
|
+
icon="pi pi-times"
|
|
5989
|
+
[rounded]="true"
|
|
5990
|
+
[text]="true"
|
|
5991
|
+
severity="danger"
|
|
5992
|
+
(onClick)="onFileRemove($event)"
|
|
5993
|
+
/>
|
|
5994
|
+
</div>
|
|
5995
|
+
|
|
5996
|
+
} @else{
|
|
5969
5997
|
<div class="text-center">
|
|
5970
5998
|
<div>
|
|
5971
5999
|
<i
|
|
@@ -5977,6 +6005,7 @@ class MetaUploadComponentDragDrop extends BaseMetaField {
|
|
|
5977
6005
|
</p>
|
|
5978
6006
|
</div>
|
|
5979
6007
|
</div>
|
|
6008
|
+
}
|
|
5980
6009
|
</ng-template>
|
|
5981
6010
|
</p-fileUpload>
|
|
5982
6011
|
<phoenix-inline-field-error
|
|
@@ -6040,6 +6069,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
6040
6069
|
</div>
|
|
6041
6070
|
</ng-template>
|
|
6042
6071
|
<ng-template #empty>
|
|
6072
|
+
@if(ctrl.value){
|
|
6073
|
+
<div class="flex align-items-center justify-content-between w-full">
|
|
6074
|
+
<div>
|
|
6075
|
+
<div>{{ ctrl.value['fileName'] }}</div>
|
|
6076
|
+
<div>{{ ctrl.value['size'] }} KB</div>
|
|
6077
|
+
</div>
|
|
6078
|
+
<p-button
|
|
6079
|
+
icon="pi pi-times"
|
|
6080
|
+
[rounded]="true"
|
|
6081
|
+
[text]="true"
|
|
6082
|
+
severity="danger"
|
|
6083
|
+
(onClick)="onFileRemove($event)"
|
|
6084
|
+
/>
|
|
6085
|
+
</div>
|
|
6086
|
+
|
|
6087
|
+
} @else{
|
|
6043
6088
|
<div class="text-center">
|
|
6044
6089
|
<div>
|
|
6045
6090
|
<i
|
|
@@ -6051,6 +6096,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
6051
6096
|
</p>
|
|
6052
6097
|
</div>
|
|
6053
6098
|
</div>
|
|
6099
|
+
}
|
|
6054
6100
|
</ng-template>
|
|
6055
6101
|
</p-fileUpload>
|
|
6056
6102
|
<phoenix-inline-field-error
|