Sever JSON Driving UI


Keywords
kitten, kittenjs, core, react, reactjs, json, ui, component, components, typescript, kittenjs-default-ui
License
MIT
Install
npm install kittenjs@1.0.3

Documentation

kitten

Kitten

Server JSON Driving UI

NPM NPM

⚠️ Warning

Kitten (kittenjs and kittenjs-default-ui) is under active development

Its API is not stable

Use it at your own risk

📦 Installation

1.kittenjs

yarn add react kittenjs

2.kittenjs-default-ui

yarn add react-dom react-router-dom antd ant-colony-ui styled-components kittenjs-default-ui

⌨️ Development

1.install

cd kittenjs
yarn install --ignore-scripts

cd kittenjs-default-ui
yarn install --ignore-scripts

cd example
yarn install --ignore-scripts

2.link

cd kittenjs
yarn link
# Fix Duplicate React: https://github.com/facebook/react/issues/15315#issuecomment-479802153
npm link ../example/node_modules/react

cd kittenjs-default-ui
yarn link
yarn link "kittenjs"
npm link ../example/node_modules/react

cd example
yarn link "kittenjs"
yarn link "kittenjs-default-ui"

3.run in development mode

cd kittenjs
yarn start

cd kittenjs-default-ui
yarn start

cd example
yarn run dev

🔨 Usage

You can see example for detail

import { Kitten } from 'kittenjs'
import { Renderer, ui } from 'kittenjs-default-ui'
import Sub1ListPlugin from './plugins/Sub1ListPlugin'
import OtherListPlugin from './plugins/OtherListPlugin'
const app = new Kitten(ui, {
    appKey: "ke",
    appTitle: 'Kitten Example',
    pageAPI: 'http://api.example.com/pages',
    loginUrl: 'http://api.example.com/login',
    menus: [
        {
            key: 'dashbord',
            label: '仪表盘',
            index: true,
            pageJSON: []
        }, {
            label: '菜单 1',
            subs: [
                {
                    label: '子菜单 1',
                    key: 'sub1',
                },
                {
                    label: '子菜单 2',
                    key: 'sub2'
                }
            ]
        }
    ],
}, [
    new Sub1ListPlugin(), // plugins
    new OtherListPlugin()
], [
    'beforeTableColumnFinalization'  // debug kitten hooks
])
app.render(Renderer,  document.getElementById('root')!)

License

MIT © docoder