@guillotinaweb/react-gmi 0.28.4 → 0.29.0

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.
@@ -40,6 +40,12 @@ export interface IRegistry {
40
40
  fieldsToFilter: {
41
41
  [key: string]: string[];
42
42
  };
43
+ defaultSortValue: {
44
+ [key: string]: {
45
+ direction: 'asc' | 'des';
46
+ field: string;
47
+ };
48
+ };
43
49
  }
44
50
  export declare const defaultComponent: (context: any) => typeof FolderCtx;
45
51
  export declare function useRegistry(data: any): {
@@ -57,5 +63,6 @@ export declare function useRegistry(data: any): {
57
63
  child: React.ReactNode;
58
64
  }[];
59
65
  getFieldsToFilter: (type: string, fallback: any) => any;
66
+ getDefaultSortValue: (type: string, fallback: any) => any;
60
67
  getSchemas: (type: string) => {};
61
68
  };
@@ -7292,6 +7292,15 @@ function PanelItems() {
7292
7292
  });
7293
7293
  var get = Ctx.registry.get;
7294
7294
  var fnName = get('searchEngineQueryParamsFunction', SearchEngine);
7295
+
7296
+ if (sortParsed === undefined) {
7297
+ var defaultSortValue = Ctx.registry.getDefaultSortValue(Ctx.context['@type'], {
7298
+ key: 'id',
7299
+ direction: 'des'
7300
+ });
7301
+ sortParsed = parser("_sort_" + defaultSortValue.direction + "=" + defaultSortValue.key + "}");
7302
+ }
7303
+
7295
7304
  var qsParsed = Ctx.client[fnName]({
7296
7305
  path: Ctx.path,
7297
7306
  start: page * PageSize,
@@ -10585,7 +10594,8 @@ var registry = {
10585
10594
  },
10586
10595
  fieldsToFilter: {
10587
10596
  UserManager: ['id', 'email', 'user_name']
10588
- }
10597
+ },
10598
+ defaultSortValue: {}
10589
10599
  };
10590
10600
 
10591
10601
  var get$2 = function get(key, param, fallback) {
@@ -10661,6 +10671,10 @@ var getFieldsToFilter = function getFieldsToFilter(type, fallback) {
10661
10671
  return registry.fieldsToFilter[type] || fallback;
10662
10672
  };
10663
10673
 
10674
+ var getDefaultSortValue = function getDefaultSortValue(type, fallback) {
10675
+ return registry.defaultSortValue[type] || fallback;
10676
+ };
10677
+
10664
10678
  var defaultComponent = function defaultComponent(context) {
10665
10679
  return context.is_folderish ? FolderCtx : ItemCtx;
10666
10680
  };
@@ -10684,6 +10698,7 @@ function useRegistry(data) {
10684
10698
  getProperties: getProperties,
10685
10699
  getItemsColumn: getItemsColumn,
10686
10700
  getFieldsToFilter: getFieldsToFilter,
10701
+ getDefaultSortValue: getDefaultSortValue,
10687
10702
  getSchemas: getSchemas
10688
10703
  };
10689
10704
  }