@cntwg/html-helper 0.0.21 → 0.0.23

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.
@@ -1,13 +1,14 @@
1
- >|***rev.*:**|0.1.18|
1
+ >|***rev.*:**|0.1.22|
2
2
  >|:---|---:|
3
- >|date:|2023-11-19|
3
+ >|date:|2024-11-13|
4
4
 
5
5
  ## Introduction
6
6
 
7
- This paper describes a classes provided by `html-ctrls-list.js` module.
7
+ This paper describes a classes provided by `list.js`, `lists-stubs.js` and `lists-btn.js` of `html-ctrls` sub-module.
8
8
 
9
9
  ## Module classes
10
10
 
11
+ <a name="THtmlItemsListContainer"></a>
11
12
  ### **THtmlItemsListContainer**
12
13
 
13
14
  This class provide a base container useful when dealing with a list elements placed on an HTML-form.
@@ -20,139 +21,273 @@ The class constructor creates a new instance of the class.
20
21
 
21
22
  The class constructor receives a parameters listed below:
22
23
 
23
- |parameter name|value type|default value|description|
24
+ | parameter name | value type | default value | description |
24
25
  |:---|---|---:|:---|
25
- |`host`|`HTMLElement`|`undefined`|points to a host element which holds a list items|
26
- |`options`|`object`|---|contains a container settings|
26
+ | `host` | `HTMLElement` | `undefined` | points to a host element which holds a list items |
27
+ | `options` | `object` | --- | contains a container settings |
27
28
 
28
29
  ##### `options` parameter
29
30
 
30
31
  The `options` structure has listed below:
31
32
 
32
- |option name|value type|default value|description|
33
+ | option name | value type | default value | description |
33
34
  |:---|---|---:|:---|
34
- |`autoHideNewItems`|`boolean`|`false`|alters behavior of the `addItem` class method. If set to `true`, the item which was added to a container members will be automatically hidden|
35
- |`markCurrentItem`|`boolean`|`false`|alters behavior of the `setCurIndex` class method. If set to `true`, the item which was added to a container members will be automatically marked as current|
36
- |`itemBaseClassID`|`array`|---|alters behavior of the `addItem` class method. It accepts value of a string or an array of strings. For more see description of an `addItem` method|
35
+ | `autoHideNewItems` | `boolean` | `false` |alters behavior of the `addItem` class method. If set to `true`, the item which was added to a container members will be automatically hidden |
36
+ | `markCurrentItem` | `boolean` | `false` |alters behavior of the `setCurIndex` class method. If set to `true`, the item which was added to a container members will be automatically marked as current |
37
+ | `itemBaseClassID` | `string`, `string[]` | --- | alters behavior of the `addItem` class method. It accepts value of a string or an array of strings. For more see description of an `addItem` method |
37
38
 
38
39
  #### class properties
39
40
 
40
- The table below describes a properties of a `THtmlItemsListContainer` class:
41
+ <a name="THtmlItemsListContainer+count"></a>
42
+ ##### **count**
41
43
 
42
- |property name|property type|read only|description|
43
- |:---|---|---|:---|
44
- |`count`|`number`|yes|contains a quantity of the items which holds by a container|
45
- |`curIndex`|`index`|yes|presents an index of a current item|
46
- |`minIndex`|`index`|yes|represents a minimum possible index for an item inside the container|
47
- |`maxIndex`|`index`|yes|represents a maximum possible index for an item inside the container|
48
- |`prevIndex`|`index`|yes|presents an index of the previous item before the current|
49
- |`nextIndex`|`index`|yes|presents an index of the next item after the current|
50
- |`curItem`|`HTMLElement` or `null`|yes|represents an item addressed by the `curIndex`|
44
+ | property type | read only | description |
45
+ |---|---|:---|
46
+ | `number` | yes | contains a quantity of the elements the container holds |
47
+
48
+ <a name="THtmlItemsListContainer+curIndex"></a>
49
+ ##### **curIndex**
50
+
51
+ | property type | read only | description |
52
+ |---|---|:---|
53
+ | `number` | yes | represents an index of the current element |
54
+
55
+ <a name="THtmlItemsListContainer+minIndex"></a>
56
+ ##### **minIndex**
57
+
58
+ | property type | read only | description |
59
+ |---|---|:---|
60
+ | `number` | yes | represents a minimum possible index for an element inside the container |
61
+
62
+ <a name="THtmlItemsListContainer+maxIndex"></a>
63
+ ##### **maxIndex**
64
+
65
+ | property type | read only | description |
66
+ |---|---|:---|
67
+ | `number` | yes | represents a maximum possible index for an element inside the container |
68
+
69
+ <a name="THtmlItemsListContainer+prevIndex"></a>
70
+ ##### **prevIndex**
71
+
72
+ | property type | read only | description |
73
+ |---|---|:---|
74
+ | `number` | yes | represents an index of the previous element before the current |
75
+
76
+ <a name="THtmlItemsListContainer+nextIndex"></a>
77
+ ##### **nextIndex**
78
+
79
+ | property type | read only | description |
80
+ |---|---|:---|
81
+ | `number` | yes | represents an index of the next element after the current |
82
+
83
+ <a name="THtmlItemsListContainer+curItem"></a>
84
+ ##### **curItem**
85
+
86
+ | property type | read only | description |
87
+ |---|---|:---|
88
+ | `?HTMLElement` | yes | represents an element addressed by the `curIndex` |
51
89
 
52
90
  #### class methods
53
91
 
54
- ##### **clear()**
92
+ <a name="THtmlItemsListContainer+clear"></a>
93
+ ##### **clear()** => `void`
55
94
 
56
95
  This method deletes all items that holds by the container.
57
96
 
58
- ##### **isEmpty()**
97
+ <a name="THtmlItemsListContainer+isEmpty"></a>
98
+ ##### **isEmpty()** => `boolean`
59
99
 
60
100
  This method returns `true` if the container has no items.
61
101
 
62
- ##### **isNotEmpty()**
102
+ <a name="THtmlItemsListContainer+isNotEmpty"></a>
103
+ ##### **isNotEmpty()** => `boolean`
63
104
 
