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

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.
@@ -1,38 +1,48 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, CSSProperties } from 'react';
2
2
  import { TextFieldProps, SelectProps, SwitchProps, InputNumberProps, InputLangProps, ComboSelectProps, DatePickerProps } from '../index';
3
3
  import { LabelProps } from '../Label';
4
4
  import { TooltipProps } from '../Tooltip';
5
5
  /**组件类型:输入框,下拉框,开关,数字输入框,国际化输入框,日期框,时间选择框,组合选择器,自定义组件*/
6
6
  export type IInputType = 'TextField' | 'Select' | 'Switch' | 'InputNumber' | 'InputLang' | 'ComboSelect' | 'DatePicker' | 'custom';
7
- /** 配置项*/
8
- export type IConfig = {
9
- /** 字段名,用于匹配*/
10
- name?: string;
11
- /** 组件类型*/
7
+ /** value集合 —— 单行 value 值集合,name 映射 configItem 中的 name */
8
+ export type IValueList<T extends Record<string, unknown> = Record<string, unknown>> = T;
9
+ /** error集合 —— 单行错误集合,name 映射 configItem 中的 name;按 keyof T 精确收窄,rowKey 字段通过 cast 访问 */
10
+ export type IErrors<T extends Record<string, unknown> = Record<string, unknown>> = {
11
+ [K in keyof T]?: unknown;
12
+ };
13
+ /** 配置项 */
14
+ export type IConfig<T extends Record<string, unknown> = Record<string, unknown>> = {
15
+ /** 字段名,用于匹配 valueList 中的 key */
16
+ name?: keyof T & string;
17
+ /** 组件类型 */
12
18
  inputType?: IInputType;
13
- /** 渲染自定义组件*/
14
- customRender?: (name: string, rowIndex: number, valueList: IValueList[], errors?: IErrors[]) => ReactNode;
15
- /** 禁用置灰组件*/
16
- isDisabled?: boolean | ((rowIndex: number, name: string, valueList: IValueList[]) => boolean);
17
- /** 固定字段,不需要显示在筛选器中的需要设置为true, 若不设置无法显示表单*/
19
+ /** 渲染自定义组件 */
20
+ customRender?: (name: keyof T & string, rowIndex: number, valueList: IValueList<T>[], errors?: IErrors<T>[]) => ReactNode;
21
+ /** 禁用置灰组件 */
22
+ isDisabled?: boolean | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => boolean);
23
+ /** 固定字段,不需要显示在筛选器中的需要设置为 true,若不设置无法显示表单 */
18
24
  isFixed?: boolean;
19
- /** 用于switch*/
20
- text?: ReactNode | ((rowIndex: number, name: string, valueList: IValueList[]) => ReactNode);
21
- /** 是否必填*/
25
+ /** 用于 switch */
26
+ text?: ReactNode | ((rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => ReactNode);
27
+ /** 是否必填 */
22
28
  required?: boolean;
23
- /** 下拉列表数据,若某一列的每一行的下拉列表数据一致, 则只需传入数组,若需要自定义任意下拉列表数据,则传入函数*/
24
- list?: ((rowIndex: number, id: string, name: string, valueList: IValueList[]) => unknown[]) | unknown[];
29
+ /** 下拉列表数据,若某一列的每一行的下拉列表数据一致,则只需传入数组;若需要自定义任意下拉列表数据,则传入函数 */
30
+ list?: ((rowIndex: number, id: string, name: keyof T & string, valueList: IValueList<T>[]) => unknown[]) | unknown[];
25
31
  /** 样式 */
26
- style?: React.CSSProperties;
32
+ style?: CSSProperties;
27
33
  /** 标题样式 */
28
34
  labelProps?: LabelProps;
29
- /** 组件其他样式,返回每个组件的样式 */
30
- otherProps?: (rowIndex: number, name: string, valueList: IValueList[]) => Record<string, unknown>;
31
- /** 其他*/
35
+ /** 组件其他样式,返回每个组件的样式 */
36
+ otherProps?: (rowIndex: number, name: keyof T & string, valueList: IValueList<T>[]) => Record<string, unknown>;
37
+ /**
38
+ * 其他字段
39
+ * 索引签名保留:IConfig 与 (TextFieldProps | SelectProps | ...) 多态子组件 props 交叉,
40
+ * 业务方需要透传不同子组件的 props(如 placeholder、suffix 等),与 Tabs/Table/Button 移除索引签名的情境不同
41
+ */
32
42
  [name: string]: unknown;
33
43
  } & (TextFieldProps | SelectProps | SwitchProps | InputNumberProps | InputLangProps | ComboSelectProps | DatePickerProps);
34
44
  /** 操作按钮配置项 */
35
- export interface IOperationButton {
45
+ export interface IOperationButton<T extends Record<string, unknown> = Record<string, unknown>> {
36
46
  /** 按钮标识 */
37
47
  key: string;
38
48
  /** 按钮图标 */
@@ -40,11 +50,11 @@ export interface IOperationButton {
40
50
  /** 按钮文本 */
41
51
  text?: string;
42
52
  /** 是否禁用 */
43
- disabled?: boolean | ((rowIndex: number, item: IValueList, valueList: IValueList[]) => boolean);
53
+ disabled?: boolean | ((rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => boolean);
44
54
  /** 点击事件 */
45
- onClick: (rowIndex: number, item: IValueList, valueList: IValueList[]) => void;
55
+ onClick: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => void;
46
56
  /** 自定义渲染 */
47
- render?: (rowIndex: number, item: IValueList, valueList: IValueList[]) => ReactNode;
57
+ render?: (rowIndex: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
48
58
  /** 样式 */
49
59
  className?: string;
50
60
  /** 提示 */
@@ -57,96 +67,86 @@ export interface IOperationButton {
57
67
  */
58
68
  order?: number;
59
69
  }
60
- /** value集合*/
61
- export interface IValueList {
62
- /** 每行value值集合, name映射configItem中的name*/
63
- [name: string]: unknown;
64
- }
65
- export interface IErrors {
66
- /** 每行错误集合,name映射configItem中的name*/
67
- [name: string]: unknown;
68
- }
69
- export interface ICurrentItem {
70
- /** 表单名*/
71
- name?: string;
72
- /** 表单值*/
73
- value?: unknown;
74
- /** 表单所处下标*/
70
+ /** 当前操作表单项;显式声明字段,禁止挂未声明字段 */
71
+ export interface ICurrentItem<T extends Record<string, unknown> = Record<string, unknown>> {
72
+ /** 表单名 */
73
+ name?: keyof T & string;
74
+ /** 表单值 */
75
+ value?: T[keyof T];
76
+ /** 表单所处下标 */
75
77
  rowIndex?: number;
76
- [name: string]: unknown;
78
+ /** 表单所处行的 rowKey 值(默认 rowKey 为 'id') */
79
+ id?: string;
77
80
  }
78
- /** 过滤回调出参*/
79
- export interface IFilterParams {
80
- /** 当前过滤操作项*/
81
+ /** 过滤回调出参 */
82
+ export interface IFilterParams<T extends Record<string, unknown> = Record<string, unknown>> {
83
+ /** 当前过滤操作项 */
81
84
  name?: string;
82
- /** 是否选中*/
85
+ /** 是否选中 */
83
86
  checkedVal?: string[];
84
- /** 更新后的valueList*/
85
- valueList?: IValueList[];
86
- /** 更新后的错误信息*/
87
- errors?: IErrors[];
87
+ /** 更新后的 valueList */
88
+ valueList?: IValueList<T>[];
89
+ /** 更新后的错误信息 */
90
+ errors?: IErrors<T>[];
88
91
  }
89
- /** 主体接口定义*/
90
- export interface IMultiValueProps {
91
- /** 指定每行key */
92
+ /** 主体接口定义 */
93
+ export interface IMultiValueProps<T extends Record<string, unknown> = Record<string, unknown>> {
94
+ /** 指定每行 key */
92
95
  rowKey?: string;
93
96
  /**
94
97
  * 组件配置项
95
98
  */
96
- config?: IConfig[];
99
+ config?: IConfig<T>[];
97
100
  /**
98
101
  * 筛选配置
99
102
  */
100
- filterConfig?: IConfig[];
103
+ filterConfig?: IConfig<T>[];
101
104
  /**
102
105
  * @desc 回调
103
- * @param valueList 整个value值集合
106
+ * @param valueList 整个 value 值集合
104
107
  * @param currentItem 当前操作表单项
105
108
  * */
106
- onChange?: (valueList: IValueList[], currentItem?: ICurrentItem) => void;
109
+ onChange?: (valueList: IValueList<T>[], currentItem?: ICurrentItem<T>) => void;
107
110
  /**
108
111
  * @desc 新增
109
- * @param valueList 新增前valueList值集合
112
+ * @param valueList 新增前 valueList 值集合
110
113
  * @param errors 新增后错误集合
111
114
  * */
112
- onAdd?: (valueList: IValueList[], errors: IErrors[]) => void;
115
+ onAdd?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
113
116
  /**
114
117
  * 自定义删除
115
118
  * */
116
- deleteRender?: (index: number, item: IValueList, valueList: IValueList[]) => ReactNode;
119
+ deleteRender?: (index: number, item: IValueList<T>, valueList: IValueList<T>[]) => ReactNode;
117
120
  /**
118
- * @desc 删除,
119
- * @param valueList 删除后整个valueList值集合
120
- * @param deleteItem 删除项
121
+ * @desc 删除
122
+ * @param valueList 删除后整个 valueList 值集合
123
+ * @param errors 删除后错误集合
121
124
  */
122
- onDelete?: (valueList: IValueList[], errors: IErrors[]) => void;
125
+ onDelete?: (valueList: IValueList<T>[], errors: IErrors<T>[]) => void;
123
126
  /**
124
127
  * @desc 筛选函数
125
- * @param name 当前筛选项的name
126
- * @param checked 是否选中, true选中, false反选
127
- * @param valueList 筛选后的value
128
128
  * */
129
- onFilter?: (data: IFilterParams) => void;
129
+ onFilter?: (data: IFilterParams<T>) => void;
130
130
  /**
131
131
  * @desc 排序
132
132
  * @param newValueList
133
133
  * @param swapIds 交换顺序的两个下标
134
134
  * */
135
- onSort?: (newValueList: IValueList[], swapIds?: number[]) => void;
135
+ onSort?: (newValueList: IValueList<T>[], swapIds?: number[]) => void;
136
136
  /**
137
137
  * @desc 筛选值的集合
138
138
  * */
139
139
  checkedValue?: string[];
140
140
  /**
141
- * 表单value集合
141
+ * 表单 value 集合
142
142
  */
143
- valueList?: IValueList[];
143
+ valueList?: IValueList<T>[];
144
144
  /**
145
145
  * 表单错误集合
146
146
  */
147
- errors?: IErrors[];
147
+ errors?: IErrors<T>[];
148
148
  /**
149
- * 是否需要支持排序,默认不支持
149
+ * 是否需要支持排序,默认不支持
150
150
  */
151
151
  isSort?: boolean;
152
152
  /**
@@ -154,7 +154,7 @@ export interface IMultiValueProps {
154
154
  */
155
155
  isFilter?: boolean;
156
156
  /**
157
- * 标题模式 none 不显示, single 只有第一列才显示, all 每列都显示
157
+ * 标题模式 none 不显示,single 只有第一列才显示,all 每列都显示
158
158
  */
159
159
  titleMode?: 'none' | 'single' | 'all';
160
160
  /**
@@ -166,11 +166,11 @@ export interface IMultiValueProps {
166
166
  */
167
167
  disabledAddTooltip?: TooltipProps;
168
168
  /**
169
- * 列之间icon
169
+ * 列之间 icon
170
170
  * */
171
171
  icon?: ReactNode;
172
172
  /**
173
- * 隐藏删除icon, string[] 指定某些行隐藏删除按钮, 入参为valueList中的id集合
173
+ * 隐藏删除 iconstring[] 指定某些行隐藏删除按钮,入参为 valueList 中的 id 集合
174
174
  * */
175
175
  deleteDisable?: string[];
176
176
  /**
@@ -187,7 +187,7 @@ export interface IMultiValueProps {
187
187
  /**
188
188
  * 新增项行表单的默认值
189
189
  */
190
- initValue?: Record<string, unknown>;
190
+ initValue?: Partial<T>;
191
191
  /**
192
192
  * 筛选器弹出框样式
193
193
  */
@@ -199,5 +199,5 @@ export interface IMultiValueProps {
199
199
  /**
200
200
  * 自定义操作按钮,支持每行配置多个操作按钮
201
201
  */
202
- operationButtons?: IOperationButton[];
202
+ operationButtons?: IOperationButton<T>[];
203
203
  }
@@ -1,6 +1,6 @@
1
1
  import { InputCodeCard as t } from "./inputCodeCard/index.js";
2
2
  import { InputCodeInput as o } from "./inputCodeInput/index.js";
3
- import '../CodeEditor/index.css';/* empty css */
3
+ import './index.css';/* empty css */
4
4
  const n = {
5
5
  Card: t,
6
6
  Input: o
@@ -1,30 +1,25 @@
1
- import { default as React, FC, ReactNode } from 'react';
1
+ import { default as React, ReactNode } from 'react';
2
2
  import { TabPane, TabsProps as RcTabsProps, TabPaneProps } from 'rc-tabs';
3
3
  import { PopConfirmProps } from '../PopConfirm';
4
4
  import { HelpProps } from '../Help';
5
5
  import { TooltipProps } from '../Tooltip';
6
6
  export type TabsType = 'line' | 'card' | 'editable-card' | 'track' | 'card-container';
7
7
  export type { TabPaneProps };
8
- export interface TabProps {
8
+ export interface TabProps<K extends React.Key = string> extends Omit<TabPaneProps, 'tabKey' | 'tab' | 'children' | 'prefixCls'> {
9
9
  /** tab text */
10
10
  label?: ReactNode;
11
11
  /** tab panel */
12
12
  content?: ReactNode;
13
13
  /** tab key */
14
- value?: React.Key;
15
- /** 禁用 */
16
- disabled?: boolean;
14
+ value: K;
17
15
  /** 禁用文案提示 */
18
16
  disabledTooltip?: TooltipProps;
19
- /** 可关闭标签 */
20
- closable?: boolean;
21
17
  /** 显示帮助提示 Help */
22
18
  showHelp?: boolean;
23
19
  /** help props */
24
20
  helpProps?: HelpProps;
25
- [name: string]: unknown;
26
21
  }
27
- export interface TabsProps extends Omit<RcTabsProps, 'editable'> {
22
+ export interface TabsProps<K extends React.Key = string> extends Omit<RcTabsProps, 'editable' | 'onChange'> {
28
23
  /** tabs 类型 */
29
24
  type?: TabsType;
30
25
  /** 模式:线性、卡片*/
@@ -46,30 +41,29 @@ export interface TabsProps extends Omit<RcTabsProps, 'editable'> {
46
41
  /** popConfirm props*/
47
42
  popConfirmProps?: PopConfirmProps;
48
43
  /** 数据列表*/
49
- data?: TabProps[];
44
+ data?: TabProps<K>[];
50
45
  /** 选中的 value*/
51
- value?: React.Key;
46
+ value?: K;
52
47
  /** 是否开启单选 */
53
48
  radio?: boolean;
54
49
  /** 单选值 */
55
- radioValue?: React.Key;
50
+ radioValue?: K;
56
51
  /** 默认单选值 */
57
- defaultRadioValue?: React.Key;
52
+ defaultRadioValue?: K;
58
53
  /** 线性选项卡导航栏主轴是否具有间距,开启为20px间距,关闭为0间距,默认开启 */
59
54
  navWithPadding?: boolean;
60
55
  /** 单选值切换的回调 */
61
- onRadioChange?: (radioValue: React.Key) => void;
56
+ onRadioChange?: (radioValue: K) => void;
62
57
  /** 新增按钮回调 showAdd 为 true 时有效*/
63
58
  onAdd?: (e?: React.MouseEvent) => void;
64
59
  /** 切换标签页的回调 */
65
- onChange?: (activeKey: React.Key, item?: TabProps) => void;
60
+ onChange?: (activeKey: K, item?: TabProps<K>) => void;
66
61
  /** 新增和删除页签的回调 */
67
- onEdit?: (item: TabProps, e?: React.MouseEvent | React.KeyboardEvent | string | React.Key, action?: 'add' | 'remove') => void;
68
- [name: string]: unknown;
62
+ onEdit?: (item: TabProps<K>, e?: React.MouseEvent | React.KeyboardEvent | string | React.Key, action?: 'add' | 'remove') => void;
69
63
  }
70
- export declare const Tabs: FC<TabsProps>;
71
- type mergedTabs = typeof Tabs & {
64
+ declare const TabsBase: <K extends React.Key = string>(props: TabsProps<K>) => import("react/jsx-runtime").JSX.Element;
65
+ type MergedTabs = typeof TabsBase & {
72
66
  TabPane: typeof TabPane;
73
67
  };
74
- declare const _default: mergedTabs;
75
- export default _default;
68
+ export declare const Tabs: MergedTabs;
69
+ export default Tabs;
package/es/Tabs/index.js CHANGED
@@ -1,170 +1,168 @@
1
- import { j as a } from "../_virtual/jsx-runtime.js";
2
- import R, { useState as ee, useEffect as te, createElement as oe } from "react";
3
- import re, { TabPane as T } from "rc-tabs";
1
+ import { j as r } from "../_virtual/jsx-runtime.js";
2
+ import T, { useState as oe, useEffect as te, createElement as re } from "react";
3
+ import ae, { TabPane as R } from "rc-tabs";
4
4
  import "../node_modules/@para-ui/icons/SvgIcon/index.js";
5
5
  import { Close as u } from "../node_modules/@para-ui/icons/Close/index.js";
6
- import { More as ae } from "../node_modules/@para-ui/icons/More/index.js";
7
- import { Plus as ne } from "../node_modules/@para-ui/icons/Plus/index.js";
6
+ import { More as ne } from "../node_modules/@para-ui/icons/More/index.js";
7
+ import { Plus as se } from "../node_modules/@para-ui/icons/Plus/index.js";
8
8
  import { PopConfirm as ie } from "../PopConfirm/index.js";
9
- import { Radio as se } from "../Radio/index.js";
10
- import le from "../Help/index.js";
11
- import de from "clsx";
12
- import ce from "../GlobalContext/useFormatMessage.js";
13
- import me from "./lang/index.js";
14
- import { $rcPrefixCls as c, $prefixCls as pe } from "../GlobalContext/constant.js";
15
- import { Tooltip as fe } from "../Tooltip/index.js";
9
+ import { Radio as le } from "../Radio/index.js";
10
+ import de from "../Help/index.js";
11
+ import ce from "clsx";
12
+ import me from "../GlobalContext/useFormatMessage.js";
13
+ import pe from "./lang/index.js";
14
+ import { $rcPrefixCls as d, $prefixCls as fe } from "../GlobalContext/constant.js";
15
+ import { Tooltip as ue } from "../Tooltip/index.js";
16
16
  import './index.css';/* empty css */
17
- const ue = (y) => {
17
+ const k = (E) => {
18
18
  const {
19
- type: k,
20
- className: A,
19
+ type: A,
20
+ className: N,
21
21
  size: h,
22
- onEdit: m,
23
- hideAdd: E,
24
- centered: K,
25
- addIcon: N,
26
- moreIcon: w = /* @__PURE__ */ a.jsx(ae, {}),
27
- editable: p,
22
+ onEdit: c,
23
+ hideAdd: y,
24
+ centered: V,
25
+ addIcon: w,
26
+ moreIcon: K = /* @__PURE__ */ r.jsx(ne, {}),
27
+ editable: m,
28
28
  mode: b,
29
29
  showAdd: S,
30
- showPopConfirm: V,
31
- popConfirmProps: H,
32
- data: s,
33
- onChange: M,
30
+ showPopConfirm: H,
31
+ popConfirmProps: M,
32
+ data: i,
33
+ onChange: z,
34
34
  onAdd: C,
35
35
  children: x,
36
- value: z,
36
+ value: B,
37
37
  activeKey: D,
38
38
  radio: F,
39
- radioValue: d,
39
+ radioValue: l,
40
40
  defaultRadioValue: J,
41
41
  navWithPadding: O = !0,
42
42
  onRadioChange: W,
43
43
  ..._
44
- } = y, q = ce("Tabs", me), r = `${pe}-tabs`, n = k ?? b, [B, $] = ee(J);
44
+ } = E, q = me("Tabs", pe), t = `${fe}-tabs`, a = A ?? b, [G, $] = oe(J);
45
45
  te(() => {
46
- d !== void 0 && $(d);
47
- }, [d]);
48
- const G = (e) => {
49
- d === void 0 && $(e), W?.(e);
50
- }, g = (e) => {
51
- let t = {}, o = e;
52
- return s && (t = s.find((i) => String(i.value) === e) || {}, t?.value !== void 0 && (o = String(t.value))), { currItem: t, tKey: o };
53
- };
46
+ l !== void 0 && $(l);
47
+ }, [l]);
48
+ const L = (e) => {
49
+ l === void 0 && $(e), W?.(e);
50
+ }, g = (e) => i?.find((o) => String(o.value) === e);
54
51
  let v;
55
- (n === "editable-card" || p) && (v = {
56
- onEdit: (e, { key: t, event: o }) => {
52
+ (a === "editable-card" || m) && (v = {
53
+ onEdit: (e, { key: o, event: n }) => {
57
54
  if (e === "add")
58
- C ? C(o) : m?.({}, o, e);
55
+ C ? C(n) : c?.({}, n, e);
59
56
  else {
60
- const { currItem: i, tKey: l } = g(t);
61
- m?.(i, String(l), e);
57
+ const s = g(o);
58
+ s && c?.(s, s.value, e);
62
59
  }
63
60
  },
64
- removeIcon: /* @__PURE__ */ a.jsx(u, {}),
65
- addIcon: N || /* @__PURE__ */ a.jsx(ne, {}),
66
- showAdd: E !== !0 && S !== !1
61
+ removeIcon: /* @__PURE__ */ r.jsx(u, {}),
62
+ addIcon: w || /* @__PURE__ */ r.jsx(se, {}),
63
+ showAdd: y !== !0 && S !== !1
67
64
  });
68
- const L = (e) => {
69
- const { currItem: t, tKey: o } = g(e);
70
- M?.(o, t);
71
- }, Q = (e) => {
72
- const { closable: t, closeIcon: o } = e;
73
- return t === !1 ? null : V ? /* @__PURE__ */ a.jsx("span", { onClick: (i) => i.stopPropagation(), children: /* @__PURE__ */ a.jsx(
65
+ const Q = (e) => {
66
+ const o = g(e);
67
+ z?.(o?.value ?? e, o);
68
+ }, U = (e) => {
69
+ const { closable: o, closeIcon: n } = e;
70
+ return o === !1 ? null : H ? /* @__PURE__ */ r.jsx("span", { onClick: (s) => s.stopPropagation(), children: /* @__PURE__ */ r.jsx(
74
71
  ie,
75
72
  {
76
73
  content: q({ id: "confirmDelete" }),
77
74
  placement: "top",
78
- ...H,
79
- onOk: () => m?.(e, e.value, "remove"),
80
- children: o || /* @__PURE__ */ a.jsx(u, {})
75
+ ...M,
76
+ onOk: () => c?.(e, e.value, "remove"),
77
+ children: n || /* @__PURE__ */ r.jsx(u, {})
81
78
  }
82
- ) }) : o || /* @__PURE__ */ a.jsx(u, {});
83
- }, U = () => {
84
- if (!s?.length) return x;
79
+ ) }) : n || /* @__PURE__ */ r.jsx(u, {});
80
+ }, X = () => {
81
+ if (!i?.length) return x;
85
82
  const e = b === "card-container" && F;
86
- return s.map((t) => {
87
- const { label: o, content: i, value: l, showHelp: j, helpProps: P, disabledTooltip: I, ...Z } = t;
88
- let f = j || e ? /* @__PURE__ */ a.jsxs("span", { className: `${c}-tabs-tab-help`, children: [
89
- e && /* @__PURE__ */ a.jsx(
90
- se,
83
+ return i.map((o) => {
84
+ const { label: n, content: s, value: p, showHelp: j, helpProps: P, disabledTooltip: I, ...ee } = o;
85
+ let f = j || e ? /* @__PURE__ */ r.jsxs("span", { className: `${d}-tabs-tab-help`, children: [
86
+ e && /* @__PURE__ */ r.jsx(
87
+ le,
91
88
  {
92
- checked: B === l,
93
- onChange: () => G(l)
89
+ checked: G === p,
90
+ onChange: () => L(p)
94
91
  }
95
92
  ),
96
- o,
97
- j && /* @__PURE__ */ a.jsx(
98
- le,
93
+ n,
94
+ j && /* @__PURE__ */ r.jsx(
95
+ de,
99
96
  {
100
97
  placement: "bottom-start",
101
98
  ...P,
102
99
  title: P?.title ?? ""
103
100
  }
104
101
  )
105
- ] }) : o;
106
- return I && (f = /* @__PURE__ */ a.jsx(
107
- fe,
102
+ ] }) : n;
103
+ return I && (f = /* @__PURE__ */ r.jsx(
104
+ ue,
108
105
  {
109
106
  disabled: !0,
110
107
  placement: "bottom-start",
111
108
  ...I,
112
109
  children: f
113
110
  }
114
- )), /* @__PURE__ */ oe(
115
- T,
111
+ )), /* @__PURE__ */ re(
112
+ R,
116
113
  {
117
- ...Z,
114
+ ...ee,
118
115
  tab: f,
119
- key: l,
120
- closeIcon: Q(t)
116
+ key: p,
117
+ closeIcon: U(o)
121
118
  },
122
- i
119
+ s
123
120
  );
124
121
  });
125
- }, X = () => {
126
- const e = D ?? z;
127
- if (e !== void 0) return String(e);
128
122
  }, Y = () => {
123
+ const e = D ?? B;
124
+ if (e !== void 0) return String(e);
125
+ }, Z = () => {
129
126
  let e;
130
- return s?.length ? e = s.some((t) => t.content) : e = R.Children.toArray(x).some(
131
- (t) => R.isValidElement(t) && t.props.children
127
+ return i?.length ? e = i.some((o) => o.content) : e = T.Children.toArray(x).some(
128
+ (o) => T.isValidElement(o) && o.props.children
132
129
  ), !e;
133
130
  };
134
- return /* @__PURE__ */ a.jsx(
135
- re,
131
+ return /* @__PURE__ */ r.jsx(
132
+ ae,
136
133
  {
137
- activeKey: X(),
138
- moreTransitionName: `${c}-tabs-slide-up`,
134
+ activeKey: Y(),
135
+ moreTransitionName: `${d}-tabs-slide-up`,
139
136
  ..._,
140
- className: de(
141
- r,
137
+ className: ce(
138
+ t,
142
139
  {
143
- [`${r}-${h}`]: h,
144
- [`${r}-line`]: !n || n === "line",
145
- [`${r}-editable-line`]: (!n || n === "line") && p,
146
- [`${r}-card`]: ["card", "editable-card"].includes(n),
147
- [`${r}-editable-card`]: n === "editable-card",
148
- [`${r}-track`]: n === "track",
149
- [`${r}-editable-track`]: n === "track" && p,
150
- [`${r}-card-container ${r}-card`]: n === "card-container",
151
- [`${r}-centered`]: K,
152
- [`${r}-no-child`]: Y(),
153
- [`${c}-nav-padding`]: O
140
+ [`${t}-${h}`]: h,
141
+ [`${t}-line`]: !a || a === "line",
142
+ [`${t}-editable-line`]: (!a || a === "line") && m,
143
+ [`${t}-card`]: ["card", "editable-card"].includes(a),
144
+ [`${t}-editable-card`]: a === "editable-card",
145
+ [`${t}-track`]: a === "track",
146
+ [`${t}-editable-track`]: a === "track" && m,
147
+ [`${t}-card-container ${t}-card`]: a === "card-container",
148
+ [`${t}-centered`]: V,
149
+ [`${t}-no-child`]: Z(),
150
+ [`${d}-nav-padding`]: O
154
151
  },
155
- A
152
+ N
156
153
  ),
157
154
  editable: v,
158
- moreIcon: w,
159
- prefixCls: `${c}-tabs`,
160
- onChange: L,
161
- children: U()
155
+ moreIcon: K,
156
+ prefixCls: `${d}-tabs`,
157
+ onChange: Q,
158
+ children: X()
162
159
  }
163
160
  );
164
161
  };
165
- ue.TabPane = T;
162
+ k.TabPane = R;
163
+ const ye = k;
166
164
  export {
167
- ue as Tabs,
168
- ue as default
165
+ ye as Tabs,
166
+ ye as default
169
167
  };
170
168
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../../CodeEditor/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