@cntwg/html-helper 0.0.17 → 0.0.19
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 +176 -0
- package/LICENSE +1 -1
- package/README.md +11 -2
- package/doc/html-ctrls-btn.md +7 -7
- package/doc/html-ctrls-fields.md +140 -0
- package/doc/html-ctrls-list.md +9 -5
- package/doc/html-helper-lib.md +23 -10
- package/index.js +16 -5
- package/lib/html-ctrls/buttons.js +242 -0
- package/lib/html-ctrls/fields.js +342 -0
- package/lib/{html-ctrls-list.js → html-ctrls/list.js} +61 -68
- package/lib/html-ctrls/lists-btn.js +155 -0
- package/lib/html-ctrls/lists-stubs.js +6 -10
- package/lib/html-ctrls/mod-hfunc.js +60 -0
- package/lib/html-helper-lib.js +78 -27
- package/package.json +18 -8
- package/lib/html-ctrls/lists-btns.js +0 -277
- package/lib/html-ctrls-btn.js +0 -343
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#### *v0.0.19*
|
|
2
|
+
|
|
3
|
+
Pre-release version.
|
|
4
|
+
|
|
5
|
+
> - `html-helper-lib.md` updated;
|
|
6
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.3;
|
|
7
|
+
> - add functions `lockHtmlElement` and `unlockHtmlElement` into `html-helper-lib.js` module;
|
|
8
|
+
> - change behavior for `createNewHtmlElement` function in handling `options` parameter (*see docs for details*);
|
|
9
|
+
> - added `THtmlInputField` class (experimental);
|
|
10
|
+
> - some other fixes.
|
|
11
|
+
|
|
12
|
+
#### *v0.0.18*
|
|
13
|
+
|
|
14
|
+
Pre-release version.
|
|
15
|
+
|
|
16
|
+
> - `html-helper-lib.md` updated;
|
|
17
|
+
> - some fixes in `html-helper-lib.js` module;
|
|
18
|
+
> - add `mod-hfunc.js` module;
|
|
19
|
+
> - rename module `html-ctrls-list.js` to `html-ctrls/list.js`;
|
|
20
|
+
> - some fixes in `list.js` module;
|
|
21
|
+
> - rename module `html-ctrls-btn.js` to `html-ctrls/buttons.js`;
|
|
22
|
+
> - some fixes in `buttons.js` module;
|
|
23
|
+
> - some fixes in `lists-btn.js` module;
|
|
24
|
+
> - some fixes in `lists-stubs.js` module;
|
|
25
|
+
> - add function `readAsAttrValue` into `html-helper-lib.js` module;
|
|
26
|
+
> - add settings `itemBaseClassID` to `THtmlItemsListContainer` class constructor `options` parameter;
|
|
27
|
+
> - added 'component' property for module exports;
|
|
28
|
+
> - deprecated 'classes' property for module exports (*use `component` instead*);
|
|
29
|
+
|
|
30
|
+
#### *v0.0.17*
|
|
31
|
+
|
|
32
|
+
Pre-release version.
|
|
33
|
+
|
|
34
|
+
> improved event logic on items deletion for `THtmlItemsListController` class.
|
|
35
|
+
|
|
36
|
+
#### *v0.0.16*
|
|
37
|
+
|
|
38
|
+
Pre-release version.
|
|
39
|
+
|
|
40
|
+
> improved items selection logic for `THtmlItemsListController` class.
|
|
41
|
+
|
|
42
|
+
#### *v0.0.15*
|
|
43
|
+
|
|
44
|
+
Pre-release version.
|
|
45
|
+
|
|
46
|
+
> - `html-helper-lib.md` updated;
|
|
47
|
+
> - `html-ctrls-list.md` updated;
|
|
48
|
+
> - some fixes in `html-ctrls-btn.js` module;
|
|
49
|
+
> - some fixes in `html-ctrls-list.js` module;
|
|
50
|
+
> - alter behavior for the `srchIndexByAttr` method of a `THtmlItemsListContainer` class (*see docs for details*);
|
|
51
|
+
> - add settings `markCurrentItem` to `THtmlItemsListContainer` class constructor `options` parameter;
|
|
52
|
+
> - add function `valueToIDString` into `html-helper-lib.js` module;
|
|
53
|
+
|
|
54
|
+
#### *v0.0.14*
|
|
55
|
+
|
|
56
|
+
Pre-release version.
|
|
57
|
+
|
|
58
|
+
> - `html-ctrls-list.md` updated;
|
|
59
|
+
> - some fixes in `html-ctrls/list-stubs.js` module;
|
|
60
|
+
> - alter behavior for the `loadItems` method of a `THtmlStubItemsSet` class in case when its `options` parameter is set to `boolean` (see `html-ctrls-list.md` for details);
|
|
61
|
+
> - added method `rstDefItem` to `THtmlStubItemsSet` class;
|
|
62
|
+
> - added `THtmlButtonsControllerARCSet` class.
|
|
63
|
+
|
|
64
|
+
#### *v0.0.13*
|
|
65
|
+
|
|
66
|
+
Pre-release version.
|
|
67
|
+
|
|
68
|
+
> - `html-helper-lib.md` updated;
|
|
69
|
+
> - `html-ctrls-btn.md` updated;
|
|
70
|
+
> - `html-ctrls-list.md` updated;
|
|
71
|
+
> - some fixes in `html-helper-lib.js` module;
|
|
72
|
+
> - some fixes in `html-ctrls-btn.js` module;
|
|
73
|
+
> - some fixes in `html-ctrls-list.js` module;
|
|
74
|
+
> - move definition of `THtmlStubItemsSet` from `html-ctrls-list.js` module to `html-ctrls/lists-stubs.js` submodule;
|
|
75
|
+
> - add function `valueToClassList` into `html-helper-lib.js` module;
|
|
76
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.2.
|
|
77
|
+
|
|
78
|
+
#### *v0.0.12*
|
|
79
|
+
|
|
80
|
+
Pre-release version.
|
|
81
|
+
|
|
82
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.1.
|
|
83
|
+
|
|
84
|
+
#### *v0.0.11*
|
|
85
|
+
|
|
86
|
+
Pre-release version.
|
|
87
|
+
|
|
88
|
+
> - `html-ctrls-btn.md` updated;
|
|
89
|
+
> - `html-ctrls-list.md` updated;
|
|
90
|
+
> - some fixes in `html-ctrls-list.js` module;
|
|
91
|
+
> - some fixes in `html-ctrls-btn.js` module.
|
|
92
|
+
|
|
93
|
+
#### *v0.0.10*
|
|
94
|
+
|
|
95
|
+
Pre-release version.
|
|
96
|
+
|
|
97
|
+
> - `html-ctrls-btn.md` updated;
|
|
98
|
+
> - added `THtmlListButtonsController` class;
|
|
99
|
+
|
|
100
|
+
#### *v0.0.9*
|
|
101
|
+
|
|
102
|
+
Pre-release version.
|
|
103
|
+
|
|
104
|
+
> - switch dependency from `@cntwg/bsfoc-lib-js` module to `@ygracs/bsfoc-lib-js` module.
|
|
105
|
+
|
|
106
|
+
#### *v0.0.8*
|
|
107
|
+
|
|
108
|
+
Pre-release version.
|
|
109
|
+
|
|
110
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.11.
|
|
111
|
+
|
|
112
|
+
#### *v0.0.7*
|
|
113
|
+
|
|
114
|
+
Pre-release version.
|
|
115
|
+
|
|
116
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.10;
|
|
117
|
+
> - some fixes in `html-helper-lib.js` module;
|
|
118
|
+
> - some fixes in `html-ctrls-list.js` module.
|
|
119
|
+
|
|
120
|
+
#### *v0.0.6*
|
|
121
|
+
|
|
122
|
+
Pre-release version.
|
|
123
|
+
|
|
124
|
+
> - `html-ctrls-btn.md` updated;
|
|
125
|
+
> - `html-ctrls-list.md` updated;
|
|
126
|
+
> - `html-helper-lib.md` updated;
|
|
127
|
+
> - some fixes in `html-ctrls-btn.js` module;
|
|
128
|
+
> - some fixes in `html-ctrls-list.js` module.
|
|
129
|
+
|
|
130
|
+
#### *v0.0.5*
|
|
131
|
+
|
|
132
|
+
Pre-release version.
|
|
133
|
+
|
|
134
|
+
> - `$module/test/README.md` added;
|
|
135
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.8;
|
|
136
|
+
> - `html-ctrls-list.md` updated;
|
|
137
|
+
> - added `minIndex` property to `THtmlItemsListContainer` class;
|
|
138
|
+
> - some fixes in `html-ctrls-list.js` module;
|
|
139
|
+
> - added 'classes' property for module exports;
|
|
140
|
+
> - MIT-license applied.
|
|
141
|
+
|
|
142
|
+
#### *v0.0.4*
|
|
143
|
+
|
|
144
|
+
Pre-release version.
|
|
145
|
+
|
|
146
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.5.
|
|
147
|
+
|
|
148
|
+
#### *v0.0.3*
|
|
149
|
+
|
|
150
|
+
Pre-release version.
|
|
151
|
+
|
|
152
|
+
> - added `activateHTMLElements` function;
|
|
153
|
+
> - added `inactivateHTMLElements` function;
|
|
154
|
+
> - added `createNewHtmlElement` function (experimental);
|
|
155
|
+
> - `html-helper-lib.md` updated;
|
|
156
|
+
> - `html-ctrls-btn.md` updated;
|
|
157
|
+
> - `html-ctrls-list.md` updated.
|
|
158
|
+
|
|
159
|
+
#### *v0.0.2*
|
|
160
|
+
|
|
161
|
+
Pre-release version.
|
|
162
|
+
|
|
163
|
+
> - `README.md` added;
|
|
164
|
+
> - `html-helper-lib.md` added to `doc`;
|
|
165
|
+
> - `html-ctrls-btn.md` added to `doc`;
|
|
166
|
+
> - `html-ctrls-list.md` added to `doc`;
|
|
167
|
+
> - added `CSS_CLASS_ACTIVE` constant to `CSS_CLASS_STRING`;
|
|
168
|
+
> - added `isActiveHTMLElement` function;
|
|
169
|
+
> - added `markHtmlElementAsActive` function;
|
|
170
|
+
> - added `unmarkActiveHtmlElement` function;
|
|
171
|
+
> - `html-btn-ctrl.js` was renamed `html-ctrls-btn.js`;
|
|
172
|
+
> - `html-list-ctrl.js` was renamed `html-ctrls-list.js`.
|
|
173
|
+
|
|
174
|
+
#### *v0.0.1*
|
|
175
|
+
|
|
176
|
+
Pre-release version.
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2019-
|
|
3
|
+
Copyright (c) 2019-2023 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,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.4|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2023-06-29|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -10,6 +10,10 @@ This module provide a base set of helpers for javascript. So your work can run a
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
`npm install @cntwg/html-helper`
|
|
16
|
+
|
|
13
17
|
## Description
|
|
14
18
|
|
|
15
19
|
This module contains the following components:
|
|
@@ -30,3 +34,8 @@ This module contains the following components:
|
|
|
30
34
|
- `THtmlStubItemsSet`.
|
|
31
35
|
|
|
32
36
|
> *For more details see `html-ctrls-list.md` in module `doc` directory*.
|
|
37
|
+
|
|
38
|
+
- classes for working with HTML-elements maintaining an input fields support such as:
|
|
39
|
+
- `THtmlInputField` (experimental, beta stage).
|
|
40
|
+
|
|
41
|
+
> *For more details see `html-ctrls-fields.md` in module `doc` directory*.
|
package/doc/html-ctrls-btn.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.9|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2023-07-04|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -77,7 +77,7 @@ This method adds a group given by `name`. If succeed `true` is returned.
|
|
|
77
77
|
|
|
78
78
|
##### **delGroup(name)**
|
|
79
79
|
|
|
80
|
-
This method deletes the
|
|
80
|
+
This method deletes the group given by `name`. If succeed `true` is returned.
|
|
81
81
|
|
|
82
82
|
##### **renameGroup(oldName, newName)**
|
|
83
83
|
|
|
@@ -108,13 +108,13 @@ The class constructor creates a new instance of the class. It receives an `optio
|
|
|
108
108
|
|option name|option type|default value|description|
|
|
109
109
|
|:---|---|---:|:---|
|
|
110
110
|
|`btnFirst`|`HTMLElement`|---|define HTML-button which will select the first element|
|
|
111
|
-
|`btn_frst`|`HTMLElement
|
|
111
|
+
|`btn_frst`|`HTMLElement`|---|\<*deprecate*> *(use `btnFirst` instead)*|
|
|
112
112
|
|`btnPrev`|`HTMLElement`|---|define HTML-button which will select the previous element|
|
|
113
|
-
|`btn_prev`|`HTMLElement
|
|
113
|
+
|`btn_prev`|`HTMLElement`|---|\<*deprecate*> *(use `btnPrev` instead)*|
|
|
114
114
|
|`btnNext`|`HTMLElement`|---|define HTML-button which will select the next element|
|
|
115
|
-
|`btn_next`|`HTMLElement
|
|
115
|
+
|`btn_next`|`HTMLElement`|---|\<*deprecate*> *(use `btnNext` instead)*|
|
|
116
116
|
|`btnLast`|`HTMLElement`|---|define HTML-button which will select the last element|
|
|
117
|
-
|`btn_last`|`HTMLElement
|
|
117
|
+
|`btn_last`|`HTMLElement`|---|\<*deprecate*> *(use `btnLast` instead)*|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
#### class properties
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
>|***rev.*:**|0.0.4|
|
|
2
|
+
>|:---|---:|
|
|
3
|
+
>|date:|2023-07-04|
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
This paper describes a classes provided by `html-ctrls-fields.js` module.
|
|
8
|
+
|
|
9
|
+
## Module classes
|
|
10
|
+
|
|
11
|
+
### **THtmlInputField**
|
|
12
|
+
|
|
13
|
+
This class provide a container useful when dealing with an elements such an input fields or a checkboxes placed on an HTML-form.
|
|
14
|
+
|
|
15
|
+
#### class constructor
|
|
16
|
+
|
|
17
|
+
The class constructor creates a new instance of the class. It receives a parameters listed below:
|
|
18
|
+
|
|
19
|
+
|parameter name|value type|default value|description|
|
|
20
|
+
|:---|---|---:|:---|
|
|
21
|
+
|`name`|`string`|---|\<*reserved*>|
|
|
22
|
+
|`eholds`|`object`|---|contains ref-list for container elements|
|
|
23
|
+
|`options`|`object`|---|contains a container settings|
|
|
24
|
+
|
|
25
|
+
The `eholds` structure has listed below:
|
|
26
|
+
|
|
27
|
+
|parameter name|value type|default value|description|
|
|
28
|
+
|:---|---|---:|:---|
|
|
29
|
+
|`host`|`HTMLElement`|---|points to a host element which holds all other items|
|
|
30
|
+
|`label`|`HTMLElement`|---|points to a label item|
|
|
31
|
+
|`field`|`HTMLElement`|---|points to a field item|
|
|
32
|
+
|
|
33
|
+
The `options` structure has listed below:
|
|
34
|
+
|
|
35
|
+
|option name|value type|default value|description|
|
|
36
|
+
|:---|---|---:|:---|
|
|
37
|
+
|`idPref`|---|---|\<*reserved*>|
|
|
38
|
+
|`baseClassID`|---|---|\<*reserved*>|
|
|
39
|
+
|`hint`|---|---|\<*reserved*>|
|
|
40
|
+
|`fldType`|---|---|\<*reserved*>|
|
|
41
|
+
|`isReadOnly`|---|---|\<*reserved*>|
|
|
42
|
+
|
|
43
|
+
#### class properties
|
|
44
|
+
|
|
45
|
+
The table below describes a properties of a `THtmlInputField` class:
|
|
46
|
+
|
|
47
|
+
|property name|property type|read only|description|
|
|
48
|
+
|:---|---|---|:---|
|
|
49
|
+
|`value`|`string` or `boolean`|no|contains a container value|
|
|
50
|
+
|`isModified`|`boolean`|yes|show whether or not the field content was modified|
|
|
51
|
+
|
|
52
|
+
#### class methods
|
|
53
|
+
|
|
54
|
+
##### **clear()**
|
|
55
|
+
|
|
56
|
+
> Note: \<*reserved*>
|
|
57
|
+
|
|
58
|
+
##### **isEmpty()**
|
|
59
|
+
|
|
60
|
+
This method returns `true` if the container field element contains an empty string.
|
|
61
|
+
|
|
62
|
+
##### **isNotEmpty()**
|
|
63
|
+
|
|
64
|
+
This method returns `true` if the container field element contains a non-empty string.
|
|
65
|
+
|
|
66
|
+
##### **hideItem()**
|
|
67
|
+
|
|
68
|
+
This method hides a container on the Web-form.
|
|
69
|
+
|
|
70
|
+
##### **showItem()**
|
|
71
|
+
|
|
72
|
+
This method shows a container on the Web-form.
|
|
73
|
+
|
|
74
|
+
##### **attachTo(target)**
|
|
75
|
+
|
|
76
|
+
This method attaches a container to a parent HTML-element given by a `target` parameter. If succeed `true` returned.
|
|
77
|
+
|
|
78
|
+
#### class methods (*static*)
|
|
79
|
+
|
|
80
|
+
##### **create(name\[, options])**
|
|
81
|
+
|
|
82
|
+
This method creates an instance of the class. If failed `null` returned.
|
|
83
|
+
|
|
84
|
+
The `name` parameter represents an ID of the created container.
|
|
85
|
+
|
|
86
|
+
For details of `options` parameter see a `createElement` method description.
|
|
87
|
+
|
|
88
|
+
##### **createElement(name\[, options\[, bRetChild]])**
|
|
89
|
+
|
|
90
|
+
This method creates a container with all elements needed for input field component to function.
|
|
91
|
+
|
|
92
|
+
The `name` parameter represents an ID of the created container.
|
|
93
|
+
|
|
94
|
+
The `options` structure has listed below:
|
|
95
|
+
|
|
96
|
+
|option name|value type|default value|description|
|
|
97
|
+
|:---|---|---:|:---|
|
|
98
|
+
|`host`|`HTMLElement`|---|an HTML-element which is a host for all container elements|
|
|
99
|
+
|`idPref`|`string`|---|a prefix which modified a container ID, if given|
|
|
100
|
+
|`label`|`string`|---|a text for the field label|
|
|
101
|
+
|`labelPosition`|`string`|---|defines a position to place a label|
|
|
102
|
+
|`useDelim`|`boolean`|`true`|defines whether a delimeter is used within a text of a label|
|
|
103
|
+
|`baseClassID`|`object`|---|containes a list of class name attributes for container elements|
|
|
104
|
+
|`hint`|`string`|---|defines a helper string which is shown when a field content is empty|
|
|
105
|
+
|`fldType`|`string`|---|defines a field type|
|
|
106
|
+
|`isReadOnly`|`boolean`|`true`|defines whether a field content can be modified|
|
|
107
|
+
|
|
108
|
+
The `baseClassID` structure has listed below:
|
|
109
|
+
|
|
110
|
+
|option name|value type|default value|description|
|
|
111
|
+
|:---|---|---:|:---|
|
|
112
|
+
|`main`|---|---|containes a list of class name attributes for all elements|
|
|
113
|
+
|`host`|---|---|containes a list of class name attributes for container host|
|
|
114
|
+
|`label`|---|---|containes a list of class name attributes for label element|
|
|
115
|
+
|`field`|---|---|containes a list of class name attributes for field element|
|
|
116
|
+
|
|
117
|
+
The `bRetChild` parameter, if given, changes the result value of the method. It must be of a `boolean` type. If value is `false` the only host element is returned as a result (a default behavoir). If `true`, an `object` of the following structure is returned:
|
|
118
|
+
|
|
119
|
+
|property name|value type|description|
|
|
120
|
+
|:---|---|:---|
|
|
121
|
+
|`host`|`HTMLElement`|a container host element|
|
|
122
|
+
|`label`|`HTMLElement`|a container label element|
|
|
123
|
+
|`field`|`HTMLElement`|a container field element|
|
|
124
|
+
|
|
125
|
+
#### class methods (*special*)
|
|
126
|
+
|
|
127
|
+
##### **on(name, event)**
|
|
128
|
+
|
|
129
|
+
This method sets event handler addressed by `name` parameter for the class instance.
|
|
130
|
+
|
|
131
|
+
> Note: for current implementation you can't reset or set new event handler (*especially another one*) if a handler with the same name exists already.
|
|
132
|
+
|
|
133
|
+
#### class events
|
|
134
|
+
|
|
135
|
+
The class generates the events listed in the table bellow:
|
|
136
|
+
|
|
137
|
+
|event name|description|
|
|
138
|
+
|:---|:---|
|
|
139
|
+
|`value-changed`|fired when value is changed|
|
|
140
|
+
|`value-empty`|fired due editing of the field when its value become an empty string|
|
package/doc/html-ctrls-list.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.15|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2023-07-04|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -27,6 +27,7 @@ The `options` structure has listed below:
|
|
|
27
27
|
|:---|---|---:|:---|
|
|
28
28
|
|`autoHideNewItems`|`boolean`|`false`|alters behavior of the `addItem` class method. If set to `true`, the item which was added to a container members will be automatically hidden|
|
|
29
29
|
|`markCurrentItem`|`boolean`|`false`|alters behavior of the `setCurIndex` class method. If set to `true`, the item which was added to a container members will be automatically marked as current|
|
|
30
|
+
|`itemBaseClassID`|`array`|---|alters behavior of the `addItem` class method. It accepts value of a string or an array of strings. For more see description of an `addItem` method|
|
|
30
31
|
|
|
31
32
|
#### class properties
|
|
32
33
|
|
|
@@ -112,6 +113,8 @@ This method adds a given item to a container members and if succeed returns its
|
|
|
112
113
|
|
|
113
114
|
If `options` parameter is given and is set to `true`, in case of success, the `curIndex` property is adjusted by the method.
|
|
114
115
|
|
|
116
|
+
If `itemBaseClassID` option of the container is set, the method will applied a value given by this option as a `class` attribute of an item which was successfully added.
|
|
117
|
+
|
|
115
118
|
##### **delItem(index\[, options])**
|
|
116
119
|
|
|
117
120
|
This method deletes an item addressed by the given `index` from a container members and if succeed `true` is returned.
|
|
@@ -161,8 +164,9 @@ The `options` structure has listed below:
|
|
|
161
164
|
|
|
162
165
|
|option name|value type|default value|description|
|
|
163
166
|
|:---|---|---:|:---|
|
|
164
|
-
|`autoHideNewItems`|`boolean`|`false`|
|
|
165
|
-
|`markCurrentItem`|`boolean`|`false`|
|
|
167
|
+
|`autoHideNewItems`|`boolean`|`false`|for details see options on `THtmlItemsListContainer` class constructor section|
|
|
168
|
+
|`markCurrentItem`|`boolean`|`false`|for details see options on `THtmlItemsListContainer` class constructor section|
|
|
169
|
+
|`itemBaseClassID`|`array`|---|for details see options on `THtmlItemsListContainer` class constructor section|
|
|
166
170
|
|`showStubsIfEmpty`|`boolean`|`false`|if set, in case of the empty list, the default stub-item will be displayed|
|
|
167
171
|
|`allowGroupSelection`|`boolean`|`false`|if set the more than one element can be selected in the list|
|
|
168
172
|
|`allowSelectionLocks`|`boolean`|`false`|<*reserved, experimental*>|
|
|
@@ -405,7 +409,7 @@ The `options` parameter is an `object` that contains the following set of parame
|
|
|
405
409
|
|option name|value type|default value|description|
|
|
406
410
|
|:---|---|---:|:---|
|
|
407
411
|
|`useClear`|`boolean`|`true`|if set to `true`, before the load of the items, the list is cleared|
|
|
408
|
-
|`load_as_new`|`boolean`|`true
|
|
412
|
+
|`load_as_new`|`boolean`|`true`|\<*deprecate*> *(use `useClear` instead)*|
|
|
409
413
|
|`force`|`boolean`|`false`|if set to `true`, the item which is already present will be replaced with a new one|
|
|
410
414
|
|
|
411
415
|
If the `options` parameter is a `boolean` value it treats as a `options.useClear` option.
|
package/doc/html-helper-lib.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.8|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|
|
|
3
|
+
>|date:|2023-06-12|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -74,6 +74,14 @@ This function applies the class attribute defined by `CSS_CLASS_CURRENT` for a g
|
|
|
74
74
|
|
|
75
75
|
This function removes the class attribute defined by `CSS_CLASS_CURRENT` for a given HTML-element. If succeed `true` is returned.
|
|
76
76
|
|
|
77
|
+
#### **unlockHtmlElement(object)**
|
|
78
|
+
|
|
79
|
+
This function enables a given HTML-element.
|
|
80
|
+
|
|
81
|
+
#### **lockHtmlElement(args)**
|
|
82
|
+
|
|
83
|
+
This function disables a given HTML-element.
|
|
84
|
+
|
|
77
85
|
#### **activateHtmlElements(args)**
|
|
78
86
|
|
|
79
87
|
This function enables all HTML-elements listed by `args`.
|
|
@@ -94,24 +102,25 @@ The `options` parameter if sets to `true` force the function to remove all dupli
|
|
|
94
102
|
|
|
95
103
|
> 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.
|
|
96
104
|
|
|
97
|
-
#### **createNewHtmlElement(tagName, options)**
|
|
105
|
+
#### **createNewHtmlElement(tagName\[, options])**
|
|
98
106
|
|
|
99
107
|
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:
|
|
100
108
|
|
|
101
109
|
|parameter name|value type|default value|description|
|
|
102
110
|
|:---|---|---:|:---|
|
|
103
|
-
|`tagName`|`string`|`undefined`|defines a tag name of the element
|
|
104
|
-
|`options`|`object`|---|contains a set of a settings
|
|
111
|
+
|`tagName`|`string`|`undefined`|defines a tag name of the element|
|
|
112
|
+
|`options`|`object`|---|contains a set of a settings|
|
|
105
113
|
|
|
106
114
|
The `options` structure has listed below:
|
|
107
115
|
|
|
108
116
|
|option name|value type|default value|description|
|
|
109
117
|
|:---|---|---:|:---|
|
|
110
|
-
|`id`|`string`|`undefined`|defines ID-attribute of an element
|
|
111
|
-
|`text`|`string`|`undefined`|defines a text context of an element
|
|
112
|
-
|`attr`|---|`undefined`|defines an attributes of an element
|
|
113
|
-
|`class`|---|`undefined
|
|
114
|
-
|`
|
|
118
|
+
|`id`|`string`|`undefined`|defines ID-attribute of an element|
|
|
119
|
+
|`text`|`string`|`undefined`|defines a text context of an element|
|
|
120
|
+
|`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|
|
|
123
|
+
|`data`|---|`undefined`|defines a data-attributes of an element|
|
|
115
124
|
|
|
116
125
|
If succeed, the function returned `HTMLElement` and `null` if failed.
|
|
117
126
|
|
|
@@ -120,3 +129,7 @@ This function make all the jobs under the hood. So there is no need to call DOM-
|
|
|
120
129
|
#### **valueToIDString(value)**
|
|
121
130
|
|
|
122
131
|
This function tries to convert a given `value` to `ID_STRING`. If failed an empty string is returned.
|
|
132
|
+
|
|
133
|
+
#### **readAsAttrValue(value)**
|
|
134
|
+
|
|
135
|
+
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,12 +1,13 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.018-20230629]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
5
5
|
const html_helper = require('./lib/html-helper-lib.js');
|
|
6
|
-
const html_list = require('./lib/html-ctrls
|
|
7
|
-
const html_bts = require('./lib/html-ctrls
|
|
6
|
+
const html_list = require('./lib/html-ctrls/list.js');
|
|
7
|
+
const html_bts = require('./lib/html-ctrls/buttons.js');
|
|
8
|
+
const html_flds = require('./lib/html-ctrls/fields.js');
|
|
8
9
|
|
|
9
|
-
const html_list_btn = require('./lib/html-ctrls/lists-
|
|
10
|
+
const html_list_btn = require('./lib/html-ctrls/lists-btn.js');
|
|
10
11
|
|
|
11
12
|
// === module extra block (helper functions) ===
|
|
12
13
|
|
|
@@ -28,6 +29,8 @@ exports.markHtmlElementAsCurrent = html_helper.markHtmlElementAsCurrent;
|
|
|
28
29
|
exports.unmarkCurrentHtmlElement = html_helper.unmarkCurrentHtmlElement;
|
|
29
30
|
exports.markHtmlElementAsActive = html_helper.markHtmlElementAsActive;
|
|
30
31
|
exports.unmarkActiveHtmlElement = html_helper.unmarkActiveHtmlElement;
|
|
32
|
+
exports.lockHtmlElement = html_helper.lockHtmlElement;
|
|
33
|
+
exports.unlockHtmlElement = html_helper.unlockHtmlElement;
|
|
31
34
|
exports.activateHtmlElements = html_helper.activateHtmlElements;
|
|
32
35
|
exports.inactivateHtmlElements = html_helper.inactivateHtmlElements;
|
|
33
36
|
exports.valueToClassList = html_helper.valueToClassList;
|
|
@@ -40,17 +43,25 @@ exports.THtmlButtonsSet = html_bts.THtmlButtonsSet;
|
|
|
40
43
|
exports.THtmlButtonsControllerARCSet = html_bts.THtmlButtonsControllerARCSet;
|
|
41
44
|
exports.BTS_DEF_GROUP_NAME = html_bts.BTS_DEF_GROUP_NAME;
|
|
42
45
|
|
|
46
|
+
// experimental
|
|
47
|
+
exports.THtmlInputField = html_flds.THtmlInputField;
|
|
48
|
+
|
|
43
49
|
exports.THtmlListButtonsController = html_list_btn.THtmlListButtonsController;
|
|
44
50
|
|
|
45
51
|
// experimental
|
|
46
52
|
exports.valueToIDString = html_helper.valueToIDString;
|
|
53
|
+
exports.readAsAttrValue = html_helper.readAsAttrValue;
|
|
47
54
|
exports.createNewHtmlElement = html_helper.createNewHtmlElement;
|
|
48
55
|
|
|
49
|
-
exports.
|
|
56
|
+
exports.component = {
|
|
50
57
|
THtmlStubItemsSet: exports.THtmlStubItemsSet,
|
|
51
58
|
THtmlItemsListContainer: exports.THtmlItemsListContainer,
|
|
52
59
|
THtmlItemsListController: exports.THtmlItemsListController,
|
|
53
60
|
THtmlButtonsSet: exports.THtmlButtonsSet,
|
|
54
61
|
THtmlListButtonsController: exports.THtmlListButtonsController,
|
|
55
62
|
THtmlButtonsControllerARCSet: exports.THtmlButtonsControllerARCSet,
|
|
63
|
+
// experimental
|
|
64
|
+
THtmlInputField: exports.THtmlInputField,
|
|
56
65
|
};
|
|
66
|
+
// will deprecate
|
|
67
|
+
exports.classes = exports.component;
|