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

troyfe-component

v1.0.1

Published

创意组件库

Readme

创意通用组件库 Troyfe-component

Troyfe-component

install


  npm install troyfe-component

Use


  import { Icon, ProcessManage, DynamicForm, BarAndLineChart } from 'troyfe-component'

Example Icon


  <Icon
    type=""
    // type是必填项
    scriptUrl="//at.alicdn.com/t/font_385790_4939zqugz3c.js"
    // url可以是图标库地址。阿里https://www.iconfont.cn/
    extraCommonProps={{ className: 'myIcon' }}
    style={{
      fontSize: '40px'
    }}
  />

Example ProcessManage


  <ProcessManage
    xml=""
    onSave={(xml) => {
      console.log(xml);
    }}
  />

Example DynamicForm

import React, { useRef } from 'react';
import { NewSelectWidget, NewTreeSelectWidget, NewUploadWidget } from '../../components/CustomDynamicFormItem'
// 这些组件是用户自己子定义
  const refs = useRef(null) // 获取动态表单实例

  <DynamicForm
    settings={[
      {
        title: '自定义组件',
        widgets: [
          {
            text: '下拉框',
            name: 'apiSelect',
            schema: {
              title: '下拉框',
              type: 'string',
              widget: 'NewSelectWidget',
            },
            setting: {
              url: { title: 'url', type: 'string' },
              key: { title: '键', type: 'string' },
              valueKey: { title: '值', type: 'string' },
            }
          },
          {
            text: '树形下拉框',
            name: 'apiTreeSelect',
            schema: {
              title: '树形下拉',
              type: 'string',
              widget: 'NewTreeSelectWidget'
            },
            setting: {
              url: { title: 'url', type: 'string' },
              key: { title: '键', type: 'string' },
              label: { title: '名称', type: 'string' },
            }
          },
          {
            text: '上传文件',
            name: 'apiUpload',
            schema: {
              title: '上传文件',
              type: 'array',
              widget: 'NewUploadWidget',
              enum: ['xlsx', 'docx', 'mp4'],
            },
            setting: {
              enum: { enum: [], props: {mode: "tags"}, title: "文件格式", type: "array", widget: "select" },
            }
          }
        ],
      }
    ]}
    ref={refs}
    widgets={{ NewSelectWidget, NewTreeSelectWidget, NewUploadWidget }}
  />

动态表单获取设置表单值


  const schema = JSON.stringify(refs.current.getValue()) // 获取表单值
  refs.current.setValue(JSON.parse(res.data.metaData)) // 设置表单值

props

| 参数 | 说明 | 类型 | 类型 | | ------ | ------ | ------ | ------ | | hideId | 隐藏组件ID | boolean | false | | defaultValue | 默认表单 schema | object | DEFAULT_SCHEMA | | transformer | schema 双向转换 | object | { fromFormRender, toFormRender } | | extraButtons | 操作栏按钮 | array | extraButton[] | | controlButtons | 选中项操作按钮 | array | controlButton[] | | settings | 左右侧栏配置 | array | defaultSettings | | commonSettings | 通用配置 | object | defaultCommonSettings | | globalSettings | 全局配置 | object | defaultGlobalSettings | | widgets | 自定义组件 | object | {} | | mapping | 组件和 schema 的映射规则 | object | {} |

extraButton

| 属性 | 说明 | 类型 | | ------ | ------ | ------ | | text | 按钮文案 | string | | onClick | 按钮点击回调函数 | (event) => void |

controlButton

| 属性 | 说明 | 类型 | | ------ | ------ | ------ | | text | 按钮文案 | string | | onClick | 按钮点击回调函数 | (event, schema) => void |

Methods

| 事件名 | 说明 | 入参 | | ------ | ------ | ------ | | getValue | 获取导出的 schema 值 | - | | setValue | 从外部强制修改 schema | schema | | copyValue | 将现有 schema 拷贝到剪贴板 | - |

Example BarAndLineProps


  <BarAndLineProps
    option={createOption()}
    notMerge={true}
    lazyUpdate={true}
    style={{ width: '100%', height: '100%' }}
  />

参数

  {
    title?: {};
    legend?: {[key: string]: any};
    grid?: {
      top: string | number;
      left: string | number;
      right: string | number;
      bottom: string | number;
      containLabel: boolean;
    },
    xAxisKey: string,
    xAxisOption?: {},
    yAxisKey?: Array<{
      [key: string]: any
    }>
    seriesKey: Array<{
      type: string;
      key: string | string[];
      color: string;
      yIndex?: number;
      noTansfrom?: boolean;
    }>
    data: Array<{}>;
    horizontal?: boolean;
    tooltipFormatter?: (param: {}) => string
  }

运行该项目执行

yarn dev or npm run dev

运行开发模式 在浏览器中打开http://localhost:6006

yarn build or npm run build

运行该命名进行项目的打包

yarn build build-storybook

运行该项目进行文档打包

yarn start or npm start

运行组件库的文档

Note:

部署组件库文档需要上传如下文件: config server storybook-static package.json

并在config中的config.prod.js文件中修改端口