@cntwg/html-helper 0.0.26 → 0.0.27
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 +9 -0
- package/doc/html-ctrls-btn.md +4 -11
- package/doc/html-helper-lib.md +11 -2
- package/index.js +2 -2
- package/lib/html-ctrls/buttons.js +31 -59
- package/lib/html-ctrls/fields.js +19 -19
- package/lib/html-ctrls/list.js +65 -64
- package/lib/html-ctrls/lists-btn.js +19 -19
- package/lib/html-ctrls/lists-stubs.js +18 -18
- package/lib/html-helper-lib.js +61 -34
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
#### *v0.0.27*
|
|
2
|
+
|
|
3
|
+
Pre-release version.
|
|
4
|
+
|
|
5
|
+
> - `html-helper-lib.md` updated;
|
|
6
|
+
> - `html-ctrls-btn.md` updated;
|
|
7
|
+
> - update dependency on `@ygracs/bsfoc-lib-js` module to v0.3.0;
|
|
8
|
+
> - update dependency on `@ygracs/lists-lib-js` module to v0.1.0.
|
|
9
|
+
|
|
1
10
|
#### *v0.0.26*
|
|
2
11
|
|
|
3
12
|
Pre-release version.
|
package/doc/html-ctrls-btn.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.16|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2025-08-27|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -16,15 +16,6 @@ By module, constants that is provided listed in the following table:
|
|
|
16
16
|
|
|
17
17
|
## Module functions
|
|
18
18
|
|
|
19
|
-
<a name="isHTMLButton"></a>
|
|
20
|
-
#### **isHTMLButton(obj)** => `boolean`
|
|
21
|
-
|
|
22
|
-
This function checks whether or not a given object represents an HTML-button element and if so returns `true` or `false` if else.
|
|
23
|
-
|
|
24
|
-
| parameter name | value type | default value | description |
|
|
25
|
-
|:---|---|---:|:---|
|
|
26
|
-
| `obj` | `any` | --- | some element to be checked |
|
|
27
|
-
|
|
28
19
|
## Module classes
|
|
29
20
|
|
|
30
21
|
<a name="THtmlButtonsSet"></a>
|
|
@@ -199,6 +190,8 @@ This method inactivates all "button" elements present in a group named by `name`
|
|
|
199
190
|
|---|---|:---|
|
|
200
191
|
| `function` | yes | contains a default function that verified validity of an element. The function receives element and returns result for validation as a `boolean`. |
|
|
201
192
|
|
|
193
|
+
> For more details see [`isHTMLButton`](html-helper-lib.md#isHTMLButton).
|
|
194
|
+
|
|
202
195
|
<a name="THtmlButtonsControllerARCSet"></a>
|
|
203
196
|
### **THtmlButtonsControllerARCSet**
|
|
204
197
|
|
package/doc/html-helper-lib.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.16|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|2025-
|
|
3
|
+
>|date:|2025-08-27|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -33,6 +33,15 @@ This function checks whether or not a given object represents an HTML-element an
|
|
|
33
33
|
|:---|---|---:|:---|
|
|
34
34
|
| `obj` | `any` | --- | some element to be checked |
|
|
35
35
|
|
|
36
|
+
<a name="isHTMLButton"></a>
|
|
37
|
+
#### **isHTMLButton(obj)** => `boolean`
|
|
38
|
+
|
|
39
|
+
This function checks whether or not a given object represents an HTML-button element and if so returns `true` or `false` if else.
|
|
40
|
+
|
|
41
|
+
| parameter name | value type | default value | description |
|
|
42
|
+
|:---|---|---:|:---|
|
|
43
|
+
| `obj` | `any` | --- | some element to be checked |
|
|
44
|
+
|
|
36
45
|
<a name="isSelectedHTMLElement"></a>
|
|
37
46
|
#### **isSelectedHTMLElement(obj)** => `boolean`
|
|
38
47
|
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.029-20250827]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -71,8 +71,8 @@ module.exports.readAsAttrName = html_helper.readAsAttrName;
|
|
|
71
71
|
module.exports.readAsAttrValue = html_helper.readAsAttrValue;
|
|
72
72
|
module.exports.valueToElementID = html_helper.valueToElementID;
|
|
73
73
|
module.exports.createNewHTMLElement = html_helper.createNewHTMLElement;
|
|
74
|
+
module.exports.isHTMLButton = html_helper.isHTMLButton;
|
|
74
75
|
|
|
75
|
-
module.exports.isHTMLButton = html_bts.isHTMLButton;
|
|
76
76
|
|
|
77
77
|
module.exports.THtmlInputField = html_flds.THtmlInputField;
|
|
78
78
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.064-20250827]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
} = require('@ygracs/lists-lib-js');
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
|
-
isHTMLElement,
|
|
15
|
+
isHTMLElement, isHTMLButton,
|
|
16
16
|
valueToIDString,
|
|
17
17
|
lockHTMLElement, unlockHTMLElement,
|
|
18
18
|
CSS_CLASS_STRING,
|
|
@@ -37,38 +37,10 @@ const {
|
|
|
37
37
|
|
|
38
38
|
const BTS_DEF_GROUP_NAME = 'all';
|
|
39
39
|
|
|
40
|
-
const etlHTagInputForBtn = new Set([
|
|
41
|
-
'button', 'submit', 'reset', 'image',
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
40
|
/***
|
|
45
41
|
* (* function definitions *)
|
|
46
42
|
*/
|
|
47
43
|
|
|
48
|
-
/**
|
|
49
|
-
* @function isHTMLButton
|
|
50
|
-
* @param {any} obj - element to be verified
|
|
51
|
-
* @returns {boolean}
|
|
52
|
-
* @description Checks if the given object is an HTML-button.
|
|
53
|
-
*/
|
|
54
|
-
function isHTMLButton(obj) {
|
|
55
|
-
let result = false;
|
|
56
|
-
if (isHTMLElement(obj)) {
|
|
57
|
-
switch (obj.tagName.toLowerCase()) {
|
|
58
|
-
case 'button': {
|
|
59
|
-
result = true;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case 'input': {
|
|
63
|
-
result = etlHTagInputForBtn.has(obj.type.toLowerCase());
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
default: {}
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
44
|
/***
|
|
73
45
|
* (* class definitions *)
|
|
74
46
|
*/
|
|
@@ -81,7 +53,7 @@ class THtmlButtonsSet {
|
|
|
81
53
|
#_btnCol;
|
|
82
54
|
|
|
83
55
|
/**
|
|
84
|
-
*
|
|
56
|
+
* Creates an instance of a buttons set
|
|
85
57
|
*/
|
|
86
58
|
constructor() {
|
|
87
59
|
// define default functions for manipulators
|
|
@@ -122,133 +94,133 @@ class THtmlButtonsSet {
|
|
|
122
94
|
}
|
|
123
95
|
|
|
124
96
|
/**
|
|
97
|
+
* Checks whether a target item with a given name exists.
|
|
125
98
|
* @param {string} name - element name
|
|
126
99
|
* @returns {boolean}
|
|
127
100
|
* @see TItemsICollection.hasItem
|
|
128
|
-
* @description Checks whether a target item with a given name exists.
|
|
129
101
|
*/
|
|
130
102
|
hasItem(name) {
|
|
131
103
|
return this.#_btnCol.hasItem(name);
|
|
132
104
|
}
|
|
133
105
|
|
|
134
106
|
/**
|
|
107
|
+
* Adds buttons to a set members.
|
|
135
108
|
* @param {string} name - element name
|
|
136
109
|
* @param {any} item - element
|
|
137
110
|
* @param {...string} [group] - name of a target groups
|
|
138
111
|
* @returns {boolean}
|
|
139
112
|
* @see TItemsICollection.addItem
|
|
140
|
-
* @description Adds buttons to a set members.
|
|
141
113
|
*/
|
|
142
114
|
addItem(...args) {
|
|
143
115
|
return this.#_btnCol.addItem(...args);
|
|
144
116
|
}
|
|
145
117
|
|
|
146
118
|
/**
|
|
119
|
+
* Adds button to a listed groups.
|
|
147
120
|
* @param {string} name - element name
|
|
148
121
|
* @param {...string} [group] - name of a target groups
|
|
149
122
|
* @returns {boolean}
|
|
150
123
|
* @see TItemsICollection.addItemToCategory
|
|
151
|
-
* @description Adds button to a listed groups.
|
|
152
124
|
*/
|
|
153
125
|
addItemToGroup(...args) {
|
|
154
126
|
return this.#_btnCol.addItemToCategory(...args);
|
|
155
127
|
}
|
|
156
128
|
|
|
157
129
|
/**
|
|
130
|
+
* Deletes button from a set members.
|
|
158
131
|
* @param {string} name - element name
|
|
159
132
|
* @returns {boolean}
|
|
160
133
|
* @see TItemsICollection.delItem
|
|
161
|
-
* @description Deletes button from a set members.
|
|
162
134
|
*/
|
|
163
135
|
delItem(name) {
|
|
164
136
|
return this.#_btnCol.delItem(name);
|
|
165
137
|
}
|
|
166
138
|
|
|
167
139
|
/**
|
|
140
|
+
* Deletes button from a listed groups.
|
|
168
141
|
* @param {string} name - element name
|
|
169
142
|
* @param {...string} [group] - name of a target groups
|
|
170
143
|
* @returns {boolean}
|
|
171
144
|
* @see TItemsICollection.delItemFromGroup
|
|
172
|
-
* @description Deletes button from a listed groups.
|
|
173
145
|
*/
|
|
174
146
|
delItemFromGroup(...args) {
|
|
175
147
|
return this.#_btnCol.delItemFromGroup(...args);
|
|
176
148
|
}
|
|
177
149
|
|
|
178
150
|
/**
|
|
151
|
+
* Renames button in a set.
|
|
179
152
|
* @param {string} name - old name
|
|
180
153
|
* @param {string} value - new name
|
|
181
154
|
* @returns {boolean}
|
|
182
155
|
* @see TItemsICollection.renameItem
|
|
183
|
-
* @description Renames button in a set.
|
|
184
156
|
*/
|
|
185
157
|
renameItem(name, value) {
|
|
186
158
|
return this.#_btnCol.renameItem(name, value, false);
|
|
187
159
|
}
|
|
188
160
|
|
|
189
161
|
/**
|
|
162
|
+
* Tries to enable button.
|
|
190
163
|
* @param {string} name - element name
|
|
191
164
|
* @returns {void}
|
|
192
|
-
* @description Tries to enable button.
|
|
193
165
|
*/
|
|
194
166
|
enableItem(name) {
|
|
195
167
|
unlockHTMLElement(this.#_btnCol.getItem(name));
|
|
196
168
|
}
|
|
197
169
|
|
|
198
170
|
/**
|
|
171
|
+
* Tries to disable button.
|
|
199
172
|
* @param {string} name - element name
|
|
200
173
|
* @returns {void}
|
|
201
|
-
* @description Tries to disable button.
|
|
202
174
|
*/
|
|
203
175
|
disableItem(name) {
|
|
204
176
|
lockHTMLElement(this.#_btnCol.getItem(name));
|
|
205
177
|
}
|
|
206
178
|
|
|
207
179
|
/**
|
|
180
|
+
* Checks whether a target group with a given name exists.
|
|
208
181
|
* @param {string} name - group name
|
|
209
182
|
* @returns {boolean}
|
|
210
183
|
* @see TItemsICollection.hasCategory
|
|
211
|
-
* @description Checks whether a target group with a given name exists.
|
|
212
184
|
*/
|
|
213
185
|
hasGroup(name) {
|
|
214
186
|
return this.#_btnCol.hasCategory(name);
|
|
215
187
|
}
|
|
216
188
|
|
|
217
189
|
/**
|
|
190
|
+
* Adds a group with a given name.
|
|
218
191
|
* @param {string} name - group name
|
|
219
192
|
* @returns {boolean}
|
|
220
193
|
* @see TItemsICollection.addCategory
|
|
221
|
-
* @description Adds a group with a given name.
|
|
222
194
|
*/
|
|
223
195
|
addGroup(name) {
|
|
224
196
|
return this.#_btnCol.addCategory(name);
|
|
225
197
|
}
|
|
226
198
|
|
|
227
199
|
/**
|
|
200
|
+
* Deletes a group with a given name.
|
|
228
201
|
* @param {string} name - group name
|
|
229
202
|
* @returns {boolean}
|
|
230
203
|
* @see TItemsICollection.delCategory
|
|
231
|
-
* @description Deletes a group with a given name.
|
|
232
204
|
*/
|
|
233
205
|
delGroup(name) {
|
|
234
206
|
return this.#_btnCol.delCategory(name);
|
|
235
207
|
}
|
|
236
208
|
|
|
237
209
|
/**
|
|
210
|
+
* Renames group in a set.
|
|
238
211
|
* @param {string} name - old name
|
|
239
212
|
* @param {string} value - new name
|
|
240
213
|
* @returns {boolean}
|
|
241
214
|
* @see TItemsICollection.renameCategory
|
|
242
|
-
* @description Renames group in a set.
|
|
243
215
|
*/
|
|
244
216
|
renameGroup(name, value) {
|
|
245
217
|
return this.#_btnCol.renameCategory(name, value, false);
|
|
246
218
|
}
|
|
247
219
|
|
|
248
220
|
/**
|
|
221
|
+
* Enables all buttons in a given group.
|
|
249
222
|
* @param {string} value - group name
|
|
250
223
|
* @returns {void}
|
|
251
|
-
* @description Enables all buttons in a given group.
|
|
252
224
|
*/
|
|
253
225
|
enableGroup(value) {
|
|
254
226
|
const group = this.#_btnCol.getCategory(value);
|
|
@@ -256,9 +228,9 @@ class THtmlButtonsSet {
|
|
|
256
228
|
}
|
|
257
229
|
|
|
258
230
|
/**
|
|
231
|
+
* Disables all buttons in a given group.
|
|
259
232
|
* @param {string} value - group name
|
|
260
233
|
* @returns {void}
|
|
261
|
-
* @description Disables all buttons in a given group.
|
|
262
234
|
*/
|
|
263
235
|
disableGroup(value) {
|
|
264
236
|
const group = this.#_btnCol.getCategory(value);
|
|
@@ -276,6 +248,14 @@ class THtmlButtonsSet {
|
|
|
276
248
|
|
|
277
249
|
};
|
|
278
250
|
|
|
251
|
+
/**
|
|
252
|
+
* A description for ARC-buttons set.
|
|
253
|
+
* @typedef {Object} arcButtonsDesc
|
|
254
|
+
* @property {?HTMLElement} btnApply - button 'apply'
|
|
255
|
+
* @property {?HTMLElement} btnReset - button 'reset'
|
|
256
|
+
* @property {?HTMLElement} btnCancel - button 'cancel'
|
|
257
|
+
*/
|
|
258
|
+
|
|
279
259
|
/**
|
|
280
260
|
* @classdesc This class implements an interface of a pre-defined buttons set.
|
|
281
261
|
* A set provide a three button: <apply>, <reset> and <cancel>.
|
|
@@ -287,16 +267,8 @@ class THtmlButtonsControllerARCSet {
|
|
|
287
267
|
#_events;
|
|
288
268
|
|
|
289
269
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @property {?HTMLElement} btnApply - button 'apply'
|
|
292
|
-
* @property {?HTMLElement} btnReset - button 'reset'
|
|
293
|
-
* @property {?HTMLElement} btnCancel - button 'cancel'
|
|
294
|
-
* @description A description for ARC-buttons set.
|
|
295
|
-
*/
|
|
296
|
-
|
|
297
|
-
/**
|
|
270
|
+
* Creates an instance of the buttons set.
|
|
298
271
|
* @param {arcButtonsDesc} opt - an option
|
|
299
|
-
* @description Creates an instance of the buttons set.
|
|
300
272
|
*/
|
|
301
273
|
constructor(opt) {
|
|
302
274
|
// load controls
|
|
@@ -362,42 +334,42 @@ class THtmlButtonsControllerARCSet {
|
|
|
362
334
|
}
|
|
363
335
|
|
|
364
336
|
/**
|
|
337
|
+
* Disables all buttons in 'main' group.
|
|
365
338
|
* @returns {void}
|
|
366
|
-
* @description Disables all buttons in 'main' group.
|
|
367
339
|
*/
|
|
368
340
|
disableMain() {
|
|
369
341
|
this.#_btnSet.disableGroup('main');
|
|
370
342
|
}
|
|
371
343
|
|
|
372
344
|
/**
|
|
345
|
+
* Enables all buttons in 'main' group.
|
|
373
346
|
* @returns {void}
|
|
374
|
-
* @description Enables all buttons in 'main' group.
|
|
375
347
|
*/
|
|
376
348
|
enableMain() {
|
|
377
349
|
this.#_btnSet.enableGroup('main');
|
|
378
350
|
}
|
|
379
351
|
|
|
380
352
|
/**
|
|
353
|
+
* Disables all buttons.
|
|
381
354
|
* @returns {void}
|
|
382
|
-
* @description Disables all buttons.
|
|
383
355
|
*/
|
|
384
356
|
disableAll() {
|
|
385
357
|
this.#_btnSet.disableGroup('all');
|
|
386
358
|
}
|
|
387
359
|
|
|
388
360
|
/**
|
|
361
|
+
* Enables all buttons.
|
|
389
362
|
* @returns {void}
|
|
390
|
-
* @description Enables all buttons.
|
|
391
363
|
*/
|
|
392
364
|
enableAll() {
|
|
393
365
|
this.#_btnSet.enableGroup('all');
|
|
394
366
|
}
|
|
395
367
|
|
|
396
368
|
/**
|
|
369
|
+
* Sets a callback function to handle event.
|
|
397
370
|
* @param {string} name - event name
|
|
398
371
|
* @param {func} evnt - a callback function
|
|
399
372
|
* @returns {void}
|
|
400
|
-
* @description Sets a callback function to handle event.
|
|
401
373
|
*/
|
|
402
374
|
on(name, evnt) {
|
|
403
375
|
pushEventHandler(this.#_events, name, evnt);
|
package/lib/html-ctrls/fields.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.023-20250827]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
pushEventHandler, triggerEventHandler,
|
|
20
20
|
} = require('./mod-hfunc.js');
|
|
21
21
|
|
|
22
|
-
// === module
|
|
22
|
+
// === module inner block ===
|
|
23
23
|
|
|
24
24
|
const lpAllowedValues = new Map([
|
|
25
25
|
[ 'before', 0 ],
|
|
@@ -28,18 +28,18 @@ const lpAllowedValues = new Map([
|
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
+
* An input field type descriptor
|
|
31
32
|
* @typedef {Object} ifcTypeDesc
|
|
32
33
|
* @property {string} type - field general type
|
|
33
34
|
* @property {string} subtype - field sub-type
|
|
34
|
-
* @description An input field type description
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
+
* Returns field description by a given type.
|
|
38
39
|
* @function getInputFieldTypeDescr
|
|
39
40
|
* @param {string} value - field type
|
|
40
41
|
* @returns {ifcTypeDesc}
|
|
41
42
|
* @inner
|
|
42
|
-
* @description Returns field description by a given type.
|
|
43
43
|
*/
|
|
44
44
|
function getInputFieldTypeDescr(value) {
|
|
45
45
|
let fldType = readAsString(value, { useTrim: true });
|
|
@@ -69,11 +69,11 @@ function getInputFieldTypeDescr(value) {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
+
* Returns label position ID by its name.
|
|
72
73
|
* @function getLabelPositionID
|
|
73
74
|
* @param {string} value - label position identifier
|
|
74
75
|
* @returns {number}
|
|
75
76
|
* @inner
|
|
76
|
-
* @description Returns label position ID by its name.
|
|
77
77
|
*/
|
|
78
78
|
function getLabelPositionID(value) {
|
|
79
79
|
let key = readAsString(value, { useTrim: true });
|
|
@@ -96,6 +96,7 @@ function getLabelPositionID(value) {
|
|
|
96
96
|
*/
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
+
* An options set for create ifc
|
|
99
100
|
* @typedef {Object} OPT_ifcdesc
|
|
100
101
|
* @property {HTMLElement} [host] - host element
|
|
101
102
|
* @property {string} [idPref]
|
|
@@ -106,25 +107,24 @@ function getLabelPositionID(value) {
|
|
|
106
107
|
* @property {string} [hint] - hint to show when empty
|
|
107
108
|
* @property {string} [type] - field type
|
|
108
109
|
* @property {boolean} [readonly] - mode flag
|
|
109
|
-
* @description An options set for create ifc
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
+
* An options set for `THtmlInputField`-class
|
|
113
114
|
* @typedef {Object} OPT_ifcsett
|
|
114
115
|
* @property {string} [idPref]
|
|
115
116
|
* @property {(string|string[])} [baseClassID]
|
|
116
117
|
* @property {string} [hint] - hint to show when empty
|
|
117
118
|
* @property {string} [type] - field type
|
|
118
119
|
* @property {boolean} [readonly=true] - mode flag
|
|
119
|
-
* @description An options set for `THtmlInputField`-class
|
|
120
120
|
*/
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
+
* A descriptor for an input field elements set.
|
|
123
124
|
* @typedef {Object} ifcElementsDesc
|
|
124
125
|
* @property {HTMLElement} host - host element
|
|
125
126
|
* @property {HTMLElement} label - label element
|
|
126
127
|
* @property {HTMLElement} field - field element
|
|
127
|
-
* @description A description for input field elements set.
|
|
128
128
|
*/
|
|
129
129
|
|
|
130
130
|
/**
|
|
@@ -142,13 +142,13 @@ class THtmlInputField {
|
|
|
142
142
|
/** @type {OPT_ifcsett} */
|
|
143
143
|
#_options = null;
|
|
144
144
|
/**
|
|
145
|
+
* A controller status
|
|
145
146
|
* @typedef {Object} statIFCtrl
|
|
146
147
|
* @property {string} fldType - field general type
|
|
147
148
|
* @property {string} fldSubType - field sub-type
|
|
148
149
|
* @property {boolean} isReadOnly - mode flag
|
|
149
150
|
* @property {boolean} isModified - indicates whether any changes was made
|
|
150
151
|
* @inner
|
|
151
|
-
* @description A controller status
|
|
152
152
|
*/
|
|
153
153
|
/** @type {statIFCtrl} */
|
|
154
154
|
#_status;// = null;
|
|
@@ -156,10 +156,10 @@ class THtmlInputField {
|
|
|
156
156
|
#_events;// = null;
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
|
+
* Creates an instance of an input field element
|
|
159
160
|
* @param {string} name - <*reserved*>
|
|
160
161
|
* @param {ifcElementsDesc} eholds - elements set
|
|
161
162
|
* @param {OPT_ifcsett} [opt] - options
|
|
162
|
-
* @description Creates an instance of an input field element
|
|
163
163
|
*/
|
|
164
164
|
constructor(name, eholds, opt) {
|
|
165
165
|
// load elements
|
|
@@ -331,9 +331,9 @@ class THtmlInputField {
|
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
/**
|
|
334
|
+
* Tries to attach an element to a given target.
|
|
334
335
|
* @param {HTMLElement} target - target element
|
|
335
336
|
* @returns {boolean}
|
|
336
|
-
* @description Tries to attach an element to a given target.
|
|
337
337
|
*/
|
|
338
338
|
attachTo(target) {
|
|
339
339
|
const host = this.#_host;
|
|
@@ -349,32 +349,32 @@ class THtmlInputField {
|
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
|
+
* Checks if a value of an element is not set.
|
|
352
353
|
* @returns {boolean}
|
|
353
|
-
* @description Checks if a value of an element is not set.
|
|
354
354
|
*/
|
|
355
355
|
isEmpty() {
|
|
356
356
|
return isEmptyString(this.value);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
/**
|
|
360
|
+
* Checks if a value of an element is set.
|
|
360
361
|
* @returns {boolean}
|
|
361
|
-
* @description Checks if a value of an element is set.
|
|
362
362
|
*/
|
|
363
363
|
isNotEmpty() {
|
|
364
364
|
return isNotEmptyString(this.value);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
|
+
* Shows an element.
|
|
368
369
|
* @returns {void}
|
|
369
|
-
* @description Shows an element.
|
|
370
370
|
*/
|
|
371
371
|
show() {
|
|
372
372
|
showHTMLElement(this.#_host);
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
|
+
* Hides an element.
|
|
376
377
|
* @returns {void}
|
|
377
|
-
* @description Hides an element.
|
|
378
378
|
*/
|
|
379
379
|
hide() {
|
|
380
380
|
hideHTMLElement(this.#_host);
|
|
@@ -382,18 +382,18 @@ class THtmlInputField {
|
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
384
|
* @returns {void}
|
|
385
|
-
* @
|
|
385
|
+
* @todo not implemented yet.
|
|
386
386
|
*/
|
|
387
387
|
clear() {
|
|
388
388
|
// // TODO:
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
|
+
* Creates a new instance.
|
|
392
393
|
* @param {string} name - <*reserved*>
|
|
393
394
|
* @param {OPT_ifcdesc} opt - options
|
|
394
395
|
* @returns {?THtmlInputField}
|
|
395
396
|
* @static
|
|
396
|
-
* @description Creates a new instance.
|
|
397
397
|
*/
|
|
398
398
|
static create(name, opt) {
|
|
399
399
|
const eholds = THtmlInputField.createElement(name, opt, true);
|
|
@@ -406,12 +406,12 @@ class THtmlInputField {
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
/**
|
|
409
|
+
* Creates a new elements.
|
|
409
410
|
* @param {string} name
|
|
410
411
|
* @param {OPT_ifcdesc} [opt] - options
|
|
411
412
|
* @param {boolean} [doRetChild=false] - mode flag
|
|
412
413
|
* @returns {(HTMLElement|ifcElementsDesc)}
|
|
413
414
|
* @static
|
|
414
|
-
* @description Creates a new elements.
|
|
415
415
|
*/
|
|
416
416
|
static createElement(name, opt, doRetChild) {
|
|
417
417
|
const id = valueToIDString(name);
|
|
@@ -505,10 +505,10 @@ class THtmlInputField {
|
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
/**
|
|
508
|
+
* Sets a callback function to handle event.
|
|
508
509
|
* @param {string} name - event name
|
|
509
510
|
* @param {func} evnt - callback function
|
|
510
511
|
* @returns {void}
|
|
511
|
-
* @description Sets a callback function to handle event.
|
|
512
512
|
*/
|
|
513
513
|
on(name, evnt) {
|
|
514
514
|
pushEventHandler(this.#_events, name, evnt);
|