forked from p96170835/amis
修复 tsc 错误
This commit is contained in:
parent
e15b98aced
commit
4f7a0bfa62
11
publish.sh
11
publish.sh
|
@ -11,15 +11,14 @@ rm -rf lib/node_modules
|
|||
rm -rf sdk && fis3 release publish-sdk -c
|
||||
|
||||
# 生成 .d.ts 文件
|
||||
tsc --allowJs --declaration || true
|
||||
tsc --allowJs --declaration
|
||||
|
||||
cd output;
|
||||
cd output
|
||||
|
||||
for f in `find . -name "*.d.ts"`;
|
||||
do mkdir -p ../lib/`dirname $f` && mv $f ../lib/`dirname $f`;
|
||||
for f in $(find . -name "*.d.ts"); do
|
||||
mkdir -p ../lib/$(dirname $f) && mv $f ../lib/$(dirname $f)
|
||||
done
|
||||
|
||||
cd ..;
|
||||
cd ..
|
||||
|
||||
rm -rf output
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
import React from 'react';
|
||||
import cx from 'classnames';
|
||||
import {findDOMNode} from 'react-dom';
|
||||
import {SketchPicker, GithubPicker, ColorResult} from 'react-color';
|
||||
import {SketchPicker, GithubPicker, ColorState} from 'react-color';
|
||||
import {Icon} from './icons';
|
||||
import Overlay from './Overlay';
|
||||
import uncontrollable from 'uncontrollable';
|
||||
|
@ -177,7 +177,7 @@ export class ColorControl extends React.PureComponent<
|
|||
return image.style.color !== 'rgb(255, 255, 255)';
|
||||
}
|
||||
|
||||
handleChange(color: ColorResult) {
|
||||
handleChange(color: ColorState) {
|
||||
const {
|
||||
onChange,
|
||||
format
|
||||
|
|
|
@ -66,4 +66,6 @@ class InputInner extends React.Component<InputProps, InputState> {
|
|||
|
||||
export default React.forwardRef<HTMLInputElement>((props, ref) => {
|
||||
return <InputInner {...props} forwardedRef={ref} />;
|
||||
}) as React.ReactType<React.InputHTMLAttributes<HTMLInputElement>>;
|
||||
}) as React.ComponentType<
|
||||
React.InputHTMLAttributes<HTMLInputElement> & {ref?: any}
|
||||
>;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
// @ts-ignore
|
||||
import VisibilitySensor from 'react-visibility-sensor';
|
||||
import Spinner from './Spinner';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ BasePosition.propTypes.placement = () => null;
|
|||
class Position extends BasePosition {
|
||||
props: any;
|
||||
_lastTarget: any;
|
||||
setState: Function;
|
||||
setState: (state: any) => void;
|
||||
|
||||
updatePosition(target: any) {
|
||||
this._lastTarget = target;
|
||||
|
|
|
@ -146,9 +146,7 @@ export class Radios extends React.Component<RadioProps, any> {
|
|||
multiple: false,
|
||||
delimiter,
|
||||
valueField,
|
||||
options,
|
||||
joinValues,
|
||||
extractValue
|
||||
options
|
||||
});
|
||||
let body: Array<React.ReactNode> = [];
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ interface RangeProps extends RendererProps {
|
|||
| number;
|
||||
classPrefix: string;
|
||||
classnames: ClassNamesFn;
|
||||
onChange: (value: any) => void;
|
||||
}
|
||||
|
||||
export class Range extends React.Component<RangeProps, any> {
|
||||
|
@ -53,12 +54,10 @@ export class Range extends React.Component<RangeProps, any> {
|
|||
return (
|
||||
<InputRange
|
||||
{...this.props}
|
||||
className={className}
|
||||
classNames={classNames}
|
||||
minValue={min}
|
||||
maxValue={max}
|
||||
value={value}
|
||||
multiple={multiple}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -88,16 +88,9 @@ export default class FroalaEditor extends React.Component<any, any> {
|
|||
this.$element = $(ref);
|
||||
this.setContent(true);
|
||||
this.registerEvents();
|
||||
resizeSensor(
|
||||
ref.parentElement,
|
||||
() => {
|
||||
$(ref)
|
||||
.prev('.fr-box')
|
||||
.find('.fr-toolbar')
|
||||
.css('width', '');
|
||||
},
|
||||
true
|
||||
);
|
||||
resizeSensor(ref.parentElement, () => {
|
||||
$(ref).prev('.fr-box').find('.fr-toolbar').css('width', '');
|
||||
});
|
||||
this.$editor = this.$element
|
||||
.froalaEditor(this.config)
|
||||
.data('froala.editor').$el;
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
// @ts-ignore
|
||||
import Textarea from 'react-textarea-autosize';
|
||||
export default Textarea;
|
||||
|
|
|
@ -132,8 +132,6 @@ export class TreeSelector extends React.Component<
|
|||
|
||||
this.setState({
|
||||
value: value2array(props.value, {
|
||||
joinValues: props.joinValues,
|
||||
extractValue: props.extractValue,
|
||||
multiple: props.multiple,
|
||||
delimiter: props.delimiter,
|
||||
valueField: props.valueField,
|
||||
|
@ -157,8 +155,6 @@ export class TreeSelector extends React.Component<
|
|||
this.props.options !== nextProps.options
|
||||
) {
|
||||
toUpdate.value = value2array(nextProps.value, {
|
||||
joinValues: nextProps.joinValues,
|
||||
extractValue: nextProps.extractValue,
|
||||
multiple: nextProps.multiple,
|
||||
delimiter: nextProps.delimiter,
|
||||
valueField: nextProps.valueField,
|
||||
|
@ -597,8 +593,10 @@ export class TreeSelector extends React.Component<
|
|||
{showIcon ? (
|
||||
<i
|
||||
className={cx(
|
||||
`Tree-itemIcon ${item[iconField] ||
|
||||
(childrenItems ? 'Tree-folderIcon' : 'Tree-leafIcon')}`
|
||||
`Tree-itemIcon ${
|
||||
item[iconField] ||
|
||||
(childrenItems ? 'Tree-folderIcon' : 'Tree-leafIcon')
|
||||
}`
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
|
|
|
@ -33,8 +33,8 @@ export interface AudioState {
|
|||
|
||||
export class Audio extends React.Component<AudioProps, AudioState> {
|
||||
audio: any;
|
||||
progressTimeout: number;
|
||||
durationTimeout: number;
|
||||
progressTimeout: NodeJS.Timeout;
|
||||
durationTimeout: NodeJS.Timeout;
|
||||
|
||||
static defaultProps: Pick<
|
||||
AudioProps,
|
||||
|
|
|
@ -74,8 +74,8 @@ const defaultSchema = {
|
|||
|
||||
export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
||||
wrapperRef: React.RefObject<HTMLDivElement> = React.createRef();
|
||||
intervalTimeout: number;
|
||||
durationTimeout: number;
|
||||
intervalTimeout: NodeJS.Timer;
|
||||
durationTimeout: NodeJS.Timer;
|
||||
|
||||
static defaultProps: Pick<
|
||||
CarouselProps,
|
||||
|
|
|
@ -24,10 +24,10 @@ export default class Container<T> extends React.Component<
|
|||
<div className={cx('Container-body', bodyClassName)}>
|
||||
{children
|
||||
? typeof children === 'function'
|
||||
? (children(this.props) as JSX.Element)
|
||||
? ((children as any)(this.props) as JSX.Element)
|
||||
: (children as JSX.Element)
|
||||
: body
|
||||
? (render('body', body) as JSX.Element)
|
||||
? (render('body', body as any) as JSX.Element)
|
||||
: null}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class ArrayControl extends React.Component<ArrayProps> {
|
|||
|
||||
return (
|
||||
<Combo
|
||||
{...rest}
|
||||
{...(rest as any)}
|
||||
controls={[items]}
|
||||
flat
|
||||
multiple
|
||||
|
|
|
@ -3,7 +3,7 @@ import {FormItem, FormControlProps} from './Item';
|
|||
import cx from 'classnames';
|
||||
import {Button} from '../../types';
|
||||
|
||||
export interface ButtonProps extends FormControlProps, Button {}
|
||||
export interface ButtonProps extends FormControlProps, Omit<Button, 'size'> {}
|
||||
|
||||
export class ButtonControl extends React.Component<ButtonProps, any> {
|
||||
static defaultProps: Partial<ButtonProps> = {};
|
||||
|
|
|
@ -22,7 +22,7 @@ import {dataMapping, resolveVariable} from '../../utils/tpl-builtin';
|
|||
import {isEffectiveApi} from '../../utils/api';
|
||||
import {Alert2} from '../../components';
|
||||
import memoize from 'lodash/memoize';
|
||||
import {Icon}from '../../components/icons'
|
||||
import {Icon} from '../../components/icons';
|
||||
export interface Condition {
|
||||
test: string;
|
||||
controls: Array<Schema>;
|
||||
|
@ -35,7 +35,7 @@ function pickVars(vars:any, fields: Array<string>) {
|
|||
return fields.reduce((data: any, key: string) => {
|
||||
data[key] = resolveVariable(key, vars);
|
||||
return data;
|
||||
}, {})
|
||||
}, {});
|
||||
}
|
||||
|
||||
export interface ComboProps extends FormControlProps {
|
||||
|
@ -80,7 +80,25 @@ export interface ComboProps extends FormControlProps {
|
|||
}
|
||||
|
||||
export default class ComboControl extends React.Component<ComboProps> {
|
||||
static defaultProps = {
|
||||
static defaultProps: Pick<
|
||||
ComboProps,
|
||||
| 'minLength'
|
||||
| 'maxLength'
|
||||
| 'multiple'
|
||||
| 'multiLine'
|
||||
| 'addButtonClassName'
|
||||
| 'formClassName'
|
||||
| 'subFormMode'
|
||||
| 'draggableTip'
|
||||
| 'addButtonText'
|
||||
| 'canAccessSuperData'
|
||||
| 'addIcon'
|
||||
| 'dragIcon'
|
||||
| 'deleteIcon'
|
||||
| 'tabsMode'
|
||||
| 'tabsStyle'
|
||||
| 'placeholder'
|
||||
> = {
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
multiple: false,
|
||||
|
@ -188,13 +206,19 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
|
||||
// combo 进来了新的值,且这次 form 初始化时带来的新值变化,但是之前的值已经 onInit 过了
|
||||
// 所以,之前 onInit 设置进去的初始值是过时了的。这个时候修复一下。
|
||||
if (nextProps.value !== props.value && !props.formInited && this.subFormDefaultValues.length) {
|
||||
this.subFormDefaultValues = this.subFormDefaultValues.map((item, index) => {
|
||||
if (
|
||||
nextProps.value !== props.value &&
|
||||
!props.formInited &&
|
||||
this.subFormDefaultValues.length
|
||||
) {
|
||||
this.subFormDefaultValues = this.subFormDefaultValues.map(
|
||||
(item, index) => {
|
||||
return {
|
||||
...item,
|
||||
values: values[index]
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -390,7 +414,10 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
setted: false
|
||||
});
|
||||
|
||||
if (syncDefaultValue === false || this.subFormDefaultValues.length !== this.subForms.length) {
|
||||
if (
|
||||
syncDefaultValue === false ||
|
||||
this.subFormDefaultValues.length !== this.subForms.length
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -429,11 +456,15 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
handleSingleFormInit(values: any) {
|
||||
const {syncDefaultValue, setPrinstineValue, value, nullable} = this.props;
|
||||
|
||||
|
||||
if (syncDefaultValue !== false && !nullable && isObjectShallowModified(value, values) && setPrinstineValue) {
|
||||
if (
|
||||
syncDefaultValue !== false &&
|
||||
!nullable &&
|
||||
isObjectShallowModified(value, values) &&
|
||||
setPrinstineValue
|
||||
) {
|
||||
setPrinstineValue({
|
||||
...values
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,17 +590,33 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
}
|
||||
|
||||
memoizedFormatValue = memoize(
|
||||
(strictMode: boolean, syncFields: Array<string> | void, value: any, index: number, data: any) => {
|
||||
(
|
||||
strictMode: boolean,
|
||||
syncFields: Array<string> | void,
|
||||
value: any,
|
||||
index: number,
|
||||
data: any
|
||||
) => {
|
||||
return createObject(
|
||||
extendObject(data, {index, __index: index, ...data}),
|
||||
{
|
||||
...value,
|
||||
...Array.isArray(syncFields) ? pickVars(data, syncFields!) : null
|
||||
...(Array.isArray(syncFields) ? pickVars(data, syncFields!) : null)
|
||||
}
|
||||
);
|
||||
},
|
||||
(strictMode: boolean, syncFields: Array<string> | void, value: any, index: number, data: any) =>
|
||||
Array.isArray(syncFields) ? JSON.stringify([value, index, data, pickVars(data, syncFields)]): strictMode ? JSON.stringify([value, index]) : JSON.stringify([value, index, data])
|
||||
(
|
||||
strictMode: boolean,
|
||||
syncFields: Array<string> | void,
|
||||
value: any,
|
||||
index: number,
|
||||
data: any
|
||||
) =>
|
||||
Array.isArray(syncFields)
|
||||
? JSON.stringify([value, index, data, pickVars(data, syncFields)])
|
||||
: strictMode
|
||||
? JSON.stringify([value, index])
|
||||
: JSON.stringify([value, index, data])
|
||||
);
|
||||
|
||||
formatValue(value: any, index: number = -1) {
|
||||
|
@ -583,7 +630,13 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
|
||||
value = value || this.defaultValue;
|
||||
|
||||
return this.memoizedFormatValue(strictMode !== false, syncFields, value, index, data);
|
||||
return this.memoizedFormatValue(
|
||||
strictMode !== false,
|
||||
syncFields,
|
||||
value,
|
||||
index,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
pickCondition(value: any): Condition | null {
|
||||
|
@ -638,7 +691,8 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
const {onChange} = this.props;
|
||||
onChange(null);
|
||||
|
||||
Array.isArray(this.subForms) && this.subForms.forEach(subForm => {
|
||||
Array.isArray(this.subForms) &&
|
||||
this.subForms.forEach(subForm => {
|
||||
subForm.clearErrors();
|
||||
});
|
||||
}
|
||||
|
@ -694,7 +748,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
|
||||
return (
|
||||
<CTabs
|
||||
className={"ComboTabs"}
|
||||
className={'ComboTabs'}
|
||||
mode={tabsStyle}
|
||||
activeKey={store.activeKey}
|
||||
onSelect={this.handleTabSelect}
|
||||
|
@ -724,7 +778,11 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
}
|
||||
)
|
||||
) : (
|
||||
<a onClick={this.addItem} data-position="left" data-tooltip="新增一条数据">
|
||||
<a
|
||||
onClick={this.addItem}
|
||||
data-position="left"
|
||||
data-tooltip="新增一条数据"
|
||||
>
|
||||
{addIcon ? <i className={cx('m-r-xs', addIcon)} /> : null}
|
||||
<span>{addButtonText || '新增'}</span>
|
||||
</a>
|
||||
|
@ -753,7 +811,11 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
data-tooltip="删除"
|
||||
data-position="bottom"
|
||||
>
|
||||
{deleteIcon ? <i className={deleteIcon} /> : <Icon icon="close" /> }
|
||||
{deleteIcon ? (
|
||||
<i className={deleteIcon} />
|
||||
) : (
|
||||
<Icon icon="close" />
|
||||
)}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
@ -891,12 +953,14 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
multiLine ? `Combo--ver` : `Combo--hor`,
|
||||
noBorder ? `Combo--noBorder` : '',
|
||||
disabled ? 'is-disabled' : '',
|
||||
(!disabled && draggable && Array.isArray(value) && value.length > 1) ? 'is-draggable' : '',
|
||||
!disabled && draggable && Array.isArray(value) && value.length > 1
|
||||
? 'is-draggable'
|
||||
: ''
|
||||
)}
|
||||
>
|
||||
<div className={cx(`Combo-items`)}>
|
||||
{Array.isArray(value) && value.length
|
||||
? value.map((value, index, thelist) => {
|
||||
{Array.isArray(value) && value.length ? (
|
||||
value.map((value, index, thelist) => {
|
||||
const toolbar: Array<any> = [];
|
||||
|
||||
// if (!disabled && draggable && thelist.length > 1) {
|
||||
|
@ -929,7 +993,11 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
data-tooltip="删除"
|
||||
data-position="bottom"
|
||||
>
|
||||
{deleteIcon ? <i className={deleteIcon} /> : <Icon icon="close" /> }
|
||||
{deleteIcon ? (
|
||||
<i className={deleteIcon} />
|
||||
) : (
|
||||
<Icon icon="close" />
|
||||
)}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
@ -964,7 +1032,11 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
data-tooltip="拖拽排序"
|
||||
data-position="bottom"
|
||||
>
|
||||
{dragIcon ? ( <i className={dragIcon} /> ): <Icon icon="combo-dragger"/> }
|
||||
{dragIcon ? (
|
||||
<i className={dragIcon} />
|
||||
) : (
|
||||
<Icon icon="combo-dragger" />
|
||||
)}
|
||||
</a>
|
||||
</div>
|
||||
) : null}
|
||||
|
@ -972,16 +1044,11 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
<div className={cx('Combo-itemTag')}>
|
||||
<label>类型</label>
|
||||
<Select
|
||||
onChange={this.handleComboTypeChange.bind(
|
||||
this,
|
||||
index
|
||||
)}
|
||||
options={(conditions as Array<Condition>).map(
|
||||
item => ({
|
||||
onChange={this.handleComboTypeChange.bind(this, index)}
|
||||
options={(conditions as Array<Condition>).map(item => ({
|
||||
label: item.label,
|
||||
value: item.label
|
||||
})
|
||||
)}
|
||||
}))}
|
||||
value={condition.label}
|
||||
clearable={false}
|
||||
/>
|
||||
|
@ -1027,7 +1094,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
</div>
|
||||
);
|
||||
})
|
||||
: placeholder ? (
|
||||
) : placeholder ? (
|
||||
<div className={cx(`Combo-placeholder`)}>{placeholder}</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
@ -1092,7 +1159,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
noBorder,
|
||||
disabled,
|
||||
typeSwitchable,
|
||||
nullable,
|
||||
nullable
|
||||
} = this.props;
|
||||
|
||||
let controls = this.props.controls;
|
||||
|
@ -1157,13 +1224,24 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
{value && nullable ? (<a className={cx('Combo-setNullBtn')} href="#" onClick={this.setNull}>清空数据</a>) : null}
|
||||
{value && nullable ? (
|
||||
<a className={cx('Combo-setNullBtn')} href="#" onClick={this.setNull}>
|
||||
清空数据
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {formInited, multiple, className, classPrefix: ns, classnames: cx, disabled} = this.props;
|
||||
const {
|
||||
formInited,
|
||||
multiple,
|
||||
className,
|
||||
classPrefix: ns,
|
||||
classnames: cx,
|
||||
disabled
|
||||
} = this.props;
|
||||
|
||||
return formInited ? (
|
||||
<div className={cx(`ComboControl`, className)}>
|
||||
|
|
|
@ -3,8 +3,11 @@ import {Renderer} from '../../factory';
|
|||
import cx from 'classnames';
|
||||
import Container from '../Container';
|
||||
import FormItem, {FormControlProps} from './Item';
|
||||
import {IIRendererStore} from '../../store/iRenderer';
|
||||
|
||||
export interface ContainerProps extends FormControlProps {}
|
||||
export interface ContainerProps extends FormControlProps {
|
||||
store: IIRendererStore;
|
||||
}
|
||||
|
||||
@FormItem({
|
||||
type: 'container',
|
||||
|
|
|
@ -6,8 +6,11 @@ import {FormItem, FormControlProps} from './Item';
|
|||
import pick from 'lodash/pick';
|
||||
import React from 'react';
|
||||
import cx from 'classnames';
|
||||
import {IIRendererStore} from '../../store/iRenderer';
|
||||
|
||||
export interface GridProps extends FormControlProps {}
|
||||
export interface GridProps extends FormControlProps {
|
||||
store: IIRendererStore;
|
||||
}
|
||||
const defaultHorizontal = {
|
||||
left: 'col-sm-4',
|
||||
right: 'col-sm-8',
|
||||
|
@ -36,13 +39,17 @@ export class GridRenderer extends Grid<GridProps> {
|
|||
if (node && !node.type && (node.controls || node.tabs || node.feildSet)) {
|
||||
return (
|
||||
<div className={cx(`Grid-form Form--${node.mode || 'normal'}`)}>
|
||||
{renderFormItems(node, ($path as string).replace(/^.*form\//, ''), {
|
||||
{renderFormItems(
|
||||
node as any,
|
||||
($path as string).replace(/^.*form\//, ''),
|
||||
{
|
||||
mode: node.mode || 'normal',
|
||||
horizontal: node.horizontal || defaultHorizontal,
|
||||
store,
|
||||
data: store.data,
|
||||
render
|
||||
})}
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,10 @@ import HBox from '../HBox';
|
|||
import {Schema} from '../../types';
|
||||
import cx from 'classnames';
|
||||
import {isVisible} from '../../utils/helper';
|
||||
import {IIRendererStore} from '../../store/iRenderer';
|
||||
|
||||
interface HBoxProps extends FormControlProps {
|
||||
size?: string;
|
||||
store: IIRendererStore;
|
||||
}
|
||||
|
||||
@FormItem({
|
||||
|
@ -53,7 +54,10 @@ export class HBoxRenderer extends React.Component<HBoxProps, any> {
|
|||
const {render, renderFormItems, formMode, store, $path} = this.props;
|
||||
|
||||
if (node && !node.type && (node.controls || node.tabs || node.feildSet)) {
|
||||
return renderFormItems(node, ($path as string).replace(/^.*form\//, ''), {
|
||||
return renderFormItems(
|
||||
node as any,
|
||||
($path as string).replace(/^.*form\//, ''),
|
||||
{
|
||||
mode: node.mode || 'normal',
|
||||
horizontal: node.horizontal || {
|
||||
left: 4,
|
||||
|
@ -63,7 +67,8 @@ export class HBoxRenderer extends React.Component<HBoxProps, any> {
|
|||
store,
|
||||
data: store.data,
|
||||
render
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return render(region, node.body || node);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import cx from 'classnames';
|
||||
// @ts-ignore
|
||||
import matchSorter from 'match-sorter';
|
||||
import keycode from 'keycode';
|
||||
import Downshift, {StateChangeOptions} from 'downshift';
|
||||
|
|
|
@ -11,10 +11,11 @@ import {
|
|||
import cx from 'classnames';
|
||||
import getExprProperties from '../../utils/filter-schema';
|
||||
import {FormItem, FormControlProps} from './Item';
|
||||
import {IFormStore} from '../../store/form';
|
||||
|
||||
export interface InputGroupProps extends FormControlProps {
|
||||
controls: Array<any>;
|
||||
size?: 'xs' | 'sm' | 'normal';
|
||||
formStore: IFormStore;
|
||||
}
|
||||
|
||||
interface InputGroupState {
|
||||
|
@ -115,7 +116,8 @@ export class InputGroup extends React.Component<
|
|||
});
|
||||
|
||||
let horizontalDeeper =
|
||||
horizontal || makeHorizontalDeeper(formHorizontal, controls.length);
|
||||
horizontal ||
|
||||
makeHorizontalDeeper(formHorizontal as any, controls.length);
|
||||
return (
|
||||
<div
|
||||
className={cx(`InputGroup`, className, {
|
||||
|
|
|
@ -770,8 +770,8 @@ export function asFormItem(config: Omit<FormItemConfig, 'component'>) {
|
|||
delete config.storeType;
|
||||
}
|
||||
|
||||
// @observer
|
||||
class FormItemRenderer extends FormItemWrap {
|
||||
return hoistNonReactStatic(
|
||||
class extends FormItemWrap {
|
||||
static defaultProps = {
|
||||
className: '',
|
||||
renderLabel: config.renderLabel,
|
||||
|
@ -877,10 +877,9 @@ export function asFormItem(config: Omit<FormItemConfig, 'component'>) {
|
|||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
hoistNonReactStatic(FormItemRenderer, Control);
|
||||
return FormItemRenderer;
|
||||
},
|
||||
Control
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ export default class NestedSelectControl extends React.Component<
|
|||
)
|
||||
? xorBy
|
||||
: unionBy;
|
||||
newValue = fn(items, option, valueField || 'value');
|
||||
newValue = fn(items, option as any, valueField || 'value');
|
||||
} else {
|
||||
newValue = items.filter(
|
||||
item =>
|
||||
|
@ -406,10 +406,10 @@ export default class NestedSelectControl extends React.Component<
|
|||
>
|
||||
<Icon icon="search" className="icon" />
|
||||
<Input
|
||||
value={this.state.inputValue}
|
||||
value={this.state.inputValue || ''}
|
||||
onFocus={this.onFocus}
|
||||
onBlur={this.onBlur}
|
||||
disabled={disabled}
|
||||
disabled={disabled!!}
|
||||
placeholder={searchPromptText}
|
||||
onChange={this.handleInputChange}
|
||||
ref={this.inputRef}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import {FormItem, FormControlProps} from './Item';
|
||||
import cx from 'classnames';
|
||||
// @ts-ignore
|
||||
import InputNumber from 'rc-input-number';
|
||||
import {filter} from '../../utils/tpl';
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ export default class RatingControl extends React.Component<RatingProps, any> {
|
|||
count={count}
|
||||
half={half}
|
||||
readOnly={readOnly}
|
||||
size={size}
|
||||
onChange={(value: any) => onChange(value)}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -84,7 +84,7 @@ const eighties = {
|
|||
}
|
||||
};
|
||||
|
||||
const themes = {
|
||||
const themes: any = {
|
||||
twilight,
|
||||
eighties
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ export class OperationField extends React.Component<OperationProps, object> {
|
|||
level:
|
||||
button.level ||
|
||||
(button.icon && !button.label ? 'link' : ''),
|
||||
...button
|
||||
...(button as any)
|
||||
},
|
||||
{
|
||||
key: index
|
||||
|
|
|
@ -3,6 +3,7 @@ import cx from 'classnames';
|
|||
import {Renderer, RendererProps} from '../factory';
|
||||
import {FormItem, FormControlProps} from './Form/Item';
|
||||
import {filter} from '../utils/tpl';
|
||||
// @ts-ignore
|
||||
import QrCode from 'qrcode.react';
|
||||
|
||||
export interface QRCodeProps extends FormControlProps {
|
||||
|
|
|
@ -28,7 +28,7 @@ export interface ServiceProps extends RendererProps {
|
|||
};
|
||||
}
|
||||
export default class Service extends React.Component<ServiceProps> {
|
||||
timer: number;
|
||||
timer: NodeJS.Timeout;
|
||||
mounted: boolean;
|
||||
|
||||
static defaultProps: Partial<ServiceProps> = {
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
/* eslint fecs-indent: [0, "space", 2, 2] */
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
Player,
|
||||
Shortcut,
|
||||
BigPlayButton,
|
||||
ControlBar,
|
||||
PlaybackRateMenuButton
|
||||
// @ts-ignore
|
||||
} from 'video-react';
|
||||
import {padArr} from '../utils/helper';
|
||||
import cx from 'classnames';
|
||||
|
@ -315,10 +317,9 @@ export default class Video extends React.Component<VideoProps, VideoState> {
|
|||
const rect = item.getBoundingClientRect();
|
||||
this.cursorDom.setAttribute(
|
||||
'style',
|
||||
`width: ${rect.width - 4}px; height: ${rect.height -
|
||||
4}px; left: ${rect.left + 2 - frameRect.left}px; top: ${rect.top +
|
||||
2 -
|
||||
frameRect.top}px;`
|
||||
`width: ${rect.width - 4}px; height: ${rect.height - 4}px; left: ${
|
||||
rect.left + 2 - frameRect.left
|
||||
}px; top: ${rect.top + 2 - frameRect.top}px;`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -405,14 +406,16 @@ export default class Video extends React.Component<VideoProps, VideoState> {
|
|||
</div>
|
||||
))}
|
||||
|
||||
{/* 补充空白 */ restCount
|
||||
{
|
||||
/* 补充空白 */ restCount
|
||||
? blankArray.map((_, index) => (
|
||||
<div
|
||||
className={`${ns}Hbox-col Wrapper--xxs`}
|
||||
key={`blank_${index}`}
|
||||
/>
|
||||
))
|
||||
: null}
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -333,6 +333,7 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
|
|||
|
||||
console.error(e.stack);
|
||||
root.notify('error', e.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ export const ServiceStore = iRendererStore
|
|||
markFetching(false);
|
||||
e.stack && console.error(e.stack);
|
||||
root.notify('error', e.message || e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -234,6 +235,7 @@ export const ServiceStore = iRendererStore
|
|||
markFetching(false);
|
||||
e.stack && console.error(e.stack);
|
||||
root.notify('error', e.message || e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ export function themeable<
|
|||
classnames?: ClassNamesFn;
|
||||
};
|
||||
|
||||
class EnhancedComponent extends React.Component<Props> {
|
||||
const result = hoistNonReactStatic(
|
||||
class extends React.Component<Props> {
|
||||
static displayName = `Themeable(${
|
||||
ComposedComponent.displayName || ComposedComponent.name
|
||||
})`;
|
||||
|
@ -135,7 +136,9 @@ export function themeable<
|
|||
|
||||
render() {
|
||||
const theme: string = this.props.theme || this.context || defaultTheme;
|
||||
const config = hasTheme(theme) ? getTheme(theme) : getTheme(defaultTheme);
|
||||
const config = hasTheme(theme)
|
||||
? getTheme(theme)
|
||||
: getTheme(defaultTheme);
|
||||
const injectedProps: {
|
||||
classPrefix: string;
|
||||
classnames: ClassNamesFn;
|
||||
|
@ -155,9 +158,9 @@ export function themeable<
|
|||
</ThemeContext.Provider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const result = hoistNonReactStatic(EnhancedComponent, ComposedComponent);
|
||||
},
|
||||
ComposedComponent
|
||||
);
|
||||
|
||||
return result as typeof result & {
|
||||
ComposedComponent: T;
|
||||
|
|
|
@ -70,7 +70,7 @@ function getContainerDimensions(containerNode: any) {
|
|||
getScrollTop(ownerDocument(containerNode).documentElement) ||
|
||||
getScrollTop(containerNode);
|
||||
} else {
|
||||
({width, height} = getOffset(containerNode));
|
||||
({width, height} = getOffset(containerNode) as any);
|
||||
scroll = getScrollTop(containerNode);
|
||||
}
|
||||
|
||||
|
@ -144,11 +144,13 @@ export function calculatePosition(
|
|||
container: any,
|
||||
padding: any = 0
|
||||
) {
|
||||
const childOffset =
|
||||
const childOffset: any =
|
||||
container.tagName === 'BODY'
|
||||
? getOffset(target)
|
||||
: getPosition(target, container);
|
||||
const {height: overlayHeight, width: overlayWidth} = getOffset(overlayNode);
|
||||
const {height: overlayHeight, width: overlayWidth} = getOffset(
|
||||
overlayNode
|
||||
) as any;
|
||||
|
||||
const clip = container.getBoundingClientRect();
|
||||
const clip2 = overlayNode.getBoundingClientRect();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function property2control(property: any, key: any, schema: any) {
|
||||
const requiredList = schema.required || [];
|
||||
const rest = {};
|
||||
const validations = {};
|
||||
const rest: any = {};
|
||||
const validations: any = {};
|
||||
let type = 'text';
|
||||
|
||||
if (property.type === 'integer') {
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
"outDir": "output/",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es6", "dom"],
|
||||
"sourceMap": true,
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
|
@ -21,14 +18,10 @@
|
|||
"strictNullChecks": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./types"
|
||||
]
|
||||
"typeRoots": ["./node_modules/@types", "./types"],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"build",
|
||||
|
@ -37,7 +30,5 @@
|
|||
"webpack",
|
||||
"jest"
|
||||
],
|
||||
"types": [
|
||||
"typePatches"
|
||||
]
|
||||
"types": ["typePatches"]
|
||||
}
|
Loading…
Reference in New Issue