@equinor/apollo-utils 0.1.3 → 0.1.4

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/dist/index.d.ts CHANGED
@@ -1,88 +1,7 @@
1
- import { CellContext } from '@tanstack/react-table';
2
- import * as styled_components from 'styled-components';
3
- import * as react from 'react';
4
- import * as _equinor_eds_core_react from '@equinor/eds-core-react';
5
1
  import { PrimitiveAtom } from 'jotai';
6
2
  import { AtomFamily } from 'jotai/vanilla/utils/atomFamily';
7
3
  import { z } from 'zod';
8
4
 
9
- type FormMeta = {
10
- _isNew?: boolean;
11
- _editMode?: boolean;
12
- _hasRemoteChange?: boolean;
13
- };
14
- type WithoutFormMeta<T extends FormMeta> = Omit<T, keyof FormMeta>;
15
-
16
- /**
17
- * Subscribes to the `_editMode` field in a `react-hook-form` context.
18
- *
19
- * @returns edit mode value
20
- */
21
- declare function useEditMode(): boolean;
22
- /**
23
- * Subscribes to the `_hasRemoteChange` field in a `react-hook-form` context.
24
- *
25
- * @returns edit mode value
26
- */
27
- declare function useHasRemoteChange(): boolean;
28
- /**
29
- * @returns function getting is new meta
30
- */
31
- declare function useGetIsNew(): () => boolean;
32
- declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) => void;
33
- declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
34
- declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
35
-
36
- declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T, boolean>): JSX.Element;
37
-
38
- interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
39
- dateStringFormatter?: (date: string) => string;
40
- }
41
- declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
42
-
43
- interface Option {
44
- label: string;
45
- value: string;
46
- }
47
- interface EditableDropdownCellProps<T extends FormMeta> extends CellContext<T, unknown> {
48
- /**
49
- * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
50
- */
51
- options: Option[];
52
- }
53
- declare function EditableDropdownCell<T extends FormMeta>(props: EditableDropdownCellProps<T>): JSX.Element;
54
- declare const AutocompleteCustom: styled_components.StyledComponent<(<T>(props: {
55
- options: T[];
56
- label: string;
57
- initialSelectedOptions?: T[] | undefined;
58
- meta?: string | undefined;
59
- disabled?: boolean | undefined;
60
- readOnly?: boolean | undefined;
61
- hideClearButton?: boolean | undefined;
62
- selectedOptions?: T[] | undefined;
63
- onOptionsChange?: ((changes: _equinor_eds_core_react.AutocompleteChanges<T>) => void) | undefined;
64
- multiple?: boolean | undefined;
65
- optionLabel?: ((option: T) => string) | undefined;
66
- disablePortal?: boolean | undefined;
67
- optionDisabled?: ((option: T) => boolean) | undefined;
68
- optionsFilter?: ((option: T, inputValue: string) => boolean) | undefined;
69
- autoWidth?: boolean | undefined;
70
- placeholder?: string | undefined;
71
- clearSearchOnChange?: boolean | undefined;
72
- } & react.HTMLAttributes<HTMLDivElement> & {
73
- ref?: react.ForwardedRef<HTMLDivElement> | undefined;
74
- displayName?: string | undefined;
75
- }) => JSX.Element), any, {}, never>;
76
-
77
- declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
78
-
79
- interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
80
- title: string;
81
- }
82
- declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
83
-
84
- declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
85
-
86
5
  type ValidationErrorMap<T> = Map<keyof T, {
87
6
  message: string;
88
7
  code: string;
@@ -124,4 +43,4 @@ declare function useFormFamilyUtils<T>(family: FormFamily<T>, options?: UseFormF
124
43
  };
125
44
  declare function useFormFamilyMutation<T>(family: FormFamily<T>, param: FormFamilyParam, validator?: FormValidator): (update: Partial<T>) => void;
126
45
 
127
- export { AutocompleteCustom, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownCell, EditableDropdownCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormFamilyParam, FormMeta, FormState, Option, ValidationErrorMap, WithoutFormMeta, addFormMeta, createFormFamily, createValidator, removeFormMeta, useEditMode, useFormFamilyMutation, useFormFamilyUtils, useGetIsNew, useHasRemoteChange, useSetFormMeta };
46
+ export { FormFamilyParam, FormState, ValidationErrorMap, createFormFamily, createValidator, useFormFamilyMutation, useFormFamilyUtils };