Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 20, 2020
1 parent 0a8f239 commit 50a5274
Show file tree
Hide file tree
Showing 105 changed files with 2,688 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/grid/_modules_/grid/hooks/root/useColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { Logger, useLogger } from '../utils/useLogger';
import { SORT_MODEL_CHANGE, COLUMNS_UPDATED } from '../../constants/eventsConstants';
import { useRafUpdate } from '../utils';
import { isEqual } from '../../utils';
import { useApiMethod } from './useApiMethod';
import { useApiEventHandler } from './useApiEventHandler';

Expand Down Expand Up @@ -218,10 +219,9 @@ export function useColumns(
const updatedCols: ColDef[] = [];

const currentSortedCols = stateRef.current.all
.filter((column) => column.sortDirection != null)
.map((column) => ({ field: column.field, sort: column.sortDirection }));

if (JSON.stringify(currentSortedCols) === JSON.stringify(sortModel)) {
.filter((c) => c.sortDirection != null)
.map((c) => ({ field: c.field, sort: c.sortDirection }));
if (isEqual(currentSortedCols, sortModel)) {
return;
}

Expand Down
9 changes: 9 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_DataView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getNative from './_getNative.js';
import root from './_root.js';

'use strict';

/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView');

export default DataView;
34 changes: 34 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Hash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import hashClear from './_hashClear.js';
import hashDelete from './_hashDelete.js';
import hashGet from './_hashGet.js';
import hashHas from './_hashHas.js';
import hashSet from './_hashSet.js';

'use strict';

/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;

export default Hash;
34 changes: 34 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_ListCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import listCacheClear from './_listCacheClear.js';
import listCacheDelete from './_listCacheDelete.js';
import listCacheGet from './_listCacheGet.js';
import listCacheHas from './_listCacheHas.js';
import listCacheSet from './_listCacheSet.js';

'use strict';

/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;

export default ListCache;
9 changes: 9 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getNative from './_getNative.js';
import root from './_root.js';

'use strict';

/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');

export default Map;
34 changes: 34 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_MapCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import mapCacheClear from './_mapCacheClear.js';
import mapCacheDelete from './_mapCacheDelete.js';
import mapCacheGet from './_mapCacheGet.js';
import mapCacheHas from './_mapCacheHas.js';
import mapCacheSet from './_mapCacheSet.js';

'use strict';

/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;

export default MapCache;
9 changes: 9 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Promise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getNative from './_getNative.js';
import root from './_root.js';

'use strict';

/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');

export default Promise;
9 changes: 9 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getNative from './_getNative.js';
import root from './_root.js';

'use strict';

/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');

export default Set;
29 changes: 29 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_SetCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import MapCache from './_MapCache.js';
import setCacheAdd from './_setCacheAdd.js';
import setCacheHas from './_setCacheHas.js';

'use strict';

/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;

this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}

// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;

export default SetCache;
29 changes: 29 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Stack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ListCache from './_ListCache.js';
import stackClear from './_stackClear.js';
import stackDelete from './_stackDelete.js';
import stackGet from './_stackGet.js';
import stackHas from './_stackHas.js';
import stackSet from './_stackSet.js';

'use strict';

/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}

// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;

export default Stack;
8 changes: 8 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Symbol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import root from './_root.js';

'use strict';

/** Built-in value references. */
var Symbol = root.Symbol;

export default Symbol;
8 changes: 8 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_Uint8Array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import root from './_root.js';

'use strict';

/** Built-in value references. */
var Uint8Array = root.Uint8Array;

export default Uint8Array;
9 changes: 9 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_WeakMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getNative from './_getNative.js';
import root from './_root.js';

'use strict';

/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');

export default WeakMap;
27 changes: 27 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_arrayFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];

while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}

export default arrayFilter;
51 changes: 51 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_arrayLikeKeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import baseTimes from './_baseTimes.js';
import isArguments from './isArguments.js';
import isArray from './isArray.js';
import isBuffer from './isBuffer.js';
import isIndex from './_isIndex.js';
import isTypedArray from './isTypedArray.js';

'use strict';

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;

for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}

export default arrayLikeKeys;
22 changes: 22 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_arrayPush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;

while (++index < length) {
array[offset + index] = values[index];
}
return array;
}

export default arrayPush;
25 changes: 25 additions & 0 deletions packages/grid/_modules_/grid/lib/lodash/_arraySome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;

while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}

export default arraySome;
Loading

0 comments on commit 50a5274

Please sign in to comment.