reykit 1.0.187 → 1.0.189

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,26 +1,27 @@
1
1
  import { ReactNode } from 'react';
2
- export type HeaderOption<Row extends Record<string, any>> = {
2
+ export type TableFieldOption<Row extends Record<string, any>> = {
3
3
  key: string;
4
4
  name: string;
5
5
  isHide?: boolean;
6
6
  isSort?: boolean;
7
7
  isGroup?: boolean;
8
8
  sortMethod?: (a: Row, b: Row) => number;
9
+ defaultValue?: any;
9
10
  }[];
10
- export type SearchOption<Row extends Record<string, any>> = {
11
+ export type TableSearchOption<Row extends Record<string, any>> = {
11
12
  method: (value: string, row: Row) => boolean;
12
13
  placeholder?: string;
13
14
  };
14
- export type ButtonOption = {
15
+ export type TableButtonOption = {
15
16
  name: ReactNode;
16
17
  method: () => void;
17
18
  }[];
18
- export type OptionName = ReactNode;
19
+ export type TableOptionName = ReactNode;
19
20
  export type RowOptionItem<Row extends Record<string, any>> = {
20
21
  name: ReactNode;
21
22
  fn: ((row: Row) => void) | null;
22
23
  };
23
- export type RowOption<Row extends Record<string, any>> = {
24
+ export type TableRowOption<Row extends Record<string, any>> = {
24
25
  options?: RowOptionItem<Row>[];
25
26
  destructiveOptions?: RowOptionItem<Row>[];
26
27
  } | ((row: Row) => {
@@ -31,7 +32,7 @@ export type SelectRowsOptionItem<Row extends Record<string, any>> = {
31
32
  name: ReactNode;
32
33
  fn: ((selectRows: Row[]) => void) | null;
33
34
  };
34
- export type SelectRowsOption<Row extends Record<string, any>> = {
35
+ export type TableSelectRowsOption<Row extends Record<string, any>> = {
35
36
  options?: SelectRowsOptionItem<Row>[];
36
37
  destructiveOptions?: SelectRowsOptionItem<Row>[];
37
38
  } | ((selectRows: Row[]) => {
@@ -43,7 +44,7 @@ export type SelectRowsOption<Row extends Record<string, any>> = {
43
44
  *
44
45
  * @param data - Table data state value.
45
46
  * @param setData - Function of set table data state value.
46
- * @param headerOption - Header option.
47
+ * @param fieldOption - Header option.
47
48
  * @param searchOption - Search option.
48
49
  * @param buttonOption - Custom buttons option.
49
50
  * @param rowOption - Each row option.
@@ -52,14 +53,14 @@ export type SelectRowsOption<Row extends Record<string, any>> = {
52
53
  * @param mobilePageSize - Page rows size on mobile devices.
53
54
  * @param language - Language type.
54
55
  */
55
- export declare function Table<Row extends Record<string, any>>({ data, setData, headerOption, searchOption, buttonOption, rowOption, selectRowsOption, pageSize, mobilePageSize, language }: {
56
+ export declare function Table<Row extends Record<string, any>>({ data, setData, fieldOption, searchOption, buttonOption, rowOption, selectRowsOption, pageSize, mobilePageSize, language }: {
56
57
  data: Row[];
57
58
  setData: (value: Row[] | ((value: Row[]) => Row[])) => void;
58
- headerOption?: HeaderOption<Row>;
59
- searchOption?: SearchOption<Row>;
60
- buttonOption?: ButtonOption;
61
- rowOption?: RowOption<Row>;
62
- selectRowsOption?: SelectRowsOption<Row>;
59
+ fieldOption?: TableFieldOption<Row>;
60
+ searchOption?: TableSearchOption<Row>;
61
+ buttonOption?: TableButtonOption;
62
+ rowOption?: TableRowOption<Row>;
63
+ selectRowsOption?: TableSelectRowsOption<Row>;
63
64
  pageSize?: number;
64
65
  mobilePageSize?: number;
65
66
  language?: 'en' | 'zh';
@@ -12,6 +12,6 @@ export { CycleButton } from './Button';
12
12
  export { Form } from './Form';
13
13
  export { Loading, useLoading } from './Loading';
14
14
  export { Notice, notice } from './Notice';
15
- export { type HeaderOption, type SearchOption, type ButtonOption, type OptionName, type RowOption, type SelectRowsOption, Table } from './Table';
15
+ export { type TableFieldOption, type TableSearchOption, type TableButtonOption, type TableOptionName, type TableRowOption, type TableSelectRowsOption, Table } from './Table';
16
16
  export { IconText } from './Text';
17
17
  export { IconToggle } from './Toggle';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reykit",
3
- "version": "1.0.187",
3
+ "version": "1.0.189",
4
4
  "description": "Kit method set.",
5
5
  "author": "reyxbo",
6
6
  "keywords": [