ngx-formly-zorro-antd 14.1.0 → 14.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-formly-zorro-antd-upload.mjs","sources":["../../../../packages/formlyantd/upload/src/upload.component.ts","../../../../packages/formlyantd/upload/src/upload.type.ts","../../../../packages/formlyantd/upload/src/upload.module.ts","../../../../packages/formlyantd/upload/src/ngx-formly-zorro-antd-upload.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport {\n ChangeDetectionStrategy,\n Component,\n Input,\n ViewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { OnChangeType, OnTouchedType, NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { NzUploadChangeParam, NzUploadComponent, NzUploadFile } from 'ng-zorro-antd/upload';\n\n@Component({\n selector: 'formly-upload',\n template: `\n <nz-upload\n [nzAccept]=\"nzAccept\"\n [nzAction]=\"nzAction\"\n [nzDirectory]=\"nzDirectory\"\n [nzBeforeUpload]=\"nzBeforeUpload\"\n [nzCustomRequest]=\"nzCustomRequest\"\n [nzData]=\"nzData\"\n [(nzFileList)]=\"nzFileList\"\n [nzLimit]=\"nzLimit\"\n [nzSize]=\"nzSize\"\n [nzFileType]=\"nzFileType\"\n [nzFilter]=\"nzFilter\"\n [nzHeaders]=\"nzHeaders\"\n [nzListType]=\"nzListType\"\n [nzMultiple]=\"nzMultiple\"\n [nzName]=\"nzName\"\n [nzShowUploadList]=\"nzShowUploadList\"\n [nzShowButton]=\"nzShowButton\"\n [nzWithCredentials]=\"nzWithCredentials\"\n [nzOpenFileDialogOnClick]=\"nzOpenFileDialogOnClick\"\n [nzPreview]=\"nzPreview\"\n [nzPreviewFile]=\"nzPreviewFile\"\n [nzPreviewIsImage]=\"nzPreviewIsImage\"\n [nzRemove]=\"nzRemove\"\n [nzDownload]=\"nzDownload\"\n [nzTransformFile]=\"nzTransformFile\"\n [nzIconRender]=\"nzIconRender\"\n [nzFileListRender]=\"nzFileListRender\"\n [ngClass]=\"className\"\n (nzChange)=\"change($event)\"\n [nzType]=\"nzType\"\n (nzFileListChange)=\"fileListChange($event)\"\n >\n <ng-container *ngIf=\"text; else buttontext\">\n <button nz-button type=\"button\">\n <i nz-icon nzType=\"upload\"></i>\n {{ text }}\n </button>\n </ng-container>\n\n <ng-template #buttontext>\n <button nz-button type=\"button\">\n <i nz-icon nzType=\"upload\"></i>\n </button>\n </ng-template>\n </nz-upload>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: UploadComponent,\n multi: true\n }\n ]\n})\nexport class UploadComponent extends NzUploadComponent implements ControlValueAccessor {\n @ViewChild('upload', { static: true }) transfer!: NzUploadComponent;\n\n /**\n * 按钮文本\n * @default 点击上传\n */\n @Input() text?: string;\n /**\n * 样式名\n */\n @Input() className = '';\n @Input() resultMap?: (items: NzUploadFile[]) => NzSafeAny[];\n\n onChange: OnChangeType = () => {};\n onTouched: OnTouchedType = () => {};\n writeValue(): void {}\n registerOnChange(fn: NzSafeAny): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: NzSafeAny): void {\n this.onTouched = fn;\n }\n setDisabledState?(isDisabled: boolean): void {\n this.nzDisabled = isDisabled;\n }\n\n fileListChange(list: NzUploadFile[]) {\n this.nzFileListChange.emit(list);\n }\n\n change(value: NzUploadChangeParam) {\n this.nzChange.emit(value);\n if (['removed', 'success'].includes(value.type ?? '')) {\n if (this.resultMap instanceof Function) {\n this.onChange(this.resultMap(value.fileList.filter(x => x.status === 'done')));\n } else {\n this.onChange(value.fileList.filter(x => x.status === 'done'));\n }\n }\n }\n}\n","import {\n Component,\n ChangeDetectionStrategy,\n TemplateRef,\n Type,\n ViewChild,\n OnInit\n} from '@angular/core';\nimport { FieldType, FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core';\nimport { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';\n\nimport { Observable, Subscription } from 'rxjs';\nimport {\n NzUploadComponent,\n NzUploadType,\n NzUploadChangeParam,\n NzUploadFile,\n NzUploadTransformFileType,\n UploadFilter,\n NzIconRenderTemplate,\n NzUploadListType\n} from 'ng-zorro-antd/upload';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\ninterface UploadProps extends FormlyFieldProps {\n /**\n * 接受上传的文件类型, 详见 input accept Attribute\n */\n accept?: string | string[];\n\n /**\n * 必选参数, 上传的地址\n */\n action?: string | ((file: NzUploadFile) => string | Observable<string>);\n\n /**\n * 支持上传文件夹(caniuse)\n * @default false\n */\n directory?: boolean;\n\n /**\n * 上传文件之前的钩子,参数为上传的文件,若返回 false 则停止上传。注意:IE9 不支持该方法;注意:务必使用 => 定义处理方法。\n */\n beforeUpload?: (file: NzUploadFile, fileList: NzUploadFile[]) => boolean | Observable<boolean>;\n\n /**\n * 通过覆盖默认的上传行为,可以自定义自己的上传实现;注意:务必使用 => 定义处理方法。\n */\n customRequest?: (item: NzSafeAny) => Subscription;\n\n /**\n * 上传所需参数或返回上传参数的方法;注意:务必使用 => 定义处理方法。\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n data?: Object | ((file: NzUploadFile) => Object | Observable<{}>);\n\n /**\n * 文件列表,双向绑定\n */\n fileList?: NzUploadFile[];\n\n /**\n * 限制单次最多上传数量,nzMultiple 打开时有效;0 表示不限\n * @default 0\n */\n limit?: number;\n\n /**\n * 限制文件大小,单位:KB;0 表示不限\n * @default 0\n */\n size?: number;\n\n /**\n * 限制文件类型,例如:image/png,image/jpeg,image/gif,image/bmp\n */\n fileType?: string;\n\n /**\n * 自定义过滤器\n */\n filter?: UploadFilter[];\n\n /**\n * 设置上传的请求头部,IE10 以上有效;注意:务必使用 => 定义处理方法。\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n headers?: Object | ((file: NzUploadFile) => Object | Observable<{}>);\n\n /**\n * 上传列表的内建样式,支持三种基本样式 text, picture 和 picture-card\n * @default text\n */\n listType?: NzUploadListType;\n\n /**\n * 是否支持多选文件,ie10+ 支持。开启后按住 ctrl 可选择多个文件。\n * @default false;\n */\n multiple?: boolean;\n\n /**\n * 发到后台的文件参数名\n * @default file\n */\n name?: string;\n\n /**\n * 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon,showRemoveIcon 和 showDownloadIcon\n * @default true\n */\n showUploadList?:\n | boolean\n | { showPreviewIcon?: boolean; showRemoveIcon?: boolean; showDownloadIcon?: boolean };\n\n /**\n * 是否展示上传按钮\n * @default true\n */\n showButton?: boolean;\n\n /**\n * 上传请求时是否携带 cookie\n * @default false\n */\n withCredentials?: boolean;\n\n /**\n * 点击打开文件对话框\n * @default true\n */\n openFileDialogOnClick?: boolean;\n\n /**\n * 点击文件链接或预览图标时的回调;注意:务必使用 => 定义处理方法。\n */\n preview?: (file: NzUploadFile) => void;\n\n /**\n * 自定义文件预览逻辑;注意:务必使用 => 定义处理方法。\n */\n previewFile?: (file: NzUploadFile) => Observable<string>;\n\n /**\n * 自定义预览文件是否有效图像,一般用于图像URL为非标准格式;注意:务必使用 => 定义处理方法。\n */\n previewIsImage?: (file: NzUploadFile) => boolean;\n\n /**\n * 点击移除文件时的回调,返回值为 false 时不移除。支持返回 Observable 对象;注意:务必使用 => 定义处理方法。\n */\n remove?: (file: NzUploadFile) => boolean | Observable<boolean>;\n\n /**\n * 上传文件改变时的状态\n */\n onChange?: (value: NzUploadChangeParam) => void;\n\n /**\n * 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页\n * @default 跳转新标签页\n */\n download?: (file: NzUploadFile) => void;\n\n /**\n * 在上传之前转换文件。支持返回一个 Observable 对象\n */\n transformFile?: (file: NzUploadFile) => NzUploadTransformFileType;\n\n /**\n * 自定义显示 icon\n */\n iconRender?: NzIconRenderTemplate | null;\n\n /**\n * 自定义显示整个列表\n */\n fileListRender?: TemplateRef<void> | null;\n\n /**\n * 按钮文本\n * @default 点击上传\n */\n text?: string;\n\n /**\n * 文件列表改变事件\n */\n fileListChange?: (list: NzUploadFile[]) => void;\n\n /**\n * 返回结果格式映射\n * @returns 默认返回 NzUploadFile[] 格式\n */\n resultMap?: (items: NzUploadFile[]) => NzSafeAny[];\n}\n\nexport interface FormlyUploadFieldConfig extends FormlyFieldConfig<UploadProps> {\n type: 'upload' | Type<FormlyFieldUpload>;\n}\n\n@Component({\n selector: 'formly-field-upload',\n template: `<formly-upload\n #upload\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [nzAccept]=\"props['accept']\"\n [nzAction]=\"props['action']\"\n [nzDirectory]=\"props['directory']!!\"\n [nzBeforeUpload]=\"props['beforeUpload']\"\n [nzCustomRequest]=\"props['customRequest']\"\n [nzData]=\"props['data']\"\n [(nzFileList)]=\"props['fileList']\"\n [nzLimit]=\"props['limit']\"\n [nzSize]=\"props['size']\"\n [nzFileType]=\"props['fileType']\"\n [nzFilter]=\"props['filter']!\"\n [nzHeaders]=\"props['headers']\"\n [nzListType]=\"props['listType']!\"\n [nzMultiple]=\"props['multiple']!!\"\n [nzName]=\"props['name']!\"\n [nzShowUploadList]=\"props['showUploadList']\"\n [nzShowButton]=\"props['showButton']!!\"\n [nzWithCredentials]=\"props['withCredentials']!!\"\n [nzOpenFileDialogOnClick]=\"props['openFileDialogOnClick']!!\"\n [nzPreview]=\"props['preview']\"\n [nzPreviewFile]=\"props['previewFile']\"\n [nzPreviewIsImage]=\"props['previewIsImage']\"\n [nzRemove]=\"props['remove']\"\n (nzChange)=\"props['change'] && props['change']($event)\"\n [nzDownload]=\"props['download']\"\n [nzTransformFile]=\"props['transformFile']\"\n [nzIconRender]=\"props['iconRender'] ?? null\"\n [nzFileListRender]=\"props['fileListRender'] ?? null\"\n [text]=\"props['text']\"\n [className]=\"props['className']\"\n (nzFileListChange)=\"props['fileListChange'] && props['fileListChange']($event)\"\n [resultMap]=\"props['resultMap']\"\n >\n </formly-upload>`,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormlyFieldUpload extends FieldType<FieldTypeConfig> implements OnInit {\n override defaultOptions = {\n props: {\n listType: 'text' as const,\n name: 'file',\n showUploadList: true,\n showButton: true,\n openFileDialogOnClick: true,\n limit: 0,\n size: 0,\n filter: [],\n text: ''\n }\n };\n\n @ViewChild('upload', { static: true }) upload!: NzUploadComponent;\n\n ngOnInit(): void {\n const type = this.props.type;\n if (type) {\n this.upload.nzType = type as NzUploadType;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlyNzFormFieldModule } from 'ngx-formly-zorro-antd/form-field';\n\nimport { NzUploadModule } from 'ng-zorro-antd/upload';\nimport { NzButtonModule } from 'ng-zorro-antd/button';\nimport { NzIconModule } from 'ng-zorro-antd/icon';\nimport { FormlyFieldUpload } from './upload.type';\nimport { UploadComponent } from './upload.component';\n\n@NgModule({\n declarations: [FormlyFieldUpload, UploadComponent],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FormlyNzFormFieldModule,\n\n NzUploadModule,\n NzButtonModule,\n NzIconModule,\n\n FormlyModule.forChild({\n types: [\n {\n name: 'upload',\n component: FormlyFieldUpload,\n wrappers: ['form-field']\n }\n ]\n })\n ]\n})\nexport class FormlyNzUploadModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3.UploadComponent"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAwEM,MAAO,eAAgB,SAAQ,iBAAiB,CAAA;AA5DtD,IAAA,WAAA,GAAA;;AAoEE;;AAEG;QACM,IAAS,CAAA,SAAA,GAAG,EAAE,CAAC;AAGxB,QAAA,IAAA,CAAA,QAAQ,GAAiB,MAAK,GAAG,CAAC;AAClC,QAAA,IAAA,CAAA,SAAS,GAAkB,MAAK,GAAG,CAAC;AA0BrC,KAAA;AAzBC,IAAA,UA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BAAuB;QAEvB,cAAc;QACd,cAAc;QACd,YAAY;QAEZ,YAAY,CAAC,QAAQ,CAAC;AACpB,YAAA,KAAK,EAAE;AACL,gBAAA;AACE,oBAAA,IAAI,EAAE,QAAQ;AACd,oBAAA,SAAS,EAAE,iBAAiB;oBAC5B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iBAAA;AACF,aAAA;SACF,CAAC,CAAA,EAAA,CAAA,CAAA;2FAGO,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAtBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC;AAClD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,uBAAuB;wBAEvB,cAAc;wBACd,cAAc;wBACd,YAAY;wBAEZ,YAAY,CAAC,QAAQ,CAAC;AACpB,4BAAA,KAAK,EAAE;AACL,gCAAA;AACE,oCAAA,IAAI,EAAE,QAAQ;AACd,oCAAA,SAAS,EAAE,iBAAiB;oCAC5B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iCAAA;AACF,6BAAA;yBACF,CAAC;AACH,qBAAA;AACF,iBAAA,CAAA;;;ACjCD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-formly-zorro-antd-upload.mjs","sources":["../../../../packages/formlyantd/upload/src/upload.component.ts","../../../../packages/formlyantd/upload/src/upload.type.ts","../../../../packages/formlyantd/upload/src/upload.module.ts","../../../../packages/formlyantd/upload/src/ngx-formly-zorro-antd-upload.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport {\n ChangeDetectionStrategy,\n Component,\n TemplateRef,\n forwardRef,\n Input,\n ViewEncapsulation,\n ViewChild\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { OnChangeType, OnTouchedType, NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { NzUploadChangeParam, NzUploadComponent, NzUploadFile } from 'ng-zorro-antd/upload';\nimport type { AntdIcon } from './upload.props';\n\n@Component({\n selector: 'formly-nz-upload',\n template: `\n <nz-upload\n [nzType]=\"nzType\"\n [nzAccept]=\"nzAccept\"\n [nzAction]=\"nzAction\"\n [nzDirectory]=\"nzDirectory\"\n [nzBeforeUpload]=\"nzBeforeUpload\"\n [nzCustomRequest]=\"nzCustomRequest\"\n [nzData]=\"nzData\"\n [nzDisabled]=\"nzDisabled\"\n [(nzFileList)]=\"nzFileList\"\n [nzLimit]=\"nzLimit\"\n [nzSize]=\"nzSize\"\n [nzFileType]=\"nzFileType\"\n [nzFilter]=\"nzFilter\"\n [nzHeaders]=\"nzHeaders\"\n [nzListType]=\"nzListType\"\n [nzMultiple]=\"nzMultiple\"\n [nzName]=\"nzName\"\n [nzShowUploadList]=\"nzShowUploadList\"\n [nzShowButton]=\"nzShowButton\"\n [nzWithCredentials]=\"nzWithCredentials\"\n [nzOpenFileDialogOnClick]=\"nzOpenFileDialogOnClick\"\n [nzPreview]=\"nzPreview\"\n [nzPreviewFile]=\"nzPreviewFile\"\n [nzPreviewIsImage]=\"nzPreviewIsImage\"\n [nzRemove]=\"nzRemove\"\n [nzDownload]=\"nzDownload\"\n [nzTransformFile]=\"nzTransformFile\"\n [nzIconRender]=\"nzIconRender\"\n [nzFileListRender]=\"nzFileListRender\"\n [ngClass]=\"className\"\n (nzChange)=\"change($event)\"\n (nzFileListChange)=\"fileListChange($event)\"\n >\n <ng-container [ngSwitch]=\"nzType\">\n <ng-container *ngSwitchCase=\"'drag'\">\n <p class=\"ant-upload-drag-icon\">\n <span\n *ngIf=\"nzeUploadButtonIcon\"\n nz-icon\n [nzType]=\"nzeUploadButtonIcon.type\"\n [nzTheme]=\"nzeUploadButtonIcon.theme || 'outline'\"\n [nzSpin]=\"nzeUploadButtonIcon.spin!!\"\n [nzTwotoneColor]=\"nzeUploadButtonIcon.twoToneColor || ''\"\n ></span>\n </p>\n <p class=\"ant-upload-text\">{{ nzeText }}</p>\n <p class=\"ant-upload-hint\">{{ nzeHint }}</p>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button\n type=\"button\"\n nz-button\n [disabled]=\"nzDisabled!!\"\n *ngIf=\"nzeShowUploadButton !== false\"\n >\n <span\n *ngIf=\"nzeUploadButtonIcon\"\n nz-icon\n [nzType]=\"nzeUploadButtonIcon.type\"\n [nzTheme]=\"nzeUploadButtonIcon.theme || 'outline'\"\n [nzSpin]=\"nzeUploadButtonIcon.spin!!\"\n [nzTwotoneColor]=\"nzeUploadButtonIcon.twoToneColor || ''\"\n ></span>\n {{ nzeText }}\n </button>\n\n <div *ngIf=\"nzeShowUploadButton === false\">\n <span\n *ngIf=\"nzeUploadButtonIcon\"\n nz-icon\n [nzType]=\"nzeUploadButtonIcon.type\"\n [nzTheme]=\"nzeUploadButtonIcon.theme || 'outline'\"\n [nzSpin]=\"nzeUploadButtonIcon.spin!!\"\n [nzTwotoneColor]=\"nzeUploadButtonIcon.twoToneColor || ''\"\n ></span>\n {{ nzeText }}\n <div class=\"ant-upload-hint\" style=\"margin-top: 8px\">{{ nzeHint }}</div>\n </div>\n </ng-container>\n </ng-container>\n </nz-upload>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => UploadNzComponent),\n multi: true\n }\n ]\n})\nexport class UploadNzComponent extends NzUploadComponent implements ControlValueAccessor {\n // @ViewChild('upload', { static: true }) transfer!: NzUploadComponent;\n\n /** 上传显示文本信息 */\n @Input() nzeText?: string;\n /** 上传的提示信息 */\n @Input() nzeHint?: string;\n /** 是否显示上传按钮, 如果是nzType=\"drag\" 隐藏按钮 */\n @Input() nzeShowUploadButton?: boolean;\n /**\n * 自定义按钮或显示内容\n */\n @Input() nzeUploadButton?: string | TemplateRef<NzSafeAny>;\n /** 上传按钮的图标 */\n @Input() nzeUploadButtonIcon?: AntdIcon | null = {\n type: 'cloud-upload'\n };\n\n /** 样式名 */\n @Input() className = '';\n @Input() resultMap?: (items: NzUploadFile[]) => NzSafeAny[];\n\n onChange: OnChangeType = () => {};\n onTouched: OnTouchedType = () => {};\n writeValue(): void {}\n registerOnChange(fn: NzSafeAny): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: NzSafeAny): void {\n this.onTouched = fn;\n }\n setDisabledState?(isDisabled: boolean): void {\n this.nzDisabled = isDisabled;\n }\n\n fileListChange(list: NzUploadFile[]) {\n this.nzFileListChange.emit(list);\n }\n\n change(value: NzUploadChangeParam) {\n this.nzChange.emit(value);\n if (['removed', 'success'].includes(value.type ?? '')) {\n if (this.resultMap instanceof Function) {\n this.onChange(this.resultMap(value.fileList.filter(x => x.status === 'done')));\n } else {\n this.onChange(value.fileList.filter(x => x.status === 'done'));\n }\n }\n }\n}\n","import { Component, ChangeDetectionStrategy, Type, ViewChild, OnInit } from '@angular/core';\nimport { FieldType, FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core';\nimport { UploadNzComponent } from './upload.component';\nimport type { UploadProps } from './upload.props';\n\nexport interface FormlyUploadFieldConfig extends FormlyFieldConfig<UploadProps> {\n type: 'upload' | Type<FormlyFieldUpload>;\n}\n\n@Component({\n selector: 'formly-field-upload',\n template: `<formly-nz-upload\n #upload\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [nzAccept]=\"props['accept']\"\n [nzAction]=\"props['action']\"\n [nzDirectory]=\"props['directory']!!\"\n [nzBeforeUpload]=\"props['beforeUpload']\"\n [nzCustomRequest]=\"props['customRequest']\"\n [nzData]=\"props['data']\"\n [nzDisabled]=\"props['disabled']!!\"\n [(nzFileList)]=\"props['fileList']\"\n [nzLimit]=\"props['limit']\"\n [nzSize]=\"props['size']\"\n [nzFileType]=\"props['fileType']\"\n [nzFilter]=\"props['filter']!\"\n [nzHeaders]=\"props['headers']\"\n [nzListType]=\"props['listType']!\"\n [nzMultiple]=\"props['multiple']!!\"\n [nzName]=\"props['name'] || ''\"\n [nzShowUploadList]=\"props['showUploadList']\"\n [nzShowButton]=\"props['showButton']!!\"\n [nzWithCredentials]=\"props['withCredentials']!!\"\n [nzOpenFileDialogOnClick]=\"props['openFileDialogOnClick']!!\"\n [nzPreview]=\"props['preview']\"\n [nzPreviewFile]=\"props['previewFile']\"\n [nzPreviewIsImage]=\"props['previewIsImage']\"\n [nzRemove]=\"props['remove']\"\n (nzChange)=\"props.change && props.change(field, $event)\"\n [nzDownload]=\"props['download']\"\n [nzTransformFile]=\"props['transformFile']\"\n [nzIconRender]=\"props['iconRender'] ?? null\"\n [nzFileListRender]=\"props['fileListRender'] ?? null\"\n [resultMap]=\"props['resultMap']\"\n [nzeHint]=\"props['hint']\"\n [nzeText]=\"props['text']\"\n [nzeUploadButtonIcon]=\"props['uploadButtonIcon']\"\n [nzeShowUploadButton]=\"props['showUploadButton']\"\n [className]=\"props['className'] || ''\"\n (nzFileListChange)=\"props['fileListChange'] && props['fileListChange'](field, $event)\"\n >\n </formly-nz-upload>`,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormlyFieldUpload extends FieldType<FieldTypeConfig<UploadProps>> implements OnInit {\n override defaultOptions = {\n props: {\n listType: 'text' as const,\n name: 'file',\n showUploadList: true,\n showButton: true,\n openFileDialogOnClick: true,\n showUploadButton: true,\n limit: 0,\n size: 0,\n fileList: [],\n filter: [],\n text: ''\n }\n };\n\n @ViewChild('upload', { static: true }) upload!: UploadNzComponent;\n\n ngOnInit(): void {\n const type = this.props.type;\n if (type) {\n this.upload.nzType = type;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlyNzFormFieldModule } from 'ngx-formly-zorro-antd/form-field';\n\nimport { NzUploadModule } from 'ng-zorro-antd/upload';\nimport { NzButtonModule } from 'ng-zorro-antd/button';\nimport { NzIconModule } from 'ng-zorro-antd/icon';\nimport { FormlyFieldUpload } from './upload.type';\nimport { UploadNzComponent } from './upload.component';\n\n@NgModule({\n declarations: [FormlyFieldUpload, UploadNzComponent],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FormlyNzFormFieldModule,\n\n NzUploadModule,\n NzButtonModule,\n NzIconModule,\n\n FormlyModule.forChild({\n types: [\n {\n name: 'upload',\n component: FormlyFieldUpload,\n wrappers: ['form-field']\n }\n ]\n })\n ]\n})\nexport class FormlyNzUploadModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3.UploadNzComponent"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AA+GM,MAAO,iBAAkB,SAAQ,iBAAiB,CAAA;AAhGxD,IAAA,WAAA,GAAA;;;AA8GW,QAAA,IAAA,CAAA,mBAAmB,GAAqB;AAC/C,YAAA,IAAI,EAAE,cAAc;SACrB,CAAC;;QAGO,IAAS,CAAA,SAAA,GAAG,EAAE,CAAC;AAGxB,QAAA,IAAA,CAAA,QAAQ,GAAiB,MAAK,GAAG,CAAC;AAClC,QAAA,IAAA,CAAA,SAAS,GAAkB,MAAK,GAAG,CAAC;AA0BrC,KAAA;AAzBC,IAAA,UAAU,MAAW;AACrB,IAAA,gBAAgB,CAAC,EAAa,EAAA;AAC5B,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;KACpB;AACD,IAAA,iBAAiB,CAAC,EAAa,EAAA;AAC7B,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;KACrB;AACD,IAAA,gBAAgB,CAAE,UAAmB,EAAA;AACnC,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAC9B;AAED,IAAA,cAAc,CAAC,IAAoB,EAAA;AACjC,QAAA,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClC;AAED,IAAA,MAAM,CAAC,KAA0B,EAAA;AAC/B,QAAA,IAAI,CAAC,QAAQ,CA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AAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAnB7B,YAAY;QACZ,mBAAmB;QACnB,uBAAuB;QAEvB,cAAc;QACd,cAAc;QACd,YAAY;QAEZ,YAAY,CAAC,QAAQ,CAAC;AACpB,YAAA,KAAK,EAAE;AACL,gBAAA;AACE,oBAAA,IAAI,EAAE,QAAQ;AACd,oBAAA,SAAS,EAAE,iBAAiB;oBAC5B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iBAAA;AACF,aAAA;SACF,CAAC,CAAA,EAAA,CAAA,CAAA;2FAGO,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAtBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;AACpD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,uBAAuB;wBAEvB,cAAc;wBACd,cAAc;wBACd,YAAY;wBAEZ,YAAY,CAAC,QAAQ,CAAC;AACpB,4BAAA,KAAK,EAAE;AACL,gCAAA;AACE,oCAAA,IAAI,EAAE,QAAQ;AACd,oCAAA,SAAS,EAAE,iBAAiB;oCAC5B,QAAQ,EAAE,CAAC,YAAY,CAAC;AACzB,iCAAA;AACF,6BAAA;yBACF,CAAC;AACH,qBAAA;AACF,iBAAA,CAAA;;;ACjCD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-formly-zorro-antd",
3
- "version": "14.1.0",
3
+ "version": "14.2.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -109,18 +109,18 @@ export interface TabsProps {
109
109
  /**
110
110
  * 单击 title 的回调函数
111
111
  */
112
- click?: () => void;
112
+ click?: (field: FormlyFieldConfig) => void;
113
113
  /**
114
114
  * 右键 title 的回调函数
115
115
  */
116
- contextmenu?: (event: MouseEvent) => void;
116
+ contextmenu?: (field: FormlyFieldConfig, event: MouseEvent) => void;
117
117
  /**
118
118
  * tab 被选中的回调函数
119
119
  */
120
- select?: () => void;
120
+ select?: (field: FormlyFieldConfig) => void;
121
121
  /**
122
122
  * tab 被取消选中的回调函数
123
123
  */
124
- deselect?: () => void;
124
+ deselect?: (field: FormlyFieldConfig) => void;
125
125
  };
126
126
  }
@@ -4,9 +4,10 @@ import * as i2 from "@angular/common";
4
4
  import * as i3 from "@angular/forms";
5
5
  import * as i4 from "ngx-formly-zorro-antd/form-field";
6
6
  import * as i5 from "ng-zorro-antd/input";
7
- import * as i6 from "@ngx-formly/core";
7
+ import * as i6 from "ng-zorro-antd/icon";
8
+ import * as i7 from "@ngx-formly/core";
8
9
  export declare class FormlyNzTextareaModule {
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<FormlyNzTextareaModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyNzTextareaModule, [typeof i1.FormlyFieldTextarea], [typeof i2.CommonModule, typeof i3.ReactiveFormsModule, typeof i4.FormlyNzFormFieldModule, typeof i5.NzInputModule, typeof i6.FormlyModule], never>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyNzTextareaModule, [typeof i1.FormlyFieldTextarea], [typeof i2.CommonModule, typeof i3.ReactiveFormsModule, typeof i4.FormlyNzFormFieldModule, typeof i5.NzInputModule, typeof i6.NzIconModule, typeof i7.FormlyModule], never>;
11
12
  static ɵinj: i0.ɵɵInjectorDeclaration<FormlyNzTextareaModule>;
12
13
  }
@@ -3,6 +3,7 @@ import { FieldType, FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core'
3
3
  import type { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';
4
4
  import * as i0 from "@angular/core";
5
5
  interface TextareaProps extends FormlyFieldProps {
6
+ type?: 'count' | 'clear';
6
7
  /**
7
8
  * 自适应内容高度,可设置为 boolean 或对象:{ minRows: 2, maxRows: 6 }
8
9
  * @default false
@@ -24,7 +25,7 @@ interface TextareaProps extends FormlyFieldProps {
24
25
  export interface FormlyTextareaFieldConfig extends FormlyFieldConfig<TextareaProps> {
25
26
  type: 'textarea' | Type<FormlyFieldTextarea>;
26
27
  }
27
- export declare class FormlyFieldTextarea extends FieldType<FieldTypeConfig> {
28
+ export declare class FormlyFieldTextarea extends FieldType<FieldTypeConfig<TextareaProps>> {
28
29
  defaultOptions: {
29
30
  props: {
30
31
  rows: number;
@@ -1,17 +1,23 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import { ControlValueAccessor } from '@angular/forms';
2
3
  import type { OnChangeType, OnTouchedType, NzSafeAny } from 'ng-zorro-antd/core/types';
3
4
  import { NzUploadChangeParam, NzUploadComponent, NzUploadFile } from 'ng-zorro-antd/upload';
5
+ import type { AntdIcon } from './upload.props';
4
6
  import * as i0 from "@angular/core";
5
- export declare class UploadComponent extends NzUploadComponent implements ControlValueAccessor {
6
- transfer: NzUploadComponent;
7
+ export declare class UploadNzComponent extends NzUploadComponent implements ControlValueAccessor {
8
+ /** 上传显示文本信息 */
9
+ nzeText?: string;
10
+ /** 上传的提示信息 */
11
+ nzeHint?: string;
12
+ /** 是否显示上传按钮, 如果是nzType="drag" 隐藏按钮 */
13
+ nzeShowUploadButton?: boolean;
7
14
  /**
8
- * 按钮文本
9
- * @default 点击上传
10
- */
11
- text?: string;
12
- /**
13
- * 样式名
15
+ * 自定义按钮或显示内容
14
16
  */
17
+ nzeUploadButton?: string | TemplateRef<NzSafeAny>;
18
+ /** 上传按钮的图标 */
19
+ nzeUploadButtonIcon?: AntdIcon | null;
20
+ /** 样式名 */
15
21
  className: string;
16
22
  resultMap?: (items: NzUploadFile[]) => NzSafeAny[];
17
23
  onChange: OnChangeType;
@@ -22,6 +28,6 @@ export declare class UploadComponent extends NzUploadComponent implements Contro
22
28
  setDisabledState?(isDisabled: boolean): void;
23
29
  fileListChange(list: NzUploadFile[]): void;
24
30
  change(value: NzUploadChangeParam): void;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<UploadComponent, never>;
26
- static ɵcmp: i0.ɵɵComponentDeclaration<UploadComponent, "formly-upload", never, { "text": "text"; "className": "className"; "resultMap": "resultMap"; }, {}, never, never, false>;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<UploadNzComponent, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<UploadNzComponent, "formly-nz-upload", never, { "nzeText": "nzeText"; "nzeHint": "nzeHint"; "nzeShowUploadButton": "nzeShowUploadButton"; "nzeUploadButton": "nzeUploadButton"; "nzeUploadButtonIcon": "nzeUploadButtonIcon"; "className": "className"; "resultMap": "resultMap"; }, {}, never, never, false>;
27
33
  }
@@ -10,6 +10,6 @@ import * as i8 from "ng-zorro-antd/icon";
10
10
  import * as i9 from "@ngx-formly/core";
11
11
  export declare class FormlyNzUploadModule {
12
12
  static ɵfac: i0.ɵɵFactoryDeclaration<FormlyNzUploadModule, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyNzUploadModule, [typeof i1.FormlyFieldUpload, typeof i2.UploadComponent], [typeof i3.CommonModule, typeof i4.ReactiveFormsModule, typeof i5.FormlyNzFormFieldModule, typeof i6.NzUploadModule, typeof i7.NzButtonModule, typeof i8.NzIconModule, typeof i9.FormlyModule], never>;
13
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormlyNzUploadModule, [typeof i1.FormlyFieldUpload, typeof i2.UploadNzComponent], [typeof i3.CommonModule, typeof i4.ReactiveFormsModule, typeof i5.FormlyNzFormFieldModule, typeof i6.NzUploadModule, typeof i7.NzButtonModule, typeof i8.NzIconModule, typeof i9.FormlyModule], never>;
14
14
  static ɵinj: i0.ɵɵInjectorDeclaration<FormlyNzUploadModule>;
15
15
  }
@@ -0,0 +1,173 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import type { FormlyFieldConfig } from '@ngx-formly/core';
3
+ import { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';
4
+ import { Observable, Subscription } from 'rxjs';
5
+ import type { ThemeType } from '@ant-design/icons-angular';
6
+ import type { NzUploadChangeParam, NzUploadFile, NzUploadTransformFileType, UploadFilter, NzIconRenderTemplate, NzUploadListType, NzUploadType, NzUploadXHRArgs } from 'ng-zorro-antd/upload';
7
+ import type { NzSafeAny } from 'ng-zorro-antd/core/types';
8
+ export interface UploadProps extends FormlyFieldProps {
9
+ type?: NzUploadType;
10
+ /**
11
+ * 接受上传的文件类型, 详见 input accept Attribute
12
+ */
13
+ accept?: string | string[];
14
+ /**
15
+ * 必选参数, 上传的地址
16
+ */
17
+ action?: string | ((file: NzUploadFile) => string | Observable<string>);
18
+ /**
19
+ * 支持上传文件夹(caniuse)
20
+ * @default false
21
+ */
22
+ directory?: boolean;
23
+ /**
24
+ * 上传文件之前的钩子,参数为上传的文件,若返回 false 则停止上传。注意:IE9 不支持该方法;注意:务必使用 => 定义处理方法。
25
+ */
26
+ beforeUpload?: (file: NzUploadFile, fileList: NzUploadFile[]) => boolean | Observable<boolean>;
27
+ /**
28
+ * 通过覆盖默认的上传行为,可以自定义自己的上传实现;注意:务必使用 => 定义处理方法。
29
+ */
30
+ customRequest?: (item: NzUploadXHRArgs) => Subscription;
31
+ /**
32
+ * 上传所需参数或返回上传参数的方法;注意:务必使用 => 定义处理方法。
33
+ */
34
+ data?: {} | ((file: NzUploadFile) => {} | Observable<{}>);
35
+ /**
36
+ * 文件列表,双向绑定
37
+ */
38
+ fileList: NzUploadFile[];
39
+ /**
40
+ * 限制单次最多上传数量,nzMultiple 打开时有效;0 表示不限
41
+ * @default 0
42
+ */
43
+ limit?: number;
44
+ /**
45
+ * 限制文件大小,单位:KB;0 表示不限
46
+ * @default 0
47
+ */
48
+ size?: number;
49
+ /**
50
+ * 限制文件类型,例如:image/png,image/jpeg,image/gif,image/bmp
51
+ */
52
+ fileType?: string;
53
+ /**
54
+ * 自定义过滤器
55
+ */
56
+ filter?: UploadFilter[];
57
+ /**
58
+ * 设置上传的请求头部,IE10 以上有效;注意:务必使用 => 定义处理方法。
59
+ */
60
+ headers?: Object | ((file: NzUploadFile) => Object | Observable<{}>);
61
+ /**
62
+ * 上传列表的内建样式,支持三种基本样式 text, picture 和 picture-card
63
+ * @default text
64
+ */
65
+ listType?: NzUploadListType;
66
+ /**
67
+ * 是否支持多选文件,ie10+ 支持。开启后按住 ctrl 可选择多个文件。
68
+ * @default false;
69
+ */
70
+ multiple?: boolean;
71
+ /**
72
+ * 发到后台的文件参数名
73
+ * @default file
74
+ */
75
+ name?: string;
76
+ /**
77
+ * 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon,showRemoveIcon 和 showDownloadIcon
78
+ * @default true
79
+ */
80
+ showUploadList?: boolean | {
81
+ showPreviewIcon?: boolean;
82
+ showRemoveIcon?: boolean;
83
+ showDownloadIcon?: boolean;
84
+ };
85
+ /**
86
+ * 是否展示上传按钮
87
+ * @default true
88
+ */
89
+ showButton?: boolean;
90
+ /**
91
+ * 上传请求时是否携带 cookie
92
+ * @default false
93
+ */
94
+ withCredentials?: boolean;
95
+ /**
96
+ * 点击打开文件对话框
97
+ * @default true
98
+ */
99
+ openFileDialogOnClick?: boolean;
100
+ /**
101
+ * 点击文件链接或预览图标时的回调;注意:务必使用 => 定义处理方法。
102
+ */
103
+ preview?: (file: NzUploadFile) => void;
104
+ /**
105
+ * 自定义文件预览逻辑;注意:务必使用 => 定义处理方法。
106
+ */
107
+ previewFile?: (file: NzUploadFile) => Observable<string>;
108
+ /**
109
+ * 自定义预览文件是否有效图像,一般用于图像URL为非标准格式;注意:务必使用 => 定义处理方法。
110
+ */
111
+ previewIsImage?: (file: NzUploadFile) => boolean;
112
+ /**
113
+ * 点击移除文件时的回调,返回值为 false 时不移除。支持返回 Observable 对象;注意:务必使用 => 定义处理方法。
114
+ */
115
+ remove?: (file: NzUploadFile) => boolean | Observable<boolean>;
116
+ /**
117
+ * 上传文件改变时的状态
118
+ */
119
+ onChange?: (value: NzUploadChangeParam) => void;
120
+ /**
121
+ * 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页
122
+ * @default 跳转新标签页
123
+ */
124
+ download?: (file: NzUploadFile) => void;
125
+ /**
126
+ * 在上传之前转换文件。支持返回一个 Observable 对象
127
+ */
128
+ transformFile?: (file: NzUploadFile) => NzUploadTransformFileType;
129
+ /**
130
+ * 自定义显示 icon
131
+ */
132
+ iconRender?: NzIconRenderTemplate | null;
133
+ /**
134
+ * 自定义显示整个列表
135
+ */
136
+ fileListRender?: TemplateRef<void> | null;
137
+ /**
138
+ * 文件列表改变事件
139
+ */
140
+ fileListChange?: (field: FormlyFieldConfig, event: NzUploadFile[]) => void;
141
+ /**
142
+ * 返回结果格式映射
143
+ * @returns 默认返回 NzUploadFile[] 格式
144
+ */
145
+ resultMap?: (items: NzUploadFile[]) => NzSafeAny[];
146
+ /** 上传的提示信息 */
147
+ hint?: string;
148
+ /**
149
+ * 上传显示文本信息
150
+ */
151
+ text?: string;
152
+ /**
153
+ * 上传按钮的图标
154
+ */
155
+ uploadButtonIcon?: AntdIcon | null;
156
+ /**
157
+ * 是否显示上传按钮
158
+ * @default true
159
+ */
160
+ showUploadButton?: boolean;
161
+ }
162
+ export interface AntdIcon {
163
+ /** 图标类型 */
164
+ type: string;
165
+ /** 图标主题风格,默认:`outline` */
166
+ theme?: ThemeType;
167
+ /** 是否有旋转动画,默认:`false` */
168
+ spin?: boolean;
169
+ /** 仅适用双色图标,设置双色图标的主要颜色,仅对当前 icon 生效 */
170
+ twoToneColor?: string;
171
+ /** 指定来自 IconFont 的图标类型 */
172
+ iconfont?: string;
173
+ }
@@ -1,157 +1,12 @@
1
- import { TemplateRef, Type, OnInit } from '@angular/core';
1
+ import { Type, OnInit } from '@angular/core';
2
2
  import { FieldType, FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core';
3
- import { FormlyFieldProps } from 'ngx-formly-zorro-antd/form-field';
4
- import { Observable, Subscription } from 'rxjs';
5
- import { NzUploadComponent, NzUploadChangeParam, NzUploadFile, NzUploadTransformFileType, UploadFilter, NzIconRenderTemplate, NzUploadListType } from 'ng-zorro-antd/upload';
6
- import type { NzSafeAny } from 'ng-zorro-antd/core/types';
3
+ import { UploadNzComponent } from './upload.component';
4
+ import type { UploadProps } from './upload.props';
7
5
  import * as i0 from "@angular/core";
8
- interface UploadProps extends FormlyFieldProps {
9
- /**
10
- * 接受上传的文件类型, 详见 input accept Attribute
11
- */
12
- accept?: string | string[];
13
- /**
14
- * 必选参数, 上传的地址
15
- */
16
- action?: string | ((file: NzUploadFile) => string | Observable<string>);
17
- /**
18
- * 支持上传文件夹(caniuse)
19
- * @default false
20
- */
21
- directory?: boolean;
22
- /**
23
- * 上传文件之前的钩子,参数为上传的文件,若返回 false 则停止上传。注意:IE9 不支持该方法;注意:务必使用 => 定义处理方法。
24
- */
25
- beforeUpload?: (file: NzUploadFile, fileList: NzUploadFile[]) => boolean | Observable<boolean>;
26
- /**
27
- * 通过覆盖默认的上传行为,可以自定义自己的上传实现;注意:务必使用 => 定义处理方法。
28
- */
29
- customRequest?: (item: NzSafeAny) => Subscription;
30
- /**
31
- * 上传所需参数或返回上传参数的方法;注意:务必使用 => 定义处理方法。
32
- */
33
- data?: Object | ((file: NzUploadFile) => Object | Observable<{}>);
34
- /**
35
- * 文件列表,双向绑定
36
- */
37
- fileList?: NzUploadFile[];
38
- /**
39
- * 限制单次最多上传数量,nzMultiple 打开时有效;0 表示不限
40
- * @default 0
41
- */
42
- limit?: number;
43
- /**
44
- * 限制文件大小,单位:KB;0 表示不限
45
- * @default 0
46
- */
47
- size?: number;
48
- /**
49
- * 限制文件类型,例如:image/png,image/jpeg,image/gif,image/bmp
50
- */
51
- fileType?: string;
52
- /**
53
- * 自定义过滤器
54
- */
55
- filter?: UploadFilter[];
56
- /**
57
- * 设置上传的请求头部,IE10 以上有效;注意:务必使用 => 定义处理方法。
58
- */
59
- headers?: Object | ((file: NzUploadFile) => Object | Observable<{}>);
60
- /**
61
- * 上传列表的内建样式,支持三种基本样式 text, picture 和 picture-card
62
- * @default text
63
- */
64
- listType?: NzUploadListType;
65
- /**
66
- * 是否支持多选文件,ie10+ 支持。开启后按住 ctrl 可选择多个文件。
67
- * @default false;
68
- */
69
- multiple?: boolean;
70
- /**
71
- * 发到后台的文件参数名
72
- * @default file
73
- */
74
- name?: string;
75
- /**
76
- * 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon,showRemoveIcon 和 showDownloadIcon
77
- * @default true
78
- */
79
- showUploadList?: boolean | {
80
- showPreviewIcon?: boolean;
81
- showRemoveIcon?: boolean;
82
- showDownloadIcon?: boolean;
83
- };
84
- /**
85
- * 是否展示上传按钮
86
- * @default true
87
- */
88
- showButton?: boolean;
89
- /**
90
- * 上传请求时是否携带 cookie
91
- * @default false
92
- */
93
- withCredentials?: boolean;
94
- /**
95
- * 点击打开文件对话框
96
- * @default true
97
- */
98
- openFileDialogOnClick?: boolean;
99
- /**
100
- * 点击文件链接或预览图标时的回调;注意:务必使用 => 定义处理方法。
101
- */
102
- preview?: (file: NzUploadFile) => void;
103
- /**
104
- * 自定义文件预览逻辑;注意:务必使用 => 定义处理方法。
105
- */
106
- previewFile?: (file: NzUploadFile) => Observable<string>;
107
- /**
108
- * 自定义预览文件是否有效图像,一般用于图像URL为非标准格式;注意:务必使用 => 定义处理方法。
109
- */
110
- previewIsImage?: (file: NzUploadFile) => boolean;
111
- /**
112
- * 点击移除文件时的回调,返回值为 false 时不移除。支持返回 Observable 对象;注意:务必使用 => 定义处理方法。
113
- */
114
- remove?: (file: NzUploadFile) => boolean | Observable<boolean>;
115
- /**
116
- * 上传文件改变时的状态
117
- */
118
- onChange?: (value: NzUploadChangeParam) => void;
119
- /**
120
- * 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页
121
- * @default 跳转新标签页
122
- */
123
- download?: (file: NzUploadFile) => void;
124
- /**
125
- * 在上传之前转换文件。支持返回一个 Observable 对象
126
- */
127
- transformFile?: (file: NzUploadFile) => NzUploadTransformFileType;
128
- /**
129
- * 自定义显示 icon
130
- */
131
- iconRender?: NzIconRenderTemplate | null;
132
- /**
133
- * 自定义显示整个列表
134
- */
135
- fileListRender?: TemplateRef<void> | null;
136
- /**
137
- * 按钮文本
138
- * @default 点击上传
139
- */
140
- text?: string;
141
- /**
142
- * 文件列表改变事件
143
- */
144
- fileListChange?: (list: NzUploadFile[]) => void;
145
- /**
146
- * 返回结果格式映射
147
- * @returns 默认返回 NzUploadFile[] 格式
148
- */
149
- resultMap?: (items: NzUploadFile[]) => NzSafeAny[];
150
- }
151
6
  export interface FormlyUploadFieldConfig extends FormlyFieldConfig<UploadProps> {
152
7
  type: 'upload' | Type<FormlyFieldUpload>;
153
8
  }
154
- export declare class FormlyFieldUpload extends FieldType<FieldTypeConfig> implements OnInit {
9
+ export declare class FormlyFieldUpload extends FieldType<FieldTypeConfig<UploadProps>> implements OnInit {
155
10
  defaultOptions: {
156
11
  props: {
157
12
  listType: "text";
@@ -159,15 +14,16 @@ export declare class FormlyFieldUpload extends FieldType<FieldTypeConfig> implem
159
14
  showUploadList: boolean;
160
15
  showButton: boolean;
161
16
  openFileDialogOnClick: boolean;
17
+ showUploadButton: boolean;
162
18
  limit: number;
163
19
  size: number;
20
+ fileList: never[];
164
21
  filter: never[];
165
22
  text: string;
166
23
  };
167
24
  };
168
- upload: NzUploadComponent;
25
+ upload: UploadNzComponent;
169
26
  ngOnInit(): void;
170
27
  static ɵfac: i0.ɵɵFactoryDeclaration<FormlyFieldUpload, never>;
171
28
  static ɵcmp: i0.ɵɵComponentDeclaration<FormlyFieldUpload, "formly-field-upload", never, {}, {}, never, never, false>;
172
29
  }
173
- export {};