@guillotinaweb/react-gmi 0.32.3 → 0.34.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
- interface Props {
5
- model: ItemModel;
4
+ import { SearchOrCommonObject } from '../types/guillotina';
5
+ interface Props<T extends SearchOrCommonObject = SearchOrCommonObject> {
6
+ model: ItemModel<T>;
6
7
  children: React.ReactNode;
7
8
  style?: IndexSignature;
8
9
  }
@@ -4,6 +4,7 @@ interface Props {
4
4
  onChange: (value: string) => void;
5
5
  placeholder?: string;
6
6
  id?: string;
7
+ required?: boolean;
7
8
  }
8
- export declare const EmailInput: ({ value, dataTest, placeholder, id, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const EmailInput: ({ value, dataTest, placeholder, id, onChange, required, }: Props) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -3,6 +3,9 @@ interface Props {
3
3
  value: string;
4
4
  dataTest: string;
5
5
  onChange: (value: string) => void;
6
+ placeholder?: string;
7
+ id?: string;
8
+ required?: boolean;
6
9
  }
7
- export declare const PasswordInput: ({ value, dataTest, onChange, }: Props & InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const PasswordInput: ({ value, dataTest, onChange, placeholder, id, required, }: Props & InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element;
8
11
  export {};
@@ -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, SearchOrCommonObject } 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]: <T extends SearchOrCommonObject = SearchOrCommonObject>() => ItemColumn<T>[];
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: <T extends SearchOrCommonObject = SearchOrCommonObject>(type: string) => ItemColumn<T>[] | 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
@@ -1896,7 +1896,8 @@ var EmailInput = function EmailInput(_ref) {
1896
1896
  dataTest = _ref.dataTest,
1897
1897
  placeholder = _ref.placeholder,
1898
1898
  id = _ref.id,
1899
- onChange = _ref.onChange;
1899
+ onChange = _ref.onChange,
1900
+ required = _ref.required;
1900
1901
  var intl = reactIntl.useIntl();
1901
1902
  return jsxRuntime.jsx(Input, {
1902
1903
  type: "email",
@@ -1915,7 +1916,8 @@ var EmailInput = function EmailInput(_ref) {
1915
1916
  }),
1916
1917
  id: id,
1917
1918
  placeholder: placeholder,
1918
- onChange: onChange
1919
+ onChange: onChange,
1920
+ required: required
1919
1921
  });
1920
1922
  };
1921
1923
 
@@ -1962,12 +1964,18 @@ var Form = function Form(_ref) {
1962
1964
  var PasswordInput = function PasswordInput(_ref) {
1963
1965
  var value = _ref.value,
1964
1966
  dataTest = _ref.dataTest,
1965
- onChange = _ref.onChange;
1967
+ onChange = _ref.onChange,
1968
+ placeholder = _ref.placeholder,
1969
+ id = _ref.id,
1970
+ required = _ref.required;
1966
1971
  return jsxRuntime.jsx(Input, {
1967
1972
  value: value,
1968
1973
  type: "password",
1969
1974
  dataTest: dataTest,
1970
- onChange: onChange
1975
+ onChange: onChange,
1976
+ placeholder: placeholder,
1977
+ id: id,
1978
+ required: required
1971
1979
  });
1972
1980
  };
1973
1981
 
@@ -9104,7 +9112,8 @@ function TabsPanel(_ref2) {
9104
9112
  currentTab = _ref2.currentTab,
9105
9113
  rightToolbar = _ref2.rightToolbar,
9106
9114
  _ref2$fallback = _ref2.fallback,
9107
- fallback = _ref2$fallback === void 0 ? FallbackTab : _ref2$fallback;
9115
+ fallback = _ref2$fallback === void 0 ? FallbackTab : _ref2$fallback,
9116
+ restProps = _objectWithoutPropertiesLoose(_ref2, ["tabs", "currentTab", "rightToolbar", "fallback"]);
9108
9117
 
9109
9118
  var _useLocation = useLocation(),
9110
9119
  location = _useLocation[0],
@@ -9162,9 +9171,9 @@ function TabsPanel(_ref2) {
9162
9171
  })]
9163
9172
  }), jsxRuntime.jsx("div", {
9164
9173
  className: "container",
9165
- children: jsxRuntime.jsx(CurrentComp, {
9174
+ children: jsxRuntime.jsx(CurrentComp, _extends({
9166
9175
  title: current
9167
- })
9176
+ }, restProps))
9168
9177
  })]
9169
9178
  });
9170
9179
  }