@azrico/reactgrid 1.1.30 → 1.1.31

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.
@@ -421,13 +421,13 @@ function ApplyColumnData(props) {
421
421
  //console.log(final_columns);
422
422
  return final_columns;
423
423
  }
424
- function to_datasource(arr, idProperty) {
424
+ function to_datasource(arr, idProperty, valueAsID = true) {
425
425
  const res = [];
426
426
  let index = 0;
427
427
  if (Array.isArray(arr)) {
428
428
  arr.map(s => {
429
429
  let elem = {};
430
- elem[idProperty] = '_cid_' + index;
430
+ if (valueAsID) elem[idProperty] = String(s).toLowerCase();else elem[idProperty] = '_cid_' + index;
431
431
  if (typeof s === 'object') elem = {
432
432
  ...elem,
433
433
  ...s
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.1.30",
3
+ "version": "1.1.31",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -572,13 +572,14 @@ function ApplyColumnData(props: any): ColumnDefinition[] {
572
572
  return final_columns;
573
573
  }
574
574
 
575
- function to_datasource(arr: any[], idProperty: string) {
575
+ function to_datasource(arr: any[], idProperty: string, valueAsID = true) {
576
576
  const res: any[] = [];
577
577
  let index = 0;
578
578
  if (Array.isArray(arr)) {
579
579
  arr.map((s: any) => {
580
580
  let elem = {};
581
- elem[idProperty] = '_cid_' + index;
581
+ if (valueAsID) elem[idProperty] = String(s).toLowerCase();
582
+ else elem[idProperty] = '_cid_' + index;
582
583
  if (typeof s === 'object') elem = { ...elem, ...s };
583
584
  else elem['label'] = s;
584
585
  res.push(elem);