amis 1.8.0-beta.3 → 1.8.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AssociatedSelection.js +9 -2
- package/lib/components/AssociatedSelection.js.map +2 -2
- package/lib/components/Checkbox.d.ts +24 -23
- package/lib/components/Checkbox.js +6 -2
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +2 -0
- package/lib/components/DateRangePicker.js +61 -2
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Radios.d.ts +21 -21
- package/lib/components/calendar/Calendar.js +2 -14
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/factory.js +4 -1
- package/lib/factory.js.map +2 -2
- package/lib/index.js +1 -1
- package/lib/renderers/CRUD.d.ts +8 -0
- package/lib/renderers/CRUD.js +11 -4
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Form/Checkbox.d.ts +5 -2
- package/lib/renderers/Form/Checkbox.js +2 -2
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.d.ts +5 -0
- package/lib/renderers/Form/Checkboxes.js +99 -6
- package/lib/renderers/Form/Checkboxes.js.map +2 -2
- package/lib/renderers/Form/Item.js +3 -1
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/index.d.ts +1 -0
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +1 -0
- package/lib/renderers/Table/index.js +3 -2
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +33 -7
- package/lib/store/crud.js.map +2 -2
- package/lib/store/formItem.js +1 -1
- package/lib/store/formItem.js.map +2 -2
- package/lib/themes/ang-ie11.css +120 -3
- package/lib/themes/ang.css +127 -2
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +120 -3
- package/lib/themes/antd.css +127 -2
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +120 -3
- package/lib/themes/cxd.css +127 -2
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +120 -3
- package/lib/themes/dark.css +127 -2
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +120 -3
- package/lib/themes/default.css +127 -2
- package/lib/themes/default.css.map +1 -1
- package/package.json +1 -1
- package/schema.json +76 -7
- package/scss/_properties.scss +10 -1
- package/scss/components/form/_checks.scss +122 -1
- package/scss/components/form/_form.scss +16 -0
- package/sdk/ang-ie11.css +143 -3
- package/sdk/ang.css +150 -2
- package/sdk/antd-ie11.css +143 -3
- package/sdk/antd.css +150 -2
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +143 -3
- package/sdk/cxd.css +150 -2
- package/sdk/dark-ie11.css +143 -3
- package/sdk/dark.css +150 -2
- package/sdk/exceljs.js +1 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +17 -17
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +143 -3
- package/sdk/sdk.css +150 -2
- package/sdk/sdk.js +1247 -1247
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/components/AssociatedSelection.tsx +9 -3
- package/src/components/Checkbox.tsx +11 -5
- package/src/components/DateRangePicker.tsx +97 -2
- package/src/components/calendar/Calendar.tsx +2 -15
- package/src/factory.tsx +4 -1
- package/src/renderers/CRUD.tsx +22 -4
- package/src/renderers/Form/Checkbox.tsx +11 -2
- package/src/renderers/Form/Checkboxes.tsx +101 -5
- package/src/renderers/Form/Item.tsx +1 -0
- package/src/renderers/Form/index.tsx +1 -0
- package/src/renderers/Table/index.tsx +4 -2
- package/src/store/crud.ts +40 -5
- package/src/store/formItem.ts +1 -2
@@ -51,8 +51,15 @@ var AssociatedSelection = /** @class */ (function (_super) {
|
|
51
51
|
}
|
52
52
|
};
|
53
53
|
AssociatedSelection.prototype.handleLeftDeferLoad = function (option) {
|
54
|
-
var _a = this.props, leftOptions = _a.leftOptions, onLeftDeferLoad = _a.onLeftDeferLoad;
|
55
|
-
|
54
|
+
var _a = this.props, leftOptions = _a.leftOptions, onLeftDeferLoad = _a.onLeftDeferLoad, onDeferLoad = _a.onDeferLoad;
|
55
|
+
if (typeof onLeftDeferLoad === 'function') {
|
56
|
+
// TabsTransfer
|
57
|
+
return onLeftDeferLoad === null || onLeftDeferLoad === void 0 ? void 0 : onLeftDeferLoad(option, leftOptions);
|
58
|
+
}
|
59
|
+
else if (typeof onDeferLoad === 'function') {
|
60
|
+
// Select
|
61
|
+
return onDeferLoad === null || onDeferLoad === void 0 ? void 0 : onDeferLoad(option);
|
62
|
+
}
|
56
63
|
};
|
57
64
|
AssociatedSelection.prototype.handleRetry = function (option) {
|
58
65
|
var onDeferLoad = this.props.onDeferLoad;
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/components/AssociatedSelection.tsx"
|
7
7
|
],
|
8
8
|
"names": [],
|
9
|
-
"mappings": ";AAAA;;;;GAIG;;;;AAEH,6DAA0B;AAC1B,yCAA8D;AAC9D,mCAAyC;AACzC,0CAAyC;AACzC,kCAAmC;AACnC,iDAA8C;AAC9C,qFAAkD;AAClD,iFAA8C;AAC9C,+EAA4C;AAC5C,qFAAiD;AACjD,qFAAkD;AAClD,iCAA6B;AAC7B,oCAAqC;AAwBrC;IAAyC,oDAGxC;IAHD;QAAA,
|
9
|
+
"mappings": ";AAAA;;;;GAIG;;;;AAEH,6DAA0B;AAC1B,yCAA8D;AAC9D,mCAAyC;AACzC,0CAAyC;AACzC,kCAAmC;AACnC,iDAA8C;AAC9C,qFAAkD;AAClD,iFA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AAQ,EAClB,UAAU,EAAE,UAAU,GACtB,CACH,CACF,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAC1C,EAAE,CAAC,sBAAsB,CAAC,CACvB,CACP,CACF,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAC1C,EAAE,CAAC,yBAAyB,CAAC,CAC1B,CACP,CACG,CACF,CACP,CAAC;IACJ,CAAC;;IAzKD;QADC,iBAAQ;;0EACgB,eAAM,oBAAN,eAAM;;+DAE9B;IAGD;QADC,iBAAQ;;0EACe,eAAM,oBAAN,eAAM;;+DAa7B;IAGD;QADC,iBAAQ;;0EACmB,eAAM,oBAAN,eAAM;;kEAUjC;IA2IH,0BAAC;CAAA,AApMD,CAAyC,yBAAa,GAoMrD;AApMY,kDAAmB;AAsMhC,kBAAe,IAAA,iBAAS,EACtB,IAAA,mBAAU,EACR,IAAA,+BAAc,EAAC,mBAAmB,EAAE;IAClC,KAAK,EAAE,UAAU;CAClB,CAAC,CACH,CACF,CAAC",
|
10
10
|
"sourcesContent": [
|
11
|
-
"/**\n * 关联多选框,仅支持两层关联选择。\n * 左边先点选,然后右边再次点选。\n * 可以满足,先从 tree 中选中一个元素,然后查出来一个列表再次勾选。\n */\n\nimport React from 'react';\nimport {BaseSelectionProps, BaseSelection} from './Selection';\nimport {Options, Option} from './Select';\nimport {autobind} from '../utils/helper';\nimport {themeable} from '../theme';\nimport {uncontrollable} from 'uncontrollable';\nimport GroupedSelection from './GroupedSelection';\nimport TableSelection from './TableSelection';\nimport TreeSelection from './TreeSelection';\nimport GroupedSelecton from './GroupedSelection';\nimport ChainedSelection from './ChainedSelection';\nimport {Icon} from './icons';\nimport {localeable} from '../locale';\n\nexport interface AssociatedSelectionProps extends BaseSelectionProps {\n leftOptions: Options;\n leftDefaultValue?: any;\n leftMode?: 'tree' | 'list' | 'group';\n rightMode?: 'table' | 'list' | 'group' | 'tree' | 'chained';\n columns?: Array<any>;\n cellRender?: (\n column: {\n name: string;\n label: string;\n [propName: string]: any;\n },\n option: Option,\n colIndex: number,\n rowIndex: number\n ) => JSX.Element;\n}\n\nexport interface AssociatedSelectionState {\n leftValue?: Option;\n}\n\nexport class AssociatedSelection extends BaseSelection<\n AssociatedSelectionProps,\n AssociatedSelectionState\n> {\n state: AssociatedSelectionState = {\n leftValue: this.props.leftDefaultValue\n };\n\n componentDidMount() {\n const leftValue = this.state.leftValue;\n const {options, onDeferLoad} = this.props;\n\n if (leftValue) {\n const selectdOption = BaseSelection.resolveSelected(\n leftValue,\n options,\n (option: Option) => option.ref\n );\n\n if (selectdOption && onDeferLoad && selectdOption.defer) {\n onDeferLoad(selectdOption);\n }\n }\n }\n\n @autobind\n leftOption2Value(option: Option) {\n return option.value;\n }\n\n @autobind\n handleLeftSelect(value: Option) {\n const {options, onDeferLoad} = this.props;\n this.setState({leftValue: value});\n\n const selectdOption = BaseSelection.resolveSelected(\n value,\n options,\n (option: Option) => option.ref\n );\n\n if (selectdOption && onDeferLoad && selectdOption.defer) {\n onDeferLoad(selectdOption);\n }\n }\n\n @autobind\n handleLeftDeferLoad(option: Option) {\n const {leftOptions, onLeftDeferLoad} = this.props;\n\n onLeftDeferLoad?.(option, leftOptions);\n }\n\n handleRetry(option: Option) {\n const {onDeferLoad} = this.props;\n onDeferLoad?.(option);\n }\n\n render() {\n const {\n classnames: cx,\n className,\n leftOptions,\n options,\n option2value,\n rightMode,\n onChange,\n columns,\n value,\n disabled,\n leftMode,\n cellRender,\n multiple,\n itemRender\n } = this.props;\n\n const selectdOption = BaseSelection.resolveSelected(\n this.state.leftValue,\n options,\n (option: Option) => option.ref\n );\n const __ = this.props.translate;\n\n return (\n <div className={cx('AssociatedSelection', className)}>\n <div className={cx('AssociatedSelection-left')}>\n {leftMode === 'tree' ? (\n <TreeSelection\n option2value={this.leftOption2Value}\n options={leftOptions}\n value={this.state.leftValue}\n disabled={disabled}\n onChange={this.handleLeftSelect}\n multiple={false}\n clearable={false}\n onDeferLoad={this.handleLeftDeferLoad}\n />\n ) : (\n <GroupedSelecton\n option2value={this.leftOption2Value}\n options={leftOptions}\n value={this.state.leftValue}\n disabled={disabled}\n onChange={this.handleLeftSelect}\n multiple={false}\n clearable={false}\n />\n )}\n </div>\n <div className={cx('AssociatedSelection-right')}>\n {this.state.leftValue ? (\n selectdOption ? (\n selectdOption.defer && !selectdOption.loaded ? (\n <div className={cx('AssociatedSelection-box')}>\n <div\n className={cx(\n 'AssociatedSelection-reload',\n selectdOption.loading ? 'is-spin' : 'is-clickable'\n )}\n onClick={\n selectdOption.loading\n ? undefined\n : this.handleRetry.bind(this, selectdOption)\n }\n >\n <Icon icon=\"reload\" className=\"icon\" />\n </div>\n\n {selectdOption.loading ? (\n <p>{__('loading')}</p>\n ) : (\n <p>{__('Transfer.refreshIcon')}</p>\n )}\n </div>\n ) : rightMode === 'table' ? (\n <TableSelection\n columns={columns!}\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n cellRender={cellRender}\n multiple={multiple}\n />\n ) : rightMode === 'tree' ? (\n <TreeSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n ) : rightMode === 'chained' ? (\n <ChainedSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n ) : (\n <GroupedSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n )\n ) : (\n <div className={cx('AssociatedSelection-box')}>\n {__('Transfer.configError')}\n </div>\n )\n ) : (\n <div className={cx('AssociatedSelection-box')}>\n {__('Transfer.selectFromLeft')}\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default themeable(\n localeable(\n uncontrollable(AssociatedSelection, {\n value: 'onChange'\n })\n )\n);\n"
|
11
|
+
"/**\n * 关联多选框,仅支持两层关联选择。\n * 左边先点选,然后右边再次点选。\n * 可以满足,先从 tree 中选中一个元素,然后查出来一个列表再次勾选。\n */\n\nimport React from 'react';\nimport {BaseSelectionProps, BaseSelection} from './Selection';\nimport {Options, Option} from './Select';\nimport {autobind} from '../utils/helper';\nimport {themeable} from '../theme';\nimport {uncontrollable} from 'uncontrollable';\nimport GroupedSelection from './GroupedSelection';\nimport TableSelection from './TableSelection';\nimport TreeSelection from './TreeSelection';\nimport GroupedSelecton from './GroupedSelection';\nimport ChainedSelection from './ChainedSelection';\nimport {Icon} from './icons';\nimport {localeable} from '../locale';\n\nexport interface AssociatedSelectionProps extends BaseSelectionProps {\n leftOptions: Options;\n leftDefaultValue?: any;\n leftMode?: 'tree' | 'list' | 'group';\n rightMode?: 'table' | 'list' | 'group' | 'tree' | 'chained';\n columns?: Array<any>;\n cellRender?: (\n column: {\n name: string;\n label: string;\n [propName: string]: any;\n },\n option: Option,\n colIndex: number,\n rowIndex: number\n ) => JSX.Element;\n}\n\nexport interface AssociatedSelectionState {\n leftValue?: Option;\n}\n\nexport class AssociatedSelection extends BaseSelection<\n AssociatedSelectionProps,\n AssociatedSelectionState\n> {\n state: AssociatedSelectionState = {\n leftValue: this.props.leftDefaultValue\n };\n\n componentDidMount() {\n const leftValue = this.state.leftValue;\n const {options, onDeferLoad} = this.props;\n\n if (leftValue) {\n const selectdOption = BaseSelection.resolveSelected(\n leftValue,\n options,\n (option: Option) => option.ref\n );\n\n if (selectdOption && onDeferLoad && selectdOption.defer) {\n onDeferLoad(selectdOption);\n }\n }\n }\n\n @autobind\n leftOption2Value(option: Option) {\n return option.value;\n }\n\n @autobind\n handleLeftSelect(value: Option) {\n const {options, onDeferLoad} = this.props;\n this.setState({leftValue: value});\n\n const selectdOption = BaseSelection.resolveSelected(\n value,\n options,\n (option: Option) => option.ref\n );\n\n if (selectdOption && onDeferLoad && selectdOption.defer) {\n onDeferLoad(selectdOption);\n }\n }\n\n @autobind\n handleLeftDeferLoad(option: Option) {\n const {leftOptions, onLeftDeferLoad, onDeferLoad} = this.props;\n\n if (typeof onLeftDeferLoad === 'function') {\n // TabsTransfer\n return onLeftDeferLoad?.(option, leftOptions);\n } else if (typeof onDeferLoad === 'function') {\n // Select\n return onDeferLoad?.(option);\n }\n }\n\n handleRetry(option: Option) {\n const {onDeferLoad} = this.props;\n onDeferLoad?.(option);\n }\n\n render() {\n const {\n classnames: cx,\n className,\n leftOptions,\n options,\n option2value,\n rightMode,\n onChange,\n columns,\n value,\n disabled,\n leftMode,\n cellRender,\n multiple,\n itemRender\n } = this.props;\n\n const selectdOption = BaseSelection.resolveSelected(\n this.state.leftValue,\n options,\n (option: Option) => option.ref\n );\n const __ = this.props.translate;\n\n return (\n <div className={cx('AssociatedSelection', className)}>\n <div className={cx('AssociatedSelection-left')}>\n {leftMode === 'tree' ? (\n <TreeSelection\n option2value={this.leftOption2Value}\n options={leftOptions}\n value={this.state.leftValue}\n disabled={disabled}\n onChange={this.handleLeftSelect}\n multiple={false}\n clearable={false}\n onDeferLoad={this.handleLeftDeferLoad}\n />\n ) : (\n <GroupedSelecton\n option2value={this.leftOption2Value}\n options={leftOptions}\n value={this.state.leftValue}\n disabled={disabled}\n onChange={this.handleLeftSelect}\n multiple={false}\n clearable={false}\n />\n )}\n </div>\n <div className={cx('AssociatedSelection-right')}>\n {this.state.leftValue ? (\n selectdOption ? (\n selectdOption.defer && !selectdOption.loaded ? (\n <div className={cx('AssociatedSelection-box')}>\n <div\n className={cx(\n 'AssociatedSelection-reload',\n selectdOption.loading ? 'is-spin' : 'is-clickable'\n )}\n onClick={\n selectdOption.loading\n ? undefined\n : this.handleRetry.bind(this, selectdOption)\n }\n >\n <Icon icon=\"reload\" className=\"icon\" />\n </div>\n\n {selectdOption.loading ? (\n <p>{__('loading')}</p>\n ) : (\n <p>{__('Transfer.refreshIcon')}</p>\n )}\n </div>\n ) : rightMode === 'table' ? (\n <TableSelection\n columns={columns!}\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n cellRender={cellRender}\n multiple={multiple}\n />\n ) : rightMode === 'tree' ? (\n <TreeSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n ) : rightMode === 'chained' ? (\n <ChainedSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n ) : (\n <GroupedSelection\n value={value}\n disabled={disabled}\n options={selectdOption.children || []}\n onChange={onChange}\n option2value={option2value}\n multiple={multiple}\n itemRender={itemRender}\n />\n )\n ) : (\n <div className={cx('AssociatedSelection-box')}>\n {__('Transfer.configError')}\n </div>\n )\n ) : (\n <div className={cx('AssociatedSelection-box')}>\n {__('Transfer.selectFromLeft')}\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default themeable(\n localeable(\n uncontrollable(AssociatedSelection, {\n value: 'onChange'\n })\n )\n);\n"
|
12
12
|
]
|
13
13
|
}
|
@@ -12,10 +12,10 @@ interface CheckboxProps {
|
|
12
12
|
labelClassName?: string;
|
13
13
|
className?: string;
|
14
14
|
onChange?: (value: any, shift?: boolean) => void;
|
15
|
-
value?:
|
15
|
+
value?: boolean | string | number;
|
16
16
|
inline?: boolean;
|
17
|
-
trueValue?:
|
18
|
-
falseValue?:
|
17
|
+
trueValue?: boolean | string | number;
|
18
|
+
falseValue?: boolean | string | number;
|
19
19
|
disabled?: boolean;
|
20
20
|
readOnly?: boolean;
|
21
21
|
checked?: boolean;
|
@@ -24,6 +24,7 @@ interface CheckboxProps {
|
|
24
24
|
classPrefix: string;
|
25
25
|
classnames: ClassNamesFn;
|
26
26
|
partial?: boolean;
|
27
|
+
optionType?: 'default' | 'button';
|
27
28
|
}
|
28
29
|
export declare class Checkbox extends React.Component<CheckboxProps, any> {
|
29
30
|
static defaultProps: Pick<CheckboxProps, 'trueValue' | 'falseValue' | 'type'>;
|
@@ -31,12 +32,12 @@ export declare class Checkbox extends React.Component<CheckboxProps, any> {
|
|
31
32
|
render(): JSX.Element;
|
32
33
|
}
|
33
34
|
declare const _default: {
|
34
|
-
new (props: (Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps) | Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>): {
|
35
|
+
new (props: (Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps) | Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>): {
|
35
36
|
render(): JSX.Element;
|
36
37
|
context: any;
|
37
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
38
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
38
39
|
forceUpdate(callback?: (() => void) | undefined): void;
|
39
|
-
readonly props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps> & Readonly<{
|
40
|
+
readonly props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps> & Readonly<{
|
40
41
|
children?: React.ReactNode;
|
41
42
|
}>;
|
42
43
|
state: Readonly<{}>;
|
@@ -44,24 +45,24 @@ declare const _default: {
|
|
44
45
|
[key: string]: React.ReactInstance;
|
45
46
|
};
|
46
47
|
componentDidMount?(): void;
|
47
|
-
shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
48
|
+
shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
48
49
|
componentWillUnmount?(): void;
|
49
50
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
50
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
51
|
-
componentDidUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
51
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
52
|
+
componentDidUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
52
53
|
componentWillMount?(): void;
|
53
54
|
UNSAFE_componentWillMount?(): void;
|
54
|
-
componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
55
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
56
|
-
componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
57
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
55
|
+
componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
56
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
57
|
+
componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
58
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
58
59
|
};
|
59
|
-
new (props: Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps, context: any): {
|
60
|
+
new (props: Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps, context: any): {
|
60
61
|
render(): JSX.Element;
|
61
62
|
context: any;
|
62
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
63
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
63
64
|
forceUpdate(callback?: (() => void) | undefined): void;
|
64
|
-
readonly props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps> & Readonly<{
|
65
|
+
readonly props: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps> & Readonly<{
|
65
66
|
children?: React.ReactNode;
|
66
67
|
}>;
|
67
68
|
state: Readonly<{}>;
|
@@ -69,17 +70,17 @@ declare const _default: {
|
|
69
70
|
[key: string]: React.ReactInstance;
|
70
71
|
};
|
71
72
|
componentDidMount?(): void;
|
72
|
-
shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
73
|
+
shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
73
74
|
componentWillUnmount?(): void;
|
74
75
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
75
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
76
|
-
componentDidUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
76
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
77
|
+
componentDidUpdate?(prevProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
77
78
|
componentWillMount?(): void;
|
78
79
|
UNSAFE_componentWillMount?(): void;
|
79
|
-
componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
80
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
81
|
-
componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
82
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
80
|
+
componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
81
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextContext: any): void;
|
82
|
+
componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
83
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "label" | "value" | "description" | "disabled" | "checked" | "name" | "size" | "inline" | "readOnly" | "onChange" | "labelClassName" | "partial" | "optionType"> & Partial<Pick<Omit<CheckboxProps, keyof import("../theme").ThemeProps>, "type" | "trueValue" | "falseValue">> & Partial<Pick<Pick<CheckboxProps, "type" | "trueValue" | "falseValue">, never>> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
83
84
|
};
|
84
85
|
displayName: string;
|
85
86
|
contextType: React.Context<string>;
|
@@ -24,11 +24,15 @@ var Checkbox = /** @class */ (function (_super) {
|
|
24
24
|
};
|
25
25
|
Checkbox.prototype.render = function () {
|
26
26
|
var _a;
|
27
|
-
var _b = this.props, size = _b.size, className = _b.className, cx = _b.classnames, value = _b.value, label = _b.label, partial = _b.partial, trueValue = _b.trueValue, children = _b.children, disabled = _b.disabled, description = _b.description, readOnly = _b.readOnly, checked = _b.checked, type = _b.type, name = _b.name, labelClassName = _b.labelClassName;
|
27
|
+
var _b = this.props, size = _b.size, className = _b.className, cx = _b.classnames, value = _b.value, label = _b.label, partial = _b.partial, trueValue = _b.trueValue, children = _b.children, disabled = _b.disabled, description = _b.description, readOnly = _b.readOnly, checked = _b.checked, type = _b.type, name = _b.name, labelClassName = _b.labelClassName, optionType = _b.optionType;
|
28
28
|
return (react_1.default.createElement("label", { className: cx("Checkbox Checkbox--".concat(type), className, (_a = {
|
29
|
-
'Checkbox--full': !partial
|
29
|
+
'Checkbox--full': !partial,
|
30
|
+
'Checkbox--partial': partial
|
30
31
|
},
|
31
32
|
_a["Checkbox--".concat(size)] = size,
|
33
|
+
_a['Checkbox--button'] = optionType === 'button',
|
34
|
+
_a['Checkbox--button--checked'] = optionType === 'button' && checked,
|
35
|
+
_a['Checkbox--button--disabled--unchecked'] = disabled && !checked,
|
32
36
|
_a)) },
|
33
37
|
react_1.default.createElement("input", { type: type, checked: typeof checked !== 'undefined'
|
34
38
|
? checked
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/components/Checkbox.tsx"
|
7
7
|
],
|
8
8
|
"names": [],
|
9
|
-
"mappings": ";AAAA;;;GAGG;;;;AAEH,6DAA0B;AAC1B,kCAAiD;AACjD,0CAAyC;AAEzC,IAAM,YAAY,GAAG,UAAC,CAAM,IAAK,OAAA,CAAC,CAAC,eAAe,EAAE,EAAnB,CAAmB,CAAC;
|
9
|
+
"mappings": ";AAAA;;;GAGG;;;;AAEH,6DAA0B;AAC1B,kCAAiD;AACjD,0CAAyC;AAEzC,IAAM,YAAY,GAAG,UAAC,CAAM,IAAK,OAAA,CAAC,CAAC,eAAe,EAAE,EAAnB,CAAmB,CAAC;AAwBrD;IAA8B,yCAAmC;IAAjE;;IAgFA,CAAC;IArEC,8BAAW,GAAX,UAAY,CAAyB;QAC7B,IAAA,KAAoC,IAAI,CAAC,KAAK,EAA7C,SAAS,eAAA,EAAE,UAAU,gBAAA,EAAE,QAAQ,cAAc,CAAC;QAErD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;SACR;QAED,QAAQ,CACN,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAC/C,CAAC,CAAC,WAA0B,CAAC,QAAQ,CACvC,CAAC;IACJ,CAAC;IAED,yBAAM,GAAN;;QACM,IAAA,KAiBA,IAAI,CAAC,KAAK,EAhBZ,IAAI,UAAA,EACJ,SAAS,eAAA,EACG,EAAE,gBAAA,EACd,KAAK,WAAA,EACL,KAAK,WAAA,EACL,OAAO,aAAA,EACP,SAAS,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QADC,iBAAQ;;0EACM,eAAK,oBAAL,eAAK,CAAC,WAAW;;+CAW/B;IA0DH,eAAC;CAAA,AAhFD,CAA8B,eAAK,CAAC,SAAS,GAgF5C;AAhFY,4BAAQ;AAkFrB,kBAAe,IAAA,iBAAS,EAAC,QAAQ,CAAC,CAAC",
|
10
10
|
"sourcesContent": [
|
11
|
-
"/**\n * @file Checkbox\n * @author fex\n */\n\nimport React from 'react';\nimport {ClassNamesFn, themeable} from '../theme';\nimport {autobind} from '../utils/helper';\n\nconst preventEvent = (e: any) => e.stopPropagation();\n\ninterface CheckboxProps {\n type: 'checkbox' | 'radio';\n size?: 'sm' | 'lg' | 'small' | 'large';\n label?: string;\n labelClassName?: string;\n className?: string;\n onChange?: (value: any, shift?: boolean) => void;\n value?:
|
11
|
+
"/**\n * @file Checkbox\n * @author fex\n */\n\nimport React from 'react';\nimport {ClassNamesFn, themeable} from '../theme';\nimport {autobind} from '../utils/helper';\n\nconst preventEvent = (e: any) => e.stopPropagation();\n\ninterface CheckboxProps {\n type: 'checkbox' | 'radio';\n size?: 'sm' | 'lg' | 'small' | 'large';\n label?: string;\n labelClassName?: string;\n className?: string;\n onChange?: (value: any, shift?: boolean) => void;\n value?: boolean | string | number;\n inline?: boolean;\n trueValue?: boolean | string | number;\n falseValue?: boolean | string | number;\n disabled?: boolean;\n readOnly?: boolean;\n checked?: boolean;\n name?: string;\n description?: string;\n classPrefix: string;\n classnames: ClassNamesFn;\n partial?: boolean;\n optionType?: 'default' | 'button';\n}\n\nexport class Checkbox extends React.Component<CheckboxProps, any> {\n static defaultProps: Pick<\n CheckboxProps,\n 'trueValue' | 'falseValue' | 'type'\n > = {\n trueValue: true,\n falseValue: false,\n type: 'checkbox'\n };\n\n @autobind\n handleCheck(e: React.ChangeEvent<any>) {\n const {trueValue, falseValue, onChange} = this.props;\n\n if (!onChange) {\n return;\n }\n\n onChange(\n e.currentTarget.checked ? trueValue : falseValue,\n (e.nativeEvent as MouseEvent).shiftKey\n );\n }\n\n render() {\n let {\n size,\n className,\n classnames: cx,\n value,\n label,\n partial,\n trueValue,\n children,\n disabled,\n description,\n readOnly,\n checked,\n type,\n name,\n labelClassName,\n optionType\n } = this.props;\n\n return (\n <label\n className={cx(`Checkbox Checkbox--${type}`, className, {\n 'Checkbox--full': !partial,\n 'Checkbox--partial': partial,\n [`Checkbox--${size}`]: size,\n 'Checkbox--button': optionType === 'button',\n 'Checkbox--button--checked': optionType === 'button' && checked,\n 'Checkbox--button--disabled--unchecked': disabled && !checked\n })}\n >\n <input\n type={type}\n checked={\n typeof checked !== 'undefined'\n ? checked\n : typeof value === 'undefined'\n ? value\n : value == trueValue\n }\n onChange={this.handleCheck}\n onClick={\n preventEvent // 当点击 i 的时候,这个地方也会触发 click,很奇怪,干脆禁掉\n }\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n />\n <i />\n <span className={cx(labelClassName)}>{children || label}</span>\n {description ? (\n <div className={cx('Checkbox-desc')}>{description}</div>\n ) : null}\n </label>\n );\n }\n}\n\nexport default themeable(Checkbox);\n"
|
12
12
|
]
|
13
13
|
}
|
@@ -98,6 +98,8 @@ export declare class DateRangePicker extends React.Component<DateRangePickerProp
|
|
98
98
|
confirm(): void;
|
99
99
|
filterDate(date: moment.Moment, originValue?: moment.Moment, timeFormat?: string, type?: 'start' | 'end'): moment.Moment;
|
100
100
|
handleSelectChange(newValue: moment.Moment): void;
|
101
|
+
handleTimeStartChange(newValue: moment.Moment): void;
|
102
|
+
handleTimeEndChange(newValue: moment.Moment): void;
|
101
103
|
handleMobileChange(data: any, callback?: () => void): void;
|
102
104
|
selectRannge(range: PlainObject): void;
|
103
105
|
renderRanges(ranges: string | Array<ShortCuts> | undefined): JSX.Element | null;
|
@@ -338,6 +338,8 @@ var DateRangePicker = /** @class */ (function (_super) {
|
|
338
338
|
_this.open = _this.open.bind(_this);
|
339
339
|
_this.close = _this.close.bind(_this);
|
340
340
|
_this.handleSelectChange = _this.handleSelectChange.bind(_this);
|
341
|
+
_this.handleTimeStartChange = _this.handleTimeStartChange.bind(_this);
|
342
|
+
_this.handleTimeEndChange = _this.handleTimeEndChange.bind(_this);
|
341
343
|
_this.handleFocus = _this.handleFocus.bind(_this);
|
342
344
|
_this.handleBlur = _this.handleBlur.bind(_this);
|
343
345
|
_this.checkStartIsValidDate = _this.checkStartIsValidDate.bind(_this);
|
@@ -516,6 +518,56 @@ var DateRangePicker = /** @class */ (function (_super) {
|
|
516
518
|
}
|
517
519
|
this.isFirstClick = !this.isFirstClick;
|
518
520
|
};
|
521
|
+
// 主要用于处理时间的情况
|
522
|
+
DateRangePicker.prototype.handleTimeStartChange = function (newValue) {
|
523
|
+
var _this = this;
|
524
|
+
var _a = this.props, embed = _a.embed, timeFormat = _a.timeFormat, minDuration = _a.minDuration, maxDuration = _a.maxDuration, minDate = _a.minDate;
|
525
|
+
var _b = this.state, startDate = _b.startDate, endDate = _b.endDate;
|
526
|
+
if (startDate &&
|
527
|
+
(!endDate || (endDate && newValue.isSame(startDate))) && // 没有结束时间,或者新的时间也是开始时间,这时都会将新值当成结束时间
|
528
|
+
newValue.isSameOrAfter(startDate) &&
|
529
|
+
(!minDuration || newValue.isAfter(startDate.clone().add(minDuration))) &&
|
530
|
+
(!maxDuration || newValue.isBefore(startDate.clone().add(maxDuration)))) {
|
531
|
+
return this.setState({
|
532
|
+
endDate: this.filterDate(newValue, endDate, timeFormat, 'end')
|
533
|
+
}, function () {
|
534
|
+
embed && _this.confirm();
|
535
|
+
});
|
536
|
+
}
|
537
|
+
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
538
|
+
newValue = minDate;
|
539
|
+
}
|
540
|
+
this.setState({
|
541
|
+
startDate: this.filterDate(newValue, startDate || minDate, timeFormat, 'start')
|
542
|
+
}, function () {
|
543
|
+
embed && _this.confirm();
|
544
|
+
});
|
545
|
+
};
|
546
|
+
DateRangePicker.prototype.handleTimeEndChange = function (newValue) {
|
547
|
+
var _this = this;
|
548
|
+
var _a = this.props, embed = _a.embed, timeFormat = _a.timeFormat, minDuration = _a.minDuration, maxDuration = _a.maxDuration, maxDate = _a.maxDate;
|
549
|
+
var _b = this.state, startDate = _b.startDate, endDate = _b.endDate;
|
550
|
+
if (endDate &&
|
551
|
+
!startDate &&
|
552
|
+
newValue.isSameOrBefore(endDate) &&
|
553
|
+
(!minDuration ||
|
554
|
+
newValue.isBefore(endDate.clone().subtract(minDuration))) &&
|
555
|
+
(!maxDuration || newValue.isAfter(endDate.clone().subtract(maxDuration)))) {
|
556
|
+
return this.setState({
|
557
|
+
startDate: this.filterDate(newValue, startDate, timeFormat, 'start')
|
558
|
+
}, function () {
|
559
|
+
embed && _this.confirm();
|
560
|
+
});
|
561
|
+
}
|
562
|
+
if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
|
563
|
+
newValue = maxDate;
|
564
|
+
}
|
565
|
+
this.setState({
|
566
|
+
endDate: this.filterDate(newValue, endDate || maxDate, timeFormat, 'end')
|
567
|
+
}, function () {
|
568
|
+
embed && _this.confirm();
|
569
|
+
});
|
570
|
+
};
|
519
571
|
DateRangePicker.prototype.handleMobileChange = function (data, callback) {
|
520
572
|
this.setState({
|
521
573
|
startDate: data.startDate,
|
@@ -670,8 +722,15 @@ var DateRangePicker = /** @class */ (function (_super) {
|
|
670
722
|
var _c = this.state, startDate = _c.startDate, endDate = _c.endDate;
|
671
723
|
return (react_1.default.createElement("div", { className: "".concat(ns, "DateRangePicker-wrap") },
|
672
724
|
this.renderRanges(ranges),
|
673
|
-
react_1.default.createElement(Calendar_1.default, { className: "".concat(ns, "DateRangePicker-start"), value: startDate,
|
674
|
-
|
725
|
+
react_1.default.createElement(Calendar_1.default, { className: "".concat(ns, "DateRangePicker-start"), value: startDate,
|
726
|
+
// 区分的原因是 time-range 左侧就只能选起始时间,而其它都能在左侧同时同时选择起始和结束
|
727
|
+
// TODO: 后续得把 time-range 代码拆分出来
|
728
|
+
onChange: viewMode === 'time'
|
729
|
+
? this.handleTimeStartChange
|
730
|
+
: this.handleSelectChange, requiredConfirm: false, dateFormat: dateFormat, inputFormat: inputFormat, timeFormat: timeFormat, isValidDate: this.checkStartIsValidDate, viewMode: viewMode, input: false, onClose: this.close, renderDay: this.renderDay, renderQuarter: this.renderQuarter, locale: locale }),
|
731
|
+
react_1.default.createElement(Calendar_1.default, { className: "".concat(ns, "DateRangePicker-end"), value: endDate, onChange: viewMode === 'time'
|
732
|
+
? this.handleTimeEndChange
|
733
|
+
: this.handleSelectChange, requiredConfirm: false, dateFormat: dateFormat, inputFormat: inputFormat, timeFormat: timeFormat, viewDate: this.nextMonth, isEndDate: true, isValidDate: this.checkEndIsValidDate, viewMode: viewMode, input: false, onClose: this.close, renderDay: this.renderDay, renderQuarter: this.renderQuarter, locale: locale }),
|
675
734
|
embed ? null : (react_1.default.createElement("div", { key: "button", className: "".concat(ns, "DateRangePicker-actions") },
|
676
735
|
react_1.default.createElement("a", { className: cx('Button', 'Button--default'), onClick: this.close }, __('cancel')),
|
677
736
|
react_1.default.createElement("a", { className: cx('Button', 'Button--primary', 'm-l-sm', {
|