@cntwg/html-helper 0.0.25 → 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 +19 -0
- package/doc/html-ctrls-btn.md +4 -11
- package/doc/html-ctrls-list.md +13 -13
- package/doc/html-helper-lib.md +11 -2
- package/index.js +3 -2
- package/lib/event-hfunc.js +26 -8
- package/lib/html-ctrls/buttons.js +37 -72
- package/lib/html-ctrls/fields.js +42 -42
- package/lib/html-ctrls/list.js +83 -72
- package/lib/html-ctrls/lists-btn.js +20 -22
- package/lib/html-ctrls/lists-stubs.js +55 -42
- package/lib/html-helper-lib.js +64 -40
- package/package.json +6 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
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
|
+
|
|
10
|
+
#### *v0.0.26*
|
|
11
|
+
|
|
12
|
+
Pre-release version.
|
|
13
|
+
|
|
14
|
+
> - `html-ctrls-list.md` updated;
|
|
15
|
+
> - improve a 'THtmlItemsListController' behavior on handling a `click`-event;
|
|
16
|
+
> - change behavior for a `THtmlStubItemsSet`-class constructor (*see docs for details*);
|
|
17
|
+
> - change behavior for a `loadItems`-method of a `THtmlStubItemsSet`-class (*see docs for details*);
|
|
18
|
+
> - some other fixes.
|
|
19
|
+
|
|
1
20
|
#### *v0.0.25*
|
|
2
21
|
|
|
3
22
|
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-ctrls-list.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.24|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|2025-
|
|
3
|
+
>|date:|2025-05-05|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -625,7 +625,9 @@ The class constructor receives a parameters listed below:
|
|
|
625
625
|
| parameter name | value type | default value | description |
|
|
626
626
|
|:---|---|---:|:---|
|
|
627
627
|
| `host` | `HTMLElement` | --- | points to a host element which holds a list items |
|
|
628
|
-
| `options` | `object`, `array` |
|
|
628
|
+
| `options` | `object`, `array` | --- | contains an object that is send to a class `loadItems` method |
|
|
629
|
+
|
|
630
|
+
> \[!] NOTE: `[since v0.0.26]` a use of a `array` type as a value of an `options` are deprecated and will be dropped soon.
|
|
629
631
|
|
|
630
632
|
##### `options` parameter
|
|
631
633
|
|
|
@@ -633,11 +635,9 @@ The `options` structure has listed below:
|
|
|
633
635
|
|
|
634
636
|
| option name | value type | default value | description |
|
|
635
637
|
|:---|---|---:|:---|
|
|
636
|
-
| `items` | `array` |
|
|
638
|
+
| `items` | `array`, `object` | --- | defines a list of the entries to load. For more details see a description of a [`loadItems`](#THtmlStubItemsSet+loadItems) class method |
|
|
637
639
|
| `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
|
|
638
|
-
| `force` | `boolean` | `false` | if set to `true`, the item which is already present will be replaced with a new one
|
|
639
|
-
|
|
640
|
-
> NOTE: For more details on an `items` element see an description of a [`loadItems`](#THtmlStubItemsSet+loadItems) class method.
|
|
640
|
+
| `force` | `boolean` | `false` | if set to `true`, the item which is already present will be replaced with a new one |
|
|
641
641
|
|
|
642
642
|
#### class properties
|
|
643
643
|
|
|
@@ -754,27 +754,27 @@ This class method is similar to `showItem` method but is performed on a default
|
|
|
754
754
|
This class method is similar to `hideItem` method but is performed on a default item.
|
|
755
755
|
|
|
756
756
|
<a name="THtmlStubItemsSet+loadItems"></a>
|
|
757
|
-
##### **loadItems(
|
|
757
|
+
##### **loadItems(data\[, options])** => `number`
|
|
758
758
|
|
|
759
759
|
This class methods loads an items given by `list` in the set and returned quantity of how many items have been processed successfully.
|
|
760
760
|
|
|
761
761
|
| parameter name | value type | default value | description |
|
|
762
762
|
|:---|---|---:|:---|
|
|
763
|
-
| `
|
|
763
|
+
| `data` | `array`, `object` | --- | an array of entries or a special descriptive object |
|
|
764
764
|
| `options` | `boolean`, `object` | --- | an options |
|
|
765
765
|
|
|
766
766
|
> \[!] NOTE: *`[since v0.0.25]`* the use of a booleans as an `options` value is deprecated and will be dropped soon.
|
|
767
767
|
|
|
768
|
-
If the `
|
|
768
|
+
If the `data` parameter is an `object` that contains the following set of values:
|
|
769
769
|
|
|
770
770
|
| option name | value type | default value | description |
|
|
771
771
|
|:---|---|---:|:---|
|
|
772
772
|
| `items` | `array` | `undefined` | defines a list of the entries to load. Each entry contains a `name`-`element` pair. |
|
|
773
773
|
| `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
|
|
774
774
|
|
|
775
|
-
If the `
|
|
775
|
+
If the `data` parameter is an `array` it used as value of a `data.items` options.
|
|
776
776
|
|
|
777
|
-
Note that each element of a `
|
|
777
|
+
Note that each element of a `data.items` can be:
|
|
778
778
|
|
|
779
779
|
- an `array` which contains a `key-value` pair
|
|
780
780
|
|
|
@@ -788,7 +788,7 @@ If the `options` parameter is an `object` that contains the following set of par
|
|
|
788
788
|
|
|
789
789
|
| option name | value type | default value | description |
|
|
790
790
|
|:---|---|---:|:---|
|
|
791
|
-
| `defaultItem` | `string` | --- | if set it defines a name of the item used by default |
|
|
791
|
+
| `defaultItem` | `string` | --- | (*deprecated **since `v0.0.26`***) if set it defines a name of the item used by default |
|
|
792
792
|
| `useClear` | `boolean` | `true` | if set to `true`, before the load of the items, the list is cleared |
|
|
793
793
|
| `force` | `boolean` | `false` | if set to `true`, the item which is already present will be replaced with a new one |
|
|
794
794
|
|
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
|
|
|
@@ -27,6 +27,7 @@ const components = {
|
|
|
27
27
|
|
|
28
28
|
const eventHelper = {
|
|
29
29
|
pushEventHandler: ev_helper.pushEventHandler,
|
|
30
|
+
removeEventHandler: ev_helper.removeEventHandler,
|
|
30
31
|
triggerEventHandler: ev_helper.triggerEventHandler,
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -70,8 +71,8 @@ module.exports.readAsAttrName = html_helper.readAsAttrName;
|
|
|
70
71
|
module.exports.readAsAttrValue = html_helper.readAsAttrValue;
|
|
71
72
|
module.exports.valueToElementID = html_helper.valueToElementID;
|
|
72
73
|
module.exports.createNewHTMLElement = html_helper.createNewHTMLElement;
|
|
74
|
+
module.exports.isHTMLButton = html_helper.isHTMLButton;
|
|
73
75
|
|
|
74
|
-
module.exports.isHTMLButton = html_bts.isHTMLButton;
|
|
75
76
|
|
|
76
77
|
module.exports.THtmlInputField = html_flds.THtmlInputField;
|
|
77
78
|
|
package/lib/event-hfunc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.063-20250503]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @function pushEventHandler
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {Map<string, Function>} pool - pool object
|
|
20
20
|
* @param {string} name - event name
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {Function} evnt - callback function
|
|
22
22
|
* @returns {void}
|
|
23
23
|
* @inner
|
|
24
24
|
*/
|
|
25
|
-
function pushEventHandler(pool, name, evnt){
|
|
25
|
+
function pushEventHandler(pool, name, evnt) {
|
|
26
26
|
const _name = typeof name === 'string' ? name.trim() : '';
|
|
27
27
|
if (_name !== '' && typeof evnt === 'function') {
|
|
28
28
|
if (!pool.has(_name)) {
|
|
@@ -35,15 +35,32 @@ function pushEventHandler(pool, name, evnt){
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @function removeEventHandler
|
|
40
|
+
* @param {Map<string, Function>} pool - pool object
|
|
41
|
+
* @param {string} name - event name
|
|
42
|
+
* @returns {void}
|
|
43
|
+
* @inner
|
|
44
|
+
*/
|
|
45
|
+
function removeEventHandler(pool, name) {
|
|
46
|
+
const key = typeof name === 'string' ? name.trim() : '';
|
|
47
|
+
if (key !== '') {
|
|
48
|
+
/* NOTE:
|
|
49
|
+
* for current you can't reset or set new one on the same event
|
|
50
|
+
*/
|
|
51
|
+
if (pool.has(key)) pool.delete(key);
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
38
55
|
/**
|
|
39
56
|
* @function triggerEventHandler
|
|
40
|
-
* @param {
|
|
57
|
+
* @param {Map<string, Function>} pool - pool object
|
|
41
58
|
* @param {string} name - event name
|
|
42
59
|
* @param {...any} [args]
|
|
43
60
|
* @returns {void}
|
|
44
61
|
* @inner
|
|
45
62
|
*/
|
|
46
|
-
function triggerEventHandler(pool, name, ...args){
|
|
63
|
+
function triggerEventHandler(pool, name, ...args) {
|
|
47
64
|
const _name = typeof name === 'string' ? name.trim() : '';
|
|
48
65
|
if (_name !== '') {
|
|
49
66
|
if (pool.has(_name)) pool.get(_name)(...args);
|
|
@@ -56,5 +73,6 @@ function triggerEventHandler(pool, name, ...args){
|
|
|
56
73
|
|
|
57
74
|
// === module exports block ===
|
|
58
75
|
|
|
59
|
-
exports.pushEventHandler = pushEventHandler;
|
|
60
|
-
exports.triggerEventHandler = triggerEventHandler;
|
|
76
|
+
module.exports.pushEventHandler = pushEventHandler;
|
|
77
|
+
module.exports.triggerEventHandler = triggerEventHandler;
|
|
78
|
+
module.exports.removeEventHandler = removeEventHandler;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.064-20250827]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
isNotEmptyString,
|
|
7
7
|
isPlainObject, valueToArray,
|
|
8
|
-
//TItemsICollection,
|
|
9
8
|
} = require('@ygracs/bsfoc-lib-js');
|
|
10
9
|
|
|
11
10
|
const {
|
|
12
11
|
TItemsICollection,
|
|
13
|
-
} = require('@ygracs/
|
|
12
|
+
} = require('@ygracs/lists-lib-js');
|
|
14
13
|
|
|
15
14
|
const {
|
|
16
|
-
isHTMLElement,
|
|
15
|
+
isHTMLElement, isHTMLButton,
|
|
17
16
|
valueToIDString,
|
|
18
17
|
lockHTMLElement, unlockHTMLElement,
|
|
19
18
|
CSS_CLASS_STRING,
|
|
@@ -25,15 +24,9 @@ const {
|
|
|
25
24
|
} = require('./mod-hfunc.js');
|
|
26
25
|
|
|
27
26
|
const {
|
|
28
|
-
//CSS_CLASS_SELECTED,
|
|
29
27
|
CSS_CLASS_DISABLED,
|
|
30
|
-
//CSS_CLASS_HIDDEN,
|
|
31
28
|
} = CSS_CLASS_STRING;
|
|
32
29
|
|
|
33
|
-
const etlHTagInputForBtn = new Set([
|
|
34
|
-
'button', 'submit', 'reset', 'image',
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
30
|
// === module extra block (helper functions) ===
|
|
38
31
|
|
|
39
32
|
// === module main block ===
|
|
@@ -48,32 +41,6 @@ const BTS_DEF_GROUP_NAME = 'all';
|
|
|
48
41
|
* (* function definitions *)
|
|
49
42
|
*/
|
|
50
43
|
|
|
51
|
-
/**
|
|
52
|
-
* @function isHTMLButton
|
|
53
|
-
* @param {any} obj - element to be verified
|
|
54
|
-
* @returns {boolean}
|
|
55
|
-
* @description Checks if the given object is an HTML-button.
|
|
56
|
-
*/
|
|
57
|
-
function isHTMLButton(obj) {
|
|
58
|
-
let result = false;
|
|
59
|
-
if (isHTMLElement(obj)) {
|
|
60
|
-
switch (obj.tagName.toLowerCase()) {
|
|
61
|
-
case 'button': {
|
|
62
|
-
result = true;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case 'input': {
|
|
66
|
-
result = etlHTagInputForBtn.has(obj.type.toLowerCase());
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
default: {
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
44
|
/***
|
|
78
45
|
* (* class definitions *)
|
|
79
46
|
*/
|
|
@@ -86,7 +53,7 @@ class THtmlButtonsSet {
|
|
|
86
53
|
#_btnCol;
|
|
87
54
|
|
|
88
55
|
/**
|
|
89
|
-
*
|
|
56
|
+
* Creates an instance of a buttons set
|
|
90
57
|
*/
|
|
91
58
|
constructor() {
|
|
92
59
|
// define default functions for manipulators
|
|
@@ -127,133 +94,133 @@ class THtmlButtonsSet {
|
|
|
127
94
|
}
|
|
128
95
|
|
|
129
96
|
/**
|
|
97
|
+
* Checks whether a target item with a given name exists.
|
|
130
98
|
* @param {string} name - element name
|
|
131
99
|
* @returns {boolean}
|
|
132
100
|
* @see TItemsICollection.hasItem
|
|
133
|
-
* @description Checks whether a target item with a given name exists.
|
|
134
101
|
*/
|
|
135
102
|
hasItem(name) {
|
|
136
103
|
return this.#_btnCol.hasItem(name);
|
|
137
104
|
}
|
|
138
105
|
|
|
139
106
|
/**
|
|
107
|
+
* Adds buttons to a set members.
|
|
140
108
|
* @param {string} name - element name
|
|
141
109
|
* @param {any} item - element
|
|
142
110
|
* @param {...string} [group] - name of a target groups
|
|
143
111
|
* @returns {boolean}
|
|
144
112
|
* @see TItemsICollection.addItem
|
|
145
|
-
* @description Adds buttons to a set members.
|
|
146
113
|
*/
|
|
147
114
|
addItem(...args) {
|
|
148
115
|
return this.#_btnCol.addItem(...args);
|
|
149
116
|
}
|
|
150
117
|
|
|
151
118
|
/**
|
|
119
|
+
* Adds button to a listed groups.
|
|
152
120
|
* @param {string} name - element name
|
|
153
121
|
* @param {...string} [group] - name of a target groups
|
|
154
122
|
* @returns {boolean}
|
|
155
123
|
* @see TItemsICollection.addItemToCategory
|
|
156
|
-
* @description Adds button to a listed groups.
|
|
157
124
|
*/
|
|
158
125
|
addItemToGroup(...args) {
|
|
159
126
|
return this.#_btnCol.addItemToCategory(...args);
|
|
160
127
|
}
|
|
161
128
|
|
|
162
129
|
/**
|
|
130
|
+
* Deletes button from a set members.
|
|
163
131
|
* @param {string} name - element name
|
|
164
132
|
* @returns {boolean}
|
|
165
133
|
* @see TItemsICollection.delItem
|
|
166
|
-
* @description Deletes button from a set members.
|
|
167
134
|
*/
|
|
168
135
|
delItem(name) {
|
|
169
136
|
return this.#_btnCol.delItem(name);
|
|
170
137
|
}
|
|
171
138
|
|
|
172
139
|
/**
|
|
140
|
+
* Deletes button from a listed groups.
|
|
173
141
|
* @param {string} name - element name
|
|
174
142
|
* @param {...string} [group] - name of a target groups
|
|
175
143
|
* @returns {boolean}
|
|
176
144
|
* @see TItemsICollection.delItemFromGroup
|
|
177
|
-
* @description Deletes button from a listed groups.
|
|
178
145
|
*/
|
|
179
146
|
delItemFromGroup(...args) {
|
|
180
147
|
return this.#_btnCol.delItemFromGroup(...args);
|
|
181
148
|
}
|
|
182
149
|
|
|
183
150
|
/**
|
|
151
|
+
* Renames button in a set.
|
|
184
152
|
* @param {string} name - old name
|
|
185
153
|
* @param {string} value - new name
|
|
186
154
|
* @returns {boolean}
|
|
187
155
|
* @see TItemsICollection.renameItem
|
|
188
|
-
* @description Renames button in a set.
|
|
189
156
|
*/
|
|
190
157
|
renameItem(name, value) {
|
|
191
158
|
return this.#_btnCol.renameItem(name, value, false);
|
|
192
159
|
}
|
|
193
160
|
|
|
194
161
|
/**
|
|
162
|
+
* Tries to enable button.
|
|
195
163
|
* @param {string} name - element name
|
|
196
164
|
* @returns {void}
|
|
197
|
-
* @description Tries to enable button.
|
|
198
165
|
*/
|
|
199
166
|
enableItem(name) {
|
|
200
167
|
unlockHTMLElement(this.#_btnCol.getItem(name));
|
|
201
168
|
}
|
|
202
169
|
|
|
203
170
|
/**
|
|
171
|
+
* Tries to disable button.
|
|
204
172
|
* @param {string} name - element name
|
|
205
173
|
* @returns {void}
|
|
206
|
-
* @description Tries to disable button.
|
|
207
174
|
*/
|
|
208
175
|
disableItem(name) {
|
|
209
176
|
lockHTMLElement(this.#_btnCol.getItem(name));
|
|
210
177
|
}
|
|
211
178
|
|
|
212
179
|
/**
|
|
180
|
+
* Checks whether a target group with a given name exists.
|
|
213
181
|
* @param {string} name - group name
|
|
214
182
|
* @returns {boolean}
|
|
215
183
|
* @see TItemsICollection.hasCategory
|
|
216
|
-
* @description Checks whether a target group with a given name exists.
|
|
217
184
|
*/
|
|
218
185
|
hasGroup(name) {
|
|
219
186
|
return this.#_btnCol.hasCategory(name);
|
|
220
187
|
}
|
|
221
188
|
|
|
222
189
|
/**
|
|
190
|
+
* Adds a group with a given name.
|
|
223
191
|
* @param {string} name - group name
|
|
224
192
|
* @returns {boolean}
|
|
225
193
|
* @see TItemsICollection.addCategory
|
|
226
|
-
* @description Adds a group with a given name.
|
|
227
194
|
*/
|
|
228
195
|
addGroup(name) {
|
|
229
196
|
return this.#_btnCol.addCategory(name);
|
|
230
197
|
}
|
|
231
198
|
|
|
232
199
|
/**
|
|
200
|
+
* Deletes a group with a given name.
|
|
233
201
|
* @param {string} name - group name
|
|
234
202
|
* @returns {boolean}
|
|
235
203
|
* @see TItemsICollection.delCategory
|
|
236
|
-
* @description Deletes a group with a given name.
|
|
237
204
|
*/
|
|
238
205
|
delGroup(name) {
|
|
239
206
|
return this.#_btnCol.delCategory(name);
|
|
240
207
|
}
|
|
241
208
|
|
|
242
209
|
/**
|
|
210
|
+
* Renames group in a set.
|
|
243
211
|
* @param {string} name - old name
|
|
244
212
|
* @param {string} value - new name
|
|
245
213
|
* @returns {boolean}
|
|
246
214
|
* @see TItemsICollection.renameCategory
|
|
247
|
-
* @description Renames group in a set.
|
|
248
215
|
*/
|
|
249
216
|
renameGroup(name, value) {
|
|
250
217
|
return this.#_btnCol.renameCategory(name, value, false);
|
|
251
218
|
}
|
|
252
219
|
|
|
253
220
|
/**
|
|
221
|
+
* Enables all buttons in a given group.
|
|
254
222
|
* @param {string} value - group name
|
|
255
223
|
* @returns {void}
|
|
256
|
-
* @description Enables all buttons in a given group.
|
|
257
224
|
*/
|
|
258
225
|
enableGroup(value) {
|
|
259
226
|
const group = this.#_btnCol.getCategory(value);
|
|
@@ -261,9 +228,9 @@ class THtmlButtonsSet {
|
|
|
261
228
|
}
|
|
262
229
|
|
|
263
230
|
/**
|
|
231
|
+
* Disables all buttons in a given group.
|
|
264
232
|
* @param {string} value - group name
|
|
265
233
|
* @returns {void}
|
|
266
|
-
* @description Disables all buttons in a given group.
|
|
267
234
|
*/
|
|
268
235
|
disableGroup(value) {
|
|
269
236
|
const group = this.#_btnCol.getCategory(value);
|
|
@@ -281,6 +248,14 @@ class THtmlButtonsSet {
|
|
|
281
248
|
|
|
282
249
|
};
|
|
283
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
|
+
|
|
284
259
|
/**
|
|
285
260
|
* @classdesc This class implements an interface of a pre-defined buttons set.
|
|
286
261
|
* A set provide a three button: <apply>, <reset> and <cancel>.
|
|
@@ -292,27 +267,17 @@ class THtmlButtonsControllerARCSet {
|
|
|
292
267
|
#_events;
|
|
293
268
|
|
|
294
269
|
/**
|
|
295
|
-
*
|
|
296
|
-
* @property {?HTMLElement} btnApply - button 'apply'
|
|
297
|
-
* @property {?HTMLElement} btnReset - button 'reset'
|
|
298
|
-
* @property {?HTMLElement} btnCancel - button 'cancel'
|
|
299
|
-
* @description A description for ARC-buttons set.
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
/**
|
|
270
|
+
* Creates an instance of the buttons set.
|
|
303
271
|
* @param {arcButtonsDesc} opt - an option
|
|
304
|
-
* @description Creates an instance of the buttons set.
|
|
305
272
|
*/
|
|
306
273
|
constructor(opt) {
|
|
307
|
-
// load options
|
|
308
|
-
const _options = isPlainObject(opt) ? opt : {};
|
|
309
274
|
// load controls
|
|
310
275
|
/** @type {arcButtonsDesc} */
|
|
311
276
|
let {
|
|
312
277
|
btnApply,
|
|
313
278
|
btnReset,
|
|
314
279
|
btnCancel,
|
|
315
|
-
} =
|
|
280
|
+
} = isPlainObject(opt) ? opt : {};
|
|
316
281
|
if (!isHTMLButton(btnApply)) btnApply = null;
|
|
317
282
|
if (!isHTMLButton(btnReset)) btnReset = null;
|
|
318
283
|
if (!isHTMLButton(btnCancel)) btnCancel = null;
|
|
@@ -369,42 +334,42 @@ class THtmlButtonsControllerARCSet {
|
|
|
369
334
|
}
|
|
370
335
|
|
|
371
336
|
/**
|
|
337
|
+
* Disables all buttons in 'main' group.
|
|
372
338
|
* @returns {void}
|
|
373
|
-
* @description Disables all buttons in 'main' group.
|
|
374
339
|
*/
|
|
375
340
|
disableMain() {
|
|
376
341
|
this.#_btnSet.disableGroup('main');
|
|
377
342
|
}
|
|
378
343
|
|
|
379
344
|
/**
|
|
345
|
+
* Enables all buttons in 'main' group.
|
|
380
346
|
* @returns {void}
|
|
381
|
-
* @description Enables all buttons in 'main' group.
|
|
382
347
|
*/
|
|
383
348
|
enableMain() {
|
|
384
349
|
this.#_btnSet.enableGroup('main');
|
|
385
350
|
}
|
|
386
351
|
|
|
387
352
|
/**
|
|
353
|
+
* Disables all buttons.
|
|
388
354
|
* @returns {void}
|
|
389
|
-
* @description Disables all buttons.
|
|
390
355
|
*/
|
|
391
356
|
disableAll() {
|
|
392
357
|
this.#_btnSet.disableGroup('all');
|
|
393
358
|
}
|
|
394
359
|
|
|
395
360
|
/**
|
|
361
|
+
* Enables all buttons.
|
|
396
362
|
* @returns {void}
|
|
397
|
-
* @description Enables all buttons.
|
|
398
363
|
*/
|
|
399
364
|
enableAll() {
|
|
400
365
|
this.#_btnSet.enableGroup('all');
|
|
401
366
|
}
|
|
402
367
|
|
|
403
368
|
/**
|
|
369
|
+
* Sets a callback function to handle event.
|
|
404
370
|
* @param {string} name - event name
|
|
405
371
|
* @param {func} evnt - a callback function
|
|
406
372
|
* @returns {void}
|
|
407
|
-
* @description Sets a callback function to handle event.
|
|
408
373
|
*/
|
|
409
374
|
on(name, evnt) {
|
|
410
375
|
pushEventHandler(this.#_events, name, evnt);
|
|
@@ -413,9 +378,9 @@ class THtmlButtonsControllerARCSet {
|
|
|
413
378
|
|
|
414
379
|
// === module exports block ===
|
|
415
380
|
|
|
416
|
-
exports.THtmlButtonsSet = THtmlButtonsSet;
|
|
417
|
-
exports.THtmlButtonsControllerARCSet = THtmlButtonsControllerARCSet;
|
|
381
|
+
module.exports.THtmlButtonsSet = THtmlButtonsSet;
|
|
382
|
+
module.exports.THtmlButtonsControllerARCSet = THtmlButtonsControllerARCSet;
|
|
418
383
|
|
|
419
|
-
exports.BTS_DEF_GROUP_NAME = BTS_DEF_GROUP_NAME;
|
|
384
|
+
module.exports.BTS_DEF_GROUP_NAME = BTS_DEF_GROUP_NAME;
|
|
420
385
|
|
|
421
|
-
exports.isHTMLButton = isHTMLButton;
|
|
386
|
+
module.exports.isHTMLButton = isHTMLButton;
|