Git Product home page Git Product logo

formstamp's Introduction

FormStamp

Build Status

Gitter chat

FormStamp is a pure AngularJS widgets library designed for rich front-end web applications. FormStamp core principles are:

  • all widgets are written from scratch;
  • maximum AngularJS compatibility (supports ngDisabled, ngModel and other standard directives);
  • styled with Twitter Bootstrap;
  • clean & minimalistic codebase.

Live Demo

Installation

FormStamp can be installed via Bower Package Manager:

bower install angular-formstamp

Structure

There are 3 levels of directives:

  • Form Builder - orchestrates building of complex forms; provides simple DSL-like markup for describing forms and hides complex markup from you.
  • Widget directives - most often used widgets.
  • Low-level directives - common concerns for widgets construction, can be used to build your own custom widgets.

Form Builder

  • fsFormFor - root form builder directive;
  • fsInput - renders a row with input in form builder;
  • fsRow - renders a custom row.

Widget Directives

  • fsSelect - select input with free text support (select/combo);
  • fsMultiselect - multiple select input with free text support;
  • fsTime - time input;
  • fsDate - date input with fsCalendar inside dropdown;
  • fsDatetime - widget composed from fsTime and fsDate to enter both date and time;
  • fsRadio - a group of radiobuttons;
  • fsCheck - a group of checkboxes.

Low-level Directives

  • fsList - renders a list of items and allows to move selection up and down (with custom templating for items);
  • fsNullForm - hides input with ngModel binding from a parent form;
  • fsInput - simplifies keyboard & focus events handling;
  • fsCalendar - draws a calendar and allows to mark one day as selected.

Development Environment

Install node.js

curl https://raw.github.com/creationix/nvm/master/install.sh | sh # install nvm
nvm install 0.10

Clone FormStamp repository

git clone [email protected]:formstamp/formstamp.git

Install bower dependencies and node.js packages

  cd formstamp
  nvm use 0.10
  npm install && cd demo && npm install && cd ..

Build, start demo server and start watching changes using

npm start

# open browser @ localhost:8080/index.html

Now, point your browser to http://localhost:8080/ and you'll see FormStamp's demo page.

NOTE: These commands add nvm command to .bash_profile. It may not work if you are not using bash shell (like zsh). In this case you have to manually configure profile file.

Running Tests

Run unit tests:

npm test

To run protractor tests you could use:

npm run-script e2e

To build bower package in dist/ run:

npm run-script build

Release Notes

To see what has changed in recent versions, see the CHANGELOG.

License

FormStamp is released under MIT License.

formstamp's People

Contributors

asmisha avatar bazai avatar danil avatar maksimr avatar mirasrael avatar mlapshin avatar niquola avatar semalexa avatar serzh avatar viruzzz-kun 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

formstamp's Issues

textarea

Hi,
Just started to use formstamp and like it very much.

  1. How can I use a textarea as I dont see support for this type
  2. Is is possible to use ragiogroup and checkboxgroup inline?
    Thanks,
    John

fsTime should work with Date object as model, not string

Despite the docs saying "This directive expects that scope property specified in ngModel will be a Date", fsTime seems to require a time string "HH:MM" as the ngModel. The example you provide confirms this.

This makes it not possible to use the same date object as an fsDate field.

Production

