@cntwg/html-helper 0.0.22 → 0.0.24

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,4 +1,4 @@
1
- // [v0.1.063-20240714]
1
+ // [v0.1.067-20241119]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -10,9 +10,9 @@ const {
10
10
 
11
11
  const {
12
12
  isHTMLElement, isSelectedHTMLElement, isHiddenHTMLElement,
13
- showHtmlElement, hideHtmlElement,
14
- selectHtmlElement, unselectHtmlElement,
15
- markHtmlElementAsCurrent, unmarkCurrentHtmlElement,
13
+ showHTMLElement, hideHTMLElement,
14
+ selectHTMLElement, unselectHTMLElement,
15
+ markHTMLElementAsCurrent, unmarkCurrentHTMLElement,
16
16
  readAsAttrValue, valueToClassList,
17
17
  CSS_CLASS_STRING,
18
18
  } = require('../html-helper-lib.js');
@@ -24,24 +24,20 @@ const {
24
24
  } = require('./mod-hfunc.js');
25
25
 
26
26
  const {
27
- CSS_CLASS_SELECTED,
27
+ //CSS_CLASS_SELECTED,
28
28
  CSS_CLASS_DISABLED,
29
- CSS_CLASS_HIDDEN,
30
- CSS_CLASS_CURRENT,
31
- CSS_CLASS_ACTIVE,
29
+ //CSS_CLASS_HIDDEN,
30
+ //CSS_CLASS_CURRENT,
31
+ //CSS_CLASS_ACTIVE,
32
32
  } = CSS_CLASS_STRING;
33
33
 
34
- const ILC_SMODE_DEF = 0;
35
- const ILC_SMODE_SHFT = 1;
36
- const ILC_SMODE_CTRL = 2;
37
-
38
34
  // === module extra block (helper functions) ===
39
35
 
40
36
  /**
41
37
  * @function srchListElementByAttr
42
- * @param {TItemsListEx}
43
- * @param {string}
44
- * @param {string}
38
+ * @param {TItemsListEx} list
39
+ * @param {string} name
40
+ * @param {string} [value=""]
45
41
  * @returns {object}
46
42
  * @inner
47
43
  * @description Searches an element in a list by a given attributes
@@ -77,6 +73,10 @@ function srchListElementByAttr(list, name, value = '') {
77
73
  * (* constant definitions *)
78
74
  */
79
75
 
76
+ const ILC_SMODE_DEF = 0;
77
+ const ILC_SMODE_SHFT = 1;
78
+ const ILC_SMODE_CTRL = 2;
79
+
80
80
  /***
81
81
  * (* function definitions *)
82
82
  */
