@flatbiz/antd 4.4.5 → 4.4.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.
Files changed (41) hide show
  1. package/esm/box-grid/index.css +1 -0
  2. package/esm/box-grid/index.js +5 -0
  3. package/esm/box-grid/index.js.map +1 -0
  4. package/esm/button-operate/index.js +1 -1
  5. package/esm/button-operate/index.js.map +1 -1
  6. package/esm/button-wrapper/index.js.map +1 -1
  7. package/esm/card-layout/index.js.map +1 -1
  8. package/esm/date-range-picker-wrapper-form-item/index.js +1 -1
  9. package/esm/date-range-picker-wrapper-form-item/index.js.map +1 -1
  10. package/esm/dialog-alert/index.js +1 -1
  11. package/esm/dialog-alert/index.js.map +1 -1
  12. package/esm/dialog-confirm/index.js +1 -1
  13. package/esm/dialog-confirm/index.js.map +1 -1
  14. package/esm/dialog-modal/index.js +1 -1
  15. package/esm/dialog-modal/index.js.map +1 -1
  16. package/esm/drag-editable-table/index.js +1 -1
  17. package/esm/drag-editable-table/index.js.map +1 -1
  18. package/esm/dropdown-menu-wrapper/index.js +1 -1
  19. package/esm/dropdown-menu-wrapper/index.js.map +1 -1
  20. package/esm/easy-form/index.css +1 -0
  21. package/esm/easy-form/index.js +7 -0
  22. package/esm/easy-form/index.js.map +1 -0
  23. package/esm/easy-table/index.css +1 -1
  24. package/esm/easy-table/index.js +1 -1
  25. package/esm/easy-table/index.js.map +1 -1
  26. package/esm/editable-table/index.js +1 -1
  27. package/esm/editable-table/index.js.map +1 -1
  28. package/esm/form-item-wrapper/index.js +1 -1
  29. package/esm/form-item-wrapper/index.js.map +1 -1
  30. package/esm/form-wrapper/index.css +0 -0
  31. package/esm/form-wrapper/index.js +5 -0
  32. package/esm/form-wrapper/index.js.map +1 -0
  33. package/esm/index.js +5 -2
  34. package/esm/search-form/index.js +2 -1
  35. package/esm/search-form/index.js.map +1 -1
  36. package/esm/table-cell-render/index.js +1 -1
  37. package/esm/table-cell-render/index.js.map +1 -1
  38. package/esm/tree-wrapper/index.js +1 -1
  39. package/esm/tree-wrapper/index.js.map +1 -1
  40. package/index.d.ts +176 -22
  41. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import { API, ModelType } from '@dimjs/model';
6
6
  import { DateFormatType, TAny, TNoopDefine, TPlainObject } from '@flatbiz/utils';
7
7
  import { IAllProps } from '@tinymce/tinymce-react';