64
105
  This method returns `true` if the container has at least one item.
65
106
 
66
- ##### **chkIndex(value)**
107
+ <a name="THtmlItemsListContainer+chkIndex"></a>
108
+ ##### **chkIndex(value)** => `boolean`
67
109
 
68
110
  This method returns `true` if a given `value` represents a valid index within the range of the list.
69
111
 
70
- ##### **chkIndexEx(value\[, mode])**
112
+ | parameter name | value type | default value | description |
113
+ |:---|---|---:|:---|
114
+ | `value` | `any` | --- | a value to be verified |
115
+
116
+ <a name="THtmlItemsListContainer+chkIndexEx"></a>
117
+ ##### **chkIndexEx(value\[, mode])** => `boolean`\|`number`
71
118
 
72
119
  This method is similar to a `chkIndex` methods but receives a `mode` parameter which allow to choose what a type of the result the method returns.
73
120
 
121
+ | parameter name | value type | default value | description |
122
+ |:---|---|---:|:---|
123
+ | `value` | `any` | --- | a value to be verified |
124
+ | `mode` | `boolean` | `false` | a flag to switch result value type |
125
+
74
126
  The `mode` parameter treats as follows:
75
127
 
76
128
  - if set to `false`, the result returned by the method is a `boolean` value;
77
- - if `mode` parameter set to `true`, the result returned by the method has an index type;
78
- - if not given or has a type of not a `boolean` value, the default value is used which is set to `false`.
129
+ - if set to `true`, the result returned by the method is an index;
130
+ - if not given or has a type of not a `boolean`, the default value is used.
79
131
 
80
- ##### **srchIndex(item)**
132
+ <a name="THtmlItemsListContainer+srchIndex"></a>
133
+ ##### **srchIndex(item)** => `number`
81
134
 
82
135
  This method tries to find a given item in the list and if it is found returns its index.
83
136
 
84
- ##### **srchIndexByAttr(name, value)**
137
+ | parameter name | value type | default value | description |
138
+ |:---|---|---:|:---|
139
+ | `item` | `?HTMLElement` | --- | an element to search |
140
+
141
+ <a name="THtmlItemsListContainer+srchIndexByAttr"></a>
142
+ ##### **srchIndexByAttr(name, value)** => `number`
85
143
 
86
144
  This method tries to find an item that has an attribute with a given `name` and `value` in the list and if it is found its index is returned.
87
145
 
146
+ | parameter name | value type | default value | description |
147
+ |:---|---|---:|:---|
148
+ | `name` | `string` | --- | an attribute name |
149
+ | `value` | `any` | --- | an attribute value |
150
+
88
151
  The `value` can be a `boolean`, `number` or a `string`. If it is not given the empty string value is used. In any other cases the method will failed.
89
152
 
90
153
  > Note: In case when a `value` is an empty string the method will accept any item with an attribute which name is equal to a given `name` regardless of a value such attribute has.
91
154
 
92
- ##### **srchIndexByID(value)**
155
+ <a name="THtmlItemsListContainer+srchIndexByID"></a>
156
+ ##### **srchIndexByID(value)** => `number`
93
157
 
94
158
  This method tries to find an item by its `ID`-attribute in the list and if it is found returns its index (*see description of `srchIndexByAttr` method for details how a `value` parameter is used*).
95
159
 
96
- ##### **setCurIndex(value)**
160
+ | parameter name | value type | default value | description |
161
+ |:---|---|---:|:---|
162
+ | `value` | `string` | --- | an ID value |
163
+
164
+ <a name="THtmlItemsListContainer+setCurIndex"></a>
165
+ ##### **setCurIndex(index)** => `boolean`
97
166
 
98
167
  This method sets a current item index in the list. If succeed `true` is returned.
99
168
 
100
- ##### **rstCurIndex()**
169
+ | parameter name | value type | default value | description |
170
+ |:---|---|---:|:---|
171
+ | `index` | `number`, `string` | --- | an element index |
101
172
 
102
- This method resets a current item index in the list.
173
+ <a name="THtmlItemsListContainer+rstCurIndex"></a>
174
+ ##### **rstCurIndex()** => `void`
175
+
176
+ This method resets a current element index in the list.
177
+
178
+ <a name="THtmlItemsListContainer+getItem"></a>
179
+ ##### **getItem(index)** => `?HTMLElement`
103
180
 
104
- ##### **getItem(index)**
181
+ This method returns an element addressed by a given `index`.
105
182
 
106
- This method returns an item addressed by a given `index`.
183
+ | parameter name | value type | default value | description |
184
+ |:---|---|---:|:---|
185
+ | `index` | `number`, `string` | --- | an element index |
107
186
 
108
- ##### **getItemByAttr(name, value)**
187
+ <a name="THtmlItemsListContainer+getItemByAttr"></a>
188
+ ##### **getItemByAttr(name, value)** => `?HTMLElement`
109
189
 
110
190
  This method tries to find an item by its given attribute in the list and if found returns it (*see description of `srchIndexByAttr` method for details how a `value` parameter is used*).
111
191
 
112
- ##### **getItemByID(value)**
192
+ | parameter name | value type | default value | description |
193
+ |:---|---|---:|:---|
194
+ | `name` | `string` | --- | an attribute name |
195
+ | `value` | `any` | --- | an attribute value |
196
+
197
+ <a name="THtmlItemsListContainer+getItemByID"></a>
198
+ ##### **getItemByID(value)** => `?HTMLElement`
113
199
 
114
200
  This method tries to find an item by its `ID`-attribute in the list and if found returns it (*see description of `srchIndexByAttr` method for details how a `value` parameter is used*).
115
201
 
116
- ##### **addItem(item\[, options])**
202
+ | parameter name | value type | default value | description |
203
+ |:---|---|---:|:---|
204
+ | `value` | `string` | --- | an ID value |
205
+
206
+ <a name="THtmlItemsListContainer+addItem"></a>
207
+ ##### **addItem(item\[, options])** => `number`
117
208
 
118
209
  This method adds a given item to a container members and if succeed returns its index.