@@ -86,20 +86,32 @@ function srchListElementByAttr(list, name, value = '') {
86
86
  */
87
87
 
88
88
  /**
89
- * @description This class implements an instance of a list container
89
+ * @classdesc This class implements an interfaco for a list container
90
90
  */
91
91
  class THtmlItemsListContainer {
92
- #_host = null;
93
- #_items = null;
94
- #_options = null;
95
- #_status = null;
92
+ /** @property {?HTMLElement} */
93
+ #_host;
94
+ /** @property {TItemsListEx} */
95
+ #_items;
96
+ /** @property {object} */
97
+ #_options;// = null;
98
+ /**
99
+ * @typedef {Object} statILCont
100
+ * @property {number} curIndex
101
+ * @property {?HTMLElement} curItem
102
+ * @inner
103
+ * @description A container status
104
+ */
105
+ /** @property {statILCont} */
106
+ #_status;
96
107
 
97
108
  /**
98
- * @param {HTMLElement}
109
+ * @param {HTMLElement} host
99
110
  * @param {object} [opt]
100
- * @param {bool} [opt.autoHideNewItems=false]
101
- * @param {bool} [opt.markCurrentItem=false]
102
- * @param {(string|array)} [opt.itemBaseClassID]
111
+ * @param {boolean} [opt.autoHideNewItems=false]
112
+ * @param {boolean} [opt.markCurrentItem=false]
113
+ * @param {(string|string[])} [opt.itemBaseClassID]
114
+ * @description Creates an instance of a list container
103
115
  */
104
116
  constructor(host, opt) {
105
117
  // check host
@@ -123,6 +135,7 @@ class THtmlItemsListContainer {
123
135
  itemBaseClassID = valueToClassList(itemBaseClassID, true);
124
136
  _options.itemBaseClassID = itemBaseClassID;
125
137
  // init status
138
+ /** @type {statILCont} */
126
139
  const _status = {
127
140
  curIndex: _items.curIndex,
128
141
  curItem: _items.curItem,
@@ -135,66 +148,72 @@ class THtmlItemsListContainer {
135
148
  /**
136
149
  * @property {number}
137
150
  * @readonly
151
+ * @description Contains a Qty of an elements
138
152
  */
139
- get count(){
153
+ get count() {
140
154
  return this.#_items.count;
141
155
  }
142
156
 
143
157
  /**
144
- * @property {index}
158
+ * @property {number}
145
159
  * @readonly
160
+ * @description Contains an of the current element
146
161
  */
147
- get curIndex(){
162
+ get curIndex() {
148
163
  return this.#_items.curIndex;
149
164
  }
150
165
 
151
166
  /**
152
- * @property {index}
167
+ * @property {number}
153
168
  * @readonly
169
+ * @description Returns a minimum value of an index
154
170
  */
155
- get minIndex(){
171
+ get minIndex() {
156
172
  return this.#_items.minIndex;
157
173
  }
158
174
 
159
175
  /**
160
- * @property {index}
176
+ * @property {number}
161
177
  * @readonly
178
+ * @description Returns a maximum value of an index
162
179
  */
163
- get maxIndex(){
180
+ get maxIndex() {
164
181
  return this.#_items.maxIndex;
165
182
  }
166
183
 
167
184
  /**
168
- * @property {index}
185
+ * @property {number}
169
186
  * @readonly
187
+ * @description Returns a value of a previous index
170
188
  */
171
- get prevIndex(){
189
+ get prevIndex() {
172
190
  return this.#_items.prevIndex;
173
191
  }
174
192
 
175
193
  /**
176
- * @property {index}
194
+ * @property {number}
177
195
  * @readonly
196
+ * @description Returns a value of a next index
178
197
  */
179
- get nextIndex(){
198
+ get nextIndex() {
180
199
  return this.#_items.nextIndex;
181
200
  }
182
201
 
183
202
  /**
184
203
  * @property {?HTMLElement}
185
204
  * @readonly
205
+ * @description Returns an element in the current index
186
206
  */
187
- get curItem(){
207
+ get curItem() {
188
208
  const item = this.#_items.curItem;
189
209
  return isHTMLElement(item) ? item : null;
190
210
  }
191
211
 
192
212
  /**
193
- * @param {none}
194
- * @returns {none}
213
+ * @returns {void}
195
214
  * @description Clears an instance content.
196
215
  */
197
- clear(){
216
+ clear() {
198
217
  this.#_items.clear();
199
218
  const _status = this.#_status;
200
219
  _status.curIndex = this.curIndex;
@@ -204,104 +223,104 @@ class THtmlItemsListContainer {
204
223
  }
205
224
 
206
225
  /**
207
- * @param {none}
208
- * @returns {bool}
226
+ * @returns {boolean}
209
227
  * @description Checks if an instance contains no items.
210
228
  */
211
- isEmpty(){
229
+ isEmpty() {
212
230
  return this.#_items.isEmpty();
213
231
  }
214
232
 
215
233
  /**
216
- * @param {none}
217
- * @returns {bool}
234
+ * @returns {boolean}
218
235
  * @description Checks if an instance contains any items.
219
236
  */
220
- isNotEmpty(){
237
+ isNotEmpty() {
221
238
  return this.#_items.isNotEmpty();
222
239
  }
223
240
 
224
241
  /**
225
- * @param {any}
226
- * @returns {bool}
242
+ * @param {any} value - index value
243
+ * @returns {boolean}
227
244
  * @description Checks if a given value is a valid index and
228
245
  * it fits an index range within an instance.
229
246
  */
230
- chkIndex(value){
247
+ chkIndex(value) {
231
248
  return this.#_items.chkIndex(value);
232
249
  }
233
250
 
234
251
  /**
252
+ * @param {any} value - value to check
253
+ * @param {boolean} [opt=false] - defines a type of result
254
+ * @returns {(boolean|number)}
235
255
  * @see TItemsListEx.chkIndexEx
236
256
  * @description Checks if a given value is a valid index and
237
257
  * it fits an index range within an instance.
238
258
  */
239
- chkIndexEx(...args){
259
+ chkIndexEx(...args) {
240
260
  return this.#_items.chkIndexEx(...args);
241
261
  }
242
262
 
243
263
  /**
244
- * @param {HTMLElement}
245
- * @returns {index}
264
+ * @param {HTMLElement} item - element to search
265
+ * @returns {number}
246
266
  * @description Returns an index of a given element.
247
267
  */
248
- srchIndex(item){
268
+ srchIndex(item) {
249
269
  return isHTMLElement(item) ? this.#_items.srchIndex(item) : -1;
250
270
  }
251
271
 
252
272
  /**
253
- * @param {ID_STRING}
254
- * @param {any}
255
- * @returns {index}
273
+ * @param {string} name - attribute name
274
+ * @param {any} [value=""] - attribute value
275
+ * @returns {number}
256
276
  * @description Returns an index of an element wich has an attribute
257
277
  * with a given name and value.
258
278
  */
259
- srchIndexByAttr(name, value = ''){
279
+ srchIndexByAttr(name, value = '') {
260
280
  const _name = typeof name === 'string' ? name.trim() : '';
261
281
  const { index } = srchListElementByAttr(this.#_items, _name, value);
262
282
  return index;
263
283
  };
264
284
 
265
285
  /**
266
- * @param {ID_STRING}
267
- * @returns {index}
286
+ * @param {string} value - element ID
287
+ * @returns {number}
268
288
  * @description Returns an index of an element wich has a given ID.
269
289
  */
270
- srchIndexByID(value){
290
+ srchIndexByID(value) {
271
291
  const { index } = srchListElementByAttr(this.#_items, 'id', value);
272
292
  return index;
273
293
  };
274
294
 
275
295
  /**
276
- * @param {index}
277
- * @returns {bool}
296
+ * @param {(number|string)} index - element index
297
+ * @returns {boolean}
278
298
  * @description Sets a current index.
279
299
  */
280
- setCurIndex(index){
300
+ setCurIndex(index) {
281
301
  const isSUCCEED = this.#_items.setIndex(index);
282
302
  if (isSUCCEED) {
283
303
  const markCurrentItem = this.#_options.markCurrentItem;
284
304
  const _status = this.#_status;
285
305
  if (markCurrentItem && _status.curIndex !== -1) {
286
- unmarkCurrentHtmlElement(_status.curItem);
306
+ unmarkCurrentHTMLElement(_status.curItem);
287
307
  };
288
308
  const item = this.getItem(index);
289
309
  _status.curIndex = Number(index);
290
310
  _status.curItem = item;
291
- if (markCurrentItem) markHtmlElementAsCurrent(item);
311
+ if (markCurrentItem) markHTMLElementAsCurrent(item);
292
312
  };
293
313
  return isSUCCEED;
294
314
  }
295
315
 
296
316
  /**
297
- * @param {none}
298
- * @returns {none}
317
+ * @returns {void}
299
318
  * @description Resets a current index.
300
319
  */
301
- rstCurIndex(){
320
+ rstCurIndex() {
302
321
  const _status = this.#_status;
303
322
  if (this.#_options.markCurrentItem && _status.curIndex !== -1) {
304
- unmarkCurrentHtmlElement(_status.curItem);
323
+ unmarkCurrentHTMLElement(_status.curItem);
305
324
  };
306
325
  this.#_items.rstIndex();
307
326
  _status.curIndex = this.#_items.curIndex;
@@ -309,46 +328,45 @@ class THtmlItemsListContainer {
309
328
  }
310
329
 
311
330
  /**
312
- * @param {index}
331
+ * @param {(number|string)} index - element index
313
332
  * @returns {?HTMLElement}
314
333
  * @description Returns an item addressed by a given index.
315
334
  */
316
- getItem(index){
335
+ getItem(index) {
317
336
  const item = this.#_items.getItem(index);
318
337
  return isHTMLElement(item) ? item : null;
319
338
  }
320
339
 
321
340
  /**
322
- * @param {ID_STRING}
323
- * @param {any}
341
+ * @param {string} name - attribute name
342
+ * @param {any} [value=""] - attribute value
324
343
  * @returns {?HTMLElement}
325
344
  * @description Returns an item wich has an attribute
326
345
  * with a given name and value.
327
346
  */
328
- getItemByAttr(name, value = ''){
347
+ getItemByAttr(name, value = '') {
329
348
  const _name = typeof name === 'string' ? name.trim() : '';
330
349
  const { item } = srchListElementByAttr(this.#_items, _name, value);
331
350
  return item;
332
351
  }
333
352
 
334
353
  /**
335
- * @param {ID_STRING}
336
- * @param {any}
354
+ * @param {string} value - element ID
337
355
  * @returns {?HTMLElement}
338
356
  * @description Returns an item wich has a given ID.
339
357
  */
340
- getItemByID(value){
358
+ getItemByID(value) {
341
359
  const { item } = srchListElementByAttr(this.#_items, 'id', value);
342
360
  return item;
343
361
  }
344
362
 
345
363
  /**
346
- * @param {HTMLElement}
347
- * @param {bool} [opt=false]
348
- * @returns {index}
364
+ * @param {HTMLElement} item
365
+ * @param {boolean} [opt=false]
366
+ * @returns {number}
349
367
  * @description Adds an item to an instance.
350
368
  */
351
- addItem(item, opt){
369
+ addItem(item, opt) {
352
370
  const forceCI = typeof opt === 'boolean' ? opt : false;
353
371
  const index = (
354
372
  isHTMLElement(item)
@@ -358,7 +376,7 @@ class THtmlItemsListContainer {
358
376
  const isSUCCEED = index !== -1;
359
377
  if (isSUCCEED) {
360
378
  const { autoHideNewItems, itemBaseClassID } = this.#_options;
361
- if (autoHideNewItems) hideHtmlElement(item);
379
+ if (autoHideNewItems) hideHTMLElement(item);
362
380
  if (itemBaseClassID.length > 0) item.classList.add(...itemBaseClassID);
363
381
  if (forceCI) this.setCurIndex(index);
364
382
  const _host = this.#_host;
@@ -368,13 +386,13 @@ class THtmlItemsListContainer {
368
386
  }
369
387
 
370
388
  /**
371
- * @param {index}
389
+ * @param {(number|string)} index - element index
372
390
  * @param {any} [opt]
373
- * @param {bool} [optEx=true]
374
- * @returns {bool}
391
+ * @param {boolean} [optEx=true]
392
+ * @returns {boolean}
375
393
  * @description Deletes an item from an instance.
376
394
  */
377
- delItem(index, opt, optEx){
395
+ delItem(index, opt, optEx) {
378
396
  const _items = this.#_items;
379
397
  const item = _items.delItemEx(index, opt);
380
398
  const isSUCCEED = item !== undefined;
@@ -394,48 +412,48 @@ class THtmlItemsListContainer {
394
412
  }
395
413
 
396
414
  /**
397
- * @param {index}
398
- * @param {bool} [opt=false]
399
- * @returns {bool}
415
+ * @param {(number|string)} index - element index
416
+ * @param {boolean} [opt=false]
417
+ * @returns {boolean}
400
418
  * @description Selects an item addressed by a given index.
401
419
  */
402
- selectItem(index, opt){
420
+ selectItem(index, opt) {
403
421
  const forceCI = typeof opt === 'boolean' ? opt : false;
404
- const isSUCCEED = selectHtmlElement(this.#_items.getItem(index));
422
+ const isSUCCEED = selectHTMLElement(this.#_items.getItem(index));
405
423
  if (isSUCCEED && forceCI) this.setCurIndex(index);
406
424
  return isSUCCEED;
407
425
  }
408
426
 
409
427
  /**
410
- * @param {index}
411
- * @returns {bool}
428
+ * @param {(number|string)} index - element index
429
+ * @returns {boolean}
412
430
  * @description Unselects an item addressed by a given index.
413
431
  */
414
- unselectItem(index){
415
- return unselectHtmlElement(this.#_items.getItem(index));
432
+ unselectItem(index) {
433
+ return unselectHTMLElement(this.#_items.getItem(index));
416
434
  }
417
435
 
418
436
  /**
419
- * @param {index}
420
- * @returns {bool}
437
+ * @param {(number|string)} index - element index
438
+ * @returns {boolean}
421
439
  * @description Hides an item addressed by a given index.
422
440
  */
423
- hideItem(index){
424
- return hideHtmlElement(this.#_items.getItem(index));
441
+ hideItem(index) {
442
+ return hideHTMLElement(this.#_items.getItem(index));
425
443
  }
426
444
 
427
445
  /**
428
- * @param {index}
429
- * @returns {bool}
446
+ * @param {(number|string)} index - element index
447
+ * @returns {boolean}
430
448
  * @description Shows an item addressed by a given index.
431
449
  */
432
- showItem(index){
433
- return showHtmlElement(this.#_items.getItem(index));
450
+ showItem(index) {
451
+ return showHTMLElement(this.#_items.getItem(index));
434
452
  }
435
453
 
436
454
  /**
437
- * @param {index}
438
- * @returns {bool}
455
+ * @param {(number|string)} index - element index
456
+ * @returns {boolean}
439
457
  * @description Checks whether an item is selected.
440
458
  */
441
459
  isSelectedItem(index) {
@@ -443,8 +461,8 @@ class THtmlItemsListContainer {
443
461
  }
444
462
 
445
463
  /**
446
- * @param {index}
447
- * @returns {bool}
464
+ * @param {(number|string)} index - element index
465
+ * @returns {boolean}
448
466
  * @description Checks whether an item is hidden.
449
467
  */
450
468
  isHiddenItem(index) {
@@ -455,27 +473,46 @@ class THtmlItemsListContainer {
455
473
 
456
474
  /**
457
475
  * @augments THtmlItemsListContainer
458
- * @description This class enhanced a capabilities implemented
459
- * in the `THtmlItemsListContainer` class
476
+ * @classdesc This class enhanced a capabilities implemented
477
+ * in the `THtmlItemsListContainer` class
460
478
  */
461
479
  class THtmlItemsListController extends THtmlItemsListContainer {
462
- #_host = null;
463
- #_stubs = null;
464
- #_selects = null;
465
- #_options = null;
466
- #_status = null;
467
- #_events = null;
480
+ /** @property {?HTMLElement} */
481
+ #_host;
482
+ /** @property {THtmlStubItemsSet} */
483
+ #_stubs;
484
+ /** @property {Set} */
485
+ #_selects;
486
+ /** @property {object} */
487
+ #_options;// = null;
488
+ /**
489
+ * @typedef {Object} statILCtrl
490
+ * @property {boolean} isSelectionLocked
491
+ * @property {boolean} isStubItemShown
492
+ * @property {boolean} isHostEnabled
493
+ * @property {boolean} catchEventOnHost
494
+ * @property {boolean} execDelItem
495
+ * @property {number} execDelItemDI
496
+ * @property {number} execDelItemCI
497
+ * @inner
498
+ * @description A controler status
499
+ */
500
+ /** @property {statILCtrl} */
501
+ #_status;
502
+ /** @property {Map} */
503
+ #_events;
468
504
 
469
505
  /**
470
- * @param {HTMLElement}
506
+ * @param {?HTMLElement} host
471
507
  * @param {object} [opt]
472
- * @param {bool} [opt.autoHideNewItems=false]
473
- * @param {bool} [opt.markCurrentItem=false]
474
- * @param {(string|array)} [opt.itemBaseClassID]
475
- * @param {bool} [opt.showStubsIfEmpty=false]
476
- * @param {bool} [opt.allowGroupSelection=false]
477
- * @param {bool} [opt.allowSelectionLocks=false]
508
+ * @param {boolean} [opt.autoHideNewItems=false]
509
+ * @param {boolean} [opt.markCurrentItem=false]
510
+ * @param {(string|string[])} [opt.itemBaseClassID]
511
+ * @param {boolean} [opt.showStubsIfEmpty=false]
512
+ * @param {boolean} [opt.allowGroupSelection=false]
513
+ * @param {boolean} [opt.allowSelectionLocks=false]
478
514
  * @param {object} [opt.stubs]
515
+ * @description Creates a new instance of the class.
479
516
  */
480
517
  constructor(host, opt) {
481
518
  // check host element
@@ -507,6 +544,7 @@ class THtmlItemsListController extends THtmlItemsListContainer {
507
544
  // save options
508
545
  this.#_options = _options;
509
546
  // init status flags set
547
+ /** @type {statILCtrl} */
510
548
  const _status = {
511
549
  isSelectionLocked: false,
512
550
  isStubItemShown: false,
@@ -535,8 +573,8 @@ class THtmlItemsListController extends THtmlItemsListContainer {
535
573
  }
536
574
 
537
575
  /**
538
- * @param {object}
539
- * @returns {none}
576
+ * @param {object} e
577
+ * @returns {void}
540
578
  * @private
541
579
  */
542
580
  #_on_will_select_item = (e) => {
@@ -589,9 +627,9 @@ class THtmlItemsListController extends THtmlItemsListContainer {
589
627
  };
590
628
 
591
629
  /**
592
- * @param {ID_STRING}
593
- * @param {...any}
594
- * @returns {none}
630
+ * @param {string} name
631
+ * @param {...any} args
632
+ * @returns {void}
595
633
  * @private
596
634
  * @see triggerEventHandler
597
635
  */
@@ -600,10 +638,11 @@ class THtmlItemsListController extends THtmlItemsListContainer {
600
638
  };
601
639
 
602
640
  /**
603
- * @property {array}
641
+ * @property {HTMLElement[]}
604
642
  * @readonly
643
+ * @description Returns a list of the selected elements
605
644
  */
606
- get SelectedItems(){
645
+ get SelectedItems() {
607
646
  const _selects = this.#_selects;
608
647
  // // TODO: consider to use: `[...<value>]`
609
648
  let result = [];
@@ -616,26 +655,27 @@ class THtmlItemsListController extends THtmlItemsListContainer {
616
655
  /**
617
656
  * @property {THtmlStubItemsSet}
618
657
  * @readonly
658
+ * @description Returns a `THtmlStubItemsSet` instance
619
659
  */
620
- get StubItems(){
660
+ get StubItems() {
621
661
  return this.#_stubs;
622
662
  }
623
663
 
624
664
  /**
625
- * @property {bool}
665
+ * @property {boolean}
626
666
  * @readonly
667
+ * @description Indicates whether a selection is locked
627
668
  */
628
- get isSelectionLocked(){
669
+ get isSelectionLocked() {
629
670
  return this.#_status.isSelectionLocked;
630
671
  }
631
672
 
632
673
  /**
633
- * @param {none}
634
- * @returns {none}
674
+ * @returns {void}
635
675
  * @fires THtmlItemsListController#list-clear
636
676
  * @description Clears an instance content.
637
677
  */
638
- clear(){
678
+ clear() {
639
679
  // // TODO: clear event handler on elements if set
640
680
  super.clear();
641
681
  this.#_selects.clear();
@@ -645,45 +685,43 @@ class THtmlItemsListController extends THtmlItemsListContainer {
645
685
  };
646
686
  /**
647
687
  * @event THtmlItemsListController#list-clear
648
- * @type {none}
688
+ * @type {void}
649
689
  */
650
690
  this.#_triggerEvent('list-clear');
651
691
  }
652
692
 
653
693
  /**
654
- * @param {none}
655
- * @returns {none}
694
+ * @returns {void}
656
695
  * @description Locks an element selection.
657
696
  */
658
- lockItemsSelection(){
697
+ lockItemsSelection() {
659
698
  if (this.#_options.allowSelectionLocks) {
660
699
  this.#_status.isSelectionLocked = true;
661
700
  };
662
701
  }
663
702
 
664
703
  /**
665
- * @param {none}
666
- * @returns {none}
704
+ * @returns {void}
667
705
  * @description Unlocks an element selection.
668
706
  */
669
- unlockItemsSelection(){
707
+ unlockItemsSelection() {
670
708
  this.#_status.isSelectionLocked = false;
671
709
  }
672
710
 
673
711
  /**
674
- * @param {index}
675
- * @returns {bool}
712
+ * @param {(number|string)} index - element index
713
+ * @returns {boolean}
676
714
  * @fires THtmlItemsListController#current-item-chosen
677
715
  * @private
678
716
  * @description Sets a current index.
679
717
  */
680
- #_setCurIndex(index){
718
+ #_setCurIndex(index) {
681
719
  const isSUCCEED = super.setCurIndex(index);
682
720
  /**
683
721
  * @event THtmlItemsListController#current-item-chosen
684
- * @type {object}
685
- * @property {index} index
686
- * @property {null} item
722
+ * @type {Object}
723
+ * @property {number} index - element index
724
+ * @property {?HTMLElement} item - element
687
725
  */
688
726
  if (isSUCCEED) this.#_triggerEvent('current-item-chosen', {
689
727
  index: Number(index),
@@ -693,20 +731,19 @@ class THtmlItemsListController extends THtmlItemsListContainer {
693
731
  };
694
732
 
695
733
  /**
696
- * @param {index}
697
- * @returns {bool}
734
+ * @param {(number|string)} index - element index
735
+ * @returns {boolean}
698
736
  * @description Sets a current index.
699
737
  */
700
- setCurIndex(index){
738
+ setCurIndex(index) {
701
739
  return this.selectItem(index, true);
702
740
  }
703
741
 
704
742
  /**
705
- * @param {none}
706
- * @returns {none}
743
+ * @returns {void}
707
744
  * @description Resets a current index.
708
745
  */
709
- rstCurIndex(){
746
+ rstCurIndex() {
710
747
  const {
711
748
  execDelItem,
712
749
  execDelItemDI,
@@ -723,13 +760,14 @@ class THtmlItemsListController extends THtmlItemsListContainer {
723
760
  }
724
761
 
725
762
  /**
726
- * @param {HTMLElement}
727
- * @returns {index}
763
+ * @param {HTMLElement} item
764
+ * @param {boolean} [opt=false]
765
+ * @returns {number}
728
766
  * @fires THtmlItemsListController#first-item-added
729
767
  * @fires THtmlItemsListController#item-added
730
768
  * @description Adds an element to an instance members.
731
769
  */
732
- addItem(item, opt){
770
+ addItem(item, opt) {
733
771
  const index = super.addItem(item, false);
734
772
  if (index !== -1) {
735
773
  const { autoHideNewItems, showStubsIfEmpty } = this.#_options;
@@ -753,9 +791,9 @@ class THtmlItemsListController extends THtmlItemsListContainer {
753
791
  };
754
792
  /**
755
793
  * @event THtmlItemsListController#first-item-added
756
- * @type {object}
757
- * @property {index} index
758
- * @property {?HTMLElement} item
794
+ * @type {Object}
795
+ * @property {number} index - element index
796
+ * @property {?HTMLElement} item - element
759
797
  */
760
798
  this.#_triggerEvent('first-item-added', {
761
799
  index: index,
@@ -764,9 +802,9 @@ class THtmlItemsListController extends THtmlItemsListContainer {
764
802
  };
765
803
  /**
766
804
  * @event THtmlItemsListController#item-added
767
- * @type {object}
768
- * @property {index} index
769
- * @property {?HTMLElement} item
805
+ * @type {Object}
806
+ * @property {number} index - element index
807
+ * @property {?HTMLElement} item - element
770
808
  */
771
809
  this.#_triggerEvent('item-added', {
772
810
  index: index,
@@ -785,14 +823,14 @@ class THtmlItemsListController extends THtmlItemsListContainer {
785
823
  }
786
824
 
787
825
  /**
788
- * @param {index}
826
+ * @param {(number|string)} index - element index
789
827
  * @param {any} [opt]
790
- * @returns {bool}
828
+ * @returns {boolean}
791
829
  * @fires THtmlItemsListController#list-clear
792
830
  * @fires THtmlItemsListController#item-removed
793
831
  * @description Deletes an element from an instance members.
794
832
  */
795
- delItem(index, opt){
833
+ delItem(index, opt) {
796
834
  const item = super.getItem(index);
797
835
  let isSUCCEED = item !== undefined;
798
836
  const _status = this.#_status;
@@ -821,9 +859,9 @@ class THtmlItemsListController extends THtmlItemsListContainer {
821
859
  this.#_selects.delete(item);
822
860
  /**
823
861
  * @event THtmlItemsListController#item-removed
824
- * @type {object}
825
- * @property {index} index
826
- * @property {?HTMLElement} item
862
+ * @type {Object}
863
+ * @property {number} index - element index
864
+ * @property {?HTMLElement} item - element
827
865
  */
828
866
  this.#_triggerEvent('item-removed', {
829
867
  index: Number(index),
@@ -845,22 +883,22 @@ class THtmlItemsListController extends THtmlItemsListContainer {
845
883
  }
846
884
 
847
885
  /**
848
- * @param {index}
849
- * @returns {bool}
886
+ * @param {(number|string)} index - element index
887
+ * @returns {boolean}
850
888
  * @private
851
889
  * @fires THtmlItemsListController#item-selected
852
890
  * @description Selects an element.
853
891
  */
854
- #_selectItem(index){
892
+ #_selectItem(index) {
855
893
  const item = super.getItem(index);
856
- const isSUCCEED = selectHtmlElement(item);
894
+ const isSUCCEED = selectHTMLElement(item);
857
895
  if (isSUCCEED) {
858
896
  this.#_selects.add(item);
859
897
  /**
860
898
  * @event THtmlItemsListController#item-selected
861
- * @type {object}
862
- * @property {index} index
863
- * @property {?HTMLElement} item
899
+ * @type {Object}
900
+ * @property {number} index - element index
901
+ * @property {?HTMLElement} item - element
864
902
  */
865
903
  this.#_triggerEvent('item-selected', {
866
904
  index: Number(index),
@@ -871,12 +909,12 @@ class THtmlItemsListController extends THtmlItemsListContainer {
871
909
  }
872
910
 
873
911
  /**
874
- * @param {index}
912
+ * @param {?HTMLElement} item - element
875
913
  * @param {object} [opt]
876
- * @param {bool} [opt.ctrlKey=false]
877
- * @param {bool} [opt.shiftKey=false]
878
- * @param {bool} [opt.forceCI=false]
879
- * @returns {none}
914
+ * @param {boolean} [opt.ctrlKey=false]
915
+ * @param {boolean} [opt.shiftKey=false]
916
+ * @param {boolean} [opt.forceCI=false]
917
+ * @returns {void}
880
918
  * @private
881
919
  * @description Selects an element.
882
920
  */
@@ -933,12 +971,12 @@ class THtmlItemsListController extends THtmlItemsListContainer {
933
971
  }
934
972
 
935
973
  /**
936
- * @param {index}
937
- * @param {bool} [opt=false]
938
- * @returns {bool}
974
+ * @param {(number|string)} index - element index
975
+ * @param {boolean} [opt=false]
976
+ * @returns {boolean}
939
977
  * @description Selects an element.
940
978
  */
941
- selectItem(index, opt){
979
+ selectItem(index, opt) {
942
980
  const item = super.getItem(index);
943
981
  let isSUCCEED = isHTMLElement(item);
944
982
  if (isSUCCEED) {
@@ -953,21 +991,21 @@ class THtmlItemsListController extends THtmlItemsListContainer {
953
991
  }
954
992
 
955
993
  /**
956
- * @param {index}
957
- * @returns {bool}
994
+ * @param {(number|string)} index - element index
995
+ * @returns {boolean}
958
996
  * @fires THtmlItemsListController#item-unselected
959
997
  * @description Unselects an element.
960
998
  */
961
- unselectItem(index){
999
+ unselectItem(index) {
962
1000
  const item = super.getItem(index);
963
- let isSUCCEED = unselectHtmlElement(item);
1001
+ let isSUCCEED = unselectHTMLElement(item);
964
1002
  if (isSUCCEED) {
965
1003
  this.#_selects.delete(item);
966
1004
  /**
967
1005
  * @event THtmlItemsListController#item-unselected
968
- * @type {object}
969
- * @property {index} index
970
- * @property {?HTMLElement} item
1006
+ * @type {Object}
1007
+ * @property {number} index - element index
1008
+ * @property {?HTMLElement} item - element
971
1009
  */
972
1010
  this.#_triggerEvent('item-unselected', {
973
1011
  index: Number(index),
@@ -978,20 +1016,20 @@ class THtmlItemsListController extends THtmlItemsListContainer {
978
1016
  }
979
1017
 
980
1018
  /**
981
- * @param {index}
982
- * @returns {bool}
1019
+ * @param {(number|string)} index - element index
1020
+ * @returns {boolean}
983
1021
  * @fires THtmlItemsListController#item-hidden
984
1022
  * @description Hides an element.
985
1023
  */
986
- hideItem(index){
1024
+ hideItem(index) {
987
1025
  const item = super.getItem(index);
988
- let isSUCCEED = hideHtmlElement(item);
1026
+ let isSUCCEED = hideHTMLElement(item);
989
1027
  if (isSUCCEED) {
990
1028
  /**
991
1029
  * @event THtmlItemsListController#item-hidden
992
- * @type {object}
993
- * @property {index} index
994
- * @property {?HTMLElement} item
1030
+ * @type {Object}
1031
+ * @property {number} index - element index
1032
+ * @property {?HTMLElement} item - element
995
1033
  */
996
1034
  this.#_triggerEvent('item-hidden', {
997
1035
  index: Number(index),
@@ -1002,20 +1040,20 @@ class THtmlItemsListController extends THtmlItemsListContainer {
1002
1040
  }
1003
1041
 
1004
1042
  /**
1005
- * @param {index}
1006
- * @returns {bool}
1043
+ * @param {(number|string)} index - element index
1044
+ * @returns {boolean}
1007
1045
  * @fires THtmlItemsListController#item-shown
1008
1046
  * @description Shows an element.
1009
1047
  */
1010
- showItem(index){
1048
+ showItem(index) {
1011
1049
  const item = super.getItem(index);
1012
- let isSUCCEED = showHtmlElement(item);
1050
+ let isSUCCEED = showHTMLElement(item);
1013
1051
  if (isSUCCEED) {
1014
1052
  /**
1015
1053
  * @event THtmlItemsListController#item-shown
1016
- * @type {object}
1017
- * @property {index} index
1018
- * @property {?HTMLElement} item
1054
+ * @type {Object}
1055
+ * @property {number} index - element index
1056
+ * @property {?HTMLElement} item - element
1019
1057
  */
1020
1058
  this.#_triggerEvent('item-shown', {
1021
1059
  index: Number(index),
@@ -1026,12 +1064,12 @@ class THtmlItemsListController extends THtmlItemsListContainer {
1026
1064
  }
1027
1065
 
1028
1066
  /**
1029
- * @param {ID_STRING}
1030
- * @param {func}
1031
- * @returns {none}
1067
+ * @param {string} name - event name
1068
+ * @param {func} evnt
1069
+ * @returns {void}
1032
1070
  * @description Sets a callback function to handle event.
1033
1071
  */
1034
- on(name, evnt){
1072
+ on(name, evnt) {
1035
1073
  pushEventHandler(this.#_events, name, evnt);
1036
1074
  }
1037
1075