# @brftech/filex-react 中文文档

规范地址：https://npmcn.com/package/%40brftech/filex-react/

版本：0\.59\.0
npm 元数据更新时间：2026-11-06T22:09:45.663Z
中文译文更新时间：2026-11-08T14:57:30.478Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40brftech/filex-react
原文对照：https://npmcn.com/package/%40brftech/filex-react/?lang=original
项目主页：https://github.com/BRF-Tech/filex#readme
源码仓库：https://github.com/BRF-Tech/filex

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：28.1 kB，8 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：3 个
- peer 依赖：react ^18\.0\.0 \|\| ^19\.0\.0，react-dom ^18\.0\.0 \|\| ^19\.0\.0
- 首次发布：2026-07-04T17:12:54.932Z
- 最新版本发布：2026-11-06T22:09:45.329Z
- 近 30 天下载量：2838（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：149（近 12 个月 149 个）

## 中文简介

filex React 适配器 - React idom (道具 +骆驼)的外包装 案件处理员)

## 安装

```sh
npm install @brftech/filex-react
```

也可以使用：`pnpm add @brftech/filex-react`、`yarn add @brftech/filex-react`、`bun add @brftech/filex-react`

## README

![filex logo](https://raw.githubusercontent.com/BRF-Tech/filex/main/docs/logo.png)

# @ brftech/ filex 反应

反应适配器 [文件x](https://github.com/BRF-Tech/filex) 文件管理器。 细细的包裹 `<filex-explorer>` (单位:千美元) `@brftech/filex` Web 组件) - 给您适当的反应道具和 骆驼活动处理器通过 `@lit/react`是因为 `createComponent`。 。 。 .

> ⚠ 此包包包 **探索者** 只有这个 filex 的另一个表面 - 即 连接面板, 添加存储和访问权限 s3/SFTP/FTPS/NFS/WebDAV上方的服务器为: `<filex-connections>` 内 [`@brftech/filex`](https://www.npmjs.com/package/@brftech/filex) 并是一个简单的定制要素:直接在JSX中并设置 `config` 打开 和任何非反应元素一样.

## 安装

```bash
npm i @brftech/filex-react react react-dom
```

> ⚠ **`@brftech/filex-react` 0.55需要一个文件x 0.55服务器.** 打开哪些文件进行编辑 (单位:千美元)`edit_kinds`),输入限制(`limits`)和版本行 (单位:千美元)`release`, (中文(简体) ), `commit`, (中文(简体) ), `built`)来自服务器的 `/api/files/capabilities`; 软件包没有它自己的列表要倒下 回来,所以反对一个旧的服务器 没有提供编辑和什么都没有 作为办公文档打开。 用软件包更新服务器 (单位:千美元)[API.md (英语)](https://github.com/BRF-Tech/filex/blob/main/docs/API.md)) (中文(简体) ).

> ⚠ **打印的应用程序** (单位:千美元)`ui.print`, filex 0.55 从 filex 自己的指纹 打印页面,该页面为您页面中的探索者框架。 只有文件x, 其桌面 应用程序和服务器 `FILEX_FRAME_ANCESTORS` 可能设置该页面,例如 其它网站列出您的页面来源, 否则该应用程序会被告知 打印为 `unavailable` (单位:千美元)[安全头和框架](https://github.com/BRF-Tech/filex/blob/main/docs/CONFIGURATION.md#security-headers-and-framing)) (中文(简体) ).

## 使用

```jsx
import { FileManager } from '@brftech/filex-react';

export function App() {
  return (
    <FileManager
      config={{
        apiBase: 'https://files.example.com',
        auth: { kind: 'bearer', token: '<jwt>' },
        locale: 'tr',
        theme: 'auto',
        // The navigation panel (the "+ New" menu · Home / Shared with me /
        // My shares / Recent / Starred / Trash · your tags, personal and team ·
        // an Apps section · storages) and how much of the
        // explorer to draw. Both are ordinary config keys - there is no
        // React-specific switch for either.
        sideNav: true,
        connections: true,
        // How much of the explorer to put on screen - a reduction, and only
        // that. Two values: 'standard' (default) and 'simple' (one pane,
        // list/grid only, no tab strip, no split pane). Anything else resolves
        // to 'standard' with one console line naming it - the 'drive' profile
        // was removed after v0.40.0; pass 'simple' instead. It does NOT decide
        // the look: the "+ New" menu, the header search field with its ⌘K hint,
        // the filter row, the Folders/Files sections and Details/Activity are
        // what every embed draws now, with no string passed.
        uiProfile: 'simple',
      }}
      onError={(e) => console.error(e.detail[0].message)}
      onShareCreated={(e) => navigator.clipboard.writeText(e.detail[0].url)}
      onFileOpened={(e) => console.log('opened', e.detail[0].basename)}
      onUploadProgress={(e) => console.log(e.detail[0].percent + '%')}
      onSelectionChange={(e) => console.log(e.detail[0].length, 'selected')}
    />
  );
}
```

这个 `config` 道具接受完整 `ExplorerConfig` (从 `@brftech/filex-core` 为方便起见。 事件处理员接收本地 `CustomEvent`s,和 ⚠ **有效载荷是 `event.detail[0]`**: 基本习惯 元素发送 `detail` 设置到弹出参数列表中,故 `event.detail.url` 实值 `undefined`。导出 `Filex*Detail` 类型描述 这第一个元素.

## 样式

**没有 CSS 导入 .** 上面的片段是整个: 这个包 没有自己的样式表,你不需要其他地方的样式表.

`@brftech/filex-react` 覆盖 `<filex-explorer>` 来自 [`@brftech/filex`](https://www.npmjs.com/package/@brftech/filex),其捆绑 带入探索者的样式表 _在 Java 脚本内_ 并附加到 `<head>` 一次,第一次一个元素上架。 床单是 `@brftech/filex-core`'s, 字节的字节, 所以一个反应页面和一个 Vue 页面渲染 同一个探险家 - Vue 包装器是唯一导入一个 `style.css`,因为安装一个 SFC 没有进行可以 注射出来.

外观是 `--fe-*` 自定义属性。 设置在任何范围上方 组件 - `:root`,一个包装 `div` - 探索者如下:

```css
:root {
  --fe-primary: #2b7a41;
  --fe-radius: 10px;
}
```

轻/暗 `config.theme` (单位:千美元)`'light'` 编号 : `'dark'` 编号 : `'auto'`,以及 `auto` 读取主机 `prefers-color-scheme`) (中文(简体) ). 运出调色板在 [`docs/INTEGRATION.md`](https://github.com/BRF-Tech/filex/blob/main/docs/INTEGRATION.md#themes) - 说吧 和操作员自己的主题,由管理员组成 **外观** 屏幕, 同一条路 `--fe-*` 标志,所以一个嵌入 穿例 颜色没有被告知.

> \* 上行产品标记来自 `config.brand` (单位:千美元)`{ name, markUrl }`而不是从一个槽。 挂载自定义元素的主机 无法填补其中的空格 - 这是一个 Vue 自定义元素限制, 而不是 监督 - 所以,配置入口是门.

## 纸条

富人取景(摩纳哥,美人鱼,Epub,xlsx,CodeMirror, **选项** 并且通过动态的进口到达 被抓住,所以没有它们,建设 仅显示普通观众。 但是,一个捆绑商拒绝解决 导入无法找到, 因此 `vite build` 停止为 `Rollup failed to resolve import "monaco-editor"` 除非你要么安装 想要的或者说是外部的

```js
// vite.config.js
export default {
  build: {
    rollupOptions: {
      external: [
        'monaco-editor', 'jszip', 'mermaid', 'epubjs', 'xlsx',
        '@google/model-viewer', 'codemirror', /^@codemirror\//,
      ],
    },
  },
};
```

## 构建

```bash
pnpm build      # tsc check + vite lib build → dist/filex-react.{js,cjs}
```

## 许可证

麻省理工学院

## 常见问题

### @brftech/filex-react 是什么？

filex React 适配器 - React idom \(道具 \+骆驼\)的外包装 案件处理员\)

### 如何安装 @brftech/filex-react？

在项目目录运行 npm install @brftech/filex-react，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react（^18\.0\.0 \|\| ^19\.0\.0）、react-dom（^18\.0\.0 \|\| ^19\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @brftech/filex-react 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @brftech/filex-react 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @brftech/filex-react 可以商用吗？

@brftech/filex-react 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @brftech/filex-react 的下载量有多少？

根据 npm 官方下载统计，@brftech/filex-react 在 2026/10/09 – 2026/11/07 这 30 天内被下载 2,838 次，日均约 95 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @brftech/filex-react 还在维护吗？

最新版本 0\.59\.0 发布于 2026/11/07（1 天前）；至今共发布 149 个版本，其中过去 12 个月发布了 149 个；首次发布于 2026/07/05。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

