react-bootstrap-table-ng-editor 4.19.1 → 4.19.2

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/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  `react-bootstrap-table-ng` separate the cell edit code base to [`react-bootstrap-table-ng-editor`](https://github.com/jeff-k-zhou/react-bootstrap-table-ng/tree/main/packages/react-bootstrap-table-ng-editor), so there's a little bit different when you use cell edit than `react-bootstrap-table`. In the following, we are going to show you how to enable the cell edit
4
4
 
5
- **[Live Demo For Cell Edit](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/index.html?selectedKind=Cell%20Editing)**
5
+ **[Live Demo For Cell Edit](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/cell-editing--docs)**
6
6
 
7
7
  **[API&Props Definitation](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/cell-edit-props.html)**
8
8
 
9
- -----
9
+ ---
10
10
 
11
11
  ## Install
12
12
 
@@ -16,61 +16,66 @@ $ npm install react-bootstrap-table-ng-editor --save
16
16
 
17
17
  ## How
18
18
 
19
- We have [two ways](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/cell-edit-props.html#celleditmode-string) to trigger a editable cell as editing cell:
19
+ We have [two ways](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/cell-edit-props.html#celleditmode-string) to trigger a editable cell as editing cell:
20
20
 
21
- * click
22
- * dbclick
21
+ - click
22
+ - dbclick
23
23
 
24
24
  That's look into how we enable the cell edit on tabe:
25
25
 
26
26
  ```js
27
- import cellEditFactory from 'react-bootstrap-table-ng-editor';
27
+ import cellEditFactory from "react-bootstrap-table-ng-editor";
28
28
 
29
29
  // omit
30
30
 
31
31
  <BootstrapTable
32
32
  keyField="id"
33
- data={ products }
34
- columns={ columns }
35
- cellEdit={ cellEditFactory({ mode: 'click' }) }
36
- />
33
+ data={products}
34
+ columns={columns}
35
+ cellEdit={cellEditFactory({ mode: "click" })}
36
+ />;
37
37
  ```
38
38
 
39
39
  How user save their new editings? We offer two ways:
40
40
 
41
- * Press ENTER(**default**)
42
- * Blur from current editing cell(Need to enable the [cellEdit.blurToSave](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/cell-edit-props.html#celleditblurtosave-bool))
41
+ - Press ENTER(**default**)
42
+ - Blur from current editing cell(Need to enable the [cellEdit.blurToSave](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/cell-edit-props.html#celleditblurtosave-bool))
43
43
 
44
44
  ## Editable Cell
45
+
45
46
  `react-bootstrap-table-ng` support you to configure the cell editable on three level:
46
47
 
47
- * Row Level ([cellEdit.nonEditableRows](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/cell-edit-props.html#celleditnoneditablerows-function))
48
- * Column Level (Configure [column.editable](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditable-bool-function) as bool value)
49
- * Cell Level (Configure [column.editable](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditable-bool-function) as a callback function)
48
+ - Row Level ([cellEdit.nonEditableRows](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/cell-edit-props.html#celleditnoneditablerows-function))
49
+ - Column Level (Configure [column.editable](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditable-bool-function) as bool value)
50
+ - Cell Level (Configure [column.editable](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditable-bool-function) as a callback function)
50
51
 
51
52
  ## Validation
52
53
 
53
- [column.validator](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnvalidator-function) will help you to work on it!
54
+ [column.validator](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columnvalidator-function) will help you to work on it!
55
+
54
56
  ## Customize Style/Class
57
+
55
58
  ### Editing Cell
56
59
 
57
- * Customize the editing cell style via [column.editCellStyle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditcellstyle-object-function)
58
- * Customize the editing cell classname via [column.editCellClasses](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditcellclasses-string-function)
60
+ - Customize the editing cell style via [column.editCellStyle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditcellstyle-object-function)
61
+ - Customize the editing cell classname via [column.editCellClasses](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditcellclasses-string-function)
59
62
 
60
63
  ### Editor
61
- * Customize the editor style via [column.editorStyle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditorstyle-object-function)
62
- * Customize the editor classname via [column.editoClasses](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditorclasses-string-function)
64
+
65
+ - Customize the editor style via [column.editorStyle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditorstyle-object-function)
66
+ - Customize the editor classname via [column.editoClasses](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditorclasses-string-function)
63
67
 
64
68
  ## Rich Editors
69
+
65
70
  `react-bootstrap-table-ng` have following predefined editor:
66
71
 
67
- * Text(Default)
68
- * Dropdown
69
- * Date
70
- * Textarea
71
- * Checkbox
72
+ - Text(Default)
73
+ - Dropdown
74
+ - Date
75
+ - Textarea
76
+ - Checkbox
72
77
 
73
- In a nutshell, you just only give a [column.editor](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditor-object) and define the `type`:
78
+ In a nutshell, you just only give a [column.editor](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditor-object) and define the `type`:
74
79
 
75
80
  ```js
76
81
  import { Type } from 'react-bootstrap-table-ng-editor';
@@ -89,9 +94,11 @@ const columns = [
89
94
  In the following, we go though all the predefined editors:
90
95
 
91
96
  ### Dropdown Editor
97
+
92
98
  Dropdown editor give a select menu to choose a data from a list. When use dropdown editor, either `editor.options` or `editor.getOptions` should be required prop.
93
99
 
94
100
  #### editor.options
101
+
95
102
  This is most simple case for assign the dropdown options data directly.
96
103
 
97
104
  ```js
@@ -123,13 +130,13 @@ const columns = [
123
130
  ```
124
131
 
125
132
  #### editor.getOptions
133
+
126
134
  It is much flexible which accept a function and you can assign the dropdown options dynamically.
127
135
 
128
136
  There are two case for `getOptions`:
129
137
 
130
- * *Synchronous*: Just return the options array in `getOptions` callback function
131
- * *Asynchronous*: Call `setOptions` function argument when you get the options from remote.
132
-
138
+ - _Synchronous_: Just return the options array in `getOptions` callback function
139
+ - _Asynchronous_: Call `setOptions` function argument when you get the options from remote.
133
140
 
134
141
  ```js
135
142
  // Synchronous
@@ -160,9 +167,10 @@ const columns = [
160
167
 
161
168
  ```
162
169
 
163
- [here](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/index.html?selectedKind=Cell%20Editing&selectedStory=Dropdown%20Editor%20with%20Dynamic%20Options) is an online example.
170
+ [here](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/story/cell-editing--dropdown-editor) is an online example.
164
171
 
165
172
  ### Date Editor
173
+
166
174
  Date editor is use `<input type="date">`, the configuration is very simple:
167
175
 
168
176
  ```js
@@ -184,6 +192,7 @@ const columns = [
184
192
  ```
185
193
 
186
194
  ### Textarea Editor
195
+
187
196
  Textarea editor is use `<input type="textarea">`, user can press `ENTER` to change line and in the `react-bootstrap-table-ng`, user allow to save result via press `SHIFT` + `ENTER`.
188
197
 
189
198
  ```js
@@ -196,7 +205,9 @@ const columns = [
196
205
  }
197
206
  }];
198
207
  ```
208
+
199
209
  ### Checkbox Editor
210
+
200
211
  Checkbox editor allow you to have a pair value choice, the `editor.value` is required value to represent the actual value for check and uncheck.
201
212
 
202
213
  ```js
@@ -212,14 +223,15 @@ const columns = [
212
223
  ```
213
224
 
214
225
  ## Customize Editor
215
- If you feel above predefined editors are not satisfied to your requirement, you can certainly custom the editor via [column.editorRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columneditorrenderer-function). It accept a function and pass following arguments when function called:
216
-
217
- * `editorProps`: Some useful attributes you can use on DOM editor, like class, style etc.
218
- * `value`: Current cell value
219
- * `row`: Current row data
220
- * `column`: Current column definition
221
- * `rowIndex`: Current row index
222
- * `columnIndex`: Current column index
226
+
227
+ If you feel above predefined editors are not satisfied to your requirement, you can certainly custom the editor via [column.editorRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/column-props.html#columneditorrenderer-function). It accept a function and pass following arguments when function called:
228
+
229
+ - `editorProps`: Some useful attributes you can use on DOM editor, like class, style etc.
230
+ - `value`: Current cell value
231
+ - `row`: Current row data
232
+ - `column`: Current column definition
233
+ - `rowIndex`: Current row index
234
+ - `columnIndex`: Current column index
223
235
 
224
236
  > Note when implement a custom React editor component, this component should have a **getValue** function which return current value on editor
225
237