@scheels-softdev/kendoreact-generics 2.0.1 → 2.0.3

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.
Files changed (2) hide show
  1. package/README.md +117 -41
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -25,16 +25,16 @@ Note: This package has only been tested with typescript. if you're using javascr
25
25
 
26
26
  ## Generic Dropdown
27
27
 
28
- ### Usage
28
+ ### Props
29
29
 
30
- <GenericDropdown
31
- data={MyDataArray}
32
- changeEvent={(e: ComboBoxChangeEvent) => setPrinterIp(e.target.value.ipAddress)}
33
- selectedId={MyDataArray.find((x) => x.id === selectedValue.id)?.id || 0}
34
- textFields={["name"]}
35
- />
36
-
37
- ### Required props
30
+ data: T[];
31
+ selectedId: number;
32
+ changeEvent: Function;
33
+ textFields: (keyof T)[];
34
+ separator?: string;
35
+ idField?: keyof T;
36
+ disabled?: boolean;
37
+ title?: string;
38
38
 
39
39
  #### data
40
40
 
@@ -53,23 +53,21 @@ textFields={["name"]}
53
53
  - This is defined as (keyof T)[].
54
54
  - For example, if my dropdown is fed a list of employee objects with a firstName, lastName, and id key, I would pass ["firstName","lastName"] to see "John Williams", or ["firstName","lastName","id"] to see "John Doe 19382032141"
55
55
 
56
- ### Optional props
57
-
58
- #### separator
56
+ #### separator (optional)
59
57
 
60
58
  - This defines what your text fields are separated by. by default, it is assumed you only want a space between them. Use this prop if you want to change this
61
59
  - For example, if we want our employee's names separated by a comma, we would pass ", " here
62
60
 
63
- #### idField
61
+ #### idField (optional)
64
62
 
65
63
  - IdField is a keyof T, much like textFields. while textFields determines what's displayed in the dropdown, idField overrides what field of each object the dropdown looks at to compare against the selectedId prop
66
64
  - For example, if our employee's id field is employeeId instead of just id, we would pass "employeeId" here
67
65
 
68
- #### disabled
66
+ #### disabled (optional)
69
67
 
70
68
  - If you want to conditionally disable the dropdown you can do that here
71
69
 
72
- #### title
70
+ #### title (optional)
73
71
 
74
72
  - The label that appears in your multiselect when there aren't any options selected, or just above the multiselect when there are
75
73
  - For example, if we want to use it to send a letter to an employee, we would pass "Selected Employee" here
@@ -78,19 +76,15 @@ textFields={["name"]}
78
76
 
79
77
  ## MultiSelect Dropdown
80
78
 
81
- ### Usage
79
+ ### Props
82
80
 
83
- <MultiSelectDropdown
84
- data={myDataArray}
85
- selectedData={mySelectedDataArray}
86
- textFields={["firstName", "lastName"]}
87
- separator=" - "
88
- selectEvent={setSelectedVend}
89
- title="Vendor(s)"
90
- limit={10}
91
- />
92
-
93
- ### Required props
81
+ data: T[];
82
+ selectedData: T[];
83
+ textFields: (keyof T)[];
84
+ selectEvent: Function;
85
+ title?: string;
86
+ separator?: string;
87
+ limit?: number;
94
88
 
95
89
  #### data
96
90
 
@@ -109,19 +103,17 @@ limit={10}
109
103
 
110
104
  - "Event" you're given should just be your new array of selected Items
111
105
 
112
- ### Optional props
113
-
114
- #### title
106
+ #### title (optional)
115
107
 
116
108
  - The label that appears in your multiselect when there aren't any options selected, or just above the multiselect when there are
117
109
  - For example, if we want to use it to send work anniversary letters to multiple employees, we would pass "Selected Employees" here
118
110
 
119
- #### separator
111
+ #### separator (optional)
120
112
 
121
113
  - This defines what your text fields are separated by. by default, it is assumed you only want a space between them. Use this prop if you want to change this
122
114
  - For example, if we want our employee's names separated by a comma, we would pass ", " here
123
115
 
124
- #### limit
116
+ #### limit (optional)
125
117
 
126
118
  - The upper limit of how many items the user can select at once.
127
119
  - For example, if our meeting room only has room for 8 people, we would pass an 8.
@@ -130,14 +122,12 @@ limit={10}
130
122
 
131
123
  ## Filter Cell Dropdown
132
124
 
133
- ### Usage
125
+ ### Props
134
126
 
