Code Monkey home page Code Monkey logo

deer-ui's Introduction

@deer-ui

基于 React 的可扩展的 UI 库,快速、简易地开发 web 应用。

Feature

  • 原子构建
  • 基于 Flex 布局
  • 表单控制器(FormController)
    • UI 表现与业务逻辑分离
  • Table
    • 固定表头(Fxied Header)
    • 固定前后列(Fixed Column)
  • 多终端支持
    • Desktop web
    • Mobile web
  • 浏览器支持
    • Chrome
    • IE10+
    • Firfox
    • Safari
  • 服务端渲染(SSR)
    • Gatsby
    • Next
  • typescript 支持

Usage

@deer-ui/core

yarn add @deer-ui/core @mini-code/base-func

@deer-ui/core 扩展 UI 库,可选

yarn add @deer-ui/enhance-ui @deer-ui/core @mini-code/base-func

FormController quick start

import React, { useState } from 'react';
import {
  FormLayout, Button, Radio,
  FormOptions, FormLayoutBtnsConfig
} from '@deer-ui/core';

const FormLayoutDemo = () => {
  const [layout, setLayout] = useState('horizontal');
  const [resDesc, setResDesc] = useState('');

  const submit = (formData, actingRef) => {
    // 模拟获取数据
    setTimeout(() => {
      setResDesc({
        hasErr: false,
        resDesc: '成功'
      });
    }, 800);
  }

  const formBtns: FormLayoutBtnsConfig = [
    {
      action: (formRef, actingRef) => {
        submit(formRef.value, actingRef);
      },
      type: 'submit',
      text: 'Button',
      actingRef: 'forTest'
    },
  ];

  const formOptions: FormOptions = [
    {
      type: 'input',
      ref: 'InputField',
      defaultValue: '123',
    },
    {
      type: 'radio',
      ref: "RadioField",
      values: {
        radioValue1: 'radioText1',
        radioValue2: 'radioText2',
      }
    }
  ];

  return (
    <>
      <Radio
        onChange={nextLayout => setLayout(nextLayout)}
        defaultValue="horizontal"
        values={{
          'horizontal': '水平布局',
          'vertical': '垂直布局',
          'flow': '流布局',
        }} />
      <FormLayout
        layout={layout}
        formBtns={formBtns}
        onChange={(changedValues, ref, currChangeValue) => {

        }}
        formOptions={formOptions}/>
    </>
  );
}
ReactDOM.render(
  <FormLayoutDemo />,
  document.querySelector('#Main')
);

Local dev

git clone https://github.com/minimal-studio/deer-ui
cd deer-ui
yarn; yarn dev:doc

Reference

deer-ui's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deer-ui's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.