Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 181dbcc

Browse files
committed
latest rev of tools
* using the latest rev all all tools/packages (used yarn upgrade -L) * fixed eslint for missing types * now using [email protected] and "webpack": "^5.3.2"
1 parent b3afa0c commit 181dbcc

File tree

6 files changed

+2148
-2001
lines changed

6 files changed

+2148
-2001
lines changed

package.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,42 +42,41 @@
4242
"url": "https://github.com/gridstack/gridstack.js/issues"
4343
},
4444
"homepage": "http://gridstack.github.io/gridstack.js/",
45-
"dependencies": {
46-
},
45+
"dependencies": {},
4746
"devDependencies": {
4847
"@types/jasmine": "^3.5.9",
4948
"@types/jquery": "^3.5.1",
5049
"@types/jqueryui": "^1.12.13",
51-
"@typescript-eslint/eslint-plugin": "^2.23.0",
52-
"@typescript-eslint/parser": "^2.23.0",
50+
"@typescript-eslint/eslint-plugin": "^4.6.0",
51+
"@typescript-eslint/parser": "^4.6.0",
5352
"connect": "^3.7.0",
5453
"core-js": "^3.6.4",
5554
"coveralls": "^3.0.9",
5655
"doctoc": "^1.4.0",
57-
"eslint": "^6.8.0",
56+
"eslint": "^7.12.1",
5857
"grunt": "^1.0.4",
5958
"grunt-cli": "^1.3.2",
60-
"grunt-contrib-connect": "^2.1.0",
59+
"grunt-contrib-connect": "^3.0.0",
6160
"grunt-contrib-copy": "^1.0.0",
6261
"grunt-contrib-cssmin": "^3.0.0",
63-
"grunt-contrib-uglify": "^4.0.1",
62+
"grunt-contrib-uglify": "^5.0.0",
6463
"grunt-contrib-watch": "^1.1.0",
65-
"grunt-eslint": "^22.0.0",
64+
"grunt-eslint": "^23.0.0",
6665
"grunt-protractor-runner": "^5.0.0",
6766
"grunt-protractor-webdriver": "^0.2.5",
6867
"grunt-sass": "3.1.0",
6968
"jasmine-core": "^3.5.0",
70-
"karma": "^4.4.1",
69+
"karma": "^5.2.3",
7170
"karma-chrome-launcher": "^3.1.0",
7271
"karma-cli": "^2.0.0",
73-
"karma-jasmine": "^3.1.1",
74-
"karma-typescript": "4.1.1",
75-
"node-sass": "^4.13.1",
76-
"puppeteer": "^2.1.1",
72+
"karma-jasmine": "^4.0.1",
73+
"karma-typescript": "5.2.0",
74+
"node-sass": "^5.0.0",
75+
"puppeteer": "^5.4.1",
7776
"serve-static": "^1.14.1",
78-
"ts-loader": "^6.2.1",
79-
"typescript": "3.4.5",
80-
"webpack": "^4.44.1",
81-
"webpack-cli": "^3.3.12"
77+
"ts-loader": "^8.0.7",
78+
"typescript": "4.0.5",
79+
"webpack": "^5.3.2",
80+
"webpack-cli": "^4.1.0"
8281
}
8382
}

