GithubHelp home page GithubHelp logo

hishamhaniffa / vue-rule-builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blocka/vue-rule-builder

0.0 2.0 0.0 827 KB

A component for building complex rules

Home Page: https://blocka.github.io/vue-rule-builder/

License: MIT License

JavaScript 90.08% CSS 3.15% Vue 6.77%

vue-rule-builder's Introduction

What is this?

This component can be used whenever you need a UI for created complex filters. The UI is used to build up a data structure which can be used to generate a query of some sort.

Installation

npm install vue-rule-builder (or use yarn)

To use globally:

import RuleBuilder from 'vue-rule-builder'

Vue.use(RuleBuilder)

or import { RuleBuilder } from 'vue-rule-builder' for "local" installation.

You can import the built in stylesheet as well: import 'vue-rule-builder/dist/styles.css

A rule consists of three fields, a name, operation and value { name: 'firstName', operation: 'startsWith', value: 'B' }

The name and operation are arbitrary values, and you would have to have a parser which understands what those mean.

Rules can be put in a group: { all: true, rules: [] }

Rules can be filtered further:

{
name: 'totalPayments',
filter: {
	all: true,
	rules: [
	]
}

The basic component can takes two props, filter and fields. filter is a rule group, and fields is an array of fields. A field looks like: { name: 'firstName', label: 'First Name', operations: [["Starts With", "startWith"]] }

The component will emit update:filter so you can use the .sync modifier.

The component comes with a built in UI, and there is a stylesheet which can be included as well, to get the default look and feel. Alternatively, a scoped slot can be provided instead, for the ultimate in flexibility.

Check out the storybook which demonstrates usage.

vue-rule-builder's People

Contributors

blocka avatar slatiner avatar

Watchers

James Cloos avatar Hisham Haniffa avatar

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.