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

@femessage/el-data-tree

v0.8.0

Published

base on element-ui, makes crud easily

Downloads

65

Readme

el-data-tree

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

Use axios to automatically send requests, support filtering, customize action columns, and make RESTful CRUD simpler 👏

el-data-tree-crud.gif

中文文档

Table of Contents

Introduction

CRUD

el-data-tree is created to solve business problems, so CRUD logic is set inside. For example, to develop user api, suppose its relative path like this:

/api/v1/users

The restful CRUD api should be:

  • Retrieve
GET /api/v1/users?type=1
  • Create
POST / api / v1 / users
  • Update
PUT /api/v1/users/:id
  • Delete
DELETE /api/v1/users/:id

Then only need to use the following code to complete CRUD functions

<template>
  <el-data-tree v-bind="treeConfig"></el-data-tree>
</template>
<script>
export default {
  data() {
    return {
      treeConfig: {
        url: '/example/users',
        dataPath: 'data.payload',
        showFilter: true,
        form: [
          {
            $type: 'input',
            $id: 'name',
            label: '用户名',
            $el: {
              placeholder: '请输入'
            },
            rules: [
              {
                required: true,
                message: '请输入用户名',
                trigger: 'blur'
              }
            ]
          }
        ]
      }
    }
  }
}
</script>

The results are as follows:

  • Retrieve

el-data-tree-search.png

  • Create

el-data-tree-add.png

  • Update

el-data-tree-modify.png

  • Delete

el-data-tree-delete.png

⬆ Back to Top

Feature

  • Use configuration to call restful api to complete CRUD functions
  • Support custom menu bar, as well as custom action functions
  • Save the expandedKeys by default and will not losing the expandedKeys state after calling create/delete/update apis
  • Optimized node check method

⬆ Back to Top

Demo

⬆ Back to Top

Pre Install

This component peerDependencies on element-ui and @femessage/el-form-renderer and axiosmake sure you have installed in your project

yarn add element-ui @femessage/el-form-renderer axios

⬆ Back to Top

Install

Encourage using yarn to install

yarn add @femessage/el-data-tree

⬆ Back to Top

Quick Start

Global Register Component

This is for minification reason: in this way building your app, webpack or other bundler just bundle the dependencies into one vendor for all pages which using this component, instead of one vendor for one page

import Vue from 'vue'
// register component and loading directive
import ElDataTree from '@femessage/el-data-tree'
import ElFormRenderer from '@femessage/el-form-renderer'
import {
  Button,
  Dialog,
  Dropdown,
  DropdownMenu,
  DropdownItem,
  Form,
  FormItem,
  Input,
  Loading,
  Tree,
  MessageBox,
  Message
} from 'element-ui'
Vue.use(Button)
Vue.use(Dialog)
Vue.use(Dropdown)
Vue.use(DropdownMenu)
Vue.use(DropdownItem)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Loading.directive)
Vue.use(Tree)
Vue.component('el-form-renderer', ElFormRenderer)
Vue.component('el-data-tree', ElDataTree)
// to show confirm before delete
Vue.prototype.$confirm = MessageBox.confirm
// if the tree component cannot access `this.$axios`, it cannot send request
import axios from 'axios'
Vue.prototype.$axios = axios

⬆ Back to Top

Template

<template>
  <el-data-tree></el-data-tree>
</template>

⬆ Back to Top

Contributors

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top