Skip to content

Commit d53d61d

Browse files
fix TS in Navigation Vue demos
1 parent b2be014 commit d53d61d

156 files changed

Lines changed: 816 additions & 502 deletions

File tree

Some content is hidden

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

apps/demos/Demos/Accordion/Overview/Vue/CustomItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
import { type CompanyData } from './data';
3434
3535
defineProps<{
36-
itemData?: CompanyData
36+
itemData: CompanyData
3737
}>();
3838
</script>

apps/demos/Demos/Accordion/Overview/Vue/CustomTitle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
import { type CompanyData } from './data';
66
77
defineProps<{
8-
itemData?: CompanyData
8+
itemData: CompanyData
99
}>();
1010
</script>

apps/demos/Demos/ActionSheet/PopoverMode/Vue/ContactItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
import { type ContactInfo } from './data';
1010
1111
defineProps<{
12-
itemData?: ContactInfo
12+
itemData: ContactInfo
1313
}>();
1414
</script>

apps/demos/Demos/CardView/CardTemplate/Vue/App.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
:vehicle="vehicle"
5656
:id="ID"
5757
:model="`${TrademarkName} ${Name}`"
58-
:price="fields?.find(f => f.column?.dataField === 'Price')?.text"
58+
:price="getPriceText(fields)"
5959
:category-name="CategoryName"
6060
:modification="Modification"
6161
:body-style-name="BodyStyleName"
@@ -83,13 +83,20 @@ import { DxCardView, DxColumn, DxHeaderFilter, DxSearchPanel, DxPaging } from 'd
8383
import { DxPopup, DxPosition } from 'devextreme-vue/popup';
8484
import LicenseInfo from './LicenseInfo.vue';
8585
import VehicleCard from './VehicleCard.vue';
86-
import { vehicles } from './data.ts';
86+
import { vehicles, type Vehicle } from './data.ts';
8787
import { ref } from 'vue';
8888
8989
const popupVisible = ref(false);
90-
const currentVehicle = ref(null);
90+
const currentVehicle = ref<Vehicle | undefined>();
9191
92-
function showInfo(vehicle) {
92+
function getPriceText(
93+
fields?: Array<{ column?: { dataField?: string }, text?: string }>,
94+
): string {
95+
const priceField = fields?.find((field) => field?.column?.dataField === 'Price');
96+
return priceField?.text || '';
97+
}
98+
99+
function showInfo(vehicle: Vehicle) {
93100
currentVehicle.value = vehicle;
94101
popupVisible.value = true;
95102
}

apps/demos/Demos/CardView/ColumnChooser/Vue/App.vue

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@
88
:data-source="['dragAndDrop', 'select']"
99
:input-attr="{ 'aria-label': 'Column Chooser Mode' }"
1010
:value="columnChooserMode"
11-
@value-changed="({ value }) => { columnChooserMode = value; }"
11+
@value-changed="onModeChanged"
1212
/>
1313
</div>
1414
<div className="option">
1515
<DxCheckBox
1616
text="Search Enabled"
1717
:value="searchEnabled"
18-
@value-changed="({ value }) => { searchEnabled = value; }"
18+
@value-changed="onSearchEnabledChanged"
1919
/>
2020
</div>
2121
<div className="option">
2222
<DxCheckBox
2323
text="Allow Select All"
2424
:value="allowSelectAll"
25-
@value-changed="({ value }) => { allowSelectAll = value; }"
25+
@value-changed="onAllowSelectAllChanged"
2626
:disabled="columnChooserMode !== 'select'"
2727
/>
2828
</div>
2929
<div className="option">
3030
<DxCheckBox
3131
text="Select By Click On Item"
3232
:value="selectByClick"
33-
@value-changed="({ value }) => { selectByClick = value; }"
33+
@value-changed="onSelectByClickChanged"
3434
:disabled="columnChooserMode !== 'select'"
3535
/>
3636
</div>
3737
<div className="option">
3838
<DxCheckBox
3939
text="Allow Column Reordering"
4040
:value="allowColumnReordering"
41-
@value-changed="({ value }) => { allowColumnReordering = value; }"
41+
@value-changed="onAllowColumnReorderingChanged"
4242
/>
4343
</div>
4444
</div>
@@ -103,8 +103,8 @@ import { ref } from 'vue';
103103
import {
104104
DxCardView, DxColumn, DxCardCover, DxSearchPanel, DxColumnChooser, DxColumnChooserSearch, DxColumnChooserSelection,
105105
} from 'devextreme-vue/card-view';
106-
import { DxSelectBox } from 'devextreme-vue/select-box';
107-
import { DxCheckBox } from 'devextreme-vue/check-box';
106+
import { DxSelectBox, type DxSelectBoxTypes } from 'devextreme-vue/select-box';
107+
import { DxCheckBox, type DxCheckBoxTypes } from 'devextreme-vue/check-box';
108108
import { employees, type Employee } from './data.ts';
109109
110110
function altExpr({ First_Name, Last_Name }: Employee): string {
@@ -125,6 +125,26 @@ const allowSelectAll = ref(true);
125125
const selectByClick = ref(true);
126126
const allowColumnReordering = ref(false);
127127
128+
function onModeChanged({ value }: DxSelectBoxTypes.ValueChangedEvent) {
129+
columnChooserMode.value = value;
130+
}
131+
132+
function onSearchEnabledChanged({ value }: DxCheckBoxTypes.ValueChangedEvent) {
133+
searchEnabled.value = value;
134+
}
135+
136+
function onAllowSelectAllChanged({ value }: DxCheckBoxTypes.ValueChangedEvent) {
137+
allowSelectAll.value = value;
138+
}
139+
140+
function onSelectByClickChanged({ value }: DxCheckBoxTypes.ValueChangedEvent) {
141+
selectByClick.value = value;
142+
}
143+
144+
function onAllowColumnReorderingChanged({ value }: DxCheckBoxTypes.ValueChangedEvent) {
145+
allowColumnReordering.value = value;
146+
}
147+
128148
</script>
129149
<style>
130150
.options-panel {

apps/demos/Demos/CardView/ColumnHeaderFilter/Vue/App.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,26 @@ function getOrderDay(rowData: Order) {
6969
return new Date(rowData.OrderDate).getDay();
7070
}
7171
72-
function calculateOrderDateFilterExpression(this: DxCardViewTypes.Column, value, selectedFilterOperations, target) {
72+
function calculateOrderDateFilterExpression(
73+
this: DxCardViewTypes.Column,
74+
value: unknown,
75+
selectedFilterOperations: string | null,
76+
target: string,
77+
) {
7378
if (value === 'weekends') {
7479
return [[getOrderDay, '=', 0], 'or', [getOrderDay, '=', 6]];
7580
}
7681
return this.defaultCalculateFilterExpression(value, selectedFilterOperations, target) as any;
7782
}
7883
79-
function orderDateHeaderFilterDataSource(data) {
80-
data.dataSource.postProcess = function(results) {
84+
type HeaderFilterDataSourceArg = {
85+
dataSource: {
86+
postProcess: (results: Array<{ text: string; value: unknown }>) => Array<{ text: string; value: unknown }>;
87+
};
88+
};
89+
90+
function orderDateHeaderFilterDataSource(data: HeaderFilterDataSourceArg): void {
91+
data.dataSource.postProcess = function(results: Array<{ text: string; value: unknown }>) {
8192
results.push({
8293
text: 'Weekends',
8394
value: 'weekends',

apps/demos/Demos/CardView/DataValidation/Vue/App.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,27 @@
171171
import {
172172
DxCardView, DxColumn, DxCardCover, DxEditing, DxForm, DxItem, DxSearchPanel, DxRequiredRule, DxEmailRule, DxPatternRule, DxAsyncRule, DxCustomRule,
173173
} from 'devextreme-vue/card-view';
174+
import { type ValidationCallbackData } from 'devextreme-vue/common';
174175
import 'devextreme-vue/text-area';
175176
import { employees, type Employee } from './data.ts';
176177
177-
function altExpr({ fullName }: Employee) {
178+
function altExpr({ fullName }: Employee): string {
178179
return `Photo of ${fullName}`;
179180
}
180181
181-
function imageExpr({ picture }: Employee) {
182+
function imageExpr({ picture }: Employee): string {
182183
return picture;
183184
}
184185
185-
function calculateFullName({ firstName, lastName }: Employee) {
186+
function calculateFullName({ firstName, lastName }: Employee): string {
186187
return `${firstName} ${lastName}`;
187188
}
188189
189190
const emailValidationUrl = 'https://js.devexpress.com/Demos/NetCore/RemoteValidation/CheckUniqueEmailAddress';
190191
191-
async function emailValidationCallback(params) {
192+
async function emailValidationCallback(
193+
params: ValidationCallbackData,
194+
): Promise<boolean> {
192195
const response = await fetch(emailValidationUrl, {
193196
method: 'POST',
194197
headers: {
@@ -205,7 +208,7 @@ async function emailValidationCallback(params) {
205208
return result;
206209
}
207210
208-
function hireDateValidationCallback(params) {
209-
return new Date(params.value) > new Date(params.data.birthDate);
210-
}
211+
const hireDateValidationCallback = (
212+
params: ValidationCallbackData,
213+
): boolean => new Date(params.value) > new Date(params.data.birthDate);
211214
</script>

apps/demos/Demos/CardView/DataValidation/Vue/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface Employee {
1818
departmentID: number;
1919
department: string;
2020
status: string;
21-
notes: string;
21+
notes: string | null;
2222
pictureName: string;
2323
picture: string;
2424
}

apps/demos/Demos/CardView/FieldTemplate/Vue/Employee.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<button className="task__link-button">{{ employee.Name }}</button>
2+
<button className="task__link-button">{{ employee?.Name }}</button>
33
</template>
44

55
<script setup lang="ts">

apps/demos/Demos/CardView/FieldTemplate/Vue/Priority.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div :className="priorityClassName">
33
<div className="task__indicator"></div>
4-
<div>{{ priority.text }}</div>
4+
<div>{{ priority?.text }}</div>
55
</div>
66
</template>
77

@@ -16,7 +16,9 @@ const props = defineProps<{
1616
const priority = computed(() =>
1717
priorities.find(p => p.id === props.priorityID)
1818
);
19-
const priorityClassName = `task__priority task__priority--${priority.value.postfix}`;
19+
const priorityClassName = computed(() =>
20+
`task__priority task__priority--${priority.value?.postfix || ''}`
21+
);
2022
</script>
2123

2224
<style>

0 commit comments

Comments
 (0)