import React, { Component,useCallback,useState ,useEffect} from 'react'; import { Input, InputNumber, Select, Radio, DatePicker, Form } from 'antd'; import * as Tools from 'jad-tool' import classname from 'classnames' import { checkValidateRule } from 'jad-tool' const { RangePicker } = DatePicker; export const show_FnMiddle = ({ interrupt }) => (next) => (params,child) => { const { show = true } = params if (!show) { interrupt(null) } next(params,child) } export const validate_FnMiddle = ({ interrupt }) => { const ValidateMiddle = (params)=>{ let { value, props={}, rule = new RegExp(''), message = '', children = null } = params let error = checkValidateRule(rule, value) message = Tools.isString(error) ? error : message; const validate = !error ? 'success' : 'error'; const help = !error ? false : message return (
{children}
) } return (next) => (params,child) => { const render = {child} next(params,render) } } export const formLabel_FnMiddle = ({ interrupt }) =>{ const FormLabelMiddle = (props) => { const { label = '', hint = '', children = null } = props return (
{children} { hint ? {hint} : '' }
) } return (next) => (params,child) => { const render = {child} next(params,render) } } export const input_FnMiddle = ({ interrupt }) => { const InputMiddle = (params)=>{ const [text,SetText] = useState('') const { props = {}, value="", style = { width: '100%' }, onChange=()=>null, placeholder = "", disabled = false, name = "", } = params useEffect(()=>{ SetText(value) },[value]) return { const inputValue = e.target.value SetText(inputValue) onChange(e) }} /> } return (next) => (params,child) => { const render = next(params,render) } } export const select_FnMiddle = ({ interrupt }) => { const SelectMiddle = (params)=>{ const { props={}, value = undefined, placeholder = "", disabled = false, onChange = (e) => { }, children = null, style = { width: '100%' }, } = params return } return (next) => (params,child) => { const render = {child} next(params,render) } } export const radio_FnMiddle = ({ interrupt }) => { const RadioMiddle = (params)=>{ const { value = false, props={}, disabled = false, onChange = (e) => { }, children = null } = params return {children} } return (next) => (params,child) => { const render = {child} next(params,render) } } export const rangePicker_FnMiddle = ({ interrupt }) => { const RangePickerMiddle = (params)=>{ const { value = false, props={}, disabled = false, onChange = (e) => { } } = params return } return (next) => (params,child) => { const render = next(params,render) } }