@guillotinaweb/react-gmi 0.32.2 → 0.33.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.
package/README.md CHANGED
@@ -127,10 +127,8 @@ yarn start
127
127
 
128
128
  ## Sponsors
129
129
 
130
- This project is sponsored by <a href="https://www.vinissimus.com">Vinissimus Wine Shop</a> and <a href="https://iskra.cat">Iskra</a>
130
+ This project is sponsored by <a href="https://iskra.cat">Iskra</a>
131
131
 
132
- <a href="https://www.vinissimus.com"><img src="https://cdn.vinissimus.com/front/static/images/vinissimus-logo.svg" /></a>
133
- <br/>
134
132
  <a href="https://iskra.cat"><img src="https://storage.googleapis.com/iskra/iskra-logo.png" /></a>
135
133
 
136
134
  # TODO
@@ -1,6 +1,8 @@
1
1
  import { ItemModel } from '../models';
2
+ import { GuillotinaCommonObject } from '../types/guillotina';
3
+ import { SearchItem } from '../types/guillotina';
2
4
  interface Props {
3
- items: Array<ItemModel>;
5
+ items: Array<ItemModel<SearchItem | GuillotinaCommonObject>>;
4
6
  }
5
7
  export declare function CopyItems(props: Props): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -1,6 +1,8 @@
1
1
  import { ItemModel } from '../models';
2
+ import { GuillotinaCommonObject } from '../types/guillotina';
3
+ import { SearchItem } from '../types/guillotina';
2
4
  interface Props {
3
- items: ItemModel[];
5
+ items: ItemModel<SearchItem | GuillotinaCommonObject>[];
4
6
  }
5
7
  export declare function MoveItems(props: Props): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -1,6 +1,7 @@
1
1
  import { ItemModel } from '../models';
2
+ import { GuillotinaCommonObject, SearchItem } from '../types/guillotina';
2
3
  interface Props {
3
- items: ItemModel[];
4
+ items: ItemModel<SearchItem | GuillotinaCommonObject>[];
4
5
  }
5
6
  export declare function RemoveItems(props: Props): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ItemModel } from '../models';
3
+ import { GuillotinaCommonObject, SearchItem } from '../types/guillotina';
3
4
  interface Props {
4
5
  aRef?: React.Ref<HTMLAnchorElement>;
5
- model: ItemModel;
6
+ model: ItemModel<SearchItem | GuillotinaCommonObject>;
6
7
  children: React.ReactNode;
7
8
  onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
8
9
  }
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ItemModel } from '../models';
3
3
  import { IndexSignature } from '../types/global';
