doui-react 2.0.7 → 2.0.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.
Files changed (55) hide show
  1. package/es/color-picker/component/index.d.ts +2 -0
  2. package/es/color-picker/component/index.js +17 -0
  3. package/es/color-picker/index.d.ts +2 -0
  4. package/es/color-picker/index.js +2 -0
  5. package/es/color-picker/type/index.d.ts +7 -0
  6. package/es/color-picker/type/index.js +1 -0
  7. package/es/form/component/form-item-map.d.ts +2 -0
  8. package/es/form/component/form-item-map.js +2 -0
  9. package/es/form/component/utils.d.ts +8 -8
  10. package/es/index.d.ts +2 -1
  11. package/es/index.js +1 -0
  12. package/es/open-modal/style/index.js +1 -1
  13. package/es/radio/component/abstract-box.d.ts +30 -30
  14. package/es/table/component/display-column.d.ts +2 -0
  15. package/es/table/component/display-column.js +95 -0
  16. package/es/table/component/index.d.ts +2 -0
  17. package/es/table/component/index.js +3 -1
  18. package/es/table/component/table.js +59 -63
  19. package/es/table/component/utils.d.ts +2 -2
  20. package/es/table/component/utils.js +37 -20
  21. package/es/table/style/index.d.ts +1 -0
  22. package/es/table/style/index.js +3 -2
  23. package/es/table/type/display-column.d.ts +9 -0
  24. package/es/table/type/display-column.js +1 -0
  25. package/es/table/type/index.d.ts +6 -0
  26. package/es/table/type/index.js +1 -0
  27. package/es/tabs/component/utils.d.ts +7 -7
  28. package/lib/color-picker/component/index.d.ts +2 -0
  29. package/lib/color-picker/component/index.js +24 -0
  30. package/lib/color-picker/index.d.ts +2 -0
  31. package/lib/color-picker/index.js +27 -0
  32. package/lib/color-picker/type/index.d.ts +7 -0
  33. package/lib/color-picker/type/index.js +5 -0
  34. package/lib/form/component/form-item-map.d.ts +2 -0
  35. package/lib/form/component/form-item-map.js +2 -0
  36. package/lib/form/component/utils.d.ts +8 -8
  37. package/lib/index.d.ts +2 -1
  38. package/lib/index.js +8 -0
  39. package/lib/open-modal/style/index.js +1 -1
  40. package/lib/radio/component/abstract-box.d.ts +30 -30
  41. package/lib/table/component/display-column.d.ts +2 -0
  42. package/lib/table/component/display-column.js +102 -0
  43. package/lib/table/component/index.d.ts +2 -0
  44. package/lib/table/component/index.js +3 -1
  45. package/lib/table/component/table.js +58 -62
  46. package/lib/table/component/utils.d.ts +2 -2
  47. package/lib/table/component/utils.js +38 -20
  48. package/lib/table/style/index.d.ts +1 -0
  49. package/lib/table/style/index.js +3 -2
  50. package/lib/table/type/display-column.d.ts +9 -0
  51. package/lib/table/type/display-column.js +5 -0
  52. package/lib/table/type/index.d.ts +6 -0
  53. package/lib/table/type/index.js +11 -0
  54. package/lib/tabs/component/utils.d.ts +7 -7
  55. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import { ColorPickerProps } from '../type';
