2024-12-02 16:59:57 +08:00
var ka = Object . defineProperty ;
2024-12-11 16:27:12 +08:00
var Rt = ( e ) => {
2024-12-02 16:59:57 +08:00
throw TypeError ( e ) ;
} ;
var va = ( e , t , a ) => t in e ? ka ( e , t , { enumerable : ! 0 , configurable : ! 0 , writable : ! 0 , value : a } ) : e [ t ] = a ;
2024-12-11 16:27:12 +08:00
var k = ( e , t , a ) => va ( e , typeof t != "symbol" ? t + "" : t , a ) , Ft = ( e , t , a ) => t . has ( e ) || Rt ( "Cannot " + a ) ;
var g = ( e , t , a ) => ( Ft ( e , t , "read from private field" ) , a ? a . call ( e ) : t . get ( e ) ) , $ = ( e , t , a ) => t . has ( e ) ? Rt ( "Cannot add the same private member more than once" ) : t instanceof WeakSet ? t . add ( e ) : t . set ( e , a ) , B = ( e , t , a , n ) => ( Ft ( e , t , "write to private field" ) , n ? n . call ( e , a ) : t . set ( e , a ) , a ) ;
2024-12-02 16:59:57 +08:00
var Ot = ( e , t , a , n ) => ( {
set _ ( r ) {
2024-12-10 14:48:09 +08:00
B ( e , t , r , a ) ;
2024-12-02 16:59:57 +08:00
} ,
get _ ( ) {
return g ( e , t , n ) ;
}
} ) ;
2024-12-11 16:27:12 +08:00
import { jsx as u , jsxs as R } from "react/jsx-runtime" ;
import C , { useEffect as E , useState as N , useCallback as le , useMemo as Q , useRef as q , useContext as Te , useId as Ge , useLayoutEffect as Sa } from "react" ;
2024-12-02 16:59:57 +08:00
import p from "lodash" ;
import Ht from "immutability-helper" ;
2024-12-10 10:46:00 +08:00
import O from "classnames" ;
2024-12-11 16:27:12 +08:00
import { Form as Ke , Input as xa , Button as lt , Breadcrumb as Pa , Tree as Na , Pagination as $a , Table as Ea , Empty as Ta , Popconfirm as Ra , Tooltip as Fa , Popover as Oa } from "antd" ;
2024-12-02 16:59:57 +08:00
import { useMergedState as La } from "rc-util" ;
2024-12-11 16:27:12 +08:00
import Y , { FieldContext as Va , Field as Jt } from "rc-field-form" ;
2024-12-02 16:59:57 +08:00
import { useParams as Aa , generatePath as ja , createBrowserRouter as Ia , useInRouterContext as Ma , Navigate as za } from "react-router-dom" ;
2024-12-04 11:05:27 +08:00
import A from "prop-types" ;
2024-12-02 16:59:57 +08:00
import * as Lt from "react-is" ;
import { useNotification as Wa } from "rc-notification" ;
2024-12-11 16:27:12 +08:00
import { N as Re , a as Fe , T as ct , S as Ua } from "./vender-DMK1apIA.js" ;
2024-12-02 16:59:57 +08:00
import "rc-util/lib/hooks/useMergedState" ;
2024-12-10 14:48:09 +08:00
import Da from "rc-drawer" ;
import Ba from "rc-dialog" ;
2024-12-11 16:27:12 +08:00
var xe , Ve , Pe , se , be , ke ;
2024-12-02 16:59:57 +08:00
class Kt {
constructor ( t , a ) {
2024-12-11 16:27:12 +08:00
$ ( this , xe , /* @__PURE__ */ new Map ( ) ) ;
$ ( this , Ve , ! 0 ) ;
$ ( this , Pe , [ ] ) ;
$ ( this , se ) ;
$ ( this , be , ( ) => g ( this , se ) ) ;
$ ( this , ke , ( ) => Promise . resolve ( ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "get" , ( ... t ) => new Promise ( ( a , n ) => {
2024-12-02 16:59:57 +08:00
const r = JSON . stringify ( t ) ;
2024-12-11 16:27:12 +08:00
if ( g ( this , xe ) . has ( r ) ) return a ( g ( this , ke ) . call ( this , g ( this , se ) , ... t ) ) ;
if ( g ( this , se ) === void 0 ) g ( this , Pe ) . push ( [ t , a , n ] ) , g ( this , Ve ) && ( B ( this , Ve , ! 1 ) , Promise . resolve ( typeof g ( this , be ) == "function" ? g ( this , be ) . call ( this ) : g ( this , be ) ) . then ( ( s ) => B ( this , se , s || null ) ) . finally ( ( ) => {
2024-12-02 16:59:57 +08:00
g ( this , Pe ) . forEach ( ( [ s , i , o ] ) => {
try {
2024-12-11 16:27:12 +08:00
const l = g ( this , ke ) . call ( this , g ( this , se ) , ... s ) ;
g ( this , xe ) . set ( JSON . stringify ( s ) , l ) , i ( l ) ;
2024-12-02 16:59:57 +08:00
} catch ( l ) {
o ( l ) ;
}
} ) , g ( this , Pe ) . length = 0 ;
} ) ) ;
else {
2024-12-11 16:27:12 +08:00
const s = g ( this , ke ) . call ( this , g ( this , se ) , ... t ) ;
g ( this , xe ) . set ( r , s ) , a ( s ) ;
2024-12-02 16:59:57 +08:00
}
} ) ) ;
2024-12-11 16:27:12 +08:00
B ( this , ke , a ) , B ( this , be , t ) ;
2024-12-02 16:59:57 +08:00
}
}
2024-12-11 16:27:12 +08:00
xe = new WeakMap ( ) , Ve = new WeakMap ( ) , Pe = new WeakMap ( ) , se = new WeakMap ( ) , be = new WeakMap ( ) , ke = new WeakMap ( ) ;
const Zn = ( ) => u ( "div" , { children : "Empty" } ) , We = C . createContext ( { ele : { } , mount : ( ) => {
2024-12-02 16:59:57 +08:00
} , unmount : ( ) => {
2024-12-11 16:27:12 +08:00
} } ) , J = ( { rootClassName : e , className : t , children : a , actions : n , title : r , subTitle : s , extras : i , style : o = { } } ) => {
const { mount : l , unmount : d } = C . useContext ( We ) ;
return n && J . Action ( { children : n } ) , r && J . Title ( { children : r } ) , s && J . SubTitle ( { children : s } ) , i && J . Extra ( { children : i } ) , E ( ( ) => ( l ( "rootClassName" , e ) , ( ) => d ( e ) ) , [ e ] ) , u ( "div" , { className : O ( "ff-container" , t ) , style : o , children : a } ) ;
} , Je = ( e ) => ( { children : t , className : a } ) => {
const { mount : n , unmount : r } = C . useContext ( We ) ;
return E ( ( ) => ( n ( e , C . createElement ( "div" , { key : ` ff- ${ e } ` , className : O ( ` ff-popup- ${ e } ` , a ) } , t ) ) , ( ) => r ( e ) ) , [ a , t ] ) , null ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
J . Action = Je ( "actions" ) , J . Title = Je ( "title" ) , J . SubTitle = Je ( "sub-title" ) , J . Extra = Je ( "extras" ) , J . propTypes = { className : A . string , style : A . object , title : A . any , subTitle : A . any , actions : A . any , extras : A . any } ;
const er = ( ) => u ( J , { className : "ff-loading" , children : R ( "div" , { className : "loader" , children : [ R ( "div" , { className : "square" , children : [ u ( "span" , { } ) , u ( "span" , { } ) , u ( "span" , { } ) ] } ) , R ( "div" , { className : "square" , children : [ u ( "span" , { } ) , u ( "span" , { } ) , u ( "span" , { } ) ] } ) , R ( "div" , { className : "square" , children : [ u ( "span" , { } ) , u ( "span" , { } ) , u ( "span" , { } ) ] } ) , R ( "div" , { className : "square" , children : [ u ( "span" , { } ) , u ( "span" , { } ) , u ( "span" , { } ) ] } ) ] } ) } ) , tr = ( ) => u ( "div" , { children : "NotFound" } ) , _t = ( { children : e } ) => {
const [ t , a ] = N ( { } ) , n = le ( ( s , i ) => a ( ( o ) => ( { ... o , [ s ] : i } ) ) , [ ] ) , r = le ( ( s ) => a ( ( i ) => ( { ... i , [ s ] : void 0 } ) ) , [ ] ) ;
return typeof ( e == null ? void 0 : e . type ) == "string" ? e : u ( We . Provider , { value : { ele : t , mount : n , unmount : r } , children : C . cloneElement ( e , { className : t . rootClassName , title : t . title , subTitle : t [ "sub-title" ] , actions : t . actions , extras : t . extras } ) } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-04 11:05:27 +08:00
_t . propTypes = { children : A . element . isRequired } ;
2024-12-11 16:27:12 +08:00
const Vt = { close : [ "M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" ] , check : [ "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z" ] , info : [ "M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" , "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z" ] } , bt = ( { type : e , props : t } ) => u ( "i" , { ... t , children : u ( "svg" , { viewBox : "0 0 1024 1024" , width : "1em" , height : "1em" , fill : "currentColor" , children : ( Vt [ e ] || Vt . info ) . map ( ( a , n ) => u ( "path" , { d : a } , n ) ) } ) } ) , Gt = ( { className : e , content : t , icon : a , $close : n } ) => R ( C . Fragment , { children : [ a && u ( "div" , { className : O ( "ff-notification-icon" , e ) , children : u ( bt , { type : a } ) } ) , t ] } ) , qa = ( { } ) => u ( J , { children : "Confirm" } ) ;
var de , Ne ;
const Z = class Z {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-11 16:27:12 +08:00
$ ( this , Ne , /* @__PURE__ */ new Map ( ) ) ;
k ( this , "init" , ( t ) => B ( this , Ne , new Map ( t ) ) ) ;
k ( this , "check" , ( t ) => ! g ( this , Ne ) . has ( t ) || g ( this , Ne ) . get ( t ) ) ;
if ( g ( Z , de ) ) return g ( Z , de ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
de = new WeakMap ( ) , Ne = new WeakMap ( ) , $ ( Z , de , null ) , k ( Z , "getInstance" , ( ) => ( g ( Z , de ) || B ( Z , de , new Z ( ) ) , g ( Z , de ) ) ) ;
let dt = Z ;
2024-12-06 13:12:05 +08:00
const Ha = dt . getInstance ( ) ;
2024-12-11 16:27:12 +08:00
var ue , Ae ;
const ee = class ee {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-11 16:27:12 +08:00
$ ( this , Ae , null ) ;
k ( this , "init" , ( t ) => B ( this , Ae , t ) ) ;
k ( this , "get" , ( t , a ) => p . get ( g ( this , Ae ) , t , a ) ) ;
if ( g ( ee , ue ) ) return g ( ee , ue ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
ue = new WeakMap ( ) , Ae = new WeakMap ( ) , $ ( ee , ue , null ) , k ( ee , "getInstance" , ( ) => ( g ( ee , ue ) || B ( ee , ue , new ee ( ) ) , g ( ee , ue ) ) ) ;
let ut = ee ;
const Oe = ut . getInstance ( ) , At = { null2json : ( e ) => Object . create ( ) , null2array : ( e ) => [ ] , null2number : ( e ) => 0 , null2bool : ( e ) => ! 1 , null2string : ( e ) => "" , null2integer : ( e ) => 0 , null2float : ( e ) => 0 , string2json : ( e ) => e ? JSON . parse ( e ) : "{}" , string2array : ( e ) => e . substr ( 0 , 1 ) === "[" && e . substr ( - 1 ) === "]" ? JSON . parse ( e ) : e . split ( "," ) , string2number : ( e ) => e == "" ? 0 : + e , string2integer : ( e ) => e == "" ? 0 : + e , string2float : ( e ) => e == "" ? 0 : + e , string2bool : ( e ) => {
2024-12-02 16:59:57 +08:00
switch ( ` ${ e } ` . toLowerCase ( ) ) {
case "0" :
case "false" :
case "[]" :
case "{}" :
return ! 1 ;
}
return ! ! e ;
2024-12-11 16:27:12 +08:00
} , string2string : ( e ) => e , json2json : ( e ) => e , json2array : ( e ) => e ? Object . values ( e ) : [ ] , json2number : ( e ) => Object . keys ( e ) . length , json2integer : ( e ) => Object . keys ( e ) . length , json2float : ( e ) => Object . keys ( e ) . length , json2bool : ( e ) => Object . keys ( e ) . length > 0 , json2string : ( e ) => e ? JSON . stringify ( e ) : "" , array2json : ( e ) => ( { ... e } ) , array2array : ( e ) => e , array2number : ( e ) => e . length , array2integer : ( e ) => e . length , array2float : ( e ) => e . length , array2bool : ( e ) => e . length > 0 , array2string : ( e ) => JSON . stringify ( e ) , number2json : ( e ) => ( { } ) , number2array : ( e ) => [ e ] , number2number : ( e ) => e , number2integer : ( e ) => e , number2float : ( e ) => e , number2bool : ( e ) => ! ! e , number2string : ( e ) => e . toString ( ) , boolean2json : ( e ) => ( { } ) , boolean2array : ( e ) => [ ] , boolean2number : ( e ) => + e , boolean2integer : ( e ) => + e , boolean2float : ( e ) => + e , boolean2bool : ( e ) => e , boolean2string : ( e ) => e ? "true" : "false" } , G = ( e , t ) => {
2024-12-02 16:59:57 +08:00
let a = "string" ;
a = Array . isArray ( e ) ? "array" : typeof e , p . isObject ( e ) && ( a = "json" ) ;
const n = ` ${ a } 2 ${ t } ` ;
return Reflect . has ( At , n ) ? At [ n ] ( e ) : e ;
2024-12-10 14:48:09 +08:00
} , Yt = ( e = { } , t = { } , a = { } , n = "" ) => Xt ( e , ( r , s ) => s === "type" && r === "code" ) ? Qt ( e , t , a , n ) : Zt ( e , t , n ) , Xt = ( e , t = ( ) => ! 1 ) => p . some ( e , ( a ) => ! ! p . some ( a , t ) || ( p . isEmpty ( a ) || ! p . isPlainObject ( a ) && ! p . isArray ( a ) ? void 0 : Xt ( a , t ) ) ) , Qt = async ( e = { } , t = { } , a = { } , n = "" ) => {
2024-12-02 16:59:57 +08:00
let r = /* @__PURE__ */ Object . create ( null ) ;
for ( let s in e ) {
let i ;
if ( Reflect . has ( e [ s ] , "type" ) && [ "code" , "field" , "router" , "query" , "string" ] . includes ( e [ s ] . type ) ) {
2024-12-11 16:27:12 +08:00
const { type : o , value : l = "" , default : d = n } = e [ s ] ;
2024-12-02 16:59:57 +08:00
switch ( o ) {
case "code" :
2024-12-11 16:27:12 +08:00
i = await Ce . exec ( l , t , a ) ;
2024-12-02 16:59:57 +08:00
break ;
case "field" :
i = p . get ( t , l ) ? ? p . get ( t , l . substring ( l . indexOf ( "." ) + 1 ) ) ;
break ;
case "router" :
case "query" :
2024-12-11 16:27:12 +08:00
i = oe . getPageParams ( l ) ;
2024-12-02 16:59:57 +08:00
break ;
case "string" :
i = l ;
}
2024-12-11 16:27:12 +08:00
i ? ? ( i = d ) ;
2024-12-10 14:48:09 +08:00
} else i = await Qt ( e [ s ] , t , a , n ) ;
2024-12-02 16:59:57 +08:00
p . set ( r , s , i ) ;
}
return r ;
} , Zt = ( e = { } , t = { } , a = "" ) => Object . keys ( e || { } ) . reduce ( ( n , r ) => {
if ( p . isPlainObject ( e [ r ] ) ) {
let s ;
if ( Reflect . has ( e [ r ] , "type" ) && [ "field" , "router" , "query" , "string" ] . includes ( e [ r ] . type ) ) {
const { type : i , value : o = "" , default : l = a } = e [ r ] ;
switch ( i ) {
case "field" :
s = p . get ( t , o ) ? ? p . get ( t , o . substring ( o . indexOf ( "." ) + 1 ) ) ;
break ;
case "router" :
case "query" :
2024-12-11 16:27:12 +08:00
s = oe . getPageParams ( o ) ;
2024-12-02 16:59:57 +08:00
break ;
case "string" :
s = o ;
}
s ? ? ( s = l ) ;
} else s = Zt ( e [ r ] , t , a ) ;
p . set ( n , r , s ) ;
}
return n ;
2024-12-11 16:27:12 +08:00
} , { } ) , st = ( e , t ) => e && typeof e == "object" ? Array . isArray ( e ) ? e . map ( ( a ) => st ( a , t ) ) : Object . keys ( e ) . reduce ( ( a , n ) => ( t [ n ] ? a [ t [ n ] ] = st ( e [ n ] , t ) : a [ n ] = st ( e [ n ] , t ) , a ) , { } ) : e , ar = ( ) => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" . replace ( /[xy]/g , ( e ) => {
2024-12-10 14:48:09 +08:00
const t = 16 * Math . random ( ) | 0 ;
return ( e === "x" ? t : 3 & t | 8 ) . toString ( 16 ) ;
} ) ;
2024-12-11 16:27:12 +08:00
var Xe , je , Ie , Qe ;
const Ze = class Ze {
2024-12-02 16:59:57 +08:00
constructor ( ... t ) {
2024-12-11 16:27:12 +08:00
$ ( this , je , [ ] ) ;
$ ( this , Ie , ( t ) => {
2024-12-02 16:59:57 +08:00
var a ;
2024-12-11 16:27:12 +08:00
for ( let n of t ) Array . isArray ( n [ 0 ] ) ? g ( this , Ie ) . call ( this , n ) : g ( this , je ) . push ( g ( a = Ze , Xe ) . call ( a , n [ 0 ] , n [ 1 ] ) ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "toValue" , async ( t , a = null ) => {
2024-12-02 16:59:57 +08:00
const n = { getValue : ( ) => t , getRecord : ( ) => a } ;
2024-12-11 16:27:12 +08:00
return await g ( this , je ) . reduce ( async ( r , s ) => {
2024-12-02 16:59:57 +08:00
try {
const i = await r ;
return ( await s ) . call ( n , i ) ;
} catch ( i ) {
return console . error ( i ) , r ;
}
} , t ) ;
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "toRender" , ( t , a , n = null ) => C . createElement ( g ( this , Qe ) , { value : t , record : a } , n ) ) ;
$ ( this , Qe , ( { value : t , record : a , children : n } ) => {
2024-12-10 14:48:09 +08:00
const [ r , s ] = N ( n ) ;
return xt ( ( ) => {
2024-12-02 16:59:57 +08:00
let i = ! 1 ;
2024-12-11 16:27:12 +08:00
return s ( n ) , this . toValue ( t , a ) . then ( ( o ) => G ( o , "string" ) ) . then ( ( o ) => ! i && s ( o ) ) . catch ( ( o ) => ! i && s ( ` ${ o } ` ) ) , ( ) => i = ! 0 ;
2024-12-02 16:59:57 +08:00
} , [ t , a ] ) , r ;
} ) ;
2024-12-11 16:27:12 +08:00
g ( this , Ie ) . call ( this , t ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
Xe = new WeakMap ( ) , je = new WeakMap ( ) , Ie = new WeakMap ( ) , Qe = new WeakMap ( ) , $ ( Ze , Xe , p . memoize ( ( t , a ) => X . getWidgetComponent ( t ) . then ( ( n ) => {
2024-12-02 16:59:57 +08:00
var r ;
return ( ( r = n . default ) == null ? void 0 : r . call ( n , a ) ) || ( ( s ) => s ) ;
2024-12-11 16:27:12 +08:00
} ) , ( t , a ) => ` ${ t } :: ${ G ( a , "string" ) } ` ) ) ;
let Ye = Ze ;
const Ja = ( e , t = { } ) => Q ( ( ) => e == null ? void 0 : e . map ( ( { widgetByJs : a , widgetByJsSetting : n , ... r } , s ) => a ? { ... r , render : ( i , o ) => new Ye ( [ a , n ] ) . toRender ( i , o , "-" ) } : r ) , [ e , t ] ) , nr = ( e ) => {
2024-12-10 14:48:09 +08:00
const [ t , a ] = N ( { } ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
2024-12-02 16:59:57 +08:00
let n = ! 1 ;
2024-12-11 16:27:12 +08:00
return e && T . get ( ` /api/_/ ${ e } ` ) . then ( ( r ) => p . pick ( r , [ "uuid" , "name" , "code" , "resource" , "marginX" , "marginY" , "cols" , "rowHeight" , "primaryKey" , "columns" , "itemOperations" , "batchOperations" , "isConditionFormLayout" , "layout" , "tabs" , "pageSize" , "layoutConfig" ] ) ) . then ( ( r ) => ! n && a ( r ) ) , ( ) => n = ! 0 ;
2024-12-02 16:59:57 +08:00
} , [ e ] ) , t ;
2024-12-11 16:27:12 +08:00
} , rr = ( e , t = { } ) => {
2024-12-10 14:48:09 +08:00
const [ a , n ] = N ( { dataSource : [ ] } ) ;
2024-12-11 16:27:12 +08:00
return Ue ( ( ) => {
2024-12-02 16:59:57 +08:00
let r = ! 1 ;
2024-12-11 16:27:12 +08:00
return e && T . get ( ` /api/ ${ e } / ${ T . encode ( { page : 1 , ... t } )} ` ) . then ( ( s ) => ! r && n ( s ) ) , ( ) => r = ! 0 ;
2024-12-02 16:59:57 +08:00
} , [ e , t ] ) , a ;
2024-12-11 16:27:12 +08:00
} , gt = ( e , t = null , a = null , n = "id" ) => Q ( ( ) => {
2024-12-02 16:59:57 +08:00
if ( p . isEmpty ( e ) || ! e . some ( ( { uuid : s } ) => Ha . check ( s ) ) ) return ! 1 ;
if ( p . isEmpty ( a ) || p . isEmpty ( t ) ) return ! 0 ;
const r = t . map ( ( s ) => ` ${ s == null ? void 0 : s [ n ] } ` ) ;
return e . some ( ( { uuid : s } ) => ! s || ! a . has ( s ) || a . get ( s ) . some ( ( i ) => r . includes ( ` ${ i } ` ) ) ) ;
2024-12-03 10:15:14 +08:00
} , [ e , t , a , n ] ) , Ka = ( e , t , a = "id" , n = null ) => {
const r = St ( ) , s = q ( ! 1 ) , i = q ( e . dataSource ) , o = q ( e . itemOperationsAccess ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => ( i . current = e . dataSource , o . current = e . itemOperationsAccess , ( ) => s . current = ! 1 ) , [ e . dataSource , e . itemOperationsAccess ] ) , s . current && ( e . dataSource = i . current , e . itemOperationsAccess = o . current ) , [ e , ( l = 0 , d = null ) => {
var c , m ;
if ( s . current = ! 1 , l === 1 ) return ( c = e . onReload ) == null ? void 0 : c . call ( e ) ;
2024-12-03 10:15:14 +08:00
if ( l === 2 ) {
2024-12-11 16:27:12 +08:00
const h = p . get ( d , "__PARENT_ID__" , "" ) , f = p . get ( d , a , p . get ( d , [ n , a ] , "" ) ) , y = p . findIndex ( i . current , [ "__PARENT_ID__" , h ] ) , b = p . findIndex ( y > - 1 ? p . get ( i . current , [ y , "children" ] ) : i . current , [ a , f ] ) ;
if ( b === - 1 ) return ( m = e . onReload ) == null ? void 0 : m . call ( e ) ;
Promise . all ( [ T . get ( ` /api/ ${ t } /detail/ ${ f } ` ) , T . post ( ` /api/ ${ t } /list-operations-access ` , { ids : f } ) ] ) . then ( ( [ w , v ] ) => {
2024-12-04 11:05:27 +08:00
const j = p . get ( i . current , y > - 1 ? [ y , "children" , b , "children" ] : [ b , "children" ] ) ;
i . current = Ht ( i . current , y > - 1 ? { [ y ] : { children : { $splice : [ [ b , 1 , { ... w , children : j } ] ] } } } : { $splice : [ [ b , 1 , { ... w , children : j } ] ] } ) ;
2024-12-11 16:27:12 +08:00
const z = new Map ( v ) ;
2024-12-10 10:46:00 +08:00
o . current . forEach ( ( I , L ) => {
2024-12-04 11:05:27 +08:00
var S ;
2024-12-11 16:27:12 +08:00
( S = z . get ( L ) ) != null && S . some ( ( F ) => F == f ) || o . current . set ( L , I . filter ( ( F ) => F !== f ) ) ;
} ) , z . forEach ( ( I , L ) => {
2024-12-10 10:46:00 +08:00
o . current . has ( L ) ? o . current . set ( L , p . uniq ( [ ... o . current . get ( L ) || [ ] , ... I ] ) ) : o . current . set ( L , I ) ;
2024-12-04 11:05:27 +08:00
} ) ;
} ) . then ( ( ) => {
s . current = ! 0 , r ( ) ;
} ) ;
}
2024-12-02 16:59:57 +08:00
} ] ;
} , _a = ( e , t ) => {
const a = St ( ) , n = q ( t ) , r = q ( /* @__PURE__ */ new Map ( ) ) , s = q ( [ ] ) , i = p . throttle ( ( l ) => {
2024-12-11 16:27:12 +08:00
s . current = [ ] , T . list ( e , p . pick ( { ... n . current , ... l } , [ "tab" , "page" , "pageSize" , "condition" , "sider" , "keyword" ] ) ) . then ( ( { keyword : d , condition : c , total : m , tab : h , sider : f , page : y , pageSize : b , operationsAccess : w , dataSource : v } ) => {
n . current = { tab : h , condition : c , sider : f , keyword : d , total : m , pageSize : b , page : v != null && v . length ? y : 1 } , s . current = v , r . current = new Map ( w ) , a ( ) ;
2024-12-02 16:59:57 +08:00
} ) ;
} , 380 , { leading : ! 1 , trailing : ! 0 } ) ;
2024-12-10 14:48:09 +08:00
xt ( ( ) => {
2024-12-02 16:59:57 +08:00
s . current = [ ] , e && i ( t ) ;
} , [ e , t ] ) ;
2024-12-11 16:27:12 +08:00
const o = Q ( ( ) => p . pick ( n . current , [ "total" , "tab" , "page" , "pageSize" , "condition" , "sider" , "keyword" ] ) , [ n . current ] ) ;
return Object . assign ( o , { onTabChange : ( l ) => i ( { tab : l , page : 1 } ) , onPageChange : ( l , d ) => i ( { page : l , pageSize : d } ) , onPageSizeChange : ( l ) => i ( { pageSize : l , page : 1 } ) , onConditionChange : ( l , d ) => i ( { keyword : d , condition : Ht ( n . current . condition || { } , { $merge : l || { } } ) , page : 1 } ) , onSiderChange : ( l ) => i ( { sider : l , page : 1 } ) , onKeywordChange : ( l ) => i ( { keyword : l , page : 1 } ) , itemOperationsAccess : r . current , dataSource : s . current , onReload : i } ) ;
} , Ga = ( { className : e , itemClassName : t , classNames : a = { } , dataSource : n , isPaginate : r , isItemOperations : s , isBatchOperations : i , batchOperations : o , itemOperations : l , itemOperationsAccess : d , resource : c , primaryKey : m , title : h , itemGridLayout : f , $setting : y , tabs : b , isConditionFormLayout : w , isTreeSider : v , treeSiderConfig : j } ) => {
const { getBase62params : z , onClickCallback : I } = Te ( we ) , { total : L , page : S , pageSize : F } = ( z == null ? void 0 : z ( ) ) || { } , V = le ( ( W , U , D ) => u ( Ya , { className : O ( "ff-data-list-framework-item" , t ) , operations : s && U ? l == null ? void 0 : l . filter ( ( x ) => ! ( m && x . uuid && d . has ( x . uuid ) ) || d . get ( x . uuid ) . includes ( U == null ? void 0 : U [ m ] ) ) : [ ] , data : c ? { [ c ] : U } : U , children : W , onClickCallback : I } ) , [ c , m , s , I , l , d ] ) ;
return R ( "div" , { className : O ( "ff-data-list-framework" , e ) , children : [ u ( na , { className : a == null ? void 0 : a . sider , isTreeSider : v , ... j } ) , R ( "div" , { className : O ( "ff-data-list-container" , a == null ? void 0 : a . container ) , children : [ u ( vt , { className : a == null ? void 0 : a . filter , isConditionFormLayout : w } ) , u ( aa , { title : h , className : a == null ? void 0 : a . toolbar , tabs : b } ) , u ( on , { ... f , className : a == null ? void 0 : a . content , style : { "--col-num" : ( y == null ? void 0 : y . colNum ) || 1 } , primaryKey : m , itemRender : V , dataSource : n } ) , u ( ra , { className : a == null ? void 0 : a . footer , isPaginate : r , isOperations : i , operations : o , total : L , page : S , pageSize : F } ) ] } ) ] } ) ;
} , Ya = ( { className : e , operations : t , children : a , data : n , onClickCallback : r } ) => R ( "div" , { className : O ( "data-list-grid-layout-item-container" , e ) , children : [ a , ! ! ( t != null && t . length ) && u ( "div" , { className : "data-list-grid-layout-item-actions" , children : t . map ( ( s ) => u ( "span" , { className : "data-list-grid-layout-item-action" , children : u ( P . Link , { uuid : s . uuid , type : s . type , name : s . name , widget : s . widget , widgetType : s . widgetType , widgetProps : s . widgetProps , widgetSetting : s . widgetSetting , widgetContainerProps : s . widgetContainerSetting , data : n , onAfterClick : ( i ) => i !== ! 1 && ( r == null ? void 0 : r ( s . isRefresh , n ) ) } , s . uuid || Ge ( ) ) } , ( s == null ? void 0 : s . uuid ) || Ge ( ) ) ) } ) ] } ) , Xa = ( { listCode : e , className : t , classNames : a = { } , itemClassName : n , dataSource : r , columns : s , isItemOperations : i , isBatchOperations : o , batchOperations : l , itemOperations : d , itemOperationsAccess : c , resource : m , primaryKey : h , title : f , tabs : y , isPaginate : b , isTreeSider : w , treeSiderConfig : v , isConditionFormLayout : j , ... z } ) => {
const { getBase62params : I , onClickCallback : L } = Te ( we ) , { total : S , page : F , pageSize : V } = ( I == null ? void 0 : I ( ) ) || { } , W = gt ( d , r , c , h ) ;
return R ( "div" , { className : O ( "ff-data-table-framework" , t ) , children : [ u ( na , { className : a == null ? void 0 : a . sider , isTreeSider : w , ... v } ) , R ( "div" , { className : O ( "ff-data-table-container" , a == null ? void 0 : a . container ) , children : [ u ( vt , { listCode : e , isConditionFormLayout : j } ) , u ( aa , { title : f , className : a == null ? void 0 : a . toolbar , tabs : y } ) , u ( tn , { ... z , primaryKey : h , className : "ff-data-table-content" , columns : s , dataSource : r , operationRender : W ? ( U ) => u ( "div" , { className : "ff-data-table-actions" , children : d == null ? void 0 : d . reduce ( ( D , x , ce ) => [ ... D , u ( P . Link , { size : "small" , uuid : x . uuid , type : x . type , name : x . name , widget : x . widget , widgetType : x . widgetType , widgetProps : x . widgetProps , widgetData : x . widgetData , widgetSetting : x . widgetSetting , widgetContainerProps : x . widgetContainerSetting , data : U , onAfterClick : ( re ) => re !== ! 1 && ( L == null ? void 0 : L ( x . isRefresh , U ) ) } , x . uuid || ce ) ] , [ ] ) } ) : null } ) , u ( ra , { isPaginate : b , isOperations : o , operations : l , total : S , page : F , pageSize : V } ) ] } ) ] } ) ;
} , we = C . createContext ( { listCode : "" , getBase62params : ( e , t ) => {
2024-12-02 16:59:57 +08:00
} , onReload : ( ) => {
} , onClickCallback : ( ) => {
} , onConditionChange : ( ) => {
} , onTabChange : ( ) => {
} , onSiderChange : ( ) => {
} , onKeywordChange : ( ) => {
} , onPageChange : ( ) => {
} , onPageSizeChange : ( ) => {
2024-12-11 16:27:12 +08:00
} } ) , Qa = ( { isItemGridLayout : e , theme : t , themeProps : a , onClickCallback : n , onReload : r , listCode : s , total : i = 0 , page : o = 0 , onPageChange : l , pageSize : d = 30 , onPageSizeChange : c , tab : m , onTabChange : h , keyword : f , onKeywordChange : y , condition : b , onConditionChange : w , sider : v , onSiderChange : j , ... z } ) => {
2024-12-10 14:48:09 +08:00
const [ I , L ] = N ( ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
t ? X . getWidgetComponent ( t ) . then ( ( S ) => {
2024-12-02 16:59:57 +08:00
if ( ! S ) throw ` ${ t } not found ` ;
return S ;
2024-12-11 16:27:12 +08:00
} ) . catch ( ( S ) => ( { default : ( ) => ` ${ S } ` } ) ) . then ( ( S ) => L ( C . createElement ( S . default , { ... z , $setting : a } ) ) ) : L ( u ( e ? Ga : Xa , { ... z , $setting : a } ) ) ;
} , [ t , a ] ) , u ( we . Provider , { value : { listCode : s , onClickCallback : n , onReload : r , getBase62params : ( S , F ) => {
const V = { tab : m , page : o , pageSize : d , keyword : f , sider : v , condition : b , total : i } ;
2024-12-04 11:05:27 +08:00
return S && S != "init" ? V [ S ] ? ? F : V ;
2024-12-11 16:27:12 +08:00
} , onPageChange : l , onPageSizeChange : c , onTabChange : h , onSiderChange : j , onKeywordChange : y , onConditionChange : w } , children : I && C . cloneElement ( I , z ) } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
var ge , ie , ve , et ;
const te = class te {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-11 16:27:12 +08:00
$ ( this , ie , null ) ;
$ ( this , ve , /* @__PURE__ */ new Map ( ) ) ;
$ ( this , et , ( ) => {
if ( g ( this , ie ) ) return g ( this , ie ) . port . postMessage ( { command : "status" , data : [ ] } ) ;
B ( this , ie , new SharedWorker ( new URL ( "/ff-worker/res-ws.js" , self . location ) ) ) , g ( this , ie ) . port . onmessage = ( t ) => {
2024-12-02 16:59:57 +08:00
var a , n ;
2024-12-11 16:27:12 +08:00
( a = t . data ) != null && a . uuid ? g ( this , ve ) . forEach ( ( r , s ) => {
2024-12-02 16:59:57 +08:00
var i ;
( r == "*" || ( i = r == null ? void 0 : r . includes ) != null && i . call ( r , t . data . uuid ) ) && s ( t . data ) ;
2024-12-11 16:27:12 +08:00
} ) : ( ( n = t . data ) == null ? void 0 : n . readyState ) == WebSocket . CLOSED && T . get ( "/api/user-api-token" ) . then ( ( { token : r , expire _at : s } ) => {
g ( this , ie ) . port . postMessage ( { command : "initWs" , data : [ ` ws ${ p . trimStart ( T . appUrl , "http" ) } api/user-resource-status-ws?token= ${ r } ` ] } ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
} , g ( this , ie ) . port . postMessage ( { command : "status" , data : [ ] } ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "subscribe" , ( t , a = [ ] ) => ( a ? Array . isArray ( a ) && a . length == 0 ? a = "*" : Array . isArray ( a ) || ( a = [ a ] . flat ( ) ) : a = "*" , g ( this , ve ) . set ( t , a ) , g ( this , ve ) . size == 1 && g ( this , et ) . call ( this ) , ( ) => this . unsubscribe ( t ) ) ) ;
k ( this , "unsubscribe" , ( t ) => g ( this , ve ) . delete ( t ) ) ;
if ( g ( te , ge ) ) return g ( te , ge ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
ge = new WeakMap ( ) , ie = new WeakMap ( ) , ve = new WeakMap ( ) , et = new WeakMap ( ) , $ ( te , ge , null ) , k ( te , "getInstance" , ( ) => ( g ( te , ge ) || B ( te , ge , new te ( ) ) , g ( te , ge ) ) ) ;
let pt = te ;
2024-12-02 16:59:57 +08:00
const ea = pt . getInstance ( ) , kt = C . forwardRef ( ( { listCode : e , base62params : t , className : a , itemClassName : n , theme : r , themeProps : s , classNames : i } , o ) => {
2024-12-11 16:27:12 +08:00
const [ { resource : l , primaryKey : d , batchOperations : c = [ ] , itemOperations : m = [ ] , columns : h = [ ] , themeConfig : f , theme : y , isConditionFormLayout : b = ! 1 , isTreeSider : w , treeSiderConfig : v , isItemGridLayout : j , itemGridLayout : z , title : I , isPaginate : L , tabs : S } , F ] = N ( { isItemGridLayout : ! 1 , itemGridLayout : { } } ) , V = _a ( e , t ) , [ { dataSource : W , itemOperationsAccess : U , condition : D , tab : x , keyword : ce , page : re , total : at , pageSize : Be , sider : nt , onConditionChange : Et , onTabChange : pa , onKeywordChange : ma , onPageChange : ha , onPageSizeChange : fa , onSiderChange : ya , onReload : rt } , Tt ] = Ka ( V , e , d , l ) , wa = gt ( m , W , U , d ) , Ca = gt ( c ) ;
return E ( ( ) => {
let qe = null ;
return e && T . get ( ` /api/_/ ${ e } ` ) . resp ( ( { data : He , res : ba } ) => {
He != null && He . isDynamicRefresh && ( qe = ea . subscribe ( ( ) => rt ( ) , ba ) ) , F ( He ) ;
} ) . catch ( ( ) => F ( { } ) ) , ( ) => qe == null ? void 0 : qe ( ) ;
} , [ e ] ) , C . useImperativeHandle ( o , ( ) => ( { onReload : rt , onClickCallback : Tt } ) ) , u ( Qa , { listCode : e , title : I , itemClassName : n , classNames : i , resource : l , primaryKey : d , theme : r || y , themeProps : s || f , isTreeSider : w , treeSiderConfig : v , isPaginate : L , tabs : S , isItemOperations : wa , isBatchOperations : Ca , batchOperations : c , itemOperations : m , isItemGridLayout : j , columns : h , itemGridLayout : z , isConditionFormLayout : b , itemOperationsAccess : U , dataSource : W , onConditionChange : Et , onTabChange : pa , onKeywordChange : ma , onPageChange : ha , onPageSizeChange : fa , onSiderChange : ya , condition : D , tab : x , keyword : ce , page : re , total : at , pageSize : Be , sider : nt , className : O ( "ff-data-list-helper" , a ) , onReload : rt , onClickCallback : Tt } ) ;
2024-12-02 16:59:57 +08:00
} ) , ta = ( e , t , a , n , r = { } , s = 0 ) => {
const i = { "--grid-layout-h" : ` ${ n } ` , "--grid-layout-w" : ` ${ a } ` , "--grid-layout-x" : ` ${ e } ` , "--grid-layout-y" : ` ${ t } ` , "--grid-layout-row-height-offset" : "0px" } ;
2024-12-08 01:12:46 +08:00
return r != null && r . autoHeight ? i . height = "fit-content" : i [ "--grid-layout-row" ] = ` ${ n } ` , r != null && r . alignItems && ( i [ "--grid-layout-box-align-items" ] = r . alignItems ) , r != null && r . justifyContent && ( i [ "--grid-layout-box-justify-content" ] = r . justifyContent ) , i [ "--grid-layout-box-margin" ] = jt ( r == null ? void 0 : r . marginTop , r == null ? void 0 : r . marginRight , r == null ? void 0 : r . marginBottom , r == null ? void 0 : r . marginLeft ) , i [ "--grid-layout-box-padding" ] = jt ( r == null ? void 0 : r . paddingTop , r == null ? void 0 : r . paddingRight , r == null ? void 0 : r . paddingBottom , r == null ? void 0 : r . paddingLeft ) , s && ( i . height = ` ${ s } px ` ) , i ;
2024-12-02 16:59:57 +08:00
} , jt = ( e , t , a , n ) => ` ${ e || 0 } px ${ t || 0 } px ${ a || 0 } px ${ n || 0 } px ` , vt = ( { className : e , isConditionFormLayout : t } ) => {
2024-12-11 16:27:12 +08:00
var m , h ;
const [ a , n ] = N ( { } ) , { listCode : r , onKeywordChange : s , onConditionChange : i , getBase62params : o } = C . useContext ( we ) , { keyword : l , condition : d } = ( o == null ? void 0 : o ( ) ) || { } , [ c ] = Ke . useForm ( ) ;
return E ( ( ) => {
r && t && T . get ( ` /api/_/ ${ r } /list-condition-form-layout ` ) . then ( ( { resource : f , marginX : y , marginY : b , rowHeight : w , cols : v , fields : j } ) => {
2024-12-04 11:05:27 +08:00
n ( { resource : f , itemMargin : [ y , b ] , rowHeight : w , cols : v , fields : j } ) ;
2024-12-02 16:59:57 +08:00
} ) . catch ( ( ) => n ( { } ) ) ;
2024-12-11 16:27:12 +08:00
} , [ r , t ] ) , E ( ( ) => {
c . setFieldsValue ( { keyword : l , ... d } ) ;
} , [ JSON . stringify ( [ l , d ] ) ] ) , u ( "div" , { className : O ( "ff-data-list-filter" , e ) , children : u ( Ke , { form : c , layout : "vertical" , autoComplete : "off" , onFinish : ( ( m = a . fields ) == null ? void 0 : m . length ) > 1 ? ( f ) => i ( { [ a . resource ] : f [ a . resource ] } , f . keyword ) : ( ) => {
2024-12-03 10:15:14 +08:00
} , onValuesChange : ( f ) => {
2024-12-11 16:27:12 +08:00
p . isEmpty ( p . omit ( f , [ "keyword" ] ) ) || c . submit ( ) ;
} , children : ( ( h = a . fields ) == null ? void 0 : h . length ) > 1 ? u ( Pt , { ... a , children : u ( Za , { onReset : ( ) => {
2024-12-03 10:15:14 +08:00
const { keyword : f , condition : y } = o ( "init" ) || { } ;
2024-12-11 16:27:12 +08:00
c . setFieldsValue ( { keyword : f , ... y } ) ;
} } ) } ) : u ( "div" , { className : "ff-data-list-filter-default-form ff-grid-layout-form" , children : u ( "div" , { className : "grid-layout-item" , style : ta ( 20 , 0 , 5 , 2 ) , children : u ( Ke . Item , { name : [ "keyword" ] , children : u ( xa . Search , { allowClear : ! 0 , enterButton : "搜索" , placeholder : "多关键字 | 分割" , onSearch : ( f ) => s ( f ) } ) } ) } ) } ) } ) } ) ;
2024-12-02 16:59:57 +08:00
} , Za = ( { cols : e , fields : t , onReset : a } ) => {
2024-12-11 16:27:12 +08:00
const [ n , r ] = N ( ! 1 ) , s = Q ( ( ) => t == null ? void 0 : t . toReversed ( ) . some ( ( i ) => i . y > 1 || i . x + i . w >= e - 5 ) , [ e , t ] ) ;
return R ( Ke . Item , { label : " " , style : { "--item-span" : 5 } , className : O ( "ff-data-list-filter-actions" , { expanded : n } ) , children : [ u ( lt , { onClick : a , children : "重置" } ) , u ( lt , { type : "primary" , htmlType : "submit" , children : "查询" } ) , s && u ( P . Link , { className : "ff-data-list-filter-expanded-button" , widget : ( ) => r ( ( i ) => ! i ) , type : "primary" , name : n ? "关闭" : "展开" , icon : n ? "icon-up" : "icon-down" , iconPosition : "end" } ) ] } ) ;
2024-12-02 16:59:57 +08:00
} ;
vt . reservedFields = [ { x : 0 , y : 0 , h : 3 , w : 5 , field : { isVirtual : ! 0 , widgetPrefix : "@pkg/ff/grid-layout-forms" , widget : "Input" , code : "keyword" , label : "关键字" , placeholder : "多关键字 | 分割" , extras : { prefix : "icon-search" } } } ] ;
2024-12-11 16:27:12 +08:00
const aa = ( { className : e , title : t , tabs : a } ) => {
const { getBase62params : n , onTabChange : r , onReload : s } = Te ( we ) , { tab : i } = ( n == null ? void 0 : n ( ) ) || { } , [ o , l ] = La ( ( a == null ? void 0 : a [ 0 ] . value ) ? ? ( a == null ? void 0 : a [ 0 ] . code ) , { value : i , onChange : r } ) ;
return R ( "div" , { className : O ( "ff-data-list-toolbar" , e ) , children : [ u ( "div" , { className : "ff-data-list-title" , children : t } ) , u ( Pa , { className : "ff-data-list-tabs" , itemRender : ( { label : d , code : c , value : m } ) => u ( "span" , { onClick : ( ) => l ( m ? ? c ) , className : O ( "ff-data-list-tab" , { active : ( m ? ? c ) == o } ) , children : d } ) , items : a } ) , R ( "div" , { className : "ff-data-list-actions" , children : [ u ( P . Link , { icon : "icon-reload" , widget : ( ) => s ( ) } ) , u ( P . Link , { icon : "icon-setting" } ) ] } ) ] } ) ;
} , en = [ { title : "parent 1" , key : "0-0" , children : [ { title : "parent 1-0" , key : "0-0-0" , disabled : ! 0 , children : [ { title : "leaf" , key : "0-0-0-0" , disableCheckbox : ! 0 } , { title : "leaf" , key : "0-0-0-1" } ] } , { title : "parent 1-1" , key : "0-0-1" , children : [ { title : u ( "span" , { style : { color : "#1677ff" } , children : "sss" } ) , key : "0-0-1-0" } ] } ] } ] , na = ( { className : e , width : t = 280 , isTreeSider : a } ) => a ? u ( Na . DirectoryTree , { className : O ( "ff-data-list-sider" , e ) , style : { "--sider-width" : t } , showLine : ! 0 , showIcon : ! 1 , treeData : en } ) : null , ra = ( { className : e , operations : t , isOperations : a , isPaginate : n , total : r , page : s , pageSize : i } ) => {
const { onPageChange : o , onPageSizeChange : l , onClickCallback : d } = C . useContext ( we ) ;
return a && ! p . isEmpty ( t ) || n ? R ( "div" , { className : O ( "ff-data-list-footer" , e ) , children : [ u ( "div" , { className : "ff-data-list-actions" , children : t == null ? void 0 : t . map ( ( c , m ) => u ( P , { uuid : c . uuid , type : c . type , name : c . name , widget : c . widget , widgetType : c . widgetType , widgetProps : c . widgetProps , widgetData : c . widgetData , widgetSetting : c . widgetSetting , widgetContainerProps : c . widgetContainerSetting , onAfterClick : ( h ) => h !== ! 1 && ( d == null ? void 0 : d ( c . isRefresh , null ) ) } , c . uuid || m ) ) } ) , n && u ( $a , { size : "small" , total : r , pageSize : i , showSizeChanger : ! 1 , showTotal : ( c ) => ` 第 ${ s } 页 / 总共 ${ c } 条 ` , onChange : o , onShowSizeChange : l } ) ] } ) : null ;
2024-12-02 16:59:57 +08:00
} , sa = ( e , t , a = ! 0 ) => a !== ! 0 && a -- <= 0 ? [ ] : p . isArray ( e ) && ! p . isEmpty ( e ) ? e . reduce ( ( n , r ) => ( Reflect . has ( r , t ) && Reflect . has ( r , "children" ) && n . push ( r [ t ] ) , Reflect . has ( r , "children" ) && ! p . isEmpty ( r . children ) ? n . concat ( sa ( r . children , t , a ) ) : n ) , [ ] ) : [ ] , tn = ( { className : e , primaryKey : t , columns : a = [ ] , dataSource : n = [ ] , operationRender : r , operationWidth : s = 180 , ... i } ) => {
2024-12-11 16:27:12 +08:00
Ge ( ) ;
const o = q ( null ) , l = q ( null ) , [ d , c ] = N ( [ ] ) , [ m , h ] = N ( { width : 0 , height : 0 } ) ;
E ( ( ) => {
c ( sa ( n , t ) ) ;
2024-12-02 16:59:57 +08:00
} , [ n , t ] ) , Sa ( ( ) => {
const y = new ResizeObserver ( ( ) => {
var b ;
2024-12-11 16:27:12 +08:00
h ( { width : ( ( b = o . current ) == null ? void 0 : b . nativeElement . querySelector ( ".ant-table-body" ) . scrollWidth ) || l . current . offsetWidth , height : l . current . offsetHeight } ) ;
2024-12-02 16:59:57 +08:00
} ) ;
return l . current && y . observe ( l . current ) , ( ) => {
l . current && y . unobserve ( l . current ) ;
} ;
} , [ ] ) ;
2024-12-03 10:15:14 +08:00
const f = Ja ( a ) ;
2024-12-11 16:27:12 +08:00
return u ( "div" , { ref : l , className : O ( "ff-data-list-table" , e ) , children : m . height ? u ( Ea , { ... i , ref : o , rowKey : ( y ) => ( y == null ? void 0 : y [ t ] ) ? ? Math . random ( ) , columns : f == null ? void 0 : f . concat ( r ? [ { title : "操作" , align : "center" , fixed : "right" , width : ` ${ Math . ceil ( s / m . width * 100 ) . toFixed ( 2 ) } % ` , render : ( y , b , w ) => r ( b , w ) } ] : [ ] ) , dataSource : n , size : "middle" , scroll : { x : "max-content" , y : m . height - 50 } , pagination : ! 1 , expandable : { defaultExpandAllRows : ! 0 , expandRowByClick : ! 0 , onExpandedRowsChange : c , expandedRowKeys : d } } ) : null } ) ;
2024-12-02 16:59:57 +08:00
} , an = "RC_FORM_INTERNAL_HOOKS" , ia = ( e , { initialValue : t , initialValueLanguage : a , convertJs : n , convertJsSetting : r , type : s = "string" } , i = null ) => {
2024-12-11 16:27:12 +08:00
const o = q ( ! 1 ) , l = Te ( Va ) , [ d , c ] = N ( ) , [ m , h ] = N ( a != "javascript" && e ? l . getFieldValue ( e ) : void 0 ) , { registerWatch : f } = l . getInternalHooks ( an ) || { } ;
return E ( ( ) => f == null ? void 0 : f ( ( y , b , w ) => {
2024-12-02 16:59:57 +08:00
if ( ! o . current ) return ;
2024-12-04 11:05:27 +08:00
const v = p . get ( b , e ) ;
2024-12-11 16:27:12 +08:00
p . isEqual ( v , m ) || h ( G ( v , s ) ) ;
} ) , [ m ] ) , E ( ( ) => {
a == "javascript" && t ? Ce . exec ( t , { } , { getFieldValueForBasicForm : ( y ) => i ? i . getFieldValue ( y ) : l . getFieldValue ( y ) , getFieldValue : ( y ) => l . getFieldValue ( y ) } ) . then ( ( y ) => h ( G ( y , s ) ) ) . catch ( ( y ) => notification . error ( { message : ` 布局数据错误: ${ JSON . stringify ( y ) } ` } ) ) . finally ( ( ) => o . current = ! 0 ) : ( t && h ( G ( t ? ? l . getFieldValue ( e ) , s ) ) , o . current = ! 0 ) ;
} , [ t , a ] ) , Ue ( ( ) => {
o . current && n && new Ye ( [ n , r ] ) . toValue ( m , l . getFieldsValue ( ! 0 ) ) . then ( c ) . catch ( ( y ) => {
c ( y ) , console . error ( "布局数据转换错误: " , y , n ) ;
2024-12-06 13:12:05 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
} , [ m , n , r ] ) , [ d ? ? m , m ] ;
} , oa = ( e , t , a = "@pkg/ff/grid-layouts" , n = null ) => Q ( ( ) => {
2024-12-02 16:59:57 +08:00
var r ;
2024-12-11 16:27:12 +08:00
return ( r = p . sortBy ( e , [ "y" , "x" ] ) ) == null ? void 0 : r . map ( ( { i : s , x : i , y : o , w : l , h : d , field : { boxStyle : c , widgetPrefix : m = a , widget : h , ... f } } , y ) => u ( "div" , { className : "grid-layout-item" , style : ta ( i , o , l , d , c , h === "Height" && ( f == null ? void 0 : f . initialValue ) ) , children : u ( nn , { ... f , basicForm : n , itemWidget : h != null && h . startsWith ( "@" ) || h != null && h . startsWith ( "blob:" ) ? h : ` ${ m } / ${ h } ` , itemWidgetRender : t } ) } , s || y ) ) ;
2024-12-02 16:59:57 +08:00
} , [ e ] ) , nn = ( { itemWidget : e , itemWidgetRender : t , basicForm : a , ... n } ) => {
2024-12-10 14:48:09 +08:00
const [ r , s ] = N ( ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
X . getWidgetComponent ( e ) . then ( ( { defaultProps : i = { } , default : o } ) => {
2024-12-02 16:59:57 +08:00
s ( C . createElement ( t ( o , i , a ) , n ) ) ;
} ) . catch ( ( i ) => {
console . error ( i ) , s ( e ) ;
} ) ;
} , [ e ] ) , r ;
} , la = ( { cols : e = 12 , rowHeight : t = 21 , fields : a = [ ] , data : n , containerPadding : r = [ 0 , 0 ] , itemMargin : s = [ 4 , 0 ] , formProps : i = { } , className : o , ... l } ) => {
2024-12-11 16:27:12 +08:00
const [ d ] = Y . useForm ( ) , c = oa ( a , rn , "@pkg/ff/grid-layouts" ) , m = Q ( ( ) => [ { name : "__PROPS__" , value : i } ] , [ i ] ) ;
return Ue ( ( ) => ( d . setFieldsValue ( n ) , ( ) => d . resetFields ( ) ) , [ n ] ) , u ( Y , { fields : m , form : d , component : ! 1 , children : u ( "div" , { ... l , className : O ( "ff-grid-layout" , o ) , style : { "--grid-layout-item-margin-y" : ` ${ ( s == null ? void 0 : s [ 0 ] ) || 0 } px ` , "--grid-layout-item-margin-x" : ` ${ ( s == null ? void 0 : s [ 1 ] ) || 0 } px ` , "--grid-layout-container-padding-y" : ` ${ ( r == null ? void 0 : r [ 0 ] ) || 0 } px ` , "--grid-layout-container-padding-x" : ` ${ ( r == null ? void 0 : r [ 1 ] ) || 0 } px ` , "--grid-layout-cols" : e , "--grid-layout-row-height" : ` ${ t } px ` } , children : c } ) } ) ;
2024-12-02 16:59:57 +08:00
} , rn = ( e , t = { } , a = null ) => ( n ) => {
2024-12-11 16:27:12 +08:00
const { code : r , label : s , extras : i , isVirtual : o , initialValue : l , initialValueLanguage : d , convertJs : c , convertJsSetting : m , ... h } = p . merge ( { } , t , n ) , [ f , y ] = ia ( o ? null : r , { initialValue : l , initialValueLanguage : d , convertJs : c , convertJsSetting : m , type : ( h == null ? void 0 : h . type ) || "string" } , a ) ;
return u ( e , { ... h , value : f , rawValue : y , $setting : i || { } } ) ;
} , sr = ( It = la , function ( { code : e , data : t , ... a } ) {
2024-12-10 14:48:09 +08:00
const [ n , r ] = N ( { resource : null , cols : 12 , rowHeight : 21 , fields : [ ] } ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
e && T . get ( ` /api/_/ ${ e } ` ) . then ( ( s ) => r ( p . pick ( s , [ "resource" , "cols" , "rowHeight" , "fields" ] ) ) ) ;
2024-12-06 13:12:05 +08:00
} , [ e ] ) , ( n == null ? void 0 : n . resource ) && u ( It , { ... a , rowHeight : n . rowHeight , cols : n . cols , fields : n . fields , data : n != null && n . resource ? { [ n == null ? void 0 : n . resource ] : t } : { } } ) ;
2024-12-02 16:59:57 +08:00
} ) ;
var It ;
2024-12-11 16:27:12 +08:00
const ir = ( { widget : e , widgetPrefix : t = "@pkg/ff/grid-layouts" , basicForm : a , ... n } ) => {
2024-12-10 14:48:09 +08:00
const r = e != null && e . startsWith ( "@" ) || e != null && e . startsWith ( "blob:" ) ? e : ` ${ t } / ${ e } ` , [ s , i ] = N ( ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
r && X . getWidgetComponent ( r ) . then ( ( { defaultProps : o = { } , default : l } ) => ( { default : sn ( l , o , a ) } ) ) . catch ( ( o ) => ( { default : ( ) => ` ${ o } ` } ) ) . then ( ( o ) => i ( C . createElement ( o . default , n ) ) ) ;
2024-12-02 16:59:57 +08:00
} , [ r ] ) , s ;
} , sn = ( e , t = { } , a = null ) => ( n ) => {
2024-12-11 16:27:12 +08:00
const { code : r , label : s , extras : i , isVirtual : o , initialValue : l , initialValueLanguage : d , convertJs : c , convertJsSetting : m , value : h , ... f } = p . merge ( { } , t , n ) , [ y , b ] = ia ( o ? null : r , { initialValue : l , initialValueLanguage : d , convertJs : c , convertJsSetting : m , type : ( f == null ? void 0 : f . type ) || "string" } , a ) ;
2024-12-06 13:12:05 +08:00
return u ( e , { ... f , value : y , rawValue : b , $setting : i || { } } ) ;
2024-12-11 16:27:12 +08:00
} , on = ( { cols : e , rowHeight : t , itemMargin : a , fields : n , primaryKey : r , dataSource : s , itemClassName : i , itemRender : o = ( m , h , f ) => m , empty : l = u ( Ta , { description : null } ) , className : d , style : c = { } } ) => {
const m = Ge ( ) , h = Q ( ( ) => u ( la , { cols : e , rowHeight : t , itemMargin : a , fields : n , className : i } ) , [ n , e , t , a ] ) ;
return u ( "div" , { className : O ( "ff-data-list-content" , d ) , style : c , children : p . isEmpty ( s ) ? l : s . map ( ( f , y ) => {
const b = o ( C . cloneElement ( h , { data : f } ) , f , y ) ;
return C . cloneElement ( b , { key : ` ${ m } - ${ ( f == null ? void 0 : f [ r ] ) || y } ` } ) ;
2024-12-04 11:05:27 +08:00
} ) } ) ;
2024-12-02 16:59:57 +08:00
} , ln = ( { component : e } ) => {
const { base62params : t } = Aa ( ) ;
2024-12-11 16:27:12 +08:00
return u ( J , { children : u ( kt , { listCode : e , base62params : T . decode ( t ) } ) } ) ;
2024-12-02 16:59:57 +08:00
} , cn = ( ) => "Empty" , dn = ( { component : e , $setting : t } ) => {
2024-12-10 14:48:09 +08:00
const [ a , n ] = N ( ) ;
2024-12-11 16:27:12 +08:00
E ( ( ) => {
2024-12-06 13:12:05 +08:00
if ( ! e ) return n ( u ( cn , { description : null } ) ) ;
2024-12-11 16:27:12 +08:00
X . getWidgetComponent ( e ) . catch ( ( s ) => ( { default : ( ) => ` ${ s } ` } ) ) . then ( ( s ) => C . createElement ( s . default , { $setting : t } ) ) . then ( n ) ;
2024-12-02 16:59:57 +08:00
} , [ e ] ) ;
2024-12-11 16:27:12 +08:00
const r = oe . getPageParams ( ) || { } ;
2024-12-02 16:59:57 +08:00
return a ? C . cloneElement ( a , r ) : null ;
} ;
2024-12-11 16:27:12 +08:00
var pe , _ , me , he , Me , ze ;
const ae = class ae {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-11 16:27:12 +08:00
$ ( this , _ , /* @__PURE__ */ new Map ( ) ) ;
$ ( this , me , { } ) ;
$ ( this , he , null ) ;
2024-12-04 11:05:27 +08:00
k ( this , "init" , ( t , a ) => {
2024-12-11 16:27:12 +08:00
B ( this , _ , t ) , B ( this , me , a ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "get" , ( t ) => ( g ( this , _ ) . has ( t ) || ( t = Array . from ( g ( this , _ ) . keys ( ) ) . find ( ( a ) => g ( this , _ ) . get ( a ) . uri === t ) ) , g ( this , _ ) . get ( t ) || { } ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "redirect" , ( t , a , n = { } ) => {
2024-12-02 16:59:57 +08:00
const { uri : r , type : s , widgetProps : i } = this . get ( t ) || { } ;
2024-12-11 16:27:12 +08:00
let o = ja ( r || t , s != "list" ? a : p . mapValues ( a , ( d ) => T . encode ( d ) ) ) ;
2024-12-02 16:59:57 +08:00
const l = new URLSearchParams ( ) ;
2024-12-11 16:27:12 +08:00
for ( const d in i || { } ) ( i == null ? void 0 : i . type ) == "query" && l . append ( d , a [ d ] ) ;
2024-12-02 16:59:57 +08:00
return l . size > 0 && ( o = ` ${ o } ? ${ l . toString ( ) } ` ) , g ( this , he ) . navigate ( o , n ) ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getMenus" , ( t ) => {
2024-12-02 16:59:57 +08:00
var a ;
return ( ( a = g ( this , me ) ) == null ? void 0 : a [ t ] ) || [ ] ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "findMenuPathByUuid" , ( t ) => {
2024-12-02 16:59:57 +08:00
let a = [ ] ;
2024-12-11 16:27:12 +08:00
for ( const n in g ( this , me ) ) if ( a = g ( this , Me ) . call ( this , g ( this , me ) [ n ] , t , [ n ] ) , a . length > 1 ) return a ;
2024-12-02 16:59:57 +08:00
return a ;
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "getMenusByRouteUuid" , ( t ) => g ( this , ze ) . call ( this , t , Object . values ( g ( this , me ) ) . flat ( ) ) ) ;
$ ( this , Me , ( t , a , n = [ ] ) => {
2024-12-02 16:59:57 +08:00
if ( p . isEmpty ( t ) ) return n ;
for ( const { uuid : r , children : s } of t ) {
if ( r == a ) return n . concat ( r ) ;
2024-12-11 16:27:12 +08:00
if ( ! p . isEmpty ( s ) ) return n . concat ( r , g ( this , Me ) . call ( this , s , a ) ) ;
2024-12-02 16:59:57 +08:00
}
return n ;
} ) ;
2024-12-11 16:27:12 +08:00
$ ( this , ze , ( t , a ) => {
2024-12-02 16:59:57 +08:00
var r ;
let n = [ ] ;
2024-12-11 16:27:12 +08:00
for ( const s of a ) s . widgetType == "redirect" && ( s . uuid == t || s . widget == t ? n . push ( s ) : ( r = s . children ) != null && r . length && ( n = n . concat ( g ( this , ze ) . call ( this , t , s . children ) ) ) ) ;
2024-12-02 16:59:57 +08:00
return n ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getCurrentMenu" , ( ) => {
2024-12-02 16:59:57 +08:00
const { uuid : t } = this . getCurrentRoute ( ) || { } ;
if ( ! t ) return ;
const a = this . getMenusByRouteUuid ( t ) ;
return p . isEmpty ( a ) ? void 0 : a [ 0 ] ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getCurrentRoute" , ( t = 0 ) => {
2024-12-02 16:59:57 +08:00
var n ;
const a = ( n = g ( this , he ) . state . matches [ g ( this , he ) . state . matches . length - 1 - t ] ) == null ? void 0 : n . route ;
if ( ! a ) return null ;
2024-12-11 16:27:12 +08:00
for ( let [ r , s ] of g ( this , _ ) ) if ( s . uri === a . path ) return s ;
2024-12-02 16:59:57 +08:00
return null ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getPageParams" , ( t ) => {
2024-12-11 16:27:12 +08:00
var s , i ;
const { location : a = { } , matches : n = [ ] } = ( ( s = g ( this , he ) ) == null ? void 0 : s . state ) || { } , r = ( ( i = n [ n . length - 1 ] ) == null ? void 0 : i . params ) || { } ;
return a . search && new URLSearchParams ( a . search ) . forEach ( ( o , l ) => {
r [ l ] = o ;
2024-12-02 16:59:57 +08:00
} ) , t ? p . get ( r , t ) : r ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "createBrowserRouter" , ( t = { } ) => {
2024-12-11 16:27:12 +08:00
if ( g ( this , _ ) . size == 0 ) return null ;
const a = Oe . get ( "Common.WEBSITE_DEFAULT_THEME" , "@pkg/ff/frameworks/DefaultTheme" ) , n = Oe . get ( X . checkUserToken ( ) ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT" , "/index" ) , r = { [ a ] : 0 } , s = ( o , l ) => ( ) => X . getWidgetComponent ( o ) . then ( ( d ) => d . default || function ( ) {
2024-12-02 16:59:57 +08:00
return ` ${ o } ` ;
2024-12-11 16:27:12 +08:00
} ) . then ( ( d ) => ( { Component : ( ) => C . createElement ( _t , { } , C . createElement ( d , l ) ) } ) ) , i = Array . from ( g ( this , _ ) . values ( ) ) . reduce ( ( o , { uuid : l , uri : d , name : c , type : m , component : h , widgetSetting : f , isLogin : y , isLayout : b , extra : w } ) => {
2024-12-04 11:05:27 +08:00
let v = { } , j = 0 ;
2024-12-11 16:27:12 +08:00
switch ( m ) {
2024-12-02 16:59:57 +08:00
case "list" :
2024-12-11 16:27:12 +08:00
v . element = C . createElement ( ln , { component : h } ) ;
2024-12-02 16:59:57 +08:00
break ;
case "fsdpf-component" :
2024-12-11 16:27:12 +08:00
v . element = C . createElement ( dn , { key : h , component : h , $setting : f } ) ;
2024-12-02 16:59:57 +08:00
}
if ( w != null && w . layout ) {
2024-12-11 16:27:12 +08:00
if ( ! r [ w == null ? void 0 : w . layout ] ) return r [ w == null ? void 0 : w . layout ] = o . length , [ ... o , { path : "/" , lazy : s ( w == null ? void 0 : w . layout , { } ) , children : [ { path : d , ... v } ] } ] ;
2024-12-04 11:05:27 +08:00
j = r [ w == null ? void 0 : w . layout ] ;
2024-12-02 16:59:57 +08:00
}
2024-12-11 16:27:12 +08:00
return b && j > - 1 ? ( o [ j ] . children . push ( { path : d , ... v } ) , o ) : [ ... o , { path : d , ... v } ] ;
2024-12-02 16:59:57 +08:00
} , [ { path : "/" , lazy : s ( a , { } ) , children : [ ] } ] ) ;
2024-12-10 14:48:09 +08:00
return i . push ( { index : ! 0 , element : C . createElement ( un , { to : n , replace : ! 0 } ) } ) , B ( this , he , Ia ( i , t ) ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
if ( g ( ae , pe ) ) return g ( ae , pe ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
pe = new WeakMap ( ) , _ = new WeakMap ( ) , me = new WeakMap ( ) , he = new WeakMap ( ) , Me = new WeakMap ( ) , ze = new WeakMap ( ) , $ ( ae , pe , null ) , k ( ae , "getInstance" , ( ) => ( g ( ae , pe ) || B ( ae , pe , new ae ( ) ) , g ( ae , pe ) ) ) ;
let mt = ae ;
const un = ( { to : e , replace : t } ) => Ma ( ) ? C . createElement ( za , { to : e , replace : t } ) : ( window . document . location = e , "redirect" ) , oe = mt . getInstance ( ) , Se = new Worker ( new URL ( "/ff-worker/index.js" , self . location ) ) , Mt = { getConfigure : ( e ) => Oe . get ( e ) , route : { redirect : ( ... e ) => oe . redirect ( ... e ) , getPageParams : ( ... e ) => oe . getPageParams ( ... e ) , getCurrentRoute : ( ) => oe . getCurrentRoute ( ) } , popup : { notification : ( ... e ) => K . notification ( ... e ) , success : ( ... e ) => K . success ( ... e ) , error : ( ... e ) => K . error ( ... e ) , form : ( ... e ) => K . form ( ... e ) , modal : ( ... e ) => K . modal ( ... e ) , confirm : ( ... e ) => K . confirm ( ... e ) } } ;
var tt , $e , fe ;
const M = class M {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-04 11:05:27 +08:00
k ( this , "exec" , ( t , a = { } , n = { } , r = "" ) => new Promise ( ( s , i ) => {
2024-12-11 16:27:12 +08:00
const o = Ot ( M , tt ) . _ ++ ;
g ( M , $e ) . set ( o , n ) , M . mQueue . set ( o , [ s , i ] ) , Se . postMessage ( { id : o , session : r , category : "eval" , method : t , args : a } ) ;
2024-12-02 16:59:57 +08:00
} ) ) ;
2024-12-11 16:27:12 +08:00
k ( this , "clear" , ( t ) => Se . postMessage ( { session : t , category : "clear" } ) ) ;
if ( g ( M , fe ) ) return g ( M , fe ) ;
Promise . resolve ( ) . then ( ( ) => An ) . then ( ( t ) => {
2024-12-02 16:59:57 +08:00
Mt . http = t . http ;
2024-12-11 16:27:12 +08:00
} ) , Se . addEventListener ( "message" , ( { data : { id : t , task _id : a , method : n , args : r , category : s , data : i , error : o , session : l } } ) => {
if ( s === "eval" && M . mQueue . has ( t ) ) o !== null ? M . mQueue . get ( t ) [ 1 ] ( o ) : M . mQueue . get ( t ) [ 0 ] ( i ) , g ( M , $e ) . delete ( t ) , M . mQueue . delete ( t ) ;
2024-12-02 16:59:57 +08:00
else if ( s === "util" ) try {
2024-12-11 16:27:12 +08:00
const d = p . get ( Mt , n . split ( "/" ) ) || p . get ( g ( M , $e ) . get ( a ) , n . split ( "/" ) ) ;
if ( ! p . isFunction ( d ) ) throw ` ${ n } not found ` ;
Promise . resolve ( Reflect . apply ( d , void 0 , r ) ) . then ( ( c ) => {
Se . postMessage ( { id : t , task _id : a , category : s , method : n , args : r , session : l , data : c , error : null } ) ;
} ) . catch ( ( c ) => {
Se . postMessage ( { id : t , task _id : a , category : s , method : n , args : r , session : l , data : null , error : c } ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
} catch ( d ) {
Se . postMessage ( { id : t , task _id : a , category : s , method : n , args : r , session : l , data : null , error : d } ) ;
2024-12-02 16:59:57 +08:00
}
} , ! 1 ) ;
}
} ;
2024-12-11 16:27:12 +08:00
tt = new WeakMap ( ) , $e = new WeakMap ( ) , fe = new WeakMap ( ) , k ( M , "mQueue" , /* @__PURE__ */ new Map ( ) ) , $ ( M , tt , 0 ) , $ ( M , $e , /* @__PURE__ */ new Map ( ) ) , $ ( M , fe , null ) , k ( M , "getInstance" , ( ) => ( g ( M , fe ) || B ( M , fe , new M ( ) ) , g ( M , fe ) ) ) ;
let ht = M ;
const Ce = ht . getInstance ( ) , St = ( ) => {
2024-12-02 16:59:57 +08:00
const e = q ( ! 0 ) , [ , t ] = C . useReducer ( ( a ) => a + 1 , 0 ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => ( ) => e . current = ! 1 , [ ] ) , ( ) => e . current && t ( ) ;
} , or = ( e ) => {
2024-12-02 16:59:57 +08:00
const t = q ( ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
2024-12-02 16:59:57 +08:00
t . current = e ;
} , [ e ] ) , t . current ;
2024-12-11 16:27:12 +08:00
} , lr = ( e ) => {
const [ t , a ] = N ( e ) , n = q ( null ) , r = le ( ( s , i ) => {
2024-12-02 16:59:57 +08:00
n . current = i , a ( s ) ;
} , [ ] ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
2024-12-02 16:59:57 +08:00
n . current && ( n . current ( t ) , n . current = null ) ;
} , [ t ] ) , [ t , r ] ;
2024-12-11 16:27:12 +08:00
} , Ue = ( e = ( n ) => {
2024-12-02 16:59:57 +08:00
} , t , a = p . isEqual ) => {
const n = C . useRef ( ) ;
a ( t , n . current ) || ( n . current = p . cloneDeep ( t ) ) , C . useEffect ( e , [ n . current ] ) ;
2024-12-11 16:27:12 +08:00
} , xt = Ue , ca = ( e , t = "string" ) => {
2024-12-02 16:59:57 +08:00
var a ;
if ( ! Array . isArray ( e ) ) return e ;
2024-12-11 16:27:12 +08:00
for ( let n = 0 ; n < e . length ; n ++ ) e [ n ] . value = G ( ( a = e [ n ] ) == null ? void 0 : a . value , t ) , e [ n ] && Reflect . has ( e [ n ] , "children" ) && ( e [ n ] . children = ca ( e [ n ] . children , t ) ) ;
2024-12-02 16:59:57 +08:00
return e ;
2024-12-11 16:27:12 +08:00
} , cr = ( e , t = "json" , a = "string" , n , r = null ) => {
const [ s ] = Y . useForm ( n ) , [ i , o ] = N ( [ { label : "无" , value : "" , disabled : ! 0 } ] ) , l = q ( [ ] ) , d = Y . useWatch ( ( c ) => l . current . length === 0 ? null : p . pick ( c , l . current ) , s ) || null ;
return E ( ( ) => {
Array . isArray ( e ) ? o ( e ) : t === "javascript" && e ? Ce . exec ( e , { } , { getFieldValue : ( c ) => ( l . current . includes ( c ) || l . current . push ( c ) , s . getFieldValue ( c ) ) , getFieldValueForBasicForm : ( c ) => ( l . current . includes ( c ) || l . current . push ( c ) , r ? r . getFieldValue ( c ) : s . getFieldValue ( c ) ) } ) . then ( ( c ) => {
o ( G ( c , "array" ) ) ;
} ) : e && o ( G ( e , "array" ) ) ;
} , [ e , t , d ] ) , ca ( i , a ) ;
} , dr = ( e ) => {
2024-12-10 14:48:09 +08:00
const [ t , a ] = N ( ) , n = { type : "GET" } ;
2024-12-02 16:59:57 +08:00
if ( typeof e == "string" ? n . url = e : p . isPlainObject ( e ) && Object . assign ( n , e ) , ! ( n != null && n . url ) ) throw "url is required" ;
2024-12-11 16:27:12 +08:00
const r = ( s ) => T . request ( n , ! 1 ) . resp ( ( i ) => ( console . log ( "useSubscribeRequest" , s ) , a ( i ) , i ) ) ;
return Ue ( ( ) => {
2024-12-02 16:59:57 +08:00
let s = null ;
return r ( ) . then ( ( i ) => {
s = ea . subscribe ( p . throttle ( r , 180 , { leading : ! 1 , trailing : ! 0 } ) , i . res ) ;
} ) , ( ) => s == null ? void 0 : s ( ) ;
} , n ) , t ;
} , gn = ( e ) => {
const [ t , a ] = C . useState ( { gridItems : [ ] , hideItems : [ ] } ) ;
return C . useEffect ( ( ) => {
2024-12-11 16:27:12 +08:00
e && T . get ( ` /api/_/ ${ e } ` ) . then ( ( { pk : n , uuid : r , code : s , resource : i , align : o , cols : l , rowHeight : d , marginX : c , marginY : m , listenChangeFields : h , listenChangeFieldsFunc : f , fields : y } ) => ( { pk : n , uuid : r , code : s , resource : i , align : o , cols : l , rowHeight : d , marginX : c , marginY : m , listenChangeFields : h , listenChangeFieldsFunc : f , ... y . reduce ( ( b , w ) => {
2024-12-04 11:05:27 +08:00
var v ;
return ( v = w == null ? void 0 : w . field ) != null && v . hidden ? b . hides . push ( w == null ? void 0 : w . field ) : b . items . push ( w ) , b ;
2024-12-02 16:59:57 +08:00
} , { items : [ ] , hides : [ ] } ) } ) ) . then ( a ) ;
} , [ e ] ) , t ;
} , pn = ( { max : e = 0 , min : t = 0 , type : a = "" , message : n , pattern : r , required : s = ! 1 , validator : i } = { } , o , l ) => {
2024-12-11 16:27:12 +08:00
const [ d , c ] = N ( [ ] ) ;
return E ( ( ) => {
const m = [ ] ;
2024-12-02 16:59:57 +08:00
if ( s ) {
2024-12-11 16:27:12 +08:00
let h = l ;
2024-12-02 16:59:57 +08:00
switch ( l ) {
case "number" :
case "string" :
case "array" :
break ;
case "bool" :
2024-12-11 16:27:12 +08:00
h = "boolean" ;
2024-12-02 16:59:57 +08:00
break ;
case "json" :
2024-12-11 16:27:12 +08:00
h = "object" ;
2024-12-02 16:59:57 +08:00
}
2024-12-11 16:27:12 +08:00
m . push ( { type : h , required : ! 0 , whitespace : ! 0 , message : "该项必填" } ) ;
2024-12-02 16:59:57 +08:00
}
switch ( a ) {
case "string" :
2024-12-11 16:27:12 +08:00
m . push ( { type : a , max : e , min : t , message : n || ( t && e ? ` 字符必须在 ${ t } ~ ${ e } 之间 ` : ` ${ e ? "最多能有" : "最少要有" } ${ t || e } 个字符 ` ) } ) ;
2024-12-02 16:59:57 +08:00
break ;
case "pattern" :
2024-12-11 16:27:12 +08:00
m . push ( { type : "string" , pattern : r , message : n } ) ;
2024-12-02 16:59:57 +08:00
break ;
case "validator" :
2024-12-11 16:27:12 +08:00
i && m . push ( ( { getFieldValue : h } ) => ( { validator : async ( f , y ) => {
const b = await Ce . exec ( i , { value : y , fieldName : o } , { getFieldValue : h } ) ;
2024-12-02 16:59:57 +08:00
return p . isString ( b ) && b ? Promise . reject ( b ) : p . isBoolean ( b ) && ! b ? Promise . reject ( n ) : Promise . resolve ( ) ;
} } ) ) ;
}
2024-12-11 16:27:12 +08:00
c ( m ) ;
} , [ e , t , a , n , r , s , i ] ) , d ;
2024-12-02 16:59:57 +08:00
} , mn = ( e , t , a ) => {
2024-12-10 14:48:09 +08:00
const [ n , r ] = N ( null ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
2024-12-02 16:59:57 +08:00
const { initDataUri : s = ` /api/ ${ e } ` , initDataMethod : i = "GET" } = a || { } ;
2024-12-11 16:27:12 +08:00
t && T . request ( { method : i , url : p . trimEnd ( ` ${ s } / ${ t } ` , "/" ) } ) . then ( ( o ) => {
2024-12-02 16:59:57 +08:00
r ( o ) ;
} ) ;
} , [ e , t , a ] ) , n ;
} , hn = ( e , t , a , n = { } ) => {
2024-12-11 16:27:12 +08:00
const r = St ( ) , s = q ( ! 0 ) , i = q ( [ ] ) , [ o , l ] = N ( a ) , d = Y . useWatch ( ( c ) => JSON . stringify ( p . pick ( c , i . current ) ) , t ) || "{}" ;
return E ( ( ) => {
e && Ce . exec ( e , n , { getFieldValue : p . wrap ( t . getFieldValue , ( c , m ) => ( i . current . some ( ( h ) => p . isEqual ( h , m ) ) || ( i . current . push ( m ) , r ( ) ) , c ( m ) ) ) , isFieldTouched : t . isFieldTouched , isFieldsTouched : t . isFieldsTouched } ) . then ( ( c ) => s . current && l ( c ) ) ;
} , [ e , d , t , n ] ) , E ( ( ) => ( ) => s . current = ! 1 , [ ] ) , o ;
} , ur = ( { value : e , onChange : t } , a = null ) => {
const n = q ( ) , [ r ] = Y . useForm ( a ) ;
2024-12-10 14:48:09 +08:00
return xt ( ( ) => {
2024-12-02 16:59:57 +08:00
p . isEqual ( n . current , e ) || r . setFieldsValue ( e ) ;
2024-12-11 16:27:12 +08:00
} , [ e ] ) , E ( ( ) => ( ) => r . resetFields ( ) , [ ] ) , [ Q ( ( ) => r . _ _INTERNAL _ _ ? r : { ... r , _ _INTERNAL _ _ : { } } , [ r ] ) , ( s , i ) => {
2024-12-02 16:59:57 +08:00
n . current = i , t ( i ) ;
} ] ;
} , fn = ( { type : e , initialValue : t , initialValueLanguage : a , onChange : n , form : r } ) => {
const s = hn ( a == "javascript" && t , r , a == "javascript" ? void 0 : t , { } ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
a == "javascript" ? n ( G ( s , e ) ) : t && n ( G ( t , e ) ) ;
2024-12-02 16:59:57 +08:00
} , [ e , t , s ] ) , null ;
} , yn = ( { widget : e = "Input" , widgetPrefix : t = "@pkg/ff/grid-layout-forms" , widgetDecorator : a , subWidgets : n , basicForm : r , ... s } ) => {
2024-12-10 14:48:09 +08:00
const i = e != null && e . startsWith ( "@" ) || e != null && e . startsWith ( "blob:" ) ? e : ` ${ t } / ${ e } ` , [ o , l ] = N ( ) ;
2024-12-11 16:27:12 +08:00
return E ( ( ) => {
i && X . getWidgetComponent ( i ) . then ( ( { defaultProps : d = { } , default : c } ) => ( { default : da ( c , d , r ) } ) ) . catch ( ( d ) => ( { default : ( ) => ` ${ d } ` } ) ) . then ( ( d ) => l ( C . createElement ( d . default , s ) ) ) ;
2024-12-02 16:59:57 +08:00
} , [ i ] ) , o && C . cloneElement ( o , s ) ;
} , da = ( e , t = { } , a = null ) => ( n ) => {
2024-12-11 16:27:12 +08:00
const { type : r , code : s , label : i , noStyle : o , placeholder : l , extras : d , validators : c , help : m , isVirtual : h , $isReserved : f , initialValue : y , initialValueLanguage : b , convertJs : w , convertJsSetting : v , widgetPerfix : j , boxStyle : z , widgetDecorator : I , subWidgets : L , ... S } = { ... t , ... n } , F = pn ( c || { } , s , r ) , V = { label : i , noStyle : o , colon : ! 1 , layout : "vertical" } , W = { placeholder : l , ... S } , U = le ( ( D ) => D == null ? void 0 : G ( D , r ) , [ r ] ) ;
return u ( Jt , { name : s , rules : F , initialValue : U ( y ) , normalize : U , children : ( D , x , ce ) => {
var re ;
return u ( e , { type : r , rcform : ce , itemProps : { validateStatus : x . errors . length > 0 ? "error" : "success" , tooltip : m , help : x . errors . length > 0 ? x . errors . join ( "、" ) : null , required : ( ( re = F == null ? void 0 : F [ 0 ] ) == null ? void 0 : re . required ) || ! 1 , ... V } , fieldProps : { ... W , ... D } , $setting : d || { } } ) ;
2024-12-02 16:59:57 +08:00
} } ) ;
2024-12-11 16:27:12 +08:00
} , Pt = ( { cols : e = 24 , rowHeight : t = 16 , itemMargin : a = [ 8 , 16 ] , containerPadding : n = [ 0 , 0 ] , fields : r = [ ] , children : s , basicForm : i = null } ) => {
2024-12-02 16:59:57 +08:00
const o = oa ( r , da , "@pkg/ff/grid-layout-forms" ) ;
2024-12-11 16:27:12 +08:00
return R ( "div" , { className : "ff-grid-layout-form" , style : { "--grid-layout-item-margin-x" : ` ${ ( a == null ? void 0 : a [ 0 ] ) ? ? 8 } px ` , "--grid-layout-item-margin-y" : ` ${ ( a == null ? void 0 : a [ 1 ] ) ? ? 16 } px ` , "--grid-layout-container-padding-y" : ` ${ ( n == null ? void 0 : n [ 0 ] ) || 0 } px ` , "--grid-layout-container-padding-x" : ` ${ ( n == null ? void 0 : n [ 1 ] ) || 0 } px ` , "--grid-layout-cols" : e , "--grid-layout-row-height" : ` ${ t } px ` } , children : [ o , s && C . cloneElement ( s , { cols : e , rowHeight : t , itemMargin : a , containerPadding : n , fields : r } ) ] } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
Pt . propTypes = { fields : A . array } ;
const wn = ( zt = Pt , ( { code : e , layout : t , name : a , primaryKey : n = 0 , style : r = { } , formProps : s = { } , form : i , isPreview : o = ! 1 , className : l , onFinish : d , onValuesChange : c = ( ) => {
} , ... m } ) => {
const { align : h , autoComplete : f , resource : y , items : b , hides : w , rowHeight : v , marginX : j , marginY : z , cols : I , listenChangeFields : L , listenChangeFieldsFunc : S , pk : F , uuid : V } = gn ( e ) , [ W ] = Y . useForm ( i ) , U = Q ( ( ) => [ { name : "__PK__" , value : F } , { name : "__PROPS__" , value : s } , { name : "__RESOURCE__" , value : y } , { name : "__LAYOUT_KEY__" , value : e } , { name : "__LAYOUT_UUID__" , value : V } , { name : "__PRIMARY_KEY__" , value : n } ] , [ F , e , V , y , n , s ] ) ;
return R ( Y , { className : l , name : a || e , layout : t || h , fields : U , form : W , autoComplete : f , style : { ... r , position : "relative" } , onFinish : d , onValuesChange : ( D , x ) => ( ( { changedValues : ce , allValues : re , listenChangeFields : at , listenChangeFieldsFunc : Be , onValuesChange : nt , code : Et } ) => {
nt ( ce , re ) , Be && Array . isArray ( at ) && Ce . exec ( Be , { changedValues : ce , allValues : re } , { getFieldValue : W . getFieldValue , setFieldValue : W . setFieldValue , setFieldsValue : W . setFieldsValue , isFieldTouched : W . isFieldTouched , isFieldsTouched : W . isFieldsTouched } ) ;
} ) ( { changedValues : D , allValues : x , listenChangeFields : L , listenChangeFieldsFunc : S , onValuesChange : c , code : e } ) , children : [ u ( zt , { ... m , form : W , code : e , fields : b , cols : I , rowHeight : v , itemMargin : [ j , z ] } ) , w == null ? void 0 : w . map ( ( D ) => {
var x ;
return u ( Jt , { name : D . code , children : u ( fn , { form : W , name : D . code , type : D . type , initialValue : D . initialValue , initialValueLanguage : ( x = D . extras ) == null ? void 0 : x . initialValueLanguage } ) } , JSON . stringify ( D . code ) ) ;
2024-12-02 16:59:57 +08:00
} ) ] } , e ) ;
} ) ;
var zt ;
const ua = ( { $setting : e , $close : t , extras : a , code : n , primaryKey : r , ... s } ) => {
2024-12-11 16:27:12 +08:00
const [ i ] = Y . useForm ( ) , o = mn ( n , r , e ) ;
return E ( ( ) => {
2024-12-02 16:59:57 +08:00
o && i . setFieldsValue ( o ) ;
2024-12-11 16:27:12 +08:00
} , [ o ] ) , u ( J , { actions : R ( C . Fragment , { children : [ u ( P , { name : "保存" , type : "primary" , widget : ( ) => {
const l = i . getFieldValue ( "__RESOURCE__" ) , { initDataUri : d = ` /api/ ${ n } ` } = e || { } ;
i . validateFields ( ! 0 ) . then ( ( c ) => l ? p . pick ( c , [ l ] ) : c ) . then ( ( c ) => T . post ( r ? ` ${ d } / ${ r } ` : ` ${ d } ` , c ) . msg ( t ) ) . catch ( ( ) => K . error ( "请先完善表单信息" , { duration : 2e3 } ) ) ;
} } ) , u ( P , { name : "取消" , widget : ( ) => t ( ! 1 ) } ) ] } ) , extras : a , children : u ( wn , { form : i , code : n , primaryKey : r , ... s } ) } ) ;
} , Cn = ( e , t , a , { isReplaceRouteHistory : n = ! 1 } = { } ) => oe . redirect ( a , t , { replace : n } ) , bn = ( e , t = { } , a , n = { } ) => {
var s ;
const r = ( s = n . router ) == null ? void 0 : s . reduce ( ( i , [ o , l , d ] ) => {
const c = p . get ( t , [ "router" , o ] ) ;
if ( ! c && c !== 0 && l ) throw ` 请传入 ${ d } ` ;
return ` ${ i } / ${ c } ` ;
} , ` /api/ ${ a } ` ) ;
return T . del ( r , t . param ) . msg ( ) ;
} , Wt = ( e , t , a , { status : { loading : n , disabled : r } , setStatus : s } ) => {
2024-12-02 16:59:57 +08:00
const i = { loading : ( o ) => o === void 0 ? n : s ( ( l ) => ( { ... l , loading : o } ) ) , disabled : ( o ) => o === void 0 ? r : s ( ( l ) => ( { ... l , disabled : o } ) ) } ;
2024-12-11 16:27:12 +08:00
return p . isFunction ( a ) ? a . call ( null , { ... t , ... i } ) : p . isString ( a ) && a ? Ce . exec ( a , t , i ) : null ;
} , Ut = ( e , t , a , n , r ) => p . isString ( a ) && a ? X . getWidgetComponent ( a ) . then ( ( { default : s } ) => K . modal ( s , { ... t , $setting : n } , r != null && r . title ? { ... r , title : p . template ( r . title ) ( e ) } : r ) ) . catch ( ( s ) => {
K . error ( a , { content : s . toString ( ) } ) ;
} ) : K . modal ( a , { ... t , $setting : n } , r != null && r . title ? { ... r , title : p . template ( r . title ) ( e ) } : r ) , kn = ( e , t , a , n , r ) => K . modal ( ua , { ... t , $setting : n , code : a } , r != null && r . title ? { ... r , title : p . template ( r . title ) ( e ) } : r ) , vn = ( e , t , a , n , r ) => K . modal ( kt , { base62params : t , $setting : n , listCode : a } , r != null && r . title ? { ... r , title : p . template ( r . title ) ( e ) } : r ) , Sn = ( { widget : e , widgetType : t , widgetData : a , widgetProps : n , widgetSetting : r , widgetContainerProps : s } , { onAfterClick : i , onBeforeClick : o } ) => {
const l = Te ( we ) , [ d , c ] = N ( { leading : ! 0 , trailing : ! 1 } ) , m = Q ( ( ) => {
2024-12-02 16:59:57 +08:00
switch ( t ) {
case "redirect" :
return p . partialRight ( Cn , e , r ) ;
case "func" :
2024-12-11 16:27:12 +08:00
return p . partialRight ( Wt , ( r == null ? void 0 : r . code ) ? ? e , { status : d , setStatus : c } ) ;
2024-12-02 16:59:57 +08:00
case "fsdpf-component" :
return p . partialRight ( Ut , e , r , s ) ;
case "grid-layout-form" :
return p . partialRight ( kn , e , r , s ) ;
2024-12-11 16:27:12 +08:00
case "data-list" :
return p . partialRight ( vn , e , r , s ) ;
case "destroy" :
return p . partialRight ( bn , e , r , s ) ;
2024-12-02 16:59:57 +08:00
default :
2024-12-10 14:48:09 +08:00
if ( $t ( e ) || C . isValidElement ( e ) ) return p . partialRight ( Ut , e , r , s ) ;
2024-12-11 16:27:12 +08:00
if ( p . isFunction ( e ) ) return p . partialRight ( Wt , ( r == null ? void 0 : r . code ) || e , { status : d , setStatus : c } ) ;
2024-12-02 16:59:57 +08:00
}
2024-12-11 16:27:12 +08:00
return ( ... h ) => console . error ( "useButton unknown widgetType" , t , ... h ) ;
2024-12-02 16:59:57 +08:00
} , [ e , t ] ) ;
2024-12-11 16:27:12 +08:00
return [ p . debounce ( ( h ) => ( o == null || o ( h ) , Promise . resolve ( Yt ( n , h , { list : l } ) ) . then ( ( f ) => m ( h , { ... a , ... f } ) ) . then ( ( f ) => i == null ? void 0 : i ( f ) ) . catch ( console . error ) ) , 300 , { leading : ! 0 , trailing : ! 1 } ) , d ] ;
2024-12-10 14:48:09 +08:00
} , Dt = /* @__PURE__ */ new Set ( ) , ft = ( e = [ ] , t = 0 ) => {
2024-12-02 16:59:57 +08:00
const a = e [ t ] ;
2024-12-10 14:48:09 +08:00
if ( a . length && ! Dt . has ( a ) ) {
2024-12-02 16:59:57 +08:00
const n = document . createElement ( "script" ) ;
n . setAttribute ( "src" , a ) , n . setAttribute ( "data-namespace" , a ) , e . length > t + 1 && ( n . onload = ( ) => {
ft ( e , t + 1 ) ;
} , n . onerror = ( ) => {
ft ( e , t + 1 ) ;
2024-12-10 14:48:09 +08:00
} ) , Dt . add ( a ) , document . body . appendChild ( n ) ;
2024-12-02 16:59:57 +08:00
}
2024-12-10 10:46:00 +08:00
} , yt = ( { className : e , type : t , style : a = { } , ... n } ) => u ( "span" , { role : "img" , className : O ( "ff-iconfont" , e ) , style : a , ... n , children : u ( "svg" , { style : { width : "1em" , height : "1em" , fill : "currentColor" , overflow : "hidden" } , viewBox : "0 0 1024 1024" , children : u ( "use" , { xlinkHref : ` # ${ t } ` } ) } ) } ) ;
2024-12-04 11:05:27 +08:00
yt . propTypes = { className : A . string , type : A . string . isRequired , style : A . object } , yt . init = ft ;
2024-12-11 16:27:12 +08:00
const De = ( e ) => function ( { className : t , children : a , name : n , icon : r , type : s = "default" , iconPosition : i = "start" , noAuthType : o , onAfterClick : l , onBeforeClick : d , data : c , loading : m , disabled : h , tooltip : f , popConfirm : y , widget : b , widgetType : w , widgetData : v , widgetProps : j , widgetSetting : z , widgetContainerProps : I , ... L } ) {
2024-12-10 10:46:00 +08:00
const S = { type : "primary" , className : O ( "ff-button" , t ) , iconPosition : i } ;
s === "danger" ? S . danger = ! 0 : s === "default" && ( S . type = s ) , e === "link" || e === "dashed" ? ( S . type = e , s === "default" && ( S . className = O ( S . className , "ff-default" ) ) ) : e !== "circle" && e !== "round" || ( S . shape = e ) , r && ( S . icon = u ( yt , { type : r } ) ) ;
2024-12-11 16:27:12 +08:00
const [ F , V ] = N ( ! 1 ) , [ W , { disabled : U , loading : D } ] = Sn ( { widget : b , widgetType : w , widgetData : v , widgetProps : j , widgetSetting : z , widgetContainerProps : I } , { onAfterClick : l , onBeforeClick : d } ) ;
return u ( Ra , { okText : "确定" , cancelText : "取消" , ... y || { } , disabled : U || h , open : F , onOpenChange : ( x ) => {
if ( ! x ) return V ( x ) ;
y ? V ( x ) : W ( c ) ;
2024-12-02 16:59:57 +08:00
} , onConfirm : ( ) => {
2024-12-11 16:27:12 +08:00
W ( c ) ;
} , onClick : ( x ) => {
x . stopPropagation ( ) ;
} , children : u ( Fa , { ... f , title : F ? null : f == null ? void 0 : f . title , trigger : [ "hover" , "click" ] , children : u ( lt , { loading : D || m , disabled : U || h , ... S , ... L , children : a || n } ) } ) } ) ;
} , P = De ( "default" ) , xn = De ( "link" ) , Pn = De ( "circle" ) , Nn = De ( "round" ) , $n = De ( "dashed" ) , Bt = ( { data : e , widget : t , widgetType : a = "fsdpf-component" , children : n , widgetData : r , widgetProps : s , widgetSetting : i , widgetContainerProps : o } ) => {
const l = Te ( we ) , [ d , c ] = N ( ! 1 ) , [ m , h ] = N ( "hover" ) , [ f , y ] = N ( { } ) , [ b , w ] = N ( ) , { placement : v , align : j , arrow : z = { pointAtCenter : ! 0 } , getPopupContainer : I , ... L } = o || { } ;
E ( ( ) => {
a == "grid-layout-form" ? w ( C . createElement ( ua , { ... r , $setting : i , code : t } ) ) : a == "data-list" ? w ( C . createElement ( kt , { base62params : e , $setting : i , listCode : t } ) ) : p . isString ( t ) ? X . getWidgetComponent ( t ) . then ( ( { default : V } ) => {
2024-12-04 11:05:27 +08:00
w ( C . createElement ( V , { ... r , $setting : i } ) ) ;
2024-12-10 14:48:09 +08:00
} ) . catch ( ( V ) => w ( V . toString ( ) ) ) : $t ( t ) ? w ( C . createElement ( t , { ... r , $setting : i } ) ) : C . isValidElement ( t ) && w ( C . cloneElement ( t , { ... r , $setting : i } ) ) ;
2024-12-11 16:27:12 +08:00
} , [ t , a , r ] ) , E ( ( ) => {
2024-12-02 16:59:57 +08:00
Promise . resolve ( Yt ( s , e , { list : l } ) ) . then ( y ) ;
} , [ s , e ] ) ;
2024-12-04 11:05:27 +08:00
const S = ( V ) => {
2024-12-11 16:27:12 +08:00
c ( V ) , ! V && h ( "hover" ) ;
2024-12-04 11:05:27 +08:00
} , F = ( V ) => {
2024-12-11 16:27:12 +08:00
c ( ! 0 ) , h ( "click" ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
return u ( Oa , { zIndex : 1080 , placement : v , onPopupClick : F , onClick : F , open : d , align : j , arrow : z , trigger : m , getPopupContainer : I , content : u ( En , { ... L , children : b && C . cloneElement ( b , { ... f , $close : ( ) => S ( ! 1 ) } ) } ) , children : n , onOpenChange : S } ) ;
} , En = ( { title : e , className : t , children : a , width : n , height : r , ... s } ) => {
const [ i , o ] = N ( { } ) , l = le ( ( m , h ) => o ( ( f ) => ( { ... f , [ m ] : h } ) ) , [ ] ) , d = le ( ( m ) => o ( ( h ) => ( { ... h , [ m ] : void 0 } ) ) , [ ] ) , c = e ? C . createElement ( "div" , { className : "ff-popup-title" } , e ) : i == null ? void 0 : i . title ;
return u ( We . Provider , { value : { ele : i , mount : l , unmount : d } , children : R ( "div" , { className : O ( "ff-popup ff-popover" , t ) , style : { width : n , height : r } , ... s , children : [ R ( "div" , { className : "ff-popup-header" , children : [ c , i == null ? void 0 : i [ "sub-title" ] ] } ) , a , R ( "div" , { className : "ff-popup-footer" , children : [ i == null ? void 0 : i . extras , i == null ? void 0 : i . actions ] } ) ] } ) } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
Bt . propTypes = { widgetType : A . oneOf ( [ "fsdpf-component" , "grid-layout-form" , "data-list" ] ) } , P . propTypes = { type : A . oneOf ( [ "primary" , "default" , "danger" , "" ] ) , name : A . string , icon : A . string , iconPosition : A . oneOf ( [ "start" , "end" ] ) , data : A . any , widget : A . any , widgetType : A . oneOf ( [ "destroy" , "redirect" , "func" , "fsdpf-component" , "grid-layout-form" , "grid-layout" , "data-list" ] ) , widgetData : A . object , widgetProps : A . object , widgetSetting : A . object , widgetContainerProps : A . object } , P . Link = xn , P . Link . defaultProps = P . defaultProps , P . Link . propTypes = P . propTypes , P . Circle = Pn , P . Circle . defaultProps = P . defaultProps , P . Circle . propTypes = P . propTypes , P . Round = Nn , P . Round . defaultProps = P . defaultProps , P . Round . propTypes = P . propTypes , P . Dashed = $n , P . Dashed . defaultProps = P . defaultProps , P . Dashed . propTypes = P . propTypes , P . Popover = Bt ;
2024-12-02 16:59:57 +08:00
const Tn = ( { fields : e , formProps : t , $close : a } ) => {
2024-12-11 16:27:12 +08:00
const [ n ] = Y . useForm ( ) , r = Q ( ( ) => [ { name : "__PROPS__" , value : t } ] , [ t ] ) ;
return u ( J , { actions : R ( C . Fragment , { children : [ u ( P , { name : "取消" , widget : ( ) => a ( ! 1 ) } ) , u ( P , { name : "确定" , type : "primary" , widget : ( ) => n . validateFields ( ! 0 ) . then ( a ) } ) ] } ) , children : u ( Y , { fields : r , form : n , className : "ff-modal-form" , children : e == null ? void 0 : e . map ( ( { code : s , ... i } ) => u ( yn , { code : s , ... i } , s ) ) } ) } ) ;
} , Rn = ( { className : e , $close : t , children : a , title : n , subTitle : r , actions : s , extras : i , zIndex : o , ... l } ) => R ( Da , { ... l , prefixCls : "ff-drawer" , className : O ( "ff-popup" , e ) , maskMotion : { motionAppear : ! 0 , motionName : "mask-motion" } , motion : ( d ) => ( { motionAppear : ! 0 , motionName : ` panel-motion- ${ d } ` } ) , children : [ R ( "div" , { className : "ff-popup-header" , children : [ u ( "button" , { "aria-label" : "Close" , className : "ff-popup-close" , onClick : l . onClose , children : u ( bt , { type : "close" } ) } ) , n , r ] } ) , u ( "div" , { className : "ff-popup-body" , children : a } ) , R ( "div" , { className : "ff-popup-footer" , children : [ i , s ] } ) ] } ) , Fn = ( { className : e , $close : t , $event : a , children : n , title : r , subTitle : s , actions : i , extras : o , zIndex : l , placement : d , ... c } ) => {
const m = ( a == null ? void 0 : a . pageX ) === void 0 ? { animation : null , maskAnimation : null , mousePosition : { x : null , y : null } } : { animation : "zoom" , maskAnimation : "fade" , mousePosition : { x : a == null ? void 0 : a . pageX , y : a == null ? void 0 : a . pageY } } ;
return u ( Ba , { ... c , ... m , prefixCls : "ff-modal" , modalRender : ( ) => R ( "div" , { className : O ( "ff-modal-content ff-popup" , e ) , children : [ R ( "div" , { className : "ff-popup-header" , children : [ u ( "button" , { "aria-label" : "Close" , className : "ff-popup-close" , onClick : c . onClose , children : u ( bt , { type : "close" } ) } ) , r , s ] } ) , u ( "div" , { className : "ff-popup-body" , children : n } ) , R ( "div" , { className : "ff-popup-footer" , children : [ o , i ] } ) ] } ) } ) ;
2024-12-02 16:59:57 +08:00
} , ga = ( { placement : e , $close : t , $event : a , children : n , title : r , ... s } ) => {
2024-12-11 16:27:12 +08:00
const [ i , o ] = N ( { } ) , [ l , d ] = N ( ! 0 ) , c = le ( ( y , b ) => o ( ( w ) => ( { ... w , [ y ] : b } ) ) , [ ] ) , m = le ( ( y ) => o ( ( b ) => ( { ... b , [ y ] : void 0 } ) ) , [ ] ) ;
let h = { ... s , className : i . rootClassName , title : i . title || r && C . createElement ( "div" , { className : O ( "ff-popup-title" ) } , r ) , subTitle : i [ "sub-title" ] , actions : i . actions , extras : i . extras , children : n , $close : t , $event : a , onClose : ( ) => d ( ! 1 ) } ;
2024-12-03 10:15:14 +08:00
const f = ( ) => {
2024-12-02 16:59:57 +08:00
t ( ! 1 ) ;
} ;
2024-12-11 16:27:12 +08:00
return u ( We . Provider , { value : { ele : i , mount : c , unmount : m } , children : e && e !== "center" ? u ( Rn , { ... h , placement : e , open : l , afterOpenChange : ( y ) => ! y && f ( ) } ) : u ( Fn , { ... h , visible : l , afterClose : f } ) } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-04 11:05:27 +08:00
ga . propTypes = { placement : A . oneOf ( [ "center" , "left" , "top" , "right" , "bottom" ] ) } ;
2024-12-11 16:27:12 +08:00
const H = ( ) => {
2024-12-02 16:59:57 +08:00
const [ e , t ] = Wa ( { maxCount : 6 , motion : { motionName : "ff-notification-fade" , motionAppear : ! 0 , motionEnter : ! 0 , motionLeave : ! 0 , onLeaveStart : ( s ) => {
const { offsetHeight : i } = s ;
return { height : i } ;
} , onLeaveActive : ( ) => ( { height : 0 , opacity : 0 , margin : 0 } ) } , prefixCls : "ff-notification" } ) , [ , a ] = C . useReducer ( ( s ) => s + 1 , 0 ) ;
2024-12-11 16:27:12 +08:00
E ( ( ) => {
H . $onClick = n , H . $queue . forEach ( ( [ s , i , o ] , l , d ) => {
r ( [ i , o ] , ... s ) , delete d [ l ] ;
2024-12-02 16:59:57 +08:00
} ) ;
} , [ ] ) ;
2024-12-11 16:27:12 +08:00
const n = ( s , i = { } , o = { } ) => new Promise ( ( l , d ) => r ( [ l , d ] , s , i , o ) ) , r = ( [ s , i ] , o , l = { } , d = { } ) => {
const c = H . $index ++ , m = ( h ) => ( ( f , y ) => ( H . $popups . delete ( f ) , a ( ) , y == null ? void 0 : y ( ) ) ) ( c , ( ) => s ( h ) ) ;
if ( o === Gt ) return e . open ( { ... d , key : c , content : C . createElement ( o , { ... l , $close : ( ) => e . close ( c ) } ) } ) ;
H . $popups . set ( c , C . createElement ( ga , { zIndex : c , maskClosable : ! 1 , $event : l == null ? void 0 : l . $event , ... d , key : c , $close : m } , C . isValidElement ( o ) ? C . cloneElement ( o , { ... l , $close : m } ) : o != null && o . name || Lt . isForwardRef ( o ) || ( o == null ? void 0 : o . $$typeof ) === Lt . ForwardRef ? C . createElement ( o , { ... l , $close : m } ) : o ) ) , a ( ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
return R ( C . Fragment , { children : [ Array . from ( H . $popups ) . map ( ( [ s , i ] ) => i ) , t ] } ) ;
2024-12-02 16:59:57 +08:00
} ;
2024-12-11 16:27:12 +08:00
H . $popups = /* @__PURE__ */ new Map ( ) , H . $index = 0 , H . $queue = [ ] , H . $onClick = ( ... e ) => new Promise ( ( t , a ) => {
H . $queue . push ( [ e , t , a ] ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
const qt = ( e , t , a = { } ) => H . $onClick ( e , t , a ) , it = ( e , { showProgress : t , duration : a , ... n } = { duration : 1.5 } ) => H . $onClick ( Gt , { content : e , ... n } , { showProgress : t , duration : a } ) , K = { modal : qt , confirm : ( e , t = { } ) => H . $onClick ( qa , { content : e , ... t } , { placement : "center" } ) , form : ( e , t = { } , a = { } ) => qt ( Tn , { formProps : a , fields : e } , { placement : "center" , ... t } ) . then ( ( n ) => {
2024-12-02 16:59:57 +08:00
if ( n === ! 1 ) throw ! 1 ;
return n ;
2024-12-06 13:12:05 +08:00
} ) , notification : it , success : ( e , t = { duration : 1.5 } ) => it ( e , { ... t , className : "ff-notification-success" , icon : "check" } ) , error : ( e , t = { duration : 1.5 } ) => it ( e , { ... t , className : "ff-notification-error" , icon : "close" } ) } ;
2024-12-11 16:27:12 +08:00
Re . configure ( { showSpinner : ! 1 } ) , Fe . interceptors . request . use ( ( e ) => {
2024-12-02 16:59:57 +08:00
e . headers . Platform = "web" , e . headers . SaaS = window . localStorage . getItem ( "SaaS" ) ;
2024-12-11 16:27:12 +08:00
const t = window . localStorage . getItem ( _e ) ;
2024-12-02 16:59:57 +08:00
return e . headers . Authorization = t ? ` Bearer ${ t } ` : void 0 , Re . inc ( ) , e ;
2024-12-11 16:27:12 +08:00
} , ( e ) => ( Re . done ( ) , Promise . reject ( { code : - 1 , msg : e } ) ) ) , Fe . interceptors . response . use ( ( { data : e , headers : t } ) => ( Re . done ( ) , { ... e , res : t == null ? void 0 : t . res } ) , function ( e ) {
2024-12-02 16:59:57 +08:00
return Re . done ( ) , Promise . reject ( e . message ) ;
2024-12-11 16:27:12 +08:00
} ) , window . addEventListener ( "unhandledrejection" , ct . onUnhandledRejection ) , ct . onMsg = ( e , t ) => K [ [ 0 , 1 ] . includes ( e ) ? "success" : "error" ] ( t ) . then ( ( ) => e === 20300 && oe . redirect ( Oe . get ( "Common.WEBSITE_LOGIN_PAGE" ) ) ) ;
2024-12-02 16:59:57 +08:00
const wt = { appUrl : "" , init : ( e , t , a ) => {
2024-12-11 16:27:12 +08:00
wt . appUrl = a , Fe . defaults . baseURL = a , Fe . defaults . timeout = 15e3 , Object . assign ( wt , new ct ( e , t , Fe ) ) ;
} } , T = wt ;
class Nt extends Error {
2024-12-02 16:59:57 +08:00
constructor ( t , a ) {
2024-12-11 16:27:12 +08:00
super ( a ) , Error . captureStackTrace && Error . captureStackTrace ( this , Nt ) , ! a instanceof Le && ( this . name = ` ${ t } Error Runtime ` ) ;
2024-12-02 16:59:57 +08:00
}
}
2024-12-11 16:27:12 +08:00
class Le extends Error {
2024-12-02 16:59:57 +08:00
constructor ( t , ... a ) {
2024-12-11 16:27:12 +08:00
super ( ... a ) , Error . captureStackTrace && Error . captureStackTrace ( this , Le ) , this . name = ` ${ t } Not Found ` ;
2024-12-02 16:59:57 +08:00
}
}
2024-12-11 16:27:12 +08:00
const ot = "mine" , _e = "token" ;
2024-12-02 16:59:57 +08:00
var ye , Ee ;
2024-12-11 16:27:12 +08:00
const ne = class ne {
2024-12-02 16:59:57 +08:00
constructor ( ) {
2024-12-11 16:27:12 +08:00
$ ( this , Ee , /* @__PURE__ */ new Map ( ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "setVendor" , ( t , a ) => g ( this , Ee ) . set ( t , new Kt ( a , async ( n , r ) => {
2024-12-02 16:59:57 +08:00
var i , o ;
if ( ! ( n != null && n . default ) ) throw "@pkg not found" ;
let s = ( ) => r ;
switch ( "function" ) {
case typeof ( s = ( i = n . default ) == null ? void 0 : i [ ` ./ ${ r } /index.jsx ` ] ) :
case typeof ( s = ( o = n . default ) == null ? void 0 : o [ ` ./ ${ r } /index.js ` ] ) :
return s ( ) ;
}
2024-12-11 16:27:12 +08:00
throw new Le ( r ) ;
2024-12-02 16:59:57 +08:00
} ) ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getWidgetComponent" , async ( t ) => {
2024-12-02 16:59:57 +08:00
if ( ! t ) throw "getWidgetComponent widget is required" ;
if ( t != null && t . startsWith ( "blob:" ) || t != null && t . startsWith ( "http:" ) || t != null && t . startsWith ( "https:" ) ) return await import ( t ) ;
const [ , a ] = t == null ? void 0 : t . split ( "@pkg/" ) ;
2024-12-11 16:27:12 +08:00
if ( ! a ) throw new Le ( t ) ;
2024-12-02 16:59:57 +08:00
try {
2024-12-11 16:27:12 +08:00
return g ( this , Ee ) . has ( "pkg" ) ? await g ( this , Ee ) . get ( "pkg" ) . get ( a ) : await import ( ` ${ T . appUrl } /api/pkg-import/web?name= ${ t } ` ) ;
2024-12-02 16:59:57 +08:00
} catch ( n ) {
2024-12-11 16:27:12 +08:00
throw new Nt ( t , n ) ;
2024-12-02 16:59:57 +08:00
}
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "getRoutes" , ( ) => T . get ( "/api/my-router" ) . then ( ( t ) => [ ... t , { uuid : "data-list-setting" , isLayout : ! 0 , uri : "/data-list-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/DataListSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "grid-layout-setting" , isLayout : ! 0 , uri : "/grid-layout-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/GridLayoutSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "grid-layout-form-setting" , isLayout : ! 0 , uri : "/grid-layout-form-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/GridLayoutFormSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "resource-api-setting" , isLayout : ! 0 , uri : "/resource-api-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/ResourceApiSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "charts-setting" , isLayout : ! 0 , uri : "/resource-api-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/ChartsSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "fsm-setting" , isLayout : ! 0 , uri : "/fsm-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/FsmSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "component-setting" , isLayout : ! 0 , uri : "/component-setting/:category/:categoryUuid" , type : "fsdpf-component" , component : "@pkg/ff-design/components/ComponentSetting" , extra : { layout : "@pkg/ff-design/frameworks/DesignTheme" } } , { uuid : "login" , uri : "/login" , name : "登录" , type : "fsdpf-component" , isLogin : ! 1 , component : "@pkg/ff/components/Login" } , { uuid : "not-found" , uri : "*" , name : "Not Found" , type : "fsdpf-component" , isLogin : ! 1 , component : "@pkg/ff/components/NotFound" } ] . map ( ( { uuid : a , ... n } ) => [ a , { uuid : a , ... n } ] ) ) . then ( ( t ) => new Map ( t ) ) ) ;
k ( this , "getMenus" , ( ) => T . get ( "/api/my-menu" ) ) ;
k ( this , "getConfigure" , ( ) => T . get ( "api/init-configure" ) ) ;
k ( this , "getWidgetOperationAuth" , ( ) => T . get ( "/api/init-widget-operation-auth" ) . then ( ( t ) => t . reduce ( ( a , { uuid : n , auth : r } ) => [ ... a , [ n , r ] ] , [ ] ) ) ) ;
k ( this , "getPhoneNumber" , ( t ) => T . get ( ` /api/user-wx-phone-number/ ${ t } ` ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getUserToken" , ( ) => {
2024-12-11 16:27:12 +08:00
const t = window . localStorage . getItem ( _e ) ;
2024-12-02 16:59:57 +08:00
if ( ! t ) return "" ;
const a = t . split ( "." ) ;
if ( ! Array . isArray ( a ) || a . length !== 3 ) throw "登录令牌无效!" ;
const { iat : n } = JSON . parse ( window . atob ( a [ 1 ] ) ) ;
if ( Math . floor ( ( /* @__PURE__ */ new Date ( ) ) . getTime ( ) / 1e3 ) - n > 2592e3 ) throw "登录令牌已过期, 请重新登录!" ;
return t ;
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "checkUserToken" , ( ) => {
2024-12-02 16:59:57 +08:00
try {
return ! ! this . getUserToken ( ) ;
} catch {
return ! 1 ;
}
} ) ;
2024-12-04 11:05:27 +08:00
k ( this , "getUserInfo" , ( t = ! 0 ) => {
2024-12-02 16:59:57 +08:00
var a ;
try {
const n = this . getUserToken ( ) ;
if ( ! n ) return Promise . resolve ( null ) ;
2024-12-11 16:27:12 +08:00
const { iat : r } = JSON . parse ( window . atob ( ( a = n == null ? void 0 : n . split ( "." ) ) == null ? void 0 : a [ 1 ] ) ) , { iat : s , ... i } = T . decode ( window . localStorage . getItem ( ot ) || "" , { } ) ;
return s === r ? Promise . resolve ( i ) : T . get ( "/api/mine-info" ) . then ( ( { User : o = null } ) => ( window . localStorage . setItem ( ot , T . encode ( { ... o , iat : r } ) ) , o ) ) ;
2024-12-02 16:59:57 +08:00
} catch ( n ) {
console . error ( n ) , t && Popup . error ( "请登录" ) . then ( logout ) ;
}
return Promise . resolve ( null ) ;
} ) ;
2024-12-11 16:27:12 +08:00
k ( this , "login" , ( t , a , n = { } ) => T . post ( "/api/user-token" , { username : t , passwd : Ua . hash ( a ) , platform : "web" , ... n } ) . then ( ( { token : r } ) => ( window . localStorage . setItem ( _e , r ) , r ) ) ) ;
2024-12-04 11:05:27 +08:00
k ( this , "logout" , ( ) => {
2024-12-11 16:27:12 +08:00
window . localStorage . removeItem ( ot ) , window . localStorage . removeItem ( _e ) ;
2024-12-02 16:59:57 +08:00
} ) ;
2024-12-11 16:27:12 +08:00
if ( g ( ne , ye ) ) return g ( ne , ye ) ;
2024-12-02 16:59:57 +08:00
}
} ;
2024-12-11 16:27:12 +08:00
ye = new WeakMap ( ) , Ee = new WeakMap ( ) , $ ( ne , ye , null ) , k ( ne , "getInstance" , ( ) => ( g ( ne , ye ) || B ( ne , ye , new ne ( ) ) , g ( ne , ye ) ) ) ;
let Ct = ne ;
const X = Ct . getInstance ( ) , On = C . createContext ( { user : { } , initUser : ( ) => {
} , initUserComplete : ! 1 } ) , Ln = C . createContext ( { set : ( ) => {
2024-12-02 16:59:57 +08:00
} , get : ( ) => {
} , assign : ( ) => {
} , currentRoute : ( ) => {
2024-12-11 16:27:12 +08:00
} } ) , $t = ( e ) => ! ! ( e != null && e . name ) && ( e . prototype instanceof C . Component || /^[A-Z]/ . test ( e . name ) ) , Vn = ( e , t ) => {
2024-12-02 16:59:57 +08:00
if ( ! e || typeof window > "u" ) return ;
let a = document . querySelector ( ` style[ff-style-token=" ${ t } "] ` ) ;
return a ? ( a . innerHTML = e , e ) : ( a = document . createElement ( "style" ) , a . setAttribute ( "ff-style-token" , t ) , a . setAttribute ( "type" , "text/css" ) , a . innerHTML = e , document . head . appendChild ( a ) , e ) ;
2024-12-11 16:27:12 +08:00
} , An = Object . freeze ( Object . defineProperty ( { _ _proto _ _ : null , AppContext : On , AppGlobalParamsContext : Ln , cache : Kt , configure : Oe , default : X , func : Ce , http : T , insertStyle : Vn , isReactComponent : $t , route : oe } , Symbol . toStringTag , { value : "Module" } ) ) , jn = ( e , t , a = "children" ) => {
2024-12-02 16:59:57 +08:00
if ( p . isEmpty ( e ) ) return { } ;
const n = p . find ( e , [ "value" , t ] ) ;
if ( ! p . isEmpty ( n ) ) return n ;
const r = e . length ;
for ( let s = 0 ; s < r ; s ++ ) {
2024-12-11 16:27:12 +08:00
const { [ a ] : i } = e [ s ] , o = jn ( i , t , a ) ;
2024-12-02 16:59:57 +08:00
if ( ! p . isEmpty ( o ) ) return o ;
}
return { } ;
} ;
export {
2024-12-10 14:48:09 +08:00
_t as $ ,
_a as A ,
St as B ,
2024-12-11 16:27:12 +08:00
or as C ,
Ye as D ,
lr as E ,
Ue as F ,
sr as G ,
2024-12-02 16:59:57 +08:00
an as H ,
2024-12-10 14:48:09 +08:00
xt as I ,
2024-12-11 16:27:12 +08:00
cr as J ,
dr as K ,
2024-12-10 14:48:09 +08:00
wn as L ,
2024-12-11 16:27:12 +08:00
Pt as M ,
2024-12-10 14:48:09 +08:00
yn as N ,
ua as O ,
gn as P ,
pn as Q ,
2024-12-02 16:59:57 +08:00
ea as R ,
2024-12-10 14:48:09 +08:00
mn as S ,
hn as T ,
2024-12-11 16:27:12 +08:00
ur as U ,
2024-12-10 14:48:09 +08:00
yt as V ,
2024-12-11 16:27:12 +08:00
P as W ,
2024-12-10 14:48:09 +08:00
Ha as X ,
2024-12-11 16:27:12 +08:00
Sn as Y ,
J as Z ,
We as _ ,
2024-12-02 16:59:57 +08:00
ta as a ,
2024-12-11 16:27:12 +08:00
H as a0 ,
K as a1 ,
Zn as a2 ,
er as a3 ,
tr as a4 ,
X as a5 ,
2024-12-10 14:48:09 +08:00
$t as a6 ,
2024-12-11 16:27:12 +08:00
Vn as a7 ,
T as a8 ,
2024-12-10 14:48:09 +08:00
Kt as a9 ,
2024-12-11 16:27:12 +08:00
Oe as aa ,
Ce as ab ,
oe as ac ,
On as ad ,
Ln as ae ,
jn as af ,
2024-12-02 16:59:57 +08:00
sa as b ,
la as c ,
2024-12-11 16:27:12 +08:00
ir as d ,
2024-12-10 14:48:09 +08:00
ia as e ,
oa as f ,
2024-12-02 16:59:57 +08:00
Yt as g ,
2024-12-10 14:48:09 +08:00
Qa as h ,
vt as i ,
aa as j ,
na as k ,
ra as l ,
kt as m ,
2024-12-11 16:27:12 +08:00
we as n ,
2024-12-10 14:48:09 +08:00
tn as o ,
on as p ,
Ga as q ,
2024-12-06 13:12:05 +08:00
st as r ,
2024-12-10 14:48:09 +08:00
Xa as s ,
2024-12-11 16:27:12 +08:00
G as t ,
ar as u ,
2024-12-10 14:48:09 +08:00
Ja as v ,
2024-12-11 16:27:12 +08:00
nr as w ,
rr as x ,
2024-12-10 14:48:09 +08:00
gt as y ,
Ka as z
2024-12-02 16:59:57 +08:00
} ;