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