@bigbinary/neeto-fields-frontend 1.0.5 → 1.0.7

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