@cntwg/html-helper 0.0.19 → 0.0.21

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 CHANGED
@@ -1,3 +1,23 @@
1
+ #### *v0.0.21*
2
+
3
+ Pre-release version.
4
+
5
+ > - `html-ctrls-list.md` updated;
6
+ > - `html-ctrls-fields.md` updated;
7
+ > - `html-ctrls-btn.md` updated;
8
+ > - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.2.1;
9
+ > - remove some deprecates (*see docs for details*);
10
+ > - change behavior for `loadItems` method of `THtmlStubItemsSet` class in handling `options` parameter (*see docs for details*);
11
+ > - added 'components' property for module exports;
12
+ > - some other fixes.
13
+
14
+ #### *v0.0.20*
15
+
16
+ Pre-release version.
17
+
18
+ > - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.4;
19
+ > - some fixes in `html-helper-lib.js` module.
20
+
1
21
  #### *v0.0.19*
2
22
 
3
23
  Pre-release version.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2023 Yuri Grachev
3
+ Copyright (c) 2019-2024 Yuri Grachev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,41 +1,42 @@
1
- >|***rev.*:**|0.1.4|
1
+ >|***rev.*:**|0.1.5|
2
2
  >|:---|---:|
3
- >|date:|2023-06-29|
3
+ >|date:|2024-07-13|
4
4
 
5
5
  ## Introduction
6
6
 
7
7
  This module provide a base set of helpers for javascript. So your work can run a bit easy by using it when you deal with HTML-forms.
8
8
 
