Giter VIP home page Giter VIP logo

focus-components's Introduction

focus-components

NPM

master develop

Dependencies Status Dev Dependencies Status Peer Dependencies Status

Throughput Graph

Issue Stats Issue Stats Package Quality Components for focus application.

Components

Sources

All the source code is in src.

component spec

Component example structure, with all the directories ans sub directories.

  • index.js : the component entry point.
  • style: the style of the component should be written in sass.
  • assets: all the components assets
  • example: a example directory for your component, should have an index.html file. (see build section for more informations).
  • __tests__ : components unit tests

Build

  • First install the dependencies npm install, in case of any problem with a proxy or with node-gyp have a look at this gist
  • npm run build to trigger the complete build
  • npm run build:browser to trigger only the build for the browser

Component catalog

In order to build the catalog, your component must be describe under the components node in the package.json file.

"components": [
    {
      "name": "componentName",
      "path": "componentPath"
    }
  ]

When your component has been added to this list, it will automatically be deployed as a single component and testable through the url: http://localhost:3000 using the static-server.js file. You can launch the examples with the command npm run example.

Unit test

In order to launch unit test: npm run test

CSS

FlexBox/

Lint

npm run lint in order to see your errors.

Browser testing done with Browserstack

focus-components's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

focus-components's Issues

[field][valueBehaviourMixin]

/**
  * Get the value from the field.
  */
  getValue: function getValue() {
    return this.refs.input.getValue();
  },

Get an error Uncaught TypeError: Cannot read property 'getValue' of undefined

Override of onChange props

All the onChange props are overriden by Focus. We can't use it. Here's the modification I did on the select component:

     */
    select: function renderSelect() {
        if (this.props.FieldComponent || this.props.InputLabelComponent) {
            return this.renderFieldComponent();
        }
        var selectClassName = `form-control`;
        return (
            <div className ={`input-group ${this._getContentGridClassName()}`}>
                <this.props.SelectComponent
                    style={{class: selectClassName}}
                    id={this.props.name}
                   name={this.props.name}
                    value={this.state.value}
                    values={this.state.values}
                    type={this.props.type}
                    onChange={this.props.onChange  || this.onInputChange}
                    ref="input"
                />
            </div>
        );
    },

[button] Label hard coded

For instance :

buttonEdit: function buttonEdit() {
    var form = this;
    return React.createElement(Button, {
      label: "edit",
      type: "button",
      css: "edit",
      handleOnClick: function handleOnClickEdit() {
        form.setState({ isEdit: !form.state.isEdit });
      }
    });
  }

[form] save action behaviour

In common/form/mixin/action-behaviour.js

=> Construct json from form's refs

 _getEntity: function formGetEntity(){
    if(this.getEntity){
      return this.getEntity();
    }
    //Build the entity value from the ref getVaue.
    var htmlData = {};
    for(var r in this.refs){
      //todo @pierr see if this is sufficient.
      if(this.refs[r] && isFunction(this.refs[r].getValue)){
          var key = r;
          if(this.definitionPath) {
              key = key.replace(this.definitionPath + '.', '');
          }
          htmlData[key] = this.refs[r].getValue();
      }
    }
    return assign({}, this.state, htmlData);
  },

Before:

{
  "package.entity.property": value
}

After:

{
  "property": value
}

[component][search] live-filter

This component will be use to filter results after a search.

{
"filters": {
      "filter1": {
        "label": "filterKey",
        "value": "value"
      }
  } 
}

[list] listfor

The isEdit props of the form is not transferred to the line component in the listFor method of the form.

[form] validator should translate the message

replace

 validateInput: function validateInputText() {
    var value = this.getValue();
    if (this.props.isRequired && (value === undefined || value === "")) {
      return this.i18n("field.required", { name: this.i18n(this.props.label) });
    }
    if (this.props.validator) {
      return this.props.validator(value);
    }
    return true;
  },

with

 validateInput: function validateInputText() {
    var value = this.getValue();
    if (this.props.isRequired && (value === undefined || value === "")) {
      return this.i18n("field.required", { name: this.i18n(this.props.label) });
    }
    if (this.props.validator) {
      return this.props.validator(value);
    }
    return true;
  },

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.