Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"author": "Adrian Png <[email protected]",
"license": "MIT",
"dependencies": {
"@types/jquery": "^3.2.16"
"@types/base-64": "^0.1.2",
"@types/jquery": "^3.2.16",
"jquery-confirm": "^3.3.2"
},
"devDependencies": {}
}
}
50 changes: 32 additions & 18 deletions types/orclapex-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare namespace apex {
* @param {string} pMessage
* @param {string} pRequest
*/
function confirm(pMessage: string, pRequest: string): void;
function confirm(pMessage?: string, pRequest?: string): void;

/**
* apex.confirm Signature 2 (alias for apex.page.confirm)
Expand Down Expand Up @@ -283,13 +283,14 @@ declare namespace apex {
}

function addVisibilityCheck(pFunction: Function): void;
function alert(pMessage: string, pCallback: Function): void;
function alert(pMessage: string, pCallback?: Function): void;
function clearErrors(): void;
function confirm(pMessage: string, pCallback: Function): void;
function confirm(pMessage: string, pCallback?: Function): void;
function hidePageSuccess(): void;
function setThemeHooks(): void; // @todo
function setThemeHooks(themeHookOptions?: ThemeHookOptions): void; // @todo
function showErrors(pErrors: Error | Array<Error>): void; // @todo
function showPageSuccess(pMessage: string): void;

}

namespace navigation {
Expand Down Expand Up @@ -389,17 +390,17 @@ declare namespace apex {
}

interface PluginData {
pageItems: string | JQuery | HTMLElement | Array<string>,
x01?: string,
x02?: string,
x03?: string,
x04?: string,
x05?: string,
x06?: string,
x07?: string,
x08?: string,
x09?: string,
x10?: string,
pageItems?: string | JQuery | HTMLElement | Array<string>,
x01?: string | number,
x02?: string | number,
x03?: string | number,
x04?: string | number,
x05?: string | number,
x06?: string | number,
x07?: string | number,
x08?: string | number,
x09?: string | number,
x10?: string | number,
f01?: string | Array<string | number>
f02?: string | Array<string | number>
f03?: string | Array<string | number>
Expand All @@ -419,7 +420,8 @@ declare namespace apex {
f17?: string | Array<string | number>
f18?: string | Array<string | number>
f19?: string | Array<string | number>
f20?: string | Array<string | number>
f20?: string | Array<string | number>,
p_request?:string
}

interface Queue {
Expand All @@ -435,7 +437,19 @@ declare namespace apex {
loadingIndicator?: string | JQuery | HTMLElement | Function,
loadingIndicatorPosition?: string,
queue?: Queue,
target?: string | HTMLElement
success?: Function,
error?: Function,
beforeSend?: Function,
complete?: Function,
async?: boolean,
target?: string | HTMLElement,
cache?: boolean,
contents?: Object,
context?: Object,
contentType?: boolean | string,
converters?: Object,
crossDomain?: boolean,
dataFilter?: Function
}

function loadScript(pConfig: ScriptConfig, pCallback: Function): Function;
Expand Down Expand Up @@ -1173,4 +1187,4 @@ declare function $d_Find(pThis: HTMLElement | string, pString: string, pTags: st
* @returns { boolean }
*/
declare function $f_First_field(pNd: HTMLElement | string): boolean;
// END - Non-namespaced APIs
// END - Non-namespaced APIs
97 changes: 97 additions & 0 deletions types/orclapex-js/orclapex-js-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/// <reference path="index.d.ts" />
class Car {
constructor(firstname, lastname) {
this.firstname = firstname;
this.lastname = lastname;
this.firstName = firstname;
this.lastName = lastname;
}
getSumme(a, b) {
return a + b;
}
getSumme_x(a, b, c) {
return a + b + c;
}
getFirstName() {
return this.firstName;
}
getLastName() {
return this.lastName;
}
setLastName(lastname) {
if (this.lastName == lastName) {
console.log("Latname is already exist");
}
else {
this.lastName = lastname;
}
}
setFirstName(firstName) {
this.firstName = firstName;
}
callServer() {
apex.page.confirm("Are you Sure?", "SUCCESS");
apex.confirm();
apex.event.trigger('pSelector', 'pEvent', $x('pNd'));
}
callServerx(processname) {
var $body = $(".t-Body");
apex.server.process(processname, {
pageItems: "#P2300_LOV",
x01: 1
}, {
contents: document.body,
async: true,
beforeSend: () => {
$body.addClass("loading");
$('<span class="vfr u-Processinga" role="alert" style="top: 252px; left: 720px;"><span class="vfr u-Processing-spinner"></span><span class="u-VisuallyHidden">Processing</span></span>').appendTo("body");
},
success: (pData) => {
/* If the AJAX is successful set the value or the returned items */
if (pData.success === true) {
/* Loop through the array and set the value of each item */
for (var i = 0; i < pData.items.length; i++) {
apex.item(pData.items[i].id).setValue(pData.items[i].value);
}
}
/* Remove the processing image */
},
error: (request, status, error) => {
alert(request.responseText);
/* Remove the processing image */
}
});
}
apexMessageAlert() {
apex.message.alert("Load complete");
}
apexMessageConfirm() {
apex.message.confirm("Are you sure?", (okPressed) => {
if (okPressed) {
console.log('delete');
}
});
apex.message.confirm("Are you sure?");
}
apexMessageSetThemeHooks() {
apex.message.setThemeHooks({
beforeShow: (pMsgType, pElement$) => {
if (pMsgType === apex.message.TYPE.SUCCESS) {
pElement$.addClass("animate-msg");
}
},
beforeHide: (pMsgType, pElement$) => {
if (pMsgType === apex.message.TYPE.SUCCESS) {
pElement$.removeClass("animate-msg");
}
}
});
}
}
var firstName = 'Pierre';
var lastName = 'Yotti';
var type = new Car(firstName, lastName);
console.log("The Summe is " + type.getSumme(2, 3));
console.log("The LastName is " + type.getLastName());
type.setLastName('Yotti');
console.log("The LastName is " + type.getLastName());
139 changes: 139 additions & 0 deletions types/orclapex-js/orclapex-js-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/// <reference path="index.d.ts" />
namespace server {
export interface Iperson {
firstname: string,
lastname: string,
getSumme: (a: number, b: number) => number

}

export interface care {
firstname: string,
lastname: string,
getSumme: (a: number, b: number) => number

}

export interface callbackevent {
success: string,
lastname: string,
getSumme: (a: number, b: number) => number

}
}

class Car implements server.Iperson {
private firstName: string;
private lastName: string;
constructor(public firstname: string, public lastname: string) {
this.firstName = firstname;
this.lastName = lastname;
}
public getSumme(a: number, b: number): number {
return a + b;
}

public getSumme_x(a: number, b: number, c: number): number {
return a + b + c;
}
public getFirstName(): string {
return this.firstName;
}
public getLastName(): string {
return this.lastName;
}
public setLastName(lastname: string) {
if (this.lastName == lastName) {
console.log("Latname is already exist");
} else {
this.lastName = lastname;
}

}

public setFirstName(firstName: string) {
this.firstName = firstName;
}

public callServer() {
apex.page.confirm("Are you Sure?", "SUCCESS");
apex.confirm();
apex.event.trigger('pSelector', 'pEvent', $x('pNd'))

}

public callServerx(processname: string) {
var $body = $(".t-Body");
apex.server.process(processname, {
pageItems: "#P2300_LOV",
x01: 1
}, {
contents: document.body,
async:true,
beforeSend: ()=> {
$body.addClass("loading");
$('<span class="vfr u-Processinga" role="alert" style="top: 252px; left: 720px;"><span class="vfr u-Processing-spinner"></span><span class="u-VisuallyHidden">Processing</span></span>').appendTo("body");


},
success: (pData:any)=> {
/* If the AJAX is successful set the value or the returned items */
if (pData.success === true) {
/* Loop through the array and set the value of each item */
for (var i = 0; i < pData.items.length; i++) {
apex.item(pData.items[i].id).setValue(pData.items[i].value);
}
}

/* Remove the processing image */

},
error: (request:any, status:any, error:any)=> {
alert(request.responseText);

/* Remove the processing image */

}
});
}

public apexMessageAlert(){
apex.message.alert("Load complete");
}

public apexMessageConfirm(){
apex.message.confirm( "Are you sure?", ( okPressed: string )=> {
if( okPressed ) {
console.log('delete');
}
});
apex.message.confirm( "Are you sure?");
}

public apexMessageSetThemeHooks(){
apex.message.setThemeHooks({
beforeShow: ( pMsgType: string, pElement$: HTMLSelectElement )=>{
if ( pMsgType === apex.message.TYPE.SUCCESS ) {
pElement$.addClass( "animate-msg" );
}
},
beforeHide: ( pMsgType:any, pElement$:any )=>{
if ( pMsgType === apex.message.TYPE.SUCCESS ) {
pElement$.removeClass( "animate-msg" );
}
}
});

}


}


var firstName: string = 'Pierre';
var lastName: string = 'Yotti';
var type = new Car(firstName, lastName);
console.log("The Summe is " + type.getSumme(2, 3));
console.log("The LastName is " + type.getLastName());
type.setLastName('Yotti');
console.log("The LastName is " + type.getLastName());
2 changes: 1 addition & 1 deletion types/orclapex-js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"index.d.ts",
"orclapex-js-tests.ts"
]
}
}