135
- <FilterCellDropdown
136
- data={myStatusArray}
137
- textFields={["StatusName"]}
138
- />
139
-
140
- ### Required props
127
+ {...GridFilterCellProps} (from @progress/kendo-react-grid)
128
+ data: T[];
129
+ textFields: (keyof T)[];
130
+ separator?: string;
141
131
 
142
132
  #### {...FilterCellProps}
143
133
 
@@ -152,13 +142,99 @@ textFields={["StatusName"]}
152
142
  - This is defined as (keyof T)[].
153
143
  - For example, if my dropdown is fed a list of employee Statuses, I could feed it a "StatusName" field (assuming my Status objects have that key) and it could display something like "Active", "Terminated", or "On Leave"
154
144
 
155
- ### Optional props
145
+ #### separator (optional)
146
+
147
+ - This defines what your text fields are separated by. by default, it is assumed you only want a space between them. Use this prop if you want to change this
148
+ - For example, if some of our associates only know the status IDs for Active, Terminated, or On Leave and we want to display them side by side, we might want to add a "dash" seporator. to do this we would pass " - " here
149
+
150
+ ---
151
+
152
+ ## Command Cell Dropdown
153
+
154
+ ### Props
155
+
156
+ data: T[];
157
+ selectedId: number;
158
+ textFields: (keyof T)[];
159
+ changeEvent: (e: ComboBoxChangeEvent) => void;
160
+ separator?: string;
161
+ checkEditField?: boolean;
162
+ isEditing?: boolean;
163
+
164
+ #### data
165
+
166
+ - Array of T. What you want to display in the dropdown. the Definition of what T is matters for the "textFields" prop
167
+
168
+ #### selectedId
169
+
170
+ - all of the default props that are passed from kendo grid when trying to override the filter cell
171
+
172
+ #### textFields
173
+
174
+ - This is defined as (keyof T)[].
175
+ - For example, if my dropdown is fed a list of employee Statuses, I could feed it a "StatusName" field (assuming my Status objects have that key) and it could display something like "Active", "Terminated", or "On Leave"
176
+
177
+ #### changeEvent
156
178
 
157
- #### separator
179
+ - Pass what you want the event to do. the event you will be passed is a ComboBoxChangeEvent. The relevant information you're likely to need is stored in e.target.value
180
+
181
+ #### separator (optional)
158
182
 
159
183
  - This defines what your text fields are separated by. by default, it is assumed you only want a space between them. Use this prop if you want to change this
160
184
  - For example, if some of our associates only know the status IDs for Active, Terminated, or On Leave and we want to display them side by side, we might want to add a "dash" seporator. to do this we would pass " - " here
161
185
 
186
+ #### checkEditField (optional)
187
+
188
+ - This is for optional conditional rendering. If this is true, it will only render a dropdown if isEditing is true. if this is false, it will always render a dropdown
189
+
190
+ #### isEditing (optional)
191
+
192
+ - This goes along with the checkEditField prop. If both are true, it will render a dropdown. Otherwise, only text containing the selected value will be displayed
193
+
194
+ ---
195
+
196
+ ## Command Cell Date
197
+
198
+ ### Props
199
+
200
+ dataItem: T;
201
+ chgFn: (e: GridChangeEvent) => void;
202
+ field: keyof T;
203
+
204
+ #### dataItem
205
+
206
+ - an object containing a date. if used per Telerik(Kendo)'s documentation, the value will come from props.dataItem
207
+
208
+ #### field
209
+
210
+ - which key in your dataItem object is a date?
211
+
212
+ #### chgFn
213
+
214
+ - A handler function for a gridchangeevent.
215
+
216
+ ---
217
+
218
+ ## Command Cell Checkbox
219
+
220
+ ### Props
221
+
222
+ checked: boolean;
223
+ functionToRunOnCheck: Function;
224
+ functionToRunOnUncheck: Function;
225
+
226
+ #### checked
227
+
228
+ - boolean value for whether or not the checkbox should display a checkmark
229
+
230
+ #### functionToRunOnCheck
231
+
232
+ - what function do you want to run when checking the checkbox. I highly recommend a function that actually changes your value passed into `checked` to true.
233
+
234
+ #### functionToRunOnUncheck
235
+
236
+ - what function do you want to run when unchecking the checkbox. I highly recommend a function that actually changes your value passed into `checked` to false.
237
+
162
238
  ---
163
239
 
164
240
  ## More Updates to the README Coming Soon!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheels-softdev/kendoreact-generics",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",