119
210
 
211
+ | parameter name | value type | default value | description |
212
+ |:---|---|---:|:---|
213
+ | `item` | `HTMLElement` | --- | some element |
214
+ | `options` | `boolean` | `false` | a flag to switch mode |
215
+
120
216
  If `options` parameter is given and is set to `true`, in case of success, the `curIndex` property is adjusted by the method.
121
217
 
122
218
  If `itemBaseClassID` option of the container is set, the method will applied a value given by this option as a `class` attribute of an item which was successfully added.
123
219
 
124
- ##### **delItem(index\[, options])**
220
+ <a name="THtmlItemsListContainer+delItem"></a>
221
+ ##### **delItem(index\[, options\[, optEx]])** => `boolean`
125
222
 
126
223
  This method deletes an item addressed by the given `index` from a container members and if succeed `true` is returned.
127
224
 
225
+ | parameter name | value type | default value | description |
226
+ |:---|---|---:|:---|
227
+ | `index` | `number`, `string` | --- | an element index |
228
+ | `options` | `boolean` | `true` | a flag to switch mode |
229
+ | `optEx` | `boolean` | `true` | a flag to switch mode |
230
+
128
231
  If `options` parameter is set to `true` (a default value), the `curIndex` property is adjusted by the method. If it is set to `false` the `curIndex` property is not adjusted before a value of the property exited out of the list indexes range that caused the property to be reset. In case the `options` is not given or is not a type of a `boolean`, its receives the default value.
129
232
 
130
- ##### **selectItem(index\[, options])**
233
+ <a name="THtmlItemsListContainer+selectItem"></a>
234
+ ##### **selectItem(index\[, options])** => `boolean`
131
235
 
132
236
  This method selects an item addressed by an `index` and if succeed `true` is returned.
133
237
 
238
+ | parameter name | value type | default value | description |
239
+ |:---|---|---:|:---|
240
+ | `index` | `number`, `string` | --- | an element index |
241
+ | `options` | `boolean` | `false` | a flag to switch mode |
242
+
134
243
  If `options` parameter is given and is set to `true`, in case of success, the `curIndex` property is adjusted by the method.
135
244
 
136
- ##### **unselectItem(index)**
245
+ <a name="THtmlItemsListContainer+unselectItem"></a>
246
+ ##### **unselectItem(index)** => `boolean`
137
247
 
138
248
  This method unselects an item addressed by an `index` and if succeed `true` is returned.
139
249
 
140
- ##### **hideItem(index)**
250
+ | parameter name | value type | default value | description |
251
+ |:---|---|---:|:---|
252
+ | `index` | `number`, `string` | --- | an element index |
253
+
254
+ <a name="THtmlItemsListContainer+hideItem"></a>
255
+ ##### **hideItem(index)** => `boolean`
141
256
 
142
257
  This method hides an item addressed by an `index` and if succeed `true` is returned.
143
258
 
144
- ##### **showItem(index)**
259
+ | parameter name | value type | default value | description |
260
+ |:---|---|---:|:---|
261
+ | `index` | `number`, `string` | --- | an element index |
262
+
263
+ <a name="THtmlItemsListContainer+showItem"></a>
264
+ ##### **showItem(index)** => `boolean`
145
265
 
146
266
  This method shows an item addressed by an `index` and if succeed `true` is returned.
147
267
 
148
- ##### **isSelectedItem(index)**
268
+ | parameter name | value type | default value | description |
269
+ |:---|---|---:|:---|
270
+ | `index` | `number`, `string` | --- | an element index |
271
+
272
+ <a name="THtmlItemsListContainer+isSelectedItem"></a>
273
+ ##### **isSelectedItem(index)** => `boolean`
149
274
 
150
275
  This method checks whether or not an item addressed by an `index` is selected and if so `true` is returned.
151
276
 
152
- ##### **isHiddenItem(index)**
277
+ | parameter name | value type | default value | description |
278
+ |:---|---|---:|:---|
279
+ | `index` | `number`, `string` | --- | an element index |
280
+
281
+ <a name="THtmlItemsListContainer+isHiddenItem"></a>
282
+ ##### **isHiddenItem(index)** => `boolean`
153
283
 
154
284
  This method checks whether or not an item addressed by an `index` is hidden and if so `true` is returned.
155
285
 
286
+ | parameter name | value type | default value | description |
287
+ |:---|---|---:|:---|
288
+ | `index` | `number`, `string` | --- | an element index |
289
+
290
+ <a name="THtmlItemsListController"></a>
156
291
  ### **THtmlItemsListController**
157
292
 
158
293
  This class implements a controller that provide mechanism for managing a list container and its elements placed on an HTML-form.
@@ -165,139 +300,296 @@ The class constructor creates a new instance of the class.
165
300
 
166
301
  The class constructor receives a parameters listed below:
167
302
 
168
- |parameter name|value type|default value|description|
303
+ | parameter name | value type | default value | description |
169
304
  |:---|---|---:|:---|
170
- |`host`|`HTMLElement`|`undefined`|points to a host element which holds a list items|
171
- |`options`|`object`|---|contains a set of a settings for a container|
305
+ | `host` | `HTMLElement` | `undefined` |points to a host element which holds a list items |
306
+ | `options` | `object` | --- | contains a set of a settings for a container |
172
307
 
173
308
  ##### `options` parameter
174
309
 
175
310
  The `options` structure has listed below:
176
311
 
177
- |option name|value type|default value|description|
312
+ | option name | value type | default value | description |
178
313
  |:---|---|---:|:---|
