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