@para-ui/core 5.0.0-beta.6 → 5.0.0-beta.7

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 CHANGED
@@ -1,3 +1,18 @@
1
+ ## 🎉 para-ui/core@5.0.0-beta.7 发布
2
+
3
+ ⚠️【Breaking Change】
4
+
5
+ - 【表格-Table】`setCheck` 签名修正:`(arr: T[], data: T) => void` → `(keys: string[], data: T[]) => void`。第一参数始终为选中行的 rowKey 字符串数组(JS 对象键规范保证),第二参数为选中行的数据数组;原类型声明与运行时不符,业务代码普遍通过 `useState<any>` 绕过,升级后需按新签名声明
6
+ - 【表格-Table】`checkDefaultValue` 签名修正:`T[]` → `string[]`,与 `setCheck` 对齐,传入的是 rowKey 字符串数组;业务主键为 `number` 时需自行 `keys.map(String)`
7
+ - 【表格-Table】`data` 由 `Anyjson[]` 收窄为 `T[]`,`render(row)` 等回调里 `row` 按 `<Table<T>>` 指定的业务类型精确推导;以前依赖 `Anyjson` 索引签名访问未声明字段的代码需在 `T` 中显式声明字段
8
+ - 【表格-Table】`HeadDataProps` / `HeadDataReqProps` / `TableProps` / `ReqProps` / `FilterEnumsProps` 移除 `[name: string]: unknown` / `[key: string]: unknown` 索引签名,未声明字段的透传写法会 TS 报错
9
+ - 【表格-Table】`TableHeadBodyPublicProps.operate` 补齐泛型:`HeadDataProps` → `HeadDataProps<T>`,`operate.render(row)` 的 `row` 能推导为业务类型 `T`
10
+ - 【按钮-Button / IconButton】移除 `[name: string]: any` 索引签名;原生属性基类由 `React.ButtonHTMLAttributes<any>` 精确化为 `button / a` 共用的 DOM 属性集合,`type` 收窄为 `'button' | 'submit' | 'reset'`。原来依赖"未声明字段透传"或 `type` 传入自定义字符串的写法会 TS 报错
11
+
12
+ 🔧【Bugfix】
13
+
14
+ - 【自动按钮-AutoButton】修复 `SplitButton.options` 内嵌套数组项被当成单选项渲染导致报错的问题
15
+
1
16
  ## 🎉 para-ui/core@5.0.0-beta.6 发布
2
17
 
3
18
  🎁【Feature】
@@ -1,13 +1,13 @@
1
1
  import { j as n } from "../_virtual/jsx-runtime.js";
2
- import { useState as A, useRef as C, useEffect as S, Fragment as u } from "react";
2
+ import { useState as w, useRef as y, useEffect as S, Fragment as u } from "react";
3
3
  import { Button as i } from "../Button/index.js";
4
4
  import z from "../AutoTips/index.js";
5
5
  import { PopConfirm as E } from "../PopConfirm/index.js";
6
6
  import { MoreVert as F } from "../node_modules/@para-ui/icons/MoreVert/index.js";
7
- import { $prefixCls as v } from "../GlobalContext/constant.js";
7
+ import { $prefixCls as C } from "../GlobalContext/constant.js";
8
8
  import { Dropdown as O } from "../Dropdown/index.js";
9
9
  import { Tooltip as J } from "../Tooltip/index.js";
10
- import y from "clsx";
10
+ import v from "clsx";
11
11
  import L from "../GlobalContext/useFormatMessage.js";
12
12
  import V from "./lang/index.js";
13
13
  import q from "../Utils/Hooks/useResizeObserver.js";
