Skip to content

Commit

Permalink
Formatted types/w* packages with dprint (#66544)
Browse files Browse the repository at this point in the history
* Formatted types/w* packages with dprint

* Fix introduced issues
  • Loading branch information
JoshuaKGoldberg committed Sep 25, 2023
1 parent b84746a commit e4dc649
Show file tree
Hide file tree
Showing 843 changed files with 35,294 additions and 27,667 deletions.
22 changes: 10 additions & 12 deletions types/w2ui/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ interface JQuery {
w2popup(options: Object): W2UI.W2Popup;
}

declare var w2popup: W2UI.W2Popup
declare var w2ui: W2UI.W2UI
declare var w2popup: W2UI.W2Popup;
declare var w2ui: W2UI.W2UI;

declare namespace W2UI {

interface W2Event {
onComplete: () => void;
target: string;
}

type W2EventHandler = ((e: W2Event) => void) | ((id: string, e: W2Event) => void)
type W2EventHandler = ((e: W2Event) => void) | ((id: string, e: W2Event) => void);

/* Primitives (first alphabetically, then by documentation order) */

Expand All @@ -42,7 +41,7 @@ declare namespace W2UI {
type?: string | undefined;
}

type W2Object = W2Layout | W2Grid | W2Toolbar | W2Sidebar | W2Tabs | W2Form | W2Popup
type W2Object = W2Layout | W2Grid | W2Toolbar | W2Sidebar | W2Tabs | W2Form | W2Popup;

interface W2Panel {
content?: string | JQuery | undefined;
Expand Down Expand Up @@ -108,9 +107,9 @@ declare namespace W2UI {
}

namespace W2Grid {
interface Columns { }
interface Ranges { }
interface Records { }
interface Columns {}
interface Ranges {}
interface Records {}
}

interface W2Grid extends W2Common, W2OnClickable {
Expand Down Expand Up @@ -190,7 +189,7 @@ declare namespace W2UI {
hideSearch(...fields: string[]): number;
initAllField(field: string, value?: string): void;
initColumnOnOff(): void;
//initOperator(el, searchInd): void; // this is used internally
// initOperator(el, searchInd): void; // this is used internally
initResize(): void;
initSearches(): void;
initToolbar(): void;
Expand Down Expand Up @@ -402,8 +401,7 @@ declare namespace W2UI {
}

interface W2OnClickable {
onClick(event: W2Event): void;
onClick(id: string, data: W2Event): void;
onClick(event: W2Event): void;
onClick(id: string, data: W2Event): void;
}

}
238 changes: 129 additions & 109 deletions types/w2ui/w2ui-tests.ts
Original file line number Diff line number Diff line change
@@ -1,172 +1,192 @@


$(function() {

$('#myLayout').w2layout({
name: 'myLayout',
$("#myLayout").w2layout({
name: "myLayout",
panels: [
{ type: 'top', size: 60 },
{ type: 'left', size: 150, resizable: true },
{ type: 'right', size: 150, resizable: true }
]
{ type: "top", size: 60 },
{ type: "left", size: 150, resizable: true },
{ type: "right", size: 150, resizable: true },
],
});

$('#myGrid').w2grid({
name: 'myGrid',
$("#myGrid").w2grid({
name: "myGrid",
columns: [
{ field: 'fname', caption: 'First Name', size: '30%' },
{ field: 'lname', caption: 'Last Name', size: '30%' },
{ field: 'email', caption: 'Email', size: '40%' },
{ field: 'sdate', caption: 'Start Date', size: '120px' },
{ field: "fname", caption: "First Name", size: "30%" },
{ field: "lname", caption: "Last Name", size: "30%" },
{ field: "email", caption: "Email", size: "40%" },
{ field: "sdate", caption: "Start Date", size: "120px" },
],
records: [
{ recid: 1, fname: 'John', lname: 'Doe', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 7, fname: 'Mark', lname: 'Welldo', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 8, fname: 'Thomas', lname: 'Bahh', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 9, fname: 'Sergei', lname: 'Rachmaninov', email: 'jdoe@gmail.com', sdate: '4/3/2012' }
]
{ recid: 1, fname: "John", lname: "Doe", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 2, fname: "Stuart", lname: "Motzart", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 3, fname: "Jin", lname: "Franson", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 4, fname: "Susan", lname: "Ottie", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 5, fname: "Kelly", lname: "Silver", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 6, fname: "Francis", lname: "Gatos", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 7, fname: "Mark", lname: "Welldo", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 8, fname: "Thomas", lname: "Bahh", email: "jdoe@gmail.com", sdate: "4/3/2012" },
{ recid: 9, fname: "Sergei", lname: "Rachmaninov", email: "jdoe@gmail.com", sdate: "4/3/2012" },
],
});

$('#myToolbar').w2toolbar({
name: 'myToolbar',
$("#myToolbar").w2toolbar({
name: "myToolbar",
items: [
{ type: 'check', id: 'item1', caption: 'Check', img: 'icon-add', checked: true },
{ type: 'break' },
{ type: "check", id: "item1", caption: "Check", img: "icon-add", checked: true },
{ type: "break" },
{
type: 'menu', id: 'item2', caption: 'Drop Down', img: 'icon-folder',
type: "menu",
id: "item2",
caption: "Drop Down",
img: "icon-folder",
items: [
{ text: 'Item 1', img: 'icon-page' },
{ text: 'Item 2', img: 'icon-page' },
{ text: 'Item 3', img: 'icon-page' }
]
{ text: "Item 1", img: "icon-page" },
{ text: "Item 2", img: "icon-page" },
{ text: "Item 3", img: "icon-page" },
],
},
{ type: 'break' },
{ type: 'radio', id: 'item3', group: '1', caption: 'Radio 1', img: 'icon-page' },
{ type: 'radio', id: 'item4', group: '1', caption: 'Radio 2', img: 'icon-page' },
{ type: 'spacer' },
{ type: 'button', id: 'item5', caption: 'Item 5', img: 'icon-save' }
]
{ type: "break" },
{ type: "radio", id: "item3", group: "1", caption: "Radio 1", img: "icon-page" },
{ type: "radio", id: "item4", group: "1", caption: "Radio 2", img: "icon-page" },
{ type: "spacer" },
{ type: "button", id: "item5", caption: "Item 5", img: "icon-save" },
],
});

$('#mySidebar').w2sidebar({
name: 'mySidebar',
$("#mySidebar").w2sidebar({
name: "mySidebar",
img: null,
nodes: [
{
id: 'level-1', text: 'Level 1', img: 'icon-folder', expanded: true,
id: "level-1",
text: "Level 1",
img: "icon-folder",
expanded: true,
nodes: [
{ id: 'level-1-1', text: 'Level 1.1', img: 'icon-page' },
{ id: 'level-1-2', text: 'Level 1.2', img: 'icon-page' },
{ id: 'level-1-3', text: 'Level 1.3', img: 'icon-page' }
]
{ id: "level-1-1", text: "Level 1.1", img: "icon-page" },
{ id: "level-1-2", text: "Level 1.2", img: "icon-page" },
{ id: "level-1-3", text: "Level 1.3", img: "icon-page" },
],
},
{
id: 'level-2', text: 'Level 2', img: 'icon-folder',
id: "level-2",
text: "Level 2",
img: "icon-folder",
nodes: [
{
id: 'level-2-1', text: 'Level 2.1', img: 'icon-folder',
id: "level-2-1",
text: "Level 2.1",
img: "icon-folder",
nodes: [
{ id: 'level-2-1-1', text: 'Level 2.1.1', img: 'icon-page' },
{ id: 'level-2-1-2', text: 'Level 2.1.2', img: 'icon-page' },
{ id: 'level-2-1-3', text: 'Level 2.1.3', img: 'icon-page' }
]
{ id: "level-2-1-1", text: "Level 2.1.1", img: "icon-page" },
{ id: "level-2-1-2", text: "Level 2.1.2", img: "icon-page" },
{ id: "level-2-1-3", text: "Level 2.1.3", img: "icon-page" },
],
},
{ id: 'level-2-2', text: 'Level 2.2', img: 'icon-page' },
{ id: 'level-2-3', text: 'Level 2.3', img: 'icon-page' }
]
{ id: "level-2-2", text: "Level 2.2", img: "icon-page" },
{ id: "level-2-3", text: "Level 2.3", img: "icon-page" },
],
},
{
id: 'level-3', text: 'Level 3', img: 'icon-folder',
id: "level-3",
text: "Level 3",
img: "icon-folder",
nodes: [
{ id: 'level-3-1', text: 'Level 3.1', img: 'icon-page' },
{ id: 'level-3-2', text: 'Level 3.2', img: 'icon-page' },
{ id: 'level-3-3', text: 'Level 3.3', img: 'icon-page' }
]
}
{ id: "level-3-1", text: "Level 3.1", img: "icon-page" },
{ id: "level-3-2", text: "Level 3.2", img: "icon-page" },
{ id: "level-3-3", text: "Level 3.3", img: "icon-page" },
],
},
],
onClick: function(event: W2UI.W2Event) {
console.log(event.target);
}
},
});

$('#sidebar').w2sidebar({
name: 'sidebar',
$("#sidebar").w2sidebar({
name: "sidebar",
img: null,
nodes: [
{
id: 'level-1', text: 'Level 1', img: 'icon-folder', expanded: true,
nodes: [{ id: 'level-1-1', text: 'Level 1.1', img: 'icon-page' },
{ id: 'level-1-2', text: 'Level 1.2', img: 'icon-page' },
{ id: 'level-1-3', text: 'Level 1.3', img: 'icon-page' }
]
id: "level-1",
text: "Level 1",
img: "icon-folder",
expanded: true,
nodes: [{ id: "level-1-1", text: "Level 1.1", img: "icon-page" }, {
id: "level-1-2",
text: "Level 1.2",
img: "icon-page",
}, { id: "level-1-3", text: "Level 1.3", img: "icon-page" }],
},
{
id: 'level-2', text: 'Level 2', img: 'icon-folder',
nodes: [{
id: 'level-2-1', text: 'Level 2.1', img: 'icon-folder',
nodes: [
{ id: 'level-2-1-1', text: 'Level 2.1.1', img: 'icon-page' },
{ id: 'level-2-1-2', text: 'Level 2.1.2', img: 'icon-page' },
{ id: 'level-2-1-3', text: 'Level 2.1.3', img: 'icon-page' }
]
},
{ id: 'level-2-2', text: 'Level 2.2', img: 'icon-page' },
{ id: 'level-2-3', text: 'Level 2.3', img: 'icon-page' }
]
id: "level-2",
text: "Level 2",
img: "icon-folder",
nodes: [
{
id: "level-2-1",
text: "Level 2.1",
img: "icon-folder",
nodes: [
{ id: "level-2-1-1", text: "Level 2.1.1", img: "icon-page" },
{ id: "level-2-1-2", text: "Level 2.1.2", img: "icon-page" },
{ id: "level-2-1-3", text: "Level 2.1.3", img: "icon-page" },
],
},
{ id: "level-2-2", text: "Level 2.2", img: "icon-page" },
{ id: "level-2-3", text: "Level 2.3", img: "icon-page" },
],
},
{
id: 'level-3', text: 'Level 3', img: 'icon-folder',
nodes: [{ id: 'level-3-1', text: 'Level 3.1', img: 'icon-page' },
{ id: 'level-3-2', text: 'Level 3.2', img: 'icon-page' },
{ id: 'level-3-3', text: 'Level 3.3', img: 'icon-page' }
]
}
id: "level-3",
text: "Level 3",
img: "icon-folder",
nodes: [{ id: "level-3-1", text: "Level 3.1", img: "icon-page" }, {
id: "level-3-2",
text: "Level 3.2",
img: "icon-page",
}, { id: "level-3-3", text: "Level 3.3", img: "icon-page" }],
},
],
onClick: function(id: string, data: W2UI.W2Event) {
console.log(id);
}
},
});

$('#myTabs').w2tabs({
name: 'myTabs',
active: 'tab1',
$("#myTabs").w2tabs({
name: "myTabs",
active: "tab1",
tabs: [
{ id: 'tab1', caption: 'Tab 1' },
{ id: 'tab2', caption: 'Tab 2' },
{ id: 'tab3', caption: 'Tab 3' },
{ id: 'tab4', caption: 'Tab 4' }
{ id: "tab1", caption: "Tab 1" },
{ id: "tab2", caption: "Tab 2" },
{ id: "tab3", caption: "Tab 3" },
{ id: "tab4", caption: "Tab 4" },
],
onClick: function(event: W2UI.W2Event) {
$('#myTabsContent').html(event.target);
}
$("#myTabsContent").html(event.target);
},
});

$('#myForm').w2form({
name: 'myForm',
$("#myForm").w2form({
name: "myForm",
fields: [
{ name: 'first_name', type: 'text', required: true },
{ name: 'last_name', type: 'text', required: true },
{ name: 'comments', type: 'text' }
{ name: "first_name", type: "text", required: true },
{ name: "last_name", type: "text", required: true },
{ name: "comments", type: "text" },
],
actions: {
reset: function() {
this.clear();
},
save: function() {
this.save();
}
}
},
},
});

w2popup.open({
title: 'Popup Title HTML',
body: 'Body HTML',
buttons: 'Buttons HTML'
title: "Popup Title HTML",
body: "Body HTML",
buttons: "Buttons HTML",
});

});
Loading

0 comments on commit e4dc649

Please sign in to comment.