-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.d.ts
769 lines (761 loc) · 30.6 KB
/
core.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
// @ts-check
//#!/usr/bin/env node
// MIT License
// Copyright (c) 2022 FSys Tech Ltd.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Type definitions for web-ui
// Project: https://fsys.tech
// Definitions by: Rajib Chy <https://github.com/rajibchy>
/// <reference types="jquery"/>
/// <reference types="node"/>
import * as JQuery from 'jquery';
// import { Dct } from './framework';
declare type ReqFuncs = { xhr: JQueryXHR };
declare type ReqFunc = { (name?: string, b?: string): void };
declare type SearchDetail = {
[id: string]: any;
show: boolean;
template: string;
header?: any[];
poperty?: any[];
tablesorter?: boolean;
jQDataTable?: {
addDefaultButtons?: boolean;
settings?: DataTables.Settings;
table?: DataTables.Api;
};
detail_event?: boolean | {
on_page_ready: (pagctx: IPageContext) => void;
};
getRow?: (index: number, row: object, withTr?: boolean) => string;
onRender(pagctx: IPageContext, $owner: JQuery<HTMLElement>): void;
beforeRender?: (pagctx: IPageContext, data: any) => void;
dump?: (pagctx: IPageContext, $owner: JQuery<HTMLElement>, resp: any) => void;
};
export declare interface IPageRegInfo {
template?: string | 'SRC__DEFAULT__';
/** Keep Enabled Parent Window While Opening Child By Me */
keepMeEnable?: boolean;
window_interactive?: boolean;
window?: (pageCtx: IPageContext) => {
maximize(evt: JQuery.Event, dlg: JQueryUI.Dialog): void;
minimize(evt: JQuery.Event, dlg: JQueryUI.Dialog): void;
restore(evt: JQuery.Event, dlg: JQueryUI.Dialog): void;
};
event_array?: string[];
route: string;
key: string;
icon?: string;
title: string;
info: {
primary_key: {
id: string;
value: string | number;
};
src_key: string[];
navigator?: boolean;
has_master: boolean;
has_detail: boolean;
search_detail: SearchDetail;
};
toolbar?: {
disabled?: boolean;
buttons?: string[];
disabledButtons?: string[];
enabled?: string[];
reload?: ((cb: (pagctx: IPageContext) => void, pagctx: IPageContext) => void) | boolean;
clean?: {
before?: (pagctx: IPageContext) => void;
after?: (pagctx: IPageContext) => void
};
save?: {
before?: (pagctx: IPageContext, $owner: JQuery<HTMLElement>) => void;
after?: (pagctx: IPageContext, resp: any, isUpdate: boolean) => void;
};
delete?: {
before?: (pagctx: IPageContext, $owner: JQuery<HTMLElement>) => void;
after?: (pagctx: IPageContext, resp: any) => void;
};
search?: {
before?: (pagctx: IPageContext, $owner: JQuery<HTMLElement>) => void;
after?: (pagctx: IPageContext, resp: any) => void;
};
};
button?: {
footer: {
align: string;
title: string;
callback: (e: any) => void;
};
} | Dct<any>;
dynamic_report: boolean;
report: (event: any) => void;
/**
* Create `Print Preview` accordingly `IPrintConfig`
*
* `url: string;`
* `name?: string;`
* `specs?: string;`
*
* `parent_window?: boolean;`
* `self_print?: boolean;`
*/
print_settings?: (pagctx: IPageContext, primaryKey: string, index: any) => IPrintConfig;
}
export declare interface IPrintConfig {
url: string; name?: string;
specs?: string;
parent_window?: boolean;
self_print?: boolean;
}
declare interface IPageConfig {
readonly reg: IPageRegInfo;
readonly cmd: ISQLCommand;
readonly fm: IFormInfo;
beforeRegEvent?: (pageCtx: IPageContext) => void;
customEvent(pageCtx: IPageContext): void;
onReady(pageCtx: IPageContext): void;
onDispose(pageCtx: IPageContext): void;
}
export declare interface IPageEvent {
customEvent(pageCtx: IPageContext): void;
onReady(pageCtx: IPageContext): void;
onDispose(pageCtx: IPageContext): void;
beforeRegEvent(pageCtx: IPageContext): void;
}
declare type CommandConf = {
sp?: string;
module?: string;
validate?: boolean;
};
export declare interface ISQLCommand {
readonly iu?: CommandConf;
readonly d?: CommandConf;
readonly s?: {
def_type?: 'query' | 'object';
type?: 'SQL' | 'SP';
sp?: string;
sql?: string | ((pageCtx: IPageContext, obj?: Dct<any>) => string);
validate: boolean;
module: string;
table?: string;
schema?: string;
};
readonly __dd?: CommandConf;
readonly lq?: CommandConf;
}
export declare type ExternalLink = {
param?: string[] | ((pageCtx: IPageContext) => string[]);
paramName?: string;
dependency?: string;
route: string;
width: string;
height: string;
position?: { my?: string, at?: string },
modal: boolean;
resizable: boolean;
click?: (pageCtx: IPageContext) => void;
done?: (t: string) => void;
fail?: () => void;
}
export declare type ElementRules = {
/** Ensure this value data type*/
m?: 'text' | 'numeric' | 'boolean' | 'url' | 'date' | 'time' | 'email' | 'mobile' | 'multiple',
/** Maximum length of value */
max?: number,
/** Minimum length of value */
min?: number,
/** Is this required */
required?: boolean;
/** Custom validator */
fn?: (val: string) => boolean;
}
declare type OptionItem = {
/** Option Id */
id: any;
/** Option title */
title: any;
/** Is element default selected */
selected?: boolean,
/** Is this element disabled ? */
readonly disabled?: boolean;
/** Element style */
readonly style?: string;
};
/** Form element config */
export declare type ElementInfo = {
/** Define the type of `element` */
readonly t: 'input' | 'textarea' | 'dropdown' | 'date' | 'time-picker' | 'switch' | 'html' | 'widget' | 'multiple';
/** this is element name */
readonly name?: string;
/** Can use this element when search tigger ? */
readonly src?: boolean;
/** Use this rules for this element `validation` */
readonly rules?: ElementRules;
/** Custom `style` for this element */
readonly style?: string;
/** Define sql field name. It will use while perform `search/update/insert` (Like as your db table column name e.g. `id` or `schema.id`) */
readonly sql?: string;
/** If value type `string` then you can allow `ilike=%value%` in sql statement. */
readonly ilike?: boolean;
/** Define this element width (`bootstrap col width 12/1`) */
readonly w: number;
/** this element accept `drop` */
readonly dropable?: boolean;
/** this element accept drag */
readonly dragable?: boolean;
/** this element custom `class` */
readonly cls?: string;
/** This is element label */
readonly title?: string;
/** Cust element HTML */
readonly html?: string | (() => string);
/** Element attribute */
readonly attr?: string;
/** It will use while you allow `dragable` or `dropable` this `element` */
readonly z_index?: number;
/** Is this element disabled ? */
readonly disabled?: boolean;
/** each value add custom `data-event-your-value` attribute */
readonly event?: Dct<(pageCtx: IPageContext, e: JQuery.Event, $owner: JQuery<HTMLElement>) => void>;
/** it will use while your element type is switch. You can use on|off */
readonly text?: string;
/** Element `placeholder` */
readonly p?: string;
/** Define this element is `read only` */
readonly read_only?: boolean;
/** Use this external link for this element */
readonly external_link?: string | ((conf: ExternalLink, pageCtx: IPageContext) => ExternalLink);
/** Set default value for this `element`. If this is true then this attribute `data-default-value="false"` will be set in element */
readonly default_value?: boolean;
/** widget key. It will be effect in `widget element` */
readonly widget?: string;
/** Default dropdown source data */
readonly data?: OptionItem[];
/** It will be effect while your element type is `dropdown`*/
readonly source?: ((pageCtx: IPageContext) => SourceType) | 'OWN' | SourceType;
/** Define the dropdown type. It will be effect while your element type is `dropdown` */
readonly drop_type?: "select" | "selectize" | string;
/** It will fire on Search trigger */
readonly sql_def?: ISqlDef;
};
/*export declare interface ISelectizeConfig {
options?: any[];
optgroups?: any[];
maxItems?: number;
valueField?: string;
labelField?: string;
searchField?: string | any[];
create?: boolean;
preload?: boolean;
persist?: boolean;
delimiter?: string;
optgroupField?: string;
optgroupLabelField?: string;
optgroupValueField?: string;
lockOptgroupOrder?: boolean;
plugins?: string[];
}*/
export declare type DropDef = {
url?: string; sp: ((pageCtx: IPageContext) => void) | string;
param?: (obj: Dct<any>) => Dct<any>;
selectize_config?: Selectize.IOptions<any, any>;
};
declare type SourceType = {
query?: string;
schema?: string;
table?: string;
/** If this element auto load enable. Then it's should be provide. */
poperty?: string;
type?: "SQL" | "SP" | "TABLE";
add_new?: string;
search_poperty?: string;
drop_type?: "selectize";
/** Define this `element` can be auto load. `If false` it's can be `KeyUp` */
load?: boolean;
drop_def?: DropDef | Selectize.IOptions<any, any> | ((obj: Dct<any>, pageCtx: IPageContext, lookup: (look: DropDef) => Selectize.IOptions<any, any>) => void);
};
export declare interface IWidget {
readonly title: string;
readonly key: string;
readonly collapse: boolean;
readonly fields: Dct<ElementInfo>[];
}
declare interface ITypeofTabs {
title: string;
key?: string;
active?: boolean;
fields: Dct<ElementInfo>[];
}
export declare interface IFormInfo {
tabs?: {
header?: ITypeofTabs[];
footer?: ITypeofTabs[];
};
header?: Dct<ElementInfo>[];
footer?: Dct<ElementInfo>[];
widget?: {
header?: IWidget[];
footer?: IWidget[];
settings?: {
header: Dct<{ title: string; collapse: boolean; }>;
footer: Dct<{ title: string; collapse: boolean; }>;
}
};
}
declare type AlertConfig = {
readonly icon?: string;
readonly title?: string; content: string;
readonly text?: string;
readonly btnClass?: string;
ok?: () => void;
};
declare type PromptConfig = {
readonly icon?: string;
readonly title?: string;
readonly required?: boolean | Dct<any>;
readonly content?: string[] | string;
ok: (val: any) => void;
cancel: () => void;
};
declare type ConfirmConfig = {
readonly icon?: string;
readonly title?: string;
readonly required?: boolean;
readonly content?: string[] | string;
confirm: (inst: JQuery<HTMLElement>) => void;
readonly onContentReady?: () => void;
cancel: (msg: string, inst: JQuery<any>) => void;
};
declare type XHRConfig = {
readonly uri?: string;
readonly def: Dct<any>;
readonly sp: string;
readonly validate: boolean;
readonly module: string;
readonly data_required?: boolean;
abort?: (status: string, xhr: JQueryXHR, textStatus?: string, error?: string) => void;
done(rs: { ret_val: number; ret_msg: string; ret_data_table: any; }): void;
fail(rs: { ret_val: number; ret_msg: string; ret_data_table: any; } | string, xhr?: JQueryXHR, textStatus?: string, error?: string): void;
};
export declare type DatabaseRequestConfig = {
route: string;
uri?: string;
def: Dct<any>;
conf?: CommandConf;
done(data: { ret_val: number; ret_msg: string; ret_data_table: any }): void;
fail(jqXHR: JQueryXHR, textStatus?: string, error?: string): void;
};
declare interface INotification {
/** Clean notification */
clean(): void;
/** Exit notification */
exit(): void;
/** Show notificaton */
show(msg: string, cls?: string, interval?: number): void;
}
export declare type IRequest = {
route: string;
original: string;
param: Dct<any>;
populate: <T>(reqObj?: Dct<T>) => Dct<T>;
};
export declare interface IExHandsonTable {
/** Clean `HandsonTable` with empty `dataSet` */
cleanHandsonTable(): void;
/** Invoke `hot.loadData`. If `data.length` < `minLength` then create remaining empty line*/
loadDetail(data: any[]): void;
/** create empty `DataSet` for `handsontable` */
createEmptyDataSet(count: number, data: any[]): void;
/** Resize `HandsonTable` */
resize(): void;
}
export declare interface IPageContextElement {
/** This `context` `HTMLElement` `instanceof` `JQuery<HTMLElement>` */
$elm: JQuery<HTMLElement>;
/** Any type of value this `HTMLInputElement` */
value: any;
}
export declare interface IPageContext {
readonly isdialog: boolean;
readonly reg: IPageRegInfo;
/** Current `IPageContext` `HTMLElement`s */
readonly elements: Dct<IPageContextElement>;
readonly _query: IRequest;
readonly notification: INotification;
/** Page container */
readonly $container: JQuery<HTMLElement>;
readonly destroy_event: (() => void)[];
__data_navigate: boolean;
isDisabled: boolean;
msgBoxOpenCount: number;
hot: IExHandsonTable;
/** Create communication with database by `XMLHTTPRequest` */
db: IWebDatabase;
prepare(containerKey: string): void;
$ui(): JQueryUI.Dialog | void;
getInteractive(): JQueryUI.Dialog;
onSearch(data?: any, cb?: (...args: any[]) => void): void;
onDispose(): void;
destroyDetailTable(): void;
getDependency(): string[];
enableDisable(t: 'enable' | 'disable', field?: string[]): void;
/**
* Try to read or write column defination form local storage
* @param columns Datatable column array[], If empty/null then return from storage; otherwise, override at storage
*/
getSetColumnDef(columns?: string[]): string[] | void;
dumpObj(obj: Dct<any>): void;
dependencyResolve(params: any): void;
onTransportRequest(request: IRequest): void;
quoteLiteral(value?: string): string;
/** Create `SQL Statement` from `Dct<any>` */
createQuery(obj: Dct<string>, sqlDef?: Dct<ISqlDef>): string;
setDisposeProp(keys: (Dct<any>[]) | string, type?: string): void;
lockUnlockElm(lock: boolean): void;
alert(cfg: AlertConfig): void;
prompt(cfg: PromptConfig): void;
confirm(cfg: ConfirmConfig): void;
validate($arg?: JQuery<HTMLElement>, allow_invalid?: boolean): Dct<any> | void;
validateKeyup($arg: JQuery<HTMLElement>, async?: boolean): void;
createDropDown(obj: string | OptionItem[]): string;
_xhr(cfg: JQueryAjaxSettings, s: (rs: {
error: boolean;
response: any;
}) => void, e: (rs: {
error: boolean;
response: any;
jqXHR?: JQueryXHR;
textStatus?: string;
}) => void): JQueryXHR;
xhr(config: XHRConfig): JQueryXHR;
populateDetail(data: Dct<any>, cb?: (status: string, $owner?: JQuery<HTMLElement>) => void, $owner?: JQuery<HTMLElement>): void;
populateMaster(row: Dct<any>): void;
printPreview(id: string | ((pctx: IPageContext) => void), val: any): IPageContext;
print(cb: (pctx: IPageContext, status: string, index?: any) => void, index?: any): void;
delete(cb: (status: string, index: number | string) => void): void;
clear($elem?: JQuery<HTMLElement>): IPageContext;
getSearchObj($inst?: JQuery<HTMLElement>, type?: string): Dct<any> | any[];
searchObjModify?: (obj: any[] | Dct<any>) => void;
clean(cb?: (status: string) => void): IPageContext;
onUpdateObjModify?: (newRow: Dct<any>, mainRow: Dct<any>) => void;
save(cb: (status: string, retVal?: number, isUpdate?: boolean) => void, formobj?: Dct<any>, confirmMsg?: string, afterSave?: (res: { ret_val: number; isUpdate: boolean; }, next: () => void) => void): void;
search(cb: (status: string) => void, obj?: Dct<any>, def?: Dct<any>): void | JQuery.jqXHR<any>;
__onSearchDataModify?: (data: Dct<any>[]) => Dct<any>[];
__afterQueryBuilder?: (enq: string) => string;
loadDropDown(cb: (status: string) => void, sdestroy?: boolean): void;
saveObjModify?: (obj: Dct<any>) => { error: boolean; msg?: string };
beforeSearch?: (obj: Dct<any>) => Dct<any>;
/** This method will be throw if `DropzoneExtend.export` does not invoked yet */
clean_dropzone(): void;
/** This method will be throw if `DropzoneExtend.export` does not invoked yet */
dropzone_dispose(): void;
/** If this `window` is `child` then `window` will be `shake` */
shake(): void;
/** Build `search` `param` with after */
buildSearchParam(arr: { poperty: string; value: any }[]): { param: { poperty: string; value: any }[], after_subquery?: string; };
}
export declare interface INavigator {
getData(): Dct<any>;
populate(): INavigator;
populate_row(row: Dct<any>, cb: () => void): INavigator;
update(row: Dct<any>, isUpdate: boolean): INavigator;
getDetail$(): JQuery<HTMLElement> | void;
reset(): INavigator;
setData(data: Dct<any>[], $tabel?: JQuery<HTMLElement>, nPopulate?: boolean): INavigator;
enable(): INavigator;
disable(): INavigator;
changeIndex(row?: number, cb?: () => void, is_table?: boolean): INavigator;
delete(): void;
data_backward($el: JQuery<HTMLElement>): INavigator;
data_backward_last($el: JQuery<HTMLElement>): INavigator;
data_forward($el: JQuery<HTMLElement>): INavigator;
data_forward_last($el: JQuery<HTMLElement>): INavigator;
dispose(): INavigator;
}
export declare type ISource = {
param: any[];
map: Dct<{
add_new: string;
owner: string;
drop_type: "select" | string;
drop_def: DropDef | Selectize.IOptions<any, any>;
}[]>
};
export declare interface PageContexConstructor {
new(req: IRequest, $elm: JQuery<HTMLElement>, cb: (status: string) => void, isdialog?: boolean, $ui?: JQueryUI.Dialog): PageContext;
readonly prototype: PageContext;
}
export declare class PageContext implements IPageContext {
public readonly _query: IRequest;
public readonly isdialog: boolean;
public readonly isDisposed: boolean;
public $ui(): JQueryUI.Dialog | void;
public readonly $container: JQuery<HTMLElement>;
public readonly reg: IPageRegInfo;
public readonly destroy_event: (() => void)[];
private cmd: ISQLCommand;
private pageEvent: IPageEvent;
public elements: Dct<IPageContextElement>;
public notification: INotification;
private sql_def: Dct<ISqlDef>;
private ___callback: (() => void)[];
private _cb: (status: string) => void;
private drop_srch_map: Dct<string>;
private dispose_prop: { key: string; type: string; }[];
private source: ISource;
private children: Dct<{
click?: (pageCtx: IPageContext) => void;
param?: string[] | ((pageCtx: IPageContext) => string[]);
route?: string;
}>;
private _navigator?: INavigator;
private fm: Dct<ElementInfo>;
private isShaking: boolean;
constructor(route: string, $elm: JQuery<HTMLElement>, __cb: (status: string) => void, isdialog: boolean, ___$ui?: JQueryUI.Dialog);
private postmortem(): void;
private _: {
event: {
fire(evt: string): (e: JQuery.Event) => void;
}
};
private readonly ajax: JQueryXHR[];
private readonly data_map?: Dct<any>;
public hot: IExHandsonTable;
public db: IWebDatabase;
public msgBoxOpenCount: number;
public isDisabled: boolean;
public __data_navigate: boolean;
/**
* Try to read or write column defination form local storage
* @param columns Datatable column array[], If empty/null then return from storage; otherwise, override at storage
*/
public getSetColumnDef(columns?: string[]): string[] | void;
public getInteractive(): JQueryUI.Dialog;
public prepare(containerKey: string): void;
public onSearch(data?: any, cb?: (...args: any[]) => void): void;
public onDispose(): void;
public destroyDetailTable(): void;
public getDependency(): string[];
public enableDisable(t: 'e' | 'd' | 'enable' | 'disable', field?: string[]): void;
public dumpObj(obj: Dct<any>): void;
public dependencyResolve(params: any): void;
public onTransportRequest(request: IRequest): void;
public quoteLiteral(value?: string): string;
/** Create `SQL Statement` from `Dct<any>` */
public createQuery(obj: Dct<string>, sqlDef?: Dct<ISqlDef>): string;
public setDisposeProp(keys: (Dct<any>[]) | string, type?: string): void;
public lockUnlockElm(lock: boolean): void;
public alert(cfg: AlertConfig): void;
public prompt(cfg: PromptConfig): void;
public confirm(cfg: ConfirmConfig): void;
public validate($arg?: JQuery<HTMLElement>, allow_invalid?: boolean): Dct<any> | void;
public validateKeyup($arg: JQuery<HTMLInputElement>, async?: boolean): void;
public createDropDown(obj: string | OptionItem[]): string;
public _xhr(cfg: JQueryAjaxSettings, s: (rs: {
error: boolean;
response: any;
}) => void, e: (rs: {
error: boolean;
response: any;
jqXHR?: JQueryXHR;
textStatus?: string;
}) => void): JQueryXHR;
public xhr(config: XHRConfig): JQueryXHR;
public populateDetail(data: Dct<any>, cb?: (status: string, $owner?: JQuery<HTMLElement>) => void, $owner?: JQuery<HTMLElement>): void;
public populateMaster(row: Dct<any>): void;
public printPreview(id: string | ((pctx: IPageContext) => void), val: any): IPageContext;
public print(cb: (pctx: IPageContext, status: string, index: any) => void, index: any): void;
public delete(cb: (status: string, index: number | string) => void): void;
public clear($elem?: JQuery<HTMLElement>): IPageContext;
public getSearchObj($inst?: JQuery<HTMLElement>, type?: string): Dct<any> | any[];
public searchObjModify?: (obj: any[] | Dct<any>) => void;
public clean(cb?: (status: string) => void): IPageContext;
public onUpdateObjModify?: (nrow: Dct<any>, orow: Dct<any>) => void;
public save(cb: (status: string, retVal?: number, isUpdate?: boolean) => void, formobj?: Dct<any>, confirmMsg?: string, afterSave?: (res: { ret_val: number; isUpdate: boolean; }, next: () => void) => void): void;
public search(cb: (status: string) => void, obj?: Dct<any>, def?: Dct<any>): void | JQuery.jqXHR<any>;
public __onSearchDataModify?: (data: Dct<any>[]) => Dct<any>[];
public __afterQueryBuilder?: (enq: string) => string;
public loadDropDown(cb: (status: string) => void, sdestroy?: boolean): void;
public dispose(): void;
private dragable: {
keys: JQuery<HTMLElement>[];
invalid_count: number;
isValid: (key: string) => boolean;
};
private regWidget(selector: string): void;
public saveObjModify?: (obj: Dct<any>) => { error: boolean; msg?: string };
public beforeSearch?: (obj: Dct<any>) => Dct<any>;
public resolve(opt: { url: string; route: string; done: () => void }): void;
public clean_dropzone(): void;
public dropzone_dispose(): void;
public shake(): void;
/** Build `search` `param` with after */
public buildSearchParam(arr: { poperty: string; value: any }[]): { param: { poperty: string; value: any }[], after_subquery?: string; };
}
declare interface InternalWorker {
[id: string]: any;
validate: {
keyup($elem: JQuery<HTMLElement>): number;
keyupAsync($elem: JQuery<HTMLElement>): void;
all($elem: JQuery<HTMLElement>, ignoreInvalid?: boolean): NodeJS.Dict<any>;
};
/** Open alert window. Initilized by `$.confirm` */
alert(cfg: AlertConfig): void;
/** Open prompt window. Initilized by `$.confirm` */
prompt(cfg: PromptConfig): void;
/** Open confirm window. Initilized by `$.confirm` */
confirm(cfg: ConfirmConfig): void;
}
export declare type ISqlDef = { (pageCtx: IPageContext, pv: string, obj: Dct<any>): void | Dct<any> | string };
// 12:37 AM 11/12/2020 by rajib chy
export declare interface IWatermark {
/** Clear `Watermark` from given `HTMLElement`*/
clear($elem: JQuery<HTMLElement>): void;
/** Set `Accepted` `Watermark` in given `HTMLElement`*/
accepted($elem: JQuery<HTMLElement>): void;
/** Set `Rejected` `Watermark` in given `HTMLElement`*/
rejected($elem: JQuery<HTMLElement>): void;
/** Set `Transferred` `Watermark` in given `HTMLElement`*/
transferred($elem: JQuery<HTMLElement>): void;
/** Set `Checked` `Watermark` in given `HTMLElement`*/
checked($elem: JQuery<HTMLElement>): void;
/** Set `Verified` `Watermark` in given `HTMLElement`*/
verified($elem: JQuery<HTMLElement>): void;
/** Set `Approved` `Watermark` in given `HTMLElement`*/
approved($elem: JQuery<HTMLElement>): void;
/** Set `Authorized` `Watermark` in given `HTMLElement`*/
authorized($elem: JQuery<HTMLElement>): void;
}
interface IWebForm {
/** Generate `form` from `Dct<ElementInfo>[]` */
generate(fm: Dct<ElementInfo>[]): { fields: Dct<ElementInfo>; sql_def: Dct<ISqlDef>; body: string; };
/** Render `form` according to `IFormInfo` in given `container` */
render(fm: IFormInfo, $elm: JQuery<HTMLElement>): { fields: Dct<ElementInfo>; sql_def: Dct<ISqlDef> };
}
interface IPageContextScript {
/** Remove given `route` `script` `context` from `global` `isolate` */
remove(route: string): void;
/** Run given `script` in current `document` with `global` `context` */
append(route: string, script?: string, cb?: (status: string) => void): void;
}
export declare interface IWebUI {
/** Check MVC route and forward */
checkRoute(): void;
/** Render given `route`, if already been registered */
renderView(route: string, $elm: JQuery<HTMLElement>, __cb: (status: string) => void, isdialog?: boolean, ___$ui?: JQueryUI.Dialog, __container_key?: string): void;
/** Get given `route` template name */
getTemplateName(route): string | void;
/** Communicate current `IPageContext` to given `route` `IPageContext` */
transportRequest(route: string, obj?: IRequest): IWebUI;
/** Reslove given `route`. If already has `IPageContext` */
resolve(opt: { url: string; route: string; done: () => void }): boolean;
/** Check given `route` is registred ? */
routeIsRegistred(route: string): boolean;
/** Set this route is `IPageContext` */
active(route: string, e?: JQuery.ClickEvent): void;
/** Get active `route` */
active(): string;
/** Get Active `IPageContext` */
getActiveCtx(): IPageContext;
/** Get Active `route` */
getActiveRoute(): string;
/** Check this `route` is exists */
isRouteExists(route: string): boolean;
/** Check this `route` `IPageContext`*/
getRouteCtx(route: string): IPageContext;
/** Register current `route` dependency. */
regDependency(opt: { dependency: string; url: string }): void;
/** Add new web-page config */
assign(opt: IPageConfig, dependency: string): IWebUI;
/** postmortem all `IPageContext` */
postmortem(): IWebUI;
/** Dispose given `route` `IPageContext` with dependency */
dispose(route: string, cb: void | ((status: string) => void)): IWebUI;
/** Destroy given `route` `IPageContext` with dependency */
destroy(route: string, cb: void | ((status: string) => void)): IWebUI;
script: IPageContextScript;
/** Create new `Child Window` */
openNew(opt: OpenNewWindowConfig): void;
/** Fetch the given template from server or mem cache */
getTemplate(templ?: string, cb?: (status: string, template: string) => void): void;
/** Check this route has any dependency */
hasDependency(route: string): boolean;
/** Get dependancy of current page context */
getDependency(route: string): string[];
/** Remove Page Config */
removeConfig(route: string): void;
/** Get the given route `IPageConfig`*/
getConfig(route: string): IPageConfig | void;
/** Open alert window. Initilized by `$.confirm` */
alert(cfg: AlertConfig): void;
/** Open prompt window. Initilized by `$.confirm` */
prompt(cfg: PromptConfig): void;
/** Open confirm window. Initilized by `$.confirm` */
confirm(cfg: ConfirmConfig): void;
/** Add or Remove `Watermark` in `HTMLElement`*/
watermark: IWatermark;
/** `Web UI` Form generator */
form: IWebForm;
}
export declare type OpenNewWindowConfig = {
dependency?: string;
draggable?: boolean;
modal?: boolean;
resizable?: boolean;
autoOpen?: boolean;
url?: string;
route: string;
height?: string;
width?: string;
position?: { my?: string, at?: string };
done?: (...args: any[]) => void;
fail?: (...args: any[]) => void;
};
declare interface ITemplateScript {
has(identity: string): boolean;
remove(identity: string): boolean;
parse(identity: string, text: string, cb: () => void): void;
register(identity: string, func: () => void): void;
run(identity: string, data: any, cb: (str: string) => void): ITemplateScript;
parse(tname: string, data: string, next: () => void): void
}
export declare interface IWeb {
page(config: IPageConfig): void;
readonly UI: IWebUI;
readonly Template: {
readonly script: ITemplateScript;
readonly getSet: {
[id: string]: ($elm?: JQuery<HTMLElement>) => undefined | string
}
};
readonly userInfo: {
readonly roleId: string;
readonly loginId: string;
readonly userData?: {
readonly org_id?: string;
readonly on_behalf?: string;
readonly terminal_id?: string;
};
};
readonly Ext: {
export(need?: string[]): InternalWorker;
};
errorResponse(errorCode: string, $container: JQuery<HTMLElement>, oldResponse: string, cb?: () => void): void;
onUnload(route: string, cb: void | ((status: string) => void)): this;
destroy(route: string, cb: void | ((status: string) => void)): this;
}