@bioturing/components 0.46.4 → 0.48.0
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.
- package/dist/components/base-menu/component.js +19 -21
- package/dist/components/base-menu/component.js.map +1 -1
- package/dist/components/base-menu/index.d.ts +1 -1
- package/dist/components/base-menu/index.d.ts.map +1 -1
- package/dist/components/base-menu/index.js +12 -7
- package/dist/components/base-menu/index.js.map +1 -1
- package/dist/components/base-menu/item.css +1 -1
- package/dist/components/base-menu/item.d.ts +13 -2
- package/dist/components/base-menu/item.d.ts.map +1 -1
- package/dist/components/base-menu/item.js +62 -47
- package/dist/components/base-menu/item.js.map +1 -1
- package/dist/components/base-menu/style.css +1 -1
- package/dist/components/checkbox/component.d.ts +2 -2
- package/dist/components/checkbox/component.d.ts.map +1 -1
- package/dist/components/checkbox/component.js.map +1 -1
- package/dist/components/choice-list/component.js +12 -12
- package/dist/components/combobox/component.d.ts.map +1 -1
- package/dist/components/combobox/component.js +121 -121
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/style.css +1 -1
- package/dist/components/data-table/component.d.ts.map +1 -1
- package/dist/components/data-table/component.js +99 -79
- package/dist/components/data-table/component.js.map +1 -1
- package/dist/components/data-table/components/TableBody.d.ts +3 -2
- package/dist/components/data-table/components/TableBody.d.ts.map +1 -1
- package/dist/components/data-table/components/TableBody.js +106 -89
- package/dist/components/data-table/components/TableBody.js.map +1 -1
- package/dist/components/data-table/components/TableHeader.d.ts +3 -1
- package/dist/components/data-table/components/TableHeader.d.ts.map +1 -1
- package/dist/components/data-table/components/TableHeader.js +121 -93
- package/dist/components/data-table/components/TableHeader.js.map +1 -1
- package/dist/components/data-table/components/TablePagination.d.ts.map +1 -1
- package/dist/components/data-table/components/TablePagination.js +36 -31
- package/dist/components/data-table/components/TablePagination.js.map +1 -1
- package/dist/components/data-table/hooks.d.ts.map +1 -1
- package/dist/components/data-table/hooks.js +98 -83
- package/dist/components/data-table/hooks.js.map +1 -1
- package/dist/components/data-table/style.css +1 -1
- package/dist/components/data-table/types.d.ts +1 -1
- package/dist/components/data-table/types.d.ts.map +1 -1
- package/dist/components/data-table/utils.js +37 -30
- package/dist/components/data-table/utils.js.map +1 -1
- package/dist/components/data-table/variant-minimal.css +1 -0
- package/dist/components/data-table/variant-zebra.css +1 -0
- package/dist/components/dialog/Dialog.js +46 -46
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/dialog/dialog.css +1 -1
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +121 -144
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/dropdown-menu/item.d.ts +7 -15
- package/dist/components/dropdown-menu/item.d.ts.map +1 -1
- package/dist/components/dropdown-menu/item.js +132 -81
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/radio-group.d.ts +14 -0
- package/dist/components/dropdown-menu/radio-group.d.ts.map +1 -0
- package/dist/components/dropdown-menu/radio-group.js +45 -0
- package/dist/components/dropdown-menu/radio-group.js.map +1 -0
- package/dist/components/dropdown-menu/search-mode.d.ts +4 -0
- package/dist/components/dropdown-menu/search-mode.d.ts.map +1 -0
- package/dist/components/dropdown-menu/search-mode.js +6 -0
- package/dist/components/dropdown-menu/search-mode.js.map +1 -0
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/dropdown-menu/submenu.d.ts +25 -0
- package/dist/components/dropdown-menu/submenu.d.ts.map +1 -0
- package/dist/components/dropdown-menu/submenu.js +96 -0
- package/dist/components/dropdown-menu/submenu.js.map +1 -0
- package/dist/components/dropdown-menu/types.d.ts +85 -12
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +4 -8
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +108 -81
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/form/FormItem/ItemHolder.d.ts +6 -5
- package/dist/components/form/FormItem/ItemHolder.d.ts.map +1 -1
- package/dist/components/form/FormItem/ItemHolder.js +32 -29
- package/dist/components/form/FormItem/ItemHolder.js.map +1 -1
- package/dist/components/form/FormItem/index.d.ts +6 -0
- package/dist/components/form/FormItem/index.d.ts.map +1 -1
- package/dist/components/form/FormItem/index.js +138 -127
- package/dist/components/form/FormItem/index.js.map +1 -1
- package/dist/components/form/FormValidationContext.d.ts +5 -0
- package/dist/components/form/FormValidationContext.d.ts.map +1 -0
- package/dist/components/form/FormValidationContext.js +7 -0
- package/dist/components/form/FormValidationContext.js.map +1 -0
- package/dist/components/form/component.d.ts +6 -1
- package/dist/components/form/component.d.ts.map +1 -1
- package/dist/components/form/component.js +30 -20
- package/dist/components/form/component.js.map +1 -1
- package/dist/components/form/formValidationRule.d.ts +19 -0
- package/dist/components/form/formValidationRule.d.ts.map +1 -0
- package/dist/components/form/formValidationRule.js +22 -0
- package/dist/components/form/formValidationRule.js.map +1 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/useFormValidation.d.ts +3 -0
- package/dist/components/form/useFormValidation.d.ts.map +1 -0
- package/dist/components/form/useFormValidation.js +18 -0
- package/dist/components/form/useFormValidation.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/keyboard-shortcut/component.d.ts +2 -0
- package/dist/components/keyboard-shortcut/component.d.ts.map +1 -1
- package/dist/components/keyboard-shortcut/component.js +69 -49
- package/dist/components/keyboard-shortcut/component.js.map +1 -1
- package/dist/components/modal/Modal.d.ts +1 -1
- package/dist/components/modal/Modal.js +9 -9
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/style.css +1 -1
- package/dist/components/select/component.js +29 -29
- package/dist/components/select/component.js.map +1 -1
- package/dist/components/theme-provider/component.d.ts +3 -1
- package/dist/components/theme-provider/component.d.ts.map +1 -1
- package/dist/components/theme-provider/component.js +32 -31
- package/dist/components/theme-provider/component.js.map +1 -1
- package/dist/components/theme-provider/context/index.d.ts +2 -1
- package/dist/components/theme-provider/context/index.d.ts.map +1 -1
- package/dist/components/theme-provider/context/provider.d.ts +2 -3
- package/dist/components/theme-provider/context/provider.d.ts.map +1 -1
- package/dist/components/theme-provider/context/provider.js +13 -6
- package/dist/components/theme-provider/context/provider.js.map +1 -1
- package/dist/components/theme-provider/context/themeStore.d.ts +15 -0
- package/dist/components/theme-provider/context/themeStore.d.ts.map +1 -1
- package/dist/components/theme-provider/context/themeStore.js +10 -9
- package/dist/components/theme-provider/context/themeStore.js.map +1 -1
- package/dist/components/theme-provider/style.css +1 -1
- package/dist/components/tooltip/component.d.ts.map +1 -1
- package/dist/components/tooltip/component.js +23 -12
- package/dist/components/tooltip/component.js.map +1 -1
- package/dist/index.js +273 -258
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +9 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +14 -0
- package/dist/metadata.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +6 -6
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export type
|
|
3
|
-
/**
|
|
4
|
-
* The type of the menu item
|
|
5
|
-
*/
|
|
6
|
-
type: "item";
|
|
2
|
+
export type DropdownMenuInteractiveItemBase = {
|
|
7
3
|
/**
|
|
8
4
|
* The label of the menu item
|
|
9
5
|
*/
|
|
@@ -16,6 +12,10 @@ export type DropdownMenuItemType = {
|
|
|
16
12
|
* The icon of the menu item
|
|
17
13
|
*/
|
|
18
14
|
icon?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The description of the menu item
|
|
17
|
+
*/
|
|
18
|
+
description?: React.ReactNode;
|
|
19
19
|
/**
|
|
20
20
|
* The suffix of the menu item
|
|
21
21
|
*/
|
|
@@ -24,12 +24,6 @@ export type DropdownMenuItemType = {
|
|
|
24
24
|
* The key of the menu item
|
|
25
25
|
*/
|
|
26
26
|
key: React.Key;
|
|
27
|
-
/**
|
|
28
|
-
* The onSelect event handler of the menu item
|
|
29
|
-
*/
|
|
30
|
-
onSelect?: (item: DropdownMenuItemType & {
|
|
31
|
-
type: "item";
|
|
32
|
-
}) => void;
|
|
33
27
|
/**
|
|
34
28
|
* The onClick event handler of the menu item
|
|
35
29
|
*/
|
|
@@ -71,7 +65,85 @@ export type DropdownMenuItemType = {
|
|
|
71
65
|
text?: string;
|
|
72
66
|
suffix?: string;
|
|
73
67
|
};
|
|
74
|
-
}
|
|
68
|
+
};
|
|
69
|
+
export type DropdownMenuActionItem = DropdownMenuInteractiveItemBase & {
|
|
70
|
+
/**
|
|
71
|
+
* The type of the menu item
|
|
72
|
+
*/
|
|
73
|
+
type: "item";
|
|
74
|
+
/**
|
|
75
|
+
* The onSelect event handler of the menu item
|
|
76
|
+
*/
|
|
77
|
+
onSelect?: (item: DropdownMenuActionItem) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Submenu items that appear when this item is hovered/clicked.
|
|
80
|
+
* Only supported in menu mode (not in search/combobox mode).
|
|
81
|
+
*/
|
|
82
|
+
children?: DropdownMenuItemType[];
|
|
83
|
+
};
|
|
84
|
+
export type DropdownMenuCheckboxItem = DropdownMenuInteractiveItemBase & {
|
|
85
|
+
/**
|
|
86
|
+
* The type of the menu item
|
|
87
|
+
*/
|
|
88
|
+
type: "checkbox";
|
|
89
|
+
/**
|
|
90
|
+
* Controlled checked state
|
|
91
|
+
*/
|
|
92
|
+
checked?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Uncontrolled initial checked state
|
|
95
|
+
*/
|
|
96
|
+
defaultChecked?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Called when the checked state changes
|
|
99
|
+
*/
|
|
100
|
+
onCheckedChange?: (checked: boolean, item: DropdownMenuCheckboxItem) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Called when the checkbox item is selected
|
|
103
|
+
*/
|
|
104
|
+
onSelect?: (item: DropdownMenuCheckboxItem) => void;
|
|
105
|
+
};
|
|
106
|
+
export type DropdownMenuRadioItem = DropdownMenuInteractiveItemBase & {
|
|
107
|
+
/**
|
|
108
|
+
* The type of the menu item
|
|
109
|
+
*/
|
|
110
|
+
type: "radio";
|
|
111
|
+
/**
|
|
112
|
+
* Radio value within the group
|
|
113
|
+
*/
|
|
114
|
+
value: string;
|
|
115
|
+
/**
|
|
116
|
+
* Called when the radio item is selected
|
|
117
|
+
*/
|
|
118
|
+
onSelect?: (item: DropdownMenuRadioItem) => void;
|
|
119
|
+
};
|
|
120
|
+
export type DropdownMenuRadioGroupItem = {
|
|
121
|
+
/**
|
|
122
|
+
* Stable key for preserving radio-group identity across rerenders
|
|
123
|
+
*/
|
|
124
|
+
key?: React.Key;
|
|
125
|
+
/**
|
|
126
|
+
* The type of the menu item
|
|
127
|
+
*/
|
|
128
|
+
type: "radio-group";
|
|
129
|
+
/**
|
|
130
|
+
* Controlled selected value
|
|
131
|
+
*/
|
|
132
|
+
value?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Uncontrolled initial selected value
|
|
135
|
+
*/
|
|
136
|
+
defaultValue?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Called when the selected value changes
|
|
139
|
+
*/
|
|
140
|
+
onValueChange?: (value: string) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Radio items in the group
|
|
143
|
+
*/
|
|
144
|
+
children: DropdownMenuRadioItem[];
|
|
145
|
+
};
|
|
146
|
+
export type DropdownMenuItemType = DropdownMenuActionItem | DropdownMenuCheckboxItem | DropdownMenuRadioGroupItem | {
|
|
75
147
|
/**
|
|
76
148
|
* The type of the menu item
|
|
77
149
|
*/
|
|
@@ -90,6 +162,7 @@ export type DropdownMenuItemType = {
|
|
|
90
162
|
*/
|
|
91
163
|
className?: string;
|
|
92
164
|
};
|
|
165
|
+
export type DropdownMenuInteractiveItem = DropdownMenuActionItem | DropdownMenuCheckboxItem | DropdownMenuRadioItem;
|
|
93
166
|
export type DropdownMenuGroup = {
|
|
94
167
|
label: React.ReactNode | null;
|
|
95
168
|
items: DropdownMenuItemType[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC;IAC/D;;OAE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,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,wBAAwB,GACxB,0BAA0B,GAC1B;IACE;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;CACjB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,2BAA2B,GACnC,sBAAsB,GACtB,wBAAwB,GACxB,qBAAqB,CAAC;AAE1B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DropdownMenuItemType, DropdownMenuGroup } from './types';
|
|
1
|
+
import { DropdownMenuItemType, DropdownMenuGroup, DropdownMenuInteractiveItem } from './types';
|
|
2
2
|
export interface UseDropdownMenuProps {
|
|
3
3
|
/**
|
|
4
4
|
* Callback function to handle the open state change of the dropdown menu.
|
|
@@ -17,13 +17,11 @@ export interface UseDropdownMenuProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom render function for menu items
|
|
19
19
|
*/
|
|
20
|
-
itemRender?: (item:
|
|
20
|
+
itemRender?: (item: DropdownMenuInteractiveItem, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
|
|
21
21
|
/**
|
|
22
22
|
* Custom render function for menu item labels
|
|
23
23
|
*/
|
|
24
|
-
itemLabelRender?: (item:
|
|
25
|
-
type: "item";
|
|
26
|
-
}, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
|
|
24
|
+
itemLabelRender?: (item: DropdownMenuInteractiveItem, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
|
|
27
25
|
/**
|
|
28
26
|
* Whether to keep the dropdown open when an item is selected
|
|
29
27
|
* @default false
|
|
@@ -46,9 +44,7 @@ export interface UseDropdownMenuProps {
|
|
|
46
44
|
* Function to extract keywords from the item for search filtering
|
|
47
45
|
* @default (item) => [String(item.key), reactNodeToString(item.label)]
|
|
48
46
|
*/
|
|
49
|
-
getItemKeywords?: (item:
|
|
50
|
-
type: "item";
|
|
51
|
-
}) => string[];
|
|
47
|
+
getItemKeywords?: (item: DropdownMenuInteractiveItem) => string[];
|
|
52
48
|
}
|
|
53
49
|
export declare const useDropdownMenu: ({ items, inCombobox, classNames, selectedItemKeys, keepOpenOnSelect, showCheckbox, getItemKeywords, onOpenChange, itemRender, itemLabelRender, }: UseDropdownMenuProps) => {
|
|
54
50
|
itemGroups: DropdownMenuGroup[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AASjB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|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { DropdownMenuItem as
|
|
4
|
-
import { DropdownMenuDivider as
|
|
5
|
-
import {
|
|
1
|
+
import { jsx as u, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as M, useMemo as I } from "react";
|
|
3
|
+
import { DropdownMenuItem as $ } from "./item.js";
|
|
4
|
+
import { DropdownMenuDivider as L } from "./divider.js";
|
|
5
|
+
import { DropdownMenuSubmenu as T } from "./submenu.js";
|
|
6
|
+
import { DropdownMenuRadioGroup as j } from "./radio-group.js";
|
|
7
|
+
import { isDropdownMenuSearchSupportedItem as q } from "./search-mode.js";
|
|
8
|
+
import { Menu as b, Combobox as v } from "@base-ui/react";
|
|
6
9
|
import './style.css';/* empty css */
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { clsx as
|
|
10
|
-
const
|
|
11
|
-
items:
|
|
12
|
-
inCombobox:
|
|
10
|
+
import { reactNodeToString as z } from "../utils/reactToString.js";
|
|
11
|
+
import { useCls as A } from "../utils/antdUtils.js";
|
|
12
|
+
import { clsx as y } from "../utils/cn.js";
|
|
13
|
+
const _ = ({
|
|
14
|
+
items: D,
|
|
15
|
+
inCombobox: t = !1,
|
|
13
16
|
classNames: o = {},
|
|
14
|
-
selectedItemKeys:
|
|
15
|
-
keepOpenOnSelect:
|
|
17
|
+
selectedItemKeys: S,
|
|
18
|
+
keepOpenOnSelect: f,
|
|
16
19
|
showCheckbox: G = !1,
|
|
17
|
-
getItemKeywords:
|
|
18
|
-
onOpenChange:
|
|
19
|
-
itemRender:
|
|
20
|
-
itemLabelRender:
|
|
20
|
+
getItemKeywords: n = (p) => [String(p.key), z(p.label)],
|
|
21
|
+
onOpenChange: m,
|
|
22
|
+
itemRender: h,
|
|
23
|
+
itemLabelRender: g
|
|
21
24
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
+
const p = A(), d = M(
|
|
26
|
+
(r, i, e) => r.type === "item" || r.type === "checkbox" ? r.type === "item" && !t && r.children && r.children.length > 0 ? /* @__PURE__ */ u(
|
|
27
|
+
T,
|
|
25
28
|
{
|
|
26
|
-
item:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
item: r,
|
|
30
|
+
itemRender: h,
|
|
31
|
+
itemLabelRender: g,
|
|
32
|
+
showCheckbox: G,
|
|
33
|
+
getItemKeywords: n,
|
|
34
|
+
selectedItemKeys: S,
|
|
35
|
+
keepOpenOnSelect: f,
|
|
36
|
+
onOpenChange: m,
|
|
37
|
+
classNames: {
|
|
38
|
+
item: o.item,
|
|
39
|
+
itemIcon: o.itemIcon,
|
|
40
|
+
itemSuffix: o.itemSuffix,
|
|
41
|
+
group: o.group,
|
|
42
|
+
groupLabel: o.groupLabel,
|
|
43
|
+
divider: o.divider
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
String(r.key)
|
|
47
|
+
) : /* @__PURE__ */ u(
|
|
48
|
+
$,
|
|
49
|
+
{
|
|
50
|
+
item: r,
|
|
51
|
+
inCombobox: t,
|
|
52
|
+
selected: S?.includes(r.key),
|
|
29
53
|
afterSelect: () => {
|
|
30
|
-
|
|
54
|
+
f || m?.(!1);
|
|
31
55
|
},
|
|
32
|
-
itemRender:
|
|
56
|
+
itemRender: h,
|
|
33
57
|
showCheckbox: G,
|
|
34
|
-
getItemKeywords:
|
|
35
|
-
itemLabelRender:
|
|
58
|
+
getItemKeywords: n,
|
|
59
|
+
itemLabelRender: g,
|
|
36
60
|
classNames: {
|
|
37
61
|
item: o.item,
|
|
38
62
|
itemIcon: o.itemIcon,
|
|
39
63
|
itemSuffix: o.itemSuffix
|
|
40
64
|
}
|
|
41
65
|
},
|
|
42
|
-
r
|
|
43
|
-
) :
|
|
66
|
+
String(r.key)
|
|
67
|
+
) : r.type === "radio-group" ? /* @__PURE__ */ u(
|
|
44
68
|
j,
|
|
45
69
|
{
|
|
46
|
-
|
|
70
|
+
group: r,
|
|
71
|
+
itemRender: h,
|
|
72
|
+
itemLabelRender: g,
|
|
73
|
+
getItemKeywords: n,
|
|
74
|
+
keepOpenOnSelect: f,
|
|
75
|
+
onOpenChange: m,
|
|
76
|
+
classNames: {
|
|
77
|
+
item: o.item,
|
|
78
|
+
itemIcon: o.itemIcon,
|
|
79
|
+
itemText: void 0,
|
|
80
|
+
itemSuffix: o.itemSuffix
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
r.key != null ? String(r.key) : `radio-group-${i}-${e}`
|
|
84
|
+
) : r.type === "divider" ? /* @__PURE__ */ u(
|
|
85
|
+
L,
|
|
86
|
+
{
|
|
87
|
+
inCombobox: t,
|
|
47
88
|
className: o?.divider
|
|
48
89
|
},
|
|
49
|
-
|
|
90
|
+
`divider-${i}-${e}`
|
|
50
91
|
) : null,
|
|
51
92
|
[
|
|
52
93
|
o,
|
|
53
|
-
y,
|
|
54
|
-
g,
|
|
55
|
-
n,
|
|
56
|
-
a,
|
|
57
94
|
h,
|
|
95
|
+
m,
|
|
96
|
+
t,
|
|
97
|
+
f,
|
|
98
|
+
S,
|
|
58
99
|
G,
|
|
59
|
-
|
|
60
|
-
|
|
100
|
+
n,
|
|
101
|
+
g
|
|
61
102
|
]
|
|
62
|
-
),
|
|
63
|
-
(
|
|
64
|
-
|
|
103
|
+
), k = M(
|
|
104
|
+
(r, i) => /* @__PURE__ */ w(
|
|
105
|
+
b.Group,
|
|
65
106
|
{
|
|
66
|
-
className:
|
|
107
|
+
className: y(p("dropdown-menu-group"), o?.group),
|
|
67
108
|
children: [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
className: d(
|
|
72
|
-
l("dropdown-menu-header"),
|
|
73
|
-
o?.groupLabel
|
|
74
|
-
),
|
|
75
|
-
children: /* @__PURE__ */ i("span", { children: e.label })
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
e.items.map((t, u) => p(t, r, u))
|
|
109
|
+
r.label && /* @__PURE__ */ u(b.GroupLabel, { className: y(p("dropdown-menu-header"), o?.groupLabel), children: /* @__PURE__ */ u("span", { children: r.label }) }),
|
|
110
|
+
r.items.map((e, l) => d(e, i, l))
|
|
79
111
|
]
|
|
80
112
|
},
|
|
81
|
-
"group" +
|
|
113
|
+
"group" + i
|
|
82
114
|
),
|
|
83
|
-
[
|
|
84
|
-
),
|
|
85
|
-
(
|
|
86
|
-
|
|
115
|
+
[p, o, d]
|
|
116
|
+
), x = M(
|
|
117
|
+
(r, i) => r.label ? /* @__PURE__ */ w(
|
|
118
|
+
v.Group,
|
|
87
119
|
{
|
|
88
|
-
className:
|
|
89
|
-
items:
|
|
120
|
+
className: y(p("dropdown-menu-group"), o?.group),
|
|
121
|
+
items: r.items,
|
|
90
122
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
123
|
+
/* @__PURE__ */ u(
|
|
124
|
+
v.GroupLabel,
|
|
93
125
|
{
|
|
94
|
-
className:
|
|
95
|
-
|
|
96
|
-
o?.groupLabel
|
|
97
|
-
),
|
|
98
|
-
children: /* @__PURE__ */ i("span", { children: e.label })
|
|
126
|
+
className: y(p("dropdown-menu-header"), o?.groupLabel),
|
|
127
|
+
children: /* @__PURE__ */ u("span", { children: r.label })
|
|
99
128
|
}
|
|
100
129
|
),
|
|
101
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ u(v.Collection, { children: (e, l) => d(e, i, l) })
|
|
102
131
|
]
|
|
103
132
|
},
|
|
104
|
-
"group" +
|
|
105
|
-
) :
|
|
106
|
-
[
|
|
133
|
+
"group" + i
|
|
134
|
+
) : r.items.map((e, l) => d(e, i, l)),
|
|
135
|
+
[p, o, d]
|
|
107
136
|
);
|
|
108
137
|
return {
|
|
109
|
-
itemGroups:
|
|
110
|
-
() =>
|
|
138
|
+
itemGroups: I(
|
|
139
|
+
() => D.reduce((r, i) => (t && !q(i) || (r.length === 0 && i.type !== "header" && r.push({
|
|
111
140
|
label: null,
|
|
112
141
|
items: []
|
|
113
|
-
}),
|
|
114
|
-
label:
|
|
142
|
+
}), i.type === "header" ? r.push({
|
|
143
|
+
label: i.title,
|
|
115
144
|
items: []
|
|
116
|
-
}) : (
|
|
117
|
-
|
|
118
|
-
}), e), []),
|
|
119
|
-
[s]
|
|
145
|
+
}) : (i.type === "item" || i.type === "checkbox" || i.type === "radio-group" || i.type === "divider") && r.length > 0 && r[r.length - 1].items.push(i)), r), []),
|
|
146
|
+
[t, D]
|
|
120
147
|
),
|
|
121
|
-
renderMenuItem:
|
|
122
|
-
renderGroup:
|
|
148
|
+
renderMenuItem: d,
|
|
149
|
+
renderGroup: t ? x : k
|
|
123
150
|
};
|
|
124
151
|
};
|
|
125
152
|
export {
|
|
126
|
-
|
|
153
|
+
_ as useDropdownMenu
|
|
127
154
|
};
|
|
128
155
|
//# sourceMappingURL=useDropdownMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport { DropdownMenuItemType, DropdownMenuGroup } from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Combobox, Menu } from \"@base-ui/react\";\n\nimport \"./style.css\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for menu item labels\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const useDropdownMenu = ({\n items,\n inCombobox = false,\n classNames = {},\n selectedItemKeys,\n keepOpenOnSelect,\n showCheckbox = false,\n getItemKeywords = (item) => [String(item.key), reactNodeToString(item.label)],\n onOpenChange,\n itemRender,\n itemLabelRender,\n}: UseDropdownMenuProps) => {\n const cls = useCls();\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={inCombobox}\n selected={selectedItemKeys?.includes(item.key)}\n afterSelect={() => {\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }}\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n itemLabelRender={itemLabelRender}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={inCombobox}\n className={classNames?.divider}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n inCombobox,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupCombobox = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Combobox.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n items={group.items}\n >\n <Combobox.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Combobox.GroupLabel>\n <Combobox.Collection>\n {(item, i) => renderMenuItem(item, index, i)}\n </Combobox.Collection>\n </Combobox.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const itemGroups = useMemo(\n () =>\n items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push({\n ...current,\n });\n }\n // Skip dividers\n return acc;\n }, []),\n [items]\n );\n return {\n itemGroups,\n renderMenuItem,\n renderGroup: inCombobox ? renderGroupCombobox : renderGroup,\n };\n};\n"],"names":["useDropdownMenu","items","inCombobox","classNames","selectedItemKeys","keepOpenOnSelect","showCheckbox","getItemKeywords","item","reactNodeToString","onOpenChange","itemRender","itemLabelRender","cls","useCls","renderMenuItem","useCallback","i","j","jsx","DropdownMenuItem","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupCombobox","Combobox","useM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AAC;AAAA,IAE/D,CAACL,GAAKV,GAAYY,CAAc;AAAA,EAAA;AAmClC,SAAO;AAAA,IACL,YAjCiBe;AAAA,MACjB,MACE7B,EAAM,OAA4B,CAAC8B,GAAKC,OAElCD,EAAI,WAAW,KAAKC,EAAQ,SAAS,YACvCD,EAAI,KAAK;AAAA,QACP,OAAO;AAAA,QACP,OAAO,CAAA;AAAA,MAAC,CACT,GAICC,EAAQ,SAAS,WACnBD,EAAI,KAAK;AAAA,QACP,OAAOC,EAAQ;AAAA,QACf,OAAO,CAAA;AAAA,MAAC,CACT,KAIAA,EAAQ,SAAS,UAAUA,EAAQ,SAAS,cAC7CD,EAAI,SAAS,KAEbA,EAAIA,EAAI,SAAS,CAAC,EAAE,MAAM,KAAK;AAAA,QAC7B,GAAGC;AAAA,MAAA,CACJ,GAGID,IACN,CAAA,CAAE;AAAA,MACP,CAAC9B,CAAK;AAAA,IAAA;AAAA,IAIN,gBAAAc;AAAA,IACA,aAAab,IAAa0B,IAAsBN;AAAA,EAAA;AAEpD;"}
|
|
1
|
+
{"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport {\n DropdownMenuItemType,\n DropdownMenuGroup,\n DropdownMenuInteractiveItem,\n DropdownMenuActionItem,\n} from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { DropdownMenuSubmenu } from \"./submenu\";\nimport { DropdownMenuRadioGroup } from \"./radio-group\";\nimport { isDropdownMenuSearchSupportedItem } from \"./search-mode\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Combobox, Menu } from \"@base-ui/react\";\n\nimport \"./style.css\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuInteractiveItem,\n props: React.HTMLAttributes<HTMLElement>,\n ) => React.ReactElement;\n /**\n * Custom render function for menu item labels\n */\n itemLabelRender?: (\n item: DropdownMenuInteractiveItem,\n props: React.HTMLAttributes<HTMLElement>,\n ) => React.ReactElement;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuInteractiveItem) => string[];\n}\n\nexport const useDropdownMenu = ({\n items,\n inCombobox = false,\n classNames = {},\n selectedItemKeys,\n keepOpenOnSelect,\n showCheckbox = false,\n getItemKeywords = (item) => [String(item.key), reactNodeToString(item.label)],\n onOpenChange,\n itemRender,\n itemLabelRender,\n}: UseDropdownMenuProps) => {\n const cls = useCls();\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\" || item.type === \"checkbox\") {\n if (item.type === \"item\" && !inCombobox && item.children && item.children.length > 0) {\n return (\n <DropdownMenuSubmenu\n key={String(item.key)}\n item={item as DropdownMenuActionItem}\n itemRender={itemRender}\n itemLabelRender={itemLabelRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n selectedItemKeys={selectedItemKeys}\n keepOpenOnSelect={keepOpenOnSelect}\n onOpenChange={onOpenChange}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n group: classNames.group,\n groupLabel: classNames.groupLabel,\n divider: classNames.divider,\n }}\n />\n );\n }\n return (\n <DropdownMenuItem\n key={String(item.key)}\n item={item}\n inCombobox={inCombobox}\n selected={selectedItemKeys?.includes(item.key)}\n afterSelect={() => {\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }}\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n itemLabelRender={itemLabelRender}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"radio-group\") {\n return (\n <DropdownMenuRadioGroup\n key={item.key != null ? String(item.key) : `radio-group-${i}-${j}`}\n group={item}\n itemRender={itemRender}\n itemLabelRender={itemLabelRender}\n getItemKeywords={getItemKeywords}\n keepOpenOnSelect={keepOpenOnSelect}\n onOpenChange={onOpenChange}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemText: undefined,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={`divider-${i}-${j}`}\n inCombobox={inCombobox}\n className={classNames?.divider}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n inCombobox,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n ],\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel className={clsx(cls(\"dropdown-menu-header\"), classNames?.groupLabel)}>\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem],\n );\n\n const renderGroupCombobox = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Combobox.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n items={group.items}\n >\n <Combobox.GroupLabel\n className={clsx(cls(\"dropdown-menu-header\"), classNames?.groupLabel)}\n >\n <span>{group.label}</span>\n </Combobox.GroupLabel>\n <Combobox.Collection>{(item, i) => renderMenuItem(item, index, i)}</Combobox.Collection>\n </Combobox.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem],\n );\n\n const itemGroups = useMemo(\n () =>\n items.reduce<DropdownMenuGroup[]>((acc, current) => {\n if (inCombobox && !isDropdownMenuSearchSupportedItem(current)) {\n return acc;\n }\n\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" ||\n current.type === \"checkbox\" ||\n current.type === \"radio-group\" ||\n current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []),\n [inCombobox, items],\n );\n return {\n itemGroups,\n renderMenuItem,\n renderGroup: inCombobox ? renderGroupCombobox : renderGroup,\n };\n};\n"],"names":["useDropdownMenu","items","inCombobox","classNames","selectedItemKeys","keepOpenOnSelect","showCheckbox","getItemKeywords","item","reactNodeToString","onOpenChange","itemRender","itemLabelRender","cls","useCls","renderMenuItem","useCallback","j","jsx","DropdownMenuSubmenu","DropdownMenuItem","DropdownMenuRadioGroup","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupCombobox","Combobox","i","useMemo","acc","current","isDropdownMenuSearchSupportedItem"],"mappings":";;;;;;;;;;;;AAuEO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa,CAAA;AAAA,EACb,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,c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E;AAAA,MACP,CAAC/B,GAAYD,CAAK;AAAA,IAAA;AAAA,IAIlB,gBAAAc;AAAA,IACA,aAAab,IAAa2B,IAAsBN;AAAA,EAAA;AAEpD;"}
|
|
@@ -11,7 +11,7 @@ import { ReportMetaChange } from 'antd/es/form/context';
|
|
|
11
11
|
*
|
|
12
12
|
* Last synced with antd version: 5.x-stable (2025-02-04)
|
|
13
13
|
*/
|
|
14
|
-
import * as React from
|
|
14
|
+
import * as React from "react";
|
|
15
15
|
export interface ItemHolderProps extends FormItemProps {
|
|
16
16
|
prefixCls: string;
|
|
17
17
|
className?: string;
|
|
@@ -24,10 +24,11 @@ export interface ItemHolderProps extends FormItemProps {
|
|
|
24
24
|
fieldId?: string;
|
|
25
25
|
isRequired?: boolean;
|
|
26
26
|
onSubItemMetaChange: ReportMetaChange;
|
|
27
|
-
classNames?: FormItemProps[
|
|
28
|
-
optionalMark?: FormItemProps[
|
|
29
|
-
requiredMark?: FormItemProps[
|
|
30
|
-
labelRender?: FormItemProps[
|
|
27
|
+
classNames?: FormItemProps["classNames"];
|
|
28
|
+
optionalMark?: FormItemProps["optionalMark"];
|
|
29
|
+
requiredMark?: FormItemProps["requiredMark"];
|
|
30
|
+
labelRender?: FormItemProps["labelRender"];
|
|
31
|
+
ignoreDefaultRules?: string[];
|
|
31
32
|
}
|
|
32
33
|
export default function ItemHolder(props: ItemHolderProps): import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
//# sourceMappingURL=ItemHolder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemHolder.d.ts","sourceRoot":"","sources":["../../../../src/components/form/FormItem/ItemHolder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AASxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAEvC,OAA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AAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,gBAAgB,CAAC;IAGtC,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAE/B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,2CAwLxD"}
|
|
@@ -12,45 +12,46 @@ import re from "antd/es/form/FormItem/StatusProvider";
|
|
|
12
12
|
import te from "./FormItemInput.js";
|
|
13
13
|
import ae from "./FormItemLabel.js";
|
|
14
14
|
import { clsx as N } from "../../utils/cn.js";
|
|
15
|
-
function
|
|
15
|
+
function be(l) {
|
|
16
16
|
const {
|
|
17
17
|
prefixCls: i,
|
|
18
18
|
className: $,
|
|
19
19
|
rootClassName: x,
|
|
20
|
-
style:
|
|
20
|
+
style: R,
|
|
21
21
|
help: m,
|
|
22
22
|
errors: h,
|
|
23
23
|
warnings: v,
|
|
24
|
-
validateStatus:
|
|
24
|
+
validateStatus: F,
|
|
25
25
|
meta: r,
|
|
26
|
-
hasFeedback:
|
|
27
|
-
hidden:
|
|
28
|
-
children:
|
|
29
|
-
fieldId:
|
|
30
|
-
required:
|
|
31
|
-
isRequired:
|
|
26
|
+
hasFeedback: u,
|
|
27
|
+
hidden: I,
|
|
28
|
+
children: V,
|
|
29
|
+
fieldId: k,
|
|
30
|
+
required: q,
|
|
31
|
+
isRequired: M,
|
|
32
32
|
onSubItemMetaChange: P,
|
|
33
33
|
layout: E,
|
|
34
34
|
name: L,
|
|
35
35
|
// ============ BioTuring Custom: Extract classNames ============
|
|
36
36
|
classNames: n,
|
|
37
37
|
optionalMark: B,
|
|
38
|
-
requiredMark:
|
|
39
|
-
labelRender:
|
|
38
|
+
requiredMark: D,
|
|
39
|
+
labelRender: _,
|
|
40
|
+
ignoreDefaultRules: oe,
|
|
40
41
|
// ============ End Custom ============
|
|
41
|
-
...
|
|
42
|
-
} = l, e = `${i}-item`, { requiredMark:
|
|
42
|
+
...j
|
|
43
|
+
} = l, e = `${i}-item`, { requiredMark: H, layout: W } = p.useContext(Y), c = E || W, z = c === "vertical", o = p.useRef(null), d = C(h), g = C(v), b = m != null, S = !!(b || h.length || v.length), A = !!o.current && G(o.current), [f, w] = p.useState(null);
|
|
43
44
|
J(() => {
|
|
44
45
|
if (S && o.current) {
|
|
45
46
|
const a = getComputedStyle(o.current);
|
|
46
47
|
w(Number.parseInt(a.marginBottom, 10));
|
|
47
48
|
}
|
|
48
|
-
}, [S,
|
|
49
|
+
}, [S, A]);
|
|
49
50
|
const K = (a) => {
|
|
50
51
|
a || w(null);
|
|
51
52
|
}, t = ((a = !1) => {
|
|
52
53
|
const T = a ? d : r.errors, U = a ? g : r.warnings;
|
|
53
|
-
return ee(T, U, r, "", !!
|
|
54
|
+
return ee(T, U, r, "", !!u, F);
|
|
54
55
|
})(), O = N(
|
|
55
56
|
e,
|
|
56
57
|
$,
|
|
@@ -58,21 +59,21 @@ function ve(l) {
|
|
|
58
59
|
n?.root,
|
|
59
60
|
(b || d.length || g.length) && `${e}-with-help`,
|
|
60
61
|
// Status
|
|
61
|
-
t &&
|
|
62
|
+
t && u && `${e}-has-feedback`,
|
|
62
63
|
t === "success" && `${e}-has-success`,
|
|
63
64
|
t === "warning" && `${e}-has-warning`,
|
|
64
65
|
t === "error" && `${e}-has-error`,
|
|
65
66
|
t === "validating" && `${e}-is-validating`,
|
|
66
|
-
|
|
67
|
+
I && `${e}-hidden`,
|
|
67
68
|
// Layout
|
|
68
|
-
|
|
69
|
+
c && `${e}-${c}`
|
|
69
70
|
);
|
|
70
|
-
return /* @__PURE__ */ y("div", { className: O, style:
|
|
71
|
+
return /* @__PURE__ */ y("div", { className: O, style: R, ref: o, children: [
|
|
71
72
|
/* @__PURE__ */ y(
|
|
72
73
|
X,
|
|
73
74
|
{
|
|
74
75
|
className: N(`${e}-row`, n?.row),
|
|
75
|
-
...Q(
|
|
76
|
+
...Q(j, [
|
|
76
77
|
"_internalItemRender",
|
|
77
78
|
"colon",
|
|
78
79
|
"dependencies",
|
|
@@ -103,21 +104,23 @@ function ve(l) {
|
|
|
103
104
|
"validateTrigger",
|
|
104
105
|
"valuePropName",
|
|
105
106
|
"wrapperCol",
|
|
106
|
-
"validateDebounce"
|
|
107
|
+
"validateDebounce",
|
|
108
|
+
"ignoreDefaultRules",
|
|
109
|
+
"labelRender"
|
|
107
110
|
]),
|
|
108
111
|
children: [
|
|
109
112
|
/* @__PURE__ */ s(
|
|
110
113
|
ae,
|
|
111
114
|
{
|
|
112
|
-
htmlFor:
|
|
115
|
+
htmlFor: k,
|
|
113
116
|
...l,
|
|
114
|
-
requiredMark:
|
|
115
|
-
required:
|
|
117
|
+
requiredMark: D ?? H,
|
|
118
|
+
required: q ?? M,
|
|
116
119
|
prefixCls: i,
|
|
117
|
-
vertical:
|
|
120
|
+
vertical: z,
|
|
118
121
|
classNames: n,
|
|
119
122
|
optionalMark: B,
|
|
120
|
-
labelRender:
|
|
123
|
+
labelRender: _
|
|
121
124
|
}
|
|
122
125
|
),
|
|
123
126
|
/* @__PURE__ */ s(
|
|
@@ -140,10 +143,10 @@ function ve(l) {
|
|
|
140
143
|
meta: r,
|
|
141
144
|
errors: r.errors,
|
|
142
145
|
warnings: r.warnings,
|
|
143
|
-
hasFeedback:
|
|
146
|
+
hasFeedback: u,
|
|
144
147
|
validateStatus: t,
|
|
145
148
|
name: L,
|
|
146
|
-
children:
|
|
149
|
+
children: V
|
|
147
150
|
}
|
|
148
151
|
) })
|
|
149
152
|
}
|
|
@@ -163,6 +166,6 @@ function ve(l) {
|
|
|
163
166
|
] });
|
|
164
167
|
}
|
|
165
168
|
export {
|
|
166
|
-
|
|
169
|
+
be as default
|
|
167
170
|
};
|
|
168
171
|
//# sourceMappingURL=ItemHolder.js.map
|