@decaf-ts/for-angular 0.1.15 → 0.1.17
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.
|
@@ -3893,11 +3893,15 @@ class NgxRepositoryDirective extends DecafComponent {
|
|
|
3893
3893
|
if (!condition) {
|
|
3894
3894
|
condition = this.buildCondition();
|
|
3895
3895
|
}
|
|
3896
|
+
// !! use where condition will make paginator ignores sortBy and col name
|
|
3896
3897
|
return await this.repository
|
|
3897
3898
|
.select()
|
|
3898
|
-
.
|
|
3899
|
-
.orderBy([(this.sortBy || this.pk), sortDirection])
|
|
3899
|
+
.orderBy((this.sortBy || this.pk), sortDirection)
|
|
3900
3900
|
.paginate(limit);
|
|
3901
|
+
// .select()
|
|
3902
|
+
// .where(condition)
|
|
3903
|
+
// .orderBy([(this.sortBy || this.pk) as keyof M, sortDirection])
|
|
3904
|
+
// .paginate(limit);
|
|
3901
3905
|
}
|
|
3902
3906
|
async transactionBegin(data, repository, operation) {
|
|
3903
3907
|
try {
|
|
@@ -5671,7 +5675,7 @@ class NgxModelPageDirective extends NgxPageDirective {
|
|
|
5671
5675
|
if (result?.[this.pk]) {
|
|
5672
5676
|
this.modelId = result[this.pk];
|
|
5673
5677
|
}
|
|
5674
|
-
if (redirect) {
|
|
5678
|
+
if (redirect && !isModalChild) {
|
|
5675
5679
|
this.location.back();
|
|
5676
5680
|
}
|
|
5677
5681
|
}
|
|
@@ -5799,6 +5803,7 @@ class NgxRenderableComponentDirective extends NgxModelPageDirective {
|
|
|
5799
5803
|
component = this?.output?.component;
|
|
5800
5804
|
if (!this.instance && component)
|
|
5801
5805
|
this.instance = component;
|
|
5806
|
+
const isModalChild = this.instance?.['isModalChild'] ?? false;
|
|
5802
5807
|
if (this.instance && component) {
|
|
5803
5808
|
const componentKeys = Object.keys(this.instance);
|
|
5804
5809
|
for (const key of componentKeys) {
|
|
@@ -5810,6 +5815,7 @@ class NgxRenderableComponentDirective extends NgxModelPageDirective {
|
|
|
5810
5815
|
await this.handleEvent({
|
|
5811
5816
|
component: component.name || '',
|
|
5812
5817
|
name: key,
|
|
5818
|
+
isModalChild,
|
|
5813
5819
|
...event,
|
|
5814
5820
|
});
|
|
5815
5821
|
});
|
|
@@ -13640,37 +13646,52 @@ let FileUploadComponent = class FileUploadComponent extends NgxFormFieldDirectiv
|
|
|
13640
13646
|
async parseValue(revert = false) {
|
|
13641
13647
|
if (!revert) {
|
|
13642
13648
|
const files = this.files;
|
|
13643
|
-
if (
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
const
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13649
|
+
if (files?.length) {
|
|
13650
|
+
if (this.valueType === 'base64') {
|
|
13651
|
+
return JSON.stringify(await this.getDataURLs(files));
|
|
13652
|
+
}
|
|
13653
|
+
else {
|
|
13654
|
+
const data = [];
|
|
13655
|
+
for (const file of files) {
|
|
13656
|
+
const source = await this.getDataURLs(file);
|
|
13657
|
+
data.push({
|
|
13658
|
+
name: file.name,
|
|
13659
|
+
size: file.size,
|
|
13660
|
+
type: file.type,
|
|
13661
|
+
source,
|
|
13662
|
+
});
|
|
13663
|
+
}
|
|
13664
|
+
return JSON.stringify(data);
|
|
13656
13665
|
}
|
|
13657
|
-
return JSON.stringify(data);
|
|
13658
13666
|
}
|
|
13659
13667
|
}
|
|
13660
|
-
if (this.value
|
|
13668
|
+
if (this.value) {
|
|
13661
13669
|
try {
|
|
13662
|
-
|
|
13670
|
+
let value;
|
|
13671
|
+
try {
|
|
13672
|
+
value = JSON.parse(this.value);
|
|
13673
|
+
}
|
|
13674
|
+
catch (error) {
|
|
13675
|
+
value = this.value;
|
|
13676
|
+
}
|
|
13663
13677
|
const files = Array.isArray(value) ? value : [value];
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13678
|
+
if (files?.length) {
|
|
13679
|
+
this.files = files
|
|
13680
|
+
.map((file) => {
|
|
13681
|
+
if (this.isBase64String(file)) {
|
|
13682
|
+
const mime = this.getFileMime(file)?.split('/') || [];
|
|
13683
|
+
const type = mime?.[0] === 'text' ? mime?.[1] : `${mime?.[0]}/${mime?.[1]}`;
|
|
13684
|
+
return {
|
|
13685
|
+
name: mime?.[0] || 'file',
|
|
13686
|
+
type: `${type}` || 'image/*',
|
|
13687
|
+
source: file,
|
|
13688
|
+
};
|
|
13689
|
+
}
|
|
13690
|
+
return false;
|
|
13691
|
+
})
|
|
13692
|
+
.filter(Boolean);
|
|
13693
|
+
this.getPreview();
|
|
13694
|
+
}
|
|
13674
13695
|
}
|
|
13675
13696
|
catch (error) {
|
|
13676
13697
|
this.log.for(this.initialize).error(`Error parsing file list: ${error.message || error}`);
|