@cniot/mdd-render-pc-ftp
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -1,14 +0,14 @@ | ||
"use strict";var ze=Object.defineProperty,Qe=Object.defineProperties;var Ze=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var se=(e,t,r)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p=(e,t)=>{for(var r in t||(t={}))le.call(t,r)&&se(e,r,t[r]);if(V)for(var r of V(t))ie.call(t,r)&&se(e,r,t[r]);return e},E=(e,t)=>Qe(e,Ze(t));var T=(e,t)=>{var r={};for(var n in e)le.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&V)for(var n of V(e))t.indexOf(n)<0&&ie.call(e,n)&&(r[n]=e[n]);return r};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var D=require("react"),v=require("@cniot/mdd-render-engine"),et=require("@alife/cn-filter"),ye=require("@cniot/hooks-ftp"),tt=require("@alife/cn-table"),L=require("cn-next"),rt=require("dayjs"),nt=require("react-dom");function F(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var u=F(D),ce=F(et),at=F(tt),A=F(rt),ue=F(nt);function ot(n){var o=n,{schema:e,engine:t}=o,r=T(o,["schema","engine"]);const{title:a,body:s={}}=e;return u.default.useEffect(()=>{a&&(document.title=a)},[a]),s.type?t.createElement(s.type,s,r):(console.warn("page schema error, body.type not found",e),null)}const st="$TABLE",lt="$PARENT_REFRESH",J="$FILTER",ve=`${J}_SUBMIT`,it=`${J}.`,fe=Function.prototype.apply,Z=new WeakMap;function C(e){return Z.has(e)||Z.set(e,{}),Z.get(e)}class ct{constructor(t=null,r=console){const n=C(this);return n._events=new Set,n._callbacks={},n._console=r,n._maxListeners=t===null?null:parseInt(t,10),this}_addCallback(t,r,n,o){return this._getCallbacks(t).push({callback:r,context:n,weight:o}),this._getCallbacks(t).sort((a,s)=>a.weight>s.weight),this}_getCallbacks(t){return C(this)._callbacks[t]}_getCallbackIndex(t,r){return this._has(t)?this._getCallbacks(t).findIndex(n=>n.callback===r):null}_achieveMaxListener(t){return C(this)._maxListeners!==null&&C(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,r,n){const o=this._getCallbackIndex(t,r),a=o!==-1?this._getCallbacks(t)[o]:void 0;return o!==-1&&a&&a.context===n}_has(t){return C(this)._events.has(t)}on(t,r,n=null,o=1){const a=C(this);if(typeof r!="function")throw new TypeError(`${r} is not a function`);return this._has(t)?(this._achieveMaxListener(t)&&a._console.warn(`Max listeners (${a._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&a._console.warn(`Event "${t}" already has the callback ${r}.`)):(a._events.add(t),a._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,r,n=null,o=1){const a=(...s)=>(this.off(t,a),fe.call(r,n,s));return this.on(t,a,n,o)}off(t,r=null){const n=C(this);let o;return this._has(t)&&(r===null?(n._events.delete(t),n._callbacks[t]=null):(o=this._getCallbackIndex(t,r),o!==-1&&(n._callbacks[t].splice(o,1),this.off(...arguments)))),this}emit(t,...r){return this._has(t)&&this._getCallbacks(t).forEach(n=>fe.call(n.callback,n.context,r)),this}clear(){const t=C(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}class ut extends ct{constructor(){super(),this.data=new Map}getValue(t){return this.data[t]}getVariable(t){return t==="ALL"?this.data:this.getValue(t)}setValue(t,r){this.data[t]=r}getValues(){return this.data}}function W(e={},t=[]){return t.reduce((r,n)=>(r[n]=e[n],r),{})}const{tr:ft}=v.i18n,dt={input:"Input","number-picker":"NumberPicker",switch:"Switch",radio:"Radio","cascad-select":"CascadSelect"};function _t({schema:e,engine:t}){const{fields:r=[],col:n=4,labelSpan:o=4,maxVisibleRow:a=2}=e,[s]=u.default.useState(()=>new ut),l=ye.useFilter(i=>{t.emit(ve,i)},{columns:n,maxVisibleRow:a,labelCol:{fixedSpan:o}});return u.default.useEffect(()=>{t.setModule(J,s)},[t,s]),u.default.createElement(ce.default,E(p({},l),{className:"mdd-build-filter",onChange:(i,f)=>{const{name:_,value:c}=f;s.setValue(_,c),t.emit(it+_,c)}}),r.map(i=>u.default.createElement(ce.default.Item,{key:i.name,label:ft(i.label),name:i.name,fullWidth:!0},pt(t,i.type,i))))}function pt(e,t,r){const n=dt[t]||t;return e.createElement(n,r,W(r,r[t]))}class ht extends v.JSONWatch{constructor(){super({})}setCurrentPage(t){return this.set("CURRENT_PAGE",t),this}setPageSize(t){return this.set("PAGE_SIZE",t),this}setTotalCount(t){return this.set("TOTAL_COUNT",t),this}setTableData(t){return this.set("TABLE_DATA",t),this}setRecordData(t){return this.set("RECORD_DATA",t),this}setSelectedData(t){return this.set("SELECTED_DATA",t),this}setSelectedKeyData(t){return this.set("SELECTED_KEY_DATA",t),this}getValue(t){return this.data[t]}setValue(t,r){this.set(t,r)}getValues(){return this.get("$ALL")}}var Y=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function gt(e,t,r){r||(r={});for(var n=-1,o=t.length;++n<o;){var a=t[n];r[a]=e[a]}return r}var bt=gt;function Et(e){return e==null?"":e+""}var mt=Et;function yt(e,t){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e[t[r]];return o}var vt=yt,At=/^\d+$/,Ae=9007199254740991;function Ot(e){return function(t){return t==null?void 0:t[e]}}var Tt=Ot("length");function Rt(e){return e!=null&&$t(Tt(e))}function St(e,t){return e=typeof e=="number"||At.test(e)?+e:-1,t=t==null?Ae:t,e>-1&&e%1==0&&e<t}function Ct(e,t,r){if(!wt(r))return!1;var n=typeof t;if(n=="number"?Rt(r)&&St(t,r.length):n=="string"&&t in r){var o=r[t];return e===e?e===o:o!==o}return!1}function $t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ae}function wt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}var Dt=Ct,Lt=/<%=([\s\S]+?)%>/g,Oe=Lt,Mt="[object Function]",kt=/^\[object .+?Constructor\]$/;function It(e){return!!e&&typeof e=="object"}var Te=Object.prototype,Re=Function.prototype.toString,Nt=Te.hasOwnProperty,Pt=Te.toString,xt=RegExp("^"+Re.call(Nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ft(e,t){var r=e==null?void 0:e[t];return jt(r)?r:void 0}function Wt(e){return Kt(e)&&Pt.call(e)==Mt}function Kt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function jt(e){return e==null?!1:Wt(e)?xt.test(Re.call(e)):It(e)&&kt.test(e)}var Bt=Ft,Ht=9007199254740991,Ut="[object Arguments]",Vt="[object Function]",Yt="[object GeneratorFunction]",re=Object.prototype,qt=re.hasOwnProperty,Se=re.toString,Gt=re.propertyIsEnumerable;function Xt(e){return zt(e)&&qt.call(e,"callee")&&(!Gt.call(e,"callee")||Se.call(e)==Ut)}function Jt(e){return e!=null&&Zt(e.length)&&!Qt(e)}function zt(e){return tr(e)&&Jt(e)}function Qt(e){var t=er(e)?Se.call(e):"";return t==Vt||t==Yt}function Zt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ht}function er(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function tr(e){return!!e&&typeof e=="object"}var rr=Xt,nr="[object Array]",ar="[object Function]",or=/^\[object .+?Constructor\]$/;function Ce(e){return!!e&&typeof e=="object"}var $e=Object.prototype,we=Function.prototype.toString,sr=$e.hasOwnProperty,De=$e.toString,lr=RegExp("^"+we.call(sr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ir=ur(Array,"isArray"),cr=9007199254740991;function ur(e,t){var r=e==null?void 0:e[t];return hr(r)?r:void 0}function fr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=cr}var dr=ir||function(e){return Ce(e)&&fr(e.length)&&De.call(e)==nr};function _r(e){return pr(e)&&De.call(e)==ar}function pr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function hr(e){return e==null?!1:_r(e)?lr.test(we.call(e)):Ce(e)&&or.test(e)}var gr=dr,br=Bt,Le=rr,Me=gr,Er=/^\d+$/,mr=Object.prototype,ke=mr.hasOwnProperty,de=br(Object,"keys"),Ie=9007199254740991;function yr(e){return function(t){return t==null?void 0:t[e]}}var vr=yr("length");function Ar(e){return e!=null&&ne(vr(e))}function Ne(e,t){return e=typeof e=="number"||Er.test(e)?+e:-1,t=t==null?Ie:t,e>-1&&e%1==0&&e<t}function ne(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ie}function _e(e){for(var t=Tr(e),r=t.length,n=r&&e.length,o=!!n&&ne(n)&&(Me(e)||Le(e)),a=-1,s=[];++a<r;){var l=t[a];(o&&Ne(l,n)||ke.call(e,l))&&s.push(l)}return s}function Pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}var Or=de?function(e){var t=e==null?void 0:e.constructor;return typeof t=="function"&&t.prototype===e||typeof e!="function"&&Ar(e)?_e(e):Pe(e)?de(e):[]}:_e;function Tr(e){if(e==null)return[];Pe(e)||(e=Object(e));var t=e.length;t=t&&ne(t)&&(Me(e)||Le(e))&&t||0;for(var r=e.constructor,n=-1,o=typeof r=="function"&&r.prototype===e,a=Array(t),s=t>0;++n<t;)a[n]=n+"";for(var l in e)!(s&&Ne(l,t))&&!(l=="constructor"&&(o||!ke.call(e,l)))&&a.push(l);return a}var Rr=Or,Sr="Expected a function",pe=Math.max;function Cr(e,t){if(typeof e!="function")throw new TypeError(Sr);return t=pe(t===void 0?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,o=pe(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,r[0],a);case 2:return e.call(this,r[0],r[1],a)}var s=Array(t+1);for(n=-1;++n<t;)s[n]=r[n];return s[t]=a,e.apply(this,s)}}var $r=Cr,te={exports:{}};(function(e,t){var r={function:!0,object:!0},n=t&&!t.nodeType?t:void 0,o=e&&!e.nodeType?e:void 0,a=_(n&&o&&typeof Y=="object"&&Y),s=_(r[typeof self]&&self),l=_(r[typeof window]&&window),i=_(r[typeof Y]&&Y),f=a||l!==(i&&i.window)&&l||s||i||Function("return this")();function _(c){return c&&c.Object===Object?c:null}e.exports=f})(te,te.exports);var wr=te.exports,Dr=1/0,Lr="[object Symbol]",xe=/[&<>"'`]/g,Mr=RegExp(xe.source),kr={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function Ir(e){return kr[e]}var Nr=Object.prototype,Pr=Nr.toString,G=wr.Symbol,xr=G?G.prototype:void 0,Fr=G?xr.toString:void 0;function Wr(e){return!!e&&typeof e=="object"}function Kr(e){return typeof e=="symbol"||Wr(e)&&Pr.call(e)==Lr}function jr(e){if(typeof e=="string")return e;if(e==null)return"";if(Kr(e))return G?Fr.call(e):"";var t=e+"";return t=="0"&&1/e==-Dr?"-0":t}function Br(e){return e=jr(e),e&&Mr.test(e)?e.replace(xe,Ir):e}var Hr=Br,Ur=Hr,Vr=Oe,Yr=/<%-([\s\S]+?)%>/g,qr=/<%([\s\S]+?)%>/g,Gr={escape:Yr,evaluate:qr,interpolate:Vr,variable:"",imports:{_:{escape:Ur}}},Xr=Gr,Jr=bt,zr=mt,Qr=vt,Zr=Dt,en=Oe,ae=Rr,tn=$r,he=Xr,rn="[object Error]",nn=/\b__p \+= '';/g,an=/\b(__p \+=) '' \+/g,on=/(__e\(.*?\)|\b__t\)) \+\n'';/g,sn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,q=/($^)/,ln=/['\n\r\u2028\u2029\\]/g,cn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function un(e){return"\\"+cn[e]}function fn(e){return!!e&&typeof e=="object"}var Fe=Object.prototype,dn=Fe.hasOwnProperty,_n=Fe.toString;function ge(e,t,r,n){return e===void 0||!dn.call(n,r)?t:e}function be(e,t,r){for(var n=-1,o=ae(t),a=o.length;++n<a;){var s=o[n],l=e[s],i=r(l,t[s],s,e,t);((i===i?i!==l:l===l)||l===void 0&&!(s in e))&&(e[s]=i)}return e}function Ee(e,t){return t==null?e:Jr(t,ae(t),e)}function We(e){return fn(e)&&typeof e.message=="string"&&_n.call(e)==rn}function pn(e,t,r){var n=he.imports._.templateSettings||he;r&&Zr(e,t,r)&&(t=r=void 0),e=zr(e),t=be(Ee({},r||t),n,ge);var o=be(Ee({},t.imports),n.imports,ge),a=ae(o),s=Qr(o,a),l,i,f=0,_=t.interpolate||q,c="__p += '",b=RegExp((t.escape||q).source+"|"+_.source+"|"+(_===en?sn:q).source+"|"+(t.evaluate||q).source+"|$","g"),h="sourceURL"in t?"//# sourceURL="+t.sourceURL+` | ||
`:"";e.replace(b,function($,P,R,z,K,j){return R||(R=z),c+=e.slice(f,j).replace(ln,un),P&&(l=!0,c+=`' + | ||
__e(`+P+`) + | ||
'`),K&&(i=!0,c+=`'; | ||
`+K+`; | ||
__p += '`),R&&(c+=`' + | ||
((__t = (`+R+`)) == null ? '' : __t) + | ||
'`),f=j+$.length,$}),c+=`'; | ||
`;var N=t.variable;N||(c=`with (obj) { | ||
"use strict";var Qe=Object.defineProperty,Ze=Object.defineProperties;var et=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var se=(e,t,r)=>t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p=(e,t)=>{for(var r in t||(t={}))le.call(t,r)&&se(e,r,t[r]);if(Y)for(var r of Y(t))ie.call(t,r)&&se(e,r,t[r]);return e},b=(e,t)=>Ze(e,et(t));var T=(e,t)=>{var r={};for(var n in e)le.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Y)for(var n of Y(e))t.indexOf(n)<0&&ie.call(e,n)&&(r[n]=e[n]);return r};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var L=require("react"),v=require("@cniot/mdd-render-engine"),tt=require("@alife/cn-filter"),ye=require("@cniot/hooks-ftp"),rt=require("@alife/cn-table"),M=require("cn-next"),nt=require("dayjs"),at=require("react-dom");function F(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var u=F(L),ce=F(tt),ot=F(rt),A=F(nt),ue=F(at);function st(n){var o=n,{schema:e,engine:t}=o,r=T(o,["schema","engine"]);const{title:a,body:s={}}=e;return u.default.useEffect(()=>{a&&(document.title=a)},[a]),s.type?t.createElement(s.type,s,r):(console.warn("page schema error, body.type not found",e),null)}const lt="$TABLE",it="$PARENT_REFRESH",z="$FILTER",ve=`${z}_SUBMIT`,ct=`${z}.`,fe=Function.prototype.apply,Z=new WeakMap;function C(e){return Z.has(e)||Z.set(e,{}),Z.get(e)}class ut{constructor(t=null,r=console){const n=C(this);return n._events=new Set,n._callbacks={},n._console=r,n._maxListeners=t===null?null:parseInt(t,10),this}_addCallback(t,r,n,o){return this._getCallbacks(t).push({callback:r,context:n,weight:o}),this._getCallbacks(t).sort((a,s)=>a.weight>s.weight),this}_getCallbacks(t){return C(this)._callbacks[t]}_getCallbackIndex(t,r){return this._has(t)?this._getCallbacks(t).findIndex(n=>n.callback===r):null}_achieveMaxListener(t){return C(this)._maxListeners!==null&&C(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,r,n){const o=this._getCallbackIndex(t,r),a=o!==-1?this._getCallbacks(t)[o]:void 0;return o!==-1&&a&&a.context===n}_has(t){return C(this)._events.has(t)}on(t,r,n=null,o=1){const a=C(this);if(typeof r!="function")throw new TypeError(`${r} is not a function`);return this._has(t)?(this._achieveMaxListener(t)&&a._console.warn(`Max listeners (${a._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&a._console.warn(`Event "${t}" already has the callback ${r}.`)):(a._events.add(t),a._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,r,n=null,o=1){const a=(...s)=>(this.off(t,a),fe.call(r,n,s));return this.on(t,a,n,o)}off(t,r=null){const n=C(this);let o;return this._has(t)&&(r===null?(n._events.delete(t),n._callbacks[t]=null):(o=this._getCallbackIndex(t,r),o!==-1&&(n._callbacks[t].splice(o,1),this.off(...arguments)))),this}emit(t,...r){return this._has(t)&&this._getCallbacks(t).forEach(n=>fe.call(n.callback,n.context,r)),this}clear(){const t=C(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}class ft extends ut{constructor(){super(),this.data=new Map}getValue(t){return this.data[t]}getVariable(t){return t==="ALL"?this.data:this.getValue(t)}setValue(t,r){this.data[t]=r}getValues(){return this.data}}function W(e={},t=[]){return t.reduce((r,n)=>(r[n]=e[n],r),{})}const{tr:dt}=v.i18n,_t={input:"Input","number-picker":"NumberPicker",switch:"Switch",radio:"Radio","cascad-select":"CascadSelect"};function pt({schema:e,engine:t}){const{fields:r=[],col:n=4,labelSpan:o=4,maxVisibleRow:a=2}=e,[s]=u.default.useState(()=>new ft),l=ye.useFilter(i=>{t.emit(ve,i)},{columns:n,maxVisibleRow:a,labelCol:{fixedSpan:o}});return u.default.useEffect(()=>{t.setModule(z,s)},[t,s]),u.default.createElement(ce.default,b(p({},l),{className:"mdd-build-filter",onChange:(i,f)=>{const{name:_,value:c}=f;s.setValue(_,c),t.emit(ct+_,c)}}),r.map(i=>u.default.createElement(ce.default.Item,{key:i.name,label:dt(i.label),name:i.name,fullWidth:!0},ht(t,i.type,i))))}function ht(e,t,r){const n=_t[t]||t;return e.createElement(n,r,W(r,r[t]))}class gt extends v.JSONWatch{constructor(){super({})}setCurrentPage(t){return this.set("CURRENT_PAGE",t),this}setPageSize(t){return this.set("PAGE_SIZE",t),this}setTotalCount(t){return this.set("TOTAL_COUNT",t),this}setTableData(t){return this.set("TABLE_DATA",t),this}setRecordData(t){return this.set("RECORD_DATA",t),this}setSelectedData(t){return this.set("SELECTED_DATA",t),this}setSelectedKeyData(t){return this.set("SELECTED_KEY_DATA",t),this}getValue(t){return this.data[t]}setValue(t,r){this.set(t,r)}getValues(){return this.get("$ALL")}}var q=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function bt(e,t,r){r||(r={});for(var n=-1,o=t.length;++n<o;){var a=t[n];r[a]=e[a]}return r}var Et=bt;function mt(e){return e==null?"":e+""}var yt=mt;function vt(e,t){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e[t[r]];return o}var At=vt,Ot=/^\d+$/,Ae=9007199254740991;function Tt(e){return function(t){return t==null?void 0:t[e]}}var Rt=Tt("length");function St(e){return e!=null&&wt(Rt(e))}function Ct(e,t){return e=typeof e=="number"||Ot.test(e)?+e:-1,t=t==null?Ae:t,e>-1&&e%1==0&&e<t}function $t(e,t,r){if(!Dt(r))return!1;var n=typeof t;if(n=="number"?St(r)&&Ct(t,r.length):n=="string"&&t in r){var o=r[t];return e===e?e===o:o!==o}return!1}function wt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ae}function Dt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}var Lt=$t,Mt=/<%=([\s\S]+?)%>/g,Oe=Mt,kt="[object Function]",It=/^\[object .+?Constructor\]$/;function Nt(e){return!!e&&typeof e=="object"}var Te=Object.prototype,Re=Function.prototype.toString,Pt=Te.hasOwnProperty,xt=Te.toString,Ft=RegExp("^"+Re.call(Pt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wt(e,t){var r=e==null?void 0:e[t];return Bt(r)?r:void 0}function Kt(e){return jt(e)&&xt.call(e)==kt}function jt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Bt(e){return e==null?!1:Kt(e)?Ft.test(Re.call(e)):Nt(e)&&It.test(e)}var Ht=Wt,Ut=9007199254740991,Vt="[object Arguments]",Yt="[object Function]",qt="[object GeneratorFunction]",re=Object.prototype,Gt=re.hasOwnProperty,Se=re.toString,Xt=re.propertyIsEnumerable;function Jt(e){return Qt(e)&&Gt.call(e,"callee")&&(!Xt.call(e,"callee")||Se.call(e)==Vt)}function zt(e){return e!=null&&er(e.length)&&!Zt(e)}function Qt(e){return rr(e)&&zt(e)}function Zt(e){var t=tr(e)?Se.call(e):"";return t==Yt||t==qt}function er(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ut}function tr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function rr(e){return!!e&&typeof e=="object"}var nr=Jt,ar="[object Array]",or="[object Function]",sr=/^\[object .+?Constructor\]$/;function Ce(e){return!!e&&typeof e=="object"}var $e=Object.prototype,we=Function.prototype.toString,lr=$e.hasOwnProperty,De=$e.toString,ir=RegExp("^"+we.call(lr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cr=fr(Array,"isArray"),ur=9007199254740991;function fr(e,t){var r=e==null?void 0:e[t];return gr(r)?r:void 0}function dr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ur}var _r=cr||function(e){return Ce(e)&&dr(e.length)&&De.call(e)==ar};function pr(e){return hr(e)&&De.call(e)==or}function hr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function gr(e){return e==null?!1:pr(e)?ir.test(we.call(e)):Ce(e)&&sr.test(e)}var br=_r,Er=Ht,Le=nr,Me=br,mr=/^\d+$/,yr=Object.prototype,ke=yr.hasOwnProperty,de=Er(Object,"keys"),Ie=9007199254740991;function vr(e){return function(t){return t==null?void 0:t[e]}}var Ar=vr("length");function Or(e){return e!=null&&ne(Ar(e))}function Ne(e,t){return e=typeof e=="number"||mr.test(e)?+e:-1,t=t==null?Ie:t,e>-1&&e%1==0&&e<t}function ne(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ie}function _e(e){for(var t=Rr(e),r=t.length,n=r&&e.length,o=!!n&&ne(n)&&(Me(e)||Le(e)),a=-1,s=[];++a<r;){var l=t[a];(o&&Ne(l,n)||ke.call(e,l))&&s.push(l)}return s}function Pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}var Tr=de?function(e){var t=e==null?void 0:e.constructor;return typeof t=="function"&&t.prototype===e||typeof e!="function"&&Or(e)?_e(e):Pe(e)?de(e):[]}:_e;function Rr(e){if(e==null)return[];Pe(e)||(e=Object(e));var t=e.length;t=t&&ne(t)&&(Me(e)||Le(e))&&t||0;for(var r=e.constructor,n=-1,o=typeof r=="function"&&r.prototype===e,a=Array(t),s=t>0;++n<t;)a[n]=n+"";for(var l in e)!(s&&Ne(l,t))&&!(l=="constructor"&&(o||!ke.call(e,l)))&&a.push(l);return a}var Sr=Tr,Cr="Expected a function",pe=Math.max;function $r(e,t){if(typeof e!="function")throw new TypeError(Cr);return t=pe(t===void 0?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,o=pe(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,r[0],a);case 2:return e.call(this,r[0],r[1],a)}var s=Array(t+1);for(n=-1;++n<t;)s[n]=r[n];return s[t]=a,e.apply(this,s)}}var wr=$r,te={exports:{}};(function(e,t){var r={function:!0,object:!0},n=t&&!t.nodeType?t:void 0,o=e&&!e.nodeType?e:void 0,a=_(n&&o&&typeof q=="object"&&q),s=_(r[typeof self]&&self),l=_(r[typeof window]&&window),i=_(r[typeof q]&&q),f=a||l!==(i&&i.window)&&l||s||i||Function("return this")();function _(c){return c&&c.Object===Object?c:null}e.exports=f})(te,te.exports);var Dr=te.exports,Lr=1/0,Mr="[object Symbol]",xe=/[&<>"'`]/g,kr=RegExp(xe.source),Ir={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function Nr(e){return Ir[e]}var Pr=Object.prototype,xr=Pr.toString,X=Dr.Symbol,Fr=X?X.prototype:void 0,Wr=X?Fr.toString:void 0;function Kr(e){return!!e&&typeof e=="object"}function jr(e){return typeof e=="symbol"||Kr(e)&&xr.call(e)==Mr}function Br(e){if(typeof e=="string")return e;if(e==null)return"";if(jr(e))return X?Wr.call(e):"";var t=e+"";return t=="0"&&1/e==-Lr?"-0":t}function Hr(e){return e=Br(e),e&&kr.test(e)?e.replace(xe,Nr):e}var Ur=Hr,Vr=Ur,Yr=Oe,qr=/<%-([\s\S]+?)%>/g,Gr=/<%([\s\S]+?)%>/g,Xr={escape:qr,evaluate:Gr,interpolate:Yr,variable:"",imports:{_:{escape:Vr}}},Jr=Xr,zr=Et,Qr=yt,Zr=At,en=Lt,tn=Oe,ae=Sr,rn=wr,he=Jr,nn="[object Error]",an=/\b__p \+= '';/g,on=/\b(__p \+=) '' \+/g,sn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ln=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,G=/($^)/,cn=/['\n\r\u2028\u2029\\]/g,un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function fn(e){return"\\"+un[e]}function dn(e){return!!e&&typeof e=="object"}var Fe=Object.prototype,_n=Fe.hasOwnProperty,pn=Fe.toString;function ge(e,t,r,n){return e===void 0||!_n.call(n,r)?t:e}function be(e,t,r){for(var n=-1,o=ae(t),a=o.length;++n<a;){var s=o[n],l=e[s],i=r(l,t[s],s,e,t);((i===i?i!==l:l===l)||l===void 0&&!(s in e))&&(e[s]=i)}return e}function Ee(e,t){return t==null?e:zr(t,ae(t),e)}function We(e){return dn(e)&&typeof e.message=="string"&&pn.call(e)==nn}function hn(e,t,r){var n=he.imports._.templateSettings||he;r&&en(e,t,r)&&(t=r=void 0),e=Qr(e),t=be(Ee({},r||t),n,ge);var o=be(Ee({},t.imports),n.imports,ge),a=ae(o),s=Zr(o,a),l,i,f=0,_=t.interpolate||G,c="__p += '",E=RegExp((t.escape||G).source+"|"+_.source+"|"+(_===tn?ln:G).source+"|"+(t.evaluate||G).source+"|$","g"),h="sourceURL"in t?"//# sourceURL="+t.sourceURL+` | ||
`:"";e.replace(E,function(K,$,w,P,j,B){return w||(w=P),c+=e.slice(f,B).replace(cn,fn),$&&(l=!0,c+=`' + | ||
__e(`+$+`) + | ||
'`),j&&(i=!0,c+=`'; | ||
`+j+`; | ||
__p += '`),w&&(c+=`' + | ||
((__t = (`+w+`)) == null ? '' : __t) + | ||
'`),f=B+K.length,K}),c+=`'; | ||
`;var R=t.variable;R||(c=`with (obj) { | ||
`+c+` | ||
} | ||
`),c=(i?c.replace(nn,""):c).replace(an,"$1").replace(on,"$1;"),c="function("+(N||"obj")+`) { | ||
`+(N?"":`obj || (obj = {}); | ||
`),c=(i?c.replace(an,""):c).replace(on,"$1").replace(sn,"$1;"),c="function("+(R||"obj")+`) { | ||
`+(R?"":`obj || (obj = {}); | ||
`)+"var __t, __p = ''"+(l?", __e = _.escape":"")+(i?`, __j = Array.prototype.join; | ||
@@ -18,2 +18,2 @@ function print() { __p += __j.call(arguments, '') } | ||
`)+c+`return __p | ||
}`;var M=hn(function(){return Function(a,h+"return "+c).apply(void 0,s)});if(M.source=c,We(M))throw M;return M}var hn=tn(function(e,t){try{return e.apply(void 0,t)}catch(r){return We(r)?r:new Error(r)}}),gn=pn;const oe=(e,t)=>{if(e&&typeof e=="string")try{return gn(e)(t)}catch{return e}else return e};var bn=e=>oe(e.tpl,e),En=e=>{const{items:t=[],value:r}=e,n={size:"small"},o=t.filter(i=>typeof r=="boolean"||typeof r=="number"?String(r)===i.value:r===i.value);if(o.length===0)return u.default.createElement(L.Tag,p({},n),r);const{type:a,label:s}=o[0];n.color=a;const l=oe(s,e);return u.default.createElement(L.Tag,p({},n),l)},mn=e=>{const{items:t=[],value:r}=e,n=t.filter(a=>typeof r=="boolean"||typeof r=="number"?String(r)===a.value:r===a.value);if(n.length===0)return r;const{label:o}=n[0];return oe(o,e)};const me={tpl:bn,tag:En,"single-enum":mn};var yn=e=>{const{type:t,value:r}=e;return me[t]?me[t](e):r};const vn=(e=[])=>e.reduce((t,r)=>{const{label:n}=r||{};return t+=n.length*18,t},20);function An({schema:e,engine:t}){const{api:r,table:n,headerToolbar:o}=e,[a,s]=D.useState([]),{columns:l=[],primaryKey:i="id",bulkActions:f=[],actionColumns:_=[],pagination:c}=n,{defaultPageSize:b}=c||{},h=D.useRef(b||10),N=Array.isArray(f)&&f.length>0,M=!c||!b,[$]=D.useState(()=>new ht),P=l?l.map(k=>{var S=k,{label:d,name:y,width:g,type:O}=S,m=T(S,["label","name","width","type"]);return E(p({},m),{title:d,width:typeof g=="string"&&/^\d*$/.test(g)?Number(g):g,dataIndex:y,cell:(B,H,U)=>yn(E(p({},m),{value:B,index:H,record:U,type:O}))})}):[],R=_?_.map(d=>({children:d.label,onClick:(y,g,O)=>{const{type:m}=d.action;$.setRecordData(g),v.ACTION_EVENT_KEY[m]?t.emit(v.ACTION_EVENT_KEY[m],d.action):console.error(`action type: ${m} not defined`,d)}})):[],z=R&&R.length>0?{width:vn(_),buttons:R}:null,K=f?f.map(d=>({children:d.label,type:"primary",onClick:(y,g,O)=>{console.log("selectKeys: ",g),console.log("selectRecords: ",O);const{action:m}=d,{type:k}=m||{};v.ACTION_EVENT_KEY[k]?t.emit(v.ACTION_EVENT_KEY[k],m):console.error(`action type: ${k} not defined`,m)}})):[],j=o?o.map(d=>({children:d.label,type:"primary",onClick:y=>{const{action:g}=d,{type:O}=g||{};v.ACTION_EVENT_KEY[O]?t.emit(v.ACTION_EVENT_KEY[O],g):console.error(`action type: ${O} not defined`,g)}})):[],Ke=async(d,y=1,g=10)=>{var H;h.current=g;const B=r,{params:O}=B,m=T(B,["params"]),k=E(p({},m),{params:E(p(p({},O),d),{currentPage:y,pageSize:g}),watch:[]}),S={total:0,dataSource:[]};try{const Q=t.getModule(v.MODULE_AJAX)(k,t),I=await new Promise((Ge,Xe)=>{Q.subscribe(Je=>{Ge(Je)}),Q.catch(Xe),Q.send({})});S.total=((H=I==null?void 0:I.paging)==null?void 0:H.totalCount)||0,S.dataSource=(I==null?void 0:I.tableData)||[]}catch(U){console.error("data source load error:",r,U)}return $.setCurrentPage(y).setPageSize(g).setTableData(S.dataSource).setTotalCount(S.total),S},x=ye.useTable(Ke),{pageInfo:fa,onSizeChange:da,toolbar:je}=x,[Be,He]=D.useState(P),[Ue,Ve]=D.useState(P),Ye=E(p({},je),{batchArea:K,toolArea:j,columnChange(d,y){He(d),Ve(y)},screenChange(d){console.log("isFullScreen: ",d)}});D.useEffect(()=>{t.setModule(st,$),t.on(lt,()=>{x.onSearch(formData,1,h.current)}),t.on(ve,d=>{x.onSearch(d,1,h.current)}),x.onSearch(t.getModule(J).getValues(),1,h.current)},[]);const qe=N?{rowSelection:{onChange:(d,y)=>{s(d),$.setSelectedKeyData(d).setSelectedData(y)},selectedRowKeys:a||[]}}:{};return u.default.createElement("div",{className:"mdd-build-table"},u.default.createElement(at.default,E(p(E(p({},x),{pageSizeList:[10,20,50,100],paging:!M}),qe),{columns:Be,allColumns:Ue,primaryKey:i,operateColumn:z,toolbar:Ye})))}function On({schema:e,engine:t}){const{api:r,filter:n,headerToolbar:o,table:a}=e;return u.default.createElement(u.default.Fragment,null,u.default.createElement(_t,{schema:n,engine:t}),u.default.createElement(An,{schema:{headerToolbar:o,table:a,api:r},engine:t}))}var Tn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{source:s}=e,[l,i]=u.default.useState(r.dataSource||[]),[f,_]=u.default.useState(!1);return u.default.useEffect(()=>{if(!s)return;t.getModule("AJAX_PARSER")(s,t).subscribe("loading",_).subscribe(b=>{Array.isArray(b)?i(b):i(b.options||[])}).catch(b=>{console.error("select source load error",b,s)}).send()},[t,s]),t.createElement("Select",e,E(p({},r),{ref:n,tagInline:!0,disabled:f,showSearch:!0,autoWidth:!0,state:f?"loading":null,dataSource:l}))}),Rn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,disabledHours:l=[],disabledMinutes:i=[],disabledSeconds:f=[]}=e,_=u.default.useCallback(h=>{if(l&&l.length>0)return l.indexOf(h)>-1},[l]),c=u.default.useCallback(h=>{if(i&&i.length>0)return i.indexOf(h)>-1},[i]),b=u.default.useCallback(h=>{if(f&&f.length>0)return f.indexOf(h)>-1},[f]);return t.createElement("TimePicker2",e,E(p(p({ref:n},r),W(e,e[s])),{disabledHours:_,disabledMinutes:c,disabledSeconds:b}))});const w=A.default(),ee=A.default().hour(0).minute(0).second(0).millisecond(0);A.default().hour(0).minute(0).second(0).millisecond(0).hour(24);const Sn=A.default().subtract(7,"day"),Cn=A.default().subtract(1,"month"),$n=A.default().subtract(3,"month"),wn=A.default().subtract(1,"year"),Dn=A.default().add(7,"day"),Ln=A.default().add(1,"month"),Mn=A.default().add(3,"month"),kn=A.default().add(1,"year"),In="ALL_SELECTED",Nn="BEFORE_NOW_DISABLED",Pn="AFTER_NOW_DISABLED",xn="FORWARD_1_WEEK",Fn="FORWARD_1_MONTH",Wn="FORWARD_3_MONTH",Kn="FORWARD_1_YEAR",jn="BACKWARD_1_WEEK",Bn="BACKWARD_1_MONTH",Hn="BACKWARD_3_MONTH",Un="BACKWARD_1_YEAR",X={[In]:function(){return!1},[Nn](e,t){return e.valueOf()<ee.valueOf()},[Pn](e,t){return e.valueOf()>ee.valueOf()},[xn](e,t){return e.valueOf()<Sn.valueOf()||e.valueOf()>w.valueOf()},[Fn](e,t){return e.valueOf()<Cn.valueOf()||e.valueOf()>w.valueOf()},[Wn](e,t){return e.valueOf()<$n.valueOf()||e.valueOf()>w.valueOf()},[Kn](e,t){return e.valueOf()<wn.valueOf()||e.valueOf()>w.valueOf()},[jn](e,t){return e.valueOf()>Dn.valueOf()||e.valueOf()<ee.valueOf()},[Bn](e,t){return e.valueOf()>Ln.valueOf()||e.valueOf()<w.valueOf()},[Hn](e,t){return e.valueOf()>Mn.valueOf()||e.valueOf()<w.valueOf()},[Un](e,t){return e.valueOf()>kn.valueOf()||e.valueOf()<w.valueOf()}};var Vn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,dateRange:l="ALL_SELECTED"}=e;return t.createElement("DatePicker2",e,E(p(p({ref:n},r),W(e,e[s])),{disabledDate:X[l]||X.ALL_SELECTED}))}),Yn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,dateRange:l="ALL_SELECTED"}=e;return t.createElement("DatePicker2.RangePicker",e,E(p(p({ref:n},r),W(e,e[s])),{disabledDate:X[l]||X.ALL_SELECTED}))}),qn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,disabledHours:l=[],disabledMinutes:i=[],disabledSeconds:f=[]}=e,_=u.default.useCallback(h=>{if(l&&l.length>0)return l.indexOf(h)>-1},[l]),c=u.default.useCallback(h=>{if(i&&i.length>0)return i.indexOf(h)>-1},[i]),b=u.default.useCallback(h=>{if(f&&f.length>0)return f.indexOf(h)>-1},[f]);return t.createElement("TimePicker2.RangePicker",e,E(p(p({ref:n},r),W(e,e[s])),{disabledHours:_,disabledMinutes:c,disabledSeconds:b}))}),Gn={},Xn={},Jn={"en-US":Gn,"zh-CN":Xn};const zn="AJAX_PARSER",Qn=e=>new Promise((t,r)=>{e?L.Dialog.confirm({v2:!0,title:"\u786E\u8BA4",content:"\u786E\u8BA4\u64CD\u4F5C\u5417\uFF1F",onOk:()=>{t()},onCancel:r}):t()});function Zn({engine:e,schema:t}){return new Promise((r,n)=>{const{secondConfirm:o}=t;t.watch=[];const a=ea(500);Qn(o).then(()=>{e.getModule(zn)(t,e).subscribe("loading",a).subscribe(()=>{L.Message.success({title:v.i18n.tr("\u64CD\u4F5C\u6210\u529F"),duration:2e3}),r()}).catch(l=>{L.Message.error({title:l.message,duration:2e3}),n()}).send()}).catch(()=>{})})}function ea(e=500){let t=null;return function(r){r?t=setTimeout(()=>{L.Message.loading({title:v.i18n.tr("\u8BF7\u7A0D\u7B49..."),duration:1e4})},e):(L.Message.hide(),t&&clearTimeout(t))}}const ta=["close","esc","mask"];function ra({engine:e,schema:t}){const r=e.getComponent("Dialog"),{title:n,width:o,height:a,value:s,closeMode:l=ta,params:i={}}=t,f=r.show({v2:!0,title:n,visible:!0,footer:!1,width:Number(o)||void 0,height:Number(a)||void 0,closeMode:l,onClose(){f.hide()},content:e.createElement(s,t,{schema:t,engine:e,params:e.getVariableByJSON(i),closeSelf(){f.hide()},parentRefresh(){e.emit("$PARENT_REFRESH")}})})}const na=["close","esc","mask"];function aa({engine:e,schema:t}){const r=sa();ue.default.render(u.default.createElement(oa,{engine:e,schema:t,close:()=>{ue.default.unmountComponentAtNode(r.node),r.rmeove()}}),r.node)}function oa(e){const{engine:t,schema:r}=e,{title:n,width:o,height:a,value:s,closeMode:l=na,params:i={}}=r,f=t.getComponent("Drawer"),[_,c]=u.default.useState(!0);return u.default.createElement(f,{title:n,visible:_,width:Number(o)||void 0,height:Number(a)||void 0,closeMode:l,onClose:()=>c(!1)},t.createElement(s,r,{engine:t,schema:r,params:t.getVariableByJSON(i),closeSelf(){c(!1),e.close&&e.close()},parentRefresh(){t.emit("$PARENT_REFRESH")}}))}function sa(){const e=document.createElement("div");return{node:e,append(){document.body.append(e)},remove(){document.body.removeChild(e)}}}function la({engine:e,schema:t={}}){const{value:r,blank:n,params:o={}}=t||{},a=e.getVariableByJSON(o),s=ia(a);if(r){const l=r+"?"+s;n?window.open(l):location.href=l}else console.info("url not found",r)}function ia(e){return Object.keys(e).map(t=>{if(e[t]!==void 0)return`${t}=${encodeURIComponent(e[t])}`}).filter(t=>t).join("&")}var ca={ajax:Zn,dialog:ra,url:la,drawer:aa};const ua={ftp:On,page:ot,select:Tn,"time-picker2":Rn,"date-picker2":Vn,"date-range-picker":Yn,"time-range-picker":qn};exports.actions=ca;exports.components=ua;exports.locale=Jn; | ||
}`;var k=gn(function(){return Function(a,h+"return "+c).apply(void 0,s)});if(k.source=c,We(k))throw k;return k}var gn=rn(function(e,t){try{return e.apply(void 0,t)}catch(r){return We(r)?r:new Error(r)}}),bn=hn;const oe=(e,t)=>{if(e&&typeof e=="string")try{return bn(e)(t)}catch{return e}else return e};var En=e=>oe(e.tpl,e),mn=e=>{const{items:t=[],value:r}=e,n={size:"small"},o=t.filter(i=>typeof r=="boolean"||typeof r=="number"?String(r)===i.value:r===i.value);if(o.length===0)return u.default.createElement(M.Tag,p({},n),r);const{type:a,label:s}=o[0];n.color=a;const l=oe(s,e);return u.default.createElement(M.Tag,p({},n),l)},yn=e=>{const{items:t=[],value:r}=e,n=t.filter(a=>typeof r=="boolean"||typeof r=="number"?String(r)===a.value:r===a.value);if(n.length===0)return r;const{label:o}=n[0];return oe(o,e)};const me={tpl:En,tag:mn,"single-enum":yn};var vn=e=>{const{type:t,value:r}=e;return me[t]?me[t](e):r};const An=(e=[])=>e.reduce((t,r)=>{const{label:n}=r||{};return t+=n.length*18,t},20);function On({schema:e,engine:t}){const{api:r,table:n,headerToolbar:o}=e,[a,s]=L.useState([]),{columns:l=[],primaryKey:i="id",bulkActions:f=[],actionColumns:_=[],pagination:c,tree:E=!1}=n,{defaultPageSize:h}=c||{},R=L.useRef(h||10),k=Array.isArray(f)&&f.length>0,K=!c||!h,[$]=L.useState(()=>new gt),w=l?l.map(I=>{var S=I,{label:d,name:y,width:g,type:O}=S,m=T(S,["label","name","width","type"]);return b(p({},m),{title:d,width:typeof g=="string"&&/^\d*$/.test(g)?Number(g):g,dataIndex:y,cell:(H,U,V)=>vn(b(p({},m),{value:H,index:U,record:V,type:O}))})}):[],P=_?_.map(d=>({children:d.label,onClick:(y,g,O)=>{const{type:m}=d.action;$.setRecordData(g),v.ACTION_EVENT_KEY[m]?t.emit(v.ACTION_EVENT_KEY[m],d.action):console.error(`action type: ${m} not defined`,d)}})):[],j=P&&P.length>0?{width:An(_),buttons:P}:null,B=f?f.map(d=>({children:d.label,type:"primary",onClick:(y,g,O)=>{console.log("selectKeys: ",g),console.log("selectRecords: ",O);const{action:m}=d,{type:I}=m||{};v.ACTION_EVENT_KEY[I]?t.emit(v.ACTION_EVENT_KEY[I],m):console.error(`action type: ${I} not defined`,m)}})):[],Ke=o?o.map(d=>({children:d.label,type:"primary",onClick:y=>{const{action:g}=d,{type:O}=g||{};v.ACTION_EVENT_KEY[O]?t.emit(v.ACTION_EVENT_KEY[O],g):console.error(`action type: ${O} not defined`,g)}})):[],je=async(d,y=1,g=10)=>{var U;R.current=g;const H=r,{params:O}=H,m=T(H,["params"]),I=b(p({},m),{params:b(p(p({},O),d),{currentPage:y,pageSize:g}),watch:[]}),S={total:0,dataSource:[]};try{const Q=t.getModule(v.MODULE_AJAX)(I,t),N=await new Promise((Xe,Je)=>{Q.subscribe(ze=>{Xe(ze)}),Q.catch(Je),Q.send({})});S.total=((U=N==null?void 0:N.paging)==null?void 0:U.totalCount)||0,S.dataSource=(N==null?void 0:N.tableData)||[]}catch(V){console.error("data source load error:",r,V)}return $.setCurrentPage(y).setPageSize(g).setTableData(S.dataSource).setTotalCount(S.total),S},x=ye.useTable(je),{pageInfo:da,onSizeChange:_a,toolbar:Be}=x,[He,Ue]=L.useState(w),[Ve,Ye]=L.useState(w),qe=b(p({},Be),{batchArea:B,toolArea:Ke,columnChange(d,y){Ue(d),Ye(y)},screenChange(d){console.log("isFullScreen: ",d)}});L.useEffect(()=>{t.setModule(lt,$),t.on(it,()=>{x.onSearch(formData,1,R.current)}),t.on(ve,d=>{x.onSearch(d,1,R.current)}),x.onSearch(t.getModule(z).getValues(),1,R.current)},[]);const Ge=k?{rowSelection:{onChange:(d,y)=>{s(d),$.setSelectedKeyData(d).setSelectedData(y)},selectedRowKeys:a||[]}}:{};return u.default.createElement("div",{className:"mdd-build-table"},u.default.createElement(ot.default,b(p(b(p({tree:E},x),{pageSizeList:[10,20,50,100],paging:!K}),Ge),{columns:He,allColumns:Ve,primaryKey:i,operateColumn:j,toolbar:qe})))}function Tn({schema:e,engine:t}){const{api:r,filter:n,headerToolbar:o,table:a}=e;return u.default.createElement(u.default.Fragment,null,u.default.createElement(pt,{schema:n,engine:t}),u.default.createElement(On,{schema:{headerToolbar:o,table:a,api:r},engine:t}))}var Rn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{source:s}=e,[l,i]=u.default.useState(r.dataSource||[]),[f,_]=u.default.useState(!1);return u.default.useEffect(()=>{if(!s)return;t.getModule("AJAX_PARSER")(s,t).subscribe("loading",_).subscribe(E=>{Array.isArray(E)?i(E):i(E.options||[])}).catch(E=>{console.error("select source load error",E,s)}).send()},[t,s]),t.createElement("Select",e,b(p({},r),{ref:n,tagInline:!0,disabled:f,showSearch:!0,autoWidth:!0,state:f?"loading":null,dataSource:l}))}),Sn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,disabledHours:l=[],disabledMinutes:i=[],disabledSeconds:f=[]}=e,_=u.default.useCallback(h=>{if(l&&l.length>0)return l.indexOf(h)>-1},[l]),c=u.default.useCallback(h=>{if(i&&i.length>0)return i.indexOf(h)>-1},[i]),E=u.default.useCallback(h=>{if(f&&f.length>0)return f.indexOf(h)>-1},[f]);return t.createElement("TimePicker2",e,b(p(p({ref:n},r),W(e,e[s])),{disabledHours:_,disabledMinutes:c,disabledSeconds:E}))});const D=A.default(),ee=A.default().hour(0).minute(0).second(0).millisecond(0);A.default().hour(0).minute(0).second(0).millisecond(0).hour(24);const Cn=A.default().subtract(7,"day"),$n=A.default().subtract(1,"month"),wn=A.default().subtract(3,"month"),Dn=A.default().subtract(1,"year"),Ln=A.default().add(7,"day"),Mn=A.default().add(1,"month"),kn=A.default().add(3,"month"),In=A.default().add(1,"year"),Nn="ALL_SELECTED",Pn="BEFORE_NOW_DISABLED",xn="AFTER_NOW_DISABLED",Fn="FORWARD_1_WEEK",Wn="FORWARD_1_MONTH",Kn="FORWARD_3_MONTH",jn="FORWARD_1_YEAR",Bn="BACKWARD_1_WEEK",Hn="BACKWARD_1_MONTH",Un="BACKWARD_3_MONTH",Vn="BACKWARD_1_YEAR",J={[Nn]:function(){return!1},[Pn](e,t){return e.valueOf()<ee.valueOf()},[xn](e,t){return e.valueOf()>ee.valueOf()},[Fn](e,t){return e.valueOf()<Cn.valueOf()||e.valueOf()>D.valueOf()},[Wn](e,t){return e.valueOf()<$n.valueOf()||e.valueOf()>D.valueOf()},[Kn](e,t){return e.valueOf()<wn.valueOf()||e.valueOf()>D.valueOf()},[jn](e,t){return e.valueOf()<Dn.valueOf()||e.valueOf()>D.valueOf()},[Bn](e,t){return e.valueOf()>Ln.valueOf()||e.valueOf()<ee.valueOf()},[Hn](e,t){return e.valueOf()>Mn.valueOf()||e.valueOf()<D.valueOf()},[Un](e,t){return e.valueOf()>kn.valueOf()||e.valueOf()<D.valueOf()},[Vn](e,t){return e.valueOf()>In.valueOf()||e.valueOf()<D.valueOf()}};var Yn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,dateRange:l="ALL_SELECTED"}=e;return t.createElement("DatePicker2",e,b(p(p({ref:n},r),W(e,e[s])),{disabledDate:J[l]||J.ALL_SELECTED}))}),qn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,dateRange:l="ALL_SELECTED"}=e;return t.createElement("DatePicker2.RangePicker",e,b(p(p({ref:n},r),W(e,e[s])),{disabledDate:J[l]||J.ALL_SELECTED}))}),Gn=u.default.forwardRef((o,n)=>{var a=o,{schema:e,engine:t}=a,r=T(a,["schema","engine"]);const{type:s,disabledHours:l=[],disabledMinutes:i=[],disabledSeconds:f=[]}=e,_=u.default.useCallback(h=>{if(l&&l.length>0)return l.indexOf(h)>-1},[l]),c=u.default.useCallback(h=>{if(i&&i.length>0)return i.indexOf(h)>-1},[i]),E=u.default.useCallback(h=>{if(f&&f.length>0)return f.indexOf(h)>-1},[f]);return t.createElement("TimePicker2.RangePicker",e,b(p(p({ref:n},r),W(e,e[s])),{disabledHours:_,disabledMinutes:c,disabledSeconds:E}))}),Xn={},Jn={},zn={"en-US":Xn,"zh-CN":Jn};const Qn="AJAX_PARSER",Zn=e=>new Promise((t,r)=>{e?M.Dialog.confirm({v2:!0,title:"\u786E\u8BA4",content:"\u786E\u8BA4\u64CD\u4F5C\u5417\uFF1F",onOk:()=>{t()},onCancel:r}):t()});function ea({engine:e,schema:t}){return new Promise((r,n)=>{const{secondConfirm:o}=t;t.watch=[];const a=ta(500);Zn(o).then(()=>{e.getModule(Qn)(t,e).subscribe("loading",a).subscribe(()=>{M.Message.success({title:v.i18n.tr("\u64CD\u4F5C\u6210\u529F"),duration:2e3}),r()}).catch(l=>{M.Message.error({title:l.message,duration:2e3}),n()}).send()}).catch(()=>{})})}function ta(e=500){let t=null;return function(r){r?t=setTimeout(()=>{M.Message.loading({title:v.i18n.tr("\u8BF7\u7A0D\u7B49..."),duration:1e4})},e):(M.Message.hide(),t&&clearTimeout(t))}}const ra=["close","esc","mask"];function na({engine:e,schema:t}){const r=e.getComponent("Dialog"),{title:n,width:o,height:a,value:s,closeMode:l=ra,params:i={}}=t,f=r.show({v2:!0,title:n,visible:!0,footer:!1,width:Number(o)||void 0,height:Number(a)||void 0,closeMode:l,onClose(){f.hide()},content:e.createElement(s,t,{schema:t,engine:e,params:e.getVariableByJSON(i),closeSelf(){f.hide()},parentRefresh(){e.emit("$PARENT_REFRESH")}})})}const aa=["close","esc","mask"];function oa({engine:e,schema:t}){const r=la();ue.default.render(u.default.createElement(sa,{engine:e,schema:t,close:()=>{ue.default.unmountComponentAtNode(r.node),r.rmeove()}}),r.node)}function sa(e){const{engine:t,schema:r}=e,{title:n,width:o,height:a,value:s,closeMode:l=aa,params:i={}}=r,f=t.getComponent("Drawer"),[_,c]=u.default.useState(!0);return u.default.createElement(f,{title:n,visible:_,width:Number(o)||void 0,height:Number(a)||void 0,closeMode:l,onClose:()=>c(!1)},t.createElement(s,r,{engine:t,schema:r,params:t.getVariableByJSON(i),closeSelf(){c(!1),e.close&&e.close()},parentRefresh(){t.emit("$PARENT_REFRESH")}}))}function la(){const e=document.createElement("div");return{node:e,append(){document.body.append(e)},remove(){document.body.removeChild(e)}}}function ia({engine:e,schema:t={}}){const{value:r,blank:n,params:o={}}=t||{},a=e.getVariableByJSON(o),s=ca(a);if(r){const l=r+"?"+s;n?window.open(l):location.href=l}else console.info("url not found",r)}function ca(e){return Object.keys(e).map(t=>{if(e[t]!==void 0)return`${t}=${encodeURIComponent(e[t])}`}).filter(t=>t).join("&")}var ua={ajax:ea,dialog:na,url:ia,drawer:oa};const fa={ftp:Tn,page:st,select:Rn,"time-picker2":Sn,"date-picker2":Yn,"date-range-picker":qn,"time-range-picker":Gn};exports.actions=ua;exports.components=fa;exports.locale=zn; |
@@ -774,3 +774,3 @@ var __defProp = Object.defineProperty; | ||
const [rowSelectionList, setRowSelectionList] = useState([]); | ||
const { columns = [], primaryKey = "id", bulkActions = [], actionColumns = [], pagination } = table; | ||
const { columns = [], primaryKey = "id", bulkActions = [], actionColumns = [], pagination, tree = false } = table; | ||
const { defaultPageSize } = pagination || {}; | ||
@@ -903,3 +903,5 @@ const pageSizeCache = useRef(defaultPageSize || 10); | ||
className: "mdd-build-table" | ||
}, /* @__PURE__ */ React.createElement(CNTable, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, tableProps), { | ||
}, /* @__PURE__ */ React.createElement(CNTable, __spreadProps(__spreadValues(__spreadProps(__spreadValues({ | ||
tree | ||
}, tableProps), { | ||
pageSizeList: [10, 20, 50, 100], | ||
@@ -906,0 +908,0 @@ paging: !isSimpleTable |
{ | ||
"name": "@cniot/mdd-render-pc-ftp", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "模型驱动FTP渲染组件", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -21,3 +21,3 @@ import React, { useEffect, useState, useRef } from 'react'; | ||
const [rowSelectionList, setRowSelectionList] = useState([]); // 当前选中行 | ||
const { columns = [], primaryKey = 'id', bulkActions = [], actionColumns = [], pagination } = table; | ||
const { columns = [], primaryKey = 'id', bulkActions = [], actionColumns = [], pagination, tree = false } = table; | ||
const { defaultPageSize } = pagination || {}; | ||
@@ -198,2 +198,3 @@ const pageSizeCache = useRef(defaultPageSize || 10); | ||
<CNTable | ||
tree={tree} | ||
{...tableProps} | ||
@@ -200,0 +201,0 @@ pageSizeList={[10, 20, 50, 100]} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219326
2544