2
+ export declare function ColorPicker({ onChange, ...props }: ColorPickerProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["onChange"];
4
+ import { getPopupContainer } from "../../api";
5
+ import { ColorPicker as AntdColorPicker } from 'antd';
6
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
7
+ export function ColorPicker(_ref) {
8
+ var _onChange = _ref.onChange,
9
+ props = _objectWithoutProperties(_ref, _excluded);
10
+ return _jsx(AntdColorPicker, _objectSpread({
11
+ allowClear: true,
12
+ onChange: function onChange(color) {
13
+ _onChange === null || _onChange === void 0 || _onChange(color.cleared ? undefined : color.toHexString());
14
+ },
15
+ getPopupContainer: getPopupContainer
16
+ }, props));
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from './component';
2
+ export * from './type';
@@ -0,0 +1,2 @@
1
+ export * from "./component";
2
+ export * from "./type";
@@ -0,0 +1,7 @@
1
+ import { ColorPickerProps as AntdColorPickerProps } from 'antd';
2
+ export interface ColorPickerProps extends Omit<AntdColorPickerProps, 'onChange'> {
3
+ /**
4
+ * @description 回调方法
5
+ */
6
+ onChange?: (value?: string) => void;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxProps } from "../../checkbox";
3
+ import { ColorPicker } from "../../color-picker";
3
4
  import { DatePicker, RangePicker } from "../../date-picker";
4
5
  import { FormInstance, FormItemContext, FormItemProps } from "..";
5
6
  import { Radio } from "../../radio";
@@ -35,6 +36,7 @@ export declare const formItemMap: {
35
36
  switch: typeof Switch;
36
37
  radio: typeof Radio;
37
38
  slider: import("react").ForwardRefExoticComponent<(import("antd").SliderSingleProps | import("antd/es/slider").SliderRangeProps) & import("react").RefAttributes<import("rc-slider").SliderRef>>;
39
+ colorPicker: typeof ColorPicker;
38
40
  date: typeof DatePicker;
39
41
  rangeDate: typeof RangePicker;
40
42
  };
@@ -4,6 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  var _excluded = ["name", "collectState", "filterNotExistValue", "requiredInOptions", "form"];
6
6
  import { Checkbox } from "../../checkbox";
7
+ import { ColorPicker } from "../../color-picker";
7
8
  import { DatePicker, RangePicker } from "../../date-picker";
8
9
  import { useFormContext } from "./..";
9
10
  import { useDebounce } from "../../hooks";
@@ -116,6 +117,7 @@ export var formItemMap = _objectSpread({
116
117
  switch: Switch,
117
118
  radio: Radio,
118
119
  slider: Slider,
120
+ colorPicker: ColorPicker,
119
121
  date: DatePicker,
120
122
  rangeDate: RangePicker
121
123
  }, supportCollectStateItem);
@@ -38,26 +38,26 @@ export declare function getFormItemProps(props: any): {
38
38
  defaultVisible?: boolean | undefined;
39
39
  onVisibleChange?: ((visible: boolean) => void) | undefined;
40
40
  afterVisibleChange?: ((visible: boolean) => void) | undefined;
41
- zIndex?: number | undefined;
42
- animation?: string | undefined;
43
- motion?: import("rc-motion").CSSMotionProps | undefined;
44
- transitionName?: string | undefined;
45
41
  prefixCls?: string | undefined;
46
- forceRender?: boolean | undefined;
47
- id?: string | undefined;
48
- align?: import("@rc-component/trigger").AlignType | undefined;
49
42
  onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
50
43
  fresh?: boolean | undefined;
51
44
  mouseLeaveDelay?: number | undefined;
52
45
  mouseEnterDelay?: number | undefined;
46
+ forceRender?: boolean | undefined;
53
47
  popupVisible?: boolean | undefined;
54
48
  trigger?: import("@rc-component/trigger").ActionType | import("@rc-component/trigger").ActionType[] | undefined;
49
+ transitionName?: string | undefined;
50
+ animation?: string | undefined;
51
+ motion?: import("rc-motion").CSSMotionProps | undefined;
55
52
  overlayStyle?: import("react").CSSProperties | undefined;
56
53
  overlayClassName?: string | undefined;
57
54
  getTooltipContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
55
+ align?: import("@rc-component/trigger").AlignType | undefined;
58
56
  showArrow?: boolean | import("@rc-component/trigger").ArrowType | undefined;
59
57
  arrowContent?: import("react").ReactNode;
58
+ id?: string | undefined;
60
59
  overlayInnerStyle?: import("react").CSSProperties | undefined;
60
+ zIndex?: number | undefined;
61
61
  icon: import("@emotion/react/jsx-runtime").JSX.Element;
62
62
  } | undefined;
63
63
  initialValue: any;
@@ -85,7 +85,7 @@ export declare function transformPathToName(path?: NamePath): string | undefined
85
85
  export declare function transformKeyToPath(params?: Record<string, any>): Record<string, any>;
86
86
  export declare function parseFormFailedError(error: ValidateErrorEntity): Record<string, string>;
87
87
  export declare function noStyle(item: FormItemProps): boolean;
88
- export declare function transformOptions(item: FormItemProps, values: FormValues, params: CommonParams): ((values: FormValues, params: import("..").OptionsParams) => import("../../api").FunctionReturn<SelectOptions>) | import("../../api").FunctionReturn<SelectOptions> | ((search?: string) => import("../../api").FunctionReturn<SelectOptions>) | undefined;
88
+ export declare function transformOptions(item: FormItemProps, values: FormValues, params: CommonParams): import("../../api").FunctionReturn<SelectOptions> | ((values: FormValues, params: import("..").OptionsParams) => import("../../api").FunctionReturn<SelectOptions>) | ((search?: string) => import("../../api").FunctionReturn<SelectOptions>) | undefined;
89
89
  interface FocusFirstInputParams extends CommonParams {
90
90
  focusFirstOnMount: FormProps['focusFirstOnMount'];
91
91
  }
package/es/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './hooks';
3
3
  export * from './icon';
4
4
  export { Button, type ButtonProps } from './button';
5
5
  export { Checkbox, type CheckboxProps } from './checkbox';
6
+ export { ColorPicker, type ColorPickerProps } from './color-picker';
6
7
  export { DatePicker, RangePicker, type DatePickerProps, type RangePickerProps } from './date-picker';
7
8
  export { Empty, type EmptyProps } from './empty';
8
9
  export { Form, useForm, useFormContext, useFormListContext, useFormValue, useFormValueChange, useValidateForm, useValidateNotExistValue, type FormContext, type FormItemChildrenProps, type FormItemProps, type FormItemRenderProps, type FormProps, type FormValues, type SubmitButtonProps, } from './form';
@@ -16,7 +17,7 @@ export { Radio, type RadioProps } from './radio';
16
17
  export { Select, type SelectProps } from './select';
17
18
  export { CenterStack, HStack, VStack, type CenterStackProps, type HStackProps, type VStackProps } from './stack';
18
19
  export { Switch, type SwitchProps } from './switch';
19
- export { Table, useSearchColumn, useTableContext, type ActionProps as TableActionProps, type Column as TableColumn, type RenderProps as TableColumnRenderProps, type TableContext, type TableProps, } from './table';
20
+ export { Table, useSearchColumn, useTableContext, type DisplayColumnProps, type ActionProps as TableActionProps, type Column as TableColumn, type RenderProps as TableColumnRenderProps, type TableContext, type TableProps, } from './table';
20
21
  export { Tabs, type TabsProps } from './tabs';
21
22
  export { Text, type TextProps } from './text';
22
23
  export { Tooltip, type TooltipProps } from './tooltip';
package/es/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./hooks";
3
3
  export * from "./icon";
4
4
  export { Button } from "./button";
5
5
  export { Checkbox } from "./checkbox";
6
+ export { ColorPicker } from "./color-picker";
6
7
  export { DatePicker, RangePicker } from "./date-picker";
7
8
  export { Empty } from "./empty";
8
9
  export { Form, useForm, useFormContext, useFormListContext, useFormValue, useFormValueChange, useValidateForm, useValidateNotExistValue } from "./form";
@@ -12,7 +12,7 @@ var style = {
12
12
  wrapper: function wrapper(_ref) {
13
13
  var bodyBottomMargin = _ref.bodyBottomMargin,
14
14
  titleCenter = _ref.titleCenter;
15
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-modal-title {\n font-size: 16px;\n ", "\n }\n\n .ant-modal-body {\n overflow: auto;\n max-height: calc(100vh - 300px);\n border-top: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n margin: 15px 0 20px;\n padding: 20px 0 ", ";\n }\n\n .do-table-wrapper {\n height: unset;\n }\n\n &:not(:has(.ant-modal-footer)) {\n .", " {\n display: none;\n }\n }\n "])), titleStyle(titleCenter), bodyBottomMargin, getClassName('footer-divider'));
15
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-modal-title {\n font-size: 16px;\n ", "\n }\n\n .ant-modal-body {\n overflow: hidden auto;\n max-height: calc(100vh - 300px);\n border-top: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n margin: 15px 0 20px;\n padding: 20px 0 ", ";\n }\n\n .do-table-wrapper {\n height: unset;\n }\n\n &:not(:has(.ant-modal-footer)) {\n .", " {\n display: none;\n }\n }\n "])), titleStyle(titleCenter), bodyBottomMargin, getClassName('footer-divider'));
16
16
  }
17
17
  };
18
18
  export default style;
@@ -36,26 +36,26 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
36
36
  defaultVisible?: boolean | undefined;
37
37
  onVisibleChange?: ((visible: boolean) => void) | undefined;
38
38
  afterVisibleChange?: ((visible: boolean) => void) | undefined;
39
- zIndex?: number | undefined;
40
- animation?: string | undefined;
41
- motion?: import("rc-motion").CSSMotionProps | undefined;
42
- transitionName?: string | undefined;
43
39
  prefixCls?: string | undefined;
44
- forceRender?: boolean | undefined;
45
- id?: string | undefined;
46
- align?: import("@rc-component/trigger").AlignType | undefined;
47
40
  onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
48
41
  fresh?: boolean | undefined;
49
42
  mouseLeaveDelay?: number | undefined;
50
43
  mouseEnterDelay?: number | undefined;
44
+ forceRender?: boolean | undefined;
51
45
  popupVisible?: boolean | undefined;
52
46
  trigger?: import("@rc-component/trigger").ActionType | import("@rc-component/trigger").ActionType[] | undefined;
47
+ transitionName?: string | undefined;
48
+ animation?: string | undefined;
49
+ motion?: import("rc-motion").CSSMotionProps | undefined;
53
50
  overlayStyle?: import("react").CSSProperties | undefined;
54
51
  overlayClassName?: string | undefined;
55
52
  getTooltipContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
53
+ align?: import("@rc-component/trigger").AlignType | undefined;
56
54
  showArrow?: boolean | import("@rc-component/trigger").ArrowType | undefined;
57
55
  arrowContent?: import("react").ReactNode;
56
+ id?: string | undefined;
58
57
  overlayInnerStyle?: import("react").CSSProperties | undefined;
58
+ zIndex?: number | undefined;
59
59
  };
60
60
  boxProps: {
61
61
  onChange(e: CheckboxChangeEvent): void;
@@ -65,50 +65,49 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
65
65
  value?: any;
66
66
  boxTooltip?: import("react").ReactNode | import("antd").TooltipProps;
67
67
  inGroup?: boolean | undefined;
68
+ prefixCls?: string | undefined;
69
+ disabled?: boolean | undefined;
68
70
  className?: string | undefined;
69
71
  style?: import("react").CSSProperties | undefined;
70
- title?: string | undefined;
71
- prefixCls?: string | undefined;
72
+ id?: string | undefined;
72
73
  rootClassName?: string | undefined;
74
+ checked?: boolean | undefined;
73
75
  name?: string | undefined;
76
+ required?: boolean | undefined;
77
+ type?: string | undefined;
74
78
  defaultChecked?: boolean | undefined;
75
79
  autoFocus?: boolean | undefined;
76
- id?: string | undefined;
77
80
  tabIndex?: number | undefined;
81
+ title?: string | undefined;
78
82
  onKeyDown?: import("react").KeyboardEventHandler<HTMLElement> | undefined;
79
83
  onKeyPress?: import("react").KeyboardEventHandler<HTMLElement> | undefined;
80
84
  onClick?: import("react").MouseEventHandler<HTMLElement> | undefined;
81
85
  onMouseEnter?: import("react").MouseEventHandler<HTMLElement> | undefined;
82
86
  onMouseLeave?: import("react").MouseEventHandler<HTMLElement> | undefined;
83
- disabled?: boolean | undefined;
84
- type?: string | undefined;
85
- checked?: boolean | undefined;
86
- required?: boolean | undefined;
87
87
  indeterminate?: boolean | undefined;
88
88
  skipGroup?: boolean | undefined;
89
- color?: string | undefined;
90
- content?: string | undefined;
91
- direction?: import("antd/es/config-provider").DirectionType;
92
- translate?: "yes" | "no" | undefined;
93
- onSubmit?: import("react").FormEventHandler<HTMLElement> | undefined;
94
89
  defaultValue?: string | number | readonly string[] | undefined;
90
+ color?: string | undefined;
91
+ rows?: number | false | undefined;
95
92
  suppressContentEditableWarning?: boolean | undefined;
96
93
  suppressHydrationWarning?: boolean | undefined;
97
94
  accessKey?: string | undefined;
98
- autoCapitalize?: (string & {}) | "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
99
- contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
95
+ autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
96
+ contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
100
97
  contextMenu?: string | undefined;
101
98
  dir?: string | undefined;
102
99
  draggable?: (boolean | "true" | "false") | undefined;
103
- enterKeyHint?: "done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined;
100
+ enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
104
101
  hidden?: boolean | undefined;
105
102
  lang?: string | undefined;
106
103
  nonce?: string | undefined;
107
104
  slot?: string | undefined;
108
105
  spellCheck?: (boolean | "true" | "false") | undefined;
106
+ translate?: "yes" | "no" | undefined;
109
107
  radioGroup?: string | undefined;
110
108
  role?: import("react").AriaRole | undefined;
111
109
  about?: string | undefined;
110
+ content?: string | undefined;
112
111
  datatype?: string | undefined;
113
112
  inlist?: any;
114
113
  prefix?: string | undefined;
@@ -128,13 +127,13 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
128
127
  results?: number | undefined;
129
128
  security?: string | undefined;
130
129
  unselectable?: "off" | "on" | undefined;
131
- inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
130
+ inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
132
131
  is?: string | undefined;
133
132
  exportparts?: string | undefined;
134
133
  part?: string | undefined;
135
134
  "aria-activedescendant"?: string | undefined;
136
135
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
137
- "aria-autocomplete"?: "inline" | "none" | "list" | "both" | undefined;
136
+ "aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
138
137
  "aria-braillelabel"?: string | undefined;
139
138
  "aria-brailleroledescription"?: string | undefined;
140
139
  "aria-busy"?: (boolean | "true" | "false") | undefined;
@@ -144,17 +143,17 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
144
143
  "aria-colindextext"?: string | undefined;
145
144
  "aria-colspan"?: number | undefined;
146
145
  "aria-controls"?: string | undefined;
147
- "aria-current"?: boolean | "page" | "true" | "false" | "step" | "location" | "date" | "time" | undefined;
146
+ "aria-current"?: boolean | "step" | "true" | "false" | "page" | "location" | "date" | "time" | undefined;
148
147
  "aria-describedby"?: string | undefined;
149
148
  "aria-description"?: string | undefined;
150
149
  "aria-details"?: string | undefined;
151
150
  "aria-disabled"?: (boolean | "true" | "false") | undefined;
152
- "aria-dropeffect"?: "none" | "link" | "copy" | "execute" | "move" | "popup" | undefined;
151
+ "aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
153
152
  "aria-errormessage"?: string | undefined;
154
153
  "aria-expanded"?: (boolean | "true" | "false") | undefined;
155
154
  "aria-flowto"?: string | undefined;
156
155
  "aria-grabbed"?: (boolean | "true" | "false") | undefined;
157
- "aria-haspopup"?: boolean | "grid" | "true" | "false" | "dialog" | "listbox" | "menu" | "tree" | undefined;
156
+ "aria-haspopup"?: boolean | "true" | "false" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
158
157
  "aria-hidden"?: (boolean | "true" | "false") | undefined;
159
158
  "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
160
159
  "aria-keyshortcuts"?: string | undefined;
@@ -165,13 +164,13 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
165
164
  "aria-modal"?: (boolean | "true" | "false") | undefined;
166
165
  "aria-multiline"?: (boolean | "true" | "false") | undefined;
167
166
  "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
168
- "aria-orientation"?: "vertical" | "horizontal" | undefined;
167
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
169
168
  "aria-owns"?: string | undefined;
170
169
  "aria-placeholder"?: string | undefined;
171
170
  "aria-posinset"?: number | undefined;
172
171
  "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
173
172
  "aria-readonly"?: (boolean | "true" | "false") | undefined;
174
- "aria-relevant"?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
173
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
175
174
  "aria-required"?: (boolean | "true" | "false") | undefined;
176
175
  "aria-roledescription"?: string | undefined;
177
176
  "aria-rowcount"?: number | undefined;
@@ -209,6 +208,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
209
208
  onInputCapture?: import("react").FormEventHandler<HTMLElement> | undefined;
210
209
  onReset?: import("react").FormEventHandler<HTMLElement> | undefined;
211
210
  onResetCapture?: import("react").FormEventHandler<HTMLElement> | undefined;
211
+ onSubmit?: import("react").FormEventHandler<HTMLElement> | undefined;
212
212
  onSubmitCapture?: import("react").FormEventHandler<HTMLElement> | undefined;
213
213
  onInvalid?: import("react").FormEventHandler<HTMLElement> | undefined;
214
214
  onInvalidCapture?: import("react").FormEventHandler<HTMLElement> | undefined;
@@ -337,8 +337,8 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
337
337
  onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLElement> | undefined;
338
338
  onTransitionEnd?: import("react").TransitionEventHandler<HTMLElement> | undefined;
339
339
  onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLElement> | undefined;
340
+ direction?: import("antd/es/config-provider").DirectionType;
340
341
  tooltip?: import("react").ReactNode | import("antd").TooltipProps;
341
- rows?: number | false | undefined;
342
342
  autoShowTooltip?: boolean | undefined;
343
343
  refs?: import("../../api").Refs | undefined;
344
344
  ref: import("../../api").Refs | undefined;
@@ -0,0 +1,2 @@
1
+ import { DisplayColumnProps } from "..";
2
+ export declare function DisplayColumn({ value, onChange, storageKey, ...props }: DisplayColumnProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,95 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ var _excluded = ["value", "onChange", "storageKey"];
5
+ import { getPopupContainer } from "../../api";
6
+ import { Button } from "../../button";
7
+ import { Checkbox } from "../../checkbox";
8
+ import { useTableContext } from "./..";
9
+ import { SettingOutlined } from '@ant-design/icons';
10
+ import { Popover } from 'antd';
11
+ import _ from 'lodash';
12
+ import { useEffect } from 'react';
13
+ import { useLocalStorage } from 'react-use';
14
+ import style from "../style";
15
+ import { isActionsColumn } from "./utils";
16
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
+ function useControllableState(_ref) {
18
+ var value = _ref.value,
19
+ onChange = _ref.onChange,
20
+ _ref$storageKey = _ref.storageKey,
21
+ storageKey = _ref$storageKey === void 0 ? 'default' : _ref$storageKey,
22
+ defaultOptions = _ref.defaultOptions;
23
+ var finalStorageKey = "table-display-column-".concat(storageKey);
24
+ var _useLocalStorage = useLocalStorage(finalStorageKey, defaultOptions),
25
+ _useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
26
+ internalValue = _useLocalStorage2[0],
27
+ setInternalValue = _useLocalStorage2[1];
28
+ var _useTableContext = useTableContext(),
29
+ setContext = _useTableContext.setContext;
30
+ var finalValue = value !== null && value !== void 0 ? value : internalValue;
31
+ useEffect(function () {
32
+ setContext({
33
+ displayColumnKeys: finalValue
34
+ });
35
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
+ }, [finalValue]);
37
+ return {
38
+ value: finalValue,
39
+ onChange: onChange !== null && onChange !== void 0 ? onChange : setInternalValue
40
+ };
41
+ }
42
+ function useOptions() {
43
+ var _useTableContext2 = useTableContext(),
44
+ columns = _useTableContext2.columns;
45
+ var options = _.filter(columns, function (column) {
46
+ return column.title && !isActionsColumn(column);
47
+ }).map(function (column) {
48
+ return {
49
+ label: column.title,
50
+ value: column.dataIndex
51
+ };
52
+ });
53
+ return {
54
+ options: options,
55
+ defaultOptions: _.map(options, 'value')
56
+ };
57
+ }
58
+ function Content(props) {
59
+ var _useOptions = useOptions(),
60
+ options = _useOptions.options,
61
+ defaultOptions = _useOptions.defaultOptions;
62
+ var _useControllableState = useControllableState(_objectSpread(_objectSpread({}, props), {}, {
63
+ defaultOptions: defaultOptions
64
+ })),
65
+ value = _useControllableState.value,
66
+ onChange = _useControllableState.onChange;
67
+ return _jsx(Checkbox, {
68
+ value: value,
69
+ onChange: onChange,
70
+ options: options,
71
+ sort: false,
72
+ css: style.displayColumn
73
+ });
74
+ }
75
+ export function DisplayColumn(_ref2) {
76
+ var value = _ref2.value,
77
+ onChange = _ref2.onChange,
78
+ storageKey = _ref2.storageKey,
79
+ props = _objectWithoutProperties(_ref2, _excluded);
80
+ return _jsx(Popover, {
81
+ placement: "bottomRight",
82
+ arrow: false,
83
+ trigger: "click",
84
+ forceRender: true,
85
+ getPopupContainer: getPopupContainer,
86
+ content: _jsx(Content, {
87
+ value: value,
88
+ onChange: onChange,
89
+ storageKey: storageKey
90
+ }),
91
+ children: _jsx(Button, _objectSpread({
92
+ icon: _jsx(SettingOutlined, {})
93
+ }, props))
94
+ });
95
+ }
@@ -1,7 +1,9 @@
1
1
  import { ActionButton } from './action-button';
2
+ import { DisplayColumn } from './display-column';
2
3
  import { Table as InternalTable } from './table';
3
4
  type TableType = typeof InternalTable & {
4
5
  ActionButton: typeof ActionButton;
6
+ DisplayColumn: typeof DisplayColumn;
5
7
  };
6
8
  export declare const Table: TableType;
7
9
  export {};
@@ -1,4 +1,6 @@
1
1
  import { ActionButton } from "./action-button";
2
+ import { DisplayColumn } from "./display-column";
2
3
  import { Table as InternalTable } from "./table";
3
4
  export var Table = InternalTable;
4
- Table.ActionButton = ActionButton;
5
+ Table.ActionButton = ActionButton;
6
+ Table.DisplayColumn = DisplayColumn;
@@ -10,7 +10,7 @@ var _excluded = ["rowKey", "loading", "columns", "dataSource", "editorValueKey"]
10
10
  import { executeFunction, getClassName, includesNonStrictMode } from "../../api";
11
11
  import { Empty } from "../../empty";
12
12
  import { Form, useFormContext } from "../../form";
13
- import { useListOperation } from "../../hooks";
13
+ import { useListOperation, useMemoFn } from "../../hooks";
14
14
  import { TableProvider, useSearchColumn } from "./..";
15
15
  import { cx } from '@emotion/css';
16
16
  import _ from 'lodash';
@@ -87,11 +87,51 @@ function useInit(_ref2) {
87
87
  value: dataSource,
88
88
  onChange: setDataSource
89
89
  });
90
-
91
- // eslint-disable-next-line react-hooks/exhaustive-deps
92
- useEffect(function () {
93
- return void refresh();
94
- }, [data]);
90
+ var updateSelectedStatus = useMemoFn(function (keys) {
91
+ var data = _.map(dataSource, function (item) {
92
+ return _objectSpread(_objectSpread({}, item), {}, {
93
+ __selected__: includesNonStrictMode(keys, item[rowKey])
94
+ });
95
+ });
96
+ setDataSource(data);
97
+ });
98
+ var refresh = useMemoFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
99
+ var _ref4,
100
+ onlyLoading,
101
+ params,
102
+ _yield$Promise$all,
103
+ _yield$Promise$all2,
104
+ res,
105
+ _args2 = arguments;
106
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
107
+ while (1) switch (_context2.prev = _context2.next) {
108
+ case 0:
109
+ _ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, onlyLoading = _ref4.onlyLoading, params = _objectWithoutProperties(_ref4, _excluded2);
110
+ setLoading(true);
111
+ if (!onlyLoading) {
112
+ _context2.next = 4;
113
+ break;
114
+ }
115
+ return _context2.abrupt("return");
116
+ case 4:
117
+ _context2.prev = 4;
118
+ _context2.next = 7;
119
+ return Promise.all([executeFunction(data, params), getInitialContext(params)]);
120
+ case 7:
121
+ _yield$Promise$all = _context2.sent;
122
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
123
+ res = _yield$Promise$all2[0];
124
+ setDataSource(res || []);
125
+ case 11:
126
+ _context2.prev = 11;
127
+ setLoading(false);
128
+ return _context2.finish(11);
129
+ case 14:
130
+ case "end":
131
+ return _context2.stop();
132
+ }
133
+ }, _callee2, null, [[4,, 11, 14]]);
134
+ })));
95
135
  var context = _objectSpread(_objectSpread({}, contexts), {}, {
96
136
  refresh: refresh,
97
137
  dataSource: dataSource,
@@ -104,59 +144,14 @@ function useInit(_ref2) {
104
144
  },
105
145
  operation: operation,
106
146
  rowKey: rowKey,
147
+ columns: columns,
107
148
  editorValueKey: editorValueKey
108
149
  });
