dphelper 0.2.89 → 0.2.93
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/{LICENSE.txt → LICENSE.md} +0 -0
- package/README.md +6 -0
- package/index.js +2 -12
- package/package.json +130 -136
- package/.editorconfig +0 -13
- package/.env +0 -3
- package/.eslintignore +0 -13
- package/.eslintrc.json +0 -87
- package/.eslintrc.legacy.json +0 -91
- package/.gitattributes +0 -2
- package/.github/FUNDING.yml +0 -12
- package/.github/dependabot.yml +0 -12
- package/.hintrc +0 -11
- package/.jsbeautifyrc +0 -25
- package/.jshintrc +0 -16
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -8
- package/.stylelintignore +0 -0
- package/.stylelintrc.json +0 -468
- package/.vscode/launch.json +0 -34
- package/.vscode/settings.json +0 -58
- package/3party/shortcut.js +0 -224
- package/CHANGELOG.txt +0 -4
- package/SECURITY.md +0 -3
- package/__mocks__/fileMock.js +0 -3
- package/__mocks__/styleMock.js +0 -3
- package/babel.config.js +0 -30
- package/backup.bat +0 -43
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -0
- package/data/list.json +0 -19
- package/dist/LICENSE.txt +0 -209
- package/dist/README.md +0 -79
- package/elements/button/component.js +0 -0
- package/elements/code/component.js +0 -0
- package/elements/costants.tsx +0 -13
- package/elements/fieldset/component.js +0 -0
- package/elements/input/checkbox/component.js +0 -0
- package/elements/input/date/component.js +0 -27
- package/elements/input/number/component.js +0 -0
- package/elements/input/radio/component.js +0 -0
- package/elements/input/search/component.js +0 -0
- package/elements/input/select/component.js +0 -0
- package/elements/input/slider/component.js +0 -0
- package/elements/input/switch/component.js +0 -0
- package/elements/tab/component.js +0 -0
- package/elements/table/component.js +0 -0
- package/elements/tags.less +0 -0
- package/elements/textarea/component.js +0 -0
- package/elements/x-foo/define.js +0 -33
- package/elements/x-foo/namespace.d.ts +0 -7
- package/init.js +0 -87
- package/jest.config.js +0 -81
- package/node/createTag.js +0 -7
- package/node/gitDeploy.js +0 -7
- package/node/goLive.js +0 -7
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +0 -64
- package/public/documents/iDB/list.html +0 -11
- package/public/documents/iDB/toState.html +0 -11
- package/scripts/.OLD/import.js +0 -48
- package/scripts/.OLD/onBeforeUnLoad.js +0 -120
- package/scripts/.OLD/purge.js +0 -53
- package/scripts/.OLD/string.js +0 -27
- package/scripts/anchor.js +0 -73
- package/scripts/array.js +0 -203
- package/scripts/avoid.js +0 -48
- package/scripts/browser.js +0 -100
- package/scripts/color.js +0 -121
- package/scripts/console.js +0 -97
- package/scripts/console.mapped.js +0 -160
- package/scripts/coods.js +0 -57
- package/scripts/cookie.js +0 -105
- package/scripts/date.js +0 -179
- package/scripts/disable.js +0 -91
- package/scripts/errors.js +0 -3
- package/scripts/event.js +0 -57
- package/scripts/font.js +0 -60
- package/scripts/form.js +0 -211
- package/scripts/format.js +0 -71
- package/scripts/function.js +0 -55
- package/scripts/iDB.js +0 -688
- package/scripts/json.js +0 -84
- package/scripts/load.js +0 -112
- package/scripts/math.js +0 -100
- package/scripts/obj.js +0 -118
- package/scripts/path.js +0 -101
- package/scripts/promise.js +0 -56
- package/scripts/screen.js +0 -82
- package/scripts/scrollbar.js +0 -293
- package/scripts/shortcut.js +0 -83
- package/scripts/socket.js +0 -184
- package/scripts/state.js +0 -87
- package/scripts/storage.js +0 -93
- package/scripts/store.js +0 -115
- package/scripts/svg.js +0 -380
- package/scripts/text.js +0 -116
- package/scripts/time.js +0 -43
- package/scripts/timer.js +0 -54
- package/scripts/tool.js +0 -73
- package/scripts/trigger.js +0 -57
- package/scripts/type.js +0 -76
- package/scripts/ui.js +0 -41
- package/scripts/window.js +0 -244
- package/styles/console.less +0 -95
- package/tests/setupJest.tsx +0 -4
- package/typings/.OLD/cordova.d.ts +0 -12
- package/typings/.OLD/layerpro.d.ts +0 -20
- package/typings/.OLD/menupro.d.ts +0 -20
- package/typings/dphelper.d.ts +0 -26
- package/typings/image.d.ts +0 -5
- package/typings/styles.d.ts +0 -23
- package/webpack.config.js +0 -249
package/scripts/font.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dpHelper
|
|
3
|
-
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under the Apache-2.0, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/***********************************************************************/
|
|
9
|
-
|
|
10
|
-
var description = {
|
|
11
|
-
"name" : "Font",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "font",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"fitContainer",
|
|
18
|
-
"description":""
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"example" : "",
|
|
22
|
-
"author" : "Dario Passariello",
|
|
23
|
-
"active" : true
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
dphelper._list.scripts.push( description );
|
|
27
|
-
|
|
28
|
-
/***********************************************************************/
|
|
29
|
-
|
|
30
|
-
dphelper.font = {
|
|
31
|
-
|
|
32
|
-
fitContainer: ( name ) => {
|
|
33
|
-
if( !name ) return;
|
|
34
|
-
|
|
35
|
-
function fitStart(){
|
|
36
|
-
var divs = document.querySelectorAll( name );
|
|
37
|
-
if( divs.length <= 0 ) return;
|
|
38
|
-
for(var i = 0; i < divs.length; i++) {
|
|
39
|
-
var fontSize = divs[i].offsetWidth * 0.05;
|
|
40
|
-
divs[i].style.fontSize = fontSize+'px';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
dphelper.addListenerMulti( window , 'load resize', () => {
|
|
45
|
-
fitStart( name );
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Object.defineProperty( dphelper, 'font', {
|
|
53
|
-
writable: false,
|
|
54
|
-
configurable: false
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
package/scripts/form.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dpHelper
|
|
3
|
-
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under the Apache-2.0, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/***********************************************************************/
|
|
9
|
-
|
|
10
|
-
var description = {
|
|
11
|
-
"name" : "Form",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "form",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"serialize",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"confirmType",
|
|
21
|
-
"description":"test"
|
|
22
|
-
},{
|
|
23
|
-
"name":"required",
|
|
24
|
-
"description":"test"
|
|
25
|
-
},{
|
|
26
|
-
"name":"minLength",
|
|
27
|
-
"description":"test"
|
|
28
|
-
},{
|
|
29
|
-
"name":"maxLength",
|
|
30
|
-
"description":"test"
|
|
31
|
-
},{
|
|
32
|
-
"name":"maxPhoneNumber",
|
|
33
|
-
"description":"test"
|
|
34
|
-
},{
|
|
35
|
-
"name":"isNumeric",
|
|
36
|
-
"description":"test"
|
|
37
|
-
},{
|
|
38
|
-
"name":"isEmail",
|
|
39
|
-
"description":"test"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"example" : "",
|
|
43
|
-
"author" : "Dario Passariello",
|
|
44
|
-
"active" : true
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
dphelper._list.scripts.push( description );
|
|
48
|
-
|
|
49
|
-
/***********************************************************************/
|
|
50
|
-
|
|
51
|
-
dphelper.form = {
|
|
52
|
-
|
|
53
|
-
serialize: ( form ) => {
|
|
54
|
-
|
|
55
|
-
const $ = require("jquery");
|
|
56
|
-
const el = this;
|
|
57
|
-
//const el = $( form );
|
|
58
|
-
|
|
59
|
-
var self = el,
|
|
60
|
-
|
|
61
|
-
json = {},
|
|
62
|
-
push_counters = {},
|
|
63
|
-
|
|
64
|
-
patterns = {
|
|
65
|
-
//"validate": /^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,
|
|
66
|
-
"validate": /[a-zA-Z][a-zA-Z0-9-_.]/, //{1,200}
|
|
67
|
-
"key": /[a-zA-Z0-9_]+|(?=\[\])/g,
|
|
68
|
-
"push": /^$/,
|
|
69
|
-
"fixed": /^\d+$/,
|
|
70
|
-
"named": /^[a-zA-Z0-9_]+$/
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
el.build = function(base, key, value) {
|
|
74
|
-
base[key] = isNaN(value) || Array.isArray(value) ? value : Number(value);
|
|
75
|
-
return base;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
el.push_counter = function(key) {
|
|
79
|
-
if (push_counters[key] === undefined) {
|
|
80
|
-
push_counters[key] = 0;
|
|
81
|
-
}
|
|
82
|
-
return push_counters[key]++;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
$.each( $(el).serializeArray(), function() {
|
|
86
|
-
|
|
87
|
-
// skip invalid keys
|
|
88
|
-
if (!patterns.validate.test(el.name)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var k,
|
|
93
|
-
keys = el.name.match(patterns.key),
|
|
94
|
-
merge = el.value,
|
|
95
|
-
reverse_key = el.name;
|
|
96
|
-
|
|
97
|
-
if( merge === 'false' ) merge = Boolean(false);
|
|
98
|
-
if( merge === 'true' ) merge = Boolean(true);
|
|
99
|
-
if( merge === 'off' ) merge = Boolean(false);
|
|
100
|
-
if( merge === 'on' ) merge = Boolean(true);
|
|
101
|
-
if( merge === '[]' ) merge = [];
|
|
102
|
-
if( merge === '{}' ) merge = {};
|
|
103
|
-
if( merge === 'undefined' ) merge = undefined;
|
|
104
|
-
if( merge === 'null' ) merge = null;
|
|
105
|
-
if( merge === '' ) merge = '';
|
|
106
|
-
|
|
107
|
-
while ((k = keys.pop()) !== undefined) {
|
|
108
|
-
|
|
109
|
-
// adjust reverse_key
|
|
110
|
-
reverse_key = reverse_key.replace(new RegExp("\\[" + k + "\\]$"), '');
|
|
111
|
-
|
|
112
|
-
// push
|
|
113
|
-
if (k.match(patterns.push)) {
|
|
114
|
-
merge = self.build([], self.push_counter(reverse_key), merge);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// fixed
|
|
118
|
-
else if (k.match(patterns.fixed)) {
|
|
119
|
-
merge = self.build([], k, merge);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// named
|
|
123
|
-
else if (k.match(patterns.named)) {
|
|
124
|
-
merge = self.build({}, k, merge);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
json = $.extend(true, json, merge);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
return json;
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
confirmType: ( type, value ) => {
|
|
136
|
-
|
|
137
|
-
// FIX NUMBERS
|
|
138
|
-
if ( type === 'number' ) {
|
|
139
|
-
const containsNum = new RegExp(/^\d+$/);
|
|
140
|
-
// console.log(type, value, containsNum.test(value.toString()));
|
|
141
|
-
return containsNum.test(value.toString());
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// FIX EMAIL FORMAT
|
|
145
|
-
if ( type === 'email' ) {
|
|
146
|
-
const isEmail = new RegExp(
|
|
147
|
-
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
148
|
-
)
|
|
149
|
-
// console.log( type, value, isEmail.test(value.toString()) );
|
|
150
|
-
return isEmail.test(value.toString().toLowerCase());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return true;
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
required: (value) => {
|
|
157
|
-
if (value === null || value === undefined) {
|
|
158
|
-
return "Required";
|
|
159
|
-
} else {
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
minLength: ( value , num = 1 ) => {
|
|
165
|
-
if (!value || value?.length < num ) {
|
|
166
|
-
return "Must Enter a Value";
|
|
167
|
-
} else {
|
|
168
|
-
return undefined;
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
maxLength: ( value , num = 10 ) => {
|
|
173
|
-
if (value?.length > num ) {
|
|
174
|
-
return "Exceeds Max Length";
|
|
175
|
-
} else {
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
maxPhoneNumber: ( value , num = 10 ) => {
|
|
181
|
-
if (value?.toString()?.length > num ) {
|
|
182
|
-
return "Exceeds Max Length";
|
|
183
|
-
} else {
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
isNumeric: ( value ) => {
|
|
189
|
-
if ( isNaN(value) ) {
|
|
190
|
-
return false;
|
|
191
|
-
} else {
|
|
192
|
-
return value;
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
isEmail: ( value ) => {
|
|
197
|
-
const isEmail = new RegExp(
|
|
198
|
-
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
199
|
-
)
|
|
200
|
-
return isEmail.test( value.toString().toLowerCase() );
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
Object.defineProperty( dphelper, 'form', {
|
|
207
|
-
writable: false,
|
|
208
|
-
configurable: false
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/format.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dpHelper
|
|
3
|
-
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under the Apache-2.0, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/***********************************************************************/
|
|
9
|
-
|
|
10
|
-
var description = {
|
|
11
|
-
"name" : "Format",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "cormat",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"currency",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"phoneNumber",
|
|
21
|
-
"description":"test"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"example" : "",
|
|
25
|
-
"author" : "Dario Passariello",
|
|
26
|
-
"active" : true
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dphelper._list.scripts.push( description );
|
|
30
|
-
|
|
31
|
-
/***********************************************************************/
|
|
32
|
-
|
|
33
|
-
dphelper.format = {
|
|
34
|
-
|
|
35
|
-
currency: ( val, int = 'en-US', cur = 'USD' ) => {
|
|
36
|
-
if( !val || isNaN( val ) ) val = 0;
|
|
37
|
-
var formatter = new Intl.NumberFormat( int , {
|
|
38
|
-
style: 'currency',
|
|
39
|
-
currency: cur,
|
|
40
|
-
});
|
|
41
|
-
// return ( val ).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
|
|
42
|
-
return formatter.format( val );
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
////////////////////////////////////////////////////////////////////////////
|
|
46
|
-
|
|
47
|
-
phoneNumber: (str) => {
|
|
48
|
-
//Filter only numbers from the input
|
|
49
|
-
let cleaned = ('' + str).replace(/\D/g, '');
|
|
50
|
-
|
|
51
|
-
//Check if the input is of correct
|
|
52
|
-
let match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);
|
|
53
|
-
|
|
54
|
-
if (match) {
|
|
55
|
-
//Remove the matched extension code
|
|
56
|
-
//Change this to format for any country code.
|
|
57
|
-
let intlCode = (match[1] ? '+1 ' : '')
|
|
58
|
-
return [intlCode, '(', match[2], ') ', match[3], '-', match[4]].join('')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
Object.defineProperty( dphelper, 'format', {
|
|
67
|
-
writable: false,
|
|
68
|
-
configurable: false
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/function.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dpHelper
|
|
3
|
-
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under the Apache-2.0, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/***********************************************************************/
|
|
9
|
-
|
|
10
|
-
var description = {
|
|
11
|
-
"name" : "Func",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "func",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"new",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"toObj.set",
|
|
21
|
-
"description":"test"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"example" : "",
|
|
25
|
-
"author" : "Dario Passariello",
|
|
26
|
-
"active" : true
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dphelper._list.scripts.push( description );
|
|
30
|
-
|
|
31
|
-
/***********************************************************************/
|
|
32
|
-
|
|
33
|
-
dphelper.func = {
|
|
34
|
-
|
|
35
|
-
new: ( name , text ) => {
|
|
36
|
-
args = [ name , "return" + text ];
|
|
37
|
-
myFunc = Function.apply( null, args );
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
toObj: {
|
|
41
|
-
set: ( value , key ) => {
|
|
42
|
-
return [value , key];
|
|
43
|
-
}
|
|
44
|
-
// var dog = new dphelper.func.oop( "Dog", "Bobby" );
|
|
45
|
-
// console.log( dog.getDetails());
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
Object.defineProperty( dphelper, 'func', {
|
|
51
|
-
writable: false,
|
|
52
|
-
configurable: false
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|