179
- |`autoHideNewItems`|`boolean`|`false`|for details see options on `THtmlItemsListContainer` class constructor section|
180
- |`markCurrentItem`|`boolean`|`false`|for details see options on `THtmlItemsListContainer` class constructor section|
181
- |`itemBaseClassID`|`array`|---|for details see options on `THtmlItemsListContainer` class constructor section|
182
- |`showStubsIfEmpty`|`boolean`|`false`|if set, in case of the empty list, the default stub-item will be displayed|
183
- |`allowGroupSelection`|`boolean`|`false`|if set the more than one element can be selected in the list|
184
- |`allowSelectionLocks`|`boolean`|`false`|\<*reserved, experimental*>|
314
+ | `autoHideNewItems` | `boolean` | `false` | for details see options on `THtmlItemsListContainer` class constructor section |
315
+ | `markCurrentItem` | `boolean` | `false` | for details see options on `THtmlItemsListContainer` class constructor section |
316
+ | `itemBaseClassID` | `string`, `string[]` | --- | for details see options on `THtmlItemsListContainer` class constructor section |
317
+ | `showStubsIfEmpty` | `boolean` | `false` | if set, in case of the empty list, the default stub-item will be displayed |
318
+ | `allowGroupSelection` | `boolean` | `false` | if set the more than one element can be selected in the list |
319
+ | `allowSelectionLocks` | `boolean` | `false` | \<*reserved, experimental*> |
185
320
 
186
321
  #### class properties
187
322
 
188
- |property name|property type|read only|description|
189
- |:---|---|---|:---|
190
- |`count`|`number`|yes|contains quantity of items which holds by container|
191
- |`curIndex`|`index`|yes|presents an index of a current item|
192
- |`maxIndex`|`index`|yes|represents a max possible index for an item inside the container|
193
- |`prevIndex`|`index`|yes|presents an index of a previous item before the current|
194
- |`nextIndex`|`index`|yes|presents an index of a next item after the current|
195
- |`curItem`|`HTMLElement` or `null`|yes|represents an item addressed by `curIndex`|
196
- |`SelectedItems`|`array`|yes|returns an array of a selected items|
197
- |`StubItems`|`THtmlStubItemsSet`|yes|returns a `THtmlStubItemsSet` instance|
198
- |`isSelectionLocked`|`boolean`|yes|returns `true` if selections of an items is not allowed|
323
+ <a name="THtmlItemsListController+count"></a>
324
+ ##### **count**
325
+
326
+ | property type | read only | description |
327
+ |---|---|:---|
328
+ | `number` | yes | contains a quantity of the elements the container holds |
329
+
330
+ <a name="THtmlItemsListController+curIndex"></a>
331
+ ##### **curIndex**
332
+
333
+ | property type | read only | description |
334
+ |---|---|:---|
335
+ | `number` | yes | represents an index of the current element |
336
+
337
+ <a name="THtmlItemsListController+minIndex"></a>
338
+ ##### **minIndex**
339
+
340
+ | property type | read only | description |
341
+ |---|---|:---|
342
+ | `number` | yes | represents a minimum possible index for an element inside the container |
343
+
344
+ <a name="THtmlItemsListController+maxIndex"></a>
345
+ ##### **maxIndex**
346
+
347
+ | property type | read only | description |
348
+ |---|---|:---|
349
+ | `number` | yes | represents a maximum possible index for an element inside the container |
350
+
351
+ <a name="THtmlItemsListController+prevIndex"></a>
352
+ ##### **prevIndex**
353
+
354
+ | property type | read only | description |
355
+ |---|---|:---|
356
+ | `number` | yes | represents an index of the previous element before the current |
357
+
358
+ <a name="THtmlItemsListController+nextIndex"></a>
359
+ ##### **nextIndex**
360
+
361
+ | property type | read only | description |
362
+ |---|---|:---|
363
+ | `number` | yes | represents an index of the next element after the current |
364
+
365
+ <a name="THtmlItemsListController+curItem"></a>
366
+ ##### **curItem**
367
+
368
+ | property type | read only | description |
369
+ |---|---|:---|
370
+ | `?HTMLElement` | yes | represents an element addressed by the `curIndex` |
371
+
372
+ <a name="THtmlItemsListController+isSelectionLocked"></a>
373
+ ##### **isSelectionLocked**
374
+
375
+ | property type | read only | description |
376
+ |---|---|:---|
377
+ | `boolean` | yes | returns `true` if selections of an items is not allowed |
378
+
379
+ <a name="THtmlItemsListController+SelectedItems"></a>
380
+ ##### **SelectedItems**
381
+
382
+ | property type | read only | description |
383
+ |---|---|:---|
384
+ | `HTMLElement[]` | yes | returns an array of the selected elements |
385
+
386
+ <a name="THtmlItemsListController+StubItems"></a>
387
+ ##### **StubItems**
388
+
389
+ | property type | read only | description |
390
+ |---|---|:---|
391
+ | `THtmlStubItemsSet` | yes | returns a `THtmlStubItemsSet` instance |
199
392
 
200
393
  #### class methods
201
394
 
202
- ##### **clear()**
395
+ <a name="THtmlItemsListController+clear"></a>
396
+ ##### **clear()** => `void`
203
397
 
204
398
  This method deletes all items that is hold by the list.
205
399
 
206
- ##### **lockItemsSelection()**
400
+ <a name="THtmlItemsListController+lockItemsSelection"></a>
401
+ ##### **lockItemsSelection()** => `void`
207
402
 
208
403
  This method blocks a selection of the items in the list.
209
404
 
210
- ##### **unlockItemsSelection()**
405
+ <a name="THtmlItemsListController+unlockItemsSelection"></a>
406
+ ##### **unlockItemsSelection()** => `void`
211
407
 
212
408
  This method allows a selection of the items in the list.
213
409
 
214
- ##### **isEmpty()**
410
+ <a name="THtmlItemsListContainer+isEmpty"></a>
411
+ ##### **isEmpty()** => `boolean`
215
412
 
216
413
  This method returns `true` if the list has no items.
217
414
 
218
- ##### **isNotEmpty()**
415
+ <a name="THtmlItemsListContainer+isNotEmpty"></a>
416
+ ##### **isNotEmpty()** => `boolean`
219
417
 
220
418
  This method returns `true` if the list has at least one item.
221
419
 
222
- ##### **chkIndex(value)**
420
+ <a name="THtmlItemsListContainer+chkIndex"></a>
421
+ ##### **chkIndex(value)** => `boolean`
223
422
 
224
423
  This method returns `true` if a given value represent a valid index within the range of the list.
225
424
 
