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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@foundbyte/screen-template

v1.0.0

Published

![cmd-markdown-logo](/logo.png)

Downloads

2

Readme

FoundByte-BigData-Template

cmd-markdown-logo

快速开发平台

初始化

必须先安装 yarn

npm run init

初始化

npm run start

体验地址

http://bigdata-screen-v3-dev.gogdev.cn/#/

资产库

http://foundbyte-bigdata-docs-dev.gogdev.cn/

更新日志

log.md

目录结构

├── config
│   ├── proxy.js            // 本地代理
│   ├── webpack.common.js   // webpack通用配置
│   ├── webpack.dev.js      // webpack本地运行配置
│   ├── webpack.prod.js     // webpack构建打包配置
│   └── config.ts           // 全局配置
├── mock                    // http 模拟数据
├── public                  // 公共资源
├── dumi                    // dumi文档工程
│   └──  packages            // 组件包
└── src
    ├── assets              // 静态资源
    ├── components          // 公共组件
    ├── configs             // 配置相关
    ├── decorate            // 引入的组件包
    ├── dicts               // 数据字典配置
    ├── layouts             // 布局组件
    ├── models              // dva models
    ├── pages               // 路由页面
    ├── services            // 公共服务
    │   └── project.ts      // 数据处理、事件上下文
    ├── types               // 全局ts声明
    ├── utils               // 工具类
    ├── wrappers            // 路由拦截组件
    ├── app.ts              // 程序入口
    ├── document.ejs        // html 模板
    ├── global.less         // 全局样式
    └── render-router.tsx   // 路由渲染

主题色

./src/theme/index.tsx

默认主题色

const config = {
  default: 'dark' as Theme,
};

组件开发

情参考 bigdata-pkg 内的示例

├── settings-form               // 组件表单配置包示例(如需发布请修改项目名称)
└──  bigdata-pkg                // 组件包示例(如需发布请修改项目名称)
    └── src
          ├── index.ts          // 导出组件包
          └── widgets           // 组件包
              ├── index.ts      // 导出组件分类
              └── Echars        // 组件分类(如:常用工具、可视化组件)
                    ├── index.ts// 注册组件及分组(如:布局工具、文字)
                    ├── Bar     // 组件
                    └── ...     // 组件

组件通常包含以下内容

├── Bar
      ├── config.tsx            // 组件的默认配置
      ├── editor.tsx            // 组件的编辑器(推荐使用formilyjs编写)
      ├── schema.ts             // formilyjs 的配置
      ├── type.ts               // 一些内部ts类型
      ├── index.tsx             // 组件源码
      └── style                 // 组件样式

构建和发布

请修改 ./bigdata-pkg/package.json 中的包名

"name": "your widgets package name",

构建命令

cd ./bigdata-pkg

npm run build

发布请联系管理员

[email protected]

在项目中引用

├── src
      └── decorate
            └── widgets // 引入的组件包和配置
import { Widgets } from '@foundbyte/fast-blend-pkg';
import { ICompPackage } from '@foundbyte/fast-blend/es/types';
// 内部组件
import G2 from './G2';

// 注册组件包
const { Echars, Tool } = Widgets;

/** 左侧工具栏显示的组件 */
const components = {
  // 导入组件
  packages: {
    Tool,
    Echars,
    // G2,
  },
  // 导入配置
  config: [
    Tool.config,
    Echars.config,
    // G2.config
  ] as ICompPackage[],
};

/** 顶部工具栏显示的组件 */
const tool = {
  packages: {
    // Tool,
  },
  config: [
    // { ...(Tool.config as object), ...{ visible: true } }
  ] as ICompPackage[],
};

export { components, tool };

如果向使用路径映射,请修改 ./webpack.config.js 配置

// 如
import { Widgets } from '@foundbyte/fast-blend-pkg';
// 相当于
"@foundbyte/fast-blend-pkg": path.join(__dirname, "./bigdata-pkg/src"),

./webpack.config.js

module.exports = {
  ...
  resolve: {
    ...
    alias: {
      ...config.alias,
      "@foundbyte/fast-blend-pkg": path.join(__dirname, "./bigdata-pkg/src"),
      "@foundbyte/custom-pkg": path.join(__dirname, "./custom-pkg/src"),
      "@foundbyte/settings-form": path.join(__dirname, "./settings-form/src"),
      // 添加你的组件包路径
      ...
      "@": path.join(__dirname, "./src"),
    },
  },
  ...
}

自定义布局工具

接收标准参数参考 IWidgetProps, 其中有几个关键属性

import { IWidgetProps } from '@foundbyte/fast-blend';

const Demo: React.FC<IWidgetProps> = (props) => {
  const {
    id,           // 当前组件唯一id
    refresh,      // 强制刷新
    member = [],  // 内部组件
    packages,     // 当前编辑器使用的组件包配置
    editable,     // 是否是编辑(预览)模式
    activeWidget  // 编辑面板变化
  } = props;

  // 强制刷新(当出现嵌套容器时,为了减少组件刷新频率,可能会通知你进行主动刷新)
  useEffect(() => {
    ...
  }, [refresh]);

  // 监听布局工具内的组件变化(建议不要直接使用,member进行渲染)
  useEffect(() => {
    ...
  }, [member]);

  // 监听编辑面板编辑的变化
  useEffect(() => {
    ...
  }, [activeWidget]);
  return <>...</>
}

使用 WidgetBoard 组件包裹

import { WidgetBoard, IWidgetBoardRef } from '@foundbyte/fast-blend';

const Demo: React.FC<IWidgetProps> = (props) => {
  // IWidgetBoardRef 包含必要的操作内部组件方法
  const boardRef = useRef<IWidgetBoardRef>(null);

  return <WidgetBoard {...props} ref={boardRef}>
    ...
  </WidgetBoard>
}

相关链接

  • gitlab
    http://10.10.11.151:20216/teg/bigdata-center/data-visual/dlv/front-end/bigdata-screen-template

  • 文档工程模版
    http://10.10.11.151:20216/gzecc/common/front_common/pyramid-template/pyramid-kit-v2

  • 原模版工程
    http://10.10.11.151:20216/gzecc/common/front_common/pyramid-template/pyramid-mobile-webpack

  • formilyjs(配置化表单)
    https://formilyjs.org