antdv-next 1.8.1 → 1.8.3
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/_util/PurePanel.js +1 -1
- package/dist/_util/hooks/index.js +1 -1
- package/dist/_util/hooks/useClosable.d.ts +3 -3
- package/dist/_util/hooks/useClosable.js +9 -9
- package/dist/_util/hooks/useZIndex.js +14 -15
- package/dist/_util/vueNode.d.ts +6 -2
- package/dist/affix/index.js +27 -12
- package/dist/alert/Alert.d.ts +2 -2
- package/dist/alert/Alert.js +3 -3
- package/dist/alert/style/index.js +14 -8
- package/dist/anchor/Anchor.js +3 -1
- package/dist/antd-with-locales.esm.js +19634 -19203
- package/dist/antd-with-locales.js +112 -112
- package/dist/antd.css +1 -1
- package/dist/antd.esm.js +17697 -17268
- package/dist/antd.js +113 -113
- package/dist/app/App.js +2 -2
- package/dist/auto-complete/index.js +2 -2
- package/dist/avatar/Avatar.js +2 -2
- package/dist/avatar/AvatarGroup.js +1 -1
- package/dist/badge/Ribbon.js +1 -1
- package/dist/badge/index.d.ts +4 -1
- package/dist/badge/index.js +6 -6
- package/dist/border-beam/BorderBeam.js +1 -1
- package/dist/breadcrumb/Breadcrumb.js +2 -2
- package/dist/button/Button.js +1 -1
- package/dist/button/style/index.js +8 -2
- package/dist/calendar/generateCalendar.js +3 -3
- package/dist/card/Card.js +2 -2
- package/dist/card/CardGrid.js +1 -1
- package/dist/card/CardMeta.js +1 -1
- package/dist/card/style/index.js +2 -2
- package/dist/carousel/index.js +2 -2
- package/dist/cascader/Panel.js +1 -1
- package/dist/cascader/index.js +4 -4
- package/dist/checkbox/Checkbox.js +3 -2
- package/dist/checkbox/Group.js +1 -1
- package/dist/collapse/Collapse.js +2 -2
- package/dist/color-picker/ColorPicker.js +6 -2
- package/dist/color-picker/ColorPickerPanel.js +4 -0
- package/dist/color-picker/components/ColorSlider.js +12 -4
- package/dist/color-picker/components/PanelPicker/GradientColorBar.js +2 -0
- package/dist/components.d.ts +12 -8
- package/dist/components.js +3 -3
- package/dist/config-provider/context.d.ts +5 -3
- package/dist/config-provider/context.js +3 -3
- package/dist/config-provider/define.d.ts +5 -1
- package/dist/config-provider/index.js +38 -4
- package/dist/date-picker/generatePicker/generateRangePicker.js +3 -3
- package/dist/date-picker/generatePicker/generateSinglePicker.js +3 -3
- package/dist/date-picker/hooks/useMergedPickerSemantic.js +1 -1
- package/dist/date-picker/style/panel.js +3 -5
- package/dist/descriptions/hooks/useItems.d.ts +2 -2
- package/dist/descriptions/hooks/useRow.js +1 -1
- package/dist/descriptions/index.js +2 -2
- package/dist/divider/index.js +1 -1
- package/dist/drawer/DrawerPanel.js +1 -1
- package/dist/drawer/index.js +3 -3
- package/dist/dropdown/dropdown.js +3 -3
- package/dist/empty/index.js +2 -1
- package/dist/float-button/BackTop.js +2 -2
- package/dist/float-button/FloatButton.js +1 -1
- package/dist/float-button/FloatButtonGroup.js +2 -2
- package/dist/float-button/PurePanel.js +1 -1
- package/dist/form/ErrorList.js +1 -1
- package/dist/form/Form.d.ts +17 -44
- package/dist/form/Form.js +56 -7
- package/dist/form/FormItem/ItemHolder.js +3 -3
- package/dist/form/FormItem/index.d.ts +3 -3
- package/dist/form/FormItem/index.js +1 -1
- package/dist/form/FormItemLabel.js +1 -1
- package/dist/form/context.d.ts +3 -3
- package/dist/form/hooks/useForm.d.ts +4 -5
- package/dist/form/hooks/useVariant.js +1 -1
- package/dist/form/index.d.ts +29 -3
- package/dist/form/index.js +6 -6
- package/dist/form/types.d.ts +15 -7
- package/dist/grid/col.js +1 -1
- package/dist/grid/row.js +1 -1
- package/dist/image/PreviewGroup.js +2 -2
- package/dist/image/index.d.ts +5 -5
- package/dist/image/index.js +9 -5
- package/dist/index.d.ts +14 -7
- package/dist/index.js +2 -2
- package/dist/input/Group.js +2 -2
- package/dist/input/Input.js +2 -2
- package/dist/input/OTP/OTPInput.js +1 -1
- package/dist/input/OTP/index.js +2 -2
- package/dist/input/Password.js +1 -1
- package/dist/input/Search.js +2 -2
- package/dist/input/TextArea.js +2 -2
- package/dist/input-number/index.js +3 -3
- package/dist/input-number/style/index.js +3 -2
- package/dist/layout/Sider.js +2 -2
- package/dist/layout/layout.js +2 -3
- package/dist/listy/index.js +1 -1
- package/dist/locale/id_ID.js +8 -6
- package/dist/locale/uz_UZ.js +12 -12
- package/dist/masonry/Masonry.js +1 -1
- package/dist/mentions/index.js +5 -4
- package/dist/menu/MenuDivider.js +1 -1
- package/dist/menu/MenuItem.js +1 -1
- package/dist/menu/index.d.ts +2 -1
- package/dist/menu/index.js +29 -5
- package/dist/menu/menu.js +42 -18
- package/dist/message/PurePanel.js +2 -2
- package/dist/message/index.js +11 -9
- package/dist/message/useMessage.js +2 -2
- package/dist/modal/ConfirmDialog.js +2 -2
- package/dist/modal/Modal.js +4 -4
- package/dist/modal/PurePanel.js +1 -1
- package/dist/modal/confirm.js +6 -8
- package/dist/modal/index.d.ts +2 -2
- package/dist/modal/interface.d.ts +1 -1
- package/dist/modal/useModal/index.js +9 -4
- package/dist/notification/PurePanel.js +2 -2
- package/dist/notification/index.js +8 -13
- package/dist/notification/useNotification.js +2 -2
- package/dist/package.js +1 -1
- package/dist/package.json.d.ts +1 -0
- package/dist/pagination/Pagination.js +4 -4
- package/dist/popconfirm/index.js +2 -2
- package/dist/popover/PurePanel.js +2 -2
- package/dist/popover/index.js +1 -1
- package/dist/progress/progress.js +3 -3
- package/dist/qrcode/index.js +3 -3
- package/dist/radio/group.js +2 -2
- package/dist/radio/radio.js +2 -2
- package/dist/rate/index.js +2 -2
- package/dist/result/index.js +1 -1
- package/dist/segmented/index.js +1 -1
- package/dist/segmented/style/index.js +3 -2
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +5 -5
- package/dist/skeleton/Avatar.js +1 -1
- package/dist/skeleton/Button.js +1 -1
- package/dist/skeleton/Element.js +1 -1
- package/dist/skeleton/Input.js +1 -1
- package/dist/skeleton/Node.js +1 -1
- package/dist/skeleton/Skeleton.js +1 -1
- package/dist/skeleton/style/index.js +9 -13
- package/dist/slider/SliderTooltip.js +0 -1
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +5 -1
- package/dist/space/Addon.js +1 -1
- package/dist/space/index.js +1 -1
- package/dist/spin/index.js +2 -2
- package/dist/splitter/Splitter.js +2 -2
- package/dist/statistic/Statistic.js +1 -1
- package/dist/statistic/Timer.d.ts +2 -2
- package/dist/statistic/Timer.js +1 -1
- package/dist/steps/index.js +5 -4
- package/dist/switch/index.js +2 -2
- package/dist/table/InternalTable.js +10 -4
- package/dist/table/hooks/useFilter/FilterDropdown.js +2 -2
- package/dist/table/hooks/usePagination.d.ts +1 -2
- package/dist/table/hooks/usePagination.js +1 -3
- package/dist/table/hooks/useSelection.js +1 -1
- package/dist/table/hooks/useSorter.js +26 -19
- package/dist/table/style/index.js +1 -0
- package/dist/table/style/size.js +1 -0
- package/dist/table/util.d.ts +1 -1
- package/dist/tabs/index.js +3 -3
- package/dist/tabs/style/index.js +5 -1
- package/dist/tag/CheckableTag.js +1 -1
- package/dist/tag/CheckableTagGroup.d.ts +0 -1
- package/dist/tag/CheckableTagGroup.js +0 -4
- package/dist/tag/hooks/useColor.d.ts +1 -1
- package/dist/tag/index.js +1 -1
- package/dist/theme/themes/dark/index.js +1 -1
- package/dist/theme/useToken.js +2 -2
- package/dist/timeline/Timeline.js +1 -1
- package/dist/timeline/useItems.js +1 -1
- package/dist/tooltip/PurePanel.js +1 -1
- package/dist/tooltip/index.js +2 -2
- package/dist/tour/index.js +5 -2
- package/dist/transfer/Section.js +1 -1
- package/dist/transfer/Transfer.js +3 -3
- package/dist/transfer/hooks/useSelection.js +2 -1
- package/dist/tree/DirectoryTree.js +6 -5
- package/dist/tree/Tree.js +4 -4
- package/dist/tree/utils/dictUtil.js +5 -8
- package/dist/tree-select/index.js +4 -4
- package/dist/typography/Base/index.js +5 -3
- package/dist/typography/Base/util.js +2 -1
- package/dist/typography/Editable.js +6 -2
- package/dist/typography/Typography.js +1 -1
- package/dist/upload/Upload.js +25 -16
- package/dist/upload/UploadList/ListItem.js +5 -1
- package/dist/upload/UploadList/index.js +19 -12
- package/dist/version/token.json +1 -1
- package/dist/watermark/index.d.ts +13 -4
- package/dist/watermark/index.js +11 -7
- package/dist/watermark/useRafDebounce.js +1 -2
- package/dist/watermark/utils.js +1 -1
- package/package.json +42 -41
- package/web-tags.json +22 -14
- package/web-types.json +46 -23
|
@@ -34,7 +34,7 @@ function useBaseConfig(suffixCls, props) {
|
|
|
34
34
|
getPrefixCls: (suffixCls, prefixCls) => config.value?.getPrefixCls(suffixCls, prefixCls),
|
|
35
35
|
prefixCls: toRef(() => config.value?.getPrefixCls(suffixCls, props?.prefixCls)),
|
|
36
36
|
direction: toRef(() => config.value?.direction),
|
|
37
|
-
getPopupContainer: config?.
|
|
37
|
+
getPopupContainer: ((...args) => config.value?.getPopupContainer?.(...args))
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -83,9 +83,9 @@ function useComponentBaseConfig(propName, props, keys, suffixCls) {
|
|
|
83
83
|
direction: toRef(() => context.value.direction),
|
|
84
84
|
prefixCls: toRef(() => context.value?.getPrefixCls(suffixCls ?? propName, props?.prefixCls)),
|
|
85
85
|
rootPrefixCls: toRef(() => context.value?.getPrefixCls()),
|
|
86
|
-
getPopupContainer: context.value
|
|
86
|
+
getPopupContainer: ((...args) => context.value?.getPopupContainer?.(...args)),
|
|
87
87
|
getPrefixCls: context.value.getPrefixCls,
|
|
88
|
-
getTargetContainer: context.value
|
|
88
|
+
getTargetContainer: (() => context.value?.getTargetContainer?.()),
|
|
89
89
|
virtual: toRef(() => context.value.virtual),
|
|
90
90
|
renderEmpty: toRef(() => context.value.renderEmpty),
|
|
91
91
|
popupMatchSelectWidth: toRef(() => context.value.popupMatchSelectWidth),
|
|
@@ -4,7 +4,7 @@ import { ColumnType } from "../table/interface.js";
|
|
|
4
4
|
import "../table/index.js";
|
|
5
5
|
import { Locale } from "../locale/index.js";
|
|
6
6
|
import { RenderEmptyHandler } from "./defaultRenderEmpty.js";
|
|
7
|
-
import { AlertConfig, AnchorStyleConfig, AutoCompleteConfig, BadgeConfig, BreadcrumbConfig, ButtonConfig, CSPConfig, CalendarConfig, CardConfig, CardMetaConfig, CascaderConfig, CheckboxConfig, CollapseConfig, ColorPickerConfig, ComponentStyleConfig, DatePickerConfig, DescriptionsConfig, DirectionType, DividerConfig, DrawerConfig, DropdownConfig, EmptyConfig, FlexConfig, FloatButtonConfig, FloatButtonGroupConfig, FormConfig, ImageConfig, InputConfig, InputNumberConfig, InputPasswordConfig, InputSearchConfig, ListyConfig, MasonryConfig, MentionsConfig, MenuConfig, ModalConfig, NotificationConfig, OTPConfig, PaginationConfig, PopconfirmConfig, PopoverConfig, PopupOverflow, ProgressConfig, RadioConfig, RangePickerConfig, ResultConfig, RibbonConfig, SegmentedConfig, SelectConfig, SkeletonConfig, SliderConfig, SpaceConfig, SpinConfig, SplitterConfig, StatisticConfig, StepsConfig, SwitchStyleConfig, TableConfig, TabsConfig, TagConfig, TextAreaConfig, ThemeConfig, TimePickerConfig, TimelineConfig, TooltipConfig, TourConfig, TransferConfig, TreeConfig, TreeSelectConfig, TypographyConfig, UploadConfig, Variant, WaveConfig } from "./context.js";
|
|
7
|
+
import { AlertConfig, AnchorStyleConfig, AutoCompleteConfig, BadgeConfig, BreadcrumbConfig, ButtonConfig, CSPConfig, CalendarConfig, CardConfig, CardMetaConfig, CascaderConfig, CheckboxConfig, CollapseConfig, ColorPickerConfig, ComponentStyleConfig, DatePickerConfig, DescriptionsConfig, DirectionType, DividerConfig, DrawerConfig, DropdownConfig, EmptyConfig, FlexConfig, FloatButtonConfig, FloatButtonGroupConfig, FormConfig, ImageConfig, InputConfig, InputNumberConfig, InputPasswordConfig, InputSearchConfig, ListyConfig, MasonryConfig, MentionsConfig, MenuConfig, ModalConfig, NotificationConfig, OTPConfig, PaginationConfig, PopconfirmConfig, PopoverConfig, PopupOverflow, ProgressConfig, QRcodeConfig, RadioConfig, RangePickerConfig, ResultConfig, RibbonConfig, SegmentedConfig, SelectConfig, SkeletonConfig, SliderConfig, SpaceConfig, SpinConfig, SplitterConfig, StatisticConfig, StepsConfig, SwitchStyleConfig, TableConfig, TabsConfig, TagConfig, TextAreaConfig, ThemeConfig, TimePickerConfig, TimelineConfig, TooltipConfig, TourConfig, TransferConfig, TreeConfig, TreeSelectConfig, TypographyConfig, UploadConfig, Variant, WaveConfig } from "./context.js";
|
|
8
8
|
//#region src/config-provider/define.d.ts
|
|
9
9
|
interface ConfigProviderProps {
|
|
10
10
|
getTargetContainer?: () => HTMLElement | Window;
|
|
@@ -57,7 +57,9 @@ interface ConfigProviderProps {
|
|
|
57
57
|
theme?: ThemeConfig;
|
|
58
58
|
warning?: WarningContextProps;
|
|
59
59
|
alert?: AlertConfig;
|
|
60
|
+
affix?: ComponentStyleConfig;
|
|
60
61
|
app?: ComponentStyleConfig;
|
|
62
|
+
borderBeam?: ComponentStyleConfig;
|
|
61
63
|
anchor?: AnchorStyleConfig;
|
|
62
64
|
button?: ButtonConfig;
|
|
63
65
|
calendar?: CalendarConfig;
|
|
@@ -88,6 +90,7 @@ interface ConfigProviderProps {
|
|
|
88
90
|
descriptions?: DescriptionsConfig;
|
|
89
91
|
empty?: EmptyConfig;
|
|
90
92
|
badge?: BadgeConfig;
|
|
93
|
+
qrcode?: QRcodeConfig;
|
|
91
94
|
radio?: RadioConfig;
|
|
92
95
|
rate?: ComponentStyleConfig;
|
|
93
96
|
ribbon?: RibbonConfig;
|
|
@@ -116,6 +119,7 @@ interface ConfigProviderProps {
|
|
|
116
119
|
tooltip?: TooltipConfig;
|
|
117
120
|
popover?: PopoverConfig;
|
|
118
121
|
popconfirm?: PopconfirmConfig;
|
|
122
|
+
watermark?: ComponentStyleConfig;
|
|
119
123
|
}
|
|
120
124
|
interface ConfigProviderSlots {
|
|
121
125
|
renderEmpty?: (componentName?: string) => any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ANT_MARK, LocaleProvider, useLocaleContext } from "../locale/index.js";
|
|
1
|
+
import { useConfig, useConfigProvider } from "./context.js";
|
|
3
2
|
import seedToken from "../theme/themes/seed.js";
|
|
4
3
|
import defaultTheme from "../theme/themes/default/theme.js";
|
|
5
4
|
import { DesignTokenProvider } from "../theme/context.js";
|
|
6
|
-
import { useConfig, useConfigProvider } from "./context.js";
|
|
7
|
-
import { SizeProvider } from "./SizeContext.js";
|
|
8
5
|
import useResetIconStyle from "../theme/util/useResetIconStyle.js";
|
|
6
|
+
import { useWarningProvider } from "../_util/warning.js";
|
|
7
|
+
import { ANT_MARK, LocaleProvider, useLocaleContext } from "../locale/index.js";
|
|
8
|
+
import { SizeProvider } from "./SizeContext.js";
|
|
9
9
|
import UniqueProvider from "../tooltip/UniqueProvider/index.js";
|
|
10
10
|
import { DisabledContextProvider } from "./DisabledContext.js";
|
|
11
11
|
import { useExportConfig } from "./hooks/useConfig.js";
|
|
@@ -33,6 +33,7 @@ const PASSED_PROPS = [
|
|
|
33
33
|
"treeSelect",
|
|
34
34
|
"button",
|
|
35
35
|
"alert",
|
|
36
|
+
"affix",
|
|
36
37
|
"app",
|
|
37
38
|
"cascader",
|
|
38
39
|
"borderBeam",
|
|
@@ -164,6 +165,7 @@ const ProviderChildren = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
164
165
|
carousel: props.carousel,
|
|
165
166
|
cardMeta: props.cardMeta,
|
|
166
167
|
ribbon: props.ribbon,
|
|
168
|
+
watermark: props.watermark,
|
|
167
169
|
warning: props.warning
|
|
168
170
|
};
|
|
169
171
|
const config = { ...parentConfig };
|
|
@@ -395,10 +397,18 @@ const ProviderChildren = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
395
397
|
type: Object,
|
|
396
398
|
required: false
|
|
397
399
|
},
|
|
400
|
+
affix: {
|
|
401
|
+
type: Object,
|
|
402
|
+
required: false
|
|
403
|
+
},
|
|
398
404
|
app: {
|
|
399
405
|
type: Object,
|
|
400
406
|
required: false
|
|
401
407
|
},
|
|
408
|
+
borderBeam: {
|
|
409
|
+
type: Object,
|
|
410
|
+
required: false
|
|
411
|
+
},
|
|
402
412
|
anchor: {
|
|
403
413
|
type: Object,
|
|
404
414
|
required: false
|
|
@@ -519,6 +529,10 @@ const ProviderChildren = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
519
529
|
type: Object,
|
|
520
530
|
required: false
|
|
521
531
|
},
|
|
532
|
+
qrcode: {
|
|
533
|
+
type: Object,
|
|
534
|
+
required: false
|
|
535
|
+
},
|
|
522
536
|
radio: {
|
|
523
537
|
type: Object,
|
|
524
538
|
required: false
|
|
@@ -630,6 +644,10 @@ const ProviderChildren = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
630
644
|
popconfirm: {
|
|
631
645
|
type: Object,
|
|
632
646
|
required: false
|
|
647
|
+
},
|
|
648
|
+
watermark: {
|
|
649
|
+
type: Object,
|
|
650
|
+
required: false
|
|
633
651
|
}
|
|
634
652
|
}, providerDefaultProps),
|
|
635
653
|
inheritAttrs: false
|
|
@@ -775,10 +793,18 @@ const ConfigProvider = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
775
793
|
type: Object,
|
|
776
794
|
required: false
|
|
777
795
|
},
|
|
796
|
+
affix: {
|
|
797
|
+
type: Object,
|
|
798
|
+
required: false
|
|
799
|
+
},
|
|
778
800
|
app: {
|
|
779
801
|
type: Object,
|
|
780
802
|
required: false
|
|
781
803
|
},
|
|
804
|
+
borderBeam: {
|
|
805
|
+
type: Object,
|
|
806
|
+
required: false
|
|
807
|
+
},
|
|
782
808
|
anchor: {
|
|
783
809
|
type: Object,
|
|
784
810
|
required: false
|
|
@@ -899,6 +925,10 @@ const ConfigProvider = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
899
925
|
type: Object,
|
|
900
926
|
required: false
|
|
901
927
|
},
|
|
928
|
+
qrcode: {
|
|
929
|
+
type: Object,
|
|
930
|
+
required: false
|
|
931
|
+
},
|
|
902
932
|
radio: {
|
|
903
933
|
type: Object,
|
|
904
934
|
required: false
|
|
@@ -1010,6 +1040,10 @@ const ConfigProvider = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
1010
1040
|
popconfirm: {
|
|
1011
1041
|
type: Object,
|
|
1012
1042
|
required: false
|
|
1043
|
+
},
|
|
1044
|
+
watermark: {
|
|
1045
|
+
type: Object,
|
|
1046
|
+
required: false
|
|
1013
1047
|
}
|
|
1014
1048
|
}, providerDefaultProps),
|
|
1015
1049
|
name: "AConfigProvider",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../../config-provider/context.js";
|
|
1
3
|
import { devUseWarning, isDev } from "../../_util/warning.js";
|
|
4
|
+
import { useZIndex } from "../../_util/hooks/useZIndex.js";
|
|
2
5
|
import { useFormItemInputContext } from "../../form/context.js";
|
|
3
|
-
import { useComponentBaseConfig } from "../../config-provider/context.js";
|
|
4
6
|
import { useSize } from "../../config-provider/hooks/useSize.js";
|
|
5
7
|
import { useCompactItemContext } from "../../space/Compact.js";
|
|
6
8
|
import { ContextIsolator } from "../../_util/ContextIsolator.js";
|
|
7
|
-
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
8
|
-
import { useZIndex } from "../../_util/hooks/useZIndex.js";
|
|
9
9
|
import fallbackProp from "../../_util/fallbackProp.js";
|
|
10
10
|
import { getSlotPropsFnRun, toPropsRefs } from "../../_util/tools.js";
|
|
11
11
|
import useCSSVarCls from "../../config-provider/hooks/useCSSVarCls.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../../config-provider/context.js";
|
|
1
3
|
import { devUseWarning, isDev } from "../../_util/warning.js";
|
|
4
|
+
import { useZIndex } from "../../_util/hooks/useZIndex.js";
|
|
2
5
|
import { useFormItemInputContext } from "../../form/context.js";
|
|
3
|
-
import { useComponentBaseConfig } from "../../config-provider/context.js";
|
|
4
6
|
import { useSize } from "../../config-provider/hooks/useSize.js";
|
|
5
7
|
import { useCompactItemContext } from "../../space/Compact.js";
|
|
6
8
|
import { ContextIsolator } from "../../_util/ContextIsolator.js";
|
|
7
|
-
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
8
|
-
import { useZIndex } from "../../_util/hooks/useZIndex.js";
|
|
9
9
|
import fallbackProp from "../../_util/fallbackProp.js";
|
|
10
10
|
import { getSlotPropsFnRun, toPropsRefs } from "../../_util/tools.js";
|
|
11
11
|
import useCSSVarCls from "../../config-provider/hooks/useCSSVarCls.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useComponentConfig } from "../../config-provider/context.js";
|
|
2
1
|
import { useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentConfig } from "../../config-provider/context.js";
|
|
3
3
|
import { computed, unref } from "vue";
|
|
4
4
|
import { clsx } from "@v-c/util";
|
|
5
5
|
//#region src/date-picker/hooks/useMergedPickerSemantic.ts
|
|
@@ -283,7 +283,7 @@ const genPanelStyle = (token) => {
|
|
|
283
283
|
margin: `${unit(paddingXXS)} 0`,
|
|
284
284
|
padding: 0,
|
|
285
285
|
overflowY: "auto",
|
|
286
|
-
textAlign: "
|
|
286
|
+
textAlign: "center",
|
|
287
287
|
listStyle: "none",
|
|
288
288
|
transition: `background-color ${motionDurationMid}`,
|
|
289
289
|
overflowX: "hidden",
|
|
@@ -313,12 +313,10 @@ const genPanelStyle = (token) => {
|
|
|
313
313
|
marginInline: marginXXS,
|
|
314
314
|
[`${componentCls}-time-panel-cell-inner`]: {
|
|
315
315
|
display: "block",
|
|
316
|
-
width:
|
|
316
|
+
width: "auto",
|
|
317
317
|
height: timeCellHeight,
|
|
318
318
|
margin: 0,
|
|
319
|
-
|
|
320
|
-
paddingInlineEnd: 0,
|
|
321
|
-
paddingInlineStart: token.calc(timeColumnWidth).sub(timeCellHeight).div(2).equal(),
|
|
319
|
+
padding: 0,
|
|
322
320
|
color: colorText,
|
|
323
321
|
lineHeight: unit(timeCellHeight),
|
|
324
322
|
borderRadius: borderRadiusSM,
|
|
@@ -11,8 +11,8 @@ declare function useItems(screens: Ref<ScreenMap>, items: Ref<DescriptionsItemTy
|
|
|
11
11
|
label?: VueNode;
|
|
12
12
|
style?: import("vue").CSSProperties | undefined;
|
|
13
13
|
class?: string | undefined;
|
|
14
|
-
classes?: CellSemanticClassNames | undefined;
|
|
15
14
|
styles?: CellSemanticStyles | undefined;
|
|
15
|
+
classes?: CellSemanticClassNames | undefined;
|
|
16
16
|
rootClass?: string | undefined;
|
|
17
17
|
content?: VueNode;
|
|
18
18
|
} | {
|
|
@@ -21,8 +21,8 @@ declare function useItems(screens: Ref<ScreenMap>, items: Ref<DescriptionsItemTy
|
|
|
21
21
|
label?: VueNode;
|
|
22
22
|
style?: import("vue").CSSProperties | undefined;
|
|
23
23
|
class?: string | undefined;
|
|
24
|
-
classes?: CellSemanticClassNames | undefined;
|
|
25
24
|
styles?: CellSemanticStyles | undefined;
|
|
25
|
+
classes?: CellSemanticClassNames | undefined;
|
|
26
26
|
rootClass?: string | undefined;
|
|
27
27
|
content?: VueNode;
|
|
28
28
|
_$index: number;
|
|
@@ -6,7 +6,7 @@ function getCalcRows(rowItems, mergedColumn) {
|
|
|
6
6
|
let tmpRow = [];
|
|
7
7
|
let exceed = false;
|
|
8
8
|
let count = 0;
|
|
9
|
-
rowItems.
|
|
9
|
+
rowItems.forEach((rowItem) => {
|
|
10
10
|
const { filled, ...restItem } = rowItem;
|
|
11
11
|
if (filled) {
|
|
12
12
|
tmpRow.push(restItem);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
2
|
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
|
+
import { devUseWarning, isDev } from "../_util/warning.js";
|
|
3
4
|
import { useSize } from "../config-provider/hooks/useSize.js";
|
|
4
|
-
import { useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
5
5
|
import { getSlotPropsFnRun, toPropsRefs } from "../_util/tools.js";
|
|
6
6
|
import { isRenderable } from "../_util/is.js";
|
|
7
7
|
import { resolveSlotsNode } from "../_util/vnode/index.js";
|
package/dist/divider/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { pureAttrs, useMergeSemantic, useSemanticRootStyle, useToArr } from "../_util/hooks/useMergeSemantic.js";
|
|
1
2
|
import { useOrientation } from "../_util/hooks/useOrientation.js";
|
|
2
3
|
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
4
|
import { useSize } from "../config-provider/hooks/useSize.js";
|
|
4
|
-
import { pureAttrs, useMergeSemantic, useSemanticRootStyle, useToArr } from "../_util/hooks/useMergeSemantic.js";
|
|
5
5
|
import { toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
6
6
|
import useVariant from "../form/hooks/useVariant.js";
|
|
7
7
|
import style_default from "./style/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
2
1
|
import { useMergeSemantic, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
3
|
import { getSlotPropsFnRun, toPropsRefs } from "../_util/tools.js";
|
|
4
4
|
import { isRenderable } from "../_util/is.js";
|
|
5
5
|
import { cloneElement } from "../_util/vueNode.js";
|
package/dist/drawer/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { devUseWarning, isDev } from "../_util/warning.js";
|
|
2
|
-
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
|
-
import { ContextIsolator } from "../_util/ContextIsolator.js";
|
|
4
1
|
import { useMergedMask } from "../_util/hooks/useMergedMask.js";
|
|
5
2
|
import { getAttrStyleAndClass, useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
3
|
+
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
4
|
+
import { devUseWarning, isDev } from "../_util/warning.js";
|
|
6
5
|
import { ZIndexProvider } from "../_util/zindexContext.js";
|
|
7
6
|
import { useZIndex } from "../_util/hooks/useZIndex.js";
|
|
7
|
+
import { ContextIsolator } from "../_util/ContextIsolator.js";
|
|
8
8
|
import { getSlotPropsFnRun, toPropsRefs } from "../_util/tools.js";
|
|
9
9
|
import { isRenderable } from "../_util/is.js";
|
|
10
10
|
import useFocusable from "./useFocusable.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
2
|
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
3
|
import useToken from "../theme/useToken.js";
|
|
4
|
-
import {
|
|
4
|
+
import { devUseWarning } from "../_util/warning.js";
|
|
5
5
|
import { ZIndexProvider } from "../_util/zindexContext.js";
|
|
6
6
|
import { useZIndex } from "../_util/hooks/useZIndex.js";
|
|
7
7
|
import getPlacements from "../_util/placements.js";
|
|
@@ -14,8 +14,8 @@ import style_default from "./style/index.js";
|
|
|
14
14
|
import { computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
|
|
15
15
|
import { clsx } from "@v-c/util";
|
|
16
16
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
17
|
-
import { LeftOutlined, RightOutlined } from "@antdv-next/icons";
|
|
18
17
|
import { omit as omit$1 } from "es-toolkit";
|
|
18
|
+
import { LeftOutlined, RightOutlined } from "@antdv-next/icons";
|
|
19
19
|
import VcDropdown from "@v-c/dropdown";
|
|
20
20
|
//#region src/dropdown/dropdown.tsx
|
|
21
21
|
function _isSlot(s) {
|
package/dist/empty/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useComponentBaseConfig, useComponentConfig } from "../config-provider/context.js";
|
|
2
1
|
import { pureAttrs, useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig, useComponentConfig } from "../config-provider/context.js";
|
|
3
3
|
import { getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
4
4
|
import { isRenderable } from "../_util/is.js";
|
|
5
5
|
import useLocale from "../locale/useLocale.js";
|
|
@@ -103,6 +103,7 @@ const Empty = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose })
|
|
|
103
103
|
image: void 0,
|
|
104
104
|
description: void 0
|
|
105
105
|
}),
|
|
106
|
+
inheritAttrs: false,
|
|
106
107
|
name: "AEmpty"
|
|
107
108
|
});
|
|
108
109
|
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getAttrStyleAndClass, pureAttrs } from "../_util/hooks/useMergeSemantic.js";
|
|
1
2
|
import { useComponentBaseConfig, useConfig } from "../config-provider/context.js";
|
|
2
3
|
import { genCssVar } from "../theme/util/genStyleUtils.js";
|
|
3
|
-
import { getAttrStyleAndClass, pureAttrs } from "../_util/hooks/useMergeSemantic.js";
|
|
4
4
|
import { toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
5
5
|
import scrollTo from "../_util/scrollTo.js";
|
|
6
6
|
import { cloneIfVNode } from "../_util/vueNode.js";
|
|
@@ -9,9 +9,9 @@ import FloatButton, { floatButtonPrefixCls } from "./FloatButton.js";
|
|
|
9
9
|
import useScroll from "./hooks/useScroll.js";
|
|
10
10
|
import { Transition, computed, createVNode, defineComponent, mergeProps, shallowRef } from "vue";
|
|
11
11
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
12
|
+
import { omit } from "es-toolkit";
|
|
12
13
|
import { VerticalAlignTopOutlined } from "@antdv-next/icons";
|
|
13
14
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
14
|
-
import { omit } from "es-toolkit";
|
|
15
15
|
//#region src/float-button/BackTop.tsx
|
|
16
16
|
/** @deprecated Please use `ComponentProps<typeof FloatButton.BackTop>` instead. */
|
|
17
17
|
const defaultIcon = createVNode(VerticalAlignTopOutlined, null, null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
2
1
|
import { pureAttrs, useMergeSemantic, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
3
|
import { useZIndex } from "../_util/hooks/useZIndex.js";
|
|
4
4
|
import { getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
5
5
|
import useCSSVarCls from "../config-provider/hooks/useCSSVarCls.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
2
1
|
import { pureAttrs, useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
3
3
|
import { useZIndex } from "../_util/hooks/useZIndex.js";
|
|
4
4
|
import { getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
5
5
|
import useCSSVarCls from "../config-provider/hooks/useCSSVarCls.js";
|
|
@@ -12,9 +12,9 @@ import FloatButton, { floatButtonPrefixCls } from "./FloatButton.js";
|
|
|
12
12
|
import { Transition, computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, nextTick, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
13
13
|
import { classNames } from "@v-c/util";
|
|
14
14
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
15
|
+
import { omit as omit$1 } from "es-toolkit";
|
|
15
16
|
import { CloseOutlined, FileTextOutlined } from "@antdv-next/icons";
|
|
16
17
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
17
|
-
import { omit as omit$1 } from "es-toolkit";
|
|
18
18
|
//#region src/float-button/FloatButtonGroup.tsx
|
|
19
19
|
function _isSlot(s) {
|
|
20
20
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useConfig } from "../config-provider/context.js";
|
|
2
1
|
import { pureAttrs } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useConfig } from "../config-provider/context.js";
|
|
3
3
|
import FloatButton, { floatButtonPrefixCls } from "./FloatButton.js";
|
|
4
4
|
import BackTopWithInstall from "./BackTop.js";
|
|
5
5
|
import FloatButtonGroup from "./FloatButtonGroup.js";
|
package/dist/form/ErrorList.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFormItemPrefixContext } from "./context.js";
|
|
2
1
|
import { getAttrStyleAndClass } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useFormItemPrefixContext } from "./context.js";
|
|
3
3
|
import { getSlotPropsFnRun } from "../_util/tools.js";
|
|
4
4
|
import useCSSVarCls from "../config-provider/hooks/useCSSVarCls.js";
|
|
5
5
|
import initCollapseMotion from "../_util/motion.js";
|
package/dist/form/Form.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ColProps } from "../grid/col.js";
|
|
|
5
5
|
import "../grid/index.js";
|
|
6
6
|
import { FormLabelAlign, ScrollFocusOptions } from "./interface.js";
|
|
7
7
|
import { FormTooltipProps } from "./FormItemLabel.js";
|
|
8
|
-
import { FieldData,
|
|
8
|
+
import { FieldData, FormInstance, FormValues, InternalNamePath, RulesMap, ValidateErrorEntity, ValidateMessages } from "./types.js";
|
|
9
9
|
import { FeedbackIcons } from "./FormItem/index.js";
|
|
10
10
|
import { ComponentBaseProps, Variant } from "../config-provider/context.js";
|
|
11
11
|
import { CSSProperties, HTMLAttributes, SlotsType } from "vue";
|
|
@@ -34,7 +34,7 @@ interface FormSemanticStyles {
|
|
|
34
34
|
}
|
|
35
35
|
type FormClassNamesType = SemanticClassNamesType<FormProps, FormSemanticClassNames>;
|
|
36
36
|
type FormStylesType = SemanticStylesType<FormProps, FormSemanticStyles>;
|
|
37
|
-
interface FormProps extends ComponentBaseProps, FormEmitsProps {
|
|
37
|
+
interface FormProps<Values = Record<string, any>> extends ComponentBaseProps, FormEmitsProps<Values> {
|
|
38
38
|
classes?: FormClassNamesType;
|
|
39
39
|
styles?: FormStylesType;
|
|
40
40
|
colon?: boolean;
|
|
@@ -51,7 +51,7 @@ interface FormProps extends ComponentBaseProps, FormEmitsProps {
|
|
|
51
51
|
requiredMark?: RequiredMark;
|
|
52
52
|
variant?: Variant;
|
|
53
53
|
validateMessages?: ValidateMessages;
|
|
54
|
-
model?:
|
|
54
|
+
model?: Values;
|
|
55
55
|
rules?: RulesMap;
|
|
56
56
|
validateTrigger?: string | string[] | false;
|
|
57
57
|
preserve?: boolean;
|
|
@@ -61,54 +61,27 @@ interface FormProps extends ComponentBaseProps, FormEmitsProps {
|
|
|
61
61
|
autocomplete?: string | undefined;
|
|
62
62
|
tooltip?: FormTooltipProps;
|
|
63
63
|
}
|
|
64
|
-
interface FormEmits {
|
|
65
|
-
finish: (values:
|
|
66
|
-
finishFailed: (errorInfo: ValidateErrorEntity) => void;
|
|
64
|
+
interface FormEmits<Values = any> {
|
|
65
|
+
finish: (values: FormValues<Values>) => void;
|
|
66
|
+
finishFailed: (errorInfo: ValidateErrorEntity<FormValues<Values>>) => void;
|
|
67
67
|
submit: (e: Event) => void;
|
|
68
68
|
reset: (e: Event) => void;
|
|
69
69
|
validate: (name: InternalNamePath, status: boolean, errors: any[] | null) => void;
|
|
70
|
-
valuesChange: (changedValues: Record<string, any>, values:
|
|
70
|
+
valuesChange: (changedValues: Record<string, any>, values: FormValues<Values>) => void;
|
|
71
71
|
fieldsChange: (changedFields: FieldData[], allFields: FieldData[]) => void;
|
|
72
72
|
}
|
|
73
|
-
interface FormEmitsProps {
|
|
74
|
-
onFinish?: FormEmits['finish'];
|
|
75
|
-
onFinishFailed?: FormEmits['finishFailed'];
|
|
76
|
-
onSubmit?: FormEmits['submit'];
|
|
77
|
-
onReset?: FormEmits['reset'];
|
|
78
|
-
onValidate?: FormEmits['validate'];
|
|
79
|
-
onValuesChange?: FormEmits['valuesChange'];
|
|
80
|
-
onFieldsChange?: FormEmits['fieldsChange'];
|
|
73
|
+
interface FormEmitsProps<Values = any> {
|
|
74
|
+
onFinish?: FormEmits<Values>['finish'];
|
|
75
|
+
onFinishFailed?: FormEmits<Values>['finishFailed'];
|
|
76
|
+
onSubmit?: FormEmits<Values>['submit'];
|
|
77
|
+
onReset?: FormEmits<Values>['reset'];
|
|
78
|
+
onValidate?: FormEmits<Values>['validate'];
|
|
79
|
+
onValuesChange?: FormEmits<Values>['valuesChange'];
|
|
80
|
+
onFieldsChange?: FormEmits<Values>['fieldsChange'];
|
|
81
81
|
}
|
|
82
82
|
interface FormSlots {
|
|
83
83
|
default: () => any;
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
getFieldValue: (name: NamePath) => any;
|
|
87
|
-
getFieldsValue: (nameList?: NamePath[] | true) => Record<string, any>;
|
|
88
|
-
getFieldError: (name: NamePath) => string[];
|
|
89
|
-
getFieldsError: (nameList?: NamePath[]) => {
|
|
90
|
-
name: InternalNamePath;
|
|
91
|
-
errors: string[];
|
|
92
|
-
warnings: string[];
|
|
93
|
-
}[];
|
|
94
|
-
getFieldWarning: (name: NamePath) => string[];
|
|
95
|
-
isFieldsTouched: (nameList?: NamePath[] | boolean, allFieldsTouched?: boolean) => boolean;
|
|
96
|
-
isFieldTouched: (name: NamePath) => boolean;
|
|
97
|
-
isFieldsValidating: (nameList?: NamePath[]) => boolean;
|
|
98
|
-
isFieldValidating: (name: NamePath) => boolean;
|
|
99
|
-
resetFields: (nameList?: NamePath[] | InternalNamePath[]) => void;
|
|
100
|
-
clearValidate: (nameList?: NamePath[] | InternalNamePath[]) => void;
|
|
101
|
-
setFields: (data: FieldData[]) => void;
|
|
102
|
-
setFieldValue: (name: NamePath, value: any) => void;
|
|
103
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
104
|
-
validateFields: (nameList?: NamePath[] | ValidateOptions, options?: ValidateOptions) => Promise<Record<string, any>>;
|
|
105
|
-
validate: (nameList?: NamePath[] | ValidateOptions, options?: ValidateOptions) => Promise<Record<string, any>>;
|
|
106
|
-
submit: () => void;
|
|
107
|
-
nativeElement: HTMLFormElement | undefined;
|
|
108
|
-
scrollToField: (fieldName: NamePath, options?: ScrollFocusOptions | boolean) => void;
|
|
109
|
-
focusField: (fieldName: NamePath) => void;
|
|
110
|
-
getFieldInstance: (name: NamePath) => any;
|
|
111
|
-
}
|
|
112
|
-
declare const InternalForm: import("vue").DefineSetupFnComponent<FormProps, FormEmits, SlotsType<FormSlots>, FormProps, import("vue").PublicProps>;
|
|
85
|
+
declare const InternalForm: import("vue").DefineSetupFnComponent<FormProps<Record<string, any>>, FormEmits<any>, SlotsType<FormSlots>, FormProps<Record<string, any>>, import("vue").PublicProps>;
|
|
113
86
|
//#endregion
|
|
114
|
-
export { FormClassNamesType, FormEmits, FormEmitsProps, FormInstance, FormItemLayout, FormLayout, FormProps, FormSemanticClassNames, FormSemanticName, FormSemanticStyles, FormSlots, FormStylesType, RequiredMark, type ScrollFocusOptions, InternalForm as default };
|
|
87
|
+
export { FormClassNamesType, FormEmits, FormEmitsProps, type FormInstance, FormItemLayout, FormLayout, FormProps, FormSemanticClassNames, FormSemanticName, FormSemanticStyles, FormSlots, FormStylesType, RequiredMark, type ScrollFocusOptions, InternalForm as default };
|
package/dist/form/Form.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getAttrStyleAndClass, useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
1
3
|
import warning, { devUseWarning, isDev } from "../_util/warning.js";
|
|
2
4
|
import { NoFormStyle, useFormContextProvider, useVariantContextProvider } from "./context.js";
|
|
3
|
-
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
4
5
|
import { useSizeProvider } from "../config-provider/SizeContext.js";
|
|
5
6
|
import { useSize } from "../config-provider/hooks/useSize.js";
|
|
6
|
-
import { getAttrStyleAndClass, useMergeSemantic, useSemanticRootStyle, useToArr, useToProps } from "../_util/hooks/useMergeSemantic.js";
|
|
7
7
|
import { toPropsRefs } from "../_util/tools.js";
|
|
8
8
|
import useCSSVarCls from "../config-provider/hooks/useCSSVarCls.js";
|
|
9
9
|
import { useDisabledContext, useDisabledContextProvider } from "../config-provider/DisabledContext.js";
|
|
@@ -21,6 +21,32 @@ import { cloneDeep, pick } from "es-toolkit";
|
|
|
21
21
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
22
22
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
23
23
|
//#region src/form/Form.tsx
|
|
24
|
+
function isPlainRecord(val) {
|
|
25
|
+
return val !== null && typeof val === "object" && !Array.isArray(val) && Object.getPrototypeOf(val) === Object.prototype;
|
|
26
|
+
}
|
|
27
|
+
function clonePayloadValue(value, seen = /* @__PURE__ */ new Map()) {
|
|
28
|
+
const isArray = Array.isArray(value);
|
|
29
|
+
if (!isArray && !isPlainRecord(value)) return value;
|
|
30
|
+
if (seen.has(value)) return seen.get(value);
|
|
31
|
+
const cloned = isArray ? [] : {};
|
|
32
|
+
seen.set(value, cloned);
|
|
33
|
+
Object.keys(value).forEach((key) => {
|
|
34
|
+
cloned[key] = clonePayloadValue(value[key], seen);
|
|
35
|
+
});
|
|
36
|
+
return cloned;
|
|
37
|
+
}
|
|
38
|
+
function mergeModelValue(target, source, ancestors = /* @__PURE__ */ new Set()) {
|
|
39
|
+
Object.keys(source).forEach((key) => {
|
|
40
|
+
const next = source[key];
|
|
41
|
+
const prev = target[key];
|
|
42
|
+
if (isPlainRecord(next) && isPlainRecord(prev)) {
|
|
43
|
+
if (ancestors.has(next)) return;
|
|
44
|
+
ancestors.add(next);
|
|
45
|
+
mergeModelValue(prev, next, ancestors);
|
|
46
|
+
ancestors.delete(next);
|
|
47
|
+
} else target[key] = clonePayloadValue(next);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
24
50
|
const InternalForm = /* @__PURE__ */ defineComponent((props, { slots, expose, emit, attrs }) => {
|
|
25
51
|
const contextDisabled = useDisabledContext();
|
|
26
52
|
const { prefixCls, direction, requiredMark: contextRequiredMark, colon: contextColon, scrollToFirstError: contextScrollToFirstError, autoComplete: contextAutoComplete, autocomplete: contextAutocomplete, class: contextClassName, style: contextStyle, styles: contextStyles, classes: contextClassNames, tooltip: contextTooltip, labelAlign: contextLabelAlign, labelWrap: contextLabelWrap } = useComponentBaseConfig("form", props, [
|
|
@@ -109,10 +135,31 @@ const InternalForm = /* @__PURE__ */ defineComponent((props, { slots, expose, em
|
|
|
109
135
|
const getFieldValue = (namePath) => {
|
|
110
136
|
return get(model.value ?? {}, namePath);
|
|
111
137
|
};
|
|
112
|
-
const getFieldsValue = (nameList) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
const getFieldsValue = (nameList, filterFunc) => {
|
|
139
|
+
let mergedNameList;
|
|
140
|
+
let mergedFilterFunc;
|
|
141
|
+
if (nameList === true || Array.isArray(nameList)) {
|
|
142
|
+
mergedNameList = nameList;
|
|
143
|
+
mergedFilterFunc = filterFunc;
|
|
144
|
+
} else if (nameList && typeof nameList === "object") mergedFilterFunc = nameList.filter;
|
|
145
|
+
const store = model.value ?? {};
|
|
146
|
+
const filter = mergedFilterFunc;
|
|
147
|
+
if (mergedNameList === true && !filter) return cloneDeep(store);
|
|
148
|
+
const fieldList = Object.values(fields);
|
|
149
|
+
const filteredNameList = [];
|
|
150
|
+
if (Array.isArray(mergedNameList)) for (const name of mergedNameList) {
|
|
151
|
+
const namePath = getNamePath(name);
|
|
152
|
+
let matched = false;
|
|
153
|
+
for (const field of fieldList) {
|
|
154
|
+
const fieldNamePath = field.namePath();
|
|
155
|
+
if (!matchNamePath(fieldNamePath, namePath, true)) continue;
|
|
156
|
+
matched = true;
|
|
157
|
+
if (!filter || filter({ ...field.getMeta() })) filteredNameList.push(fieldNamePath);
|
|
158
|
+
}
|
|
159
|
+
if (!matched && (!filter || filter(null))) filteredNameList.push(namePath);
|
|
160
|
+
}
|
|
161
|
+
else for (const field of fieldList) if (!filter || filter({ ...field.getMeta() })) filteredNameList.push(field.namePath());
|
|
162
|
+
return cloneByNamePathList(store, filteredNameList);
|
|
116
163
|
};
|
|
117
164
|
const getFields = (namePathList) => {
|
|
118
165
|
return getFieldsByNameList(namePathList).map((field) => {
|
|
@@ -284,9 +331,11 @@ const InternalForm = /* @__PURE__ */ defineComponent((props, { slots, expose, em
|
|
|
284
331
|
};
|
|
285
332
|
const setFieldsValue = (values) => {
|
|
286
333
|
if (!model.value) return;
|
|
334
|
+
let store = {};
|
|
287
335
|
Object.keys(values || {}).forEach((key) => {
|
|
288
|
-
|
|
336
|
+
store = set(store, getNamePath(key), values[key]);
|
|
289
337
|
});
|
|
338
|
+
mergeModelValue(model.value, store);
|
|
290
339
|
triggerFieldsChange();
|
|
291
340
|
};
|
|
292
341
|
const getFieldError = (name) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NoStyleItemContextProvider, useFormContext } from "../context.js";
|
|
2
1
|
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { NoStyleItemContextProvider, useFormContext } from "../context.js";
|
|
3
3
|
import isNonNullable from "../../_util/isNonNullable.js";
|
|
4
4
|
import { getStatus } from "../util.js";
|
|
5
5
|
import Row from "../../grid/row.js";
|
|
@@ -30,8 +30,8 @@ const ItemHolder = /* @__PURE__ */ defineComponent((props, { attrs, slots }) =>
|
|
|
30
30
|
const onErrorVisibleChanged = (visible) => {
|
|
31
31
|
if (!visible && !hasError.value) marginBottom.value = null;
|
|
32
32
|
};
|
|
33
|
-
function getValidateState(
|
|
34
|
-
return getStatus(
|
|
33
|
+
function getValidateState() {
|
|
34
|
+
return getStatus(props?.meta?.errors, props?.meta?.warnings, props?.meta, "", !!props?.hasFeedback, props?.validateStatus);
|
|
35
35
|
}
|
|
36
36
|
return () => {
|
|
37
37
|
const mergedValidateStatus = getValidateState();
|
|
@@ -12,8 +12,8 @@ type FeedbackIcons = (itemStatus: {
|
|
|
12
12
|
errors?: any[];
|
|
13
13
|
warnings?: any[];
|
|
14
14
|
}) => { [key in ValidateStatus]?: any; };
|
|
15
|
-
interface BaseFormItemProps {
|
|
16
|
-
name?: NamePath
|
|
15
|
+
interface BaseFormItemProps<Values = any> {
|
|
16
|
+
name?: NamePath<Values>;
|
|
17
17
|
rules?: Rule[];
|
|
18
18
|
trigger?: TriggerType | TriggerType[];
|
|
19
19
|
validateTrigger?: TriggerType | TriggerType[] | false;
|
|
@@ -21,7 +21,7 @@ interface BaseFormItemProps {
|
|
|
21
21
|
validateFirst?: boolean | 'parallel';
|
|
22
22
|
preserve?: boolean;
|
|
23
23
|
}
|
|
24
|
-
type FormItemProps = BaseFormItemProps & ComponentBaseProps & Omit<FormItemLabelProps, 'requiredMark'> & FormItemInputProps & {
|
|
24
|
+
type FormItemProps<Values = any> = BaseFormItemProps<Values> & ComponentBaseProps & Omit<FormItemLabelProps, 'requiredMark'> & FormItemInputProps & {
|
|
25
25
|
noStyle?: boolean;
|
|
26
26
|
id?: string;
|
|
27
27
|
hasFeedback?: boolean | {
|