@cntwg/html-ctrls-lists 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/index.d.ts +32 -19
- package/index.js +27 -6
- package/lib/{list.d.ts → list-cont.d.ts} +207 -278
- package/lib/list-cont.js +538 -0
- package/lib/list-ctrl.d.ts +85 -0
- package/lib/{list.js → list-ctrl.js} +32 -530
- package/lib/lists-btn.d.ts +63 -63
- package/lib/lists-stubs.d.ts +134 -134
- package/lib/lists-stubs.js +2 -3
- package/lib/mod-hfunc.d.ts +18 -18
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
THtmlStubItemsSet,
|
|
3
|
+
type IStubItemsSetOptions,
|
|
4
|
+
} from "./lib/lists-stubs";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
BTS_DEF_GROUP_NAME,
|
|
8
|
+
THtmlListButtonsController,
|
|
9
|
+
} from "./lib/lists-btn";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
THtmlItemsListContainer,
|
|
13
|
+
type ITHtmlItemsListContainerOptions,
|
|
14
|
+
} from "./lib/list-cont";
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
THtmlItemsListController,
|
|
18
|
+
type IHtmlItemsListControllerOptions,
|
|
19
|
+
} from "./lib/list-ctrl";
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
THtmlStubItemsSet,
|
|
23
|
+
THtmlItemsListContainer, THtmlItemsListController,
|
|
24
|
+
BTS_DEF_GROUP_NAME,
|
|
25
|
+
THtmlListButtonsController,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type {
|
|
29
|
+
ITHtmlItemsListContainerOptions,
|
|
30
|
+
IHtmlItemsListControllerOptions,
|
|
31
|
+
IStubItemsSetOptions,
|
|
32
|
+
};
|
package/index.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.034-20260510]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const {
|
|
6
|
+
THtmlItemsListContainer,
|
|
7
|
+
// * import types definitions *
|
|
8
|
+
ITHtmlItemsListContainerOptions,
|
|
9
|
+
} = require('./lib/list-cont');
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
THtmlItemsListController,
|
|
13
|
+
// * import types definitions *
|
|
14
|
+
IHtmlItemsListControllerOptions,
|
|
15
|
+
} = require('./lib/list-ctrl');
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
THtmlStubItemsSet,
|
|
19
|
+
// * import types definitions *
|
|
20
|
+
IStubItemsSetOptions,
|
|
21
|
+
} = require('./lib/lists-stubs');
|
|
22
|
+
|
|
6
23
|
const btn = require('./lib/lists-btn');
|
|
7
|
-
const stubs = require('./lib/lists-stubs');
|
|
8
24
|
|
|
9
25
|
// === module inner block ===
|
|
10
26
|
|
|
@@ -12,11 +28,16 @@ const stubs = require('./lib/lists-stubs');
|
|
|
12
28
|
|
|
13
29
|
// === module exports block ===
|
|
14
30
|
|
|
15
|
-
module.exports.THtmlStubItemsSet =
|
|
31
|
+
module.exports.THtmlStubItemsSet = THtmlStubItemsSet;
|
|
16
32
|
|
|
17
|
-
module.exports.THtmlItemsListContainer =
|
|
18
|
-
module.exports.THtmlItemsListController =
|
|
33
|
+
module.exports.THtmlItemsListContainer = THtmlItemsListContainer;
|
|
34
|
+
module.exports.THtmlItemsListController = THtmlItemsListController;
|
|
19
35
|
|
|
20
36
|
module.exports.BTS_DEF_GROUP_NAME = btn.BTS_DEF_GROUP_NAME;
|
|
21
37
|
|
|
22
38
|
module.exports.THtmlListButtonsController = btn.THtmlListButtonsController;
|
|
39
|
+
|
|
40
|
+
// * export types definitions *
|
|
41
|
+
module.exports.ITHtmlItemsListContainerOptions = ITHtmlItemsListContainerOptions;
|
|
42
|
+
module.exports.IHtmlItemsListControllerOptions = IHtmlItemsListControllerOptions;
|
|
43
|
+
module.exports.IStubItemsSetOptions = IStubItemsSetOptions;
|
|
@@ -1,278 +1,207 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
* @
|
|
128
|
-
* @todo
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Returns an
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
*
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
*
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
*
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
hideItem(index: number | string): boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Shows an item addressed by a given index.
|
|
211
|
-
*/
|
|
212
|
-
showItem(index: number | string): boolean;
|
|
213
|
-
/**
|
|
214
|
-
* Checks whether an item is selected.
|
|
215
|
-
*/
|
|
216
|
-
isSelectedItem(index: number | string): boolean;
|
|
217
|
-
/**
|
|
218
|
-
* Checks whether an item is hidden.
|
|
219
|
-
*/
|
|
220
|
-
isHiddenItem(index: number | string): boolean;
|
|
221
|
-
[Symbol.iterator](): {
|
|
222
|
-
next: () => {
|
|
223
|
-
done: boolean;
|
|
224
|
-
value: HTMLElement | null;
|
|
225
|
-
} | {
|
|
226
|
-
done: boolean;
|
|
227
|
-
value: undefined;
|
|
228
|
-
};
|
|
229
|
-
return(): {
|
|
230
|
-
done: boolean;
|
|
231
|
-
value: undefined;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
#private;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* This class enhanced a capabilities implemented
|
|
239
|
-
* in the `THtmlItemsListContainer` class
|
|
240
|
-
*/
|
|
241
|
-
export class THtmlItemsListController extends THtmlItemsListContainer {
|
|
242
|
-
/**
|
|
243
|
-
* Creates a new instance of the class.
|
|
244
|
-
*/
|
|
245
|
-
constructor(host: HTMLElement | null, opt?: OPT_hlctlsett);
|
|
246
|
-
/**
|
|
247
|
-
* Returns a list of the selected elements
|
|
248
|
-
*/
|
|
249
|
-
get SelectedItems(): HTMLElement[];
|
|
250
|
-
/**
|
|
251
|
-
* Returns a `THtmlStubItemsSet` instance
|
|
252
|
-
*/
|
|
253
|
-
get StubItems(): THtmlStubItemsSet;
|
|
254
|
-
/**
|
|
255
|
-
* Indicates whether a selection is locked
|
|
256
|
-
*/
|
|
257
|
-
get isSelectionLocked(): boolean;
|
|
258
|
-
/**
|
|
259
|
-
* Locks an element selection.
|
|
260
|
-
*/
|
|
261
|
-
lockItemsSelection(): void;
|
|
262
|
-
/**
|
|
263
|
-
* Unlocks an element selection.
|
|
264
|
-
*/
|
|
265
|
-
unlockItemsSelection(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Deletes an element from an instance members.
|
|
268
|
-
* @fires THtmlItemsListController#list-clear
|
|
269
|
-
* @fires THtmlItemsListController#item-removed
|
|
270
|
-
*/
|
|
271
|
-
delItem(index: number | string, opt?: any): boolean;
|
|
272
|
-
/**
|
|
273
|
-
* Sets a callback function to handle event.
|
|
274
|
-
*/
|
|
275
|
-
on(name: string, evnt: Function): void;
|
|
276
|
-
#private;
|
|
277
|
-
}
|
|
278
|
-
import { THtmlStubItemsSet } from "./lists-stubs";
|
|
1
|
+
/**
|
|
2
|
+
* An options set for `THtmlItemsListContainer`-class
|
|
3
|
+
*/
|
|
4
|
+
export type ITHtmlItemsListContainerOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* - indicates whether to hide a new element
|
|
7
|
+
*/
|
|
8
|
+
autoHideNewItems?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* - indicates whether to mark a current element
|
|
11
|
+
*/
|
|
12
|
+
markCurrentItem?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* - contains a base class
|
|
15
|
+
* attributes applayed to each a newly added list member
|
|
16
|
+
*/
|
|
17
|
+
itemBaseClassID?: string | string[];
|
|
18
|
+
/**
|
|
19
|
+
* - indicates a target scope chosen to select an ID-attribute of the element
|
|
20
|
+
* @since 0.0.33
|
|
21
|
+
*/
|
|
22
|
+
targetScopeForEID?: string | number;
|
|
23
|
+
};
|
|
24
|
+
export const ITHtmlItemsListContainerOptions: ITHtmlItemsListContainerOptions;
|
|
25
|
+
|
|
26
|
+
export type ISearchListElementResultOnFail = {
|
|
27
|
+
/**
|
|
28
|
+
* - element index
|
|
29
|
+
*/
|
|
30
|
+
index: number;
|
|
31
|
+
/**
|
|
32
|
+
* - found element
|
|
33
|
+
*/
|
|
34
|
+
item: null;
|
|
35
|
+
};
|
|
36
|
+
export type ISearchListElementResultOnSuccess = {
|
|
37
|
+
/**
|
|
38
|
+
* - element index
|
|
39
|
+
*/
|
|
40
|
+
index: number;
|
|
41
|
+
/**
|
|
42
|
+
* - found element
|
|
43
|
+
*/
|
|
44
|
+
item: any;
|
|
45
|
+
};
|
|
46
|
+
export type ISearchListElementResult = ISearchListElementResultOnFail | ISearchListElementResultOnSuccess;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* This class implements an interfaco for a list container
|
|
50
|
+
*/
|
|
51
|
+
export class THtmlItemsListContainer {
|
|
52
|
+
/**
|
|
53
|
+
* Creates an instance of a list container
|
|
54
|
+
*/
|
|
55
|
+
constructor(host: HTMLElement | null, opt?: ITHtmlItemsListContainerOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Contains a Qty of an elements
|
|
58
|
+
*/
|
|
59
|
+
get count(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Contains an index of the current element
|
|
62
|
+
*/
|
|
63
|
+
get curIndex(): number;
|
|
64
|
+
/**
|
|
65
|
+
* Returns a minimum value of an index
|
|
66
|
+
*/
|
|
67
|
+
get minIndex(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Returns a maximum value of an index
|
|
70
|
+
*/
|
|
71
|
+
get maxIndex(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Returns a value of a previous index
|
|
74
|
+
*/
|
|
75
|
+
get prevIndex(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Returns a value of a next index
|
|
78
|
+
*/
|
|
79
|
+
get nextIndex(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Returns an element in the current index
|
|
82
|
+
*/
|
|
83
|
+
get curItem(): HTMLElement | null;
|
|
84
|
+
/**
|
|
85
|
+
* Clears an instance content.
|
|
86
|
+
*/
|
|
87
|
+
clear(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if an instance contains no items.
|
|
90
|
+
*/
|
|
91
|
+
isEmpty(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if an instance contains any items.
|
|
94
|
+
*/
|
|
95
|
+
isNotEmpty(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if a given value is a valid index and
|
|
98
|
+
* it fits an index range within an instance.
|
|
99
|
+
* @deprecated
|
|
100
|
+
* @todo \[since v0.0.31] deprecated. Use
|
|
101
|
+
* {@link THtmlItemsListContainer.checkIndex} instead
|
|
102
|
+
*/
|
|
103
|
+
chkIndex(value: number | string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Checks if a given value is a valid index and
|
|
106
|
+
* it fits an index range within an instance.
|
|
107
|
+
* @since 0.0.31
|
|
108
|
+
*/
|
|
109
|
+
checkIndex(value: number | string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a given value is a valid index and
|
|
112
|
+
* it fits an index range within an instance.
|
|
113
|
+
* @deprecated
|
|
114
|
+
* @todo \[since v0.0.31] deprecated. Use
|
|
115
|
+
* {@link THtmlItemsListContainer.checkIndex} or
|
|
116
|
+
* {@link THtmlItemsListContainer.tryIndex} instead
|
|
117
|
+
*/
|
|
118
|
+
chkIndexEx(value: number | string, opt?: boolean): boolean | number;
|
|
119
|
+
/**
|
|
120
|
+
* Returns an index in case a given value is a valid index value and not exceeds
|
|
121
|
+
* an index range within the list. If failed a `-1` returned
|
|
122
|
+
* @since 0.0.31
|
|
123
|
+
*/
|
|
124
|
+
tryIndex(value: any): number;
|
|
125
|
+
/**
|
|
126
|
+
* Returns an index of a given element.
|
|
127
|
+
* @param {HTMLElement} item - element to search
|
|
128
|
+
* @todo add 2nd param
|
|
129
|
+
* @see TItemsListEx.srchIndex
|
|
130
|
+
*/
|
|
131
|
+
srchIndex(item: HTMLElement): number;
|
|
132
|
+
/**
|
|
133
|
+
* Returns an index of an element wich has an attribute
|
|
134
|
+
* with a given name and value.
|
|
135
|
+
*/
|
|
136
|
+
srchIndexByAttr(name: string, value?: any): number;
|
|
137
|
+
/**
|
|
138
|
+
* Returns an index of an element wich has a given ID.
|
|
139
|
+
*/
|
|
140
|
+
srchIndexByID(value: string): number;
|
|
141
|
+
/**
|
|
142
|
+
* Sets a current index.
|
|
143
|
+
*/
|
|
144
|
+
setCurIndex(index: number | string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Resets a current index.
|
|
147
|
+
*/
|
|
148
|
+
rstCurIndex(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Returns an item addressed by a given index.
|
|
151
|
+
*/
|
|
152
|
+
getItem(index: number | string): HTMLElement | null;
|
|
153
|
+
/**
|
|
154
|
+
* Returns an item wich has an attribute with a given name and value.
|
|
155
|
+
*/
|
|
156
|
+
getItemByAttr(name: string, value?: any): HTMLElement | null;
|
|
157
|
+
/**
|
|
158
|
+
* Returns an item wich has a given ID.
|
|
159
|
+
*/
|
|
160
|
+
getItemByID(value: string): HTMLElement | null;
|
|
161
|
+
/**
|
|
162
|
+
* Adds an item to an instance.
|
|
163
|
+
*/
|
|
164
|
+
addItem(item: HTMLElement, opt?: boolean): number;
|
|
165
|
+
/**
|
|
166
|
+
* Deletes an item from an instance.
|
|
167
|
+
*/
|
|
168
|
+
delItem(index: number | string, opt?: any, optEx?: boolean): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Selects an item addressed by a given index.
|
|
171
|
+
*/
|
|
172
|
+
selectItem(index: number | string, opt?: boolean): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Unselects an item addressed by a given index.
|
|
175
|
+
*/
|
|
176
|
+
unselectItem(index: number | string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Hides an item addressed by a given index.
|
|
179
|
+
*/
|
|
180
|
+
hideItem(index: number | string): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Shows an item addressed by a given index.
|
|
183
|
+
*/
|
|
184
|
+
showItem(index: number | string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Checks whether an item is selected.
|
|
187
|
+
*/
|
|
188
|
+
isSelectedItem(index: number | string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Checks whether an item is hidden.
|
|
191
|
+
*/
|
|
192
|
+
isHiddenItem(index: number | string): boolean;
|
|
193
|
+
[Symbol.iterator](): {
|
|
194
|
+
next: () => {
|
|
195
|
+
done: boolean;
|
|
196
|
+
value: HTMLElement | null;
|
|
197
|
+
} | {
|
|
198
|
+
done: boolean;
|
|
199
|
+
value: undefined;
|
|
200
|
+
};
|
|
201
|
+
return(): {
|
|
202
|
+
done: boolean;
|
|
203
|
+
value: undefined;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
#private;
|
|
207
|
+
}
|