226
- ##### **chkIndexEx(value\[, mode])**
425
+ | parameter name | value type | default value | description |
426
+ |:---|---|---:|:---|
427
+ | `value` | `any` | --- | a value to be verified |
428
+
429
+ <a name="THtmlItemsListContainer+chkIndexEx"></a>
430
+ ##### **chkIndexEx(value\[, mode])** => `boolean`\|`number`
227
431
 
228
432
  This method is similar to a `chkIndex` methods but receives a `mode` parameter which allow to choose what a type of the result the method returns.
229
433
 
434
+ | parameter name | value type | default value | description |
435
+ |:---|---|---:|:---|
436
+ | `value` | `any` | --- | a value to be verified |
437
+ | `mode` | `boolean` | `false` | a flag to switch result value type |
438
+
230
439
  If `mode` parameter set to `false` (*its default value*), the result returned by the method is a `boolean` value.
231
440
 
232
441
  If `mode` parameter set to `true`, the result returned by the method has an index type.
233
442
 
234
- ##### **srchIndex(item)**
443
+ <a name="THtmlItemsListContainer+srchIndex"></a>
444
+ ##### **srchIndex(item)** => `number`
235
445
 
236
446
  This method tries to find a given item in the list and if it is found returns its index.
237
447
 
238
- ##### **srchIndexByAttr(name, value)**
448
+ | parameter name | value type | default value | description |
449
+ |:---|---|---:|:---|
450
+ | `item` | `?HTMLElement` | --- | an element to search |
451
+
452
+ <a name="THtmlItemsListContainer+srchIndexByAttr"></a>
453
+ ##### **srchIndexByAttr(name, value)** => `number`
239
454
 
240
455
  This method tries to find an item by its given attribute in the list and if it is found returns its index.
241
456
 
242
- ##### **srchIndexByID(value)**
457
+ | parameter name | value type | default value | description |
458
+ |:---|---|---:|:---|
459
+ | `name` | `string` | --- | an attribute name |
460
+ | `value` | `any` | --- | an attribute value |
461
+
462
+ <a name="THtmlItemsListContainer+srchIndexByID"></a>
463
+ ##### **srchIndexByID(value)** => `number`
243
464
 
244
465
  This method tries to find an item by its `ID`-attribute in the list and if it is found returns its index.
245
466
 
246
- ##### **setCurIndex(value)**
467
+ | parameter name | value type | default value | description |
468
+ |:---|---|---:|:---|
469
+ | `value` | `string` | --- | an ID value |
470
+
471
+ <a name="THtmlItemsListController+setCurIndex"></a>
472
+ ##### **setCurIndex(index)** => `boolean`
247
473
 
248
474
  This method sets a current item index in the list. If succeed `true` is returned.
249
475
 
250
- ##### **rstCurIndex()**
476
+ | parameter name | value type | default value | description |
477
+ |:---|---|---:|:---|
478
+ | `index` | `number`, `string` | --- | an element index |
479
+
480
+ <a name="THtmlItemsListController+rstCurIndex"></a>
481
+ ##### **rstCurIndex()** => `void`
251
482
 
252
483
  This method resets a current item index in the list.
253
484
 
254
- ##### **getItem(index)**
485
+ <a name="THtmlItemsListContainer+getItem"></a>
486
+ ##### **getItem(index)** => `?HTMLElement`
255
487
 
256
488
  This method returns an item addressed by a given index.
257
489
 
258
- ##### **getItemByAttr(name, value)**
490
+ | parameter name | value type | default value | description |
491
+ |:---|---|---:|:---|
492
+ | `index` | `number`, `string` | --- | an element index |
493
+
494
+ <a name="THtmlItemsListContainer+getItemByAttr"></a>
495
+ ##### **getItemByAttr(name, value)** => `?HTMLElement`
259
496
 
260
497
  This method tries to find an item by its given attribute in the list and if found returns it.
261
498
 
262
- ##### **getItemByID(value)**
499
+ | parameter name | value type | default value | description |
500
+ |:---|---|---:|:---|
501
+ | `name` | `string` | --- | an attribute name |
502
+ | `value` | `any` | --- | an attribute value |
503
+
504
+ <a name="THtmlItemsListContainer+getItemByID"></a>
505
+ ##### **getItemByID(value)** => `?HTMLElement`
263
506
 
264
507
  This method tries to find an item by its `ID`-attribute in the list and if found returns it.
265
508
 
266
- ##### **addItem(item\[, options])**
509
+ | parameter name | value type | default value | description |
510
+ |:---|---|---:|:---|
511
+ | `value` | `string` | --- | an ID value |
512
+
513
+ <a name="THtmlItemsListController+addItem"></a>
514
+ ##### **addItem(item\[, options])** => `number`
267
515
 
268
516
  This method adds a given item to a list members and if succeed returns its index.
269
517
 
270
- ##### **delItem(index\[, options])**
518
+ | parameter name | value type | default value | description |
519
+ |:---|---|---:|:---|
520
+ | `item` | `HTMLElement` | --- | some element |
521
+ | `options` | `boolean` | `false` | a flag to switch mode |
522
+
523
+ <a name="THtmlItemsListController+delItem"></a>
524
+ ##### **delItem(index\[, options])** => `boolean`
271
525
 
272
526
  This method deletes an item addressed by `index` from a list members and if succeed `true` is returned.
273
527
 
274
- ##### **selectItem(index\[, options])**
528
+ | parameter name | value type | default value | description |
529
+ |:---|---|---:|:---|
530
+ | `index` | `number`, `string` | --- | an element index |
531
+ | `options` | `boolean` | `true` | a flag to switch mode |
532
+
533
+ <a name="THtmlItemsListController+selectItem"></a>
534
+ ##### **selectItem(index\[, options])** => `boolean`
275
535
 
276
536
  This method selects an item addressed by an `index` and if succeed `true` is returned.
277
537
 
278
- ##### **unselectItem(index)**
538
+ | parameter name | value type | default value | description |
539
+ |:---|---|---:|:---|
540
+ | `index` | `number`, `string` | --- | an element index |
541
+ | `options` | `boolean` | `false` | a flag to switch mode |
542
+
543
+ <a name="THtmlItemsListController+unselectItem"></a>
544
+ ##### **unselectItem(index)** => `boolean`
279
545
 