109
- function updateSelectedStatus(keys) {
110
- var data = _.map(dataSource, function (item) {
111
- return _objectSpread(_objectSpread({}, item), {}, {
112
- __selected__: includesNonStrictMode(keys, item[rowKey])
113
- });
114
- });
115
- setDataSource(data);
116
- }
117
- function refresh() {
118
- return _refresh.apply(this, arguments);
119
- }
120
- function _refresh() {
121
- _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
122
- var _ref3,
123
- onlyLoading,
124
- params,
125
- _yield$Promise$all,
126
- _yield$Promise$all2,
127
- res,
128
- _args2 = arguments;
129
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
130
- while (1) switch (_context2.prev = _context2.next) {
131
- case 0:
132
- _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, onlyLoading = _ref3.onlyLoading, params = _objectWithoutProperties(_ref3, _excluded2);
133
- setLoading(true);
134
- if (!onlyLoading) {
135
- _context2.next = 4;
136
- break;
137
- }
138
- return _context2.abrupt("return");
139
- case 4:
140
- _context2.prev = 4;
141
- _context2.next = 7;
142
- return Promise.all([executeFunction(data, params), getInitialContext(params)]);
143
- case 7:
144
- _yield$Promise$all = _context2.sent;
145
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
146
- res = _yield$Promise$all2[0];
147
- setDataSource(res || []);
148
- case 11:
149
- _context2.prev = 11;
150
- setLoading(false);
151
- return _context2.finish(11);
152
- case 14:
153
- case "end":
154
- return _context2.stop();
155
- }
156
- }, _callee2, null, [[4,, 11, 14]]);
157
- }));
158
- return _refresh.apply(this, arguments);
159
- }
150
+
151
+ // eslint-disable-next-line react-hooks/exhaustive-deps
152
+ useEffect(function () {
153
+ return void refresh();
154
+ }, [data]);
160
155
  var rowSelection = getRowSelection({
161
156
  rowKey: rowKey,
162
157
  columns: columns,
@@ -176,11 +171,11 @@ function useInit(_ref2) {
176
171
  useFormWrapper: useFormWrapper
177
172
  };
178
173
  }
179
- export function useTable(_ref4) {
180
- var onRowClick = _ref4.onRowClick,
181
- width = _ref4.width,
182
- emptyText = _ref4.emptyText,
183
- restProps = _objectWithoutProperties(_ref4, _excluded3);
174
+ export function useTable(_ref5) {
175
+ var onRowClick = _ref5.onRowClick,
176
+ width = _ref5.width,
177
+ emptyText = _ref5.emptyText,
178
+ restProps = _objectWithoutProperties(_ref5, _excluded3);
184
179
  var params = useInit(restProps);
185
180
  var _useSearchColumn = useSearchColumn(),
186
181
  getSearchColumn = _useSearchColumn.getSearchColumn;
@@ -188,7 +183,8 @@ export function useTable(_ref4) {
188
183
  columns: _.reject(restProps.columns, {
189
184
  type: 'selection'
190
185
  }),
191
- getSearchColumn: getSearchColumn
186
+ getSearchColumn: getSearchColumn,
187
+ context: params.context
192
188
  });
193
189
  return _objectSpread(_objectSpread(_objectSpread({
194
190
  onRow: function onRow(record) {
@@ -1,5 +1,4 @@
1
1
  import { FormInstance, FormProps } from "../../form";
2
- import type { ColumnType } from 'antd/es/table';
3
2
  import type { TableRowSelection } from 'antd/es/table/interface';
4
3
  import { Column, DataSource, GetSearchColumn, TableContext, TableProps } from '../type';
5
4
  import { Actions } from './actions';
@@ -20,7 +19,8 @@ export declare const componentMap: {
20
19
  editor: typeof Editor;
21
20
  default: (props: any) => any;
22
21
  };
23
- export declare function generateColumns({ columns, getSearchColumn }: GenerateColumnsProps): ColumnType<any>[];
22
+ export declare function isActionsColumn(column: Column): boolean;
23
+ export declare function generateColumns({ columns, getSearchColumn, context }: GenerateColumnsProps): Column[];
24
24
  interface RowSelectionProps {
25
25
  rowKey: string;
26
26
  columns: Column[];