Skip to content

Commit

Permalink
update: form input data
Browse files Browse the repository at this point in the history
  • Loading branch information
kainonly committed Apr 26, 2023
1 parent d61bd4c commit d355861
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 37 deletions.
4 changes: 2 additions & 2 deletions library/media/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PicturesService } from '../services/pictures.service';
import { VideosService } from '../services/videos.service';
import { WpxPicture, WpxVideo } from '../types';

export interface FormData {
export interface InputData {
doc: AnyDto<WpxPicture | WpxVideo>;
service: PicturesService | VideosService;
}
Expand All @@ -30,7 +30,7 @@ export class FormComponent implements OnInit {
};

constructor(
@Inject(NZ_MODAL_DATA) public data: FormData,
@Inject(NZ_MODAL_DATA) public data: InputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
Expand Down
4 changes: 2 additions & 2 deletions library/media/media.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NzImageService } from 'ng-zorro-antd/image';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef, NzModalService } from 'ng-zorro-antd/modal';

import { FormComponent, FormData } from './form/form.component';
import { FormComponent, InputData } from './form/form.component';
import { WpxMediaDataSource } from './media.data-source';
import { PictureComponent, ViewPictureData } from './picture/picture.component';
import { PicturesService } from './services/pictures.service';
Expand Down Expand Up @@ -135,7 +135,7 @@ export class WpxMediaComponent implements OnInit, AfterViewInit {

form(doc: AnyDto<WpxMedia>): void {
if (!this.wpxForm) {
this.modal.create<FormComponent, FormData>({
this.modal.create<FormComponent, InputData>({
nzTitle: $localize`编辑`,
nzContent: FormComponent,
nzData: {
Expand Down
4 changes: 2 additions & 2 deletions library/quick/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';

import { WpxQuickFormData } from '../types';
import { WpxQuickInputData } from '../types';

@Component({
selector: 'wpx-quick-form',
Expand All @@ -22,7 +22,7 @@ export class FormComponent implements OnInit {
};

constructor(
@Inject(NZ_MODAL_DATA) public data: WpxQuickFormData,
@Inject(NZ_MODAL_DATA) public data: WpxQuickInputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
Expand Down
6 changes: 3 additions & 3 deletions library/quick/quick.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';

import { FormComponent } from './form/form.component';
import { WpxQuickFormData, WpxQuick } from './types';
import { WpxQuickInputData, WpxQuick } from './types';

@Component({
selector: 'wpx-quick',
Expand Down Expand Up @@ -50,9 +50,9 @@ export class WpxQuickComponent {
this.getData(true);
}

form(doc?: AnyDto<any>): void {
form(doc?: AnyDto<WpxQuick>): void {
if (!this.wpxForm) {
this.modal.create<FormComponent, WpxQuickFormData>({
this.modal.create<FormComponent, WpxQuickInputData>({
nzTitle: !doc ? $localize`新增` : $localize`编辑`,
nzContent: FormComponent,
nzData: {
Expand Down
2 changes: 1 addition & 1 deletion library/quick/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface WpxQuick {
name: string;
}

export interface WpxQuickFormData {
export interface WpxQuickInputData {
api: WpxApi<WpxQuick>;
doc?: AnyDto<WpxQuick>;
}
4 changes: 2 additions & 2 deletions src/app/admin/orgs/users/developer/developer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TableField, WpxTableComponent } from '@weplanx/ng/table';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';

import { DeveloperFormData, FormComponent } from './form/form.component';
import { DeveloperInputData, FormComponent } from './form/form.component';

@Component({
selector: 'app-admin-orgs-users-developer',
Expand All @@ -32,7 +32,7 @@ export class DeveloperComponent {
) {}

form(doc?: AnyDto<User>): void {
this.modal.create<FormComponent, DeveloperFormData>({
this.modal.create<FormComponent, DeveloperInputData>({
nzTitle: !doc ? '创建' : `编辑【${doc.email}】`,
nzWidth: 640,
nzContent: FormComponent,
Expand Down
5 changes: 2 additions & 3 deletions src/app/admin/orgs/users/developer/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AnyDto, validates, WpxService } from '@weplanx/ng';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';

export interface DeveloperFormData {
export interface DeveloperInputData {
doc?: AnyDto<User>;
}

Expand All @@ -35,8 +35,7 @@ export class FormComponent implements OnInit {
passwordVisible = false;

constructor(
@Inject(NZ_MODAL_DATA)
public data: DeveloperFormData,
@Inject(NZ_MODAL_DATA) public data: DeveloperInputData,
public wpx: WpxService,
private modalRef: NzModalRef,
private message: NzMessageService,
Expand Down
5 changes: 2 additions & 3 deletions src/app/admin/space/projects/managed/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { nanoid } from 'nanoid';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';

export interface ManagedFormData {
export interface ManagedInputData {
doc?: AnyDto<Project>;
}

Expand Down Expand Up @@ -39,8 +39,7 @@ export class FormComponent implements OnInit {
};

constructor(
@Inject(NZ_MODAL_DATA)
private data: ManagedFormData,
@Inject(NZ_MODAL_DATA) public data: ManagedInputData,
public wpx: WpxService,
private modalRef: NzModalRef,
private message: NzMessageService,
Expand Down
4 changes: 2 additions & 2 deletions src/app/admin/space/projects/managed/managed.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AnyDto, WpxData, WpxService } from '@weplanx/ng';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';

import { FormComponent, ManagedFormData } from './form/form.component';
import { FormComponent, ManagedInputData } from './form/form.component';

@Component({
selector: 'app-admin-space-projects-managed',
Expand Down Expand Up @@ -56,7 +56,7 @@ export class ManagedComponent implements OnInit {
}

form(doc?: AnyDto<Project>): void {
this.modal.create<FormComponent, ManagedFormData>({
this.modal.create<FormComponent, ManagedInputData>({
nzTitle: !doc ? $localize`新增` : $localize`编辑`,
nzContent: FormComponent,
nzData: {
Expand Down
4 changes: 2 additions & 2 deletions src/app/common/components/pictures/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';

export interface FormData {
export interface InputData {
doc: AnyDto<Picture>;
}

Expand All @@ -30,7 +30,7 @@ export class FormComponent implements OnInit {
tagItems: Array<AnyDto<WpxQuick>> = [];

constructor(
@Inject(NZ_MODAL_DATA) public data: FormData,
@Inject(NZ_MODAL_DATA) public data: InputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
Expand Down
4 changes: 2 additions & 2 deletions src/app/common/components/pictures/pictures.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';

import { FormComponent, FormData } from '@common/components/pictures/form/form.component';
import { FormComponent, InputData } from '@common/components/pictures/form/form.component';
import { Picture } from '@common/interfaces/picture';
import { PictureTagsService } from '@common/services/picture-tags.service';
import { AnyDto } from '@weplanx/ng';
Expand Down Expand Up @@ -75,7 +75,7 @@ export class PicturesComponent implements OnInit {
}

form = (doc: AnyDto<Picture>): void => {
this.modal.create<FormComponent, FormData>({
this.modal.create<FormComponent, InputData>({
nzTitle: $localize`编辑`,
nzContent: FormComponent,
nzData: {
Expand Down
5 changes: 2 additions & 3 deletions src/app/common/components/richtext/richtext.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import {
ChangeDetectionStrategy,
Component,
forwardRef,
NgZone,
TemplateRef,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

import { PicturesComponent, PicturesData } from '@common/components/pictures/pictures.component';
import { PicturesComponent } from '@common/components/pictures/pictures.component';
import { VideosComponent } from '@common/components/videos/videos.component';
import { WpxService } from '@weplanx/ng';
import { WpxMediaData } from '@weplanx/ng/media';
Expand Down Expand Up @@ -41,7 +40,7 @@ export class RichtextComponent implements ControlValueAccessor {
onChanged!: (value: any) => void;
private onTouched!: () => void;

constructor(private modal: NzModalService, private wpx: WpxService, private zone: NgZone) {}
constructor(private modal: NzModalService, private wpx: WpxService) {}

registerOnChange(fn: any): void {
this.onChanged = fn;
Expand Down
4 changes: 2 additions & 2 deletions src/app/common/components/videos/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';

export interface FormData {
export interface InputData {
shop_id: string;
doc: AnyDto<Video>;
}
Expand All @@ -30,7 +30,7 @@ export class FormComponent implements OnInit {
tagItems: Array<AnyDto<VideoTag>> = [];

constructor(
@Inject(NZ_MODAL_DATA) public data: FormData,
@Inject(NZ_MODAL_DATA) public data: InputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

import { WpxQuickFormData } from '@weplanx/ng/quick';
import { WpxQuickInputData } from '@weplanx/ng/quick';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';

export interface TagFormData extends WpxQuickFormData {
export interface TagInputData extends WpxQuickInputData {
shop_id: string;
}

Expand All @@ -25,7 +25,7 @@ export class TagFormComponent implements OnInit {
};

constructor(
@Inject(NZ_MODAL_DATA) public data: TagFormData,
@Inject(NZ_MODAL_DATA) public data: TagInputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
Expand Down
8 changes: 4 additions & 4 deletions src/app/common/components/videos/videos.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { WpxQuick, WpxQuickComponent } from '@weplanx/ng/quick';
import { Transport } from '@weplanx/ng/upload';
import { NzModalService } from 'ng-zorro-antd/modal';

import { FormComponent, FormData } from './form/form.component';
import { TagFormComponent, TagFormData } from './tag-form/tag-form.component';
import { FormComponent, InputData } from './form/form.component';
import { TagFormComponent, TagInputData } from './tag-form/tag-form.component';

@Component({
selector: 'app-videos',
Expand Down Expand Up @@ -98,7 +98,7 @@ export class VideosComponent implements OnInit {
};

tagForm = (doc?: AnyDto<VideoTag>): void => {
this.modal.create<TagFormComponent, TagFormData>({
this.modal.create<TagFormComponent, TagInputData>({
nzTitle: !doc ? $localize`新增` : $localize`编辑`,
nzContent: TagFormComponent,
nzData: {
Expand All @@ -114,7 +114,7 @@ export class VideosComponent implements OnInit {
};

form = (doc: AnyDto<Video>): void => {
this.modal.create<FormComponent, FormData>({
this.modal.create<FormComponent, InputData>({
nzTitle: $localize`编辑`,
nzContent: FormComponent,
nzData: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/design/control/control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Component } from '@angular/core';
styleUrls: ['./control.component.scss']
})
export class ControlComponent {
panels = [
panels: any = [
{
active: true,
name: 'This is panel header 1',
Expand Down

0 comments on commit d355861

Please sign in to comment.