280
546
  This method unselects an item addressed by an `index` and if succeed `true` is returned.
281
547
 
282
- ##### **hideItem(index)**
548
+ | parameter name | value type | default value | description |
549
+ |:---|---|---:|:---|
550
+ | `index` | `number`, `string` | --- | an element index |
551
+
552
+ <a name="THtmlItemsListController+hideItem"></a>
553
+ ##### **hideItem(index)** => `boolean`
283
554
 
284
555
  This method hides an item addressed by an `index` and if succeed `true` is returned.
285
556
 
286
- ##### **showItem(index)**
557
+ <a name="THtmlItemsListController+showItem"></a>
558
+ ##### **showItem(index)** => `boolean`
287
559
 
288
560
  This method shows an item addressed by an `index` and if succeed `true` is returned.
289
561
 
290
- ##### **isSelectedItem(index)**
562
+ | parameter name | value type | default value | description |
563
+ |:---|---|---:|:---|
564
+ | `index` | `number`, `string` | --- | an element index |
565
+
566
+ <a name="THtmlItemsListContainer+isSelectedItem"></a>
567
+ ##### **isSelectedItem(index)** => `boolean`
291
568
 
292
569
  This method checks whether or not an item addressed by an `index` is selected and if so `true` is returned.
293
570
 
294
- ##### **isHiddenItem(index)**
571
+ | parameter name | value type | default value | description |
572
+ |:---|---|---:|:---|
573
+ | `index` | `number`, `string` | --- | an element index |
574
+
575
+ <a name="THtmlItemsListContainer+isHiddenItem"></a>
576
+ ##### **isHiddenItem(index)** => `boolean`
295
577
 
296
578
  This method checks whether or not an item addressed by an `index` is hidden and if so `true` is returned.
297
579
 
298
- ##### **on(name, event)**
580
+ | parameter name | value type | default value | description |
581
+ |:---|---|---:|:---|
582
+ | `index` | `number`, `string` | --- | an element index |
583
+
584
+ <a name="THtmlItemsListController+on"></a>
585
+ ##### **on(name, event)** => `void`
299
586
 
300
- This method sets event handler for the list event addressed by `name` parameter.
587
+ This method sets event handler for the list event addressed by a `name` parameter.
588
+
589
+ | parameter name | value type | default value | description |
590
+ |:---|---|---:|:---|
591
+ | `name` | `string` | --- | an event name |
592
+ | `event` | `function` | --- | a callback function |
301
593
 
302
594
  > Note: for current implementation you can't reset or set new event handler (especially another one) if a handler with the same name exists already.
303
595
 
@@ -305,18 +597,19 @@ This method sets event handler for the list event addressed by `name` parameter.
305
597
 
306
598
  The class generates the events listed in the table bellow:
307
599
 
308
- |event name|description|
600
+ | event name | description |
309
601
  |:---|:---|
310
- |`list-clear`|fired if the list is cleared or a last item was removed|
311
- |`first-item-added`|fired when a first item was added to the list. This event will occur before `item-added` event was triggered|
312
- |`item-added`|fired when an item was added to the list|
313
- |`item-removed`|fired when an item was deleted from the list. It will not occur in case the item is the last.|
314
- |`current-item-chosen`|fired when an item was choosen as current|
315
- |`item-selected`|fired when an item was marked as selected in the list|
316
- |`item-unselected`|fired when an item was unmarked as selected in the list|
317
- |`item-hidden`|fired when an item was marked as hidden in the list|
318
- |`item-shown`|fired when an item was marked as non-hidden in the list|
319
-
602
+ | `list-clear` | fired if the list is cleared or a last item was removed |
603
+ | `first-item-added` | fired when a first item was added to the list. This event will occur before `item-added` event was triggered |
604
+ | `item-added` | fired when an item was added to the list |
605
+ | `item-removed` | fired when an item was deleted from the list. It will not occur in case the item is the last. |
606
+ | `current-item-chosen` | fired when an item was chosen as current |
607
+ | `item-selected` | fired when an item was marked as selected in the list |
608
+ | `item-unselected` | fired when an item was unmarked as selected in the list |
609
+ | `item-hidden` | fired when an item was marked as hidden in the list |
610
+ | `item-shown` | fired when an item was marked as non-hidden in the list |
611
+
612
+ <a name="THtmlStubItemsSet"></a>
320
613
  ### **THtmlStubItemsSet**
321
614
 
322
615
  This class implements a controller that provide mechanism for managing a so-called "stub"-elements displayed inside an attached list container placed on an HTML-form.
@@ -329,96 +622,155 @@ The class constructor creates a new instance of the class.
329
622
 
330
623
  The class constructor receives a parameters listed below:
331
624
 
332
- |parameter name|value type|default value|description|
625
+ | parameter name | value type | default value | description |
333
626
  |:---|---|---:|:---|
334
- |`host`|`HTMLElement`|---|points to a host element which holds a list items|
335
- |`options`|`object` or `array`|`undefined`|contains an object that is send to a class `loadItems` method|
627
+ | `host` | `HTMLElement` | --- | points to a host element which holds a list items |
628
+ | `options` | `object`, `array` | `undefined` | contains an object that is send to a class `loadItems` method |
336
629
 
337
630
  ##### `options` parameter
338
631
 
339
632
  The `options` structure has listed below:
340
633
 
341
- |option name|value type|default value|description|
634
+ | option name | value type | default value | description |
342
635
  |:---|---|---:|:---|