src/gridstack-dd.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type DDDropOpt = {
1818

1919
/** drag&drop options currently called from the main code, but others can be passed in grid options */
2020
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21-
export type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | {} | any;
21+
export type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | any;
2222
export type DDKey = 'minWidth' | 'minHeight' | string;
2323
export type DDValue = number | string;
2424

@@ -33,7 +33,7 @@ export class GridStackDD {
3333
static registeredPlugins: typeof GridStackDD;
3434

3535
/** call this method to register your plugin instead of the default no-op one */
36-
static registerPlugin(pluginClass: typeof GridStackDD) {
36+
static registerPlugin(pluginClass: typeof GridStackDD): void {
3737
GridStackDD.registeredPlugins = pluginClass;
3838
}
3939

src/gridstack-engine.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,11 @@ export class GridStackEngine {
639639
}
640640

641641
/** called to remove all internal values */
642-
public cleanupNode(node: GridStackNode) {
642+
public cleanupNode(node: GridStackNode): GridStackEngine {
643643
for (let prop in node) {
644644
if (prop[0] === '_') delete node[prop];
645645
}
646+
return this;
646647
}
647648

648649
/** @internal legacy method renames */

src/gridstack.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,7 @@ export class GridStack {
310310
this._setupRemoveDrop();
311311
this._setupAcceptWidget();
312312
this._updateWindowResizeEvent();
313-
};
314-
313+
}
315314

316315
/**
317316
* add a new widget and returns it.
@@ -401,7 +400,7 @@ export class GridStack {
401400
* @example
402401
* see http://gridstackjs.com/demo/serialization.html
403402
**/
404-
public load(layout: GridStackWidget[], addAndRemove: boolean | ((w: GridStackWidget, add: boolean) => void) = true) {
403+
public load(layout: GridStackWidget[], addAndRemove: boolean | ((w: GridStackWidget, add: boolean) => void) = true): GridStack {
405404
let items = GridStack.Utils.sort(layout);
406405
let removed: GridStackNode[] = [];
407406
this.batchUpdate();
@@ -435,6 +434,7 @@ export class GridStack {
435434
});
436435
this.engine.removedNodes = removed;
437436
this.commit();
437+
return this;
438438
}
439439

440440
/**
@@ -502,7 +502,7 @@ export class GridStack {
502502
this._triggerAddEvent();
503503
this._triggerChangeEvent();
504504
return this;
505-
};
505+
}
506506

507507
/** re-layout grid items to reclaim any empty space */
508508
public compact(): GridStack {
@@ -1215,7 +1215,7 @@ export class GridStack {
12151215
private _setupRemovingTimeout(el: GridItemHTMLElement): GridStack {
12161216
let node = el.gridstackNode;
12171217
if (!node || node._removeTimeout || !this.opts.removable) return this;
1218-
node._removeTimeout = setTimeout(() => {
1218+
node._removeTimeout = window.setTimeout(() => {
12191219
el.classList.add('grid-stack-item-removing');
12201220
node._isAboutToRemove = true;
12211221
}, this.opts.removeTimeout);

src/utils.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export interface HeightData {
1414
}
1515

1616
/** checks for obsolete method names */
17-
export function obsolete(self, f, oldName: string, newName: string, rev: string) {
17+
// eslint-disable-next-line
18+
export function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {
1819
let wrapper = (...args) => {
1920
console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +
2021
'with `' + newName + '`. It will be **completely** removed in v1.0');
@@ -25,7 +26,7 @@ export function obsolete(self, f, oldName: string, newName: string, rev: string)
2526
}
2627

2728
/** checks for obsolete grid options (can be used for any fields, but msg is about options) */
28-
export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string) {
29+
export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {
2930
if (opts[oldName] !== undefined) {
3031
opts[newName] = opts[oldName];
3132
console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +
@@ -34,14 +35,14 @@ export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: s
3435
}
3536

3637
/** checks for obsolete grid options which are gone */
37-
export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string) {
38+
export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {
3839
if (opts[oldName] !== undefined) {
3940
console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);
4041
}
4142
}
4243

4344
/** checks for obsolete Jquery element attributes */
44-
export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string) {
45+
export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {
4546
let oldAttr = el.getAttribute(oldName);
4647
if (oldAttr !== null) {
4748
el.setAttribute(newName, oldAttr);
@@ -106,14 +107,14 @@ export class Utils {
106107
}
107108

108109
/** removed the given stylesheet id */
109-
static removeStylesheet(id: string) {
110+
static removeStylesheet(id: string): void {
110111
let el = document.querySelector('STYLE[data-gs-style-id=' + id + ']');
111112
if (!el || !el.parentNode) return;
112113
el.parentNode.removeChild(el);
113114
}
114115

115116
/** inserts a CSS rule */
116-
static addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string) {
117+
static addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string): void {
117118
if (typeof sheet.addRule === 'function') {
118119
sheet.addRule(selector, rules);
119120
} else if (typeof sheet.insertRule === 'function') {
@@ -122,7 +123,7 @@ export class Utils {
122123
}
123124

124125
// eslint-disable-next-line @typescript-eslint/no-explicit-any
125-
static toBool(v: any): boolean {
126+
static toBool(v: unknown): boolean {
126127
if (typeof v === 'boolean') {
127128
return v;
128129
}
@@ -154,6 +155,7 @@ export class Utils {
154155
}
155156

156157
/** copies unset fields in target to use the given default sources values */
158+
// eslint-disable-next-line
157159
static defaults(target, ...sources): {} {
158160

159161
sources.forEach(source => {
@@ -172,8 +174,9 @@ export class Utils {
172174
}
173175

174176
/** makes a shallow copy of the passed json struct */
177+
// eslint-disable-next-line
175178
static clone(target: {}): {} {
176-
return {...target}; // was $.extend({}, target)
179+
return {...target};
177180
}
178181

179182
/** return the closest parent matching the given class */
@@ -185,7 +188,7 @@ export class Utils {
185188
}
186189

187190
/** @internal */
188-
static throttle(callback: () => void, delay: number) {
191+
static throttle(callback: () => void, delay: number): () => void {
189192
let isWaiting = false;
190193

191194
return (...args) => {
@@ -197,7 +200,7 @@ export class Utils {
197200
}
198201
}
199202

200-
static removePositioningStyles(el: HTMLElement) {
203+
static removePositioningStyles(el: HTMLElement): void {
201204
let style = el.style;
202205
if (style.position) {
203206
style.removeProperty('position');
@@ -230,7 +233,7 @@ export class Utils {
230233
}
231234

232235
/** @internal */
233-
static updateScrollPosition(el: HTMLElement, position: {top: number}, distance: number) {
236+
static updateScrollPosition(el: HTMLElement, position: {top: number}, distance: number): void {
234237
// is widget in view?
235238
let rect = el.getBoundingClientRect();
236239
let innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight);

0 commit comments

Comments
 (0)