@webalternatif/js-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +12 -0
- package/.idea/js-core.iml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +20 -0
- package/.idea/vcs.xml +6 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/cjs/array.js +116 -0
- package/dist/cjs/dom.js +466 -0
- package/dist/cjs/eventDispatcher.js +96 -0
- package/dist/cjs/i18n.js +50 -0
- package/dist/cjs/index.js +55 -0
- package/dist/cjs/is.js +85 -0
- package/dist/cjs/math.js +92 -0
- package/dist/cjs/random.js +38 -0
- package/dist/cjs/string.js +474 -0
- package/dist/cjs/stringPrototype.js +16 -0
- package/dist/cjs/traversal.js +110 -0
- package/dist/cjs/utils.js +118 -0
- package/dist/esm/array.js +116 -0
- package/dist/esm/dom.js +466 -0
- package/dist/esm/eventDispatcher.js +96 -0
- package/dist/esm/i18n.js +50 -0
- package/dist/esm/index.js +55 -0
- package/dist/esm/is.js +85 -0
- package/dist/esm/math.js +92 -0
- package/dist/esm/random.js +38 -0
- package/dist/esm/string.js +474 -0
- package/dist/esm/stringPrototype.js +16 -0
- package/dist/esm/traversal.js +110 -0
- package/dist/esm/utils.js +118 -0
- package/i18n/agenda/en.js +73 -0
- package/i18n/agenda/fr.js +73 -0
- package/i18n/agenda/index.js +2 -0
- package/i18n/ajaxform/en.js +5 -0
- package/i18n/ajaxform/fr.js +5 -0
- package/i18n/ajaxform/index.js +2 -0
- package/i18n/ajaxupload/en.js +12 -0
- package/i18n/ajaxupload/fr.js +12 -0
- package/i18n/ajaxupload/index.js +2 -0
- package/i18n/autocomplete/en.js +3 -0
- package/i18n/autocomplete/fr.js +3 -0
- package/i18n/autocomplete/index.js +2 -0
- package/i18n/confirm/en.js +5 -0
- package/i18n/confirm/fr.js +5 -0
- package/i18n/confirm/index.js +2 -0
- package/i18n/core/en.js +4 -0
- package/i18n/core/fr.js +4 -0
- package/i18n/core/index.js +2 -0
- package/i18n/datagrid/en.js +8 -0
- package/i18n/datagrid/fr.js +8 -0
- package/i18n/datagrid/index.js +2 -0
- package/i18n/date/en.js +51 -0
- package/i18n/date/fr.js +51 -0
- package/i18n/date/index.js +2 -0
- package/i18n/datetimepicker/en.js +30 -0
- package/i18n/datetimepicker/fr.js +30 -0
- package/i18n/datetimepicker/index.js +2 -0
- package/i18n/dialog/en.js +3 -0
- package/i18n/dialog/fr.js +3 -0
- package/i18n/dialog/index.js +2 -0
- package/i18n/fulldayeventagenda/en.js +73 -0
- package/i18n/fulldayeventagenda/fr.js +73 -0
- package/i18n/fulldayeventagenda/index.js +2 -0
- package/i18n/index.d.ts +4 -0
- package/i18n/index.js +15 -0
- package/i18n/richtexteditor/en.js +58 -0
- package/i18n/richtexteditor/fr.js +58 -0
- package/i18n/richtexteditor/index.js +2 -0
- package/i18n/select/en.js +3 -0
- package/i18n/select/fr.js +3 -0
- package/i18n/select/index.js +2 -0
- package/i18n/timepicker/en.js +3 -0
- package/i18n/timepicker/fr.js +3 -0
- package/i18n/timepicker/index.js +2 -0
- package/i18n/useragenda/en.js +74 -0
- package/i18n/useragenda/fr.js +73 -0
- package/i18n/useragenda/index.js +2 -0
- package/jest.config.js +14 -0
- package/package.json +33 -0
- package/src/array.js +124 -0
- package/src/dom.js +569 -0
- package/src/eventDispatcher.js +118 -0
- package/src/i18n.js +55 -0
- package/src/index.js +33 -0
- package/src/is.js +89 -0
- package/src/math.js +109 -0
- package/src/random.js +40 -0
- package/src/string.js +576 -0
- package/src/stringPrototype.js +15 -0
- package/src/traversal.js +134 -0
- package/src/utils.js +130 -0
- package/tests/array.test.js +326 -0
- package/tests/dom.test.js +239 -0
- package/tests/eventdispatcher.test.js +177 -0
- package/tests/i18n.test.js +132 -0
- package/tests/index.test.js +29 -0
- package/tests/is.test.js +354 -0
- package/tests/math.test.js +221 -0
- package/tests/random.test.js +72 -0
- package/tests/string.test.js +1106 -0
- package/tests/traversal.test.js +517 -0
- package/tests/utils.test.js +371 -0
- package/tsconfig.json +16 -0
- package/types/array.d.ts +8 -0
- package/types/dom.d.ts +241 -0
- package/types/eventDispatcher.d.ts +12 -0
- package/types/i18n.d.ts +4 -0
- package/types/index.d.ts +139 -0
- package/types/is.d.ts +16 -0
- package/types/math.d.ts +7 -0
- package/types/random.d.ts +7 -0
- package/types/string.d.ts +37 -0
- package/types/stringPrototype.d.ts +1 -0
- package/types/traversal.d.ts +7 -0
- package/types/utils.d.ts +7 -0
- package/webpack.config.cjs +31 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export default webf;
|
|
2
|
+
declare const webf: {
|
|
3
|
+
eventDispatcher: {
|
|
4
|
+
"__#1@#listeners": {};
|
|
5
|
+
addListener(eventsName: any, callback: any, context: any, ...args: any[]): /*elided*/ any;
|
|
6
|
+
addListenerOnce(eventsName: any, callback: any, context: any, ...listenerArgs: any[]): /*elided*/ any;
|
|
7
|
+
dispatch(eventsName: any, ...args: any[]): /*elided*/ any;
|
|
8
|
+
hasListener(eventName: any, callback: any, context: any): boolean;
|
|
9
|
+
removeListener(eventName: any, callback: any, context: any): /*elided*/ any;
|
|
10
|
+
getListeners(eventName: any): any;
|
|
11
|
+
reset(): void;
|
|
12
|
+
};
|
|
13
|
+
translate: (lang: any, ns: any, label: any) => any;
|
|
14
|
+
_: (lang: any, ns: any, label: any) => any;
|
|
15
|
+
getLang: () => any;
|
|
16
|
+
setLang: (lang: any) => void;
|
|
17
|
+
equals: (o1: any, o2: any, seen?: WeakMap<WeakKey, any>) => any;
|
|
18
|
+
noop: () => void;
|
|
19
|
+
sizeOf: (o: any) => number;
|
|
20
|
+
flatten: (o: Object | any[]) => any[];
|
|
21
|
+
strParseFloat: (val: any) => number;
|
|
22
|
+
throttle: (func: any, wait: any, leading?: boolean, trailing?: boolean, context?: null) => (...args: any[]) => void;
|
|
23
|
+
debounce: (func: Function, wait: number, immediate?: boolean, context?: Object) => Function;
|
|
24
|
+
round: (val: any, precision?: number) => number;
|
|
25
|
+
floorTo: (n: any, precision: any) => number;
|
|
26
|
+
plancher: (n: any, precision: any) => number;
|
|
27
|
+
min: (list: any, cmp_func: any) => number | undefined;
|
|
28
|
+
max: (list: any, cmp_func: any) => number | undefined;
|
|
29
|
+
dec2hex: (n: number) => string;
|
|
30
|
+
hex2dec: (hex: string) => number;
|
|
31
|
+
dom: {
|
|
32
|
+
children(el: Element, selector?: string): NodeList;
|
|
33
|
+
child(el: Element, selector?: string): Element | null;
|
|
34
|
+
find(refEl: Element | Document | string, selector?: string): NodeList;
|
|
35
|
+
findOne(refEl: Element | Document | string, selector?: string): Element | null;
|
|
36
|
+
addClass(el: Element, className: string): Element;
|
|
37
|
+
removeClass(el: Element, classNames: string): Element;
|
|
38
|
+
toggleClass(el: Element, classNames: string, force?: boolean): Element;
|
|
39
|
+
hasClass(el: Element, classNames: string): boolean;
|
|
40
|
+
append(el: Element, child: Element): Element;
|
|
41
|
+
prepend(el: Element, child: Element): Element;
|
|
42
|
+
remove(el: Element): void;
|
|
43
|
+
closest(el: Element, selector?: string): Element | null;
|
|
44
|
+
next(el: Element, selector?: string): Element | null;
|
|
45
|
+
prev(el: Element, selector?: string | null): Element | null;
|
|
46
|
+
nextAll(el: Element, selector?: string): Element[];
|
|
47
|
+
prevAll(el: Element, selector?: string): Element[];
|
|
48
|
+
wrap(el: Element, wrappingElement: Element): Element;
|
|
49
|
+
attr(el: Element, name: string, value?: any): Element | any;
|
|
50
|
+
prop(el: Element, name: string, value?: any): any | Element;
|
|
51
|
+
html(el: Element, html?: string): Element | any;
|
|
52
|
+
text(el: Element, text?: string): Element | any;
|
|
53
|
+
hide(el: Element): Element;
|
|
54
|
+
show(el: Element): Element;
|
|
55
|
+
toggle(el: Element): Element;
|
|
56
|
+
data(el: Element, name: {
|
|
57
|
+
[x: string]: string;
|
|
58
|
+
} | string, value?: string): Element;
|
|
59
|
+
removeData(el: Element, name: string): Element | any;
|
|
60
|
+
on(el: Element | Document | Window, event: string, handler: Function, options?: AddEventListenerOptions | false): Element;
|
|
61
|
+
off(el: Element | Document | Window, event: string, handler: Function, options: Object): Element;
|
|
62
|
+
css(el: HTMLElement, styles: {
|
|
63
|
+
[x: string]: string;
|
|
64
|
+
} | string, value?: string): Element;
|
|
65
|
+
closestFind(el: Element, selectorClosest: string, selectorFind: string): NodeList | null;
|
|
66
|
+
closestFindOne(el: Element, selectorClosest: string, selectorFindOne: string): Element | null;
|
|
67
|
+
first(nodeList: NodeList): Element | null;
|
|
68
|
+
last(nodeList: NodeList): Element | null;
|
|
69
|
+
create(html: string): Element;
|
|
70
|
+
eq(nodeList: NodeList, index?: number): Element | null;
|
|
71
|
+
after(el: Element, newEl: Element): Element;
|
|
72
|
+
before(el: Element, newEl: Element): Element;
|
|
73
|
+
empty(el: Element): Element;
|
|
74
|
+
};
|
|
75
|
+
isWindow: (o: any) => boolean;
|
|
76
|
+
isDomElement: (o: any) => boolean;
|
|
77
|
+
getStyle: (elem: any, cssRule: any) => any;
|
|
78
|
+
each: (o: any, callback: any, context: any) => any;
|
|
79
|
+
foreach: (o: any, callback: any, context: any) => any;
|
|
80
|
+
map: (o: any, callback: any, context: any) => any[];
|
|
81
|
+
reduce: (o: any, callback: any, initialValue: any) => any;
|
|
82
|
+
extend: (...args: any[]) => any;
|
|
83
|
+
clone: (o: any) => any;
|
|
84
|
+
merge: (first: any, second?: any[], ...args: any[]) => any;
|
|
85
|
+
inArray: (value: any, arr: Object | any[], index?: number, strict?: boolean) => boolean;
|
|
86
|
+
indexOf: (arr: any, elt: any, from?: number) => number;
|
|
87
|
+
compareArray: (a1: any, a2: any) => any;
|
|
88
|
+
arrayUnique: (arr: any) => any;
|
|
89
|
+
array_unique: (arr: any) => any;
|
|
90
|
+
arrayDiff: (array1: any, array2: any, strict?: boolean) => any;
|
|
91
|
+
array_diff: (arr: any) => any;
|
|
92
|
+
range: (size: any, startAt?: number, step?: number) => any[];
|
|
93
|
+
trim: (str: any, char?: string) => any;
|
|
94
|
+
ltrim: (str: any, char?: string) => any;
|
|
95
|
+
rtrim: (str: any, char?: string) => any;
|
|
96
|
+
stripMultipleSpaces: (str: any) => any;
|
|
97
|
+
noAccent: (str: any) => any;
|
|
98
|
+
br2nl: (str: any) => any;
|
|
99
|
+
nl2br: (str: any) => any;
|
|
100
|
+
ucfirst: (str: any) => any;
|
|
101
|
+
lcfirst: (str: any) => any;
|
|
102
|
+
insertTag: (str: any, tag: any, position?: number, length?: number) => string;
|
|
103
|
+
substringIndex: (str: any, delimiter: any, index: any) => string;
|
|
104
|
+
insert: (str: any, ins: any, n: any) => any;
|
|
105
|
+
reverse: (str: any) => string;
|
|
106
|
+
thousandSeparator: (value: any, separator?: string, pointDecimal?: string) => any;
|
|
107
|
+
numberFormat: (number: any, decimals?: number, forceCentimes?: boolean, thousandSep?: string, pointDecimal?: string) => any;
|
|
108
|
+
toPrice: (number: any, decimals?: number, forceCentimes?: boolean, thousandSep?: string, pointDecimal?: string) => any;
|
|
109
|
+
pad: (str: string, pad_length: number, pad_str?: string, pad_type?: string) => string;
|
|
110
|
+
rgb2hex: (r: number | number[], g?: number, b?: number) => string;
|
|
111
|
+
rgbtohex: (r: number | number[], g?: number, b?: number) => string;
|
|
112
|
+
hex2rgb: (hex: string) => number[];
|
|
113
|
+
hextorgb: (hex: string) => number[];
|
|
114
|
+
parse_url: (str: string) => Object;
|
|
115
|
+
addUrlParam: (url: string, param: string | Object, value?: string | null) => string;
|
|
116
|
+
decodeHtml: (str: any) => any;
|
|
117
|
+
htmlquotes: (str: any) => any;
|
|
118
|
+
htmlsimplequotes: (str: any) => any;
|
|
119
|
+
repeat: (str: any, n: any) => string;
|
|
120
|
+
stripTags: (str: any, tag: any) => any;
|
|
121
|
+
toUrl: (str: any) => any;
|
|
122
|
+
escapeRegex: (str: any) => any;
|
|
123
|
+
camelCase: (str: any) => any;
|
|
124
|
+
format: (str: any, ...args: any[]) => any;
|
|
125
|
+
f: (str: any, ...args: any[]) => any;
|
|
126
|
+
toCssClassName: (str: any) => any;
|
|
127
|
+
hilite: (str: any, req: any, tag?: string) => any;
|
|
128
|
+
formatSize: (bytes: any, decimalPoint?: string) => string;
|
|
129
|
+
compareMixAlphaDigits: (a: any, b: any) => number;
|
|
130
|
+
};
|
|
131
|
+
import * as stringFunctions from './string.js';
|
|
132
|
+
import * as arrayFunctions from './array.js';
|
|
133
|
+
import * as traversal from './traversal.js';
|
|
134
|
+
import { getStyle } from './dom.js';
|
|
135
|
+
import dom from './dom.js';
|
|
136
|
+
import * as math from './math.js';
|
|
137
|
+
import * as utils from './utils.js';
|
|
138
|
+
import eventDispatcher from './eventDispatcher.js';
|
|
139
|
+
export { stringFunctions, arrayFunctions, traversal, getStyle, dom, math, utils, eventDispatcher };
|
package/types/is.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function isString(str: any): boolean;
|
|
2
|
+
export function isObject(o: any): boolean;
|
|
3
|
+
export function isFunction(f: any): boolean;
|
|
4
|
+
export function isPlainObject(o: any): boolean;
|
|
5
|
+
export function isBoolean(b: any): boolean;
|
|
6
|
+
export function isBool(b: any): boolean;
|
|
7
|
+
export function isUndefined(v: any): v is undefined;
|
|
8
|
+
export function isArray(a: any): a is any[];
|
|
9
|
+
export function isDate(o: any): boolean;
|
|
10
|
+
export function isEvent(o: any): boolean;
|
|
11
|
+
export function isInteger(n: any): boolean;
|
|
12
|
+
export function isInt(n: any): boolean;
|
|
13
|
+
export function isFloat(n: any): boolean;
|
|
14
|
+
export function isScalar(value: any): boolean;
|
|
15
|
+
export function isEventSupported(eventName: any): boolean;
|
|
16
|
+
export function isTouchDevice(): boolean;
|
package/types/math.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function round(val: any, precision?: number): number;
|
|
2
|
+
export function floorTo(n: any, precision: any): number;
|
|
3
|
+
export function plancher(n: any, precision: any): number;
|
|
4
|
+
export function min(list: any, cmp_func: any): number | undefined;
|
|
5
|
+
export function max(list: any, cmp_func: any): number | undefined;
|
|
6
|
+
export function dec2hex(n: number): string;
|
|
7
|
+
export function hex2dec(hex: string): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function uniqid(): string;
|
|
2
|
+
export function randAlpha(n: any): string;
|
|
3
|
+
export function randAlphaCs(n: any): string;
|
|
4
|
+
export function randAlphaNum(n: any): string;
|
|
5
|
+
export function randAlphaNumCs(n: any): string;
|
|
6
|
+
export function randNum(n: any): string;
|
|
7
|
+
export function rand(range: any, n: any): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function trim(str: any, char?: string): any;
|
|
2
|
+
export function ltrim(str: any, char?: string): any;
|
|
3
|
+
export function rtrim(str: any, char?: string): any;
|
|
4
|
+
export function stripMultipleSpaces(str: any): any;
|
|
5
|
+
export function noAccent(str: any): any;
|
|
6
|
+
export function br2nl(str: any): any;
|
|
7
|
+
export function nl2br(str: any): any;
|
|
8
|
+
export function ucfirst(str: any): any;
|
|
9
|
+
export function lcfirst(str: any): any;
|
|
10
|
+
export function insertTag(str: any, tag: any, position?: number, length?: number): string;
|
|
11
|
+
export function substringIndex(str: any, delimiter: any, index: any): string;
|
|
12
|
+
export function insert(str: any, ins: any, n: any): any;
|
|
13
|
+
export function reverse(str: any): string;
|
|
14
|
+
export function thousandSeparator(value: any, separator?: string, pointDecimal?: string): any;
|
|
15
|
+
export function numberFormat(number: any, decimals?: number, forceCentimes?: boolean, thousandSep?: string, pointDecimal?: string): any;
|
|
16
|
+
export function toPrice(number: any, decimals?: number, forceCentimes?: boolean, thousandSep?: string, pointDecimal?: string): any;
|
|
17
|
+
export function pad(str: string, pad_length: number, pad_str?: string, pad_type?: string): string;
|
|
18
|
+
export function rgb2hex(r: number | number[], g?: number, b?: number): string;
|
|
19
|
+
export function rgbtohex(r: number | number[], g?: number, b?: number): string;
|
|
20
|
+
export function hex2rgb(hex: string): number[];
|
|
21
|
+
export function hextorgb(hex: string): number[];
|
|
22
|
+
export function parse_url(str: string): Object;
|
|
23
|
+
export function addUrlParam(url: string, param: string | Object, value?: string | null): string;
|
|
24
|
+
export function decodeHtml(str: any): any;
|
|
25
|
+
export function htmlquotes(str: any): any;
|
|
26
|
+
export function htmlsimplequotes(str: any): any;
|
|
27
|
+
export function repeat(str: any, n: any): string;
|
|
28
|
+
export function stripTags(str: any, tag: any): any;
|
|
29
|
+
export function toUrl(str: any): any;
|
|
30
|
+
export function escapeRegex(str: any): any;
|
|
31
|
+
export function camelCase(str: any): any;
|
|
32
|
+
export function format(str: any, ...args: any[]): any;
|
|
33
|
+
export function f(str: any, ...args: any[]): any;
|
|
34
|
+
export function toCssClassName(str: any): any;
|
|
35
|
+
export function hilite(str: any, req: any, tag?: string): any;
|
|
36
|
+
export function formatSize(bytes: any, decimalPoint?: string): string;
|
|
37
|
+
export function compareMixAlphaDigits(a: any, b: any): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function each(o: any, callback: any, context: any): any;
|
|
2
|
+
export function foreach(o: any, callback: any, context: any): any;
|
|
3
|
+
export function map(o: any, callback: any, context: any): any[];
|
|
4
|
+
export function reduce(o: any, callback: any, initialValue: any): any;
|
|
5
|
+
export function extend(...args: any[]): any;
|
|
6
|
+
export function clone(o: any): any;
|
|
7
|
+
export function merge(first: any, second?: any[], ...args: any[]): any;
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function equals(o1: any, o2: any, seen?: WeakMap<WeakKey, any>): any;
|
|
2
|
+
export function noop(): void;
|
|
3
|
+
export function sizeOf(o: any): number;
|
|
4
|
+
export function flatten(o: Object | any[]): any[];
|
|
5
|
+
export function strParseFloat(val: any): number;
|
|
6
|
+
export function throttle(func: any, wait: any, leading?: boolean, trailing?: boolean, context?: null): (...args: any[]) => void;
|
|
7
|
+
export function debounce(func: Function, wait: number, immediate?: boolean, context?: Object): Function;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: 'production',
|
|
5
|
+
entry: './src/index.js',
|
|
6
|
+
output: {
|
|
7
|
+
path: path.resolve(__dirname, 'dist'),
|
|
8
|
+
library: 'webf',
|
|
9
|
+
libraryTarget: 'umd',
|
|
10
|
+
globalObject: 'this',
|
|
11
|
+
filename: "index.js",
|
|
12
|
+
publicPath: "/dist/",
|
|
13
|
+
},
|
|
14
|
+
optimization: {
|
|
15
|
+
minimize: true,
|
|
16
|
+
},
|
|
17
|
+
module: {
|
|
18
|
+
rules: [
|
|
19
|
+
{
|
|
20
|
+
test: /\.js$/,
|
|
21
|
+
exclude: /node_modules/,
|
|
22
|
+
use: {
|
|
23
|
+
loader: 'babel-loader',
|
|
24
|
+
options: {
|
|
25
|
+
presets: ['@babel/preset-env'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|