343
- |`items`|`array`|`undefined`|defines a list of the items to load|
344
- |`defaultItem`|`string`|EMPTY_STRING|if set it defines a name of the item used by default|
345
- |`force`|`boolean`|`false`|if set to `true`, the item which is already present will be replaced with a new one|
636
+ | `items` | `array` | `undefined` | defines a list of the entries to load. Each entry contains a `name`-`element` pair. |
637
+ | `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
638
+ | `force` | `boolean` | `false` | if set to `true`, the item which is already present will be replaced with a new one (*`since: v0.0.23` - deprecated*) |
639
+
640
+ > NOTE: For more details on an `items` element see an description of a [`loadItems`](#THtmlStubItemsSet+loadItems) class method.
346
641
 
347
642
  #### class properties
348
643
 
349
- |property name|property type|read only|description|
350
- |:---|---|---|:---|
351
- |`count`|`number`|yes|presents quantity of items which holds by the set|
352
- |`defItem`|'string`|no|defines an item name which is used by default|
644
+ <a name="THtmlStubItemsSet+count"></a>
645
+ ##### **count**
646
+
647
+ | property type | read only | description |
648
+ |---|---|:---|
649
+ | `number` | yes | contains a quantity of an elements which holds by the set |
650
+
651
+ <a name="THtmlStubItemsSet+defItem"></a>
652
+ ##### **defItem**
653
+
654
+ | property type | read only | description |
655
+ |---|---|:---|
656
+ | `string` | no | defines an element name which is used by default |
353
657
 
354
658
  #### class methods
355
659
 
356
- ##### **clear()**
660
+ <a name="THtmlStubItemsSet+clear"></a>
661
+ ##### **clear()** => `void`
357
662
 
358
663
  This class method deletes all items hold by the set.
359
664
 
360
- ##### **hasItem(name)**
665
+ <a name="THtmlStubItemsSet+hasItem"></a>
666
+ ##### **hasItem(name)** => `boolean`
361
667
 
362
668
  This class method returns `true` if an item named by `name` exists in the set and `false` if else.
363
669
 
364
- ##### **hasItems()**
670
+ | parameter name | value type | default value | description |
671
+ |:---|---|---:|:---|
672
+ | `name` | `string` | --- | an element name |
673
+
674
+ <a name="THtmlStubItemsSet+hasItems"></a>
675
+ ##### **hasItems()** => `boolean`
365
676
 
366
677
  This class method returns `true` if the set hold any items and `false` if not.
367
678
 
368
- ##### **getItem(name)**
679
+ <a name="THtmlStubItemsSet+getItem"></a>
680
+ ##### **getItem(name)** => `?HTMLElement`
369
681
 
370
682
  This class method returns an item named by `name` if it exists in the set and `null` if else.
371
683
 
372
- ##### **addItem(name, item\[, actForce])**
684
+ | parameter name | value type | default value | description |
685
+ |:---|---|---:|:---|
686
+ | `name` | `string` | --- | an element name |
687
+
688
+ <a name="THtmlStubItemsSet+addItem"></a>
689
+ ##### **addItem(name, item\[, options])** => `boolean`
373
690
 
374
691
  This class method tries to include a given `item` to a set members with a label given by `name` and if succeed returns `true`.
375
692
 
376
- The `actForce` parameter if given alters the method behaviour:
693
+ | parameter name | value type | default value | description |
694
+ |:---|---|---:|:---|
695
+ | `name` | `string` | --- | an element name |
696
+ | `item` | `HTMLElement` | --- | an element |
697
+ | `options` | `boolean` | `false` | flag that defines whether to run in `force`-mode |
698
+
699
+ The `actForce` parameter if given alters the method behavior:
377
700
 
378
701
  - If set to `true` it force replacements of an existing item which label is equal to `name`;
379
702
  - If set to `false` and item with the same label already exists the method will failed;
380
703
  - If parameter is not given or not of a `boolean` type its default value meant to be `false`.
381
704
 
382
- ##### **delItem(name)**
705
+ <a name="THtmlStubItemsSet+delItem"></a>
706
+ ##### **delItem(name)** => `boolean`
383
707
 
384
708
  This class method tries to delete item named by `name` from the set and if succeed `true` is returned.
385
709
 
386
- ##### **showItem(name)**
710
+ | parameter name | value type | default value | description |
711
+ |:---|---|---:|:---|
712
+ | `name` | `string` | --- | an element name |
713
+
714
+ <a name="THtmlStubItemsSet+showItem"></a>
715
+ ##### **showItem(name)** => `boolean`
387
716
 
388
717
  This class method tries to make item named by `name` visible on HTML-form and if succeed `true` is returned.
389
718
 
390
- ##### **hideItem(name)**
719
+ | parameter name | value type | default value | description |
720
+ |:---|---|---:|:---|
721
+ | `name` | `string` | --- | an element name |
722
+
723
+ <a name="THtmlStubItemsSet+hideItem"></a>
724
+ ##### **hideItem(name)** => `boolean`
391
725
 
392
726
  This class method tries to make item named by `name` invisible on HTML-form and if succeed `true` is returned.
393
727
 
394
- ##### **setDefItem(name)**
728
+ | parameter name | value type | default value | description |
729
+ |:---|---|---:|:---|
730
+ | `name` | `string` | --- | an element name |
731
+
732
+ <a name="THtmlStubItemsSet+setDefItem"></a>
733
+ ##### **setDefItem(name)** => `boolean`
395
734
 
396
735
  This class method tries to set item named by `name` as a default item and if succeed `true` is returned.
397
736
 
398
- ##### **rstDefItem()**
737
+ | parameter name | value type | default value | description |
738
+ |:---|---|---:|:---|
739
+ | `name` | `string` | --- | an element name |
740
+
741
+ <a name="THtmlStubItemsSet+rstDefItem"></a>
742
+ ##### **rstDefItem()** => `void`
399
743
 
400
744
  This class method resets a default item.
401
745
 
402
- ##### **showDefItem()**
746
+ <a name="THtmlStubItemsSet+showDefItem"></a>
747
+ ##### **showDefItem()** => `boolean`
403
748
 
404
749
  This class method is similar to `showItem` method but is performed on a default item.
405
750
 
406
- ##### **hideDefItem()**
751
+ <a name="THtmlStubItemsSet+hideDefItem"></a>
752
+ ##### **hideDefItem()** => `boolean`
407
753
 
408
754
  This class method is similar to `hideItem` method but is performed on a default item.
409
755
 
