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