import{$ as Ehe,Da as e5,Eo as kb,Fo as l$,Gr as Va,Ia as f$,Io as lA,Is as rh,J as EI,Lr as Uj,Oo as kj,Q as EV,Qi as bV,Qr as W$,Wa as g,Yi as bI,Za as gx,_s as ph,as as oA,ea as bhe,ec as th,ga as ci,gc as wf,ho as j$,it as FB,p as Au,pr as S3,ta as bi,u as AV,ua as cA,vc as wp}from"./chunk-B_pj7Jpm.js";import{t as X1}from"./chunk-CgIzqGPc.js";import{A as qn,O as ln,o as Je,r as D,s as Jn}from"./chunk-BPHMC4rz.js";import{k as tf,u as Jp}from"./chunk-CR0lnyBO.js";import{n as ce}from"./chunk-BHPWLTEh2.js";function B(t,n){if(t&1&&th(0,`my-global-icon`,3),t&2)gx(`iconName`,f$().icon())}function X(t,n){if(t&1&&(wp(0,`div`,5),j$(1),kb()),t&2){let i=f$();FB(),oA(i.filename)}}function U(t,n){if(t&1){let i=AV();wp(0,`button`,7),rh(`click`,function(){EI(i);return bI(f$().reset())}),l$(1,0),kb()}}var j=class t{notifier=g(bi);theme=ph(`secondary`);inputLabel=ph(void 0);inputName=ph(void 0);extensions=ph([]);maxFileSize=ph(void 0);displayFilename=ph(!1);displayReset=ph(!1);icon=ph(void 0);buttonTooltip=ph(void 0);fileChanged=Ehe();classes={};allowedExtensionsMessage=``;fileInputValue;file;get filename(){return this.file?this.file.name:``}ngOnInit(){this.allowedExtensionsMessage=this.extensions().join(`, `),this.buildClasses()}ngOnChanges(){this.buildClasses()}buildClasses(){this.classes={"with-icon":!!this.icon(),"primary-button":this.theme()===`primary`,"secondary-button":this.theme()===`secondary`,"icon-only":!this.inputLabel()}}fileChange(n){if(n.target.files?.length){let[i]=n.target.files;if(i.size>this.maxFileSize()){this.notifier.error("选择的文件过大。");return}let e=`.`+i.name.split(`.`).pop();if(this.extensions().includes(e.toLowerCase())===!1){let r=`此输入无法处理此类文件。可接受的扩展名为 ${this.allowedExtensionsMessage}。`;this.notifier.error(r);return}this.file=i,this.propagateChange(this.file)}this.fileChanged.emit(this.file)}reset(){this.writeValue(void 0),this.propagateChange(void 0),this.fileChanged.emit(void 0)}propagateChange=n=>{};writeValue(n){this.file=n,this.file||(this.fileInputValue=null)}registerOnChange(n){this.propagateChange=n}registerOnTouched(){}static ɵfac=function(i){return new(i||t)};static ɵcmp=Va({type:t,selectors:[[`my-reactive-file`]],inputs:{theme:[1,`theme`],inputLabel:[1,`inputLabel`],inputName:[1,`inputName`],extensions:[1,`extensions`],maxFileSize:[1,`maxFileSize`],displayFilename:[1,`displayFilename`],displayReset:[1,`displayReset`],icon:[1,`icon`],buttonTooltip:[1,`buttonTooltip`]},outputs:{fileChanged:`fileChanged`},features:[e5([{provide:D,useExisting:wf(()=>t),multi:!0}]),ci],decls:8,vars:10,consts:()=>{let n;return n="重置",[n,[1,`root`],[1,`button-file`,3,`ngClass`,`ngbTooltip`],[3,`iconName`],[`type`,`file`,3,`change`,`ngModelChange`,`name`,`id`,`accept`,`ngModel`],[1,`filename`,`ellipsis`],[1,`reset-button`,`reset-button-small`,`ms-2`],[1,`reset-button`,`reset-button-small`,`ms-2`,3,`click`]]},template:function(i,e){i&1&&(wp(0,`div`,1)(1,`div`,2),EV(2,B,1,1,`my-global-icon`,3),wp(3,`span`),j$(4),kb(),wp(5,`input`,4),rh(`change`,function(d){return e.fileChange(d)}),lA(`ngModelChange`,function(d){return W$(e.fileInputValue,d)||(e.fileInputValue=d),d}),kb(),kj(),kb(),EV(6,X,2,1,`div`,5),EV(7,U,2,0,`button`,6),kb()),i&2&&(FB(),gx(`ngClass`,e.classes)(`ngbTooltip`,e.buttonTooltip()),FB(),bV(e.icon()?2:-1),FB(2),oA(e.inputLabel()),FB(),gx(`name`,e.inputName())(`id`,e.inputName())(`accept`,e.extensions()),cA(`ngModel`,e.fileInputValue),Uj(),FB(),bV(e.displayFilename()===!0&&e.filename?6:-1),FB(),bV(e.displayReset()&&e.file?7:-1))},dependencies:[Au,S3,tf,Jp,Jn,Je,qn,ln,X1],styles:[`.root[_ngcontent-%COMP%]{height:auto;display:flex;align-items:center}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:24px;height:24px;line-height:24px}.root[_ngcontent-%COMP%]   .button-file.with-icon[_ngcontent-%COMP%]:not(.icon-only)   my-global-icon[_ngcontent-%COMP%]{margin-inline-end:.1875rem}.root[_ngcontent-%COMP%]   .filename[_ngcontent-%COMP%]{font-weight:600;margin-inline-start:.3125rem}`],changeDetection:1})};var r=class o{label=bhe(void 0);title=bhe(void 0);responsiveLabel=ph(!1);disabled=ph(void 0);theme=ph(`secondary`);ngOnChanges(){let t=this.label();t===void 0&&!this.title()&&this.title.set("删除"),t===``&&this.label.set("删除")}static ɵfac=function(n){return new(n||o)};static ɵcmp=Va({type:o,selectors:[[`my-delete-button`]],inputs:{label:[1,`label`],title:[1,`title`],responsiveLabel:[1,`responsiveLabel`],disabled:[1,`disabled`],theme:[1,`theme`]},outputs:{label:`labelChange`,title:`titleChange`},features:[ci],decls:1,vars:5,consts:[[`icon`,`delete`,`theme`,`secondary`,3,`disabled`,`label`,`title`,`responsiveLabel`,`theme`]],template:function(n,e){n&1&&th(0,`my-button`,0),n&2&&gx(`disabled`,e.disabled())(`label`,e.label())(`title`,e.title())(`responsiveLabel`,e.responsiveLabel())(`theme`,e.theme())},dependencies:[ce],encapsulation:2})};export{j as n,r as t};
//# debugId=cc8484c0-f667-52e7-ae06-a0bdf03d9f46
//# sourceMappingURL=chunk-mhEVtCsW.js.map