sti-antd-package 0.0.9 → 0.0.11

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 (36) hide show
  1. package/dist/components/Checkbox/Group/Component.d.ts +3 -0
  2. package/dist/components/Checkbox/Group/types.d.ts +16 -0
  3. package/dist/components/Checkbox/types.d.ts +11 -6
  4. package/dist/components/DataGrid/Component.d.ts +6 -0
  5. package/dist/components/DataGrid/types.d.ts +6 -0
  6. package/dist/components/DatePicker/types.d.ts +2 -1
  7. package/dist/components/DateRangePicker/types.d.ts +2 -1
  8. package/dist/components/Form/Item/index.d.ts +2 -0
  9. package/dist/components/{FormItem → Form/Item}/types.d.ts +3 -2
  10. package/dist/components/Form/index.d.ts +1 -0
  11. package/dist/components/Input/types.d.ts +2 -1
  12. package/dist/components/NumberFormat/types.d.ts +6 -5
  13. package/dist/components/Radio/Component.d.ts +3 -0
  14. package/dist/components/Radio/index.d.ts +2 -0
  15. package/dist/components/Radio/types.d.ts +24 -0
  16. package/dist/components/Select/types.d.ts +3 -1
  17. package/dist/components/Switch/types.d.ts +2 -1
  18. package/dist/components/TextArea/types.d.ts +2 -1
  19. package/dist/components/index.d.ts +7 -2
  20. package/dist/context/DataGrid/Context.d.ts +3 -0
  21. package/dist/context/DataGrid/Provider.d.ts +4 -0
  22. package/dist/context/DataGrid/types.d.ts +8 -0
  23. package/dist/helpers/colInline/function.d.ts +6 -0
  24. package/dist/helpers/colInline/index.d.ts +1 -0
  25. package/dist/helpers/index.d.ts +1 -0
  26. package/dist/hooks/index.d.ts +1 -0
  27. package/dist/hooks/useFocus/hooks.d.ts +7 -0
  28. package/dist/hooks/useFocus/index.d.ts +1 -0
  29. package/dist/hooks/useRemoveError/hook.d.ts +1 -1
  30. package/dist/index.d.ts +129 -64
  31. package/dist/index.esm.js +151 -102
  32. package/dist/index.js +157 -101
  33. package/package.json +2 -1
  34. package/readme.md +368 -7
  35. /package/dist/components/{FormItem → Checkbox/Group}/index.d.ts +0 -0
  36. /package/dist/components/{FormItem → Form/Item}/Component.d.ts +0 -0
@@ -0,0 +1,3 @@
1
+ import { CheckboxGroupComponentProps } from "./types";
2
+ declare const CheckboxComponent: <T>({ noItem, loading, disabled, options, value, defaultValue, onChange, removeError, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, shouldUpdate, ref, }: CheckboxGroupComponentProps<T>) => import("react/jsx-runtime").JSX.Element;
3
+ export default CheckboxComponent;
@@ -0,0 +1,16 @@
1
+ import { CheckboxForm } from "../types";
2
+ import { CheckboxOptionType } from "antd";
3
+ import React, { Ref } from "react";
4
+ export interface CheckboxGroupComponentRef<T> {
5
+ value: () => T[];
6
+ setValue: React.Dispatch<React.SetStateAction<T[]>>;
7
+ }
8
+ interface CheckboxGroup<T> {
9
+ options?: (CheckboxOptionType<T> | string | number)[];
10
+ value?: T[];
11
+ defaultValue?: T[];
12
+ onChange?: (checkedValue: T[]) => void;
13
+ ref?: Ref<CheckboxGroupComponentRef<T>>;
14
+ }
15
+ export type CheckboxGroupComponentProps<T> = CheckboxGroup<T> & CheckboxForm;
16
+ export {};
@@ -8,13 +8,18 @@ export interface CheckboxComponentRef {
8
8
  checked: () => boolean;
9
9
  setChecked: React.Dispatch<React.SetStateAction<boolean>>;
10
10
  }
