mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 13:38:44 +02:00
Use npm for gridstack, remove unnecessary folders using our dedicated service
This commit is contained in:
147
node_modules/gridstack/dist/utils.js
generated
vendored
147
node_modules/gridstack/dist/utils.js
generated
vendored
@@ -1,75 +1,75 @@
|
||||
/**
|
||||
* utils.ts 12.3.2
|
||||
* utils.ts 12.4.2
|
||||
* Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
|
||||
*/
|
||||
/**
|
||||
* @internal Checks for obsolete method names and provides deprecation warnings.
|
||||
* Creates a wrapper function that logs a deprecation warning when called.
|
||||
*
|
||||
* @param self the object context to apply the function to
|
||||
* @param f the new function to call
|
||||
* @param oldName the deprecated method name
|
||||
* @param newName the new method name to use instead
|
||||
* @param rev the version when the deprecation was introduced
|
||||
* @returns a wrapper function that warns about deprecation
|
||||
*/
|
||||
// /**
|
||||
// * Checks for obsolete method names and provides deprecation warnings.
|
||||
// * Creates a wrapper function that logs a deprecation warning when called.
|
||||
// *
|
||||
// * @param self the object context to apply the function to
|
||||
// * @param f the new function to call
|
||||
// * @param oldName the deprecated method name
|
||||
// * @param newName the new method name to use instead
|
||||
// * @param rev the version when the deprecation was introduced
|
||||
// * @returns a wrapper function that warns about deprecation
|
||||
// */
|
||||
// eslint-disable-next-line
|
||||
export function obsolete(self, f, oldName, newName, rev) {
|
||||
const wrapper = (...args) => {
|
||||
console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +
|
||||
'with `' + newName + '`. It will be **removed** in a future release');
|
||||
return f.apply(self, args);
|
||||
};
|
||||
wrapper.prototype = f.prototype;
|
||||
return wrapper;
|
||||
}
|
||||
/**
|
||||
* @internal Checks for obsolete grid options and migrates them to new names.
|
||||
* Automatically copies old option values to new option names and shows deprecation warnings.
|
||||
*
|
||||
* @param opts the options object to check and migrate
|
||||
* @param oldName the deprecated option name
|
||||
* @param newName the new option name to use instead
|
||||
* @param rev the version when the deprecation was introduced
|
||||
*/
|
||||
export function obsoleteOpts(opts, oldName, newName, rev) {
|
||||
if (opts[oldName] !== undefined) {
|
||||
opts[newName] = opts[oldName];
|
||||
console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +
|
||||
newName + '`. It will be **removed** in a future release');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal Checks for obsolete grid options that have been completely removed.
|
||||
* Shows deprecation warnings for options that are no longer supported.
|
||||
*
|
||||
* @param opts the options object to check
|
||||
* @param oldName the removed option name
|
||||
* @param rev the version when the option was removed
|
||||
* @param info additional information about the removal
|
||||
*/
|
||||
export function obsoleteOptsDel(opts, oldName, rev, info) {
|
||||
if (opts[oldName] !== undefined) {
|
||||
console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal Checks for obsolete HTML element attributes and migrates them.
|
||||
* Automatically copies old attribute values to new attribute names and shows deprecation warnings.
|
||||
*
|
||||
* @param el the HTML element to check and migrate
|
||||
* @param oldName the deprecated attribute name
|
||||
* @param newName the new attribute name to use instead
|
||||
* @param rev the version when the deprecation was introduced
|
||||
*/
|
||||
export function obsoleteAttr(el, oldName, newName, rev) {
|
||||
const oldAttr = el.getAttribute(oldName);
|
||||
if (oldAttr !== null) {
|
||||
el.setAttribute(newName, oldAttr);
|
||||
console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +
|
||||
newName + '`. It will be **removed** in a future release');
|
||||
}
|
||||
}
|
||||
// export function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {
|
||||
// const wrapper = (...args) => {
|
||||
// console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +
|
||||
// 'with `' + newName + '`. It will be **removed** in a future release');
|
||||
// return f.apply(self, args);
|
||||
// }
|
||||
// wrapper.prototype = f.prototype;
|
||||
// return wrapper;
|
||||
// }
|
||||
// /**
|
||||
// * Checks for obsolete grid options and migrates them to new names.
|
||||
// * Automatically copies old option values to new option names and shows deprecation warnings.
|
||||
// *
|
||||
// * @param opts the options object to check and migrate
|
||||
// * @param oldName the deprecated option name
|
||||
// * @param newName the new option name to use instead
|
||||
// * @param rev the version when the deprecation was introduced
|
||||
// */
|
||||
// export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {
|
||||
// if (opts[oldName] !== undefined) {
|
||||
// opts[newName] = opts[oldName];
|
||||
// console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +
|
||||
// newName + '`. It will be **removed** in a future release');
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * Checks for obsolete grid options that have been completely removed.
|
||||
// * Shows deprecation warnings for options that are no longer supported.
|
||||
// *
|
||||
// * @param opts the options object to check
|
||||
// * @param oldName the removed option name
|
||||
// * @param rev the version when the option was removed
|
||||
// * @param info additional information about the removal
|
||||
// */
|
||||
// export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {
|
||||
// if (opts[oldName] !== undefined) {
|
||||
// console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * Checks for obsolete HTML element attributes and migrates them.
|
||||
// * Automatically copies old attribute values to new attribute names and shows deprecation warnings.
|
||||
// *
|
||||
// * @param el the HTML element to check and migrate
|
||||
// * @param oldName the deprecated attribute name
|
||||
// * @param newName the new attribute name to use instead
|
||||
// * @param rev the version when the deprecation was introduced
|
||||
// */
|
||||
// export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {
|
||||
// const oldAttr = el.getAttribute(oldName);
|
||||
// if (oldAttr !== null) {
|
||||
// el.setAttribute(newName, oldAttr);
|
||||
// console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +
|
||||
// newName + '`. It will be **removed** in a future release');
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Collection of utility methods used throughout GridStack.
|
||||
* These are general-purpose helper functions for DOM manipulation,
|
||||
@@ -101,9 +101,15 @@ export class Utils {
|
||||
}
|
||||
let list = root.querySelectorAll(els);
|
||||
if (!list.length && els[0] !== '.' && els[0] !== '#') {
|
||||
// see if mean to be a class
|
||||
list = root.querySelectorAll('.' + els);
|
||||
if (!list.length) {
|
||||
// else if mean to be an id
|
||||
if (!list.length)
|
||||
list = root.querySelectorAll('#' + els);
|
||||
// else see if gs-id attribute
|
||||
if (!list.length) {
|
||||
const el = root.querySelector(`[gs-id="${els}"]`);
|
||||
return el ? [el] : [];
|
||||
}
|
||||
}
|
||||
return Array.from(list);
|
||||
@@ -484,6 +490,9 @@ export class Utils {
|
||||
static removeInternalAndSame(a, b) {
|
||||
if (typeof a !== 'object' || typeof b !== 'object')
|
||||
return;
|
||||
// skip arrays as we don't know how to hydrate them (unlike object spread operator)
|
||||
if (Array.isArray(a) || Array.isArray(b))
|
||||
return;
|
||||
for (let key in a) {
|
||||
const aVal = a[key];
|
||||
const bVal = b[key];
|
||||
|
||||
Reference in New Issue
Block a user