aprog 2.2.2 → 2.2.4

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.
@@ -6,40 +6,43 @@ import {button, GUID} from "aprog";
6
6
  * Copyright (c) 2025 AlexProger.
7
7
  */
8
8
  export const ButtonConstructor = {
9
- /**
10
- * create HTMLElement
11
- */
12
- constructor() {
13
- const instance = Object.create(this);
14
- instance.class = GUID();
15
- return instance;
16
- },
9
+ /**
10
+ * create HTMLElement
11
+ */
12
+ constructor() {
13
+ const instance = Object.create(this);
14
+ instance.class = GUID();
15
+ return instance;
16
+ },
17
17
 
18
- /**
19
- * set HTMLElement
20
- */
21
- element({
22
- id = undefined,
23
- className = "",
24
- style = {},
25
- type = undefined,
26
- text = "",
27
- callback = () => {},
28
- } = {}) {
29
- return this.is = button({
30
- id: id || GUID(),
31
- class: `${this.class} btn ${className} disabled`.trim(),
32
- style: style,
33
- ...(type && {type: type}),
34
- value: text,
35
- onClick: callback
36
- });
18
+ /**
19
+ * set HTMLElement
20
+ */
21
+ element({
22
+ id = undefined,
23
+ className = "",
24
+ style = {},
25
+ type = undefined,
26
+ text = "",
27
+ callback = () => {
37
28
  },
29
+ ...props
30
+ } = {}) {
31
+ return this.is = button({
32
+ id: id || GUID(),
33
+ class: `${this.class} btn ${className} disabled`.trim(),
34
+ style: style,
35
+ ...(type && {type: type}),
36
+ value: text,
37
+ onClick: callback,
38
+ ...props
39
+ });
40
+ },
38
41
 
39
- /**
40
- * get target [HTMLElement]
41
- */
42
- get target() {
43
- return this?.is;
44
- }
42
+ /**
43
+ * get target [HTMLElement]
44
+ */
45
+ get target() {
46
+ return this?.is;
47
+ }
45
48
  };
@@ -6,45 +6,50 @@ import {GUID, input} from "aprog";
6
6
  * Copyright (c) 2025 AlexProger.
7
7
  */
8
8
  export const InputConstructor = {
9
- /**
10
- * create HTMLElement
11
- */
12
- constructor() {
13
- const instance = Object.create(this);
14
- instance.class = GUID();
15
- return instance;
16
- },
9
+ /**
10
+ * create HTMLElement
11
+ */
12
+ constructor() {
13
+ const instance = Object.create(this);
14
+ instance.class = GUID();
15
+ return instance;
16
+ },
17
17
 
18
- /**
19
- * set HTMLElement
20
- */
21
- element({
22
- id = undefined,
23
- className = "",
24
- style = {},
25
- type = undefined,
26
- focus = false,
27
- placeholder = undefined,
28
- value = undefined,
29
- nameCallback = "onInput",
30
- callback = () => {},
31
- } = {}) {
32
- return this.is = input({
33
- id: id || GUID(),
34
- class: `${this.class} input ${className}`.trim(),
35
- style: style,
36
- ...(type && {type: type}),
37
- focus: focus,
38
- ...(placeholder && {placeholder: placeholder}),
39
- ...(value && {value: value}),
40
- [nameCallback]: callback,
41
- });
18
+ /**
19
+ * set HTMLElement
20
+ */
21
+ element({
22
+ id = undefined,
23
+ className = "",
24
+ style = {},
25
+ type = undefined,
26
+ focus = false,
27
+ placeholder = undefined,
28
+ value = undefined,
29
+ nameCallback = "onInput",
30
+ callback = () => {
42
31
  },
32
+ ...props
33
+ } = {}) {
34
+ this.is = input({
35
+ id: id || GUID(),
36
+ class: `${this.class} input ${className}`.trim(),
37
+ style: style,
38
+ ...(type && {type: type}),
39
+ ...(placeholder && {placeholder: placeholder}),
40
+ ...(value && {value: value}),
41
+ [nameCallback]: callback,
42
+ ...props
43
+ });
44
+
45
+ if (focus) queueMicrotask(() => this.is.focus());
46
+ return this.is;
47
+ },
43
48
 
44
- /**
45
- * get target [HTMLElement]
46
- */
47
- get target() {
48
- return this?.is;
49
- }
49
+ /**
50
+ * get target [HTMLElement]
51
+ */
52
+ get target() {
53
+ return this?.is;
54
+ }
50
55
  };
@@ -6,40 +6,43 @@ import {GUID, select} from "aprog";
6
6
  * Copyright (c) 2025 AlexProger.
7
7
  */
8
8
  export const SelectConstructor = {
9
- /**
10
- * create HTMLElement
11
- */
12
- constructor() {
13
- const instance = Object.create(this);
14
- instance.class = GUID();
15
- return instance;
16
- },
9
+ /**
10
+ * create HTMLElement
11
+ */
12
+ constructor() {
13
+ const instance = Object.create(this);
14
+ instance.class = GUID();
15
+ return instance;
16
+ },
17
17
 
18
- /**
19
- * set HTMLElement
20
- */
21
- element({
22
- id = undefined,
23
- className = "",
24
- style = {},
25
- option = undefined,
26
- options = undefined,
27
- callback = () => {},
28
- } = {}) {
29
- return this.is = select({
30
- id: id || GUID(),
31
- class: `${this.class} input ${className}`.trim(),
32
- style: style,
33
- ...(option && {option: option}),
34
- ...(options && {options: options}),
35
- onChange: callback,
36
- });
18
+ /**
19
+ * set HTMLElement
20
+ */
21
+ element({
22
+ id = undefined,
23
+ className = "",
24
+ style = {},
25
+ option = undefined,
26
+ options = undefined,
27
+ callback = () => {
37
28
  },
29
+ ...props
30
+ } = {}) {
31
+ return this.is = select({
32
+ id: id || GUID(),
33
+ class: `${this.class} input ${className}`.trim(),
34
+ style: style,
35
+ ...(option && {option: option}),
36
+ ...(options && {options: options}),
37
+ onChange: callback,
38
+ ...props
39
+ });
40
+ },
38
41
 
39
- /**
40
- * get target [HTMLElement]
41
- */
42
- get target() {
43
- return this?.is;
44
- }
42
+ /**
43
+ * get target [HTMLElement]
44
+ */
45
+ get target() {
46
+ return this?.is;
47
+ }
45
48
  };