@@ -17,12 +17,12 @@ const lt = (P) => {
17
17
  className: M,
18
18
  style: T,
19
19
  list: e,
20
- marginRight: d = "16px",
20
+ marginRight: f = "16px",
21
21
  moreProps: B,
22
22
  morePlacement: N = "bottomLeft",
23
23
  moreMaxWidth: R = "500px",
24
24
  trigger: k = ["hover"]
25
- } = P, D = L("AutoButton", V), [l, f] = A(null), c = C(null), a = C({
25
+ } = P, A = L("AutoButton", V), [l, d] = w(null), c = y(null), a = y({
26
26
  timer: null
27
27
  });
28
28
  q({
@@ -33,7 +33,7 @@ const lt = (P) => {
33
33
  }, [e]);
34
34
  const h = () => {
35
35
  a.current.timer && clearTimeout(a.current.timer), a.current.timer = setTimeout(() => {
36
- f(e.length), e.length > 1 && b();
36
+ d(e.length), e.length > 1 && b();
37
37
  }, 100);
38
38
  }, b = (t) => {
39
39
  if (t === null || t === 0) return;
@@ -41,9 +41,9 @@ const lt = (P) => {
41
41
  const o = c.current;
42
42
  if (o && o.scrollWidth > o.clientWidth) {
43
43
  const r = Number(t) - 1;
44
- f(r), b(r);
44
+ d(r), b(r);
45
45
  }
46
- }, $ = (t, o, r) => {
46
+ }, D = (t, o, r) => {
47
47
  if (r) {
48
48
  r.onClick && r.onClick(o);
49
49
  return;
@@ -55,11 +55,11 @@ const lt = (P) => {
55
55
  variant: "text",
56
56
  disabled: t.disabled,
57
57
  loading: t.loading,
58
- className: y("item-btn", {
58
+ className: v("item-btn", {
59
59
  "item-btn-disabled": t.disabled
60
60
  }),
61
61
  onClick: (s) => {
62
- t.disabled || $(t, s, r);
62
+ t.disabled || D(t, s, r);
63
63
  },
64
64
  children: /* @__PURE__ */ n.jsx(z, { placement: "top-start", children: t[o] })
65
65
  }
@@ -70,16 +70,16 @@ const lt = (P) => {
70
70
  ...t.disabledTooltip,
71
71
  children: g(t, o, r)
72
72
  }
73
- ) : g(t, o, r), I = () => /* @__PURE__ */ n.jsx(
73
+ ) : g(t, o, r), $ = () => /* @__PURE__ */ n.jsx(
74
74
  "div",
75
75
  {
76
76
  className: "auto-button-dropdown-content",
77
77
  style: { maxWidth: R },
78
- children: e && e.map((t, o) => l !== null && l > o ? null : t.buttonType !== "split" ? /* @__PURE__ */ n.jsx(u, { children: m(t, j(t, "children")) }, o) : /* @__PURE__ */ n.jsx(u, { children: t.options?.map((r, s) => /* @__PURE__ */ n.jsx(u, { children: m(r, j(r, "label", t)) }, `${o}-${s}`)) }, o))
78
+ children: e && e.map((t, o) => l !== null && l > o ? null : t.buttonType !== "split" ? /* @__PURE__ */ n.jsx(u, { children: m(t, j(t, "children")) }, o) : /* @__PURE__ */ n.jsx(u, { children: t.options?.map((r, s) => Array.isArray(r) ? null : /* @__PURE__ */ n.jsx(u, { children: m(r, j(r, "label", t)) }, `${o}-${s}`)) }, o))
79
79
  }
80
- ), W = () => {
80
+ ), I = () => {
81
81
  if (!(l !== null && e.length > l)) return null;
82
- const { buttonType: t, icon: o = /* @__PURE__ */ n.jsx(F, {}), children: r = D({ id: "more" }) } = B || {};
82
+ const { buttonType: t, icon: o = /* @__PURE__ */ n.jsx(F, {}), children: r = A({ id: "more" }) } = B || {};
83
83
  let s = /* @__PURE__ */ n.jsx(
84
84
  i,
85
85
  {
@@ -99,8 +99,8 @@ const lt = (P) => {
99
99
  )), /* @__PURE__ */ n.jsx(
100
100
  O,
101
101
  {
102
- overlayClassName: `${v}-auto-button-dropdown`,
103
- overlay: I(),
102
+ overlayClassName: `${C}-auto-button-dropdown`,
103
+ overlay: $(),
104
104
  placement: N,
105
105
  trigger: k,
106
106
  children: s
@@ -110,29 +110,29 @@ const lt = (P) => {
110
110
  return /* @__PURE__ */ n.jsxs(
111
111
  "div",
112
112
  {
113
- className: y(M, `${v}-auto-button`),
113
+ className: v(M, `${C}-auto-button`),
114
114
  style: T,
115
115
  ref: c,
116
116
  children: [
117
117
  e.map((t, o) => {
118
118
  if (l !== null && l <= o) return null;
119
- const { buttonType: r, popConfirmProps: s, ...w } = t;
119
+ const { buttonType: r, popConfirmProps: s, ...W } = t;
120
120
  let p = i;
121
121
  const x = {
122
- marginRight: l === o + 1 ? 0 : d
122
+ marginRight: l === o + 1 ? 0 : f
123
123
  };
124
- return l !== null && e.length > l && (x.marginRight = d), r === "icon" && (p = i.IconButton), r === "split" && (p = i.SplitButton), /* @__PURE__ */ n.jsx(u, { children: m(
124
+ return l !== null && e.length > l && (x.marginRight = f), r === "icon" && (p = i.IconButton), r === "split" && (p = i.SplitButton), /* @__PURE__ */ n.jsx(u, { children: m(
125
125
  t,
126
126
  /* @__PURE__ */ n.jsx(
127
127
  p,
128
128
  {
129
- ...w,
129
+ ...W,
130
130
  style: x
131
131
  }
132
132
  )
133
133
  ) }, o);
134
134
  }),
135
- W()
135
+ I()
136
136
  ]
137
137
  }
138
138
  );
@@ -1,7 +1,10 @@
1
1
  import { default as React, FunctionComponent } from 'react';
2
2
  import { TooltipProps } from '../Tooltip';
3
3
  import { default as SplitButton } from './SplitButton';
4
- export interface ButtonProps extends React.ButtonHTMLAttributes<any> {
4
+ type ButtonOrAnchorAttributes = Omit<React.ButtonHTMLAttributes<HTMLElement> & React.AnchorHTMLAttributes<HTMLElement>, 'type'>;
5
+ export interface ButtonProps extends ButtonOrAnchorAttributes {
6
+ /** 原生 button type */
7
+ type?: 'button' | 'submit' | 'reset';
5
8
  variant?: 'contained' | 'outlined' | 'text';
6
9
  /** 设置按钮载入状态 */
7
10
  loading?: boolean | {
@@ -35,9 +38,10 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<any> {
35
38
  target?: string;
36
39
  /** 禁用提示 */
37
40
  disabledTooltip?: TooltipProps;
38
- [name: string]: any;
39
41
  }
40
- export interface IconButtonProps extends React.ButtonHTMLAttributes<any> {
42
+ export interface IconButtonProps extends ButtonOrAnchorAttributes {
43
+ /** 原生 button type */
44
+ type?: 'button' | 'submit' | 'reset';
41
45
  /** 按钮形状 */
42
46
  variant?: 'contained' | 'outlined' | 'text' | 'activate';
43
47
  size?: 'small' | 'medium' | 'large';
@@ -65,7 +69,6 @@ export interface IconButtonProps extends React.ButtonHTMLAttributes<any> {
65
69
  target?: string;
66
70
  /** 禁用提示 */
67
71
  disabledTooltip?: TooltipProps;
68
- [name: string]: any;
69
72
  }
70
73
  declare const InternalButton: FunctionComponent<ButtonProps>;
71
74
  declare const IconButton: FunctionComponent<IconButtonProps>;
@@ -21,7 +21,6 @@ export interface FilterEnumsProps {
21
21
  displayName?: ReactNode;
22
22
  /** 值 */
23
23
  value?: unknown;
24
- [name: string]: unknown;
25
24
  }
26
25
  /** 渲染数据参数 */
27
26
  export interface HeadDataProps<T = unknown> {
@@ -78,7 +77,6 @@ export interface HeadDataProps<T = unknown> {
78
77
  tipMaxWidth?: number | string;
79
78
  /** 排序,请求才有 */
80
79
  orderNum?: number;
81
- [name: string]: unknown;
82
80
  }
83
81
  /** 远程数据的表头显示列 */
84
82
  export interface HeadDataReqProps {
@@ -94,7 +92,6 @@ export interface HeadDataReqProps {
94
92
  orderFlag?: boolean;
95
93
  /** 表头是否显示该字段 */
96
94
  selectedFlag?: boolean;
97
- [name: string]: unknown;
98
95
  }
99
96
  /** 固定列/拖拽 位置信息 */
100
97
  export interface PosFixedProps {
@@ -118,7 +115,7 @@ export interface TableHeadBodyPublicProps<T = unknown> {
118
115
  /** 对齐方式 */
119
116
  align?: AlignType;
120
117
  /** 操作栏 */
121
- operate?: HeadDataProps;
118
+ operate?: HeadDataProps<T>;
122
119
  /** 是否显示列 里面 不显示 */
123
120
  showColumns?: 'inside' | false;
124
121
  /** 是否等分表格,出滚动条 */
@@ -163,7 +160,7 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
163
160
  /** 请求方式 */
164
161
  method?: MethodType;
165
162
  /** 本地数据源 */
166
- data?: Anyjson[];
163
+ data?: T[];
167
164
  /** 页数 */
168
165
  page?: number;
169
166
  /** 一页条数 */
@@ -186,12 +183,15 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
186
183
  tableCell?: (row: T, params: unknown) => ReactNode;
187
184
  /** 请求回调参数 requestCallback(data, cb) cb(data) 需要回调数据回来 */
188
185
  requestCallback?: (data: Record<string, unknown>, cb: (data: Record<string, unknown>) => void) => void;
189
- /** 默认复选框选中值 */
190
- checkDefaultValue?: T[];
186
+ /** 默认复选框选中值(选中行的 rowKey 数组,始终为 string[];若业务主键为 number,需自行 String 转换) */
187
+ checkDefaultValue?: string[];
191
188
  /** 显示已选条数 */
192
189
  checkCount?: boolean;
193
- /** 设置复选框选中值 */
194
- setCheck?: (arr: T[], data: T) => void;
190
+ /** 设置复选框选中值
191
+ * @param keys 选中行的 rowKey 数组(JS 对象键,始终为 string[];若业务主键为 number,需自行 Number 转换)
192
+ * @param data 选中行的数据数组
193
+ */
194
+ setCheck?: (keys: string[], data: T[]) => void;
195
195
  /** 默认单选选中值 */
196
196
  radioDefaultValue?: string | number;
197
197
  /** 设置单选框选中值 */
@@ -302,7 +302,6 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
302
302
  * 内部刷新事件回调
303
303
  * */
304
304
  onRefreshCallback?: (type: 'empty' | 'refresh') => void;
305
- [key: string]: unknown;
306
305
  }
307
306
  export interface ExpandableRowItem {
308
307
  /** 当前嵌套行id */
@@ -324,7 +323,6 @@ export interface ReqProps {
324
323
  ctx?: string;
325
324
  /** 请求参数 */
326
325
  data?: Record<string, unknown> | Anyjson;
327
- [name: string]: unknown;
328
326
  }
329
327
  /** 显示列LocalStorage item */
330
328
  export interface HeadLocalStorageItem {
@@ -1,5 +1,5 @@
1
- var e = { exports: {} };
1
+ var s = { exports: {} };
2
2
  export {
3
- e as __module
3
+ s as __module
4
4
  };
5
5
  //# sourceMappingURL=index3.js.map
@@ -1,5 +1,5 @@
1
- var s = { exports: {} };
1
+ var e = { exports: {} };
2
2
  export {
3
- s as __module
3
+ e as __module
4
4
  };
5
5
  //# sourceMappingURL=index4.js.map
@@ -1,4 +1,4 @@
1
- import { __module as dist } from "../../../../_virtual/index3.js";
1
+ import { __module as dist } from "../../../../_virtual/index4.js";
2
2
  import React__default from "react";
3
3
  import require$$1 from "@paraview/lib";
4
4
  import ReactDOM from "react-dom";
@@ -1,4 +1,4 @@
1
- import { __module as s } from "../../_virtual/index4.js";
1
+ import { __module as s } from "../../_virtual/index3.js";
2
2
  var u;
3
3
  function c() {
4
4
  return u ? s.exports : (u = 1, (function(i) {
@@ -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"),u=require("react"),l=require("../Button/index.js"),F=require("../AutoTips/index.js"),S=require("../PopConfirm/index.js"),w=require("../node_modules/@para-ui/icons/MoreVert/index.js"),g=require("../GlobalContext/constant.js"),A=require("../Dropdown/index.js"),I=require("../Tooltip/index.js"),E=require("clsx"),W=require("../GlobalContext/useFormatMessage.js"),O=require("./lang/index.js"),z=require("../Utils/Hooks/useResizeObserver.js");;/* empty css */const B=q=>{const{className:C,style:v,list:o,marginRight:x="16px",moreProps:P,morePlacement:y="bottomLeft",moreMaxWidth:M="500px",trigger:T=["hover"]}=q,N=W.default("AutoButton",O.default),[s,m]=u.useState(null),c=u.useRef(null),a=u.useRef({timer:null});z.default({dom:c.current,cb:()=>f()}),u.useEffect(()=>{f()},[o]);const f=()=>{a.current.timer&&clearTimeout(a.current.timer),a.current.timer=setTimeout(()=>{m(o.length),o.length>1&&j()},100)},j=t=>{if(t===null||t===0)return;t===void 0&&(t=o.length);const e=c.current;if(e&&e.scrollWidth>e.clientWidth){const n=Number(t)-1;m(n),j(n)}},_=(t,e,n)=>{if(n){n.onClick&&n.onClick(e);return}t.onClick&&t.onClick(e)},h=(t,e,n)=>r.jsxRuntimeExports.jsx(l.Button,{variant:"text",disabled:t.disabled,loading:t.loading,className:E("item-btn",{"item-btn-disabled":t.disabled}),onClick:i=>{t.disabled||_(t,i,n)},children:r.jsxRuntimeExports.jsx(F.default,{placement:"top-start",children:t[e]})}),b=(t,e,n)=>t.disabled&&t.disabledTooltip?r.jsxRuntimeExports.jsx(I.Tooltip,{disabled:!0,...t.disabledTooltip,children:h(t,e,n)}):h(t,e,n),$=()=>r.jsxRuntimeExports.jsx("div",{className:"auto-button-dropdown-content",style:{maxWidth:M},children:o&&o.map((t,e)=>s!==null&&s>e?null:t.buttonType!=="split"?r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,b(t,"children"))},e):r.jsxRuntimeExports.jsx(u.Fragment,{children:t.options?.map((n,i)=>r.jsxRuntimeExports.jsx(u.Fragment,{children:d(n,b(n,"label",t))},`${e}-${i}`))},e))}),k=()=>{if(!(s!==null&&o.length>s))return null;const{buttonType:t,icon:e=r.jsxRuntimeExports.jsx(w.MoreVert,{}),children:n=N({id:"more"})}=P||{};let i=r.jsxRuntimeExports.jsx(l.Button,{variant:"outlined",startIcon:e,className:"auto-button-more",children:n});return t==="icon"&&(i=r.jsxRuntimeExports.jsx(l.Button.IconButton,{variant:"outlined",className:"auto-button-more",children:e})),r.jsxRuntimeExports.jsx(A.Dropdown,{overlayClassName:`${g.$prefixCls}-auto-button-dropdown`,overlay:$(),placement:y,trigger:T,children:i})},d=(t,e)=>t.popConfirmProps?r.jsxRuntimeExports.jsx(S.PopConfirm,{...t.popConfirmProps,children:e}):e;return r.jsxRuntimeExports.jsxs("div",{className:E(C,`${g.$prefixCls}-auto-button`),style:v,ref:c,children:[o.map((t,e)=>{if(s!==null&&s<=e)return null;const{buttonType:n,popConfirmProps:i,...D}=t;let p=l.Button;const R={marginRight:s===e+1?0:x};return s!==null&&o.length>s&&(R.marginRight=x),n==="icon"&&(p=l.Button.IconButton),n==="split"&&(p=l.Button.SplitButton),r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,r.jsxRuntimeExports.jsx(p,{...D,style:R}))},e)}),k()]})};exports.AutoButton=B;exports.default=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),u=require("react"),l=require("../Button/index.js"),D=require("../AutoTips/index.js"),F=require("../PopConfirm/index.js"),S=require("../node_modules/@para-ui/icons/MoreVert/index.js"),g=require("../GlobalContext/constant.js"),w=require("../Dropdown/index.js"),I=require("../Tooltip/index.js"),E=require("clsx"),W=require("../GlobalContext/useFormatMessage.js"),O=require("./lang/index.js"),z=require("../Utils/Hooks/useResizeObserver.js");;/* empty css */const B=q=>{const{className:y,style:C,list:o,marginRight:x="16px",moreProps:v,morePlacement:P="bottomLeft",moreMaxWidth:M="500px",trigger:T=["hover"]}=q,N=W.default("AutoButton",O.default),[s,m]=u.useState(null),c=u.useRef(null),a=u.useRef({timer:null});z.default({dom:c.current,cb:()=>f()}),u.useEffect(()=>{f()},[o]);const f=()=>{a.current.timer&&clearTimeout(a.current.timer),a.current.timer=setTimeout(()=>{m(o.length),o.length>1&&j()},100)},j=t=>{if(t===null||t===0)return;t===void 0&&(t=o.length);const e=c.current;if(e&&e.scrollWidth>e.clientWidth){const n=Number(t)-1;m(n),j(n)}},_=(t,e,n)=>{if(n){n.onClick&&n.onClick(e);return}t.onClick&&t.onClick(e)},h=(t,e,n)=>r.jsxRuntimeExports.jsx(l.Button,{variant:"text",disabled:t.disabled,loading:t.loading,className:E("item-btn",{"item-btn-disabled":t.disabled}),onClick:i=>{t.disabled||_(t,i,n)},children:r.jsxRuntimeExports.jsx(D.default,{placement:"top-start",children:t[e]})}),b=(t,e,n)=>t.disabled&&t.disabledTooltip?r.jsxRuntimeExports.jsx(I.Tooltip,{disabled:!0,...t.disabledTooltip,children:h(t,e,n)}):h(t,e,n),$=()=>r.jsxRuntimeExports.jsx("div",{className:"auto-button-dropdown-content",style:{maxWidth:M},children:o&&o.map((t,e)=>s!==null&&s>e?null:t.buttonType!=="split"?r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,b(t,"children"))},e):r.jsxRuntimeExports.jsx(u.Fragment,{children:t.options?.map((n,i)=>Array.isArray(n)?null:r.jsxRuntimeExports.jsx(u.Fragment,{children:d(n,b(n,"label",t))},`${e}-${i}`))},e))}),k=()=>{if(!(s!==null&&o.length>s))return null;const{buttonType:t,icon:e=r.jsxRuntimeExports.jsx(S.MoreVert,{}),children:n=N({id:"more"})}=v||{};let i=r.jsxRuntimeExports.jsx(l.Button,{variant:"outlined",startIcon:e,className:"auto-button-more",children:n});return t==="icon"&&(i=r.jsxRuntimeExports.jsx(l.Button.IconButton,{variant:"outlined",className:"auto-button-more",children:e})),r.jsxRuntimeExports.jsx(w.Dropdown,{overlayClassName:`${g.$prefixCls}-auto-button-dropdown`,overlay:$(),placement:P,trigger:T,children:i})},d=(t,e)=>t.popConfirmProps?r.jsxRuntimeExports.jsx(F.PopConfirm,{...t.popConfirmProps,children:e}):e;return r.jsxRuntimeExports.jsxs("div",{className:E(y,`${g.$prefixCls}-auto-button`),style:C,ref:c,children:[o.map((t,e)=>{if(s!==null&&s<=e)return null;const{buttonType:n,popConfirmProps:i,...A}=t;let p=l.Button;const R={marginRight:s===e+1?0:x};return s!==null&&o.length>s&&(R.marginRight=x),n==="icon"&&(p=l.Button.IconButton),n==="split"&&(p=l.Button.SplitButton),r.jsxRuntimeExports.jsx(u.Fragment,{children:d(t,r.jsxRuntimeExports.jsx(p,{...A,style:R}))},e)}),k()]})};exports.AutoButton=B;exports.default=B;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,10 @@
1
1
  import { default as React, FunctionComponent } from 'react';
2
2
  import { TooltipProps } from '../Tooltip';
3
3
  import { default as SplitButton } from './SplitButton';
4
- export interface ButtonProps extends React.ButtonHTMLAttributes<any> {
4
+ type ButtonOrAnchorAttributes = Omit<React.ButtonHTMLAttributes<HTMLElement> & React.AnchorHTMLAttributes<HTMLElement>, 'type'>;
5
+ export interface ButtonProps extends ButtonOrAnchorAttributes {
6
+ /** 原生 button type */
7
+ type?: 'button' | 'submit' | 'reset';
5
8
  variant?: 'contained' | 'outlined' | 'text';
6
9
  /** 设置按钮载入状态 */
7
10
  loading?: boolean | {
@@ -35,9 +38,10 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<any> {
35
38
  target?: string;
36
39
  /** 禁用提示 */
37
40
  disabledTooltip?: TooltipProps;
38
- [name: string]: any;
39
41
  }
40
- export interface IconButtonProps extends React.ButtonHTMLAttributes<any> {
42
+ export interface IconButtonProps extends ButtonOrAnchorAttributes {
43
+ /** 原生 button type */
44
+ type?: 'button' | 'submit' | 'reset';
41
45
  /** 按钮形状 */
42
46
  variant?: 'contained' | 'outlined' | 'text' | 'activate';
43
47
  size?: 'small' | 'medium' | 'large';
@@ -65,7 +69,6 @@ export interface IconButtonProps extends React.ButtonHTMLAttributes<any> {
65
69
  target?: string;
66
70
  /** 禁用提示 */
67
71
  disabledTooltip?: TooltipProps;
68
- [name: string]: any;
69
72
  }
70
73
  declare const InternalButton: FunctionComponent<ButtonProps>;
71
74
  declare const IconButton: FunctionComponent<IconButtonProps>;
@@ -21,7 +21,6 @@ export interface FilterEnumsProps {
21
21
  displayName?: ReactNode;
22
22
  /** 值 */
23
23
  value?: unknown;
24
- [name: string]: unknown;
25
24
  }
26
25
  /** 渲染数据参数 */
27
26
  export interface HeadDataProps<T = unknown> {
@@ -78,7 +77,6 @@ export interface HeadDataProps<T = unknown> {
78
77
  tipMaxWidth?: number | string;
79
78
  /** 排序,请求才有 */
80
79
  orderNum?: number;
81
- [name: string]: unknown;
82
80
  }
83
81
  /** 远程数据的表头显示列 */
84
82
  export interface HeadDataReqProps {
@@ -94,7 +92,6 @@ export interface HeadDataReqProps {
94
92
  orderFlag?: boolean;
95
93
  /** 表头是否显示该字段 */
96
94
  selectedFlag?: boolean;
97
- [name: string]: unknown;
98
95
  }
99
96
  /** 固定列/拖拽 位置信息 */
100
97
  export interface PosFixedProps {
@@ -118,7 +115,7 @@ export interface TableHeadBodyPublicProps<T = unknown> {
118
115
  /** 对齐方式 */
119
116
  align?: AlignType;
120
117
  /** 操作栏 */
121
- operate?: HeadDataProps;
118
+ operate?: HeadDataProps<T>;
122
119
  /** 是否显示列 里面 不显示 */
123
120
  showColumns?: 'inside' | false;
124
121
  /** 是否等分表格,出滚动条 */
@@ -163,7 +160,7 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
163
160
  /** 请求方式 */
164
161
  method?: MethodType;
165
162
  /** 本地数据源 */
166
- data?: Anyjson[];
163
+ data?: T[];
167
164
  /** 页数 */
168
165
  page?: number;
169
166
  /** 一页条数 */
@@ -186,12 +183,15 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
186
183
  tableCell?: (row: T, params: unknown) => ReactNode;
187
184
  /** 请求回调参数 requestCallback(data, cb) cb(data) 需要回调数据回来 */
188
185
  requestCallback?: (data: Record<string, unknown>, cb: (data: Record<string, unknown>) => void) => void;
189
- /** 默认复选框选中值 */
190
- checkDefaultValue?: T[];
186
+ /** 默认复选框选中值(选中行的 rowKey 数组,始终为 string[];若业务主键为 number,需自行 String 转换) */
187
+ checkDefaultValue?: string[];
191
188
  /** 显示已选条数 */
192
189
  checkCount?: boolean;
193
- /** 设置复选框选中值 */
194
- setCheck?: (arr: T[], data: T) => void;
190
+ /** 设置复选框选中值
191
+ * @param keys 选中行的 rowKey 数组(JS 对象键,始终为 string[];若业务主键为 number,需自行 Number 转换)
192
+ * @param data 选中行的数据数组
193
+ */
194
+ setCheck?: (keys: string[], data: T[]) => void;
195
195
  /** 默认单选选中值 */
196
196
  radioDefaultValue?: string | number;
197
197
  /** 设置单选框选中值 */
@@ -302,7 +302,6 @@ export interface TableProps<T = unknown> extends TableHeadBodyPublicProps<T> {
302
302
  * 内部刷新事件回调
303
303
  * */
304
304
  onRefreshCallback?: (type: 'empty' | 'refresh') => void;
305
- [key: string]: unknown;
306
305
  }
307
306
  export interface ExpandableRowItem {
308
307
  /** 当前嵌套行id */
@@ -324,7 +323,6 @@ export interface ReqProps {
324
323
  ctx?: string;
325
324
  /** 请求参数 */
326
325
  data?: Record<string, unknown> | Anyjson;
327
- [name: string]: unknown;
328
326
  }
329
327
  /** 显示列LocalStorage item */
330
328
  export interface HeadLocalStorageItem {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@para-ui/core",
3
3
  "private": false,
4
- "version": "5.0.0-beta.6",
4
+ "version": "5.0.0-beta.7",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",
7
7
  "typings": "./index.d.ts",