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

cruddle

v1.0.0-alpha.5

Published

Simplifying CRUDL screen development using ModelSafe

Downloads

9

Readme

Cruddle

Introduction

Cruddle is an Angular 2 library that provides functionality to generate generic CRUD(L) screens from ModelSafe data models. The huge benefit of this is that screens in a CRUDL-based application can have their fields and validations automatically provided by ModelSafe, so the actual work you need to do develop Angular components for CRUDL screens is minimal. Cruddle provides all of the functionality to describe how a screen should look and perform from a ModelSafe model, and you just need to turn that stateful information into Angular templates.

For a general run down of how the library works, see the usage section below.

Installation

npm install --save cruddle

Usage

General Concepts

Cruddle separates the concept of a screen into three components:

  • The description of a screen, which might describe the columns to show in a list, what buttons to show on the screen and so on. Basically a literal description of how the UI might function.
  • The user interface (UI) which takes the description of a screen and renders it using HTML and then creates visual elements that can change the screen state.
  • The state of a screen, which the UI interacts with in order to keep track of certain functionality related to the screen. For example, the state of a list might contain pagination information

In a sense, the UI can be thought of as visual glue between a screen describer (produces screen descriptions) and a screen state.

Each different CRUDL action has its own respective describer and state types. These can be used to write the base components/user interfaces for each CRUDL action.

Create & Update

In most applications, a create or update screen will generally act the same or extremely similar when it comes to UI. To encourage writing minimal code, Cruddle's create and update functionality are described by the single FormDescriber class. In order to generate a FormState, you should extend the FormDescriber with a model-specific version.

If you have no custom functionality, you can use the AutoFormDescriber provider included in CruddleModule to generate default form describers for models. You will still need to provide the save function to use for saving the form data.

Read

In order to generate a ReadState, you should extend the ReadDescriber with a model-specific version.

If you have no custom functionality, you can use the AutoReadDescriber provider included in CruddleModule to generate default read describers for models.

Delete

In order to generate a DeleteState, you should extend the DeleteDescriber with a model-specific version.

If you have no custom functionality, you can use the AutoDeleteDescriber provider included in CruddleModule to generate default delete describers for models. You will still need to provide the delete function to use for deleting the model data.

Note that some applications may have the delete screen as a popup on the list screen rather than a separate screen. If that's the case, then the delete component can just be ignored and a delete action can be added to the list component.

List

In order to generate a ListState, you should extend the ListDescriber with a model-specific version.

If you have no custom functionality, you can use the AutoListDescriber provider included in CruddleModule to generate default delete describers for models. You will still need to provide the refresh function to use for refreshing the list screen.

Documentatation

The API documentation generated using TypeDoc is available online.

To generate API documentation from the code into the docs directory, run:

npm run docs

Testing

To execute the test suite run:

npm run test

License

This project is licensed under the MIT license. Please see LICENSE.md for more details.