11
- export interface CheckboxComponentProps {
11
+ interface Checkbox {
12
+ checked?: boolean;
13
+ defaultChecked?: boolean;
14
+ onChange?: (event: CheckboxChangeEvent) => void;
15
+ children?: React.ReactNode;
16
+ ref?: Ref<CheckboxComponentRef>;
17
+ }
18
+ export interface CheckboxForm {
12
19
  noItem?: boolean;
13
20
  loading?: boolean;
14
21
  disabled?: boolean;
15
- checked?: boolean;
16
- defaultChecked?: boolean;
17
- onChange?: (name: NamePath | undefined, event: CheckboxChangeEvent) => void;
22
+ removeError?: (name?: NamePath) => void;
18
23
  formColLayout?: typeof formColLayout;
19
24
  name?: NamePath;
20
25
  label?: React.ReactNode;
@@ -25,6 +30,6 @@ export interface CheckboxComponentProps {
25
30
  validateStatus?: ValidateStatus;
26
31
  help?: React.ReactNode;
27
32
  shouldUpdate?: ShouldUpdate<string | string[]>;
28
- children?: React.ReactNode;
29
- ref?: Ref<CheckboxComponentRef>;
30
33
  }
34
+ export type CheckboxComponentProps = Checkbox & CheckboxForm;
35
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import "react-data-grid/lib/styles.css";
3
+ export declare const filterColumnClassName: string;
4
+ declare const DataGridComponent: React.FC;
5
+ export default DataGridComponent;
6
+ export declare const FilterRenderer: (props: any) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export interface DataGridComponentProps {
3
+ addRows?: boolean;
4
+ filterHeader?: boolean;
5
+ extraLeft?: React.ReactNode;
6
+ }
@@ -24,7 +24,8 @@ export interface DatePickerComponentProps {
24
24
  disabledTime?: DatePickerProps['disabledTime'];
25
25
  value?: DatePickerProps['value'];
26
26
  defaultValue?: DatePickerProps['value'];
27
- onChange?: (name: NamePath | undefined, date: Dayjs, dateStrings: string | string[]) => void;
27
+ removeError?: (name?: NamePath) => void;
28
+ onChange?: (date: Dayjs, dateStrings: string | string[]) => void;
28
29
  style?: React.CSSProperties;
29
30
  formColLayout?: typeof formColLayout;
30
31
  name?: NamePath;
@@ -25,7 +25,8 @@ export interface DateRangePickerComponentProps {
25
25
  disabledTime?: RangePickerProps['disabledTime'];
26
26
  value?: RangePickerProps['value'];
27
27
  defaultValue?: RangePickerProps['value'];
28
- onChange?: (name: NamePath | undefined, date: Parameters<NonNullable<React.ComponentProps<typeof DatePicker.RangePicker>['onChange']>>[0], dateStrings: Parameters<NonNullable<React.ComponentProps<typeof DatePicker.RangePicker>['onChange']>>[1]) => void;
28
+ removeError?: (name?: NamePath) => void;
29
+ onChange?: (date: Parameters<NonNullable<React.ComponentProps<typeof DatePicker.RangePicker>['onChange']>>[0], dateStrings: Parameters<NonNullable<React.ComponentProps<typeof DatePicker.RangePicker>['onChange']>>[1]) => void;
29
30
  style?: React.CSSProperties;
30
31
  formColLayout?: typeof formColLayout;
31
32
  name?: NamePath;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Component";
2
+ export type * from "./types";
@@ -1,4 +1,4 @@
1
- import { formColLayout } from "../../constants";
1
+ import { formColLayout } from "../../../constants";
2
2
  import { ValidateStatus } from "antd/es/form/FormItem";
3
3
  import { ShouldUpdate } from "rc-field-form/lib/Field";
4
4
  import { NamePath, Rule, RuleObject, Store, StoreValue } from "rc-field-form/lib/interface";
@@ -8,11 +8,12 @@ export interface FormItemComponentProps {
8
8
  formColLayout?: typeof formColLayout;
9
9
  name?: NamePath;
10
10
  label?: React.ReactNode;
11
- normalize?: ((value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue);
11
+ normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
12
12
  required?: boolean;
13
13
  rules?: Rule[];
14
14
  ruleType?: RuleObject['type'];
15
15
  ruleMessage?: string;
16
+ ruleTransform?: (value: StoreValue) => StoreValue;
16
17
  ruleMin?: number;
17
18
  ruleMax?: number;
18
19
  valuePropName?: string;
@@ -0,0 +1 @@
1
+ export { Form } from "antd";
@@ -31,7 +31,8 @@ export interface InputComponentProps {
31
31
  placeholder?: string;
32
32
  value?: valueType;
33
33
  defaultValue?: valueType;
34
- onChange?: (name: NamePath | undefined, event: React.ChangeEvent<HTMLInputElement>) => void;
34
+ removeError?: (name?: NamePath) => void;
35
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
35
36
  onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
36
37
  onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
37
38
  onMouseEnter?: React.MouseEventHandler<HTMLInputElement>;
@@ -1,9 +1,9 @@
1
1
  import { formColLayout } from "../../constants";
2
2
  import { valueType } from "antd/es/statistic/utils";
3
3
  import { ShouldUpdate } from "rc-field-form/lib/Field";
4
- import { NamePath, Rule, RuleObject } from "rc-field-form/lib/interface";
4
+ import { NamePath, Rule } from "rc-field-form/lib/interface";
5
5
  import { Ref } from "react";
6
- import { SourceInfo } from "react-number-format";
6
+ import { OnValueChange } from "react-number-format";
7
7
  export interface NumberFormatComponentRef {
8
8
  value: () => valueType;
9
9
  setValue: React.Dispatch<React.SetStateAction<valueType>>;
@@ -13,7 +13,7 @@ export interface NumberFormatComponentProps {
13
13
  text?: boolean;
14
14
  size?: 'small';
15
15
  align?: 'right';
16
- className?: string[];
16
+ classNames?: string[];
17
17
  variant?: 'borderless' | 'underlined';
18
18
  trailing?: number;
19
19
  prefix?: string;
@@ -24,7 +24,9 @@ export interface NumberFormatComponentProps {
24
24
  allowNegative?: boolean;
25
25
  value?: valueType;
26
26
  defaultValue?: valueType;
27
- onChange?: (name: NamePath | undefined, info: SourceInfo) => void;
27
+ removeError?: (name?: NamePath) => void;
28
+ onValueChange?: OnValueChange;
29
+ onChange?: (value?: number) => void;
28
30
  style?: React.CSSProperties;
29
31
  onBlur?: React.FocusEventHandler<HTMLInputElement>;
30
32
  onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
@@ -37,7 +39,6 @@ export interface NumberFormatComponentProps {
37
39
  label?: React.ReactNode;
38
40
  required?: boolean;
39
41
  rules?: Rule[];
40
- ruleType?: RuleObject['type'];
41
42
  ruleMessage?: string;
42
43
  ruleMin?: number;
43
44
  ruleMax?: number;
@@ -0,0 +1,3 @@
1
+ import { RadioComponentProps } from "./types";
2
+ declare const RadioComponent: <T>({ buttonStyle, options, optionType, onChange, noItem, loading, disabled, removeError, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }: RadioComponentProps<T>) => import("react/jsx-runtime").JSX.Element;
3
+ export default RadioComponent;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Component";
2
+ export type * from "./types";
@@ -0,0 +1,24 @@
1
+ import { formColLayout } from "../../constants";
2
+ import { CheckboxOptionType, RadioChangeEvent } from "antd";
3
+ import { ValidateStatus } from "antd/es/form/FormItem";
4
+ import { RadioGroupButtonStyle, RadioGroupOptionType } from "antd/lib/radio";
5
+ import { NamePath, Rule, RuleObject } from "rc-field-form/lib/interface";
6
+ export interface RadioComponentProps<T> {
7
+ buttonStyle?: RadioGroupButtonStyle;
8
+ options?: (CheckboxOptionType<T> | string | number)[];
9
+ optionType?: RadioGroupOptionType;
10
+ onChange?: (event: RadioChangeEvent) => void;
11
+ noItem?: boolean;
12
+ loading?: boolean;
13
+ disabled?: boolean;
14
+ removeError?: (name?: NamePath) => void;
15
+ formColLayout?: typeof formColLayout;
16
+ name?: NamePath;
17
+ label?: React.ReactNode;
18
+ required?: boolean;
19
+ rules?: Rule[];
20
+ ruleType?: RuleObject['type'];
21
+ ruleMessage?: string;
22
+ validateStatus?: ValidateStatus;
23
+ help?: React.ReactNode;
24
+ }
@@ -5,6 +5,7 @@ import { SizeType } from "antd/es/config-provider/SizeContext";
5
5
  import { Rule, RuleObject } from "antd/es/form";
6
6
  import { ValidateStatus } from "antd/es/form/FormItem";
7
7
  import { DefaultOptionType } from "antd/es/select";
8
+ import { NamePath } from "rc-field-form/lib/interface";
8
9
  export type SelectOption = (DefaultOptionType & {
9
10
  text?: React.ReactNode;
10
11
  encryption_id?: string;
@@ -24,7 +25,8 @@ export interface SelectComponentProps {
24
25
  placeholder?: React.ReactNode;
25
26
  value?: any;
26
27
  defaultValue?: any;
27
- onChange?: (name: string | string[] | undefined, value: any, option?: SelectOption | SelectOption[]) => void;
28
+ removeError?: (name?: NamePath) => void;
29
+ onChange?: (value: any, option?: SelectOption | SelectOption[]) => void;
28
30
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
29
31
  onSearch?: (value: string) => void;
30
32
  onFocus?: React.FocusEventHandler<HTMLElement>;
@@ -12,7 +12,8 @@ export interface SwitchComponentProps {
12
12
  disabled?: boolean;
13
13
  checked?: boolean;
14
14
  defaultChecked?: boolean;
15
- onChange?: (name: NamePath | undefined, checked: boolean, event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
15
+ removeError?: (name?: NamePath) => void;
16
+ onChange?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
16
17
  formColLayout?: typeof formColLayout;
17
18
  name?: NamePath;
18
19
  label?: React.ReactNode;
@@ -23,7 +23,8 @@ export interface TextAreaComponentProps {
23
23
  placeholder?: string;
24
24
  value?: valueType;
25
25
  defaultValue?: valueType;
26
- onChange?: (name: NamePath | undefined, event: React.ChangeEvent<HTMLTextAreaElement>) => void;
26
+ removeError?: (name?: NamePath) => void;
27
+ onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
27
28
  formColLayout?: typeof formColLayout;
28
29
  name?: NamePath;
29
30
  label?: React.ReactNode;
@@ -10,14 +10,17 @@ export { default as CascaderComponent } from "./Cascader";
10
10
  export type { CascaderComponentProps, CascaderComponentRef } from "./Cascader";
11
11
  export { default as CheckboxComponent } from "./Checkbox";
12
12
  export type { CheckboxComponentProps, CheckboxComponentRef } from "./Checkbox";
13
+ export { default as CheckboxGroupComponent } from "./Checkbox/Group";
14
+ export type { CheckboxGroupComponentProps, CheckboxGroupComponentRef } from "./Checkbox/Group";
13
15
  export { default as DatePickerComponent } from "./DatePicker";
14
16
  export type { DatePickerComponentProps, DatePickerComponentRef } from "./DatePicker";
15
17
  export { default as DateRangePickerComponent } from "./DateRangePicker";
16
18
  export type { DateRangePickerComponentProps, DateRangePickerComponentRef } from "./DateRangePicker";
17
19
  export { default as DropdownButtonComponent } from "./DropdownButton";
18
20
  export type { DropdownButtonComponentProps, DropdownButtonMenuItem } from "./DropdownButton";
19
- export { default as FormItemComponent } from "./FormItem";
20
- export type { FormItemComponentProps } from "./FormItem";
21
+ export { Form } from "./Form";
22
+ export { default as FormItemComponent } from "./Form/Item";
23
+ export type { FormItemComponentProps } from "./Form/Item";
21
24
  export { default as IconCheckOrClose } from "./Icon/CheckOrClose";
22
25
  export type { IconCheckOrCloseProps } from "./Icon/CheckOrClose";
23
26
  export { default as InputComponent } from "./Input";
@@ -26,6 +29,8 @@ export { default as LinkComponent } from "./Link";
26
29
  export type { LinkComponentProps } from "./Link";
27
30
  export { default as NumberFormatComponent } from "./NumberFormat";
28
31
  export type { NumberFormatComponentProps, NumberFormatComponentRef } from "./NumberFormat";
32
+ export { default as RadioComponent } from "./Radio";
33
+ export type { RadioComponentProps } from "./Radio";
29
34
  export { default as SelectComponent } from "./Select";
30
35
  export type { SelectComponentProps, SelectOption } from "./Select";
31
36
  export { default as SelectAsyncComponent } from "./Select/Async";
@@ -0,0 +1,3 @@
1
+ import { DataGridContextType } from "./types";
2
+ export declare const DataGridContext: import("react").Context<DataGridContextType>;
3
+ export declare const useDataGrid: () => DataGridContextType;
@@ -0,0 +1,4 @@
1
+ import { DataGridProviderProps } from "./types";
2
+ import React from "react";
3
+ declare const DataGridProvider: React.FC<DataGridProviderProps>;
4
+ export default DataGridProvider;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export interface DataGridContextType {
3
+ loading?: boolean;
4
+ setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
5
+ }
6
+ export interface DataGridProviderProps {
7
+ children?: React.ReactNode;
8
+ }
@@ -0,0 +1,6 @@
1
+ declare const colInline: (col: {
2
+ [key: string]: any;
3
+ }) => {
4
+ [key: string]: any;
5
+ };
6
+ export default colInline;
@@ -0,0 +1 @@
1
+ export { default } from "./function";
@@ -1,3 +1,4 @@
1
+ export { default as colInline } from "./colInline";
1
2
  export { default as colLayout } from "./colLayout";
2
3
  export { default as getTableAsyncName } from "./getTableAsyncName";
3
4
  export { default as getTableFilterStorage } from "./getTableFilterStorage";
@@ -1 +1,2 @@
1
+ export { default as useFocus } from "./useFocus";
1
2
  export { default as useRemoveError } from "./useRemoveError";
@@ -0,0 +1,7 @@
1
+ import { InputRef } from "rc-input";
2
+ import { BaseSelectRef } from "rc-select";
3
+ declare const useFocus: (selected: boolean) => {
4
+ ref: import("react").RefObject<InputRef | BaseSelectRef | null>;
5
+ tabIndex: number;
6
+ };
7
+ export default useFocus;
@@ -0,0 +1 @@
1
+ export { default } from "./hooks";
@@ -1,4 +1,4 @@
1
1
  declare const useRemoveError: (setInputErrors: React.Dispatch<React.SetStateAction<{
2
2
  [key: string]: any;
3
- }>>) => (name?: string | string[]) => void;
3
+ }>>) => (name?: string) => void;
4
4
  export default useRemoveError;