8
- import { AlertProps, ButtonProps, CardProps, CascaderProps, CheckboxProps, CollapseProps, ColorPickerProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, FormListFieldData, FormListOperation, InputNumberProps, InputProps, MentionProps, ModalProps, PaginationProps, PopconfirmProps, PopoverProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TagProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
8
+ import { AlertProps, ButtonProps, CardProps, CascaderProps, CheckboxProps, CollapseProps, ColorPickerProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, FormListFieldData, FormListOperation, FormProps, InputNumberProps, InputProps, MentionProps, ModalProps, PaginationProps, PopconfirmProps, PopoverProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TagProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
9
9
  import { ConfigProviderProps } from 'antd/es/config-provider';
10
10
  import { PickerDateProps, RangePickerDateProps } from 'antd/es/date-picker/generatePicker';
11
11
  import { FormListProps } from 'antd/es/form';
@@ -301,16 +301,69 @@ export type BootstrapProps = {
301
301
  * ```
302
302
  */
303
303
  export declare const Bootstrap: (props: BootstrapProps) => import("react/jsx-runtime").JSX.Element;
304
+ declare const PresetDefaultGrid: {
305
+ xs: number;
306
+ sm: number;
307
+ md: number;
308
+ lg: number;
309
+ xl: number;
310
+ xxl: number;
311
+ };
312
+ export type TBoxBreakpoint = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
313
+ export interface ICommonReact {
314
+ children?: ReactNode;
315
+ className?: string;
316
+ style?: CSSProperties;
317
+ }
318
+ export type Gutter = number | undefined | Partial<Record<TBoxBreakpoint, number>>;
319
+ export type GutterParams = Gutter | [
320
+ Gutter,
321
+ Gutter
322
+ ];
323
+ export interface BoxRowProps {
324
+ /**
325
+ * 默认的栅格配置
326
+ */
327
+ defaultGrid?: Partial<typeof PresetDefaultGrid>;
328
+ /** 间距 */
329
+ gutter?: GutterParams;
330
+ /** flex 布局的垂直对齐方式 */
331
+ align?: "top" | "middle" | "bottom" | "stretch";
332
+ /** flex 布局的水平排列方式 */
333
+ justify?: "start" | "end" | "center" | "space-around" | "space-between" | "space-evenly";
334
+ }
335
+ export type BoxColProps = {
336
+ /** 栅格占位格数,固定分数,为0相当于隐藏 */
337
+ span?: number;
338
+ /** 屏幕 < 576px */
339
+ xs?: number;
340
+ /** 屏幕 ≥ 576px */
341
+ sm?: number;
342
+ /** 屏幕 ≥ 768px */
343
+ md?: number;
344
+ /** 屏幕 ≥ 992px */
345
+ lg?: number;
346
+ /** 屏幕 ≥ 1200px */
347
+ xl?: number;
348
+ /** 屏幕 ≥ 1600px */
349
+ xxl?: number;
350
+ };
351
+ export declare const BoxGrid: {
352
+ Row: import("react").FC<BoxRowProps & ICommonReact>;
353
+ Col: import("react").FC<BoxColProps & ICommonReact>;
354
+ };
304
355
  export type ButtonWrapperProps = Omit<ButtonProps, "onClick"> & {
356
+ /** 当返回 Promise 时,按钮自动loading */
305
357
  onClick?: (e: React.MouseEvent<HTMLElement>) => Promise<TAny> | void;
358
+ /** 重复点击间隙,单位毫秒 默认值:500 */
306
359
  debounceDuration?: number;
360
+ /** 基于GLOBAL中elemAclLimits按钮权限列表,控制按钮显示、隐藏 */
307
361
  permission?: string;
362
+ /** 是否隐藏按钮 */
308
363
  hidden?: boolean;
309
364
  /** loading 显示位置,默认值:left */
310
365
  loadingPosition?: "left" | "center";
311
- /**
312
- * 移除间隙,一般用于 type=link 类型下
313
- */
366
+ /** 移除按钮内边距,一般用于 type=link 类型下 */
314
367
  removeGap?: boolean;
315
368
  };
316
369
  /**
@@ -321,7 +374,7 @@ export type ButtonWrapperProps = Omit<ButtonProps, "onClick"> & {
321
374
  * @returns
322
375
  */
323
376
  export declare const ButtonWrapper: (props: ButtonWrapperProps) => import("react/jsx-runtime").JSX.Element | null;
324
- export type DialogModalProps = Omit<ModalProps, "onOk" | "onCancel" | "getContainer" | "open" | "open" | "okButtonProps" | "cancelButtonProps"> & {
377
+ export type DialogModalProps = Omit<ModalProps, "onOk" | "onCancel" | "getContainer" | "open" | "open" | "okButtonProps" | "cancelButtonProps" | "footer"> & {
325
378
  onOk?: (form: FormInstance, e: React.MouseEvent<HTMLElement>) => void | Promise<void>;
326
379
  onCancel?: (form: FormInstance, e: React.MouseEvent<HTMLElement>) => void | Promise<void>;
327
380
  content: string | ReactElement | ((form: FormInstance, operate: {
@@ -341,6 +394,8 @@ export type DialogModalProps = Omit<ModalProps, "onOk" | "onCancel" | "getContai
341
394
  */
342
395
  bodyHeightPercent?: number;
343
396
  titleExtra?: ReactElement;
397
+ /** null则隐藏footer */
398
+ footer?: null | ReactElement;
344
399
  };
345
400
  /**
346
401
  * 居中弹框
@@ -393,15 +448,14 @@ export interface DropdownMenuWrapperProps extends Omit<DropdownProps, "menu"> {
393
448
  */
394
449
  export declare const DropdownMenuWrapper: (props: DropdownMenuWrapperProps) => import("react/jsx-runtime").JSX.Element;
395
450
  export interface ButtonOperateItem extends ButtonWrapperProps {
396
- hidden?: boolean;
397
451
  /** hover 提示文字,isFold=true无效 */
398
452
  hoverTips?: string | React.ReactElement;
399
453
  /** hover 提示类型 默认:'tooltip' */
400
454
  tipsType?: "popover" | "tooltip";
455
+ /** 按钮文案 */
401
456
  text?: string | ReactElement;
457
+ /** 自定义按钮颜色 */
402
458
  color?: string;
403
- onClick?: (event: React.MouseEvent<HTMLElement>) => void | Promise<void>;
404
- permission?: string;
405
459
  /** 是否需要二次弹框确认 */
406
460
  needConfirm?: boolean;
407
461
  /** 二次弹框确认文案 */
@@ -412,6 +466,8 @@ export interface ButtonOperateItem extends ButtonWrapperProps {
412
466
  confirmModalProps?: DialogModalProps;
413
467
  }
414
468
  export interface ButtonOperateProps {
469
+ className?: string;
470
+ style?: CSSProperties;
415
471
  /**
416
472
  * 如果数组中元素为ReactElement类型
417
473
  * 1. 一般为antd Button组件,如果组件存在属性hidden=true,则会隐藏
@@ -420,14 +476,16 @@ export interface ButtonOperateProps {
420
476
  * 3. 不支持fold效果
421
477
  */
422
478
  operateList: Array<ButtonOperateItem | null | ReactElement>;
479
+ /** 是否换行,默认true */
423
480
  wrap?: boolean;
481
+ /** 隐藏图标Icon */
424
482
  foldIcon?: ReactElement;
425
- className?: string;
483
+ /** 按钮之间是否添加分隔符 */
426
484
  split?: boolean;
485
+ /** 多个按钮的包装组件Space属性 */
427
486
  spaceProps?: SpaceProps;
428
487
  /** 间距,默认:10;split=true配置下无效(可通过spaceProps设置间距) */
429
488
  gap?: number;
430
- style?: CSSProperties;
431
489
  /** 折叠合拢属性 */
432
490
  dropdownMenuProps?: Omit<DropdownMenuWrapperProps, "menuList">;
433
491
  }
@@ -444,7 +502,9 @@ export declare const ButtonOperateItemContent: (props: Pick<ButtonOperateItem, "
444
502
  */
445
503
  export declare const ButtonOperate: FC<ButtonOperateProps>;
446
504
  export type CardLayoutProps = {
505
+ /** 描述 */
447
506
  desc?: string | string[] | ReactElement | ReactElement[];
507
+ /** 标题 */
448
508
  title?: string | ReactElement;
449
509
  /**
450
510
  * layoutType 布局类型
@@ -478,9 +538,9 @@ export type CardLayoutProps = {
478
538
  size?: "default" | "small";
479
539
  onClick?: (event: any) => void;
480
540
  hidden?: boolean;
541
+ children?: ReactNode;
481
542
  className?: string;
482
543
  style?: CSSProperties;
483
- children?: ReactNode;
484
544
  };
485
545
  /**
486
546
  * 卡片结构布局,替代 SimpleLayout 组件
@@ -838,14 +898,36 @@ export interface FormItemWrapperProps extends FormItemProps {
838
898
  * 如果设置 normalize 属性,outputNormalize将失效
839
899
  */
840
900
  outputNormalize?: (value?: TAny) => TAny;
841
- /** 是否清楚 Form.Item */
901
+ /** 是否清除 Form.Item */
842
902
  isClear?: boolean;
903
+ /**
904
+ * label宽度
905
+ * ```
906
+ * 1. 如果想控制Form下所有label,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性
907
+ * ```
908
+ */
909
+ labelWidth?: "auto" | "70" | "80" | "90" | "100" | "110" | "120" | "130" | "140" | "150" | "160" | "170" | "180" | "190" | "200";
910
+ /**
911
+ * labelItem 竖直布局
912
+ * ```
913
+ * 1. 如果想控制Form下所有labelItem,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性
914
+ * ```
915
+ */
916
+ labelItemVertical?: true;
917
+ /**
918
+ * label 对齐方式
919
+ * ```
920
+ * 1. 如果想控制Form下所有labelAlign,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性
921
+ * ```
922
+ */
923
+ labelAlign?: "left" | "right";
843
924
  }
844
925
  /**
845
926
  * 对 Form.Item 包装处理
846
927
  * ```
847
928
  * 1. 为 children 增加 before、after
848
929
  * 2. 对输入、输出数据进行序列化处理
930
+ * 3. 内置布局样式使用 preDefinedClassName.formItem
849
931
  * ```
850
932
  */
851
933
  export declare const FormItemWrapper: (props: FormItemWrapperProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1777,6 +1859,55 @@ export declare const dynamicNode: {
1777
1859
  };
1778
1860
  remove: (elementId?: string) => void;
1779
1861
  };
1862
+ export type FormWrapperProps<Values = any> = FormProps<Values> & {
1863
+ children: ReactNode;
1864
+ /** label宽度,Form内部所有FormItem label都生效 */
1865
+ labelWidth?: "auto" | "70" | "80" | "90" | "100" | "110" | "120" | "130" | "140" | "150" | "160" | "170" | "180" | "190" | "200";
1866
+ /** labelItem 竖直布局 */
1867
+ labelItemVertical?: true;
1868
+ /** label 对齐方式 */
1869
+ labelAlign?: "left" | "right";
1870
+ /** formItem之间竖直间距,默认值:24 */
1871
+ formItemGap?: "15" | "8" | "5" | "0";
1872
+ };
1873
+ /**
1874
+ * Form 包装组件,添加对formItem的布局控制
1875
+ * ```
1876
+ * 1. 内置布局样式使用 preDefinedClassName.form
1877
+ * ```
1878
+ */
1879
+ export declare const FormWrapper: (props: FormWrapperProps) => import("react/jsx-runtime").JSX.Element;
1880
+ export type EasyFormProps = Omit<FormWrapperProps, "children"> & {
1881
+ children: ReactElement | ReactElement[];
1882
+ /** 一行显示几列,定义FormItem网格占比 */
1883
+ column?: 1 | 2 | 3 | 4;
1884
+ };
1885
+ /**
1886
+ * 简单Form布局,可自定义网格布局
1887
+ * ```
1888
+ * 1. EasyForm 子节点包含 hidden = true 会被忽略
1889
+ * 2. 通过 column 可修改一行显示几列FormItem
1890
+ * 3. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/label
1891
+ * <EasyForm column={3}>
1892
+ <Form.Item name="field1" label="条件1">
1893
+ <Input placeholder="请输入" allowClear={true} />
1894
+ </Form.Item>
1895
+ <Form.Item name="field2" label="条件2">
1896
+ <Input placeholder="请输入" allowClear={true} />
1897
+ </Form.Item>
1898
+ <!-- !!!可通过使用 FormGrid.Col 包裹元素来自定义网格占比 !!! -->
1899
+ <FormGrid.Col span={24}>
1900
+ <Form.Item name="field5" label="条件5">
1901
+ <Input placeholder="请输入" allowClear={true} />
1902
+ </Form.Item>
1903
+ </FormGrid.Col>
1904
+ <Form.Item name="field6" label="条件6">
1905
+ <Input placeholder="请输入" allowClear={true} />
1906
+ </Form.Item>
1907
+ </EasyForm>
1908
+ * ```
1909
+ */
1910
+ export declare const EasyForm: (props: EasyFormProps) => import("react/jsx-runtime").JSX.Element;
1780
1911
  export type TEasyTableTableColumn<T> = ColumnsType<T>[0] & {
1781
1912
  /**
1782
1913
  * @description 请使用 tipsWrapperProps 属性配置
@@ -1807,8 +1938,9 @@ export type EasyTableRefApi = {
1807
1938
  onRequest: (params?: TPlainObject) => void;
1808
1939
  /** 获取请求参数 */
1809
1940
  getRequestParams: () => TPlainObject;
1810
- /** 清楚查询条件 */
1941
+ /** 清除查询条件 */
1811
1942
  clearQueryCondition: (values?: TPlainObject) => Promise<void>;
1943
+ /** 搜素表单实例 */
1812
1944
  form: FormInstance;
1813
1945
  /** 重置请求 */
1814
1946
  onResetRequest: (params?: TPlainObject) => void;
@@ -1828,7 +1960,6 @@ export type EasyTableServiceConfig = {
1828
1960
  requestParamsAdapter?: (params: TPlainObject) => TPlainObject;
1829
1961
  /**
1830
1962
  * 接口相应数据处理
1831
- * @param params
1832
1963
  * ```
1833
1964
  * 返回数据为对象,包含两个字段
1834
1965
  * 1. 表格列表数据 - Array
@@ -1908,6 +2039,7 @@ export type EasyTableProps = {
1908
2039
  };
1909
2040
  /** 初始化是否请求,默认值:true */
1910
2041
  initRequest?: boolean;
2042
+ /** 表格数据变更回调 */
1911
2043
  onDataSourceChange?: (dataSource: TAny) => void;
1912
2044
  /** 如果自定义查询按钮,可设置 Form onFinish */
1913
2045
  onFormFinish?: (values?: TPlainObject) => void;
@@ -1926,11 +2058,7 @@ export type EasyTableProps = {
1926
2058
  * 查询条件展开、收起,被收起key数组;数组内容为EasyTable.Filter 子节点key值
1927
2059
  */
1928
2060
  foldKeys?: string[];
1929
- /**
1930
- * 自定义处理服务异常
1931
- * @param error
1932
- * @returns
1933
- */
2061
+ /** 自定义处理服务异常 */
1934
2062
  onRequestErrorHandle?: (error: any) => void;
1935
2063
  /**
1936
2064
  * 是否inline模式
@@ -1984,9 +2112,9 @@ export type EasyTableFilterProps = {
1984
2112
  formGridSize?: FormRowProps["gridSize"];
1985
2113
  formClassName?: string;
1986
2114
  formStyle?: CSSProperties;
1987
- /** filter Form 外层 SimpleLayout style */
2115
+ /** filter Form 外层 BlockLayout style */
1988
2116
  filterWrapperStyle?: CSSProperties;
1989
- /** filter Form 外层 SimpleLayout className */
2117
+ /** filter Form 外层 BlockLayout className */
1990
2118
  filterWrapperClassName?: string;
1991
2119
  /**
1992
2120
  * 自定义 filterOperate.rightList 后 默认【查询、重置】按钮处理逻辑
@@ -2017,6 +2145,19 @@ export type EasyTableTableProps<T> = Omit<TableProps<TAny>, "dataSource" | "load
2017
2145
  /** table Form 外层 SimpleLayout className */
2018
2146
  tableWrapperClassName?: string;
2019
2147
  columns: TEasyTableTableColumn<T>[];
2148
+ /**
2149
+ * 数据加载与表格初始化渲染 是否同步
2150
+ * @version 4.4.6
2151
+ * ```
2152
+ * 1. true:获取数据后再初始化渲染表格(可用于实现表格中defaultXxxx相关功能的使用)
2153
+ * ```
2154
+ */
2155
+ isSync?: boolean;
2156
+ /**
2157
+ * 空效果显示尺寸,默认值:small
2158
+ * @version 4.4.6
2159
+ */
2160
+ emptyShowSize?: "small" | "large";
2020
2161
  };
2021
2162
  /**
2022
2163
  * 对 查询条件+表格数据 进行深度封装,内置数据交互处理
@@ -3220,6 +3361,16 @@ export type SearchFormProps = {
3220
3361
  formGridSize?: FormRowProps["gridSize"];
3221
3362
  formClassName?: string;
3222
3363
  formStyle?: CSSProperties;
3364
+ /** form 初始值 */
3365
+ formInitialValues?: TPlainObject;
3366
+ /** label宽度,Form内部所有FormItem label都生效 */
3367
+ formLabelWidth?: FormWrapperProps["labelWidth"];
3368
+ /** labelItem 竖直布局 */
3369
+ formLabelItemVertical?: FormWrapperProps["labelItemVertical"];
3370
+ /** label 对齐方式 */
3371
+ formLabelAlign?: FormWrapperProps["labelAlign"];
3372
+ /** formItem之间竖直间距,默认值:24 */
3373
+ formFormItemGap?: FormWrapperProps["formItemGap"];
3223
3374
  /**
3224
3375
  * 自定义 searchOperate.rightList 后 默认【查询、重置】按钮处理逻辑
3225
3376
  * 1. cover:覆盖内部查询重置按钮(默认值)
@@ -3231,8 +3382,10 @@ export type SearchFormProps = {
3231
3382
  rightOperateAreaAppendType?: "cover" | "beforeAppend" | "afterAppend";
3232
3383
  /** 默认重启按钮触发请求,默认值:true */
3233
3384
  defaultResetButtonTriggerRequest?: boolean;
3385
+ /**
3386
+ * 展开、收起key值列表(内容当前组件子组件key值)
3387
+ */
3234
3388
  foldKeys?: string[];
3235
- formInitialValues?: TPlainObject;
3236
3389
  /**
3237
3390
  * 按钮提交事件
3238
3391
  * 如果需要自定义回车提交事件,需要自定义提交按钮
@@ -3251,6 +3404,7 @@ export type SearchFormProps = {
3251
3404
  cacheSwitch?: boolean;
3252
3405
  /** 初始化是否请求,默认值:true */
3253
3406
  initRequest?: boolean;
3407
+ form?: FormInstance;
3254
3408
  };
3255
3409
  export type SearchFormRefApi = {
3256
3410
  onQuery: (values?: TPlainObject) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/antd",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
4
4
  "description": "flat-biz ui components",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",