@gravel-form/blueprintjs
Version:
A flexible middlewares driven json schema form with Blueprintjs
1 lines • 1.07 kB
Source Map (JSON)
{"version":3,"sources":["middlewares/NumericInputMw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,4BAA4B,CAc5E,CAAC;AAEF,eAAe,cAAc,CAAC","file":"NumericInputMw.d.ts","sourcesContent":["import * as React from 'react';\nimport get from 'lodash/get';\nimport { NumericInput } from '@blueprintjs/core';\nimport { BlueprintFormMiddlewareProps } from '../share';\n\nexport const NumericInputMw: React.ComponentType<BlueprintFormMiddlewareProps> = (props) => {\n const { next, schema, data, onChange, extraProps } = props;\n if (typeof schema === 'boolean' || !(schema.type === 'number' || schema.type === 'integer')) return next(props);\n const { maximum, minimum } = schema;\n return (\n <NumericInput\n className=\"bp3-fill\"\n max={maximum}\n min={minimum}\n value={typeof data === 'number' ? data : undefined}\n onValueChange={onChange}\n {...get(extraProps, 'props')}\n />\n );\n};\n\nexport default NumericInputMw;\n"]}