9
- ## Use cases
10
-
11
- This module was make for use as a library in a development of a Web-apps based on [Electron](https://en.wikipedia.org/wiki/Electron_(software_framework)) as main target.
12
-
13
- ### Installation
14
-
15
- `npm install @cntwg/html-helper`
16
-
17
9
  ## Description
18
10
 
19
11
  This module contains the following components:
20
12
 
21
- - base helper module which provided a set of constants and functions usefull for some manipulation with HTML-elements.
13
+ - base helper module which provided a set of constants and functions useful for some manipulation with HTML-elements.
22
14
 
23
15
  > *For more details see `html-helper.md` in module `doc` directory*.
24
16
 
25
- - class `THtmlButtonsSet`,
26
- - class `THtmlListButtonsController`,
27
- - class `THtmlButtonsControllerARCSet`.
17
+ - classes for working with instances maintaining a buttons set support such as:
18
+ - `THtmlButtonsSet`,
19
+ - `THtmlListButtonsController`,
20
+ - `THtmlButtonsControllerARCSet`.
28
21
 
29
22
  > *For more details see `html-ctrls-btn.md` in module `doc` directory*.
30
23
 
31
- - classes for working with HTML-elements maintaining a lists support such as:
24
+ - classes for working with instances maintaining a lists support such as:
32
25
  - `THtmlItemsListContainer`,
33
26
  - `THtmlItemsListController`,
34
27
  - `THtmlStubItemsSet`.
35
28
 
36
29
  > *For more details see `html-ctrls-list.md` in module `doc` directory*.
37
30
 
38
- - classes for working with HTML-elements maintaining an input fields support such as:
31
+ - classes for working with instances maintaining an input fields support such as:
39
32
  - `THtmlInputField` (experimental, beta stage).
40
33
 
41
34
  > *For more details see `html-ctrls-fields.md` in module `doc` directory*.
35
+
36
+ ## Use cases
37
+
38
+ This module was make for use as a library in a development of a Web-apps based on [Electron](https://en.wikipedia.org/wiki/Electron_(software_framework)) as main target.
39
+
40
+ ### Installation
41
+
42
+ `npm install @cntwg/html-helper`
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.1.9|
1
+ >|***rev.*:**|0.1.11|
2
2
  >|:---|---:|
3
- >|date:|2023-07-04|
3
+ >|date:|2024-07-13|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -22,7 +22,11 @@ This class provide a manageable collection which used to group buttons placed on
22
22
 
23
23
  #### class constructor
24
24
 
25
- The class constructor creates a new instance of the class. No arguments is receives by it.
25
+ The class constructor creates a new instance of the class.
26
+
27
+ ##### constructor parameters
28
+
29
+ The class constructor receives no arguments.
26
30
 
27
31
  #### class properties
28
32
 
@@ -103,19 +107,18 @@ This class provide a buttons controller to use with a list components to perform
103
107
 
104
108
  #### class constructor
105
109
 
106
- The class constructor creates a new instance of the class. It receives an `options` parameter which structure has listed below:
110
+ The class constructor creates a new instance of the class.
111
+
112
+ ##### constructor parameters
113
+
114
+ The class constructor receives an `options` parameter which structure has listed below:
107
115
 
108
116
  |option name|option type|default value|description|
109
117
  |:---|---|---:|:---|
110
118
  |`btnFirst`|`HTMLElement`|---|define HTML-button which will select the first element|
111
- |`btn_frst`|`HTMLElement`|---|\<*deprecate*> *(use `btnFirst` instead)*|
112
119
  |`btnPrev`|`HTMLElement`|---|define HTML-button which will select the previous element|
113
- |`btn_prev`|`HTMLElement`|---|\<*deprecate*> *(use `btnPrev` instead)*|
114
120
  |`btnNext`|`HTMLElement`|---|define HTML-button which will select the next element|
115
- |`btn_next`|`HTMLElement`|---|\<*deprecate*> *(use `btnNext` instead)*|
116
121
  |`btnLast`|`HTMLElement`|---|define HTML-button which will select the last element|
117
- |`btn_last`|`HTMLElement`|---|\<*deprecate*> *(use `btnLast` instead)*|
118
-
119
122
 
120
123
  #### class properties
121
124
 
@@ -172,7 +175,11 @@ This class provide a buttons controller to use with a form components to perform
172
175
 
173
176
  #### class constructor
174
177
 
175
- The class constructor creates a new instance of the class. It receives an `options` parameter which structure has listed below:
178
+ The class constructor creates a new instance of the class.
179
+
180
+ ##### constructor parameters
181
+
182
+ The class constructor receives an `options` parameter which structure has listed below:
176
183
 
177
184
  |option name|option type|default value|description|
178
185
  |:---|---|---:|:---|
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.0.4|
1
+ >|***rev.*:**|0.0.5|
2
2
  >|:---|---:|
3
- >|date:|2023-07-04|
3
+ >|date:|2023-10-05|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -14,7 +14,11 @@ This class provide a container useful when dealing with an elements such an inpu
14
14
 
15
15
  #### class constructor
16
16
 
17
- The class constructor creates a new instance of the class. It receives a parameters listed below:
17
+ The class constructor creates a new instance of the class.
18
+
19
+ ##### constructor parameters
20
+
21
+ The class constructor receives a parameters listed below:
18
22
 
19
23
  |parameter name|value type|default value|description|
20
24
  |:---|---|---:|:---|
@@ -22,6 +26,8 @@ The class constructor creates a new instance of the class. It receives a paramet
22
26
  |`eholds`|`object`|---|contains ref-list for container elements|
23
27
  |`options`|`object`|---|contains a container settings|
24
28
 
29
+ ##### `eholds` parameter
30
+
25
31
  The `eholds` structure has listed below:
26
32
 
27
33
  |parameter name|value type|default value|description|
@@ -30,6 +36,8 @@ The `eholds` structure has listed below:
30
36
  |`label`|`HTMLElement`|---|points to a label item|
31
37
  |`field`|`HTMLElement`|---|points to a field item|
32
38
 
39
+ ##### `options` parameter
40
+
33
41
  The `options` structure has listed below:
34
42
 
35
43
  |option name|value type|default value|description|
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.1.15|
1
+ >|***rev.*:**|0.1.18|
2
2
  >|:---|---:|
3
- >|date:|2023-07-04|
3
+ >|date:|2023-11-19|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -14,13 +14,19 @@ This class provide a base container useful when dealing with a list elements pla
14
14
 
15
15
  #### class constructor
16
16
 
17
- The class constructor creates a new instance of the class. It receives a parameters listed below:
17
+ The class constructor creates a new instance of the class.
18
+
19
+ ##### constructor parameters
20
+
21
+ The class constructor receives a parameters listed below:
18
22
 
19
23
  |parameter name|value type|default value|description|
20
24
  |:---|---|---:|:---|
21
25
  |`host`|`HTMLElement`|`undefined`|points to a host element which holds a list items|
22
26
  |`options`|`object`|---|contains a container settings|
23
27
 
28
+ ##### `options` parameter
29
+
24
30
  The `options` structure has listed below:
25
31
 
26
32
  |option name|value type|default value|description|
@@ -153,13 +159,19 @@ This class implements a controller that provide mechanism for managing a list co
153
159
 
154
160
  #### class constructor
155
161
 
156
- The class constructor creates a new instance of the class. It receives a parameters listed below:
162
+ The class constructor creates a new instance of the class.
163
+
164
+ ##### constructor parameters
165
+
166
+ The class constructor receives a parameters listed below:
157
167
 
158
168
  |parameter name|value type|default value|description|
159
169
  |:---|---|---:|:---|
160
170
  |`host`|`HTMLElement`|`undefined`|points to a host element which holds a list items|
161
171
  |`options`|`object`|---|contains a set of a settings for a container|
162
172
 
173
+ ##### `options` parameter
174
+
163
175
  The `options` structure has listed below:
164
176
 
165
177
  |option name|value type|default value|description|
@@ -169,7 +181,7 @@ The `options` structure has listed below:
169
181
  |`itemBaseClassID`|`array`|---|for details see options on `THtmlItemsListContainer` class constructor section|
170
182
  |`showStubsIfEmpty`|`boolean`|`false`|if set, in case of the empty list, the default stub-item will be displayed|
171
183
  |`allowGroupSelection`|`boolean`|`false`|if set the more than one element can be selected in the list|
172
- |`allowSelectionLocks`|`boolean`|`false`|<*reserved, experimental*>|
184
+ |`allowSelectionLocks`|`boolean`|`false`|\<*reserved, experimental*>|
173
185
 
174
186
  #### class properties
175
187
 
@@ -311,12 +323,26 @@ This class implements a controller that provide mechanism for managing a so-call
311
323
 
312
324
  #### class constructor
313
325
 
314
- The class constructor creates a new instance of the class. It receives a parameters listed below:
326
+ The class constructor creates a new instance of the class.
327
+
328
+ ##### constructor parameters
329
+
330
+ The class constructor receives a parameters listed below:
315
331
 
316
332
  |parameter name|value type|default value|description|
317
333
  |:---|---|---:|:---|
318
334
  |`host`|`HTMLElement`|---|points to a host element which holds a list items|
319
- |`items`|`object` or `array`|`undefined`|contains an object that is send to a class `loadItems` method|
335
+ |`options`|`object` or `array`|`undefined`|contains an object that is send to a class `loadItems` method|
336
+
337
+ ##### `options` parameter
338
+
339
+ The `options` structure has listed below:
340
+
341
+ |option name|value type|default value|description|
342
+ |:---|---|---:|:---|
343
+ |`items`|`array`|`undefined`|defines a list of the items to load|
344
+ |`defaultItem`|`string`|EMPTY_STRING|if set it defines a name of the item used by default|
345
+ |`force`|`boolean`|`false`|if set to `true`, the item which is already present will be replaced with a new one|
320
346
 
321
347
  #### class properties
322
348
 
@@ -409,7 +435,6 @@ The `options` parameter is an `object` that contains the following set of parame
409
435
  |option name|value type|default value|description|
410
436
  |:---|---|---:|:---|
411
437
  |`useClear`|`boolean`|`true`|if set to `true`, before the load of the items, the list is cleared|
412
- |`load_as_new`|`boolean`|`true`|\<*deprecate*> *(use `useClear` instead)*|
413
438
  |`force`|`boolean`|`false`|if set to `true`, the item which is already present will be replaced with a new one|
414
439
 
415
440
  If the `options` parameter is a `boolean` value it treats as a `options.useClear` option.
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.1.8|
1
+ >|***rev.*:**|0.1.11|
2
2
  >|:---|---:|
3
- >|date:|2023-06-12|
3
+ >|date:|2023-07-13|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -76,10 +76,14 @@ This function removes the class attribute defined by `CSS_CLASS_CURRENT` for a g
76
76
 
77
77
  #### **unlockHtmlElement(object)**
78
78
 
79
+ > since: `v0.0.19`
80
+
79
81
  This function enables a given HTML-element.
80
82
 
81
83
  #### **lockHtmlElement(args)**
82
84
 
85
+ > since: `v0.0.19`
86
+
83
87
  This function disables a given HTML-element.
84
88
 
85
89
  #### **activateHtmlElements(args)**
@@ -118,8 +122,7 @@ The `options` structure has listed below:
118
122
  |`id`|`string`|`undefined`|defines ID-attribute of an element|
119
123
  |`text`|`string`|`undefined`|defines a text context of an element|
120
124
  |`attr`|---|`undefined`|defines an attributes of an element|
121
- |`class`|---|`undefined`|\<deprecate> (*use `classNames` instead*)|
122
- |`classNames`|---|`undefined`|defines a class-attributes of an element|
125
+ |`classNames`|---|`undefined`|defines a class-attributes of an element (*`since: v0.0.19`*)|
123
126
  |`data`|---|`undefined`|defines a data-attributes of an element|
124
127
 
125
128
  If succeed, the function returned `HTMLElement` and `null` if failed.
@@ -130,6 +133,18 @@ This function make all the jobs under the hood. So there is no need to call DOM-
130
133
 
131
134
  This function tries to convert a given `value` to `ID_STRING`. If failed an empty string is returned.
132
135
 
136
+ #### **readAsTagName(value)**
137
+
138
+ > since: `v0.0.21`
139
+
140
+ 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
+
142
+ #### **readAsAttrName(value)**
143
+
144
+ > since: `v0.0.21`
145
+
146
+ 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
+
133
148
  #### **readAsAttrValue(value)**
134
149
 
135
150
  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.
package/index.js CHANGED
@@ -1,67 +1,74 @@
1
- // [v0.1.018-20230629]
1
+ // [v0.1.019-20240713]
2
2
 
3
3
  // === module init block ===
4
4
 
5
5
  const html_helper = require('./lib/html-helper-lib.js');
6
6
  const html_list = require('./lib/html-ctrls/list.js');
7
+ const html_list_btn = require('./lib/html-ctrls/lists-btn.js');
7
8
  const html_bts = require('./lib/html-ctrls/buttons.js');
8
9
  const html_flds = require('./lib/html-ctrls/fields.js');
9
10
 
10
- const html_list_btn = require('./lib/html-ctrls/lists-btn.js');
11
11
 
12
12
  // === module extra block (helper functions) ===
13
13
 
14
14
  // === module main block ===
15
15
 
16
+ const components = {
17
+ THtmlStubItemsSet: html_list.THtmlStubItemsSet,
18
+ THtmlItemsListContainer: html_list.THtmlItemsListContainer,
19
+ THtmlItemsListController: html_list.THtmlItemsListController,
20
+ THtmlButtonsSet: html_bts.THtmlButtonsSet,
21
+ THtmlButtonsControllerARCSet: html_bts.THtmlButtonsControllerARCSet,
22
+ THtmlListButtonsController: html_list_btn.THtmlListButtonsController,
23
+ // experimental
24
+ THtmlInputField: html_flds.THtmlInputField,
25
+ };
26
+
16
27
  // === module exports block ===
17
28
 
18
- exports.CSS_CLASS_STRING = html_helper.CSS_CLASS_STRING;
19
- exports.isHTMLElement = html_helper.isHTMLElement;
20
- exports.isCurrentHTMLElement = html_helper.isCurrentHTMLElement;
21
- exports.isSelectedHTMLElement = html_helper.isSelectedHTMLElement;
22
- exports.isActiveHTMLElement = html_helper.isActiveHTMLElement;
23
- exports.isHiddenHTMLElement = html_helper.isHiddenHTMLElement;
24
- exports.showHtmlElement = html_helper.showHtmlElement;
25
- exports.hideHtmlElement = html_helper.hideHtmlElement;
26
- exports.selectHtmlElement = html_helper.selectHtmlElement;
27
- exports.unselectHtmlElement = html_helper.unselectHtmlElement;
28
- exports.markHtmlElementAsCurrent = html_helper.markHtmlElementAsCurrent;
29
- exports.unmarkCurrentHtmlElement = html_helper.unmarkCurrentHtmlElement;
30
- exports.markHtmlElementAsActive = html_helper.markHtmlElementAsActive;
31
- exports.unmarkActiveHtmlElement = html_helper.unmarkActiveHtmlElement;
32
- exports.lockHtmlElement = html_helper.lockHtmlElement;
33
- exports.unlockHtmlElement = html_helper.unlockHtmlElement;
34
- exports.activateHtmlElements = html_helper.activateHtmlElements;
35
- exports.inactivateHtmlElements = html_helper.inactivateHtmlElements;
36
- exports.valueToClassList = html_helper.valueToClassList;
37
-
38
- exports.THtmlStubItemsSet = html_list.THtmlStubItemsSet;
39
- exports.THtmlItemsListContainer = html_list.THtmlItemsListContainer;
40
- exports.THtmlItemsListController = html_list.THtmlItemsListController;
41
-
42
- exports.THtmlButtonsSet = html_bts.THtmlButtonsSet;
43
- exports.THtmlButtonsControllerARCSet = html_bts.THtmlButtonsControllerARCSet;
44
- exports.BTS_DEF_GROUP_NAME = html_bts.BTS_DEF_GROUP_NAME;
29
+ module.exports.CSS_CLASS_STRING = html_helper.CSS_CLASS_STRING;
30
+ module.exports.isHTMLElement = html_helper.isHTMLElement;
31
+ module.exports.isSelectedHTMLElement = html_helper.isSelectedHTMLElement;
32
+ module.exports.isCurrentHTMLElement = html_helper.isCurrentHTMLElement;
33
+ module.exports.isActiveHTMLElement = html_helper.isActiveHTMLElement;
34
+ module.exports.isHiddenHTMLElement = html_helper.isHiddenHTMLElement;
35
+ module.exports.hideHtmlElement = html_helper.hideHtmlElement;
36
+ module.exports.showHtmlElement = html_helper.showHtmlElement;
37
+ module.exports.selectHtmlElement = html_helper.selectHtmlElement;
38
+ module.exports.unselectHtmlElement = html_helper.unselectHtmlElement;
39
+ module.exports.markHtmlElementAsCurrent = html_helper.markHtmlElementAsCurrent;
40
+ module.exports.unmarkCurrentHtmlElement = html_helper.unmarkCurrentHtmlElement;
41
+ module.exports.markHtmlElementAsActive = html_helper.markHtmlElementAsActive;
42
+ module.exports.unmarkActiveHtmlElement = html_helper.unmarkActiveHtmlElement;
43
+ module.exports.lockHtmlElement = html_helper.lockHtmlElement;
44
+ module.exports.unlockHtmlElement = html_helper.unlockHtmlElement;
45
+ module.exports.inactivateHtmlElements = html_helper.inactivateHtmlElements;
46
+ module.exports.activateHtmlElements = html_helper.activateHtmlElements;
47
+ module.exports.valueToClassList = html_helper.valueToClassList;
45
48
 
46
- // experimental
47
- exports.THtmlInputField = html_flds.THtmlInputField;
49
+ module.exports.THtmlStubItemsSet = html_list.THtmlStubItemsSet;
50
+ module.exports.THtmlItemsListContainer = html_list.THtmlItemsListContainer;
51
+ module.exports.THtmlItemsListController = html_list.THtmlItemsListController;
52
+
53
+ module.exports.THtmlButtonsSet = html_bts.THtmlButtonsSet;
54
+ module.exports.THtmlButtonsControllerARCSet = html_bts.THtmlButtonsControllerARCSet;
55
+ module.exports.BTS_DEF_GROUP_NAME = html_bts.BTS_DEF_GROUP_NAME;
48
56
 
49
- exports.THtmlListButtonsController = html_list_btn.THtmlListButtonsController;
57
+ module.exports.THtmlListButtonsController = html_list_btn.THtmlListButtonsController;
58
+
59
+ module.exports.components = components;
50
60
 
51
61
  // experimental
52
- exports.valueToIDString = html_helper.valueToIDString;
53
- exports.readAsAttrValue = html_helper.readAsAttrValue;
54
- exports.createNewHtmlElement = html_helper.createNewHtmlElement;
55
-
56
- exports.component = {
57
- THtmlStubItemsSet: exports.THtmlStubItemsSet,
58
- THtmlItemsListContainer: exports.THtmlItemsListContainer,
59
- THtmlItemsListController: exports.THtmlItemsListController,
60
- THtmlButtonsSet: exports.THtmlButtonsSet,
61
- THtmlListButtonsController: exports.THtmlListButtonsController,
62
- THtmlButtonsControllerARCSet: exports.THtmlButtonsControllerARCSet,
63
- // experimental
64
- THtmlInputField: exports.THtmlInputField,
65
- };
62
+ module.exports.readAsTagName = html_helper.readAsTagName;
63
+ module.exports.readAsAttrName = html_helper.readAsAttrName;
64
+ module.exports.readAsAttrValue = html_helper.readAsAttrValue;
65
+ module.exports.createNewHtmlElement = html_helper.createNewHtmlElement;
66
+
67
+ module.exports.THtmlInputField = html_flds.THtmlInputField;
68
+
69
+ // re-exported
70
+ module.exports.valueToIDString = html_helper.valueToIDString;
71
+
66
72
  // will deprecate
67
- exports.classes = exports.component;
73
+ module.exports.component = components;
74
+ module.exports.classes = exports.component;