@bigbinary/neeto-fields-frontend 1.0.5 → 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.5",
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;
@@ -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,61 @@ 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;
93
106
  }
94
107
 
95
108
  interface FieldInputsProps {
96
109
  fields: KeyValuePair[];
97
110
  customComponents?: KeyValuePair;
111
+ formRef?: React.RefObject<any>
112
+ disabled?: boolean;
113
+ isRequiredColumnName?: string;
98
114
  }
99
115
 
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>;
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;
104
153
 
105
- export const useFetchFields: (options?: UseQueryOptions) => UseQueryResult;
106
154
  export const neetoFieldsUtils: {
107
- transformValues: (values: KeyValuePair) => void;
108
- mergeInitialValues: (args: {
109
- initialValues: KeyValuePair;
155
+ transformValues: (values: KeyValuePair) => KeyValuePair;
156
+ mergeInitialValues: <T extends object>(args: {
157
+ initialValues: T;
110
158
  fields: KeyValuePair[];
111
- }) => KeyValuePair;
159
+ }) => T & KeyValuePair;
112
160
  };