4
+ import { GuillotinaCommonObject, SearchItem } from '../types/guillotina';
4
5
  interface Props {
5
- model: ItemModel;
6
+ model: ItemModel<SearchItem | GuillotinaCommonObject>;
6
7
  children: React.ReactNode;
7
8
  style?: IndexSignature;
8
9
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ItemColumn, SearchItem } from '../types/guillotina';
2
+ import { GuillotinaCommonObject, ItemColumn, SearchItem } from '../types/guillotina';
3
3
  interface ItemProps {
4
4
  item: {
5
5
  id: string;
@@ -11,7 +11,7 @@ export declare function Item({ item, icon }: ItemProps): import("react/jsx-runti
11
11
  interface RItemProps {
12
12
  item: SearchItem;
13
13
  search: string;
14
- columns: ItemColumn[];
14
+ columns: ItemColumn<SearchItem | GuillotinaCommonObject>[];
15
15
  }
16
16
  export declare function RItem({ item, search, columns }: RItemProps): import("react/jsx-runtime").JSX.Element;
17
17
  interface ItemTitleProps {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IndexSignature } from '../types/global';
3
- interface Props {
3
+ interface TabsPanelProps {
4
4
  tabs: IndexSignature;
5
5
  currentTab: string;
6
6
  rightToolbar?: React.ReactNode;
@@ -8,5 +8,6 @@ interface Props {
8
8
  title: string;
9
9
  }>;
10
10
  }
11
- export declare function TabsPanel({ tabs, currentTab, rightToolbar, fallback, }: Props): import("react/jsx-runtime").JSX.Element;
11
+ type TabsPanelPropsWithChildren<T = Record<string, unknown>> = TabsPanelProps & T;
12
+ export declare function TabsPanel<T extends Record<string, unknown> = Record<string, unknown>>({ tabs, currentTab, rightToolbar, fallback, ...restProps }: TabsPanelPropsWithChildren<T>): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
@@ -1,7 +1,7 @@
1
1
  import { FolderCtx } from '../views/folder';
2
2
  import { BaseFormProps } from '../forms/base';
3
3
  import React from 'react';
4
- import { GuillotinaCommonObject, ItemColumn, RegistrySchema } from '../types/guillotina';
4
+ import { GuillotinaCommonObject, ItemColumn, RegistrySchema, SearchItem } from '../types/guillotina';
5
5
  import { MessageDescriptor } from 'react-intl';
6
6
  export interface RegistrySortValue {
7
7
  direction: 'asc' | 'des';
@@ -30,7 +30,7 @@ export interface IRegistry {
30
30
  [key: string]: (props: any | undefined) => JSX.Element | null;
31
31
  };
32
32
  itemsColumn: {
33
- [key: string]: () => ItemColumn[];
33
+ [key: string]: () => ItemColumn<SearchItem | GuillotinaCommonObject>[];
34
34
  };
35
35
  schemas: {
36
36
  [key: string]: RegistrySchema;
@@ -72,7 +72,7 @@ export interface IManageRegistry {
72
72
  getAction: (type: string, fallback?: React.FC) => React.FC;
73
73
  getBehavior: (type: string, fallback?: React.FC) => React.FC<any>;
74
74
  getProperties: (type: string) => RegistryProperties;
75
- getItemsColumn: (type: string) => ItemColumn[] | undefined;
75
+ getItemsColumn: (type: string) => ItemColumn<SearchItem | GuillotinaCommonObject>[] | undefined;
76
76
  getSchemas: (type: string) => RegistrySchema;
77
77
  getFieldsToFilter: (type: string, fallback?: string[]) => string[];
78
78
  getParsedSearchQueryParam: (query: string, type: string) => string;
@@ -1,7 +1,7 @@
1
1
  import { RestClient } from './rest';
2
2
  import { IndexSignature, LightFile } from '../types/global';
3
3
  import { Auth } from './auth';
4
- import { GuillotinaGroup, GuillotinaUser, ItemColumn, ReturnSearchCompatible } from '../types/guillotina';
4
+ import { GuillotinaCommonObject, GuillotinaGroup, GuillotinaUser, ItemColumn, ReturnSearchCompatible, SearchItem } from '../types/guillotina';
5
5
  export declare class GuillotinaClient {
6
6
  rest: RestClient;
7
7
  pathContainsContainer: boolean;
@@ -28,7 +28,7 @@ export declare class GuillotinaClient {
28
28
  path: string;
29
29
  withDepth?: boolean;
30
30
  }): string[][];
31
- getItemsColumn(): ItemColumn[];
31
+ getItemsColumn<T extends SearchItem | GuillotinaCommonObject>(): ItemColumn<T>[];
32
32
  applyCompat<T>(data: {
33
33
  items: T[];
34
34
  items_total: number;
@@ -1,9 +1,9 @@
1
1
  import { GuillotinaCommonObject, SearchItem } from '../types/guillotina';
2
2
  export * from './sharing';
3
- export declare class ItemModel {
4
- item: SearchItem | GuillotinaCommonObject;
3
+ export declare class ItemModel<T extends SearchItem | GuillotinaCommonObject = SearchItem | GuillotinaCommonObject> {
4
+ item: T;
5
5
  url: string;
6
- constructor(item: SearchItem | GuillotinaCommonObject, url?: string);
6
+ constructor(item: T, url?: string);
7
7
  get path(): string;
8
8
  get name(): string;
9
9
  get icon(): string;
package/dist/react-gmi.js CHANGED
@@ -9104,7 +9104,8 @@ function TabsPanel(_ref2) {
9104
9104
  currentTab = _ref2.currentTab,
9105
9105
  rightToolbar = _ref2.rightToolbar,
9106
9106
  _ref2$fallback = _ref2.fallback,
9107
- fallback = _ref2$fallback === void 0 ? FallbackTab : _ref2$fallback;
9107
+ fallback = _ref2$fallback === void 0 ? FallbackTab : _ref2$fallback,
9108
+ restProps = _objectWithoutPropertiesLoose(_ref2, ["tabs", "currentTab", "rightToolbar", "fallback"]);
9108
9109
 
9109
9110
  var _useLocation = useLocation(),
9110
9111
  location = _useLocation[0],
@@ -9133,6 +9134,7 @@ function TabsPanel(_ref2) {
9133
9134
  });
9134
9135
  };
9135
9136
 
9137
+ console.log('restProps', restProps);
9136
9138
  return jsxRuntime.jsxs("div", {
9137
9139
  className: "container",
9138
9140
  children: [jsxRuntime.jsxs("div", {
@@ -9162,9 +9164,9 @@ function TabsPanel(_ref2) {
9162
9164
  })]
9163
9165
  }), jsxRuntime.jsx("div", {
9164
9166
  className: "container",
9165
- children: jsxRuntime.jsx(CurrentComp, {
9167
+ children: jsxRuntime.jsx(CurrentComp, _extends({
9166
9168
  title: current
9167
- })
9169
+ }, restProps))
9168
9170
  })]
9169
9171
  });
9170
9172
  }
@@ -14525,7 +14527,7 @@ var Auth = /*#__PURE__*/function () {
14525
14527
  _proto.willExpire = function willExpire(expiration) {
14526
14528
  var now = new Date().getTime();
14527
14529
 
14528
- if (parseInt(expiration) * 1000 < now + 10 * 1000) {
14530
+ if (parseInt(expiration) < now + 10) {
14529
14531
  return true;
14530
14532
  }
14531
14533
 
@@ -14535,7 +14537,7 @@ var Auth = /*#__PURE__*/function () {
14535
14537
  _proto.isExpired = function isExpired(expiration) {
14536
14538
  var now = new Date().getTime();
14537
14539
 
14538
- if (parseInt(expiration) * 1000 > now) {
14540
+ if (parseInt(expiration) > now) {
14539
14541
  return false;
14540
14542
  }
14541
14543