Git Product home page Git Product logo

alibaba / schema-plugin-flow Goto Github PK

View Code? Open in Web Editor NEW
421.0 17.0 51.0 2.9 MB

A highly extensible JavaScript library, abbreviated as Sifo. 一个高扩展性、可二开的插件式前端开发框架

License: MIT License

JavaScript 66.95% TypeScript 21.61% CSS 0.32% HTML 0.26% Vue 6.88% Less 3.74% SCSS 0.25%
extensible schema plugin js-framework sifo extend-plugins react vue schema-plugin-flow form

schema-plugin-flow's Introduction

schema-plugin-flow

English | 简体中文

Introduction

schema-plugin-flow, abbreviated as Sifo ([sɪfɔ]),is a highly extensible JavaScript library. This library allows developers to extend business logic and page layout without touching source code, when the source code is written in Sifo.

  • sifo-model is the core of Sifo, which using JSON (as Schema) to describe page's structures and using plugins as logic controller. There are three kinds of plugin: modelPlugin、pagePlugin and componentPluign. You can learn about Sifo's basic information and the usage patterns by reading this package's README.
  • sifo-react is a React Component encapsulates sifo-model and sifo-singleton. sifo-react also support sifoAppDecorator, with which a normal React Commponent will has extension ability. You can learn about that via package's README or online demos.
  • sifo-vue is a Vue Component encapsulates sifo-model and sifo-singleton. sifo-vue also support sifoAppDecorator, with which a normal Vue Commponent will has extension ability. You can learn about that via package's README or online demos.
  • sifo-singleton is a global extensions holder. All kinds of extend-plugins and extend-components are registered to it.

Three elements of Sifo

  • schema: to describe page's structures
  • components
  • plugins: logic controller

SifoApp (sifo-react/sifo-vue) Demo

  • form-extend-demo

    sifo-react-extends-demo

  • simple demo

    In this demo, there are seven extend-plugins in seven independent js. The checkbox set which plugin should be registered. Each plugin control different logic and all registered plugins make up a integrated page.

    demo

modelPlugins

  • sifo-mplg-react-optimize is a modelPlugin for sifo-react optimization.
  • sifo-mplg-form-core is a sifo form-core model plugin. This model plugin, basing on simple schema setting, realized the form fields' control and supplied form operations with a serial of api.
  • sifo-mplg-form-antdv is a sifo form with Ant-Design-Vue, works with sifo-mplg-form-core and sifo-vue.
  • sifo-mplg-form-antd is a sifo form with Ant-Design, works with sifo-mplg-form-core and sifo-react.
  • sifo-mplg-form-fusion is a sifo form with Fusion, works with sifo-mplg-form-core and sifo-react.
  • sifo-mplg-form-antd-mobile is a sifo form with Ant-Design-Mobile, works with sifo-mplg-form-core and sifo-react.
  • sifo-mplg-drag Sifo drag model plugin. Basing on custom Components and Schema rendering, you can drag and drop component instantaneously and reconstruct a Schema. Please refer to sifo-mplg-drag-react and sifo-mplg-drag-vue.
  • sifo-mplg-drag-react Sifo drag model plugin for React components.
  • sifo-mplg-drag-vue Sifo drag model plugin for Vue components.

Sifo family

  • sifo-model + react = sifo-react
  • sifo-model + vue = sifo-vue
  • sifo-react + sifo-mplg-form-core + ant-design = sifo-mplg-form-antd
  • sifo-react + sifo-mplg-form-core + fusion = sifo-mplg-form-fusion
  • sifo-vue + sifo-mplg-form-core + ant-design-vue = sifo-mplg-form-antdv

Installation

$ npm i @schema-plugin-flow/sifo-model --save
$ npm i @schema-plugin-flow/sifo-react --save
$ npm i @schema-plugin-flow/sifo-vue --save

How Sifo extensions works

How to use

  • project

    • extend.js

      import SifoSingleton from '@schema-plugin-flow/sifo-singleton';
      const singleton = new SifoSingleton('quick-start'); // target namespace
      singleton.registerItem('testExtendId', () => {
        return {
          plugins,
          components
        }
      });
    • app.js

      import React from 'react';
      import ReactDOM from "react-dom";
      import SifoApp from '@schema-plugin-flow/sifo-react';
      const plugins = [{ modelPlugin, componentPlugin, pagePlugin }];
      class App extends React.Component {
        render() {
          return (
            <SifoApp
              namespace='quick-start'
              components={components}
              schema={schema}
              plugins={plugins}
            />
          );
        }
      }
      ReactDOM.render(
        <App />
        rootElement
      );
  • runtime

    • load extend js

    • load app js

      you should load the extend js before sifoApp rendered.

      <script src="extend.js"></script>
      <script src="app.js"></script>

Try in local

  • React

    • clone code and start
    $ git clone https://github.com/alibaba/schema-plugin-flow.git
    $ cd schema-plugin-flow
    $ npm run i
    $ npm run start
    • then visit http://localhost:8000.
  • Vue

    • clone code and start
    $ git clone https://github.com/alibaba/schema-plugin-flow.git
    $ cd schema-plugin-flow
    $ npm run i
    $ npm run i-vue
    $ npm run start-vue
    • then visit http://localhost:8080.

Try online (codesandbox.io)

schema-plugin-flow's People

Contributors

alibaba-oss avatar chenqiongqiong avatar frominxu avatar

Stargazers

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

Watchers

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

schema-plugin-flow's Issues

表单数据维护问题

你好,一些公共数据可以使用 mApi.setGlobalData 方法存储。而像表单数据应在schema上维护。
比如一个表单 涉及姓名,年龄,
数据格式为 const a ={
age:'',
name: ''
}
那怎么维护对象a 呢,比如我需要a为全局对象,age改变后,需要更新a的数据,并保存到vuex中,
plugin 中 setAttributes 的话,需要把{
age:'',
name: ''
} 都传进去,有没有更好的办法呢

setup vue example error

following shells:

$ git clone https://github.com/alibaba/schema-plugin-flow.git
$ cd schema-plugin-flow
$ npm run i
$ npm run i-vue
$ npm run start-vue

show error on npm run start-vue

ERROR Failed to compile with 1 errors

This relative module was not found:

  • ./lib/index.js in ../packages/sifo-vue/index.js

请教一些开发体验相关问题

因为是通过插件式的开发方式,解耦和扩展能力增强了。感觉接入项目的学习成本,编写,还有代码调试追踪必然受到影响,不知道你们是怎么考虑这些问题的呢?

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.