@bigbinary/neeto-fields-frontend 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-fields-frontend",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbinary/neeto-fields-nano",
package/types.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
2
 
3
- import { UseQueryResult, UseQueryOptions } from "react-query";
3
+ import {
4
+ UseQueryResult,
5
+ UseMutationResult,
6
+ UseQueryOptions,
7
+ UseMutationOptions,
8
+ } from "react-query";
4
9
 
5
10
  interface KeyValuePair {
6
11
  [key: string]: any;
@@ -9,13 +14,14 @@ interface KeyValuePair {
9
14
  interface PaneProps {
10
15
  children: React.ReactNode;
11
16
  validations?: KeyValuePair;
17
+ initialValues?: KeyValuePair;
18
+ hideRequiredSwitch?: boolean;
12
19
  }
13
20
 
14
21
  type OnDeleteClickFunction = (field: KeyValuePair) => void;
15
22
 
16
23
  type OnEditClickFunction = (field: KeyValuePair) => void;
17
24
 
18
-
19
25
  interface FieldsDashboardProps {
20
26
  rowData?: any[];
21
27
  showOwnersInMenu?: boolean;
@@ -42,7 +48,9 @@ interface AddFieldProps {
42
48
  resourceType: string;
43
49
  allowedKinds?: string[];
44
50
  additionalValidations?: KeyValuePair;
51
+ initialValues?: KeyValuePair;
45
52
  children?: React.ReactNode;
53
+ hideRequiredSwitch?: boolean;
46
54
  }
47
55
 
48
56
  interface EditProps {
@@ -51,6 +59,8 @@ interface EditProps {
51
59
  onClose: (values: any) => void;
52
60
  children?: React.ReactNode;
53
61
  additionalValidations?: KeyValuePair;
62
+ initialValues?: KeyValuePair;
63
+ hideRequiredSwitch?: boolean;
54
64
  }
55
65
 
56
66
  interface AddProps {
@@ -59,6 +69,8 @@ interface AddProps {
59
69
  onClose: () => void;
60
70
  children?: React.ReactNode;
61
71
  additionalValidations?: KeyValuePair;
72
+ initialValues?: KeyValuePair;
73
+ hideRequiredSwitch?: boolean;
62
74
  }
63
75
  interface FieldsPaneProps {
64
76
  allowedKinds: string[];
@@ -66,14 +78,17 @@ interface FieldsPaneProps {
66
78
  resourceType: string;
67
79
  onClose: () => void;
68
80
  additionalValidations?: KeyValuePair;
81
+ initialValues?: KeyValuePair;
69
82
  selectedField?: KeyValuePair;
70
83
  children?: React.ReactNode;
84
+ hideRequiredSwitch?: boolean;
71
85
  }
72
86
  interface FieldFormProps {
73
87
  chosenKind: string[];
74
88
  kindSelectOptions: KeyValuePair[];
75
89
  children?: React.ReactNode;
76
90
  isSystem?: boolean;
91
+ hideRequiredSwitch?: boolean;
77
92
  }
78
93
 
79
94
  interface FieldValuesContainerProps {
@@ -84,23 +99,62 @@ interface FieldValuesContainerProps {
84
99
  queryKeysToBeInvalidatedOnSuccess?: string[];
85
100
  customComponents?: KeyValuePair;
86
101
  className?: string;
102
+ showBorder?: boolean;
103
+ formRefs?: React.RefObject<any>
104
+ disabled?: boolean;
105
+ isRequiredColumnName?: string;
87
106
  }
88
107
 
89
108
  interface FieldInputsProps {
90
109
  fields: KeyValuePair[];
91
110
  customComponents?: KeyValuePair;
111
+ formRef?: React.RefObject<any>
112
+ disabled?: boolean;
113
+ isRequiredColumnName?: string;
92
114
  }
93
115
 
94
- export const FieldsDashboard = React.FC<FieldsDashboardProps>;
95
- export const AddField = React.FC<AddFieldProps>;
96
- export const FieldValuesContainer = React.FC<FieldValuesContainerProps>;
97
- export const FieldInputs = React.FC<FieldInputsProps>;
116
+ type FieldsParams = { resourceType?: string; ownerId?: string; state?: string, prefixQueryKeys?: string[] };
117
+
118
+ type Field = {
119
+ fields: KeyValuePair[];
120
+ count: number;
121
+ activeFieldsCount: number;
122
+ inactiveFieldsCount: number;
123
+ };
124
+
125
+ type UseFetchFieldsResult = UseQueryResult<Field>;
126
+
127
+ export const FieldsDashboard: React.FC<FieldsDashboardProps>;
128
+ export const AddField: React.FC<AddFieldProps>;
129
+ export const FieldValuesContainer: React.FC<FieldValuesContainerProps>;
130
+ export const FieldInputs: React.FC<FieldInputsProps>;
131
+
132
+ export const useFetchFields: (
133
+ params: FieldsParams,
134
+ options?: UseQueryOptions
135
+ ) => UseFetchFieldsResult;
136
+
137
+ export const useShowField: (
138
+ fieldId: string,
139
+ options?: UseQueryOptions
140
+ ) => UseFetchFieldsResult;
141
+
142
+ export const useCreateField: (
143
+ options?: UseMutationOptions
144
+ ) => UseMutationResult;
145
+
146
+ export const useUpdateField: (
147
+ options?: UseMutationOptions
148
+ ) => UseMutationResult;
149
+
150
+ export const useDestroyField: (
151
+ options?: UseMutationOptions
152
+ ) => UseMutationResult;
98
153
 
99
- export const useFetchFields: (options?: UseQueryOptions) => UseQueryResult;
100
154
  export const neetoFieldsUtils: {
101
- transformValues: (values: KeyValuePair) => void;
102
- mergeInitialValues: (args: {
103
- initialValues: KeyValuePair;
155
+ transformValues: (values: KeyValuePair) => KeyValuePair;
156
+ mergeInitialValues: <T extends object>(args: {
157
+ initialValues: T;
104
158
  fields: KeyValuePair[];
105
- }) => KeyValuePair;
159
+ }) => T & KeyValuePair;
106
160
  };