diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5b6c270 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,31 @@ +{ + "name": "orclapex-js", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/base-64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/base-64/-/base-64-0.1.2.tgz", + "integrity": "sha1-Y6wxgwLNq7XwToripW5U1IMhB+I=" + }, + "@types/jquery": { + "version": "3.2.16", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.2.16.tgz", + "integrity": "sha512-q2WC02YxQoX2nY1HRKlYGHpGP1saPmD7GN0pwCDlTz35a4eOtJG+aHRlXyjCuXokUukSrR2aXyBhSW3j+jPc0A==" + }, + "jquery": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz", + "integrity": "sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c=" + }, + "jquery-confirm": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jquery-confirm/-/jquery-confirm-3.3.2.tgz", + "integrity": "sha1-yAp6FRfHOPXlc1mTuxaOk40I9YI=", + "requires": { + "jquery": "3.2.1" + } + } + } +} diff --git a/package.json b/package.json index 8f3a0b8..d162844 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "author": "Adrian Png ): void; // @todo function showPageSuccess(pMessage: string): void; + } namespace navigation { @@ -389,17 +390,17 @@ declare namespace apex { } interface PluginData { - pageItems: string | JQuery | HTMLElement | Array, - 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, + 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 f02?: string | Array f03?: string | Array @@ -419,7 +420,8 @@ declare namespace apex { f17?: string | Array f18?: string | Array f19?: string | Array - f20?: string | Array + f20?: string | Array, + p_request?:string } interface Queue { @@ -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; @@ -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 \ No newline at end of file +// END - Non-namespaced APIs diff --git a/types/orclapex-js/orclapex-js-tests.js b/types/orclapex-js/orclapex-js-tests.js new file mode 100644 index 0000000..c221c52 --- /dev/null +++ b/types/orclapex-js/orclapex-js-tests.js @@ -0,0 +1,97 @@ +/// +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"); + $('Processing').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()); diff --git a/types/orclapex-js/orclapex-js-tests.ts b/types/orclapex-js/orclapex-js-tests.ts index e69de29..7106b83 100644 --- a/types/orclapex-js/orclapex-js-tests.ts +++ b/types/orclapex-js/orclapex-js-tests.ts @@ -0,0 +1,139 @@ +/// +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"); + $('Processing').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()); diff --git a/types/orclapex-js/tsconfig.json b/types/orclapex-js/tsconfig.json index bcf0c8e..7416690 100644 --- a/types/orclapex-js/tsconfig.json +++ b/types/orclapex-js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "orclapex-js-tests.ts" ] -} \ No newline at end of file +}