npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gzbapp/jm-rc-components

v1.1.1

Published

mygzb.com React Components

Readme

@gzbapp/jm-rc-components

工作宝中后台 React 组件库,封装 antd 之上的高频业务场景,减少重复代码、统一交互规范。

  • 包名: @gzbapp/jm-rc-components
  • 当前版本: 1.1.1
  • 构建产物: es/(ES Module + TypeScript 声明)
  • 发布者: y-ding

安装

yarn add @gzbapp/jm-rc-components

# peerDependencies
yarn add react react-dom antd lodash tslib react-router react-router-dom

版本要求

| 依赖 | 版本 | | --- | --- | | react / react-dom | >= 18.3.1 | | antd | ^5.0.0 | | react-router / react-router-dom | >= 6.28.0 | | lodash | >= 4.17.10 | | tslib | >= 1.14.1 |


快速开始

所有组件从 es 目录按需导出,每个模块均附带 .d.ts 类型声明。

import React from 'react'
import { Login, Title } from '@gzbapp/jm-rc-components'
import { message } from 'antd'

export default function LoginPage() {
  return (
    <>
      <Title>登录</Title>
      <Login
        title="登录页面"
        onSubmit={async () => {
          await new Promise((r) => setTimeout(r, 2000))
        }}
        onSuccess={() => message.success('登录成功')}
      />
    </>
  )
}

按需加载

与 antd 类似,可配合 babel-plugin-import 或 ts-import-plugin 按需引入样式:

// webpack.config.js(ts-import-plugin 示例)
{
  libraryName: '@gzbapp/jm-rc-components',
  libraryDirectory: 'es',
  style: 'css',
}

路由与 Form 统一出口

根入口同时 re-export 了 react-router-dom 路由 API 以及 antd 的 RcConfigProvider、RcForm,业务层应优先从此处导入,避免多实例问题。

import { BrowserRouter, Routes, Route, RcForm, RcConfigProvider } from '@gzbapp/jm-rc-components'

定位

本库是 基于 antd 5 的高层业务组件库,抽象后台应用的重复场景。已耦合且团队内稳定的技术栈:

  • antd 5
  • React 18
  • react-router v6
  • lodash

刻意 不耦合 的部分:

  • 状态管理(mobx / redux 等)
  • Ajax 请求库
  • 具体后端 API 实现(通过 adaptor 注入)

组件目录

布局 / 框架

| 组件 | 说明 | | --- | --- | | AdminLayout | 后台整体布局(侧边菜单、顶栏、内容区) | | LoginLayout | 登录页视觉容器 | | JmSideLayout | 左右分栏布局(树 + 详情) | | Split | 可拖拽分割面板(react-split-pane) | | Title | 页面标题与面包屑 | | BackBar | 带路由的返回栏 | | ActionBar | 表单页底部操作栏 | | FormTitle | 表单区块标题 |

表格 / 数据

| 组件 | 说明 | | --- | --- | | FatTable | 后台表格套件(搜索、分页、选择、拖拽排序、列筛选) | | FatExport | 数据导出弹窗(含进度轮询) | | FatImport | 数据导入弹窗(含上传与进度) |

表单 / 输入

| 组件 | 说明 | | --- | --- | | JmInput | JM 规范 Input / InputNumber | | JmSelect | JM 规范下拉选择 | | JmTreeSelect | JM 规范树形选择 | | JmRadio | 单选按钮组 | | JmUpload | 文件上传 | | JmButton | JM 规范按钮(类型、尺寸、节流) | | JmDropdown | 操作型 / 选择型下拉 | | SearchButton | 搜索专用按钮 |

组织 / 权限

| 组件 | 说明 | | --- | --- | | Acl | 访问控制(Provider / Allows / Choose / Switch) | | JmOrgSelector | 组织架构选人弹窗 | | JmOrgCommon | 选人 Form 封装(触发按钮 + Tag + 弹窗) | | JmOrgSearcher | 组织远程搜索选择器 |

反馈 / 展示

| 组件 | 说明 | | --- | --- | | Empty | 空状态占位 | | ErrorPage | HTTP 异常页(401/403/404/500) | | FatDrawer | 带表单提交的抽屉 | | FatModal | 带表单提交的模态框 | | FatTipModal | 图标提示确认框 | | JmAvatar | 用户头像 | | JmTag | 可编辑 / 可删除标签 | | JmTab | 受控 Tab | | JmPopConfirm | 气泡确认 | | AutoIcon | 字符 icon 套壳 | | Time | 时间戳格式化 | | TagContainer | 标签容器 |

工具 / HOC

| 组件 | 说明 | | --- | --- | | lazy | 异步组件加载 | | Query | URL 查询参数状态管理 | | Login | 完整登录页(账密、滑块、二维码/邮箱验证) |


常用示例

AdminLayout

import { AdminLayout, Title } from '@gzbapp/jm-rc-components'
import { Dropdown, Menu } from 'antd'

<AdminLayout
  siteName="后台管理系统"
  title={<Title.Display breadcrumb inline />}
  menus={menus}
  path={location.pathname}
  after={
    <Dropdown menu={{ items: menuItems }}>
      <AdminLayout.Action>用户名</AdminLayout.Action>
    </Dropdown>
  }
>
  <AdminLayout.View>
    {children}
    <AdminLayout.Footer>Version 1.0.0</AdminLayout.Footer>
  </AdminLayout.View>
</AdminLayout>

子组件: HeaderBar · View · Body · BodyHeaderBar · StandardBody · Action · Footer · Avatar

FatTable

import { FatTable } from '@gzbapp/jm-rc-components'

<FatTable
  enableSelect
  columns={columns}
  header={renderHeader}
  headerExtra={renderHeaderExtra}
  onFetch={handleFetch}
  onRemove={handleRemove}
  onAction={handleAction}
/>
  • header 必须是渲染函数(HeaderRenderer),不能传静态 JSX
  • onFetch 需返回 { list, total }
  • 行内操作用 FatTable.Actions / FatTable.Action,通过 t.triggerAction() / t.remove() 触发回调

JmOrgSelector / JmOrgCommon

选人组件通过 adaptor 对接后端 API,支持单位、部门、用户、设备用户等多种模式组合。

import { JmOrgCommon, OrgModeEnum } from '@gzbapp/jm-rc-components'

<JmOrgCommon
  adaptor={adaptor}
  mode={[OrgModeEnum.DEPARTMENT, OrgModeEnum.USER]}
  value={value}
  onChange={setValue}
  relationConfig={{ /* 各模式初始化配置 */ }}
  permissionConfig={{ roleId, manageCorpIds }}
/>

JmOrgAdaptor 需实现部门树、用户搜索、部门搜索等接口,详见 components/jm-org-selector/example/adaptor.tsx。

Query + FatTable URL 持久化

import { Query, FatTable } from '@gzbapp/jm-rc-components'

<Query.Provider>
  <FatTable namespace="user-list" enablePersist columns={columns} header={renderHeader} onFetch={handleFetch} />
</Query.Provider>

本地开发

# 安装依赖
yarn

# 编译 ES Module 产物到 es/
yarn build

# 启动本地静态服务(含 CORS)
yarn start

# 运行 docz 文档
yarn doc

# 代码格式化
yarn prettier

单个组件示例:

yarn parcel -- ./components/admin-layout/example/index.html

License

MIT


AI 全流程开发规范

组件库协作开发规范见 AGENTS.md 与 docs/README.md,包含 requirements/specs/plans/testing/solutions 的完整流程约定。