Hi,
I'm having a problem with the only module where I've included formstamp controls. This only has shown up when testing the app in production mode. After mininification all other items work fine and I've broken down what seems to be a problem with formstamp, although I imagine in could be something else and perhaps it's a conlict with anohter library(I use ui-router). At any rate when I open the form below I get the following error.
Error: [$injector:unpr] Unknown provider: aProvider <- a
http://errors.angularjs.org/1.3.2/$injector/unpr?p0=aProvider%20%3C-%20a
at http://localhost:1337/min/production.js:3:20697
at http://localhost:1337/min/production.js:4:5894
at Object.d as get
at http://localhost:1337/min/production.js:4:5989
at d (http://localhost:1337/min/production.js:4:5103)
at Object.e as invoke
at l.instance (http://localhost:1337/min/production.js:4:25970)
at http://localhost:1337/min/production.js:4:16841
at f (http://localhost:1337/min/production.js:3:21188)
at v (http://localhost:1337/min/production.js:4:16825)


Sinply commenting out the fs-input line eliminates the error.
TIA
John
fs-form-for model="contract1">

<fieldset class="form-horizontal">
    <legend>Contract Info</legend>

    <fs-input as="text" required="" name="BCSNumber"></fs-input>
</fieldset>

How to customise error messages

Hi,

Is there a way to customize the error messages from input fields. As an example, when minlength error occurs on a field, the message is "Error happened: minlength".

Regards,

Odafe

fsTime show unfinished value

When entering value such as '12:4', where minutes represented by one digit, fsTime doesn't expand it to the 12:40.

image

Time - semicolon problem

choose any time from dropdown list
make a selection in the time field (like ctrl+a)
type in 1010 or something similar
you will get 10:10
make a selection in the time field (like ctrl+a)
type in 1212 or something similar
you will be suggested 12:12 value from the list
click on this value 12:12
value in time field does not change from 1212 to 12:12
also users won't like to enter ' : ' manually

http://formstamp.github.io/#/widgets/datetime

scr-03-13-2014-06-47-08

I18n

add i18n support for widgets

$watch and freetext are not working with fs-select

My template is:

<div fs-select="" freetext="enable" items="companies" ng-model="model" fs-input="" fs-enter="select()">
   <span ng-show="item"> {{item.name}} </span>
   <span ng-hide="item"> Selecione uma empresa </span>
</div>

In controller:

    $scope.$watch('model', function () {
      console.log($scope.model)
    });
    $scope.$watch('search', function () {
      console.log($scope.search)
    });

They only log in console when I press Enter after writing in input. Why it isn't live?

Bind not working in fs-datetime

I just got the date working, the time is empty.

For informations if the date is like this: $scope.myDate = new Date(); it works.
Otherwhile it's not working. ie: javascript $scope.myDate = '2015-08-12T11:00:00.000Z';

<div fs-datetime="" data-ng-model="myDate"></div>

Here is the log console:

TypeError: ngModelCtrl.$viewValue.getHours is not a function
    at mod.directive.link.ngModelCtrl.$render (formstamp.js:1680)
    at Object.ngModelWatch (angular.js:20966)
    at Scope.$get.Scope.$digest (angular.js:14215)
    at Scope.$get.Scope.$apply (angular.js:14486)
    at done (angular.js:9644)
    at completeRequest (angular.js:9834)
    at XMLHttpRequest.requestLoaded (angular.js:9775)

TypeError: newValue.getDate is not a function
    at Object.fn (formstamp.js:1666)
    at Scope.$get.Scope.$digest (angular.js:14223)
    at Scope.$get.Scope.$apply (angular.js:14486)
    at done (angular.js:9644)
    at completeRequest (angular.js:9834)
    at XMLHttpRequest.requestLoaded (angular.js:9775)

TypeError: updatedDate.getTime is not a function
    at Object.fn (formstamp.js:1398)
    at Scope.$get.Scope.$digest (angular.js:14223)
    at Scope.$get.Scope.$apply (angular.js:14486)
    at done (angular.js:9644)
    at completeRequest (angular.js:9834)
    at XMLHttpRequest.requestLoaded (angular.js:9775)

Inline Forms

I was just wondering if formstamp supports inline forms yet.

Also do you think you will ever create a way to build the form from JSON?

safety wrapper is absent

This is the beginning of assembled formstamp.js file:

var addValidations, comp, filter, getComputedStyleFor, indexOf, innerHeightOf, nextUid, parseDate, scrollToTarget, toTimeStr, uid, updateDate, updateTime;

comp = function(a, b) {
  return ("" + a).toLowerCase().indexOf(b.toString().toLowerCase()) > -1;
};

I assume that it's a problem with bare option in coffee-script compiler.

Looks interesting

It would be good to have a paragraph in the readme of the problem that it's solving. I've gone through the examples, the DSL looks great, the form builder looks great but I'm still not 100% sure of the purpose.

Is it trying to solve form layouts by making them easier to write via the DSL? I feel like I'm missing the point and a small explanation would go far :)

Add directive for adding custom validation

Create directive that will allow for adding custom validation.
For example

<input type='password' 
  fs-validate='confirmation' 
  fs-validate-rule='password == passwordConfirmation'
  name='password'
  ng-model='password' />
<input type='password' 
   name='passwordConfirmation'
   ng-model='passwordConfirmation' />
<p class='error'
   ng-show='form.password.$error.confirmation'>
  Password should match confirmation
</p>

Support schema definitions

It is very useful to have an ability to compile schema definitions. Sometimes we need to add form dynamically to some container on a page, so it would be great to have an ability to simply define a scheme (a list of fields and their attributes) and then reuse it multiple times wherever we want. So the main thought is to have a mechanism that will receive a scheme (json, xsd) with model(s) and return a form definition that can be inclueded on a page.

Curly braces inside name attribute rase

This library looks like not usable for run time forms generation what it builds for?

Overview

$scope.userData  – hase "name" property

$scope.userInfoConfig – describe fields for edit userData

this works

<form fs-form-for="" model="userData">
<div ng-repeat="item in userInfoConfig.edit">
    <fs-input as="text" required="" name="name"></fs-input>
</div>

Unexpected token {

<form fs-form-for="" model="userData">
<div ng-repeat="item in userInfoConfig.edit">
    <fs-input as="text" required="" name="{{item.attr}}"></fs-input>
</div>

Magic!

<form fs-form-for="" model="userData">
<div ng-repeat="item in userInfoConfig.edit">
    <fs-input as="text" required="" label="{{item.label}}" name="name"></fs-input>
</div>

So, use curly braces for label attribute is ok, but inside name not.
I can dynamically generate only labels?

Where truth, bro?

Site menu items

Let's change menu item names to the following:
FormStamp
Form Builder
Select Widget -> Select
MultiSelect Widget -> MultiSelect
Radio Group
Checkboxes -> Checkbox Group
Date/Time Widgets -> Date/Time
fsList -> List

Problem with fs-Date when providing date as string (proposition of solution)

Well im using formstamp having my backend based on Django and Django Rest Framework.

I had this weird problem with fs-Date, to be exact in this method:

exports.updateDate = function(date, newDate) {
  switch (false) {
    case !(date == null):
      return newDate;
    case !(newDate == null):
      return date;
    default:
      date.setHours(newDate.getHours());
      date.setMinutes(newDate.getMinutes());
      date.setSeconds(newDate.getSeconds());
      return date;
  }
};

I was given errors about setHours (or getHours) not being a function.
It was caused by 'date' variable being string with date and not js Date object.
I fixed it by adding this lines:

newDate = new Date(newDate);
oldDate = new Date(oldDate);

before calling of this method :

$scope.$watch('selectedDate.date', function(newDate, oldDate) {
          newDate = new Date(newDate);
          oldDate = new Date(oldDate);
          var updatedDate;
          updatedDate = u.updateDate(newDate, oldDate);
          if ((updatedDate != null ? updatedDate.getTime() : void 0) !== (oldDate != null ? oldDate.getTime() : void 0)) {
            return ngModel.$setViewValue(updatedDate);
          }
        });

I cannot imagine reason why this shouldn't be there in the first place, so please either include or explain to me why it would be bad (there might be issues with compatibility or usage that i didn't think of).

Great lib anyway :)

fsList - js error in Firefox

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.