UNPKG

@aplus-frontend/ui

Version:

2 lines (1 loc) 967 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@aplus-frontend/antdv"),l=require("lodash-unified");function c(e){return typeof e=="object"&&typeof e.then=="function"?e:!1}const f=e=>typeof e=="function"&&c(e?.()),u=(e,s="0.7")=>{try{let t=e?.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(t.length===4){let o="#";for(let n=1;n<4;n+=1)o+=t.slice(n,n+1).concat(t.slice(n,n+1));t=o}const r=[];for(let o=1;o<7;o+=2)r.push(parseInt("0x"+t.slice(o,o+2)));return"rgba("+r.join(",")+","+s+")"}if(t&&t.startsWith("rgb")){let r=t.match(/(\d(\.\d+)?)+/g);return r=r?.slice(0,3)?.concat(s),"rgba("+r.join(",")+")"}return t}catch{return}},h=e=>{const{onOk:s=()=>({})}=e;return new Promise((t,i)=>{a.Modal.confirm({onOk:async()=>{try{await s(),t(!0)}catch{i()}},onCancel:()=>{i()},...l.omit(e,["onOk"])})})};exports.confirmHandle=h;exports.isAsynchronous=f;exports.isPromise=c;exports.transferOpacityColor=u;