wargerm 0.7.92 → 0.7.93

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,9 +1,23 @@
1
1
  import React, { MutableRefObject } from 'react';
2
2
  import { FormInstance } from 'antd';
3
+ import { WFormProps } from '../WForm';
3
4
  export interface IFormInstance extends MutableRefObject<FormInstance> {
4
5
  handleSubmit?: () => void;
5
6
  resetFields?: () => void;
6
- setFieldsValue?: (record: Record<string, any>) => void;
7
+ setFieldsValue?: (record?: Record<string, any>) => void;
7
8
  }
8
- declare const _default: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<unknown>>;
9
+ interface IProps extends WFormProps {
10
+ open: boolean;
11
+ setOpen: (value: any) => void;
12
+ modalFormOpend?: (value: any) => void;
13
+ submitMethod?: (value: any, done: () => void) => Promise<void>;
14
+ onSubmitSuccess?: () => Promise<void>;
15
+ record?: Record<string, any>;
16
+ formItemChild?: () => React.ReactNode;
17
+ onCancel?: () => void;
18
+ modalHeaderSlot?: React.ReactNode;
19
+ modalFooterSlot?: React.ReactNode;
20
+ formProps?: Omit<WFormProps, 'columns'>;
21
+ }
22
+ declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
9
23
  export default _default;
@@ -1,3 +1,54 @@
1
- import React from 'react';
2
- declare const _default: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<unknown>>;
1
+ import React, { MutableRefObject } from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { ProTableProps } from '@ant-design/pro-table';
4
+ import { ColumnProps, Isearch } from '../WForm';
5
+ type CustomType = {
6
+ type: 'custom';
7
+ title: ReactNode;
8
+ icon: ReactNode;
9
+ key: string;
10
+ fetchInfo?: (record?: Record<string, any>) => Promise<any>;
11
+ actionMethod?: (values: Record<string, any>, done: () => void, record?: Record<string, any>) => Promise<any>;
12
+ };
13
+ type ItableAction = {
14
+ type: 'edit' | 'view' | 'delete' | 'extraAction';
15
+ formItemChild?: (record: Record<string, any>, actionRef: MutableRefObject<any>, index: number) => ReactNode;
16
+ actionMethod?: (values: Record<string, any>, done: () => void, record?: Record<string, any>) => Promise<any>;
17
+ fetchInfo?: (record?: Record<string, any>) => Promise<any>;
18
+ actionRender?: (record: Record<string, any>, actionRef: MutableRefObject<any>, onOk: () => void, index: number) => ReactNode;
19
+ };
20
+ interface ItableBar {
21
+ type: 'add' | 'extraAction';
22
+ actionMethod?: (values: Record<string, any>, done: () => void) => Promise<any>;
23
+ render?: (record: Record<string, any>) => ReactNode;
24
+ actionRender?: (record: Record<string, any>, onOk?: () => void) => ReactNode;
25
+ }
26
+ interface ItableBarCustom {
27
+ type: 'custom';
28
+ title: ReactNode;
29
+ icon: ReactNode;
30
+ key: string;
31
+ actionMethod?: (values: Record<string, any>, done: () => void) => Promise<any>;
32
+ }
33
+ interface IoptionColumnConfig extends ColumnProps {
34
+ showMoreNum?: number;
35
+ }
36
+ interface ITableCard extends ProTableProps<Record<string, any>[], Record<string, any>> {
37
+ modalFormSearch?: Isearch;
38
+ search?: Isearch;
39
+ modalConfig?: Record<string, any>;
40
+ searchFormConfig?: Record<string, any>;
41
+ optionColumnConfig?: IoptionColumnConfig;
42
+ request?: (params: Record<string, any>) => Promise<any>;
43
+ tableAction?: Array<ItableAction | CustomType>;
44
+ filterAction?: (record: Record<string, any>, item: Record<string, any>) => boolean;
45
+ renderTableBar?: Array<ItableBar | ItableBarCustom>;
46
+ renderTableBarDeps?: any;
47
+ extraColumns?: Array<any>;
48
+ onFormChange?: (changedValues: Record<string, any>, allValues: Record<string, any>, form: any) => void;
49
+ noBordered?: boolean;
50
+ searchTableSlot?: ReactNode;
51
+ showIndex?: boolean;
52
+ }
53
+ declare const _default: React.ForwardRefExoticComponent<ITableCard & React.RefAttributes<any>>;
3
54
  export default _default;
package/dist/index.esm.js CHANGED
@@ -6944,7 +6944,7 @@ var ModalForm = function ModalForm(props, ref) {
6944
6944
  setFormIntance(form);
6945
6945
  };
6946
6946
  useEffect(function () {
6947
- if (formIntance) {
6947
+ if (formIntance && record) {
6948
6948
  setFieldsValue(record);
6949
6949
  }
6950
6950
  }, [open, record, formIntance]);
package/dist/index.js CHANGED
@@ -6987,7 +6987,7 @@ var ModalForm = function ModalForm(props, ref) {
6987
6987
  setFormIntance(form);
6988
6988
  };
6989
6989
  React.useEffect(function () {
6990
- if (formIntance) {
6990
+ if (formIntance && record) {
6991
6991
  setFieldsValue(record);
6992
6992
  }
6993
6993
  }, [open, record, formIntance]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.7.92",
4
+ "version": "0.7.93",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",