From c899b74b55414ecf754ec2f535173ba5a139414e Mon Sep 17 00:00:00 2001 From: Alexander Kozlovskiy Date: Thu, 31 Aug 2023 23:06:07 +0200 Subject: [PATCH 1/4] delete values and extend value --- packages/devextreme-react/src/calendar.ts | 6 ++--- packages/devextreme-react/src/common/index.ts | 1 + packages/devextreme-react/src/date-box.ts | 16 ++++++------ .../devextreme-react/src/date-range-box.ts | 24 +++++++++--------- packages/devextreme-vue/src/calendar.ts | 3 --- packages/devextreme-vue/src/common/index.ts | 1 + packages/devextreme-vue/src/date-box.ts | 2 -- packages/devextreme-vue/src/date-range-box.ts | 2 -- packages/devextreme/js/common.d.ts | 7 ++++++ packages/devextreme/js/ui/calendar.d.ts | 15 +++++------ packages/devextreme/js/ui/date_box.d.ts | 10 +++++--- packages/devextreme/js/ui/date_range_box.d.ts | 10 +++++--- packages/devextreme/ts/dx.all.d.ts | 25 +++++++++---------- packages/vue2-strategy/src/calendar.ts | 3 --- packages/vue2-strategy/src/common/index.ts | 1 + packages/vue2-strategy/src/date-box.ts | 2 -- packages/vue2-strategy/src/date-range-box.ts | 2 -- 17 files changed, 65 insertions(+), 65 deletions(-) diff --git a/packages/devextreme-react/src/calendar.ts b/packages/devextreme-react/src/calendar.ts index 5c82c45765d7..d04676b0a55c 100644 --- a/packages/devextreme-react/src/calendar.ts +++ b/packages/devextreme-react/src/calendar.ts @@ -5,6 +5,7 @@ import dxCalendar, { import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; +import type { SelectedDateType } from "devextreme/common"; import type { DisposingEvent, InitializedEvent, ValueChangedEvent } from "devextreme/ui/calendar"; type ReplaceFieldTypes = { @@ -21,9 +22,9 @@ type ICalendarOptions = React.PropsWithChildren React.ReactNode; cellComponent?: React.ComponentType; cellKeyFn?: (data: any) => string; - defaultValue?: any | number | string; + defaultValue?: Array | SelectedDateType; defaultZoomLevel?: "century" | "decade" | "month" | "year"; - onValueChange?: (value: any | number | string) => void; + onValueChange?: (value: Array | SelectedDateType) => void; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; }> @@ -138,7 +139,6 @@ class Calendar extends BaseComponent> "invalid", "pending"]) ]), - values: PropTypes.array, visible: PropTypes.bool, weekNumberRule: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/devextreme-react/src/common/index.ts b/packages/devextreme-react/src/common/index.ts index 3460bb4dba76..6474d4f976f1 100644 --- a/packages/devextreme-react/src/common/index.ts +++ b/packages/devextreme-react/src/common/index.ts @@ -39,6 +39,7 @@ export { ScrollMode, SearchMode, SelectAllMode, + SelectedDateType, SimplifiedSearchMode, SingleMultipleAllOrNone, SingleMultipleOrNone, diff --git a/packages/devextreme-react/src/date-box.ts b/packages/devextreme-react/src/date-box.ts index 9903f8c4a774..c1883a42bb80 100644 --- a/packages/devextreme-react/src/date-box.ts +++ b/packages/devextreme-react/src/date-box.ts @@ -6,6 +6,7 @@ import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; import NestedOption from "./core/nested-option"; +import type { SelectedDateType } from "devextreme/common"; import type { ChangeEvent, ClosedEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, KeyDownEvent, KeyUpEvent, OpenedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/date_box"; import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, OptionChangedEvent as ButtonOptionChangedEvent, ClickEvent } from "devextreme/ui/button"; import type { DisposingEvent as CalendarDisposingEvent, InitializedEvent as CalendarInitializedEvent, ValueChangedEvent as CalendarValueChangedEvent, DisabledDate, OptionChangedEvent } from "devextreme/ui/calendar"; @@ -49,9 +50,9 @@ type IDateBoxOptions = React.PropsWithChildren; dropDownButtonKeyFn?: (data: any) => string; defaultOpened?: boolean; - defaultValue?: any | number | string; + defaultValue?: SelectedDateType; onOpenedChange?: (value: boolean) => void; - onValueChange?: (value: any | number | string) => void; + onValueChange?: (value: SelectedDateType) => void; }> class DateBox extends BaseComponent> { @@ -294,9 +295,9 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ hoverStateEnabled?: boolean; isDirty?: boolean; isValid?: boolean; - max?: any | number | string; + max?: SelectedDateType; maxZoomLevel?: "century" | "decade" | "month" | "year"; - min?: any | number | string; + min?: SelectedDateType; minZoomLevel?: "century" | "decade" | "month" | "year"; name?: string; onDisposing?: ((e: CalendarDisposingEvent) => void); @@ -315,14 +316,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ validationMessageMode?: "always" | "auto"; validationMessagePosition?: "bottom" | "left" | "right" | "top"; validationStatus?: "valid" | "invalid" | "pending"; - value?: any | number | string; - values?: Array; + value?: Array | SelectedDateType; visible?: boolean; weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays"; width?: (() => number | string) | number | string; zoomLevel?: "century" | "decade" | "month" | "year"; - defaultValue?: any | number | string; - onValueChange?: (value: any | number | string) => void; + defaultValue?: Array | SelectedDateType; + onValueChange?: (value: Array | SelectedDateType) => void; defaultZoomLevel?: "century" | "decade" | "month" | "year"; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; cellRender?: (...params: any) => React.ReactNode; diff --git a/packages/devextreme-react/src/date-range-box.ts b/packages/devextreme-react/src/date-range-box.ts index 6646420c0fba..001cdd06a68e 100644 --- a/packages/devextreme-react/src/date-range-box.ts +++ b/packages/devextreme-react/src/date-range-box.ts @@ -6,6 +6,7 @@ import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; import NestedOption from "./core/nested-option"; +import type { SelectedDateType } from "devextreme/common"; import type { ChangeEvent, ClosedEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, KeyDownEvent, KeyUpEvent, OpenedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/date_range_box"; import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, OptionChangedEvent as ButtonOptionChangedEvent, ClickEvent } from "devextreme/ui/button"; import type { DisposingEvent as CalendarDisposingEvent, InitializedEvent as CalendarInitializedEvent, ValueChangedEvent as CalendarValueChangedEvent, DisabledDate, OptionChangedEvent } from "devextreme/ui/calendar"; @@ -48,14 +49,14 @@ type IDateRangeBoxOptions = React.PropsWithChildren React.ReactNode; dropDownButtonComponent?: React.ComponentType; dropDownButtonKeyFn?: (data: any) => string; - defaultEndDate?: any | number | string; + defaultEndDate?: SelectedDateType; defaultOpened?: boolean; - defaultStartDate?: any | number | string; - defaultValue?: Array; - onEndDateChange?: (value: any | number | string) => void; + defaultStartDate?: SelectedDateType; + defaultValue?: Array; + onEndDateChange?: (value: SelectedDateType) => void; onOpenedChange?: (value: boolean) => void; - onStartDateChange?: (value: any | number | string) => void; - onValueChange?: (value: Array) => void; + onStartDateChange?: (value: SelectedDateType) => void; + onValueChange?: (value: Array) => void; }> class DateRangeBox extends BaseComponent> { @@ -281,9 +282,9 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ hoverStateEnabled?: boolean; isDirty?: boolean; isValid?: boolean; - max?: any | number | string; + max?: SelectedDateType; maxZoomLevel?: "century" | "decade" | "month" | "year"; - min?: any | number | string; + min?: SelectedDateType; minZoomLevel?: "century" | "decade" | "month" | "year"; name?: string; onDisposing?: ((e: CalendarDisposingEvent) => void); @@ -302,14 +303,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ validationMessageMode?: "always" | "auto"; validationMessagePosition?: "bottom" | "left" | "right" | "top"; validationStatus?: "valid" | "invalid" | "pending"; - value?: any | number | string; - values?: Array; + value?: Array | SelectedDateType; visible?: boolean; weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays"; width?: (() => number | string) | number | string; zoomLevel?: "century" | "decade" | "month" | "year"; - defaultValue?: any | number | string; - onValueChange?: (value: any | number | string) => void; + defaultValue?: Array | SelectedDateType; + onValueChange?: (value: Array | SelectedDateType) => void; defaultZoomLevel?: "century" | "decade" | "month" | "year"; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; cellRender?: (...params: any) => React.ReactNode; diff --git a/packages/devextreme-vue/src/calendar.ts b/packages/devextreme-vue/src/calendar.ts index 6d74ecb32948..f56d961f29df 100644 --- a/packages/devextreme-vue/src/calendar.ts +++ b/packages/devextreme-vue/src/calendar.ts @@ -38,7 +38,6 @@ type AccessibleOptions = Pick { * @default new Date(3000, 0) * @public */ - max?: Date | number | string; + max?: SelectedDateType; /** * @docid * @default 'month' @@ -159,7 +160,7 @@ export interface dxCalendarOptions extends EditorOptions { * @default new Date(1000, 0) * @public */ - min?: Date | number | string; + min?: SelectedDateType; /** * @docid * @default 'century' @@ -205,15 +206,11 @@ export interface dxCalendarOptions extends EditorOptions { /** * @docid * @default null + * @default [] &for(multiple selection mode) + * @default [null,null] &for(range selection mode) * @public */ - value?: Date | number | string; - /** - * @docid - * @default [] - * @public - */ - values?: Array; + value?: SelectedDateType | Array; /** * @docid * @default 'month' diff --git a/packages/devextreme/js/ui/date_box.d.ts b/packages/devextreme/js/ui/date_box.d.ts index 27074ca9471d..271ae959fcde 100644 --- a/packages/devextreme/js/ui/date_box.d.ts +++ b/packages/devextreme/js/ui/date_box.d.ts @@ -28,6 +28,10 @@ import { Properties as PopupProperties, } from './popup'; +import { + SelectedDateType, + } from '../common'; + /** @public */ export type DateType = 'date' | 'datetime' | 'time'; /** @public */ @@ -277,7 +281,7 @@ export interface dxDateBoxOptions extends DateBoxBaseOptions { * @default null * @public */ - value?: Date | number | string; + value?: SelectedDateType; } /** @@ -321,13 +325,13 @@ export interface DateBoxBaseOptions extends dxDropDownEditorOptions< * @default undefined * @public */ - max?: Date | number | string; + max?: SelectedDateType; /** * @docid * @default undefined * @public */ - min?: Date | number | string; + min?: SelectedDateType; /** * @docid * @default "Today" diff --git a/packages/devextreme/js/ui/date_range_box.d.ts b/packages/devextreme/js/ui/date_range_box.d.ts index b54591f51eee..35f86a35d358 100644 --- a/packages/devextreme/js/ui/date_range_box.d.ts +++ b/packages/devextreme/js/ui/date_range_box.d.ts @@ -20,6 +20,10 @@ import { ValueChangedInfo, } from './editor/editor'; +import { + SelectedDateType, +} from '../common'; + /** * @docid _ui_date_range_box_ChangeEvent * @public @@ -180,7 +184,7 @@ export type Properties = Omit, 'inputAttr' | * @public * @fires dxDateRangeBoxOptions.onOptionChanged */ - endDate?: Date | number | string; + endDate?: SelectedDateType; /** * @docid dxDateRangeBoxOptions.endDateInputAttr * @default {} @@ -249,7 +253,7 @@ export type Properties = Omit, 'inputAttr' | * @public * @fires dxDateRangeBoxOptions.onOptionChanged */ - startDate?: Date | number | string; + startDate?: SelectedDateType; /** * @docid dxDateRangeBoxOptions.startDateInputAttr * @default {} @@ -291,7 +295,7 @@ export type Properties = Omit, 'inputAttr' | * @default [null,null] * @public */ - value?: Array; + value?: Array; }; /** diff --git a/packages/devextreme/ts/dx.all.d.ts b/packages/devextreme/ts/dx.all.d.ts index 113a2c47ebd7..d1728e8348b7 100644 --- a/packages/devextreme/ts/dx.all.d.ts +++ b/packages/devextreme/ts/dx.all.d.ts @@ -1724,6 +1724,7 @@ declare module DevExpress.common { export type ScrollMode = 'standard' | 'virtual'; export type SearchMode = 'contains' | 'startswith' | 'equals'; export type SelectAllMode = 'allPages' | 'page'; + export type SelectedDateType = Date | string | number | null; export type SimplifiedSearchMode = 'contains' | 'startswith'; export type SingleMultipleAllOrNone = 'single' | 'multiple' | 'all' | 'none'; export type SingleMultipleOrNone = 'single' | 'multiple' | 'none'; @@ -7882,11 +7883,11 @@ declare module DevExpress.ui { /** * [descr:DateBoxBaseOptions.max] */ - max?: Date | number | string; + max?: DevExpress.common.SelectedDateType; /** * [descr:DateBoxBaseOptions.min] */ - min?: Date | number | string; + min?: DevExpress.common.SelectedDateType; /** * [descr:DateBoxBaseOptions.todayButtonText] */ @@ -9038,7 +9039,7 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.max] */ - max?: Date | number | string; + max?: DevExpress.common.SelectedDateType; /** * [descr:dxCalendarOptions.maxZoomLevel] */ @@ -9046,7 +9047,7 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.min] */ - min?: Date | number | string; + min?: DevExpress.common.SelectedDateType; /** * [descr:dxCalendarOptions.minZoomLevel] */ @@ -9078,11 +9079,9 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.value] */ - value?: Date | number | string; - /** - * [descr:dxCalendarOptions.values] - */ - values?: Array; + value?: + | DevExpress.common.SelectedDateType + | Array; /** * [descr:dxCalendarOptions.zoomLevel] */ @@ -12006,7 +12005,7 @@ declare module DevExpress.ui { /** * [descr:dxDateBoxOptions.value] */ - value?: Date | number | string; + value?: DevExpress.common.SelectedDateType; } /** * [descr:dxDateRangeBox] @@ -12136,7 +12135,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.endDate] */ - endDate?: Date | number | string; + endDate?: DevExpress.common.SelectedDateType; /** * [descr:dxDateRangeBoxOptions.endDateInputAttr] */ @@ -12180,7 +12179,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.startDate] */ - startDate?: Date | number | string; + startDate?: DevExpress.common.SelectedDateType; /** * [descr:dxDateRangeBoxOptions.startDateInputAttr] */ @@ -12208,7 +12207,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.value] */ - value?: Array; + value?: Array; }; /** * [descr:_ui_date_range_box_ValueChangedEvent] diff --git a/packages/vue2-strategy/src/calendar.ts b/packages/vue2-strategy/src/calendar.ts index d8c402795e45..d0a21dbe948a 100644 --- a/packages/vue2-strategy/src/calendar.ts +++ b/packages/vue2-strategy/src/calendar.ts @@ -38,7 +38,6 @@ type AccessibleOptions = Pick Date: Wed, 6 Sep 2023 14:36:06 +0200 Subject: [PATCH 2/4] rework --- .../src/ui/calendar/index.ts | 31 +++---------------- .../src/ui/nested/base/calendar-options.ts | 11 ++----- .../src/ui/nested/calendar-options.ts | 3 +- packages/devextreme-react/src/calendar.ts | 5 ++- packages/devextreme-react/src/common/index.ts | 1 - packages/devextreme-react/src/date-box.ts | 15 +++++---- .../devextreme-react/src/date-range-box.ts | 23 +++++++------- packages/devextreme-vue/src/common/index.ts | 1 - packages/devextreme/js/common.d.ts | 7 ----- packages/devextreme/js/ui/calendar.d.ts | 7 ++--- packages/devextreme/js/ui/date_box.d.ts | 10 ++---- packages/devextreme/js/ui/date_range_box.d.ts | 10 ++---- packages/devextreme/ts/dx.all.d.ts | 21 ++++++------- packages/vue2-strategy/src/common/index.ts | 1 - 14 files changed, 46 insertions(+), 100 deletions(-) diff --git a/packages/devextreme-angular/src/ui/calendar/index.ts b/packages/devextreme-angular/src/ui/calendar/index.ts index 7b49f90d5727..38a64c85251f 100644 --- a/packages/devextreme-angular/src/ui/calendar/index.ts +++ b/packages/devextreme-angular/src/ui/calendar/index.ts @@ -478,27 +478,14 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr */ @Input() - get value(): Date | number | string { + get value(): Date | number | string | Array { return this._getOption('value'); } - set value(value: Date | number | string) { + set value(value: Date | number | string | Array) { this._setOption('value', value); } - /** - * [descr:dxCalendarOptions.values] - - */ - @Input() - get values(): Array { - return this._getOption('values'); - } - set values(value: Array) { - this._setOption('values', value); - } - - /** * [descr:WidgetOptions.visible] @@ -804,14 +791,7 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr * This member supports the internal infrastructure and is not intended to be used directly from your code. */ - @Output() valueChange: EventEmitter; - - /** - - * This member supports the internal infrastructure and is not intended to be used directly from your code. - - */ - @Output() valuesChange: EventEmitter>; + @Output() valueChange: EventEmitter>; /** @@ -903,7 +883,6 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr { emit: 'validationMessagePositionChange' }, { emit: 'validationStatusChange' }, { emit: 'valueChange' }, - { emit: 'valuesChange' }, { emit: 'visibleChange' }, { emit: 'weekNumberRuleChange' }, { emit: 'widthChange' }, @@ -949,7 +928,7 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr super.ngOnChanges(changes); this.setupChanges('disabledDates', changes); this.setupChanges('validationErrors', changes); - this.setupChanges('values', changes); + this.setupChanges('value', changes); } setupChanges(prop: string, changes: SimpleChanges) { @@ -961,7 +940,7 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr ngDoCheck() { this._idh.doCheck('disabledDates'); this._idh.doCheck('validationErrors'); - this._idh.doCheck('values'); + this._idh.doCheck('value'); this._watcherHelper.checkWatchers(); super.ngDoCheck(); super.clearChangedOptions(); diff --git a/packages/devextreme-angular/src/ui/nested/base/calendar-options.ts b/packages/devextreme-angular/src/ui/nested/base/calendar-options.ts index 89576ea2b3a6..5b10c45348a8 100644 --- a/packages/devextreme-angular/src/ui/nested/base/calendar-options.ts +++ b/packages/devextreme-angular/src/ui/nested/base/calendar-options.ts @@ -256,20 +256,13 @@ export abstract class DxoCalendarOptions extends NestedOption { this._setOption('validationStatus', value); } - get value(): Date | number | string { + get value(): Date | number | string | Array { return this._getOption('value'); } - set value(value: Date | number | string) { + set value(value: Date | number | string | Array) { this._setOption('value', value); } - get values(): Array { - return this._getOption('values'); - } - set values(value: Array) { - this._setOption('values', value); - } - get visible(): boolean { return this._getOption('visible'); } diff --git a/packages/devextreme-angular/src/ui/nested/calendar-options.ts b/packages/devextreme-angular/src/ui/nested/calendar-options.ts index 21d99e25c021..4deda9a6dec2 100644 --- a/packages/devextreme-angular/src/ui/nested/calendar-options.ts +++ b/packages/devextreme-angular/src/ui/nested/calendar-options.ts @@ -65,7 +65,6 @@ import { DxoCalendarOptions } from './base/calendar-options'; 'validationMessagePosition', 'validationStatus', 'value', - 'values', 'visible', 'weekNumberRule', 'width', @@ -79,7 +78,7 @@ export class DxoCalendarOptionsComponent extends DxoCalendarOptions implements O * This member supports the internal infrastructure and is not intended to be used directly from your code. */ - @Output() valueChange: EventEmitter; + @Output() valueChange: EventEmitter>; /** diff --git a/packages/devextreme-react/src/calendar.ts b/packages/devextreme-react/src/calendar.ts index d04676b0a55c..3a1d25bc483e 100644 --- a/packages/devextreme-react/src/calendar.ts +++ b/packages/devextreme-react/src/calendar.ts @@ -5,7 +5,6 @@ import dxCalendar, { import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; -import type { SelectedDateType } from "devextreme/common"; import type { DisposingEvent, InitializedEvent, ValueChangedEvent } from "devextreme/ui/calendar"; type ReplaceFieldTypes = { @@ -22,9 +21,9 @@ type ICalendarOptions = React.PropsWithChildren React.ReactNode; cellComponent?: React.ComponentType; cellKeyFn?: (data: any) => string; - defaultValue?: Array | SelectedDateType; + defaultValue?: any | Array | number | string; defaultZoomLevel?: "century" | "decade" | "month" | "year"; - onValueChange?: (value: Array | SelectedDateType) => void; + onValueChange?: (value: any | Array | number | string) => void; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; }> diff --git a/packages/devextreme-react/src/common/index.ts b/packages/devextreme-react/src/common/index.ts index 6474d4f976f1..3460bb4dba76 100644 --- a/packages/devextreme-react/src/common/index.ts +++ b/packages/devextreme-react/src/common/index.ts @@ -39,7 +39,6 @@ export { ScrollMode, SearchMode, SelectAllMode, - SelectedDateType, SimplifiedSearchMode, SingleMultipleAllOrNone, SingleMultipleOrNone, diff --git a/packages/devextreme-react/src/date-box.ts b/packages/devextreme-react/src/date-box.ts index c1883a42bb80..86d8258e7ee8 100644 --- a/packages/devextreme-react/src/date-box.ts +++ b/packages/devextreme-react/src/date-box.ts @@ -6,7 +6,6 @@ import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; import NestedOption from "./core/nested-option"; -import type { SelectedDateType } from "devextreme/common"; import type { ChangeEvent, ClosedEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, KeyDownEvent, KeyUpEvent, OpenedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/date_box"; import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, OptionChangedEvent as ButtonOptionChangedEvent, ClickEvent } from "devextreme/ui/button"; import type { DisposingEvent as CalendarDisposingEvent, InitializedEvent as CalendarInitializedEvent, ValueChangedEvent as CalendarValueChangedEvent, DisabledDate, OptionChangedEvent } from "devextreme/ui/calendar"; @@ -50,9 +49,9 @@ type IDateBoxOptions = React.PropsWithChildren; dropDownButtonKeyFn?: (data: any) => string; defaultOpened?: boolean; - defaultValue?: SelectedDateType; + defaultValue?: any | number | string; onOpenedChange?: (value: boolean) => void; - onValueChange?: (value: SelectedDateType) => void; + onValueChange?: (value: any | number | string) => void; }> class DateBox extends BaseComponent> { @@ -295,9 +294,9 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ hoverStateEnabled?: boolean; isDirty?: boolean; isValid?: boolean; - max?: SelectedDateType; + max?: any | number | string; maxZoomLevel?: "century" | "decade" | "month" | "year"; - min?: SelectedDateType; + min?: any | number | string; minZoomLevel?: "century" | "decade" | "month" | "year"; name?: string; onDisposing?: ((e: CalendarDisposingEvent) => void); @@ -316,13 +315,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ validationMessageMode?: "always" | "auto"; validationMessagePosition?: "bottom" | "left" | "right" | "top"; validationStatus?: "valid" | "invalid" | "pending"; - value?: Array | SelectedDateType; + value?: any | Array | number | string; visible?: boolean; weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays"; width?: (() => number | string) | number | string; zoomLevel?: "century" | "decade" | "month" | "year"; - defaultValue?: Array | SelectedDateType; - onValueChange?: (value: Array | SelectedDateType) => void; + defaultValue?: any | Array | number | string; + onValueChange?: (value: any | Array | number | string) => void; defaultZoomLevel?: "century" | "decade" | "month" | "year"; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; cellRender?: (...params: any) => React.ReactNode; diff --git a/packages/devextreme-react/src/date-range-box.ts b/packages/devextreme-react/src/date-range-box.ts index 001cdd06a68e..47d771f3c1ea 100644 --- a/packages/devextreme-react/src/date-range-box.ts +++ b/packages/devextreme-react/src/date-range-box.ts @@ -6,7 +6,6 @@ import * as PropTypes from "prop-types"; import { Component as BaseComponent, IHtmlOptions } from "./core/component"; import NestedOption from "./core/nested-option"; -import type { SelectedDateType } from "devextreme/common"; import type { ChangeEvent, ClosedEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, KeyDownEvent, KeyUpEvent, OpenedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/date_range_box"; import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, OptionChangedEvent as ButtonOptionChangedEvent, ClickEvent } from "devextreme/ui/button"; import type { DisposingEvent as CalendarDisposingEvent, InitializedEvent as CalendarInitializedEvent, ValueChangedEvent as CalendarValueChangedEvent, DisabledDate, OptionChangedEvent } from "devextreme/ui/calendar"; @@ -49,14 +48,14 @@ type IDateRangeBoxOptions = React.PropsWithChildren React.ReactNode; dropDownButtonComponent?: React.ComponentType; dropDownButtonKeyFn?: (data: any) => string; - defaultEndDate?: SelectedDateType; + defaultEndDate?: any | number | string; defaultOpened?: boolean; - defaultStartDate?: SelectedDateType; - defaultValue?: Array; - onEndDateChange?: (value: SelectedDateType) => void; + defaultStartDate?: any | number | string; + defaultValue?: Array; + onEndDateChange?: (value: any | number | string) => void; onOpenedChange?: (value: boolean) => void; - onStartDateChange?: (value: SelectedDateType) => void; - onValueChange?: (value: Array) => void; + onStartDateChange?: (value: any | number | string) => void; + onValueChange?: (value: Array) => void; }> class DateRangeBox extends BaseComponent> { @@ -282,9 +281,9 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ hoverStateEnabled?: boolean; isDirty?: boolean; isValid?: boolean; - max?: SelectedDateType; + max?: any | number | string; maxZoomLevel?: "century" | "decade" | "month" | "year"; - min?: SelectedDateType; + min?: any | number | string; minZoomLevel?: "century" | "decade" | "month" | "year"; name?: string; onDisposing?: ((e: CalendarDisposingEvent) => void); @@ -303,13 +302,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{ validationMessageMode?: "always" | "auto"; validationMessagePosition?: "bottom" | "left" | "right" | "top"; validationStatus?: "valid" | "invalid" | "pending"; - value?: Array | SelectedDateType; + value?: any | Array | number | string; visible?: boolean; weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays"; width?: (() => number | string) | number | string; zoomLevel?: "century" | "decade" | "month" | "year"; - defaultValue?: Array | SelectedDateType; - onValueChange?: (value: Array | SelectedDateType) => void; + defaultValue?: any | Array | number | string; + onValueChange?: (value: any | Array | number | string) => void; defaultZoomLevel?: "century" | "decade" | "month" | "year"; onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void; cellRender?: (...params: any) => React.ReactNode; diff --git a/packages/devextreme-vue/src/common/index.ts b/packages/devextreme-vue/src/common/index.ts index 6474d4f976f1..3460bb4dba76 100644 --- a/packages/devextreme-vue/src/common/index.ts +++ b/packages/devextreme-vue/src/common/index.ts @@ -39,7 +39,6 @@ export { ScrollMode, SearchMode, SelectAllMode, - SelectedDateType, SimplifiedSearchMode, SingleMultipleAllOrNone, SingleMultipleOrNone, diff --git a/packages/devextreme/js/common.d.ts b/packages/devextreme/js/common.d.ts index da0a03a1421b..d913b78a4e0f 100644 --- a/packages/devextreme/js/common.d.ts +++ b/packages/devextreme/js/common.d.ts @@ -601,13 +601,6 @@ export type SearchMode = 'contains' | 'startswith' | 'equals'; */ export type SelectAllMode = 'allPages' | 'page'; -/** - * @docid - * @public - * @namespace DevExpress.common - */ -export type SelectedDateType = Date | string | number | null; - /** * @public * @namespace DevExpress.common diff --git a/packages/devextreme/js/ui/calendar.d.ts b/packages/devextreme/js/ui/calendar.d.ts index 0f1dad32d2a1..46a8930f1ed5 100644 --- a/packages/devextreme/js/ui/calendar.d.ts +++ b/packages/devextreme/js/ui/calendar.d.ts @@ -21,7 +21,6 @@ import Editor, { import { FirstDayOfWeek, - SelectedDateType, } from '../common'; export { @@ -148,7 +147,7 @@ export interface dxCalendarOptions extends EditorOptions { * @default new Date(3000, 0) * @public */ - max?: SelectedDateType; + max?: Date | number | string; /** * @docid * @default 'month' @@ -160,7 +159,7 @@ export interface dxCalendarOptions extends EditorOptions { * @default new Date(1000, 0) * @public */ - min?: SelectedDateType; + min?: Date | number | string; /** * @docid * @default 'century' @@ -210,7 +209,7 @@ export interface dxCalendarOptions extends EditorOptions { * @default [null,null] &for(range selection mode) * @public */ - value?: SelectedDateType | Array; + value?: Date | number | string | Array; /** * @docid * @default 'month' diff --git a/packages/devextreme/js/ui/date_box.d.ts b/packages/devextreme/js/ui/date_box.d.ts index 271ae959fcde..27074ca9471d 100644 --- a/packages/devextreme/js/ui/date_box.d.ts +++ b/packages/devextreme/js/ui/date_box.d.ts @@ -28,10 +28,6 @@ import { Properties as PopupProperties, } from './popup'; -import { - SelectedDateType, - } from '../common'; - /** @public */ export type DateType = 'date' | 'datetime' | 'time'; /** @public */ @@ -281,7 +277,7 @@ export interface dxDateBoxOptions extends DateBoxBaseOptions { * @default null * @public */ - value?: SelectedDateType; + value?: Date | number | string; } /** @@ -325,13 +321,13 @@ export interface DateBoxBaseOptions extends dxDropDownEditorOptions< * @default undefined * @public */ - max?: SelectedDateType; + max?: Date | number | string; /** * @docid * @default undefined * @public */ - min?: SelectedDateType; + min?: Date | number | string; /** * @docid * @default "Today" diff --git a/packages/devextreme/js/ui/date_range_box.d.ts b/packages/devextreme/js/ui/date_range_box.d.ts index 35f86a35d358..b54591f51eee 100644 --- a/packages/devextreme/js/ui/date_range_box.d.ts +++ b/packages/devextreme/js/ui/date_range_box.d.ts @@ -20,10 +20,6 @@ import { ValueChangedInfo, } from './editor/editor'; -import { - SelectedDateType, -} from '../common'; - /** * @docid _ui_date_range_box_ChangeEvent * @public @@ -184,7 +180,7 @@ export type Properties = Omit, 'inputAttr' | * @public * @fires dxDateRangeBoxOptions.onOptionChanged */ - endDate?: SelectedDateType; + endDate?: Date | number | string; /** * @docid dxDateRangeBoxOptions.endDateInputAttr * @default {} @@ -253,7 +249,7 @@ export type Properties = Omit, 'inputAttr' | * @public * @fires dxDateRangeBoxOptions.onOptionChanged */ - startDate?: SelectedDateType; + startDate?: Date | number | string; /** * @docid dxDateRangeBoxOptions.startDateInputAttr * @default {} @@ -295,7 +291,7 @@ export type Properties = Omit, 'inputAttr' | * @default [null,null] * @public */ - value?: Array; + value?: Array; }; /** diff --git a/packages/devextreme/ts/dx.all.d.ts b/packages/devextreme/ts/dx.all.d.ts index d1728e8348b7..d00ea9509ff9 100644 --- a/packages/devextreme/ts/dx.all.d.ts +++ b/packages/devextreme/ts/dx.all.d.ts @@ -1724,7 +1724,6 @@ declare module DevExpress.common { export type ScrollMode = 'standard' | 'virtual'; export type SearchMode = 'contains' | 'startswith' | 'equals'; export type SelectAllMode = 'allPages' | 'page'; - export type SelectedDateType = Date | string | number | null; export type SimplifiedSearchMode = 'contains' | 'startswith'; export type SingleMultipleAllOrNone = 'single' | 'multiple' | 'all' | 'none'; export type SingleMultipleOrNone = 'single' | 'multiple' | 'none'; @@ -7883,11 +7882,11 @@ declare module DevExpress.ui { /** * [descr:DateBoxBaseOptions.max] */ - max?: DevExpress.common.SelectedDateType; + max?: Date | number | string; /** * [descr:DateBoxBaseOptions.min] */ - min?: DevExpress.common.SelectedDateType; + min?: Date | number | string; /** * [descr:DateBoxBaseOptions.todayButtonText] */ @@ -9039,7 +9038,7 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.max] */ - max?: DevExpress.common.SelectedDateType; + max?: Date | number | string; /** * [descr:dxCalendarOptions.maxZoomLevel] */ @@ -9047,7 +9046,7 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.min] */ - min?: DevExpress.common.SelectedDateType; + min?: Date | number | string; /** * [descr:dxCalendarOptions.minZoomLevel] */ @@ -9079,9 +9078,7 @@ declare module DevExpress.ui { /** * [descr:dxCalendarOptions.value] */ - value?: - | DevExpress.common.SelectedDateType - | Array; + value?: Date | number | string | Array; /** * [descr:dxCalendarOptions.zoomLevel] */ @@ -12005,7 +12002,7 @@ declare module DevExpress.ui { /** * [descr:dxDateBoxOptions.value] */ - value?: DevExpress.common.SelectedDateType; + value?: Date | number | string; } /** * [descr:dxDateRangeBox] @@ -12135,7 +12132,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.endDate] */ - endDate?: DevExpress.common.SelectedDateType; + endDate?: Date | number | string; /** * [descr:dxDateRangeBoxOptions.endDateInputAttr] */ @@ -12179,7 +12176,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.startDate] */ - startDate?: DevExpress.common.SelectedDateType; + startDate?: Date | number | string; /** * [descr:dxDateRangeBoxOptions.startDateInputAttr] */ @@ -12207,7 +12204,7 @@ declare module DevExpress.ui { /** * [descr:dxDateRangeBoxOptions.value] */ - value?: Array; + value?: Array; }; /** * [descr:_ui_date_range_box_ValueChangedEvent] diff --git a/packages/vue2-strategy/src/common/index.ts b/packages/vue2-strategy/src/common/index.ts index 6474d4f976f1..3460bb4dba76 100644 --- a/packages/vue2-strategy/src/common/index.ts +++ b/packages/vue2-strategy/src/common/index.ts @@ -39,7 +39,6 @@ export { ScrollMode, SearchMode, SelectAllMode, - SelectedDateType, SimplifiedSearchMode, SingleMultipleAllOrNone, SingleMultipleOrNone, From aa4205ad8ce13e19df6b85abd93c6e647ead9fa0 Mon Sep 17 00:00:00 2001 From: Alexander Kozlovskiy Date: Wed, 6 Sep 2023 14:59:35 +0200 Subject: [PATCH 3/4] rm excess changes --- .../npm/children-processing.d.ts | 4 - .../vue2-strategy/npm/children-processing.js | 40 --- packages/vue2-strategy/npm/component.d.ts | 24 -- packages/vue2-strategy/npm/component.js | 237 ---------------- packages/vue2-strategy/npm/config.d.ts | 7 - packages/vue2-strategy/npm/config.js | 25 -- .../npm/configuration-component.d.ts | 24 -- .../npm/configuration-component.js | 81 ------ packages/vue2-strategy/npm/configuration.d.ts | 59 ---- packages/vue2-strategy/npm/configuration.js | 257 ------------------ packages/vue2-strategy/npm/constants.d.ts | 3 - packages/vue2-strategy/npm/constants.js | 7 - packages/vue2-strategy/npm/errors.d.ts | 1 - packages/vue2-strategy/npm/errors.js | 4 - .../npm/extension-component.d.ts | 10 - .../vue2-strategy/npm/extension-component.js | 22 -- packages/vue2-strategy/npm/helpers.d.ts | 22 -- packages/vue2-strategy/npm/helpers.js | 86 ------ packages/vue2-strategy/npm/index.d.ts | 3 - packages/vue2-strategy/npm/index.js | 42 --- .../npm/templates-discovering.d.ts | 8 - .../npm/templates-discovering.js | 96 ------- .../vue2-strategy/npm/templates-manager.d.ts | 15 - .../vue2-strategy/npm/templates-manager.js | 92 ------- 24 files changed, 1169 deletions(-) delete mode 100644 packages/vue2-strategy/npm/children-processing.d.ts delete mode 100644 packages/vue2-strategy/npm/children-processing.js delete mode 100644 packages/vue2-strategy/npm/component.d.ts delete mode 100644 packages/vue2-strategy/npm/component.js delete mode 100644 packages/vue2-strategy/npm/config.d.ts delete mode 100644 packages/vue2-strategy/npm/config.js delete mode 100644 packages/vue2-strategy/npm/configuration-component.d.ts delete mode 100644 packages/vue2-strategy/npm/configuration-component.js delete mode 100644 packages/vue2-strategy/npm/configuration.d.ts delete mode 100644 packages/vue2-strategy/npm/configuration.js delete mode 100644 packages/vue2-strategy/npm/constants.d.ts delete mode 100644 packages/vue2-strategy/npm/constants.js delete mode 100644 packages/vue2-strategy/npm/errors.d.ts delete mode 100644 packages/vue2-strategy/npm/errors.js delete mode 100644 packages/vue2-strategy/npm/extension-component.d.ts delete mode 100644 packages/vue2-strategy/npm/extension-component.js delete mode 100644 packages/vue2-strategy/npm/helpers.d.ts delete mode 100644 packages/vue2-strategy/npm/helpers.js delete mode 100644 packages/vue2-strategy/npm/index.d.ts delete mode 100644 packages/vue2-strategy/npm/index.js delete mode 100644 packages/vue2-strategy/npm/templates-discovering.d.ts delete mode 100644 packages/vue2-strategy/npm/templates-discovering.js delete mode 100644 packages/vue2-strategy/npm/templates-manager.d.ts delete mode 100644 packages/vue2-strategy/npm/templates-manager.js diff --git a/packages/vue2-strategy/npm/children-processing.d.ts b/packages/vue2-strategy/npm/children-processing.d.ts deleted file mode 100644 index e060318aad22..000000000000 --- a/packages/vue2-strategy/npm/children-processing.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { VNode } from "vue"; -import Configuration from "./configuration"; -declare function pullAllChildren(directChildren: VNode[], allChildren: VNode[], config: Configuration): void; -export { pullAllChildren }; diff --git a/packages/vue2-strategy/npm/children-processing.js b/packages/vue2-strategy/npm/children-processing.js deleted file mode 100644 index 102a1978a7a2..000000000000 --- a/packages/vue2-strategy/npm/children-processing.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pullAllChildren = void 0; -function pullAllChildren(directChildren, allChildren, config) { - if (!directChildren || directChildren.length === 0) { - return; - } - pullConfigComponents(directChildren, allChildren, config); -} -exports.pullAllChildren = pullAllChildren; -function pullConfigComponents(children, nodes, ownerConfig) { - children.forEach(function (node) { - nodes.push(node); - if (!node.componentOptions) { - return; - } - var configComponent = node.componentOptions.Ctor; - if (!configComponent.$_optionName) { - return; - } - var initialValues = __assign(__assign({}, configComponent.$_predefinedProps), node.componentOptions.propsData); - var config = ownerConfig.createNested(configComponent.$_optionName, initialValues, configComponent.$_isCollectionItem, configComponent.$_expectedChildren); - node.componentOptions.$_config = config; - node.componentOptions.$_innerChanges = {}; - if (node.componentOptions.children) { - pullConfigComponents(node.componentOptions.children, nodes, config); - } - }); -} diff --git a/packages/vue2-strategy/npm/component.d.ts b/packages/vue2-strategy/npm/component.d.ts deleted file mode 100644 index a622d3db0b68..000000000000 --- a/packages/vue2-strategy/npm/component.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import IVue, { VueConstructor } from "vue"; -import { IConfigurable } from "./configuration-component"; -import { IEventBusHolder } from "./templates-discovering"; -import { TemplatesManager } from "./templates-manager"; -interface IWidgetComponent extends IConfigurable { - $_instance: any; - $_WidgetClass: any; - $_pendingOptions: Record; - $_templatesManager: TemplatesManager; -} -interface IBaseComponent extends IVue, IWidgetComponent, IEventBusHolder { - $_isExtension: boolean; - $_applyConfigurationChanges: () => void; - $_createWidget: (element: any) => void; - $_getIntegrationOptions: () => void; - $_getExtraIntegrationOptions: () => void; - $_getWatchMethod: () => void; - $_createEmitters: () => void; - $_processChildren: () => void; - $_getTemplates: () => object; -} -declare const BaseComponent: () => VueConstructor; -declare const DxComponent: () => VueConstructor; -export { DxComponent, BaseComponent, IWidgetComponent }; diff --git a/packages/vue2-strategy/npm/component.js b/packages/vue2-strategy/npm/component.js deleted file mode 100644 index a4e837cd9cb8..000000000000 --- a/packages/vue2-strategy/npm/component.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BaseComponent = exports.DxComponent = void 0; -var VueType = __importStar(require("vue")); -var events_1 = require("devextreme/events"); -var children_processing_1 = require("./children-processing"); -var configuration_1 = __importStar(require("./configuration")); -var configuration_component_1 = require("./configuration-component"); -var constants_1 = require("./constants"); -var helpers_1 = require("./helpers"); -var templates_manager_1 = require("./templates-manager"); -var Vue = VueType.default || VueType; -var BaseComponent = function () { return Vue.extend({ - inheritAttrs: false, - data: function () { - return { - eventBus: new Vue() - }; - }, - provide: function () { - return { - eventBus: this.eventBus - }; - }, - render: function (createElement) { - var children = []; - if (this.$_config.cleanNested) { - this.$_config.cleanNested(); - } - children_processing_1.pullAllChildren(this.$slots.default, children, this.$_config); - this.$_processChildren(children); - return createElement("div", { - attrs: { id: this.$attrs.id } - }, children); - }, - beforeUpdate: function () { - this.$_config.setPrevNestedOptions(this.$_config.getNestedOptionValues()); - }, - updated: function () { - var _a, _b; - this.$children.forEach(function (child) { return configuration_component_1.initOptionChangedFunc(configuration_component_1.getConfig(child), child, configuration_component_1.getInnerChanges(child)); }); - this.$_templatesManager.discover(); - this.$_instance.beginUpdate(); - this.$_applyConfigurationChanges(); - if (this.$_templatesManager.isDirty) { - this.$_instance.option("integrationOptions.templates", this.$_templatesManager.templates); - var props = (_b = (_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.componentOptions) === null || _b === void 0 ? void 0 : _b.propsData; - for (var _i = 0, _c = Object.keys(this.$_templatesManager.templates); _i < _c.length; _i++) { - var name_1 = _c[_i]; - this.$_instance.option(helpers_1.getTemplatePropName(props, name_1), name_1); - } - this.$_templatesManager.resetDirtyFlag(); - } - for (var _d = 0, _e = Object.keys(this.$_pendingOptions); _d < _e.length; _d++) { - var name_2 = _e[_d]; - this.$_instance.option(name_2, this.$_pendingOptions[name_2]); - } - this.$_pendingOptions = {}; - this.$_instance.endUpdate(); - this.eventBus.$emit("updated"); - }, - beforeDestroy: function () { - var instance = this.$_instance; - if (instance) { - events_1.triggerHandler(this.$el, constants_1.DX_REMOVE_EVENT); - instance.dispose(); - } - }, - created: function () { - var _this = this; - this.$_config = new configuration_1.default(function (n, v) { return _this.$_pendingOptions[n] = v; }, null, this.$options.propsData && __assign({}, this.$options.propsData), this.$_expectedChildren); - this.$_innerChanges = {}; - this.$_config.init(this.$props && Object.keys(this.$props)); - }, - methods: { - $_applyConfigurationChanges: function () { - var _this = this; - this.$_config.componentsCountChanged.forEach(function (_a) { - var optionPath = _a.optionPath, isCollection = _a.isCollection, removed = _a.removed; - var options = _this.$_config.getNestedOptionValues(); - if (!isCollection && removed) { - _this.$_instance.resetOption(optionPath); - } - else { - _this.$_instance.option(optionPath, helpers_1.getOptionValue(options, optionPath)); - } - }); - this.$_config.cleanComponentsCountChanged(); - }, - $_createWidget: function (element) { - var thisComponent = this; - thisComponent.$_pendingOptions = {}; - thisComponent.$_templatesManager = new templates_manager_1.TemplatesManager(this); - var config = this.$_config; - var options = __assign(__assign(__assign(__assign({}, this.$options.propsData), config.initialValues), config.getNestedOptionValues()), this.$_getIntegrationOptions()); - var instance = new this.$_WidgetClass(element, options); - thisComponent.$_instance = instance; - instance.on("optionChanged", function (args) { return config.onOptionChanged(args); }); - configuration_1.setEmitOptionChangedFunc(config, this, this.$_innerChanges); - configuration_1.bindOptionWatchers(config, this, this.$_innerChanges); - this.$_createEmitters(instance); - }, - $_getIntegrationOptions: function () { - var _a, _b; - var result = __assign({ integrationOptions: { - watchMethod: this.$_getWatchMethod(), - } }, this.$_getExtraIntegrationOptions()); - if (this.$_templatesManager.isDirty) { - var templates = this.$_templatesManager.templates; - result.integrationOptions.templates = templates; - var props = (_b = (_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.componentOptions) === null || _b === void 0 ? void 0 : _b.propsData; - for (var _i = 0, _c = Object.keys(templates); _i < _c.length; _i++) { - var name_3 = _c[_i]; - result[helpers_1.getTemplatePropName(props, name_3)] = name_3; - } - this.$_templatesManager.resetDirtyFlag(); - } - return result; - }, - $_getWatchMethod: function () { - var _this = this; - return function (valueGetter, valueChangeCallback, options) { - options = options || {}; - if (!options.skipImmediate) { - valueChangeCallback(valueGetter()); - } - return _this.$watch(function () { - return valueGetter(); - }, function (newValue, oldValue) { - if (helpers_1.toComparable(oldValue) !== helpers_1.toComparable(newValue) || options.deep) { - valueChangeCallback(newValue); - } - }, { - deep: options.deep - }); - }; - }, - $_getExtraIntegrationOptions: function () { - return {}; - }, - $_processChildren: function (_children) { - return; - }, - $_createEmitters: function (instance) { - var _this = this; - Object.keys(this.$listeners).forEach(function (listenerName) { - var eventName = helpers_1.camelize(listenerName); - instance.on(eventName, function (e) { - _this.$emit(listenerName, e); - }); - }); - } - } -}); }; -exports.BaseComponent = BaseComponent; -function cleanWidgetNode(node) { - var removedNodes = []; - helpers_1.forEachChildNode(node, function (childNode) { - var parent = childNode.parentNode; - var isExtension = childNode.hasAttribute && childNode.hasAttribute("isExtension"); - if ((childNode.nodeName === "#comment" || isExtension) && parent) { - removedNodes.push(childNode); - parent.removeChild(childNode); - } - }); - return removedNodes; -} -function restoreNodes(el, nodes) { - nodes.forEach(function (node) { - el.appendChild(node); - }); -} -var DxComponent = function () { return BaseComponent().extend({ - methods: { - $_getExtraIntegrationOptions: function () { - return { - onInitializing: function () { - this.beginUpdate(); - } - }; - }, - $_processChildren: function (children) { - children.forEach(function (childNode) { - if (!childNode.componentOptions) { - return; - } - childNode.componentOptions.$_hasOwner = true; - }); - }, - }, - mounted: function () { - var _this = this; - var nodes = cleanWidgetNode(this.$el); - this.$_createWidget(this.$el); - this.$_instance.endUpdate(); - restoreNodes(this.$el, nodes); - if (this.$slots && this.$slots.default) { - this.$slots.default.forEach(function (child) { - var childExtension = child.componentInstance; - if (childExtension && childExtension.$_isExtension) { - childExtension.attachTo(_this.$el); - } - }); - } - } -}); }; -exports.DxComponent = DxComponent; diff --git a/packages/vue2-strategy/npm/config.d.ts b/packages/vue2-strategy/npm/config.d.ts deleted file mode 100644 index 9d614e3e3fa0..000000000000 --- a/packages/vue2-strategy/npm/config.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -interface IOptions { - useLegacyTemplateEngine: boolean; -} -declare function setOptions(options: Partial): void; -declare function getOption(optionName: TName): IOptions[TName]; -export default setOptions; -export { getOption }; diff --git a/packages/vue2-strategy/npm/config.js b/packages/vue2-strategy/npm/config.js deleted file mode 100644 index 8d824a3e970f..000000000000 --- a/packages/vue2-strategy/npm/config.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOption = void 0; -var config = { - useLegacyTemplateEngine: false -}; -function setOptions(options) { - config = __assign(__assign({}, config), options); -} -function getOption(optionName) { - return config[optionName]; -} -exports.getOption = getOption; -exports.default = setOptions; diff --git a/packages/vue2-strategy/npm/configuration-component.d.ts b/packages/vue2-strategy/npm/configuration-component.d.ts deleted file mode 100644 index 17946e3d3ddf..000000000000 --- a/packages/vue2-strategy/npm/configuration-component.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import IVue, { VueConstructor } from "vue"; -import Configuration, { ExpectedChild } from "./configuration"; -interface IConfigurationOwner { - $_expectedChildren: Record; -} -interface IConfigurationComponent extends IConfigurationOwner { - $_optionName: string; - $_isCollectionItem: boolean; - $_predefinedProps: Record; -} -interface IConfigurable extends IConfigurationOwner { - $_config: Configuration; - $_innerChanges: any; -} -interface IComponentInfo { - optionPath: string; - isCollection: boolean; - removed?: boolean; -} -declare function getConfig(vueInstance: Pick): Configuration | undefined; -declare function getInnerChanges(vueInstance: Pick): any; -declare function initOptionChangedFunc(config: any, vueInstance: Pick, innerChanges: any): void; -declare const DxConfiguration: () => VueConstructor; -export { DxConfiguration, IComponentInfo, IConfigurable, IConfigurationComponent, initOptionChangedFunc, getConfig, getInnerChanges }; diff --git a/packages/vue2-strategy/npm/configuration-component.js b/packages/vue2-strategy/npm/configuration-component.js deleted file mode 100644 index f8b2224abaaf..000000000000 --- a/packages/vue2-strategy/npm/configuration-component.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getInnerChanges = exports.getConfig = exports.initOptionChangedFunc = exports.DxConfiguration = void 0; -var VueType = __importStar(require("vue")); -var Vue = VueType.default || VueType; -var configuration_1 = require("./configuration"); -function getConfig(vueInstance) { - if (!vueInstance.$vnode) { - return; - } - var componentOptions = vueInstance.$vnode.componentOptions; - return componentOptions && componentOptions.$_config; -} -exports.getConfig = getConfig; -function getInnerChanges(vueInstance) { - if (!vueInstance.$vnode) { - return; - } - var componentOptions = vueInstance.$vnode.componentOptions; - return componentOptions && componentOptions.$_innerChanges; -} -exports.getInnerChanges = getInnerChanges; -function initOptionChangedFunc(config, vueInstance, innerChanges) { - if (!config) { - return; - } - config.init(Object.keys(vueInstance.$props)); - configuration_1.setEmitOptionChangedFunc(config, vueInstance, innerChanges); -} -exports.initOptionChangedFunc = initOptionChangedFunc; -function getComponentInfo(_a, removed) { - var name = _a.name, isCollectionItem = _a.isCollectionItem, ownerConfig = _a.ownerConfig; - var parentPath = ownerConfig && ownerConfig.fullPath; - var optionPath = name && parentPath ? parentPath + "." + name : name || ""; - return { - optionPath: optionPath, - isCollection: isCollectionItem, - removed: removed - }; -} -var DxConfiguration = function () { return Vue.extend({ - beforeMount: function () { - var config = getConfig(this); - var innerChanges = getInnerChanges(this); - initOptionChangedFunc(config, this, innerChanges); - configuration_1.bindOptionWatchers(config, this, innerChanges); - }, - mounted: function () { - if (this.$parent.$_instance) { - this.$parent.$_config.componentsCountChanged - .push(getComponentInfo(getConfig(this))); - } - }, - beforeDestroy: function () { - this.$parent.$_config.componentsCountChanged - .push(getComponentInfo(getConfig(this), true)); - }, - render: function (createElement) { - return createElement(); - } -}); }; -exports.DxConfiguration = DxConfiguration; diff --git a/packages/vue2-strategy/npm/configuration.d.ts b/packages/vue2-strategy/npm/configuration.d.ts deleted file mode 100644 index fdb53b8880e1..000000000000 --- a/packages/vue2-strategy/npm/configuration.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Vue } from "vue/types/vue"; -import { IComponentInfo } from "./configuration-component"; -declare type UpdateFunc = (name: string, value: any) => void; -declare type EmitOptionChangedFunc = (name: string, value: any) => void; -interface ExpectedChild { - isCollectionItem: boolean; - optionName: string; -} -interface IOptionChangedArgs { - fullName: string; - value: any; - previousValue: any; - component: any; -} -declare class Configuration { - private readonly _name; - private readonly _isCollectionItem; - private readonly _collectionItemIndex; - private readonly _initialValues; - private readonly _expectedChildren; - private readonly _updateFunc; - private readonly _ownerConfig; - private _nestedConfigurations; - private _prevNestedConfigOptions; - private _emitOptionChanged; - private _componentChanges; - private _options; - constructor(updateFunc: UpdateFunc, name: string | null, initialValues: Record, expectedChildren?: Record, isCollectionItem?: boolean, collectionItemIndex?: number, ownerConfig?: Pick | undefined); - get name(): string | null; - get fullName(): string | null; - get componentsCountChanged(): IComponentInfo[]; - cleanComponentsCountChanged(): void; - get fullPath(): string | null; - get ownerConfig(): Pick | undefined; - get options(): string[]; - get initialValues(): Record; - get expectedChildren(): Record; - get nested(): Configuration[]; - get prevNestedOptions(): any; - get collectionItemIndex(): number | undefined; - get isCollectionItem(): boolean; - get updateFunc(): UpdateFunc; - init(options: string[]): void; - set emitOptionChanged(handler: EmitOptionChangedFunc); - setPrevNestedOptions(value: any): void; - onOptionChanged(args: IOptionChangedArgs): void; - cleanNested(): void; - createNested(name: string, initialValues: Record, isCollectionItem?: boolean, expectedChildren?: Record): Configuration; - updateValue(nestedName: string, value: any): void; - getNestedOptionValues(): Record | undefined; - getOptionsToWatch(): string[]; - private _onOptionChanged; - private _getNestedConfig; - private _tryEmitOptionChanged; -} -declare function bindOptionWatchers(config: Configuration, vueInstance: Pick, innerChanges: Record): void; -declare function setEmitOptionChangedFunc(config: Configuration, vueInstance: Pick, innerChanges: Record): void; -export default Configuration; -export { bindOptionWatchers, setEmitOptionChangedFunc, UpdateFunc, ExpectedChild, IOptionChangedArgs }; diff --git a/packages/vue2-strategy/npm/configuration.js b/packages/vue2-strategy/npm/configuration.js deleted file mode 100644 index 2702e2c44374..000000000000 --- a/packages/vue2-strategy/npm/configuration.js +++ /dev/null @@ -1,257 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setEmitOptionChangedFunc = exports.bindOptionWatchers = void 0; -var helpers_1 = require("./helpers"); -var Configuration = /** @class */ (function () { - function Configuration(updateFunc, name, initialValues, expectedChildren, isCollectionItem, collectionItemIndex, ownerConfig) { - this._updateFunc = updateFunc; - this._name = name; - this._initialValues = initialValues ? initialValues : {}; - this._nestedConfigurations = []; - this._isCollectionItem = !!isCollectionItem; - this._collectionItemIndex = collectionItemIndex; - this._expectedChildren = expectedChildren || {}; - this._ownerConfig = ownerConfig; - this._componentChanges = []; - this.updateValue = this.updateValue.bind(this); - } - Object.defineProperty(Configuration.prototype, "name", { - get: function () { - return this._name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "fullName", { - get: function () { - return this._name && this._isCollectionItem - ? this._name + "[" + this._collectionItemIndex + "]" - : this._name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "componentsCountChanged", { - get: function () { - return this._componentChanges; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.cleanComponentsCountChanged = function () { - this._componentChanges = []; - }; - Object.defineProperty(Configuration.prototype, "fullPath", { - get: function () { - return this._ownerConfig && this._ownerConfig.fullPath - ? this._ownerConfig.fullPath + "." + this.fullName - : this.fullName; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "ownerConfig", { - get: function () { - return this._ownerConfig; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "options", { - get: function () { - return this._options; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "initialValues", { - get: function () { - return this._initialValues; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "expectedChildren", { - get: function () { - return this._expectedChildren; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "nested", { - get: function () { - return this._nestedConfigurations; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "prevNestedOptions", { - get: function () { - return this._prevNestedConfigOptions; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "collectionItemIndex", { - get: function () { - return this._collectionItemIndex; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "isCollectionItem", { - get: function () { - return this._isCollectionItem; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "updateFunc", { - get: function () { - return this._updateFunc; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.init = function (options) { - this._options = options ? options : []; - }; - Object.defineProperty(Configuration.prototype, "emitOptionChanged", { - set: function (handler) { - this._emitOptionChanged = handler; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.setPrevNestedOptions = function (value) { - this._prevNestedConfigOptions = value; - }; - Configuration.prototype.onOptionChanged = function (args) { - if (helpers_1.isEqual(args.value, args.previousValue)) { - return; - } - this._onOptionChanged(args.fullName.split("."), args); - }; - Configuration.prototype.cleanNested = function () { - this._nestedConfigurations = []; - }; - Configuration.prototype.createNested = function (name, initialValues, isCollectionItem, expectedChildren) { - var expected = this._expectedChildren[name]; - var actualName = name; - var actualIsCollectionItem = isCollectionItem; - if (expected) { - actualIsCollectionItem = expected.isCollectionItem; - if (expected.optionName) { - actualName = expected.optionName; - } - } - var collectionItemIndex = -1; - if (actualIsCollectionItem && actualName) { - collectionItemIndex = this._nestedConfigurations.filter(function (c) { return c._name && c._name === actualName; }).length; - } - var configuration = new Configuration(this._updateFunc, actualName, initialValues, expectedChildren, actualIsCollectionItem, collectionItemIndex, this); - this._nestedConfigurations.push(configuration); - return configuration; - }; - Configuration.prototype.updateValue = function (nestedName, value) { - var fullName = [this.fullPath, nestedName].filter(function (n) { return n; }).join("."); - this._updateFunc(fullName, value); - }; - Configuration.prototype.getNestedOptionValues = function () { - var values = {}; - this._nestedConfigurations.forEach(function (o) { - if (!o._name) { - return; - } - var nestedValue = __assign(__assign({}, o.initialValues), o.getNestedOptionValues()); - if (!nestedValue) { - return; - } - if (!o._isCollectionItem) { - values[o._name] = nestedValue; - } - else { - var arr = values[o._name]; - if (!arr || !Array.isArray(arr)) { - arr = []; - values[o._name] = arr; - } - arr.push(nestedValue); - } - }); - return values; - }; - Configuration.prototype.getOptionsToWatch = function () { - var blackList = {}; - this._nestedConfigurations.forEach(function (c) { return c._name && (blackList[c._name] = true); }); - return this._options.filter(function (o) { return !blackList[o]; }); - }; - Configuration.prototype._onOptionChanged = function (optionRelPath, args) { - if (optionRelPath.length === 0) { - return; - } - var optionInfo = helpers_1.getOptionInfo(optionRelPath[0]); - if (optionInfo.isCollection || optionRelPath.length > 1) { - var nestedConfig = this._getNestedConfig(optionInfo.fullName); - if (nestedConfig) { - nestedConfig._onOptionChanged(optionRelPath.slice(1), args); - return; - } - this._tryEmitOptionChanged(optionInfo.name, args.component.option(this.fullPath ? this.fullPath + "." + optionInfo.name : optionInfo.name)); - } - else { - this._tryEmitOptionChanged(optionInfo.name, args.value); - } - }; - Configuration.prototype._getNestedConfig = function (fullName) { - for (var _i = 0, _a = this._nestedConfigurations; _i < _a.length; _i++) { - var nestedConfig = _a[_i]; - if (nestedConfig.fullName === fullName) { - return nestedConfig; - } - } - return undefined; - }; - Configuration.prototype._tryEmitOptionChanged = function (name, value) { - if (this._emitOptionChanged) { - this._emitOptionChanged(name, value); - } - }; - return Configuration; -}()); -function bindOptionWatchers(config, vueInstance, innerChanges) { - var targets = config && config.getOptionsToWatch(); - if (targets) { - targets.forEach(function (optionName) { - vueInstance.$watch(optionName, function (value) { - if (!innerChanges.hasOwnProperty(optionName) || - innerChanges[optionName] !== value) { - config.updateValue(optionName, value); - } - delete innerChanges[optionName]; - }); - }); - } -} -exports.bindOptionWatchers = bindOptionWatchers; -function setEmitOptionChangedFunc(config, vueInstance, innerChanges) { - config.emitOptionChanged = function (name, value) { - if (!helpers_1.isEqual(value, vueInstance.$props[name])) { - innerChanges[name] = value; - vueInstance.$emit("update:" + name, value); - } - }; -} -exports.setEmitOptionChangedFunc = setEmitOptionChangedFunc; -exports.default = Configuration; diff --git a/packages/vue2-strategy/npm/constants.d.ts b/packages/vue2-strategy/npm/constants.d.ts deleted file mode 100644 index 95881b8a05b5..000000000000 --- a/packages/vue2-strategy/npm/constants.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const DX_TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper"; -declare const DX_REMOVE_EVENT = "dxremove"; -export { DX_TEMPLATE_WRAPPER_CLASS, DX_REMOVE_EVENT }; diff --git a/packages/vue2-strategy/npm/constants.js b/packages/vue2-strategy/npm/constants.js deleted file mode 100644 index 81c29d9d862c..000000000000 --- a/packages/vue2-strategy/npm/constants.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DX_REMOVE_EVENT = exports.DX_TEMPLATE_WRAPPER_CLASS = void 0; -var DX_TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper"; -exports.DX_TEMPLATE_WRAPPER_CLASS = DX_TEMPLATE_WRAPPER_CLASS; -var DX_REMOVE_EVENT = "dxremove"; -exports.DX_REMOVE_EVENT = DX_REMOVE_EVENT; diff --git a/packages/vue2-strategy/npm/errors.d.ts b/packages/vue2-strategy/npm/errors.d.ts deleted file mode 100644 index f25838848047..000000000000 --- a/packages/vue2-strategy/npm/errors.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const TEMPLATE_MULTIPLE_ROOTS_ERROR = "Template must have a single root node."; diff --git a/packages/vue2-strategy/npm/errors.js b/packages/vue2-strategy/npm/errors.js deleted file mode 100644 index 5378ecd9e3a5..000000000000 --- a/packages/vue2-strategy/npm/errors.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TEMPLATE_MULTIPLE_ROOTS_ERROR = void 0; -exports.TEMPLATE_MULTIPLE_ROOTS_ERROR = "Template must have a single root node."; diff --git a/packages/vue2-strategy/npm/extension-component.d.ts b/packages/vue2-strategy/npm/extension-component.d.ts deleted file mode 100644 index 5f0653b7e521..000000000000 --- a/packages/vue2-strategy/npm/extension-component.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { VueConstructor } from "vue"; -interface IExtension { - $_isExtension: boolean; - attachTo(element: any): any; -} -interface IExtensionComponentNode { - $_hasOwner: boolean; -} -declare const DxExtensionComponent: () => VueConstructor; -export { DxExtensionComponent, IExtension, IExtensionComponentNode }; diff --git a/packages/vue2-strategy/npm/extension-component.js b/packages/vue2-strategy/npm/extension-component.js deleted file mode 100644 index d976c363299f..000000000000 --- a/packages/vue2-strategy/npm/extension-component.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DxExtensionComponent = void 0; -var component_1 = require("./component"); -var DxExtensionComponent = function () { return component_1.BaseComponent().extend({ - created: function () { - this.$_isExtension = true; - }, - mounted: function () { - this.$el.setAttribute("isExtension", "true"); - if (this.$vnode && this.$vnode.componentOptions.$_hasOwner) { - return; - } - this.attachTo(this.$el); - }, - methods: { - attachTo: function (element) { - this.$_createWidget(element); - } - } -}); }; -exports.DxExtensionComponent = DxExtensionComponent; diff --git a/packages/vue2-strategy/npm/helpers.d.ts b/packages/vue2-strategy/npm/helpers.d.ts deleted file mode 100644 index 88a44623709d..000000000000 --- a/packages/vue2-strategy/npm/helpers.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export declare function getTemplatePropName(props: Record | null, templateName: string): string; -export declare function uppercaseFirst(value: string): string; -export declare function lowercaseFirst(value: string): string; -export declare function camelize(value: string): string; -export declare function toComparable(value: any): any; -export declare function isEqual(value1: any, value2: any): boolean; -export declare function forEachChildNode(el: Node, callback: (child: ReturnType) => void): void; -export declare function allKeysAreEqual(obj1: object, obj2: object): boolean; -export declare function getOptionValue(options: any, optionPath: any): any; -export declare function getOptionInfo(name: string): IOptionInfo | ICollectionOptionInfo; -interface IOptionInfo { - isCollection: false; - name: string; - fullName: string; -} -interface ICollectionOptionInfo { - isCollection: true; - name: string; - fullName: string; - index: number; -} -export {}; diff --git a/packages/vue2-strategy/npm/helpers.js b/packages/vue2-strategy/npm/helpers.js deleted file mode 100644 index c9f44c4f3768..000000000000 --- a/packages/vue2-strategy/npm/helpers.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOptionInfo = exports.getOptionValue = exports.allKeysAreEqual = exports.forEachChildNode = exports.isEqual = exports.toComparable = exports.camelize = exports.lowercaseFirst = exports.uppercaseFirst = exports.getTemplatePropName = void 0; -function getTemplatePropName(props, templateName) { - for (var propName in props) { - if (props[propName] === templateName) { - return propName; - } - } - return templateName; -} -exports.getTemplatePropName = getTemplatePropName; -function uppercaseFirst(value) { - return value[0].toUpperCase() + value.substr(1); -} -exports.uppercaseFirst = uppercaseFirst; -function lowercaseFirst(value) { - return value[0].toLowerCase() + value.substr(1); -} -exports.lowercaseFirst = lowercaseFirst; -function camelize(value) { - return lowercaseFirst(value.split('-').map(function (v) { return uppercaseFirst(v); }).join('')); -} -exports.camelize = camelize; -function toComparable(value) { - return value instanceof Date ? value.getTime() : value; -} -exports.toComparable = toComparable; -function isEqual(value1, value2) { - if (toComparable(value1) === toComparable(value2)) { - return true; - } - if (Array.isArray(value1) && Array.isArray(value2)) { - return value1.length === 0 && value2.length === 0; - } - return false; -} -exports.isEqual = isEqual; -function forEachChildNode(el, callback) { - Array.prototype.slice.call(el.childNodes).forEach(callback); -} -exports.forEachChildNode = forEachChildNode; -function allKeysAreEqual(obj1, obj2) { - var obj1Keys = Object.keys(obj1); - if (obj1Keys.length !== Object.keys(obj2).length) { - return false; - } - for (var _i = 0, obj1Keys_1 = obj1Keys; _i < obj1Keys_1.length; _i++) { - var key = obj1Keys_1[_i]; - if (!obj2.hasOwnProperty(key)) { - return false; - } - } - return true; -} -exports.allKeysAreEqual = allKeysAreEqual; -function getOptionValue(options, optionPath) { - var value = options; - optionPath.split('.').forEach(function (p) { - var optionInfo = getOptionInfo(p); - if (value) { - value = optionInfo.isCollection - ? value[optionInfo.name] && value[optionInfo.name][optionInfo.index] - : value[optionInfo.name]; - } - }); - return value; -} -exports.getOptionValue = getOptionValue; -function getOptionInfo(name) { - var parts = name.split('['); - if (parts.length === 1) { - return { - isCollection: false, - name: name, - fullName: name, - }; - } - return { - isCollection: true, - name: parts[0], - fullName: name, - index: Number(parts[1].slice(0, -1)), - }; -} -exports.getOptionInfo = getOptionInfo; diff --git a/packages/vue2-strategy/npm/index.d.ts b/packages/vue2-strategy/npm/index.d.ts deleted file mode 100644 index f76586bfc424..000000000000 --- a/packages/vue2-strategy/npm/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function createComponent(config: any): any; -export declare function createConfigurationComponent(config: any): any; -export declare function createExtensionComponent(config: any): any; diff --git a/packages/vue2-strategy/npm/index.js b/packages/vue2-strategy/npm/index.js deleted file mode 100644 index bf63083a7b41..000000000000 --- a/packages/vue2-strategy/npm/index.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createExtensionComponent = exports.createConfigurationComponent = exports.createComponent = void 0; -var VueType = __importStar(require("vue")); -var Vue = VueType.default || VueType; -var component_1 = require("./component"); -var configuration_component_1 = require("./configuration-component"); -var extension_component_1 = require("./extension-component"); -function createComponent(config) { - config.extends = component_1.DxComponent(); - return Vue.extend(config); -} -exports.createComponent = createComponent; -function createConfigurationComponent(config) { - config.extends = configuration_component_1.DxConfiguration(); - return Vue.extend(config); -} -exports.createConfigurationComponent = createConfigurationComponent; -function createExtensionComponent(config) { - config.extends = extension_component_1.DxExtensionComponent(); - return Vue.extend(config); -} -exports.createExtensionComponent = createExtensionComponent; diff --git a/packages/vue2-strategy/npm/templates-discovering.d.ts b/packages/vue2-strategy/npm/templates-discovering.d.ts deleted file mode 100644 index d13024e5db80..000000000000 --- a/packages/vue2-strategy/npm/templates-discovering.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import IVue from "vue"; -import { ScopedSlot } from "vue/types/vnode"; -interface IEventBusHolder { - eventBus: IVue; -} -declare function discover(component: IVue): Record; -declare function mountTemplate(getSlot: () => ScopedSlot, parent: IVue, data: any, name: string, placeholder: Element): IVue; -export { mountTemplate, discover, IEventBusHolder }; diff --git a/packages/vue2-strategy/npm/templates-discovering.js b/packages/vue2-strategy/npm/templates-discovering.js deleted file mode 100644 index 5864f420c04d..000000000000 --- a/packages/vue2-strategy/npm/templates-discovering.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.discover = exports.mountTemplate = void 0; -var VueType = __importStar(require("vue")); -var errors_1 = require("./errors"); -var TEMPLATE_PROP = "template"; -var Vue = VueType.default || VueType; -function asConfigurable(component) { - if (!component.$vnode) { - return undefined; - } - var configurable = component.$vnode.componentOptions; - if (!configurable.$_config || !configurable.$_config.name) { - return undefined; - } - return configurable; -} -function hasTemplate(component) { - return TEMPLATE_PROP in component.$props && (component.$vnode.data && component.$vnode.data.scopedSlots); -} -function discover(component) { - var templates = {}; - for (var slotName in component.$scopedSlots) { - if (slotName === "default" && component.$slots.default) { - continue; - } - var slot = component.$scopedSlots[slotName]; - if (!slot) { - continue; - } - templates[slotName] = slot; - } - for (var _i = 0, _a = component.$children; _i < _a.length; _i++) { - var childComponent = _a[_i]; - var configurable = asConfigurable(childComponent); - if (!configurable) { - continue; - } - var defaultSlot = childComponent.$scopedSlots.default; - if (!defaultSlot || !hasTemplate(childComponent)) { - continue; - } - var templateName = configurable.$_config.fullPath + "." + TEMPLATE_PROP; - templates[templateName] = defaultSlot; - } - return templates; -} -exports.discover = discover; -function mountTemplate(getSlot, parent, data, name, placeholder) { - return new Vue({ - el: placeholder, - name: name, - inject: ["eventBus"], - parent: parent, - created: function () { - var _this = this; - this.eventBus.$on("updated", function () { - _this.$forceUpdate(); - }); - }, - render: function (createElement) { - var content = getSlot()(data); - if (!content) { - return createElement("div"); - } - if (content.length > 1) { - throw new Error(errors_1.TEMPLATE_MULTIPLE_ROOTS_ERROR); - } - return content[0]; - }, - destroyed: function () { - // T857821 - this.eventBus.$off("updated"); - } - }); -} -exports.mountTemplate = mountTemplate; diff --git a/packages/vue2-strategy/npm/templates-manager.d.ts b/packages/vue2-strategy/npm/templates-manager.d.ts deleted file mode 100644 index 2522d07b4990..000000000000 --- a/packages/vue2-strategy/npm/templates-manager.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import IVue from "vue"; -declare class TemplatesManager { - private _component; - private _slots; - private _templates; - private _isDirty; - constructor(component: IVue); - discover(): void; - get templates(): Record; - get isDirty(): boolean; - resetDirtyFlag(): void; - private _prepareTemplates; - private createDxTemplate; -} -export { TemplatesManager }; diff --git a/packages/vue2-strategy/npm/templates-manager.js b/packages/vue2-strategy/npm/templates-manager.js deleted file mode 100644 index 7d022b165746..000000000000 --- a/packages/vue2-strategy/npm/templates-manager.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TemplatesManager = void 0; -var config_1 = require("./config"); -var templates_discovering_1 = require("./templates-discovering"); -var dom_adapter_1 = __importDefault(require("devextreme/core/dom_adapter")); -var events_1 = require("devextreme/events"); -var constants_1 = require("./constants"); -var helpers_1 = require("./helpers"); -var TemplatesManager = /** @class */ (function () { - function TemplatesManager(component) { - this._slots = {}; - this._templates = {}; - this._isDirty = false; - this._component = component; - this.discover(); - } - TemplatesManager.prototype.discover = function () { - var slots = templates_discovering_1.discover(this._component); - this._slots = __assign(__assign({}, this._slots), slots); - if (!helpers_1.allKeysAreEqual(this._templates, slots)) { - this._prepareTemplates(); - } - }; - Object.defineProperty(TemplatesManager.prototype, "templates", { - get: function () { - return this._templates; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TemplatesManager.prototype, "isDirty", { - get: function () { - return this._isDirty; - }, - enumerable: false, - configurable: true - }); - TemplatesManager.prototype.resetDirtyFlag = function () { - this._isDirty = false; - }; - TemplatesManager.prototype._prepareTemplates = function () { - this._templates = {}; - for (var _i = 0, _a = Object.keys(this._slots); _i < _a.length; _i++) { - var name_1 = _a[_i]; - this._templates[name_1] = this.createDxTemplate(name_1); - } - this._isDirty = true; - }; - TemplatesManager.prototype.createDxTemplate = function (name) { - var _this = this; - return { - render: function (data) { - var scopeData = config_1.getOption("useLegacyTemplateEngine") - ? data.model - : { data: data.model, index: data.index }; - var container = data.container.get ? data.container.get(0) : data.container; - var placeholder = document.createElement("div"); - container.appendChild(placeholder); - var mountedTemplate = templates_discovering_1.mountTemplate(function () { return _this._slots[name]; }, _this._component, scopeData, name, placeholder); - var element = mountedTemplate.$el; - dom_adapter_1.default.setClass(element, constants_1.DX_TEMPLATE_WRAPPER_CLASS, true); - if (element.nodeType === Node.TEXT_NODE) { - var removalListener = document.createElement(container.nodeName === "TABLE" ? "tbody" : "span"); - removalListener.style.display = "none"; - container.appendChild(removalListener); - events_1.one(removalListener, constants_1.DX_REMOVE_EVENT, mountedTemplate.$destroy.bind(mountedTemplate)); - } - else { - events_1.one(element, constants_1.DX_REMOVE_EVENT, mountedTemplate.$destroy.bind(mountedTemplate)); - } - return element; - } - }; - }; - return TemplatesManager; -}()); -exports.TemplatesManager = TemplatesManager; From 569318670a59b7a959140274980af89bc2858f01 Mon Sep 17 00:00:00 2001 From: Alexander Kozlovskiy Date: Wed, 6 Sep 2023 17:22:28 +0200 Subject: [PATCH 4/4] delete default for multi/range --- packages/devextreme/js/ui/calendar.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/devextreme/js/ui/calendar.d.ts b/packages/devextreme/js/ui/calendar.d.ts index 46a8930f1ed5..784820f5111e 100644 --- a/packages/devextreme/js/ui/calendar.d.ts +++ b/packages/devextreme/js/ui/calendar.d.ts @@ -205,8 +205,6 @@ export interface dxCalendarOptions extends EditorOptions { /** * @docid * @default null - * @default [] &for(multiple selection mode) - * @default [null,null] &for(range selection mode) * @public */ value?: Date | number | string | Array;