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

react-inforvation-utility

v1.0.29

Published

[![NPM](https://img.shields.io/npm/v/react-inforvation-utility.svg)](https://www.npmjs.com/package/react-inforvation-utility) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

Downloads

35

Readme

react-inforvation-utility

NPM JavaScript Style Guide

Install

npm install --save react-inforvation-utility

Usage

#BlobImage

import React, { Component } from 'react'
import { Grid } from 'semantic-ui-react'
import { BlobImage } from 'react-inforvation-utility'

class Example extends Component {
  onSaveSuccess = () => {
    console.log('onSaveSuccess');
  }
  
  onSaveError = () => {
    console.log('onSaveError');
  }
  
  onCheckHaveImg = () => {
    console.log('onCheckHaveImg');
  }
  
  render () {
    let token = 'TOKEN';
    return (
      <Grid columns={2}>
        <Grid.Column>
          <BlobImage 
            token={token} 
            account='ACCOUNT_NAME'            
            container='CONTAINER_NAME'
            name='FILE_NAME'
            width = '100%'  {/*Percent or Pixel*/} 
            height = '100%' {/*Percent or Pixel*/} 
            ribbonDescription = 'รูปที่ 1 ทดสอบ'
            ribbonColor = 'COLOR_LIBBON' {/*Example 'teal'*/} 
            ribbonSide {/*option for show ribbon default is left*/}
            upload {/*option for show upload button*/}
            onSaveSuccess={this.onSaveSuccess}
            onNoImage={this.onCheckHaveImg}
            onSaveError={this.onSaveError}
          />
        </Grid.Column>
        <Grid.Column>
          <BlobImage 
            token={token} 
            account='ACCOUNT_NAME'            
            container='CONTAINER_NAME'
            name='FILE_NAME'
            width = '100%' {/*Percent or Pixel*/} 
            height = '100%' {/*Percent or Pixel*/} 
            ribbonDescription = 'Image Description' {/*Example ''รูปที่ 2 ทดสอบ''*/} 
            ribbonColor = 'COLOR_LIBBON' {/*Example 'red'*/} 
            ribbonSide ='right' {/*option for show ribbon default is left*/}
            upload {/*option for show upload button*/}
            onSaveSuccess={this.onSaveSuccess}
            onNoImage={this.onCheckHaveImg}
            onSaveError={this.onSaveError}
          />
        </Grid.Column>
      </Grid>
    );     
  }
}

#withDocumentFetch

import React, { Component } from 'react';
import { Form } from 'semantic-ui-react'
import validate from 'validate.js'
import { withDocumentFetch } from 'react-inforvation-utility';


validate.validators.custom = function(value, options, key, attributes) {
  return "is totally wrong";
};

const constraint = {
  year:{length:{is:4}}
}

class TestDocFetch extends Component {
  constructor(props) {
    super(props);
    this.state = {}
  }  
  
  handleChange = (e,{name,value}) => {
    let tmp = { ...this.props.data };    
    tmp[name]=value;              
    this.props.onDocumentChange(tmp);    
  }
  
  render() {    
    const { data, validateError } = this.props;
    return (
    <Form>
      <Form.Input name="year" 
        label="year"
        error={'year' in validateError}
        value={data.year||''} onChange={this.handleChange}/> 
        {validateError['year']}
     </Form>
    );
  }
}

constraint['validator'] = validate;

export default withDocumentFetch('/obec/ject_cct',constraint)(TestDocFetch);
import React, { Component,Fragment } from 'react';
import { Button } from 'semantic-ui-react'
import TestDocFetch from './TestDocFetch';

let token = 'TOKEN';

class Test extends Component {
  constructor(props) {
    super(props);
    this.state = {}
  }
 
  handleValidateError = (result) => {
    console.log(result);
  }
  
  handleClick = () => {
    this.refs.form.save();
  }
  
  onSaveSuccess = (result) => {
  }
  
  onSaveError = (result) => {
  }
  
  render() {
    return (
      <Fragment>
        <TestDocFetch docId="0011011374935" ref="form" 
          token={token} 
          onValidateError={this.handleValidateError}/>
        <Button fluid onClick={this.handleClick} content="เลือก"/>
      </Fragment>
    );
  }
}

export default Test;

#withDocumentQuery

import React, { Component } from 'react';
import { withDocumentQuery } from 'react-inforvation-utility';

class TestDocQuery extends Component {
  constructor(props) {
    super(props);
    this.state = {}
  }  

  render() {    
    const { token,body,response } = this.props;
    console.log( body,response );
    return (<div/>);
  }
}

export default withDocumentQuery('/obec/ject_cct')(TestDocQuery);
import React, { Component,Fragment } from 'react';
import { Button } from 'semantic-ui-react'
import TestDocQuery from './TestDocQuery';

let token = 'TOKEN';

class TestQuery extends Component {
  constructor(props) {
    super(props);
    this.state = {}
  }
  
  render() {
    const body = {"query":{'_id':'0011011374935'}};
    return (
      <Fragment>
        <TestDocQuery 
          token={token} 
          body={body}/>
      </Fragment>
    );
  }
}

export default TestQuery;

License

NU © theerawutt53