52 lines
2.2 KiB
JavaScript
52 lines
2.2 KiB
JavaScript
/* ui-plugin-page.js —— 插件整页(v3.25.59)
|
||
*
|
||
* 用户裁定:一级导航主组的「插件」图标进入**整页**,内容与「设置 → 插件管理」一致。
|
||
*
|
||
* 为什么单独成文件而不是塞进 ui-settings-modal.js:
|
||
* 后者已接近「单组件行数棘轮」上限,再放一个页面组件会直接打红。
|
||
* 这里只做「页面壳 + 把插件管理块渲染出来」,数据由宿主经 props 注入。
|
||
*/
|
||
;(function (global) {
|
||
'use strict'
|
||
const React = global.React || {}
|
||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||
|
||
function IWBUIPluginPage (props) {
|
||
const I = props.I
|
||
const [rev, setRev] = React.useState(0)
|
||
const [busy, setBusy] = React.useState('')
|
||
const [msg, setMsg] = React.useState(null)
|
||
const PluginHost = props.PluginHost
|
||
const S = props.Sections || ((typeof window !== 'undefined') ? window.IWBUISettingsSections : null)
|
||
const items = React.useMemo(
|
||
() => ((PluginHost && typeof PluginHost.list === 'function') ? PluginHost.list() : []),
|
||
[rev, PluginHost]
|
||
)
|
||
const body = S ? S.renderPluginsTab({
|
||
PluginHost,
|
||
pluginBusy: busy,
|
||
pluginItems: items,
|
||
setMsg: setMsg,
|
||
setPluginBusy: setBusy,
|
||
setPluginsRev: setRev,
|
||
setTab: function () {},
|
||
wEnsurePluginLoaded: props.wEnsurePluginLoaded,
|
||
wRuntimePlugins: props.wRuntimePlugins || [],
|
||
}) : el('div', { className: 'iwb-hint' }, '插件模块未就绪')
|
||
|
||
return el('div', { className: 'iwb-plugin-page' },
|
||
el('div', { className: 'iwb-plugin-page-head' },
|
||
// v3.25.64:去掉「返回画布」——左侧导航的「列表」就是回画布,重复了
|
||
el('span', { className: 'iwb-plugin-page-title' }, '插件'),
|
||
el('span', { className: 'iwb-plugin-page-sub' }, '管理与市场(与「设置 → 插件管理」同一份数据)'),
|
||
),
|
||
el('div', { className: 'iwb-plugin-page-body' },
|
||
body,
|
||
msg ? el('div', { className: 'iwb-status-' + (msg.type === 'err' ? 'err' : 'ok') }, msg.text) : null,
|
||
),
|
||
)
|
||
}
|
||
|
||
global.IWBUIPluginPage = IWBUIPluginPage
|
||
})(typeof window !== 'undefined' ? window : globalThis)
|