410
- ##### **loadItems(list\[, options])**
756
+ <a name="THtmlStubItemsSet+loadItems"></a>
757
+ ##### **loadItems(list\[, options])** => `number`
411
758
 
412
759
  This class methods loads an items given by `list` in the set and returned quantity of how many items have been processed successfully.
413
760
 
414
- The `list` parameter is an `object` that contains the following set of values:
761
+ | parameter name | value type | default value | description |
762
+ |:---|---|---:|:---|
763
+ | `list` | `array`, `object` | --- | an array of entries or a special descriptive object |
764
+ | `options` | `boolean`, `object` | --- | an options |
765
+
766
+ If the `list` parameter is an `object` that contains the following set of values:
415
767
 
416
- |value name|value type|default value|description|
768
+ | option name | value type | default value | description |
417
769
  |:---|---|---:|:---|
418
- |`defaultItem`|`string`|EMPTY_STRING|if set it defines a name of the item used by default|
419
- |`items`|`array`|`undefined`|defines a list of the items to load|
770
+ | `items` | `array` | `undefined` | defines a list of the entries to load. Each entry contains a `name`-`element` pair. |
771
+ | `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
420
772
 
421
- If the `list` parameter is an `array` it used as value of an `list.items` options and if such a case the `list.defultItem` will be set to defaults.
773
+ If the `list` parameter is an `array` it used as value of a `list.items` options and in such a case the name for a default element receives from an `options.defaultItem` if given.
422
774
 
423
775
  Note that each element of a `list.items` can be:
424
776
 
@@ -430,11 +782,93 @@ Note that each element of a `list.items` can be:
430
782
 
431
783
  '{ **name**: \<*`item name`*>, **item**: \<*`object`*>}'
432
784
 
433
- The `options` parameter is an `object` that contains the following set of parameters:
785
+ If the `options` parameter is an `object` that contains the following set of parameters:
434
786
 
435
- |option name|value type|default value|description|
787
+ | option name | value type | default value | description |
436
788
  |:---|---|---:|:---|
437
- |`useClear`|`boolean`|`true`|if set to `true`, before the load of the items, the list is cleared|
438
- |`force`|`boolean`|`false`|if set to `true`, the item which is already present will be replaced with a new one|
789
+ | `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
790
+ | `useClear` | `boolean` | `true` | if set to `true`, before the load of the items, the list is cleared |
791
+ | `force` | `boolean` | `false` | if set to `true`, the item which is already present will be replaced with a new one |
439
792
 
440
793
  If the `options` parameter is a `boolean` value it treats as a `options.useClear` option.
794
+
795
+ <a name="THtmlListButtonsController"></a>
796
+ ### **THtmlListButtonsController**
797
+
798
+ This class provides a buttons controller to use with a list components to performs actions for list elements selection.
799
+
800
+ #### class constructor
801
+
802
+ The class constructor creates a new instance of the class.
803
+
804
+ ##### constructor parameters
805
+
806
+ The class constructor receives an `options` parameter which structure has listed below:
807
+
808
+ | option name | option type | default value | description |
809
+ |:---|---|---:|:---|
810
+ | `btnFirst` | `?HTMLElement` | `undefined` | defines an HTML-button which will select the first element |
811
+ | `btnPrev` | `?HTMLElement` | `undefined` | defines an HTML-button which will select the previous element |
812
+ | `btnNext` | `?HTMLElement` | `undefined` | defines an HTML-button which will select the next element |
813
+ | `btnLast` | `?HTMLElement` | `undefined` | defines an HTML-button which will select the last element |
814
+
815
+ #### class properties
816
+
817
+ This class has none.
818
+
819
+ #### class methods
820
+
821
+ <a name="THtmlListButtonsController+disableAll"></a>
822
+ ##### **disableAll()** => `void`
823
+
824
+ This method disables all buttons that holds by the controller.
825
+
826
+ <a name="THtmlListButtonsController+disableBkwd"></a>
827
+ ##### **disableBkwd()** => `void`
828
+
829
+ This method disables all buttons in *'move backward'* group (*i.e. `btnFirst` and `btnPrev`*) that holds by the controller.
830
+
831
+ <a name="THtmlListButtonsController+disableFrwd"></a>
832
+ ##### **disableFrwd()** => `void`
833
+
834
+ This method disables all buttons in *'move forward'* group (*i.e. `btnNext` and `btnLast`*) that holds by the controller.
835
+
836
+ <a name="THtmlListButtonsController+enableAll"></a>
837
+ ##### **enableAll()** => `void`
838
+
839
+ This method enables all buttons that holds by the controller.
840
+
841
+ <a name="THtmlListButtonsController+enableBkwd"></a>
842
+ ##### **enableBkwd()** => `void`
843
+
844
+ This method enables all buttons in *'move backward'* group (*i.e. `btnFirst` and `btnPrev`*) that holds by the controller.
845
+
846
+ <a name="THtmlListButtonsController+enableFrwd"></a>
847
+ ##### **enableFrwd()** => `void`
848
+
849
+ This method enables all buttons in *'move forward'* group (*i.e. `btnNext` and `btnLast`*) that holds by the controller.
850
+
851
+ #### class methods (*special*)
852
+
853
+ <a name="THtmlListButtonsController+on"></a>
854
+ ##### **on(name, event)** => `void`
855
+
856
+ This method sets event handler addressed by a `name` parameter.
857
+
858
+ | parameter name | value type | default value | description |
859
+ |:---|---|---:|:---|
860
+ | `name` | `string` | --- | an event name |
861
+ | `event` | `function` | --- | a callback function |
862
+
863
+ > Note: for current implementation you can't reset or set new event handler (*especially another one*) if a handler with the same name exists already.
864
+
865
+ #### class events
866
+
867
+ The class generates the events listed in the table bellow:
868
+
869
+ | event name | description |
870
+ |:---|:---|
871
+ | `btn-first-pressed` | fired if the `btnFirst` was pressed |
872
+ | `btn-prev-pressed` | fired if the `btnPrev` was pressed |
873
+ | `btn-next-pressed` | fired if the `btnNext` was pressed |
874
+ | `btn-last-pressed` | fired if the `btnLast` was pressed |