Skip to content

Commit a8e9aea

Browse files
Use true imported union / enum types instead of explicit (string) acceptable values React / Vue (#28291)
1 parent 3dc8d13 commit a8e9aea

File tree

128 files changed

+3507
-3529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3507
-3529
lines changed

apps/demos/testing/known-warnings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"The specified credentials are invalid. You can sign up for a free developer account at http://www.bingmapsportal.com",
33
"W0019 -",
44
"W0022 -",
5-
"W2108 -"
5+
"W2108 -",
6+
"[Vue warn]: Invalid prop: type check failed for prop"
67
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"axe-core": "4.10.0",
4545
"cheerio": "1.0.0-rc.10",
4646
"codelyzer": "6.0.2",
47-
"devextreme-internal-tools": "16.0.0-beta.8",
47+
"devextreme-internal-tools": "16.0.0-beta.9",
4848
"http-server": "14.1.1",
4949
"husky": "8.0.3",
5050
"jest": "29.7.0",

packages/devextreme-react/src/action-sheet.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import NestedOption from "./core/nested-option";
1111

1212
import type { dxActionSheetItem, CancelClickEvent, ContentReadyEvent, DisposingEvent, InitializedEvent, ItemClickEvent, ItemContextMenuEvent, ItemHoldEvent, ItemRenderedEvent } from "devextreme/ui/action_sheet";
1313
import type { NativeEventInfo } from "devextreme/events/index";
14+
import type { ButtonStyle, ButtonType } from "devextreme/common";
1415
import type { CollectionWidgetItem } from "devextreme/ui/collection/ui.collection_widget.base";
1516
import type { template } from "devextreme/core/templates/template";
1617

@@ -99,10 +100,10 @@ type IItemProps = React.PropsWithChildren<{
99100
disabled?: boolean;
100101
icon?: string;
101102
onClick?: ((e: NativeEventInfo<any>) => void);
102-
stylingMode?: "text" | "outlined" | "contained";
103+
stylingMode?: ButtonStyle;
103104
template?: ((itemData: CollectionWidgetItem, itemIndex: number, itemElement: any) => string | any) | template;
104105
text?: string;
105-
type?: "danger" | "default" | "normal" | "success";
106+
type?: ButtonType;
106107
render?: (...params: any) => React.ReactNode;
107108
component?: React.ComponentType<any>;
108109
}>

packages/devextreme-react/src/autocomplete.ts

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import NestedOption from "./core/nested-option";
1010

1111
import type { ChangeEvent, ClosedEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, ItemClickEvent, KeyDownEvent, KeyUpEvent, OpenedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/autocomplete";
1212
import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, ClickEvent, OptionChangedEvent } from "devextreme/ui/button";
13-
import type { AnimationConfig, AnimationState } from "devextreme/animation/fx";
13+
import type { AnimationConfig, AnimationState, AnimationType } from "devextreme/animation/fx";
14+
import type { HorizontalAlignment, VerticalAlignment, TextEditorButtonLocation, PositionAlignment, Direction, ButtonStyle, ButtonType, ToolbarItemLocation, ToolbarItemComponent } from "devextreme/common";
15+
import type { CollisionResolution, PositionConfig, CollisionResolutionCombination } from "devextreme/animation/position";
1416
import type { event, EventInfo } from "devextreme/events/index";
1517
import type { template } from "devextreme/core/templates/template";
1618
import type { Component } from "devextreme/core/component";
17-
import type { PositionConfig } from "devextreme/animation/position";
18-
import type { dxPopupToolbarItem } from "devextreme/ui/popup";
19+
import type { dxPopupToolbarItem, ToolbarLocation } from "devextreme/ui/popup";
1920
import type { CollectionWidgetItem } from "devextreme/ui/collection/ui.collection_widget.base";
21+
import type { LocateInMenuMode, ShowTextMode } from "devextreme/ui/toolbar";
2022

2123
import type dxOverlay from "devextreme/ui/overlay";
2224
import type DOMComponent from "devextreme/core/dom_component";
@@ -151,8 +153,8 @@ const Animation = Object.assign<typeof _componentAnimation, NestedComponentMeta>
151153
// owners:
152154
// Position
153155
type IAtProps = React.PropsWithChildren<{
154-
x?: "center" | "left" | "right";
155-
y?: "bottom" | "center" | "top";
156+
x?: HorizontalAlignment;
157+
y?: VerticalAlignment;
156158
}>
157159
const _componentAt = (props: IAtProps) => {
158160
return React.createElement(NestedOption<IAtProps>, {
@@ -189,7 +191,7 @@ const BoundaryOffset = Object.assign<typeof _componentBoundaryOffset, NestedComp
189191
// owners:
190192
// Autocomplete
191193
type IButtonProps = React.PropsWithChildren<{
192-
location?: "after" | "before";
194+
location?: TextEditorButtonLocation;
193195
name?: string;
194196
options?: dxButtonOptions;
195197
}>
@@ -213,8 +215,8 @@ const Button = Object.assign<typeof _componentButton, NestedComponentMeta>(_comp
213215
// owners:
214216
// Position
215217
type ICollisionProps = React.PropsWithChildren<{
216-
x?: "fit" | "flip" | "flipfit" | "none";
217-
y?: "fit" | "flip" | "flipfit" | "none";
218+
x?: CollisionResolution;
219+
y?: CollisionResolution;
218220
}>
219221
const _componentCollision = (props: ICollisionProps) => {
220222
return React.createElement(NestedOption<ICollisionProps>, {
@@ -270,7 +272,7 @@ type IDropDownOptionsProps = React.PropsWithChildren<{
270272
onShowing?: ((e: { cancel: boolean | any, component: dxOverlay<any>, element: any, model: any }) => void);
271273
onShown?: ((e: EventInfo<any>) => void);
272274
onTitleRendered?: ((e: { component: dxPopup, element: any, model: any, titleElement: any }) => void);
273-
position?: (() => void) | PositionConfig | "bottom" | "center" | "left" | "left bottom" | "left top" | "right" | "right bottom" | "right top" | "top";
275+
position?: (() => void) | PositionAlignment | PositionConfig;
274276
resizeEnabled?: boolean;
275277
restorePosition?: boolean;
276278
rtlEnabled?: boolean;
@@ -287,8 +289,8 @@ type IDropDownOptionsProps = React.PropsWithChildren<{
287289
wrapperAttr?: any;
288290
defaultHeight?: (() => number | string) | number | string;
289291
onHeightChange?: (value: (() => number | string) | number | string) => void;
290-
defaultPosition?: (() => void) | PositionConfig | "bottom" | "center" | "left" | "left bottom" | "left top" | "right" | "right bottom" | "right top" | "top";
291-
onPositionChange?: (value: (() => void) | PositionConfig | "bottom" | "center" | "left" | "left bottom" | "left top" | "right" | "right bottom" | "right top" | "top") => void;
292+
defaultPosition?: (() => void) | PositionAlignment | PositionConfig;
293+
onPositionChange?: (value: (() => void) | PositionAlignment | PositionConfig) => void;
292294
defaultVisible?: boolean;
293295
onVisibleChange?: (value: boolean) => void;
294296
defaultWidth?: (() => number | string) | number | string;
@@ -361,14 +363,14 @@ const From = Object.assign<typeof _componentFrom, NestedComponentMeta>(_componen
361363
type IHideProps = React.PropsWithChildren<{
362364
complete?: (($element: any, config: AnimationConfig) => void);
363365
delay?: number;
364-
direction?: "bottom" | "left" | "right" | "top";
366+
direction?: Direction;
365367
duration?: number;
366368
easing?: string;
367369
from?: AnimationState;
368370
staggerDelay?: number;
369371
start?: (($element: any, config: AnimationConfig) => void);
370372
to?: AnimationState;
371-
type?: "css" | "fade" | "fadeIn" | "fadeOut" | "pop" | "slide" | "slideIn" | "slideOut";
373+
type?: AnimationType;
372374
}>
373375
const _componentHide = (props: IHideProps) => {
374376
return React.createElement(NestedOption<IHideProps>, {
@@ -420,8 +422,8 @@ const Item = Object.assign<typeof _componentItem, NestedComponentMeta>(_componen
420422
// owners:
421423
// Position
422424
type IMyProps = React.PropsWithChildren<{
423-
x?: "center" | "left" | "right";
424-
y?: "bottom" | "center" | "top";
425+
x?: HorizontalAlignment;
426+
y?: VerticalAlignment;
425427
}>
426428
const _componentMy = (props: IMyProps) => {
427429
return React.createElement(NestedOption<IMyProps>, {
@@ -474,11 +476,11 @@ type IOptionsProps = React.PropsWithChildren<{
474476
onInitialized?: ((e: ButtonInitializedEvent) => void);
475477
onOptionChanged?: ((e: OptionChangedEvent) => void);
476478
rtlEnabled?: boolean;
477-
stylingMode?: "text" | "outlined" | "contained";
479+
stylingMode?: ButtonStyle;
478480
tabIndex?: number;
479481
template?: ((buttonData: { icon: string, text: string }, contentElement: any) => string | any) | template;
480482
text?: string;
481-
type?: "danger" | "default" | "normal" | "success";
483+
type?: ButtonType | string;
482484
useSubmitBehavior?: boolean;
483485
validationGroup?: string;
484486
visible?: boolean;
@@ -508,22 +510,22 @@ const Options = Object.assign<typeof _componentOptions, NestedComponentMeta>(_co
508510
// From
509511
// DropDownOptions
510512
type IPositionProps = React.PropsWithChildren<{
511-
at?: Record<string, any> | "bottom" | "center" | "left" | "left bottom" | "left top" | "right" | "right bottom" | "right top" | "top" | {
512-
x?: "center" | "left" | "right";
513-
y?: "bottom" | "center" | "top";
513+
at?: Record<string, any> | PositionAlignment | {
514+
x?: HorizontalAlignment;
515+
y?: VerticalAlignment;
514516
};
515517
boundary?: any | string;
516518
boundaryOffset?: Record<string, any> | string | {
517519
x?: number;
518520
y?: number;
519521
};
520-
collision?: Record<string, any> | "fit" | "fit flip" | "fit flipfit" | "fit none" | "flip" | "flip fit" | "flip none" | "flipfit" | "flipfit fit" | "flipfit none" | "none" | "none fit" | "none flip" | "none flipfit" | {
521-
x?: "fit" | "flip" | "flipfit" | "none";
522-
y?: "fit" | "flip" | "flipfit" | "none";
522+
collision?: CollisionResolutionCombination | Record<string, any> | {
523+
x?: CollisionResolution;
524+
y?: CollisionResolution;
523525
};
524-
my?: Record<string, any> | "bottom" | "center" | "left" | "left bottom" | "left top" | "right" | "right bottom" | "right top" | "top" | {
525-
x?: "center" | "left" | "right";
526-
y?: "bottom" | "center" | "top";
526+
my?: Record<string, any> | PositionAlignment | {
527+
x?: HorizontalAlignment;
528+
y?: VerticalAlignment;
527529
};
528530
of?: any | string;
529531
offset?: Record<string, any> | string | {
@@ -549,14 +551,14 @@ const Position = Object.assign<typeof _componentPosition, NestedComponentMeta>(_
549551
type IShowProps = React.PropsWithChildren<{
550552
complete?: (($element: any, config: AnimationConfig) => void);
551553
delay?: number;
552-
direction?: "bottom" | "left" | "right" | "top";
554+
direction?: Direction;
553555
duration?: number;
554556
easing?: string;
555557
from?: AnimationState;
556558
staggerDelay?: number;
557559
start?: (($element: any, config: AnimationConfig) => void);
558560
to?: AnimationState;
559-
type?: "css" | "fade" | "fadeIn" | "fadeOut" | "pop" | "slide" | "slideIn" | "slideOut";
561+
type?: AnimationType;
560562
}>
561563
const _componentShow = (props: IShowProps) => {
562564
return React.createElement(NestedOption<IShowProps>, {
@@ -599,16 +601,16 @@ type IToolbarItemProps = React.PropsWithChildren<{
599601
cssClass?: string;
600602
disabled?: boolean;
601603
html?: string;
602-
locateInMenu?: "always" | "auto" | "never";
603-
location?: "after" | "before" | "center";
604+
locateInMenu?: LocateInMenuMode;
605+
location?: ToolbarItemLocation;
604606
menuItemTemplate?: (() => string | any) | template;
605607
options?: any;
606-
showText?: "always" | "inMenu";
608+
showText?: ShowTextMode;
607609
template?: ((itemData: CollectionWidgetItem, itemIndex: number, itemElement: any) => string | any) | template;
608610
text?: string;
609-
toolbar?: "bottom" | "top";
611+
toolbar?: ToolbarLocation;
610612
visible?: boolean;
611-
widget?: "dxAutocomplete" | "dxButton" | "dxButtonGroup" | "dxCheckBox" | "dxDateBox" | "dxDropDownButton" | "dxMenu" | "dxSelectBox" | "dxSwitch" | "dxTabs" | "dxTextBox";
613+
widget?: ToolbarItemComponent;
612614
menuItemRender?: (...params: any) => React.ReactNode;
613615
menuItemComponent?: React.ComponentType<any>;
614616
render?: (...params: any) => React.ReactNode;

0 commit comments

Comments
 (0)