@scheels-softdev/kendoreact-generics 2.0.2 → 2.0.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.
Files changed (2) hide show
  1. package/README.md +119 -41
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -20,21 +20,23 @@ Note: This package has only been tested with typescript. if you're using javascr
20
20
  - [MultiSelect Dropdown](#multiselect-dropdown)
21
21
  - [Filter Cell Dropdown](#filter-cell-dropdown)
22
22
  - [Command Cell Dropdown](#command-cell-dropdown)
23
+ - [Command Cell Date](#command-cell-date)
24
+ - [Command Cell Checkbox](#command-cell-checkbox)
23
25
 
24
26
  ---
25
27
 
26
28
  ## Generic Dropdown
27
29
 
28
- ### Usage
30
+ ### Props
29
31
 
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
32
+ data: T[];
33
+ selectedId: number;
34
+ changeEvent: Function;
35
+ textFields: (keyof T)[];
36
+ separator?: string;
37
+ idField?: keyof T;
38
+ disabled?: boolean;
39
+ title?: string;
38
40
 
39
41
  #### data
40
42
 
@@ -53,23 +55,21 @@ textFields={["name"]}
53
55
  - This is defined as (keyof T)[].
54
56
  - 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
57
 
56
- ### Optional props
57
-
58
- #### separator
58
+ #### separator (optional)
59
59
 
60
60
  - 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
61
  - For example, if we want our employee's names separated by a comma, we would pass ", " here
62
62
 
63
- #### idField
63
+ #### idField (optional)
64
64
 
65
65
  - 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
66
  - For example, if our employee's id field is employeeId instead of just id, we would pass "employeeId" here
67
67
 
68
- #### disabled
68
+ #### disabled (optional)
69
69
 
70
70
  - If you want to conditionally disable the dropdown you can do that here
71
71
 
72
- #### title
72
+ #### title (optional)
73
73
 
74
74
  - The label that appears in your multiselect when there aren't any options selected, or just above the multiselect when there are
75
75
  - For example, if we want to use it to send a letter to an employee, we would pass "Selected Employee" here
@@ -78,19 +78,15 @@ textFields={["name"]}
78
78
 
79
79
  ## MultiSelect Dropdown
80
80
 
81
- ### Usage
81
+ ### Props
82
82
 
83
- <MultiSelectDropdown
84
- data={myDataArray}
85
- selectedData={mySelectedDataArray}
86
- textFields={["firstName", "lastName"]}
87
- separator=" - "
88
- selectEvent={setSelectedEmployee}
89
- title="Selected Employees"
90
- limit={10}
91
- />
92
-
93
- ### Required props
83
+ data: T[];
84
+ selectedData: T[];
85
+ textFields: (keyof T)[];
86
+ selectEvent: Function;
87
+ title?: string;
88
+ separator?: string;
89
+ limit?: number;
94
90
 
95
91
  #### data
96
92
 
@@ -109,19 +105,17 @@ limit={10}
109
105
 
110
106
  - "Event" you're given should just be your new array of selected Items
111
107
 
112
- ### Optional props
113
-
114
- #### title
108
+ #### title (optional)
115
109
 
116
110
  - The label that appears in your multiselect when there aren't any options selected, or just above the multiselect when there are
117
111
  - For example, if we want to use it to send work anniversary letters to multiple employees, we would pass "Selected Employees" here
118
112
 
119
- #### separator
113
+ #### separator (optional)
120
114
 
121
115
  - 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
116
  - For example, if we want our employee's names separated by a comma, we would pass ", " here
123
117
 
124
- #### limit
118
+ #### limit (optional)
125
119
 
126
120
  - The upper limit of how many items the user can select at once.
127
121
  - For example, if our meeting room only has room for 8 people, we would pass an 8.
@@ -130,14 +124,12 @@ limit={10}
130
124
 
131
125
  ## Filter Cell Dropdown
132
126
 
133
- ### Usage
127
+ ### Props
134
128
 
135
- <FilterCellDropdown
136
- data={myStatusArray}
137
- textFields={["StatusName"]}
138
- />
139
-
140
- ### Required props
129
+ {...GridFilterCellProps} (from @progress/kendo-react-grid)
130
+ data: T[];
131
+ textFields: (keyof T)[];
132
+ separator?: string;
141
133
 
142
134
  #### {...FilterCellProps}
143
135
 
@@ -152,13 +144,99 @@ textFields={["StatusName"]}
152
144
  - This is defined as (keyof T)[].
153
145
  - 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
146
 
155
- ### Optional props
147
+ #### separator (optional)
148
+
149
+ - 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
150
+ - 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
151
+
152
+ ---
153
+
154
+ ## Command Cell Dropdown
155
+
156
+ ### Props
157
+
158
+ data: T[];
159
+ selectedId: number;
160
+ textFields: (keyof T)[];
161
+ changeEvent: (e: ComboBoxChangeEvent) => void;
162
+ separator?: string;
163
+ checkEditField?: boolean;
164
+ isEditing?: boolean;
165
+
166
+ #### data
167
+
168
+ - Array of T. What you want to display in the dropdown. the Definition of what T is matters for the "textFields" prop
169
+
170
+ #### selectedId
171
+
172
+ - all of the default props that are passed from kendo grid when trying to override the filter cell
173
+
174
+ #### textFields
175
+
176
+ - This is defined as (keyof T)[].
177
+ - 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"
178
+
179
+ #### changeEvent
156
180
 
157
- #### separator
181
+ - 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
182
+
183
+ #### separator (optional)
158
184
 
159
185
  - 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
186
  - 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
187
 
188
+ #### checkEditField (optional)
189
+
190
+ - 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
191
+
192
+ #### isEditing (optional)
193
+
194
+ - 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
195
+
196
+ ---
197
+
198
+ ## Command Cell Date
199
+
200
+ ### Props
201
+
202
+ dataItem: T;
203
+ chgFn: (e: GridChangeEvent) => void;
204
+ field: keyof T;
205
+
206
+ #### dataItem
207
+
208
+ - an object containing a date. if used per Telerik(Kendo)'s documentation, the value will come from props.dataItem
209
+
210
+ #### field
211
+
212
+ - which key in your dataItem object is a date?
213
+
214
+ #### chgFn
215
+
216
+ - A handler function for a gridchangeevent.
217
+
218
+ ---
219
+
220
+ ## Command Cell Checkbox
221
+
222
+ ### Props
223
+
224
+ checked: boolean;
225
+ functionToRunOnCheck: Function;
226
+ functionToRunOnUncheck: Function;
227
+
228
+ #### checked
229
+
230
+ - boolean value for whether or not the checkbox should display a checkmark
231
+
232
+ #### functionToRunOnCheck
233
+
234
+ - 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.
235
+
236
+ #### functionToRunOnUncheck
237
+
238
+ - 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.
239
+
162
240
  ---
163
241
 
164
242
  ## 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.2",
3
+ "version": "2.0.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",