Skip to content

Commit

Permalink
feat(): fix package name
Browse files Browse the repository at this point in the history
  • Loading branch information
develite98 committed Dec 22, 2023
1 parent 127a3d0 commit 592eb64
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div class="mix-dialog --default-padding">
@if (loadingState() === 'Loading') {
<div class="p-4">
<default-skeleton></default-skeleton>
</div>
} @else {
<div class="mix-dialog__header">
{{ mode === 'create' ? 'Create' : 'Update' }} record from
{{ ref.data.mixDatabase.displayName }}
Expand Down Expand Up @@ -26,4 +31,7 @@
Save
</mix-button>
</div>
}


</div>
31 changes: 19 additions & 12 deletions libs/mix-share/src/components/record-form/record-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { MixApiFacadeService } from '@mixcore/share/api';
import { BaseComponent } from '@mixcore/share/base';
import { Utils } from '@mixcore/share/utils';
import { MixButtonComponent } from '@mixcore/ui/button';
import { MixDefaultSkeletonComponent } from '@mixcore/ui/skeleton';
import { DialogRef } from '@ngneat/dialog';
import { FormlyFieldConfig, FormlyModule } from '@ngx-formly/core';
import { TuiFileLike } from '@taiga-ui/kit';
import { delay, of } from 'rxjs';

@Component({
selector: 'mix-record-form',
Expand All @@ -24,14 +26,15 @@ import { TuiFileLike } from '@taiga-ui/kit';
ReactiveFormsModule,
FormlyModule,
MixButtonComponent,
MixDefaultSkeletonComponent,
],
templateUrl: './record-form.component.html',
styleUrls: ['./record-form.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class RecordFormComponent extends BaseComponent implements OnInit {
public static windowClass = 'mix-record-form-dialog';
public static windowClass = 'mix-record-form-dialog top-align-modal';
public static minWidth = '800px';
public static maxWidth = '95vw';

Expand Down Expand Up @@ -62,19 +65,23 @@ export class RecordFormComponent extends BaseComponent implements OnInit {
public mode: 'create' | 'update' = 'create';

ngOnInit() {
const db = this.ref.data.mixDatabase;
const data = this.ref.data.data ?? {};
this.mode = data ? 'update' : 'create';
of(this.ref.data.mixDatabase)
.pipe(delay(300), this.observerLoadingStateSignal())
.subscribe(() => {
const db = this.ref.data.mixDatabase;
const data = this.ref.data.data ?? {};
this.mode = data ? 'update' : 'create';

const { model, fields } = Utils.BuildDynamicFormField(
db.columns,
data,
this.uploadFileFn,
this.deleteFileFn
);
const { model, fields } = Utils.BuildDynamicFormField(
db.columns,
data,
this.uploadFileFn,
this.deleteFileFn
);

this.fields = fields;
this.modelData = model;
this.fields = fields;
this.modelData = model;
});
}

public onSaveData() {
Expand Down

1 comment on commit 592eb64

@vercel
Copy link

@vercel vercel bot commented on 592eb64 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.