| 1 |
- import{m as s}from"./index-eaa7a1f1.js";class o{constructor(e={}){this.attributes={},Object.assign(this.attributes,e)}getAttribute(e){return this.attributes[e]}setAttribute(e,r){this.attributes[e]=r}listAttributes(){return Object.keys(this.attributes).map(e=>`${e}: ${this.attributes[e]}`).join(", ")}checkDimension(e,r){let i=["length","width"];r.lengthschemedetails&&r.lengthschemedetails.length>0&&(i=i.filter(t=>t!=="length")),r.widthschemedetails&&r.widthschemedetails.length>0&&(i=i.filter(t=>t!=="width"));for(const t of["length","width"])if(!r[t])return s.error({content:`${t=="length"?"长度":"宽度"}定制选项不能为空!`,key:1}),!1;for(const t of i){if(r[t]<e[t].min||r[t]>e[t].max)return s.error({content:`自定义${t=="length"?"长度":"宽度"}超出可选范围!`,key:1}),!1;if(!this.hasDecimal(r[t],t))return!1}return!0}hasDecimal(e,r){return e.toString().indexOf(".")!==-1?(s.error(`${r=="length"?"长度":"宽度"}请输入整数`),!1):!0}}export{o as P};
|