@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.
- package/CHANGELOG.md +22 -0
- package/README.md +8 -8
- package/doc/html-ctrls-btn.md +145 -104
- package/doc/html-ctrls-fields.md +104 -57
- package/doc/html-ctrls-list.md +570 -136
- package/doc/html-helper-lib.md +182 -48
- package/index.js +40 -15
- package/lib/event-hfunc.js +60 -0
- package/lib/html-ctrls/buttons.js +122 -101
- package/lib/html-ctrls/fields.js +126 -80
- package/lib/html-ctrls/list.js +254 -206
- package/lib/html-ctrls/lists-btn.js +44 -45
- package/lib/html-ctrls/lists-stubs.js +71 -71
- package/lib/html-ctrls/mod-hfunc.js +8 -38
- package/lib/html-helper-lib.js +227 -98
- package/package.json +5 -7
package/doc/html-helper-lib.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.14|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2024-11-10|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -12,139 +12,273 @@ This paper describes a base helpers provided by `html-helper-lib.js` module.
|
|
|
12
12
|
|
|
13
13
|
This set of constants provides some definitions of a base CSS-class strings which can be used as a class values of the HTML-element. Those are:
|
|
14
14
|
|
|
15
|
-
|name|value|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
| name | value | description |
|
|
16
|
+
|:---|---:|:---|
|
|
17
|
+
| `CSS_CLASS_CURRENT` | 'current' | Marks element as current |
|
|
18
|
+
| `CSS_CLASS_SELECTED` | 'selected' | Marks element as selected |
|
|
19
|
+
| `CSS_CLASS_ACTIVE` | 'active' | Marks element as active |
|
|
20
|
+
| `CSS_CLASS_DISABLED` | 'disabled' | Marks element as disabled |
|
|
21
|
+
| `CSS_CLASS_HIDDEN` | 'hidden' | Marks element as hidden (*not visible on the screen*) |
|
|
22
22
|
|
|
23
23
|
## Module functions
|
|
24
24
|
|
|
25
25
|
### Logical functions
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
<a name="isHTMLElement"></a>
|
|
28
|
+
#### **isHTMLElement(obj)** => `boolean`
|
|
28
29
|
|
|
29
30
|
This function checks whether or not a given object represents an HTML-element and if so returns `true` or `false` if else.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
| parameter name | value type | default value | description |
|
|
33
|
+
|:---|---|---:|:---|
|
|
34
|
+
| `obj` | `any` | --- | some element to be checked |
|
|
35
|
+
|
|
36
|
+
<a name="isSelectedHTMLElement"></a>
|
|
37
|
+
#### **isSelectedHTMLElement(obj)** => `boolean`
|
|
32
38
|
|
|
33
39
|
This function checks if the given object represents an HTML-element and whether or not its class include an attribute which is equal to `CSS_CLASS_SELECTED`.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
| parameter name | value type | default value | description |
|
|
42
|
+
|:---|---|---:|:---|
|
|
43
|
+
| `obj` | `HTMLElement` | --- | some element to be checked |
|
|
44
|
+
|
|
45
|
+
<a name="isCurrentHTMLElement"></a>
|
|
46
|
+
#### **isCurrentHTMLElement(obj)** => `boolean`
|
|
36
47
|
|
|
37
48
|
This function checks if the given object represents an HTML-element and whether or not its class include an attribute which is equal to `CSS_CLASS_CURRENT`.
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
| parameter name | value type | default value | description |
|
|
51
|
+
|:---|---|---:|:---|
|
|
52
|
+
| `obj` | `HTMLElement` | --- | some element to be checked |
|
|
53
|
+
|
|
54
|
+
<a name="isActiveHTMLElement"></a>
|
|
55
|
+
#### **isActiveHTMLElement(obj)** => `boolean`
|
|
40
56
|
|
|
41
57
|
This function checks if the given object represents an HTML-element and whether or not its class include an attribute which is equal to `CSS_CLASS_ACTIVE`.
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
| parameter name | value type | default value | description |
|
|
60
|
+
|:---|---|---:|:---|
|
|
61
|
+
| `obj` | `HTMLElement` | --- | some element to be checked |
|
|
62
|
+
|
|
63
|
+
<a name="isHiddenHTMLElement"></a>
|
|
64
|
+
#### **isHiddenHTMLElement(object)** => `boolean`
|
|
44
65
|
|
|
45
66
|
This function checks if the given object represents an HTML-element and whether or not its class include an attribute which is equal to `CSS_CLASS_HIDDEN`.
|
|
46
67
|
|
|
68
|
+
| parameter name | value type | default value | description |
|
|
69
|
+
|:---|---|---:|:---|
|
|
70
|
+
| `obj` | `HTMLElement` | --- | some element to be checked |
|
|
71
|
+
|
|
47
72
|
### Functions for element manipulations
|
|
48
73
|
|
|
49
|
-
|
|
74
|
+
<a name="hideHTMLElement"></a>
|
|
75
|
+
#### **hideHTMLElement(obj)** => `boolean`
|
|
50
76
|
|
|
51
|
-
This function hides HTML-element given by `object` parameter and if succeed `true` is returned.
|
|
77
|
+
This function hides an HTML-element given by `object` parameter and if succeed `true` is returned.
|
|
52
78
|
|
|
53
|
-
|
|
79
|
+
| parameter name | value type | default value | description |
|
|
80
|
+
|:---|---|---:|:---|
|
|
81
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
54
82
|
|
|
55
|
-
|
|
83
|
+
> Note: Technically, the function provide a wrapper that applies the class attribute defined by 'CSS_CLASS_HIDDEN' for a given HTML-element.
|
|
56
84
|
|
|
57
|
-
|
|
85
|
+
<a name="showHTMLElement"></a>
|
|
86
|
+
#### **showHTMLElement(obj)** => `boolean`
|
|
58
87
|
|
|
59
|
-
|
|
88
|
+
This function unhides an HTML-element given by `object` parameter and if succeed `true` is returned.
|
|
60
89
|
|
|
61
|
-
|
|
90
|
+
| parameter name | value type | default value | description |
|
|
91
|
+
|:---|---|---:|:---|
|
|
92
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
93
|
+
|
|
94
|
+
> Note: Technically, the function provide a wrapper that removes the class attribute defined by 'CSS_CLASS_HIDDEN' for a given HTML-element.
|
|
95
|
+
|
|
96
|
+
<a name="selectHTMLElement"></a>
|
|
97
|
+
#### **selectHTMLElement(obj)** => `boolean`
|
|
62
98
|
|
|
63
99
|
This function applies the class attribute defined by `CSS_CLASS_SELECTED` for a given HTML-element. If succeed `true` is returned.
|
|
64
100
|
|
|
65
|
-
|
|
101
|
+
| parameter name | value type | default value | description |
|
|
102
|
+
|:---|---|---:|:---|
|
|
103
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
104
|
+
|
|
105
|
+
<a name="unselectHTMLElement"></a>
|
|
106
|
+
#### **unselectHTMLElement(obj)** => `boolean`
|
|
66
107
|
|
|
67
108
|
This function removes the class attribute defined by `CSS_CLASS_SELECTED` for a given HTML-element. If succeed `true` is returned.
|
|
68
109
|
|
|
69
|
-
|
|
110
|
+
| parameter name | value type | default value | description |
|
|
111
|
+
|:---|---|---:|:---|
|
|
112
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
113
|
+
|
|
114
|
+
<a name="markHTMLElementAsCurrent"></a>
|
|
115
|
+
#### **markHTMLElementAsCurrent(obj)** => `boolean`
|
|
70
116
|
|
|
71
117
|
This function applies the class attribute defined by `CSS_CLASS_CURRENT` for a given HTML-element. If succeed `true` is returned.
|
|
72
118
|
|
|
73
|
-
|
|
119
|
+
| parameter name | value type | default value | description |
|
|
120
|
+
|:---|---|---:|:---|
|
|
121
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
122
|
+
|
|
123
|
+
<a name="unmarkCurrentHTMLElement"></a>
|
|
124
|
+
#### **unmarkCurrentHTMLElement(obj)** => `boolean`
|
|
74
125
|
|
|
75
126
|
This function removes the class attribute defined by `CSS_CLASS_CURRENT` for a given HTML-element. If succeed `true` is returned.
|
|
76
127
|
|
|
77
|
-
|
|
128
|
+
| parameter name | value type | default value | description |
|
|
129
|
+
|:---|---|---:|:---|
|
|
130
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
78
131
|
|
|
79
|
-
>
|
|
132
|
+
<a name="markHTMLElementAsActive"></a>
|
|
133
|
+
#### **markHTMLElementAsActive(obj)** => `boolean`
|
|
80
134
|
|
|
81
|
-
This function
|
|
135
|
+
This function applies the class attribute defined by `CSS_CLASS_ACTIVE` for a given HTML-element. If succeed `true` is returned.
|
|
136
|
+
|
|
137
|
+
| parameter name | value type | default value | description |
|
|
138
|
+
|:---|---|---:|:---|
|
|
139
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
140
|
+
|
|
141
|
+
<a name="unmarkActiveHTMLElement"></a>
|
|
142
|
+
#### **unmarkActiveHTMLElement(obj)** => `boolean`
|
|
143
|
+
|
|
144
|
+
This function removes the class attribute defined by `CSS_CLASS_ACTIVE` for a given HTML-element. If succeed `true` is returned.
|
|
145
|
+
|
|
146
|
+
| parameter name | value type | default value | description |
|
|
147
|
+
|:---|---|---:|:---|
|
|
148
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
82
149
|
|
|
83
|
-
|
|
150
|
+
<a name="lockHTMLElement"></a>
|
|
151
|
+
#### **lockHTMLElement(obj)** => `boolean`
|
|
84
152
|
|
|
85
153
|
> since: `v0.0.19`
|
|
86
154
|
|
|
87
155
|
This function disables a given HTML-element.
|
|
88
156
|
|
|
89
|
-
|
|
157
|
+
| parameter name | value type | default value | description |
|
|
158
|
+
|:---|---|---:|:---|
|
|
159
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
160
|
+
|
|
161
|
+
<a name="unlockHTMLElement"></a>
|
|
162
|
+
#### **unlockHTMLElement(obj)** => `boolean`
|
|
163
|
+
|
|
164
|
+
> since: `v0.0.19`
|
|
90
165
|
|
|
91
|
-
This function enables
|
|
166
|
+
This function enables a given HTML-element.
|
|
167
|
+
|
|
168
|
+
| parameter name | value type | default value | description |
|
|
169
|
+
|:---|---|---:|:---|
|
|
170
|
+
| `obj` | `HTMLElement` | --- | some element to be modified |
|
|
92
171
|
|
|
93
|
-
|
|
172
|
+
<a name="activateHTMLElements"></a>
|
|
173
|
+
#### **activateHtmlElements(arg_1\[, arg_2\[, ...arg_N]])** => `void`
|
|
94
174
|
|
|
95
|
-
This function
|
|
175
|
+
This function enables all HTML-elements received as a function arguments.
|
|
176
|
+
|
|
177
|
+
| parameter name | value type | default value | description |
|
|
178
|
+
|:---|---|---:|:---|
|
|
179
|
+
| `arg_[1...N]` | `HTMLElement` | --- | some element to be modified |
|
|
180
|
+
|
|
181
|
+
<a name="inactivateHTMLElements"></a>
|
|
182
|
+
#### **inactivateHTMLElements(arg_1\[, arg_2\[, ...arg_N]])** => `void`
|
|
183
|
+
|
|
184
|
+
This function disables all HTML-elements received as a function arguments.
|
|
185
|
+
|
|
186
|
+
| parameter name | value type | default value | description |
|
|
187
|
+
|:---|---|---:|:---|
|
|
188
|
+
| `arg_[1...N]` | `HTMLElement` | --- | some element to be modified |
|
|
96
189
|
|
|
97
190
|
### Other functions
|
|
98
191
|
|
|
99
|
-
|
|
192
|
+
<a name="valueToClassList"></a>
|
|
193
|
+
#### **valueToClassList(value\[, options])** => `string[]`
|
|
194
|
+
|
|
195
|
+
> since: `v0.0.13`
|
|
100
196
|
|
|
101
197
|
This function reads a given value and converts it to an array of a class attributes.
|
|
102
198
|
|
|
199
|
+
| parameter name | value type | default value | description |
|
|
200
|
+
|:---|---|---:|:---|
|
|
201
|
+
| `value` | `any` | --- | some value |
|
|
202
|
+
| `options` | `boolean` | --- | some value |
|
|
203
|
+
|
|
103
204
|
The `options` parameter if sets to `true` force the function to remove all duplicates from its result. The default value is `false`.
|
|
104
205
|
|
|
105
206
|
### Experimental functions
|
|
106
207
|
|
|
107
208
|
> Note: Purpose of those functions will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
|
|
108
209
|
|
|
210
|
+
<a name="createNewHtmlElement"></a>
|
|
109
211
|
#### **createNewHtmlElement(tagName\[, options])**
|
|
110
212
|
|
|
111
213
|
This function helps to simplify the process of creating a new HTML-element. It receives the tag name (`tagName` parameter) and the options as a second parameter:
|
|
112
214
|
|
|
113
|
-
|parameter name|value type|default value|description|
|
|
215
|
+
| parameter name | value type | default value | description |
|
|
114
216
|
|:---|---|---:|:---|
|
|
115
|
-
|
|
116
|
-
|
|
217
|
+
| `tagName` | `string` | --- | defines a tag name of the element |
|
|
218
|
+
| `options` | `object` | `undefined` | contains a set of a settings |
|
|
117
219
|
|
|
118
|
-
The `options` structure has listed below:
|
|
220
|
+
The `options` parameter structure has listed below:
|
|
119
221
|
|
|
120
|
-
|option name|value type|default value|description|
|
|
222
|
+
| option name | value type | default value | description |
|
|
121
223
|
|:---|---|---:|:---|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
224
|
+
| `id` | `string` | `undefined` | defines an ID-attribute of an element |
|
|
225
|
+
| `text` | `string` | `undefined` | defines a text context of an element |
|
|
226
|
+
| `attr` | `object` | --- | defines an attributes of an element |
|
|
227
|
+
| `classNames` | `string`, `string[]` | `undefined` | defines a class-attributes of an element (*`since: v0.0.19`*) |
|
|
228
|
+
| `data` | `object` | --- | defines a data-attributes of an element |
|
|
127
229
|
|
|
128
230
|
If succeed, the function returned `HTMLElement` and `null` if failed.
|
|
129
231
|
|
|
130
232
|
This function make all the jobs under the hood. So there is no need to call DOM-object directly in many situations.
|
|
131
233
|
|
|
132
|
-
|
|
234
|
+
<a name="valueToIDString"></a>
|
|
235
|
+
#### **valueToIDString(value\[, options])** => `?string`
|
|
236
|
+
|
|
237
|
+
This function tries to convert a given `value` to `ID_STRING`. If failed a `null` is returned.
|
|
238
|
+
|
|
239
|
+
| parameter name | value type | default value | description |
|
|
240
|
+
|:---|---|---:|:---|
|
|
241
|
+
| `value` | `any` | --- | some value |
|
|
242
|
+
| `options` | `boolean`, `object` | --- | options to set constraints |
|
|
133
243
|
|
|
134
|
-
|
|
244
|
+
> NOTE: This is a re-exported function. For more details see docs for [`@ygracs/bsfoc-lib-js`](https://gitlab.com/ygracs/bsfoc-lib-js)-module.
|
|
135
245
|
|
|
136
|
-
|
|
246
|
+
<a name="readAsTagName"></a>
|
|
247
|
+
#### **readAsTagName(value)** => `string`
|
|
137
248
|
|
|
138
249
|
> since: `v0.0.21`
|
|
139
250
|
|
|
140
251
|
This function tries to convert a given `value` to the value of type which is suitable for an HTML-element's tag name. If failed an empty string is returned.
|
|
141
252
|
|
|
142
|
-
|
|
253
|
+
| parameter name | value type | default value | description |
|
|
254
|
+
|:---|---|---:|:---|
|
|
255
|
+
| `value` | `any` | --- | some value |
|
|
256
|
+
|
|
257
|
+
<a name="readAsAttrName"></a>
|
|
258
|
+
#### **readAsAttrName(value)** => `string`
|
|
143
259
|
|
|
144
260
|
> since: `v0.0.21`
|
|
145
261
|
|
|
146
262
|
This function tries to convert a given `value` to the value of type which is suitable for an HTML-element's attribute name. If failed an empty string is returned.
|
|
147
263
|
|
|
148
|
-
|
|
264
|
+
| parameter name | value type | default value | description |
|
|
265
|
+
|:---|---|---:|:---|
|
|
266
|
+
| `value` | `any` | --- | some value |
|
|
267
|
+
|
|
268
|
+
<a name="readAsAttrValue"></a>
|
|
269
|
+
#### **readAsAttrValue(value)** => `string`
|
|
270
|
+
|
|
271
|
+
> since: `v0.0.18`
|
|
149
272
|
|
|
150
273
|
This function tries to convert a given `value` to the value of type which is suitable for an HTML-element's attribute. If failed a `null` is returned.
|
|
274
|
+
|
|
275
|
+
| parameter name | value type | default value | description |
|
|
276
|
+
|:---|---|---:|:---|
|
|
277
|
+
| `value` | `any` | --- | some value |
|
|
278
|
+
|
|
279
|
+
<a name="valueToElementID"></a>
|
|
280
|
+
#### **valueToElementID(value)** => `string`
|
|
281
|
+
|
|
282
|
+
> since: `v0.0.22`
|
|
283
|
+
|
|
284
|
+
This function tries to convert a given `value` to the value of a valid identifier which is suitable for an HTML-element's ID-attribute. If failed an empty string is returned.
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.025-20241115]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -7,6 +7,7 @@ const html_list = require('./lib/html-ctrls/list.js');
|
|
|
7
7
|
const html_list_btn = require('./lib/html-ctrls/lists-btn.js');
|
|
8
8
|
const html_bts = require('./lib/html-ctrls/buttons.js');
|
|
9
9
|
const html_flds = require('./lib/html-ctrls/fields.js');
|
|
10
|
+
const ev_helper = require('./lib/event-hfunc.js');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
// === module extra block (helper functions) ===
|
|
@@ -24,6 +25,11 @@ const components = {
|
|
|
24
25
|
THtmlInputField: html_flds.THtmlInputField,
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
const eventHelper = {
|
|
29
|
+
pushEventHandler: ev_helper.pushEventHandler,
|
|
30
|
+
triggerEventHandler: ev_helper.triggerEventHandler,
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
// === module exports block ===
|
|
28
34
|
|
|
29
35
|
module.exports.CSS_CLASS_STRING = html_helper.CSS_CLASS_STRING;
|
|
@@ -32,27 +38,27 @@ module.exports.isSelectedHTMLElement = html_helper.isSelectedHTMLElement;
|
|
|
32
38
|
module.exports.isCurrentHTMLElement = html_helper.isCurrentHTMLElement;
|
|
33
39
|
module.exports.isActiveHTMLElement = html_helper.isActiveHTMLElement;
|
|
34
40
|
module.exports.isHiddenHTMLElement = html_helper.isHiddenHTMLElement;
|
|
35
|
-
module.exports.
|
|
36
|
-
module.exports.
|
|
37
|
-
module.exports.
|
|
38
|
-
module.exports.
|
|
39
|
-
module.exports.
|
|
40
|
-
module.exports.
|
|
41
|
-
module.exports.
|
|
42
|
-
module.exports.
|
|
43
|
-
module.exports.
|
|
44
|
-
module.exports.
|
|
45
|
-
module.exports.
|
|
46
|
-
module.exports.
|
|
41
|
+
module.exports.hideHTMLElement = html_helper.hideHTMLElement;
|
|
42
|
+
module.exports.showHTMLElement = html_helper.showHTMLElement;
|
|
43
|
+
module.exports.selectHTMLElement = html_helper.selectHTMLElement;
|
|
44
|
+
module.exports.unselectHTMLElement = html_helper.unselectHTMLElement;
|
|
45
|
+
module.exports.markHTMLElementAsCurrent = html_helper.markHTMLElementAsCurrent;
|
|
46
|
+
module.exports.unmarkCurrentHTMLElement = html_helper.unmarkCurrentHTMLElement;
|
|
47
|
+
module.exports.markHTMLElementAsActive = html_helper.markHTMLElementAsActive;
|
|
48
|
+
module.exports.unmarkActiveHTMLElement = html_helper.unmarkActiveHTMLElement;
|
|
49
|
+
module.exports.lockHTMLElement = html_helper.lockHTMLElement;
|
|
50
|
+
module.exports.unlockHTMLElement = html_helper.unlockHTMLElement;
|
|
51
|
+
module.exports.activateHTMLElements = html_helper.activateHTMLElements;
|
|
52
|
+
module.exports.inactivateHTMLElements = html_helper.inactivateHTMLElements;
|
|
47
53
|
module.exports.valueToClassList = html_helper.valueToClassList;
|
|
48
54
|
|
|
49
55
|
module.exports.THtmlStubItemsSet = html_list.THtmlStubItemsSet;
|
|
50
56
|
module.exports.THtmlItemsListContainer = html_list.THtmlItemsListContainer;
|
|
51
57
|
module.exports.THtmlItemsListController = html_list.THtmlItemsListController;
|
|
52
58
|
|
|
59
|
+
module.exports.BTS_DEF_GROUP_NAME = html_bts.BTS_DEF_GROUP_NAME;
|
|
53
60
|
module.exports.THtmlButtonsSet = html_bts.THtmlButtonsSet;
|
|
54
61
|
module.exports.THtmlButtonsControllerARCSet = html_bts.THtmlButtonsControllerARCSet;
|
|
55
|
-
module.exports.BTS_DEF_GROUP_NAME = html_bts.BTS_DEF_GROUP_NAME;
|
|
56
62
|
|
|
57
63
|
module.exports.THtmlListButtonsController = html_list_btn.THtmlListButtonsController;
|
|
58
64
|
|
|
@@ -62,13 +68,32 @@ module.exports.components = components;
|
|
|
62
68
|
module.exports.readAsTagName = html_helper.readAsTagName;
|
|
63
69
|
module.exports.readAsAttrName = html_helper.readAsAttrName;
|
|
64
70
|
module.exports.readAsAttrValue = html_helper.readAsAttrValue;
|
|
71
|
+
module.exports.valueToElementID = html_helper.valueToElementID;
|
|
65
72
|
module.exports.createNewHtmlElement = html_helper.createNewHtmlElement;
|
|
66
73
|
|
|
74
|
+
module.exports.isHTMLButton = html_bts.isHTMLButton;
|
|
75
|
+
|
|
67
76
|
module.exports.THtmlInputField = html_flds.THtmlInputField;
|
|
68
77
|
|
|
78
|
+
module.exports.eventHelper = eventHelper;
|
|
79
|
+
|
|
69
80
|
// re-exported
|
|
70
81
|
module.exports.valueToIDString = html_helper.valueToIDString;
|
|
71
82
|
|
|
72
83
|
// will deprecate
|
|
84
|
+
module.exports.classes = components;
|
|
85
|
+
|
|
86
|
+
// deprecated
|
|
73
87
|
module.exports.component = components;
|
|
74
|
-
module.exports.
|
|
88
|
+
module.exports.hideHtmlElement = html_helper.hideHtmlElement;
|
|
89
|
+
module.exports.showHtmlElement = html_helper.showHtmlElement;
|
|
90
|
+
module.exports.selectHtmlElement = html_helper.selectHtmlElement;
|
|
91
|
+
module.exports.unselectHtmlElement = html_helper.unselectHtmlElement;
|
|
92
|
+
module.exports.markHtmlElementAsCurrent = html_helper.markHtmlElementAsCurrent;
|
|
93
|
+
module.exports.unmarkCurrentHtmlElement = html_helper.unmarkCurrentHtmlElement;
|
|
94
|
+
module.exports.markHtmlElementAsActive = html_helper.markHtmlElementAsActive;
|
|
95
|
+
module.exports.unmarkActiveHtmlElement = html_helper.unmarkActiveHtmlElement;
|
|
96
|
+
module.exports.lockHtmlElement = html_helper.lockHtmlElement;
|
|
97
|
+
module.exports.unlockHtmlElement = html_helper.unlockHtmlElement;
|
|
98
|
+
module.exports.inactivateHtmlElements = html_helper.inactivateHtmlElements;
|
|
99
|
+
module.exports.activateHtmlElements = html_helper.activateHtmlElements;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// [v0.1.062-20241115]
|
|
2
|
+
|
|
3
|
+
// === module init block ===
|
|
4
|
+
|
|
5
|
+
// === module extra block (helper functions) ===
|
|
6
|
+
|
|
7
|
+
// === module main block ===
|
|
8
|
+
|
|
9
|
+
/***
|
|
10
|
+
* (* constant definitions *)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/***
|
|
14
|
+
* (* function definitions *)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @function pushEventHandler
|
|
19
|
+
* @param {object} pool - pool object
|
|
20
|
+
* @param {string} name - event name
|
|
21
|
+
* @param {func} evnt - callback function
|
|
22
|
+
* @returns {void}
|
|
23
|
+
* @inner
|
|
24
|
+
*/
|
|
25
|
+
function pushEventHandler(pool, name, evnt){
|
|
26
|
+
const _name = typeof name === 'string' ? name.trim() : '';
|
|
27
|
+
if (_name !== '' && typeof evnt === 'function') {
|
|
28
|
+
if (!pool.has(_name)) {
|
|
29
|
+
pool.set(_name, evnt);
|
|
30
|
+
} else {
|
|
31
|
+
/* NOTE:
|
|
32
|
+
* for current you can't reset or set new one on the same event
|
|
33
|
+
*/
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @function triggerEventHandler
|
|
40
|
+
* @param {object} pool - pool object
|
|
41
|
+
* @param {string} name - event name
|
|
42
|
+
* @param {...any} [args]
|
|
43
|
+
* @returns {void}
|
|
44
|
+
* @inner
|
|
45
|
+
*/
|
|
46
|
+
function triggerEventHandler(pool, name, ...args){
|
|
47
|
+
const _name = typeof name === 'string' ? name.trim() : '';
|
|
48
|
+
if (_name !== '') {
|
|
49
|
+
if (pool.has(_name)) pool.get(_name)(...args);
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/***
|
|
54
|
+
* (* class definitions *)
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
// === module exports block ===
|
|
58
|
+
|
|
59
|
+
exports.pushEventHandler = pushEventHandler;
|
|
60
|
+
exports.triggerEventHandler = triggerEventHandler;
|