@para-ui/core 5.0.0-beta.4 → 5.0.0-beta.6
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/README.md +31 -0
- package/es/CheckboxGroup/index.d.ts +6 -6
- package/es/CheckboxGroup/index.js +21 -21
- package/es/FormItem/compoments/formSelect/index.d.ts +2 -2
- package/es/FormItem/compoments/formSelect/index.js +13 -13
- package/es/Pagination/index.js +11 -10
- package/es/RadioGroup/index.d.ts +6 -7
- package/es/RadioGroup/index.js +2 -2
- package/es/Select/index.d.ts +39 -16
- package/es/Select/index.js +324 -317
- package/es/ToggleButton/ToggleButtonGroup.d.ts +8 -8
- package/es/ToggleButton/ToggleButtonGroup.js +27 -27
- package/es/ToggleButton/index.d.ts +5 -6
- package/es/ToggleButton/index.js +13 -13
- package/es/Utils/type.d.ts +3 -1
- package/lib/Argv/batchEdit/index.js +1 -1
- package/lib/CheckboxGroup/index.d.ts +6 -6
- package/lib/CheckboxGroup/index.js +1 -1
- package/lib/CodeEditor/index.js +1 -1
- package/lib/FormItem/compoments/formSelect/index.d.ts +2 -2
- package/lib/FormItem/compoments/formSelect/index.js +1 -1
- package/lib/InputCode/index.js +1 -1
- package/lib/Pagination/index.js +1 -1
- package/lib/RadioGroup/index.d.ts +6 -7
- package/lib/RadioGroup/index.js +1 -1
- package/lib/Select/index.d.ts +39 -16
- package/lib/Select/index.js +1 -1
- package/lib/ToggleButton/ToggleButtonGroup.d.ts +8 -8
- package/lib/ToggleButton/ToggleButtonGroup.js +1 -1
- package/lib/ToggleButton/index.d.ts +5 -6
- package/lib/ToggleButton/index.js +1 -1
- package/lib/Utils/type.d.ts +3 -1
- package/lib/node_modules/@para-snack/core/dist/index.js +1 -1
- package/lib/node_modules/classnames/index.js +1 -1
- package/package.json +1 -1
- /package/lib/{CodeEditor → InputCode}/index.css +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { default as React
|
|
2
|
-
export type ToggleButtonItemProps = {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ToggleButtonItemProps<T = unknown> = {
|
|
3
3
|
label: string;
|
|
4
4
|
/** type为icon时有效 */
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
|
-
value:
|
|
6
|
+
value: T;
|
|
7
7
|
selected?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
toolTipTitle?: React.ReactNode;
|
|
10
10
|
className?: string;
|
|
11
11
|
};
|
|
12
|
-
export interface ToggleButtonGroupProps {
|
|
12
|
+
export interface ToggleButtonGroupProps<T = unknown> {
|
|
13
13
|
type?: 'text' | 'outlined' | 'icon';
|
|
14
14
|
/**
|
|
15
15
|
* 类名
|
|
@@ -30,17 +30,17 @@ export interface ToggleButtonGroupProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* 按钮组value
|
|
32
32
|
*/
|
|
33
|
-
value?:
|
|
33
|
+
value?: T | T[];
|
|
34
34
|
/**
|
|
35
35
|
* 按钮组数据源
|
|
36
36
|
*/
|
|
37
|
-
data?: ToggleButtonItemProps[];
|
|
37
|
+
data?: ToggleButtonItemProps<T>[];
|
|
38
38
|
/**
|
|
39
39
|
* value变化时回调
|
|
40
40
|
* @param event
|
|
41
41
|
* @param value
|
|
42
42
|
*/
|
|
43
|
-
onChange?: (event: React.MouseEvent, value:
|
|
43
|
+
onChange?: (event: React.MouseEvent, value: T | T[] | null) => void;
|
|
44
44
|
}
|
|
45
|
-
declare
|
|
45
|
+
declare function ToggleButtonGroup<T = unknown>(props: ToggleButtonGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export default ToggleButtonGroup;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { j as a } from "../_virtual/jsx-runtime.js";
|
|
2
|
-
import { ToggleButton as
|
|
3
|
-
import
|
|
4
|
-
import { $prefixCls as
|
|
2
|
+
import { ToggleButton as N } from "./index.js";
|
|
3
|
+
import $ from "clsx";
|
|
4
|
+
import { $prefixCls as x } from "../GlobalContext/constant.js";
|
|
5
5
|
import './index.css';/* empty css */
|
|
6
|
-
|
|
7
|
-
let { type: i = "outlined", className:
|
|
6
|
+
function T(f) {
|
|
7
|
+
let { type: i = "outlined", className: d, style: m, exclusive: c = !1, toggleable: p = !0, data: u, value: t, onChange: l } = f;
|
|
8
8
|
i === "text" && !("exclusive" in f) && (c = !0);
|
|
9
|
-
const
|
|
10
|
-
[`${
|
|
11
|
-
}),
|
|
12
|
-
if (!
|
|
9
|
+
const h = $(`${x}-togglebutton-group`, d, {
|
|
10
|
+
[`${x}-togglebutton-group-text`]: i === "text"
|
|
11
|
+
}), v = (r, e) => {
|
|
12
|
+
if (!l || !Array.isArray(t))
|
|
13
13
|
return;
|
|
14
14
|
const s = t, o = s.indexOf(e);
|
|
15
|
-
let
|
|
16
|
-
t && o >= 0 ? (
|
|
17
|
-
},
|
|
18
|
-
if (
|
|
19
|
-
if (!
|
|
15
|
+
let n;
|
|
16
|
+
t && o >= 0 ? (n = s.slice(), n.splice(o, 1)) : n = t ? s.concat(e) : [e], l(r, n);
|
|
17
|
+
}, y = (r, e) => {
|
|
18
|
+
if (l) {
|
|
19
|
+
if (!p) {
|
|
20
20
|
if (t === e) return;
|
|
21
|
-
|
|
21
|
+
l(r, e);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
l(r, t === e ? null : e);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
const { label: s, selected: o, ...
|
|
26
|
+
}, C = (r, e) => e === void 0 || r === void 0 ? !1 : Array.isArray(e) ? e.includes(r) : r === e, j = () => !u || !u?.length ? null : u.map((r, e) => {
|
|
27
|
+
const { label: s, selected: o, icon: n, ...g } = r, A = o === void 0 ? C(g.value, t) : o;
|
|
28
28
|
return /* @__PURE__ */ a.jsx(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: "toggle-button-item",
|
|
32
32
|
children: /* @__PURE__ */ a.jsx(
|
|
33
|
-
|
|
33
|
+
N,
|
|
34
34
|
{
|
|
35
|
-
...
|
|
36
|
-
style:
|
|
37
|
-
selected:
|
|
35
|
+
...g,
|
|
36
|
+
style: m,
|
|
37
|
+
selected: A,
|
|
38
38
|
type: i,
|
|
39
|
-
onClick: c ?
|
|
39
|
+
onClick: c ? y : v,
|
|
40
40
|
exclusive: c,
|
|
41
|
-
children: i === "icon" ?
|
|
41
|
+
children: i === "icon" ? n || null : s
|
|
42
42
|
}
|
|
43
43
|
)
|
|
44
44
|
},
|
|
45
45
|
e
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
|
-
return /* @__PURE__ */ a.jsx("div", { className:
|
|
49
|
-
}
|
|
48
|
+
return /* @__PURE__ */ a.jsx("div", { className: h, children: j() });
|
|
49
|
+
}
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
T as default
|
|
52
52
|
};
|
|
53
53
|
//# sourceMappingURL=ToggleButtonGroup.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { default as React
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
import { default as ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonItemProps } from './ToggleButtonGroup';
|
|
3
|
-
export interface ToggleButtonProps {
|
|
3
|
+
export interface ToggleButtonProps<T = unknown> {
|
|
4
4
|
/**
|
|
5
5
|
* 类名
|
|
6
6
|
*/
|
|
@@ -33,7 +33,7 @@ export interface ToggleButtonProps {
|
|
|
33
33
|
/**
|
|
34
34
|
* value
|
|
35
35
|
*/
|
|
36
|
-
value?:
|
|
36
|
+
value?: T;
|
|
37
37
|
/**
|
|
38
38
|
* width
|
|
39
39
|
*/
|
|
@@ -43,10 +43,9 @@ export interface ToggleButtonProps {
|
|
|
43
43
|
* @param event
|
|
44
44
|
* @param value
|
|
45
45
|
*/
|
|
46
|
-
onClick?: (event: React.MouseEvent, value:
|
|
47
|
-
[name: string]: unknown;
|
|
46
|
+
onClick?: (event: React.MouseEvent, value: T) => void;
|
|
48
47
|
}
|
|
49
|
-
export declare
|
|
48
|
+
export declare function ToggleButton<T = unknown>(props: ToggleButtonProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
50
49
|
export type { ToggleButtonGroupProps, ToggleButtonItemProps };
|
|
51
50
|
export { ToggleButtonGroup };
|
|
52
51
|
export default ToggleButton;
|
package/es/ToggleButton/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { j as o } from "../_virtual/jsx-runtime.js";
|
|
2
2
|
import { useRef as j } from "react";
|
|
3
|
-
import { Button as
|
|
3
|
+
import { Button as p } from "../Button/index.js";
|
|
4
4
|
import { default as P } from "./ToggleButtonGroup.js";
|
|
5
5
|
import { UUID as k } from "@paraview/lib";
|
|
6
6
|
import b from "clsx";
|
|
7
7
|
import { $prefixCls as T } from "../GlobalContext/constant.js";
|
|
8
8
|
import v from "../AutoTips/index.js";
|
|
9
9
|
import './index.css';/* empty css */
|
|
10
|
-
|
|
10
|
+
function D(x) {
|
|
11
11
|
const {
|
|
12
12
|
className: g,
|
|
13
13
|
style: i,
|
|
@@ -21,43 +21,43 @@ const D = (x) => {
|
|
|
21
21
|
width: a,
|
|
22
22
|
onClick: c,
|
|
23
23
|
...d
|
|
24
|
-
} = x,
|
|
24
|
+
} = x, u = j(k()).current, e = `${T}-toggle-button`, m = b(e, g, `toggle-button-${t}`, {
|
|
25
25
|
[`${e}-${$ ? "radio" : "check"}`]: t === "outlined",
|
|
26
26
|
[`${e}-selected`]: C,
|
|
27
27
|
[`${e}-disabled`]: s
|
|
28
|
-
}),
|
|
28
|
+
}), f = (h) => {
|
|
29
29
|
c && c(h, l);
|
|
30
30
|
};
|
|
31
31
|
return t === "icon" ? /* @__PURE__ */ o.jsx(
|
|
32
|
-
|
|
32
|
+
p.IconButton,
|
|
33
33
|
{
|
|
34
|
-
"data-id":
|
|
34
|
+
"data-id": u,
|
|
35
35
|
...d,
|
|
36
36
|
variant: "outlined",
|
|
37
37
|
style: { width: a, ...i },
|
|
38
|
-
className:
|
|
38
|
+
className: m,
|
|
39
39
|
disabled: s,
|
|
40
40
|
toolTipTitle: n,
|
|
41
41
|
value: l,
|
|
42
|
-
onClick:
|
|
42
|
+
onClick: f,
|
|
43
43
|
children: r
|
|
44
44
|
}
|
|
45
45
|
) : /* @__PURE__ */ o.jsx(
|
|
46
|
-
|
|
46
|
+
p,
|
|
47
47
|
{
|
|
48
|
-
"data-id":
|
|
48
|
+
"data-id": u,
|
|
49
49
|
...d,
|
|
50
50
|
variant: t === "text" ? "text" : "outlined",
|
|
51
51
|
style: { width: a, ...i },
|
|
52
|
-
className:
|
|
52
|
+
className: m,
|
|
53
53
|
disabled: s,
|
|
54
54
|
toolTipTitle: n,
|
|
55
55
|
value: l,
|
|
56
|
-
onClick:
|
|
56
|
+
onClick: f,
|
|
57
57
|
children: /* @__PURE__ */ o.jsx("span", { className: "toggle-button-text", children: /* @__PURE__ */ o.jsx(v, { children: r }) })
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
export {
|
|
62
62
|
D as ToggleButton,
|
|
63
63
|
P as ToggleButtonGroup,
|
package/es/Utils/type.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
export type IObject = Record<string, unknown>;
|
|
4
4
|
/** 通用键值对类型 */
|
|
5
5
|
export type IRecord<T = unknown> = Record<string, T>;
|
|
6
|
+
/** 通用选项值类型 */
|
|
7
|
+
export type SelectOptionValue = string | number | boolean;
|
|
6
8
|
/** 通用选项类型 */
|
|
7
9
|
export interface SelectOptionBase {
|
|
8
10
|
/** 显示标签 */
|
|
9
11
|
label?: ReactNode;
|
|
10
12
|
/** 选项值 */
|
|
11
|
-
value?:
|
|
13
|
+
value?: SelectOptionValue;
|
|
12
14
|
/** 是否禁用 */
|
|
13
15
|
disabled?: boolean;
|
|
14
16
|
/** 子选项 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../../InputCode/index.css');const c=require("../../_virtual/jsx-runtime.js"),m=require("react"),E=require("../../Button/index.js"),k=require("../../TextField/index.js"),y=require("../../Modal/index.js"),h=require("../../Message/index.js"),p=require("../../GlobalContext/useFormatMessage.js"),S=require("../../GlobalContext/constant.js"),g=require("../lang/index.js");;/* empty css */const b=l=>{const i=p.default("Argv",g.default),{className:f,sourceData:s,onFinish:u,dataToJson:o,jsonToData:n}=l,[t,r]=m.useState({open:!1,json:""}),d=()=>{let e="";if(!Array.isArray(s))e="";else try{o?e=o(s):e=JSON.stringify(s,null,4)}catch(a){console.error(a)}r({...t,json:e,open:!t.open})},x=()=>{r({...t,open:!1})},j=e=>{let a=[];try{n?a=n(e):a=JSON.parse(e)}catch{return h.Message.error(i("formatErrorJson"),5e3),!1}r({...t,open:!1}),u&&u(a)};return c.jsxRuntimeExports.jsxs("div",{className:`argv-batch-edit-content ${f}`,children:[c.jsxRuntimeExports.jsx(E.Button,{variant:"outlined",size:"small",className:"btn-edit",onClick:d,children:i("batchEdit")}),c.jsxRuntimeExports.jsx(q,{open:t.open,onCancel:x,onOk:j,json:t.json,checkData:l.checkData})]})},q=l=>{const{open:i,disabled:f,onCancel:s,onOk:u,json:o,checkData:n}=l,t=p.default("Argv",g.default),[r,d]=m.useState("");m.useEffect(()=>{d(o||"")},[o]);const x=()=>{try{const e=JSON.parse(r);return Array.isArray(e)?!(n&&!n(e)):(h.Message.error(t("formatErrorArrayJson")),!1)}catch{return h.Message.error(t("formatErrorJson")),!1}},j=()=>{if(x())try{u(r)}catch(e){console.error(e)}};return c.jsxRuntimeExports.jsx(y.Modal,{className:`${S.$prefixCls}-form`,open:i,title:t("batchEdit"),onCancel:s,onOk:j,maskClosable:!0,showCancel:!1,okText:t("ok"),children:c.jsxRuntimeExports.jsx(k.TextField,{label:"API JSON",placeholder:"请输入",disabled:f,multiline:!0,rows:12,value:r||"",onChange:e=>d(e.target.value)})})};exports.default=b;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React,
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { CheckboxProps } from '../Checkbox';
|
|
3
3
|
import { LabelTooltipProps } from '../Label';
|
|
4
4
|
import { HelperTextDetailProps } from '../HelperText';
|
|
@@ -6,7 +6,7 @@ export interface CheckboxListProps extends CheckboxProps {
|
|
|
6
6
|
/** 唯一标识值 */
|
|
7
7
|
name?: string | number;
|
|
8
8
|
}
|
|
9
|
-
export interface CheckboxGroupProps extends HelperTextDetailProps {
|
|
9
|
+
export interface CheckboxGroupProps<T extends string | number = string | number> extends HelperTextDetailProps {
|
|
10
10
|
/** 样式class */
|
|
11
11
|
className?: string;
|
|
12
12
|
/** style */
|
|
@@ -28,15 +28,15 @@ export interface CheckboxGroupProps extends HelperTextDetailProps {
|
|
|
28
28
|
/** 是否禁用 */
|
|
29
29
|
disabled?: boolean;
|
|
30
30
|
/** 默认值 不受控 */
|
|
31
|
-
defaultValue?:
|
|
31
|
+
defaultValue?: T[];
|
|
32
32
|
/** 值 */
|
|
33
|
-
value?:
|
|
33
|
+
value?: T[];
|
|
34
34
|
/** 选中选值 */
|
|
35
35
|
id?: string;
|
|
36
36
|
/** 选项数据 */
|
|
37
37
|
list: CheckboxListProps[] | CheckboxListProps[][];
|
|
38
38
|
/** 改变值 */
|
|
39
|
-
onChange?: (val:
|
|
39
|
+
onChange?: (val: T[]) => void;
|
|
40
40
|
}
|
|
41
|
-
export declare
|
|
41
|
+
export declare function CheckboxGroup<T extends string | number = string | number>(props: CheckboxGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
42
42
|
export default CheckboxGroup;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const l=require("../_virtual/jsx-runtime.js"),n=require("react"),q=require("../Checkbox/index.js"),L=require("../Label/index.js"),V=require("../HelperText/index.js"),A=require("@paraview/lib"),a=require("../GlobalContext/constant.js");;/* empty css */
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const l=require("../_virtual/jsx-runtime.js"),n=require("react"),q=require("../Checkbox/index.js"),L=require("../Label/index.js"),V=require("../HelperText/index.js"),A=require("@paraview/lib"),a=require("../GlobalContext/constant.js");;/* empty css */function N(c){const{label:h="",labelTooltip:i,spacing:m="32px",itemWidth:p,size:u="large",row:g=!0,disabled:x=!1,required:k=!1,error:j=!1,hideErrorDom:R,helperText:_="",id:d="name",list:$,className:C="",onChange:v,style:O}=c,[f,b]=n.useState([]);n.useEffect(()=>{c.defaultValue!==void 0&&b(c.defaultValue)},[]),n.useEffect(()=>{c.value!==void 0&&b(c.value)},[c.value]);const y=e=>(r,t)=>{const s=e[d],o=A.DeepClone(f);if(t)o.push(s);else{const w=o.indexOf(s);o.splice(w,1)}c.value===void 0&&b(o),v&&v(o)},S=()=>{if(h||k){const e=()=>{let r="checkbox-group-label";return i&&i.className&&(r+=` ${i.className}`),r};return l.jsxRuntimeExports.jsx(L.default,{label:h,required:k,...i,className:e()})}},E=(e,r,t)=>{const s={display:"inline-block",...e.style};return m&&g&&t.length!==r+1&&(s.marginRight=m),p&&(s.width=p),s},T=()=>{let e=`${a.$prefixCls}-checkbox-group`;return C&&(e+=` ${C}`),u&&(e+=` ${a.$prefixCls}-checkbox-group-${u}`),j&&(e+=` ${a.$prefixCls}-checkbox-group-error`),x&&(e+=` ${a.$prefixCls}-checkbox-group-disabled`),g?e+=` ${a.$prefixCls}-checkbox-group-row`:e+=` ${a.$prefixCls}-checkbox-group-column`,e};return l.jsxRuntimeExports.jsxs("div",{className:T(),style:O,children:[S(),l.jsxRuntimeExports.jsx("div",{className:"checkbox-group-content",children:$.map((e,r)=>{if(Array.isArray(e))return l.jsxRuntimeExports.jsx("div",{className:"checkbox-group-content-item",children:e.map((s,o)=>l.jsxRuntimeExports.jsx("span",{className:"checkbox-item-box",style:E(s,o,e),children:n.createElement(q.Checkbox,{...s,style:{},checked:f.indexOf(s[d])!==-1,size:u,disabled:!!(x||s.disabled),key:r,onChange:y(s)})},o))},r);const t=e;return l.jsxRuntimeExports.jsx("span",{className:"checkbox-item-box",style:E(t,r,$),children:n.createElement(q.Checkbox,{...t,style:{},checked:f.indexOf(t[d])!==-1,size:u,disabled:!!(x||t.disabled),key:r,onChange:y(t)})},r)})}),l.jsxRuntimeExports.jsx(V.default,{className:"checkbox-group-error-text",error:j,helperText:_,hideErrorDom:R})]})}exports.CheckboxGroup=N;exports.default=N;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/CodeEditor/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../InputCode/index.css');const f=require("../_virtual/jsx-runtime.js"),a=require("react"),rr=require("@paraview/lib"),er=require("react-dom"),sr=require("clsx"),ar=require("../GlobalContext/constant.js"),ur=require("../_virtual/index.js"),cr=require("../Loading/index.js"),tr=require("./lang/index.js");;/* empty css */var o=(r=>(r[r.Method=0]="Method",r[r.Function=1]="Function",r[r.Constructor=2]="Constructor",r[r.Field=3]="Field",r[r.Variable=4]="Variable",r[r.Class=5]="Class",r[r.Struct=6]="Struct",r[r.Interface=7]="Interface",r[r.Module=8]="Module",r[r.Property=9]="Property",r[r.Event=10]="Event",r[r.Operator=11]="Operator",r[r.Unit=12]="Unit",r[r.Value=13]="Value",r[r.Constant=14]="Constant",r[r.Enum=15]="Enum",r[r.EnumMember=16]="EnumMember",r[r.Keyword=17]="Keyword",r[r.Text=18]="Text",r[r.Color=19]="Color",r[r.File=20]="File",r[r.Reference=21]="Reference",r[r.Customcolor=22]="Customcolor",r[r.Folder=23]="Folder",r[r.TypeParameter=24]="TypeParameter",r[r.User=25]="User",r[r.Issue=26]="Issue",r[r.Snippet=27]="Snippet",r))(o||{});const gr=r=>{const{className:E,style:b,id:y,language:h,zoomLength:R=300,theme:q="vs-light",resize:v=!0,editorLanguage:w="javascript",disabledSelectLanguage:F,languageList:j,showExpand:L=!0,showFullScreen:T=!0,showFormat:P=!0,topRightRender:$,width:c="100%",height:t="100%",value:g="",disabled:n=!1,suggestions:U,triggerCharacters:V,codeSnippet:D,help:O,isSearchCode:N,drag:_=!0,dragMin:z=200,monacoEditorProps:H,title:A,hideSelectLanguage:B,hideLineNumber:G,onClickCodeSnippet:J,onChange:k,onChangeLanguage:Q,onMounted:S}=r,[W,x]=a.useState(!0),[M,X]=a.useState(),d=a.useRef(null),e=a.useRef({});a.useEffect(()=>(i(),()=>{clearTimeout(e.current.snackTimer)}),[]),a.useEffect(()=>{e.current.snackClass?.setValue(g||"")},[g]),a.useEffect(()=>{e.current.snackClass?.setDisabled(n)},[n]);const Y=(s,u)=>{e.current.snackClass&&(e.current.snackClass.data[s]=u,e.current.snackClass.$forceUpdate(),e.current.snackClass.editor?.focus())},Z=async()=>{if(e.current.sdk)return e.current.sdk;const s=new ur.distExports.SnackSDK({service:rr.Context.get("snackbar"),importMaps:{react:a,"react-dom":er},runtime:!0});return e.current.sdk=s,s},i=async()=>{x(!0);const u=await(await Z()).createModule({name:"codeeditornew",type:"code-editor"},{id:y,theme:q,language:h||tr.default,zoomLength:R,editorLanguage:w,title:A,disabledSelectLanguage:F,hideSelectLanguage:B,hideLineNumber:G,languageList:j,showExpand:L,showFullScreen:T,showFormat:P,topRightRender:$,width:c,height:t,resize:v,value:g,disabled:n,suggestions:U,triggerCharacters:V,codeSnippet:D,help:O,isSearchCode:N,drag:_,dragMin:z,onClickCodeSnippet:J,onChange:C,onChangeLanguage:Q,monacoEditorProps:H});if(x(!1),!u)return;const K=()=>u.FC();X(f.jsxRuntimeExports.jsx(K,{})),e.current.snackTimer=setTimeout(()=>{u.updateSnackModules=Y,e.current.snackClass=u,u.getMoveHeight=m=>{const l=d.current;l&&(l.style.height=m)},S&&S(u)})},C=s=>{k&&k(s)},p=a.useMemo(()=>M,[M]),I=()=>{const s={...b};return c&&(s.width=c),t&&(s.height=t),s};return f.jsxRuntimeExports.jsxs("div",{className:sr(`${ar.$prefixCls}-code-editor`,E),style:I(),ref:d,children:[W&&f.jsxRuntimeExports.jsx(cr.Loading,{}),p]})};exports.CompletionItemKind=o;exports.default=gr;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { SelectProps } from '../../../Select';
|
|
3
|
-
export
|
|
3
|
+
export type FormSelectProps = Omit<SelectProps, 'value' | 'defaultValue' | 'onChange'> & {
|
|
4
4
|
/**
|
|
5
5
|
* 默认值
|
|
6
6
|
*/
|
|
@@ -13,6 +13,6 @@ export interface FormSelectProps extends SelectProps {
|
|
|
13
13
|
* 绑定值
|
|
14
14
|
*/
|
|
15
15
|
value?: string;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
declare const FormSelect: FC<FormSelectProps>;
|
|
18
18
|
export default FormSelect;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../../../_virtual/jsx-runtime.js"),s=require("react"),d=require("../../../Select/index.js"),f=n=>{const{defaultValue:o="",change:t,value:e,...r}=n,[a,u]=s.useState(e!==void 0?e:o),c=l=>{u(l),t&&t(l)};return s.useEffect(()=>{u(e)},[e]),i.jsxRuntimeExports.jsx(d.default,{labelMode:"inside",onChange:c,hideErrorDom:null,...r,value:a})};exports.default=f;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/InputCode/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const t=require("./inputCodeCard/index.js"),u=require("./inputCodeInput/index.js");;/* empty css */const e={Card:t.InputCodeCard,Input:u.InputCodeInput};exports.InputCode=e;exports.default=e;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/Pagination/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const n=require("../_virtual/jsx-runtime.js"),r=require("react"),xe=require("../GlobalContext/index.js"),R=require("../GlobalContext/constant.js"),ge=require("../TextField/index.js"),fe=require("../GlobalContext/useFormatMessage.js"),de=require("./lang/index.js"),je=require("../Select/index.js"),V=require("../Button/index.js"),K=require("../node_modules/@para-ui/icons/Left/index.js"),he=require("rc-pagination"),U=require("../node_modules/@para-ui/icons/Right/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const n=require("../_virtual/jsx-runtime.js"),r=require("react"),xe=require("../GlobalContext/index.js"),R=require("../GlobalContext/constant.js"),ge=require("../TextField/index.js"),fe=require("../GlobalContext/useFormatMessage.js"),de=require("./lang/index.js"),je=require("../Select/index.js"),V=require("../Button/index.js"),K=require("../node_modules/@para-ui/icons/Left/index.js"),he=require("rc-pagination"),U=require("../node_modules/@para-ui/icons/Right/index.js"),ve=require("../node_modules/@para-ui/icons/DoubleLeft/index.js"),Pe=require("../node_modules/@para-ui/icons/DoubleRight/index.js");;/* empty css */const G=E=>{const{className:q,style:H,type:c="simple",pagerType:b="num",autoType:k=!0,total:p=0,rowsPerPage:$=[10,20,50,100],flippingArrow:z=["prev","next"],currentRowsPerPage:M=10,page:S=1,pageMaxLimit:L=!0,skipFunc:D,changePage:w,changeRowsPerPage:I,getPopupContainer:A,resizeLine:J}=E,m=fe.default("Pagination",de.default),{language:C,locale:x}=r.useContext(xe.default),[l,B]=r.useState(M),[_,Q]=r.useState([]),[s,y]=r.useState(S),[a,W]=r.useState(),[g,T]=r.useState(),[o,F]=r.useState(null),f=r.useRef(null),i=r.useRef({layoutArr:["jumper","pageRow","pager-btn","sizes","pager-num"]});i.current.type=c,i.current.autoType=k,r.useEffect(()=>()=>{window.removeEventListener("resize",d),clearTimeout(i.current.timer),clearTimeout(i.current.changePagination)},[]),r.useEffect(()=>{y(S)},[S]),r.useEffect(()=>{B(M)},[M]),r.useEffect(()=>{const e=[];for(let t=0,u=$.length;t<u;t++){const N=$[t],P={label:N.toString()+m({id:"barPage"}),value:N};e.push(P)}Q(e)},[E.rowsPerPage,x]),r.useEffect(()=>{const e=Number(a);L&&s>e&&e!==s&&y(e)},[s,a,L]),r.useEffect(()=>{const e=Math.ceil(p/l);W(e||E.page||1)},[l,p]),r.useEffect(()=>{c==="complex"&&k?(d(),window.addEventListener("resize",d)):window.removeEventListener("resize",d)},[c,k]),r.useEffect(()=>{i.current.type==="complex"&&i.current.autoType&&d()},[p,l,s,C,J]);const d=()=>{clearTimeout(i.current.timer);const e=f.current;e&&(e.classList.add(`${R.$prefixCls}-pagination-over`),i.current.timer=setTimeout(()=>{F(i.current.layoutArr.length),i.current.layoutArr.length>1&&O()},100))},X=()=>{const e=[".total-num",".component-pagination",".pagination-btn-content",".page-line-memo",".skip-page-memo"];let t,u=!1;return e.forEach(N=>{const P=f.current.querySelector(N);P&&(t===void 0?t=P.offsetTop:P.offsetTop!==t&&(u=!0))}),u},O=e=>{if(!(e===null||e===0))if(e===void 0&&(e=i.current.layoutArr.length),X()){const t=Number(e)-1;F(t),t>3?O(t):f.current.classList.remove(`${R.$prefixCls}-pagination-over`)}else f.current.classList.remove(`${R.$prefixCls}-pagination-over`)},j=e=>i.current.type instanceof Array&&i.current.type.indexOf(e)===-1,h=e=>{if(o===null)return!1;switch(e){case"jumper":return o<=0;case"pageRow":return o<=1;case"pager-btn":return o<=2||o>4;case"sizes":return o<=3;case"pager-num":return o<=4;default:return!1}},v=e=>t=>{let u=s;switch(e){case"prev":if(s===1)return;u--;break;case"next":if(s===a)return;u++;break;case"pagination":u=t;break}u!==void 0&&y(u),w&&w(u)},Y=e=>{if(e===void 0)return;const t=Number(e);e!==l&&(B(t),I&&I(t))},Z=e=>{["E","e",".","-"].indexOf(e.key)!==-1&&e.preventDefault()},ee=e=>{if(e.keyCode===13){let t=parseInt(g&&g.toString()||"0");t<=0&&(t=1,T(t)),t>Number(a)&&(t=Number(a),T(t)),D&&D(t,g),y(t),w&&w(t)}},te=e=>{T(Number(e.target.value))},ne=e=>{const t=/(?=(\B)(\d{3})+$)/g;return e.toString().replace(t,",")},re=r.useMemo(()=>{if(c==="simple"||j("sizes")||h("sizes"))return null;const e=ne(p);return n.jsxRuntimeExports.jsx("div",{className:"total-num pagination-space",children:m({id:"total"},{total:e})})},[p,C,x,o]),se=r.useMemo(()=>j("pageRow")||h("pageRow")?null:n.jsxRuntimeExports.jsx("div",{className:"page-line-memo pagination-space",children:n.jsxRuntimeExports.jsx(je.default,{className:"page-line-select",size:"large",value:l,list:_,hideErrorDom:!0,onChange:Y,allowClear:!1,getPopupContainer:A})}),[_,l,A,C,x,o]),ie=()=>n.jsxRuntimeExports.jsxs("div",{className:"jump-prev-icon",children:[n.jsxRuntimeExports.jsx("span",{children:"..."}),n.jsxRuntimeExports.jsx(ve.DoubleLeft,{})]}),oe=()=>n.jsxRuntimeExports.jsxs("div",{className:"jump-next-icon",children:[n.jsxRuntimeExports.jsx("span",{children:"..."}),n.jsxRuntimeExports.jsx(Pe.DoubleRight,{})]}),ae=()=>b!=="num"||c==="simple"?!0:c==="complex"?h("pager-num"):j("pager"),ue=r.useMemo(()=>ae()?null:n.jsxRuntimeExports.jsxs("div",{className:"pagination-content pagination-space",children:[z.indexOf("prev")!==-1&&n.jsxRuntimeExports.jsx("div",{className:"left-page",children:n.jsxRuntimeExports.jsx("div",{onClick:v("prev"),className:s===1?"disabled-btn":"",children:n.jsxRuntimeExports.jsx(K.Left,{})})}),n.jsxRuntimeExports.jsx(he,{prefixCls:`${R.$rcPrefixCls}-pagination`,current:s,pageSize:l,total:p,jumpPrevIcon:ie(),jumpNextIcon:oe(),onChange:v("pagination"),showTitle:!1}),z.indexOf("next")!==-1&&n.jsxRuntimeExports.jsx("div",{className:"right-page",children:n.jsxRuntimeExports.jsx("div",{onClick:v("next"),className:s===a?"disabled-btn":"",children:n.jsxRuntimeExports.jsx(U.Right,{})})})]}),[p,s,a,l,E.flippingArrow,b,o]),ce=()=>b==="btn"||c==="simple"?!1:c==="complex"?h("pager-btn"):j("pager"),le=r.useMemo(()=>ce()?null:n.jsxRuntimeExports.jsxs("div",{className:"pagination-btn-content pagination-space",children:[n.jsxRuntimeExports.jsx(V.Button,{variant:"outlined",size:"large",startIcon:n.jsxRuntimeExports.jsx(K.Left,{}),onClick:v("prev"),disabled:s===1,children:m({id:"prevPage"})}),n.jsxRuntimeExports.jsx(V.Button,{variant:"outlined",size:"large",endIcon:n.jsxRuntimeExports.jsx(U.Right,{}),onClick:v("next"),disabled:s===a,children:m({id:"nextPage"})})]}),[s,a,b,x,o]),pe=r.useMemo(()=>j("jumper")||h("jumper")?null:n.jsxRuntimeExports.jsxs("div",{className:"skip-page-memo pagination-space",children:[n.jsxRuntimeExports.jsx("span",{children:m({id:"jumpTo"})}),n.jsxRuntimeExports.jsx(ge.TextField,{className:"skip-page-text-field",size:"large",type:"number",value:g||"",onChange:te,hideErrorDom:!0,onKeydown:Z,onKeyUp:ee}),n.jsxRuntimeExports.jsxs("span",{children:["/ ",a,m({id:"page"})]})]}),[g,a,C,x,o]),me=()=>{let e=`${R.$prefixCls}-pagination`;return q&&(e+=` ${q}`),e};return n.jsxRuntimeExports.jsxs("div",{className:me(),style:H,ref:f,children:[re,ue,le,se,pe]})};exports.Pagination=G;exports.default=G;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { default as React,
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { RadioProps } from '../Radio';
|
|
3
3
|
import { LabelTooltipProps } from '../Label';
|
|
4
4
|
import { HelperTextDetailProps } from '../HelperText';
|
|
5
5
|
export interface RadioListProps extends RadioProps {
|
|
6
6
|
[name: string]: unknown;
|
|
7
7
|
}
|
|
8
|
-
export interface RadioGroupProps extends HelperTextDetailProps {
|
|
8
|
+
export interface RadioGroupProps<T = unknown> extends HelperTextDetailProps {
|
|
9
9
|
/** 样式class */
|
|
10
10
|
className?: string;
|
|
11
11
|
/** style */
|
|
@@ -27,16 +27,15 @@ export interface RadioGroupProps extends HelperTextDetailProps {
|
|
|
27
27
|
/** 是否禁用 */
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
/** 默认值 不受控 */
|
|
30
|
-
defaultValue?:
|
|
30
|
+
defaultValue?: T;
|
|
31
31
|
/** 默认值 */
|
|
32
|
-
value?:
|
|
32
|
+
value?: T;
|
|
33
33
|
/** 选中选值 */
|
|
34
34
|
id?: string;
|
|
35
35
|
/** 选项数据 */
|
|
36
36
|
list: RadioListProps[] | RadioListProps[][];
|
|
37
37
|
/** 改变值 */
|
|
38
|
-
onChange?: (val:
|
|
39
|
-
[name: string]: unknown;
|
|
38
|
+
onChange?: (val: T, item?: RadioListProps) => void;
|
|
40
39
|
}
|
|
41
|
-
export declare
|
|
40
|
+
export declare function RadioGroup<T = unknown>(props: RadioGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
42
41
|
export default RadioGroup;
|
package/lib/RadioGroup/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),f=require("react"),N=require("../Radio/index.js"),L=require("../Label/index.js"),V=require("../HelperText/index.js"),t=require("../GlobalContext/constant.js");;/* empty css */
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),f=require("react"),N=require("../Radio/index.js"),L=require("../Label/index.js"),V=require("../HelperText/index.js"),t=require("../GlobalContext/constant.js");;/* empty css */function q(i){const{className:p="",style:_,label:m,labelTooltip:l,spacing:g="32px",itemWidth:j,size:u="large",row:b=!0,disabled:d=!1,required:h=!1,error:R=!1,hideErrorDom:S,helperText:T="",id:c="name",value:n,list:$,onChange:E}=i,[v,x]=f.useState();f.useEffect(()=>{i.defaultValue!==void 0&&x(i.defaultValue)},[]),f.useEffect(()=>{n!==void 0&&x(n)},[n]);const y=e=>()=>{const s=e[c];n!==s&&(i.value===void 0&&x(s),E&&E(s,e))},k=()=>{if(m||h){const e=()=>{let s="radio-group-label";return l&&l.className&&(s+=` ${l.className}`),s};return r.jsxRuntimeExports.jsx(L.default,{label:m,required:h,...l,className:e()})}},C=(e,s,a)=>{const o={display:"inline-block",...e.style};return g&&b&&a.length!==s+1&&(o.marginRight=g),j&&(o.width=j),o},w=()=>{let e=`${t.$prefixCls}-radio-group`;return p&&(e+=` ${p}`),u&&(e+=` ${t.$prefixCls}-radio-group-size`),R&&(e+=` ${t.$prefixCls}-radio-group-error`),d&&(e+=` ${t.$prefixCls}-radio-group-disabled`),b?e+=` ${t.$prefixCls}-radio-group-row`:e+=` ${t.$prefixCls}-radio-group-column`,e};return r.jsxRuntimeExports.jsxs("div",{className:w(),style:_,children:[k(),r.jsxRuntimeExports.jsx("div",{className:"radio-group-content",children:$.map((e,s)=>Array.isArray(e)?r.jsxRuntimeExports.jsx("div",{className:"radio-group-content-item",children:e.map((a,o)=>r.jsxRuntimeExports.jsx("span",{className:"radio-item-box",style:C(a,o,e),children:r.jsxRuntimeExports.jsx(N.Radio,{...a,style:{},checked:v===a[c],size:u,disabled:!!(d||a.disabled),onChange:y(a)})},o))},s):r.jsxRuntimeExports.jsx("span",{className:"radio-item-box",style:C(e,s,$),children:r.jsxRuntimeExports.jsx(N.Radio,{...e,style:{},checked:v===e[c],size:u,disabled:!!(d||e.disabled),onChange:y(e)})},s))}),r.jsxRuntimeExports.jsx(V.default,{className:"radio-group-error-text",error:R,helperText:T,hideErrorDom:S})]})}exports.RadioGroup=q;exports.default=q;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/Select/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { default as React,
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { EmptyProps } from '../Empty';
|
|
3
3
|
import { LabelTooltipProps } from '../Label';
|
|
4
4
|
import { TooltipProps } from '../Tooltip';
|
|
5
5
|
import { HelperTextDetailProps } from '../HelperText';
|
|
6
|
-
import { SelectOptionBase } from '../Utils/type';
|
|
6
|
+
import { SelectOptionBase, SelectOptionValue } from '../Utils/type';
|
|
7
7
|
/** Select 下拉选项类型 */
|
|
8
8
|
export interface SelectOption extends SelectOptionBase {
|
|
9
9
|
/** 子选项数组 */
|
|
10
10
|
children?: SelectOption[];
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/** Select 共享 props —— 不含随 multiple 变化的 value/defaultValue/onChange/onEnter/multiple */
|
|
13
|
+
export interface SelectBaseProps<T extends SelectOptionValue = SelectOptionValue> extends HelperTextDetailProps {
|
|
13
14
|
/** 样式class */
|
|
14
15
|
className?: string;
|
|
15
16
|
/** style */
|
|
@@ -35,13 +36,11 @@ export interface SelectProps extends HelperTextDetailProps {
|
|
|
35
36
|
/** 搜索提示语 */
|
|
36
37
|
searchPlaceholder?: string;
|
|
37
38
|
/** 是否禁用,传入数组时表示禁用的选项值列表 */
|
|
38
|
-
disabled?: boolean |
|
|
39
|
+
disabled?: boolean | T[];
|
|
39
40
|
/**
|
|
40
41
|
* 禁用提示
|
|
41
42
|
*/
|
|
42
43
|
disabledTooltip?: TooltipProps;
|
|
43
|
-
/** 是否多选 */
|
|
44
|
-
multiple?: boolean;
|
|
45
44
|
/** 是否必填 */
|
|
46
45
|
required?: boolean;
|
|
47
46
|
/** 下拉选项数组 */
|
|
@@ -60,10 +59,6 @@ export interface SelectProps extends HelperTextDetailProps {
|
|
|
60
59
|
showValue?: string;
|
|
61
60
|
/** 下级字段 */
|
|
62
61
|
childrenName?: string;
|
|
63
|
-
/** 默认值,多选时为数组,单选时为单值 */
|
|
64
|
-
defaultValue?: string | number | boolean | Array<string | number | boolean>;
|
|
65
|
-
/** 选中值,多选时为数组,单选时为单值(受控) */
|
|
66
|
-
value?: string | number | boolean | Array<string | number | boolean>;
|
|
67
62
|
/** 超出换行 */
|
|
68
63
|
overLine?: boolean;
|
|
69
64
|
/** 是否有搜索 */
|
|
@@ -80,10 +75,6 @@ export interface SelectProps extends HelperTextDetailProps {
|
|
|
80
75
|
morePopoverClassName?: string;
|
|
81
76
|
/** 返回输入建议的方法 */
|
|
82
77
|
fetchSuggestions?: (val: string, cb: (data: SelectOption[]) => void) => void;
|
|
83
|
-
/** 改变值回调 */
|
|
84
|
-
onChange?: (val: string | number | boolean | Array<string | number | boolean>, e: React.SyntheticEvent) => void;
|
|
85
|
-
/** 全局回车事件 */
|
|
86
|
-
onEnter?: (val: string | number | boolean | Array<string | number | boolean>) => void;
|
|
87
78
|
/** 搜索框输入框回车事件 */
|
|
88
79
|
onEnterInput?: (val: string) => void;
|
|
89
80
|
/** 点击清空内容回调 */
|
|
@@ -92,7 +83,39 @@ export interface SelectProps extends HelperTextDetailProps {
|
|
|
92
83
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
93
84
|
/** 失去焦点改变值 */
|
|
94
85
|
blurChangeValueBol?: boolean;
|
|
95
|
-
[name: string]: unknown;
|
|
96
86
|
}
|
|
97
|
-
|
|
87
|
+
/** 单选模式 */
|
|
88
|
+
export interface SelectSingleProps<T extends SelectOptionValue = SelectOptionValue> extends SelectBaseProps<T> {
|
|
89
|
+
/** 是否多选(未传或 false 为单选) */
|
|
90
|
+
multiple?: false;
|
|
91
|
+
/** 默认值(单选) */
|
|
92
|
+
defaultValue?: T;
|
|
93
|
+
/** 选中值(单选受控) */
|
|
94
|
+
value?: T;
|
|
95
|
+
/** 改变值回调;清空时 val 为空字符串 */
|
|
96
|
+
/** 改变值回调;清空时 val 为 undefined */
|
|
97
|
+
onChange?: (val: T | undefined, e: React.SyntheticEvent) => void;
|
|
98
|
+
/** 全局回车事件(单选) */
|
|
99
|
+
onEnter?: (val: T) => void;
|
|
100
|
+
}
|
|
101
|
+
/** 多选模式 */
|
|
102
|
+
export interface SelectMultipleProps<T extends SelectOptionValue = SelectOptionValue> extends SelectBaseProps<T> {
|
|
103
|
+
/** 是否多选 */
|
|
104
|
+
multiple: true;
|
|
105
|
+
/** 默认值(多选) */
|
|
106
|
+
defaultValue?: T[];
|
|
107
|
+
/** 选中值(多选受控) */
|
|
108
|
+
value?: T[];
|
|
109
|
+
/** 改变值回调(多选) */
|
|
110
|
+
onChange?: (val: T[], e: React.SyntheticEvent) => void;
|
|
111
|
+
/** 全局回车事件(多选) */
|
|
112
|
+
onEnter?: (val: T[]) => void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Select 的 props
|
|
116
|
+
* - `multiple` 未传或为 `false`:value / defaultValue 为 `T`,onChange/onEnter 入参为 `T`(清空时 `undefined`)
|
|
117
|
+
* - `multiple` 为 `true`:value / defaultValue 为 `T[]`,onChange/onEnter 入参为 `T[]`(清空时 `[]`)
|
|
118
|
+
*/
|
|
119
|
+
export type SelectProps<T extends SelectOptionValue = SelectOptionValue> = SelectSingleProps<T> | SelectMultipleProps<T>;
|
|
120
|
+
declare function Select<T extends SelectOptionValue = SelectOptionValue>(outerProps: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
98
121
|
export default Select;
|