@medyll/idae-be 0.82.0 → 0.84.0
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/dist/be.d.ts +2 -5
- package/dist/be.js +7 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/attrs.js +1 -1
- package/dist/modules/position.d.ts +1 -2
- package/dist/modules/position.js +2 -2
- package/dist/modules/text.js +3 -3
- package/dist/modules/timers.d.ts +1 -2
- package/dist/modules/timers.js +14 -12
- package/dist/types.d.ts +5 -5
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +29 -26
- package/package.json +1 -1
- package/dist/modules/props.d.ts +0 -29
- package/dist/modules/props.js +0 -68
package/dist/be.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { IsWhat } from './types.js';
|
|
|
4
4
|
import { type DataHandlerHandle, DataHandler } from './modules/data.js';
|
|
5
5
|
import { EventsHandler, type EventHandlerHandle } from './modules/events.js';
|
|
6
6
|
import { type ClassHandlerHandler, ClassesHandler } from './modules/classes.js';
|
|
7
|
-
import { type PropsHandlerHandle } from './modules/props.js';
|
|
8
7
|
import { DomHandler, type DomHandlerHandle } from './modules/dom.js';
|
|
9
8
|
import { PositionHandler, type PositionHandlerHandle } from './modules/position.js';
|
|
10
9
|
import { WalkHandler } from './modules/walk.js';
|
|
@@ -13,15 +12,13 @@ import { TimersHandler } from './modules/timers.js';
|
|
|
13
12
|
export declare class Be {
|
|
14
13
|
inputNode: HTMLElement | HTMLElement[] | string;
|
|
15
14
|
isWhat: IsWhat;
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
timerOut: NodeJS.Timeout | null;
|
|
16
|
+
timerInterval: NodeJS.Timeout | null;
|
|
18
17
|
styles: (actions: BeStylesHandler) => Be;
|
|
19
18
|
private styleHandler;
|
|
20
19
|
setStyle: StylesHandler['set'];
|
|
21
20
|
getStyle: StylesHandler['get'];
|
|
22
21
|
unsetStyle: StylesHandler['unset'];
|
|
23
|
-
props: (actions: PropsHandlerHandle) => Be;
|
|
24
|
-
private propHandler;
|
|
25
22
|
data: (actions: DataHandlerHandle) => Be;
|
|
26
23
|
private dataHandler;
|
|
27
24
|
setData: DataHandler['set'];
|
package/dist/be.js
CHANGED
|
@@ -4,7 +4,6 @@ import { BeUtils } from './utils.js';
|
|
|
4
4
|
import { DataHandler } from './modules/data.js';
|
|
5
5
|
import { EventsHandler } from './modules/events.js';
|
|
6
6
|
import { ClassesHandler } from './modules/classes.js';
|
|
7
|
-
import { PropsHandler } from './modules/props.js';
|
|
8
7
|
import { DomHandler } from './modules/dom.js';
|
|
9
8
|
import { PositionHandler } from './modules/position.js';
|
|
10
9
|
import { WalkHandler } from './modules/walk.js';
|
|
@@ -14,17 +13,14 @@ export class Be {
|
|
|
14
13
|
inputNode;
|
|
15
14
|
isWhat;
|
|
16
15
|
//
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
timerOut = null;
|
|
17
|
+
timerInterval = null;
|
|
19
18
|
// styles
|
|
20
19
|
styles;
|
|
21
20
|
styleHandler;
|
|
22
21
|
setStyle;
|
|
23
22
|
getStyle;
|
|
24
23
|
unsetStyle;
|
|
25
|
-
// properties
|
|
26
|
-
props;
|
|
27
|
-
propHandler;
|
|
28
24
|
// dataSet
|
|
29
25
|
data;
|
|
30
26
|
dataHandler;
|
|
@@ -120,10 +116,6 @@ export class Be {
|
|
|
120
116
|
this.styleHandler = new StylesHandler(this);
|
|
121
117
|
this.styles = this.handle(this.styleHandler);
|
|
122
118
|
this.attach(StylesHandler, 'Style');
|
|
123
|
-
// properties
|
|
124
|
-
this.propHandler = new PropsHandler(this);
|
|
125
|
-
this.props = this.handle(this.styleHandler);
|
|
126
|
-
this.attach(PropsHandler, 'Prop');
|
|
127
119
|
// dataSet
|
|
128
120
|
this.dataHandler = new DataHandler(this);
|
|
129
121
|
this.data = this.handle(this.styleHandler);
|
|
@@ -135,7 +127,7 @@ export class Be {
|
|
|
135
127
|
// position
|
|
136
128
|
this.positionHandler = new PositionHandler(this);
|
|
137
129
|
this.position = this.handle(this.positionHandler);
|
|
138
|
-
this.attach(PositionHandler
|
|
130
|
+
this.attach(PositionHandler);
|
|
139
131
|
// text
|
|
140
132
|
this.textHandler = new TextHandler(this);
|
|
141
133
|
this.dom = this.handle(this.textHandler);
|
|
@@ -314,11 +306,14 @@ export class Be {
|
|
|
314
306
|
const fromMethods = Handler.methods || [];
|
|
315
307
|
fromMethods.forEach((method) => {
|
|
316
308
|
const handler = new Handler(this);
|
|
317
|
-
const methodName = method + suffix;
|
|
309
|
+
const methodName = suffix ? method + suffix : method;
|
|
318
310
|
if (!(method in handler)) {
|
|
319
311
|
console.error(`Method ${method} not found in ${Handler.name}`, handler);
|
|
320
312
|
}
|
|
321
313
|
else if (methodName in this) {
|
|
314
|
+
if (!handler) {
|
|
315
|
+
console.error(`Handler ${Handler.name} not found`, handler);
|
|
316
|
+
}
|
|
322
317
|
this[methodName] = (...args) => {
|
|
323
318
|
return handler[method].apply(handler, args);
|
|
324
319
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './modules/walk.js';
|
|
|
5
5
|
export * from './modules/timers.js';
|
|
6
6
|
export * from './modules/text.js';
|
|
7
7
|
export * from './modules/styles.js';
|
|
8
|
-
export * from './modules/props.js';
|
|
9
8
|
export * from './modules/position.js';
|
|
10
9
|
export * from './modules/events.js';
|
|
11
10
|
export * from './modules/dom.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export * from './modules/walk.js';
|
|
|
6
6
|
export * from './modules/timers.js';
|
|
7
7
|
export * from './modules/text.js';
|
|
8
8
|
export * from './modules/styles.js';
|
|
9
|
-
export * from './modules/props.js';
|
|
10
9
|
export * from './modules/position.js';
|
|
11
10
|
export * from './modules/events.js';
|
|
12
11
|
export * from './modules/dom.js';
|
package/dist/modules/attrs.js
CHANGED
|
@@ -47,7 +47,7 @@ export class AttrHandler {
|
|
|
47
47
|
el.removeAttribute(nameOrObject);
|
|
48
48
|
}
|
|
49
49
|
else if (typeof nameOrObject === 'object') {
|
|
50
|
-
Object.entries(nameOrObject).forEach(([name
|
|
50
|
+
Object.entries(nameOrObject).forEach(([name]) => {
|
|
51
51
|
el.removeAttribute(name);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -62,8 +62,7 @@ export declare class PositionHandler implements CommonHandler<PositionHandler, P
|
|
|
62
62
|
* @param options.offset Optional offset from the target anchor point.
|
|
63
63
|
* @returns The Be instance for method chaining.
|
|
64
64
|
*/
|
|
65
|
-
snapTo(targetElement: string | HTMLElement,
|
|
66
|
-
options: {
|
|
65
|
+
snapTo(targetElement: string | HTMLElement, options: {
|
|
67
66
|
sourceAnchor: PositionSnapOptions;
|
|
68
67
|
targetAnchor: PositionSnapOptions;
|
|
69
68
|
offset?: {
|
package/dist/modules/position.js
CHANGED
|
@@ -132,8 +132,7 @@ export class PositionHandler {
|
|
|
132
132
|
* @param options.offset Optional offset from the target anchor point.
|
|
133
133
|
* @returns The Be instance for method chaining.
|
|
134
134
|
*/
|
|
135
|
-
snapTo(targetElement,
|
|
136
|
-
options, callback) {
|
|
135
|
+
snapTo(targetElement, options, callback) {
|
|
137
136
|
if (this.beElement.isWhat !== 'element')
|
|
138
137
|
return this.beElement;
|
|
139
138
|
const targetEl = typeof targetElement === 'string' ? document.querySelector(targetElement) : targetElement;
|
|
@@ -147,6 +146,7 @@ export class PositionHandler {
|
|
|
147
146
|
// Calculate final position
|
|
148
147
|
const x = targetX - sourceX + offset.x;
|
|
149
148
|
const y = targetY - sourceY + offset.y;
|
|
149
|
+
console.log('Calculated position:', { x, y }, [sourceX, sourceY], { sourceRect });
|
|
150
150
|
// Apply position
|
|
151
151
|
this.beElement.eachNode((el) => {
|
|
152
152
|
const computedStyle = window.getComputedStyle(el);
|
package/dist/modules/text.js
CHANGED
|
@@ -34,7 +34,7 @@ export class TextHandler {
|
|
|
34
34
|
break;
|
|
35
35
|
case 'prepend':
|
|
36
36
|
if (typeof props === 'string') {
|
|
37
|
-
el.
|
|
37
|
+
el.insertAdjacentText('afterbegin', props);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
throw new Error('Invalid props for prepend: must be a string.');
|
|
@@ -42,7 +42,7 @@ export class TextHandler {
|
|
|
42
42
|
break;
|
|
43
43
|
case 'append':
|
|
44
44
|
if (typeof props === 'string') {
|
|
45
|
-
el.
|
|
45
|
+
el.insertAdjacentText('beforeend', props);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
throw new Error('Invalid props for append: must be a string.');
|
|
@@ -50,7 +50,7 @@ export class TextHandler {
|
|
|
50
50
|
break;
|
|
51
51
|
case 'replace':
|
|
52
52
|
if (typeof props === 'string') {
|
|
53
|
-
el.
|
|
53
|
+
el.textContent = props;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
throw new Error('Invalid props for replace: must be a string.');
|
package/dist/modules/timers.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ type cd = Record<'timeout' | 'interval', number> & HandlerCallBack;
|
|
|
10
10
|
type cds = Record<'clearTimeout' | 'clearInterval', HandlerCallBackFn>;
|
|
11
11
|
type TimerHandlerHandle = cd & cds;
|
|
12
12
|
export declare class TimersHandler implements CommonHandler<TimersHandler> {
|
|
13
|
+
#private;
|
|
13
14
|
private beElement;
|
|
14
15
|
static methods: timersMethods[];
|
|
15
|
-
_timer: NodeJS.Timeout | null;
|
|
16
|
-
_interval: NodeJS.Timeout | null;
|
|
17
16
|
constructor(element: Be);
|
|
18
17
|
methods: string[] | keyof TimersHandler;
|
|
19
18
|
valueOf(): unknown;
|
package/dist/modules/timers.js
CHANGED
|
@@ -9,8 +9,8 @@ var timersMethods;
|
|
|
9
9
|
export class TimersHandler {
|
|
10
10
|
beElement;
|
|
11
11
|
static methods = Object.values(timersMethods);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
#timer = null;
|
|
13
|
+
#interval = null;
|
|
14
14
|
constructor(element) {
|
|
15
15
|
this.beElement = element;
|
|
16
16
|
}
|
|
@@ -18,8 +18,8 @@ export class TimersHandler {
|
|
|
18
18
|
valueOf() {
|
|
19
19
|
return {
|
|
20
20
|
methods: this.methods,
|
|
21
|
-
timer: this
|
|
22
|
-
interval: this
|
|
21
|
+
timer: this.#timer,
|
|
22
|
+
interval: this.#interval
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
handle(actions) {
|
|
@@ -40,10 +40,10 @@ export class TimersHandler {
|
|
|
40
40
|
return this.beElement;
|
|
41
41
|
}
|
|
42
42
|
timeout(value, callback) {
|
|
43
|
-
this.beElement.
|
|
43
|
+
this.beElement.timerOut = setTimeout(() => {
|
|
44
44
|
callback?.({
|
|
45
45
|
method: 'timeout',
|
|
46
|
-
fragment: this.beElement.
|
|
46
|
+
fragment: this.beElement.timerOut,
|
|
47
47
|
be: this.beElement,
|
|
48
48
|
root: this.beElement
|
|
49
49
|
});
|
|
@@ -62,10 +62,10 @@ export class TimersHandler {
|
|
|
62
62
|
return this.beElement;
|
|
63
63
|
}
|
|
64
64
|
interval(value, callback) {
|
|
65
|
-
this.beElement.
|
|
65
|
+
this.beElement.timerInterval = setInterval(() => {
|
|
66
66
|
callback?.({
|
|
67
67
|
method: 'interval',
|
|
68
|
-
fragment: this.beElement.
|
|
68
|
+
fragment: this.beElement.timerInterval,
|
|
69
69
|
be: this.beElement,
|
|
70
70
|
root: this.beElement
|
|
71
71
|
});
|
|
@@ -84,8 +84,9 @@ export class TimersHandler {
|
|
|
84
84
|
return this.beElement;
|
|
85
85
|
}
|
|
86
86
|
clearTimeout(callback) {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if (this.beElement.timerOut)
|
|
88
|
+
clearTimeout(this.beElement.timerOut);
|
|
89
|
+
this.beElement.timerOut = null;
|
|
89
90
|
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
90
91
|
const aug = be(el);
|
|
91
92
|
if (aug.BeTimer !== null) {
|
|
@@ -102,8 +103,9 @@ export class TimersHandler {
|
|
|
102
103
|
return this.beElement;
|
|
103
104
|
}
|
|
104
105
|
clearInterval(callback) {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
if (this.beElement.timerInterval)
|
|
107
|
+
clearInterval(this.beElement.timerInterval);
|
|
108
|
+
this.beElement.timerInterval = null;
|
|
107
109
|
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
108
110
|
const aug = be(el);
|
|
109
111
|
if (aug.BeInterval !== null) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Be } from './be.js';
|
|
2
|
-
export type CombineElements<T extends string> = T extends
|
|
2
|
+
export type CombineElements<T extends string> = T extends unknown ? T | `${T} ${CombineElements<T>}` : never;
|
|
3
3
|
export type IsWhat = 'element' | 'array' | 'qy';
|
|
4
|
-
export type PositionSnapOptions = 'top' | 'right' | 'bottom' | 'left' | `${'top' | 'right' | '
|
|
4
|
+
export type PositionSnapOptions = 'top' | 'right' | 'bottom' | 'left' | 'center' | `${'top' | 'bottom'} ${'left' | 'right' | 'center'}` | `${'left' | 'right'} ${'top' | 'bottom' | 'center'}`;
|
|
5
5
|
export type HandlerCallbackProps = {
|
|
6
6
|
be: Be;
|
|
7
|
-
fragment:
|
|
7
|
+
fragment: unknown;
|
|
8
8
|
root: Be;
|
|
9
|
-
requested?:
|
|
9
|
+
requested?: unknown;
|
|
10
10
|
method?: string;
|
|
11
11
|
};
|
|
12
12
|
export type HandlerCallBackFn = (element: HandlerCallbackProps) => void;
|
|
@@ -16,7 +16,7 @@ export type HandlerCallBack = {
|
|
|
16
16
|
export type ExpandTyping<T> = T extends infer O ? {
|
|
17
17
|
[K in keyof O]: O[K];
|
|
18
18
|
} : never;
|
|
19
|
-
export interface CommonHandler<T =
|
|
19
|
+
export interface CommonHandler<T = unknown, H = unknown, V = unknown> {
|
|
20
20
|
handle: (actions: H) => Be;
|
|
21
21
|
methods: string[] | keyof T;
|
|
22
22
|
valueOf: () => V;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Be } from './be.js';
|
|
2
|
-
import type { CommonHandler } from './types.js';
|
|
2
|
+
import type { CommonHandler, PositionSnapOptions } from './types.js';
|
|
3
3
|
interface isHTMLReturn {
|
|
4
4
|
isHtml: boolean;
|
|
5
5
|
tag: string;
|
|
@@ -18,7 +18,7 @@ export declare class BeUtils {
|
|
|
18
18
|
returnHTMLelement?: boolean;
|
|
19
19
|
transformTextToHtml?: boolean;
|
|
20
20
|
}): isHTMLReturn;
|
|
21
|
-
static calculateAnchorPoint(rect: DOMRect, anchor:
|
|
21
|
+
static calculateAnchorPoint(rect: DOMRect, anchor: PositionSnapOptions): [number, number];
|
|
22
22
|
static applyStyle(beElement: Be, property: string, value: string): void;
|
|
23
23
|
static applyCallback(el: HTMLElement | HTMLCollection, callback: (el: HTMLElement) => void): void;
|
|
24
24
|
static resolveIndirection<T = CommonHandler>(classHandler: CommonHandler, actions: keyof T): {
|
package/dist/utils.js
CHANGED
|
@@ -62,33 +62,36 @@ export class BeUtils {
|
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
64
|
static calculateAnchorPoint(rect, anchor) {
|
|
65
|
-
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
let x = rect.left; // Valeur par défaut pour x
|
|
66
|
+
let y = rect.top; // Valeur par défaut pour y
|
|
67
|
+
if (typeof anchor === 'string') {
|
|
68
|
+
const [vertical, horizontal] = anchor.split(' ');
|
|
69
|
+
switch (vertical) {
|
|
70
|
+
case 'top':
|
|
71
|
+
y = rect.top;
|
|
72
|
+
break;
|
|
73
|
+
case 'bottom':
|
|
74
|
+
y = rect.bottom;
|
|
75
|
+
break;
|
|
76
|
+
case 'center':
|
|
77
|
+
y = rect.top + rect.height / 2;
|
|
78
|
+
x = rect.left + rect.width / 2;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
switch (horizontal) {
|
|
82
|
+
case 'left':
|
|
83
|
+
x = rect.left;
|
|
84
|
+
break;
|
|
85
|
+
case 'right':
|
|
86
|
+
x = rect.right;
|
|
87
|
+
break;
|
|
88
|
+
case 'center':
|
|
89
|
+
x = rect.left + rect.width / 2;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
x = rect.left;
|
|
83
|
-
break;
|
|
84
|
-
case 'right':
|
|
85
|
-
x = rect.right;
|
|
86
|
-
break;
|
|
87
|
-
case 'center':
|
|
88
|
-
x = rect.left + rect.width / 2;
|
|
89
|
-
break;
|
|
90
|
-
default:
|
|
91
|
-
x = rect.left;
|
|
93
|
+
else {
|
|
94
|
+
throw new Error('Invalid anchor type. Expected a string.');
|
|
92
95
|
}
|
|
93
96
|
return [x, y];
|
|
94
97
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medyll/idae-be",
|
|
3
3
|
"scope": "@medyll",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.84.0",
|
|
5
5
|
"description": "A powerful DOM manipulation library with a callback-based approach for precise element targeting. Provides consistent chaining, comprehensive DOM traversal, event handling, style management, and more. Written in TypeScript for modern browsers.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|
package/dist/modules/props.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Be } from '../be.js';
|
|
2
|
-
import type { CommonHandler, HandlerCallBack, HandlerCallBackFn } from '../types.js';
|
|
3
|
-
declare enum PropsMethods {
|
|
4
|
-
set = "set",
|
|
5
|
-
get = "get",
|
|
6
|
-
delete = "delete",
|
|
7
|
-
getKey = "getKey"
|
|
8
|
-
}
|
|
9
|
-
export interface PropsHandlerHandle {
|
|
10
|
-
set?: {
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
} & HandlerCallBack;
|
|
13
|
-
delete?: {
|
|
14
|
-
keys: string[];
|
|
15
|
-
} & HandlerCallBack;
|
|
16
|
-
}
|
|
17
|
-
export declare class PropsHandler implements CommonHandler<PropsHandler, PropsHandlerHandle> {
|
|
18
|
-
private beElement;
|
|
19
|
-
static methods: PropsMethods[];
|
|
20
|
-
constructor(beElement: Be);
|
|
21
|
-
methods: (keyof PropsHandler)[];
|
|
22
|
-
handle(actions: PropsHandlerHandle): Be;
|
|
23
|
-
get(name: string, callback?: HandlerCallBackFn): any;
|
|
24
|
-
set(nameOrObject: string | Record<string, any>, value?: any, callback?: HandlerCallBackFn): Be;
|
|
25
|
-
delete(name: string, callback?: HandlerCallBackFn): Be;
|
|
26
|
-
getKey(key: string, callback?: HandlerCallBackFn): string | null;
|
|
27
|
-
valueOf(): Record<string, any> | null;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
package/dist/modules/props.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Be } from '../be.js';
|
|
2
|
-
var PropsMethods;
|
|
3
|
-
(function (PropsMethods) {
|
|
4
|
-
PropsMethods["set"] = "set";
|
|
5
|
-
PropsMethods["get"] = "get";
|
|
6
|
-
PropsMethods["delete"] = "delete";
|
|
7
|
-
PropsMethods["getKey"] = "getKey";
|
|
8
|
-
})(PropsMethods || (PropsMethods = {}));
|
|
9
|
-
export class PropsHandler {
|
|
10
|
-
beElement;
|
|
11
|
-
static methods = Object.values(PropsMethods);
|
|
12
|
-
constructor(beElement) {
|
|
13
|
-
this.beElement = beElement;
|
|
14
|
-
}
|
|
15
|
-
methods = PropsHandler.methods;
|
|
16
|
-
handle(actions) {
|
|
17
|
-
if (!actions)
|
|
18
|
-
return this.beElement;
|
|
19
|
-
Object.entries(actions).forEach(([method, props]) => {
|
|
20
|
-
switch (method) {
|
|
21
|
-
case 'set':
|
|
22
|
-
{
|
|
23
|
-
const [key, val] = Object.entries(props)[0];
|
|
24
|
-
this.set(key, val, props.callback);
|
|
25
|
-
}
|
|
26
|
-
break;
|
|
27
|
-
case 'delete':
|
|
28
|
-
this.delete(props.delete);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return this.beElement;
|
|
33
|
-
}
|
|
34
|
-
get(name, callback) {
|
|
35
|
-
if (this.beElement.isWhat !== 'element')
|
|
36
|
-
return null;
|
|
37
|
-
return this.beElement.inputNode[name];
|
|
38
|
-
}
|
|
39
|
-
set(nameOrObject, value, callback) {
|
|
40
|
-
this.beElement.eachNode((el) => {
|
|
41
|
-
if (typeof nameOrObject === 'string' && value !== undefined) {
|
|
42
|
-
el[nameOrObject] = value;
|
|
43
|
-
}
|
|
44
|
-
else if (typeof nameOrObject === 'object') {
|
|
45
|
-
Object.entries(nameOrObject).forEach(([name, val]) => {
|
|
46
|
-
el[name] = val;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return this.beElement;
|
|
51
|
-
}
|
|
52
|
-
delete(name, callback) { }
|
|
53
|
-
getKey(key, callback) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
valueOf() {
|
|
57
|
-
if (this.beElement.isWhat !== 'element')
|
|
58
|
-
return null;
|
|
59
|
-
const el = this.beElement.inputNode;
|
|
60
|
-
const props = {};
|
|
61
|
-
for (let prop in el) {
|
|
62
|
-
if (el.hasOwnProperty(prop)) {
|
|
63
|
-
props[prop] = el[prop];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return props;
|
|
67
|
-
}
|
|
68
|
-
}
|