@schukai/monster 3.102.2 → 3.102.3
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 +11 -0
- package/package.json +1 -1
- package/source/components/datatable/datatable.mjs +1190 -1196
- package/source/components/datatable/stylesheet/datatable.mjs +13 -6
- package/source/components/form/form.mjs +1 -2
- package/source/components/form/select.mjs +2191 -2198
- package/source/components/layout/split-panel.mjs +1 -2
- package/source/dom/customcontrol.mjs +35 -5
- package/source/dom/updater.mjs +795 -796
- package/source/monster.mjs +1 -0
- package/source/types/internal.mjs +0 -1
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +181 -70
@@ -23,7 +23,7 @@ import { Observer } from "../../types/observer.mjs";
|
|
23
23
|
import { SplitPanelStyleSheet } from "./stylesheet/split-panel.mjs";
|
24
24
|
import { instanceSymbol } from "../../constants.mjs";
|
25
25
|
import { internalSymbol } from "../../constants.mjs";
|
26
|
-
import {getDocument} from "../../dom/util.mjs";
|
26
|
+
import { getDocument } from "../../dom/util.mjs";
|
27
27
|
|
28
28
|
export { SplitPanel, TYPE_VERTICAL, TYPE_HORIZONTAL };
|
29
29
|
|
@@ -378,7 +378,6 @@ function initEventHandler() {
|
|
378
378
|
const dragEventHandler = (e) => {
|
379
379
|
self[internalSymbol].getSubject().isDragging = false;
|
380
380
|
|
381
|
-
|
382
381
|
document.body.style.userSelect = userSelectDefault;
|
383
382
|
|
384
383
|
document.removeEventListener("mousemove", eventListener);
|
@@ -17,6 +17,8 @@ import { addAttributeToken } from "./attributes.mjs";
|
|
17
17
|
import { ATTRIBUTE_ERRORMESSAGE } from "./constants.mjs";
|
18
18
|
import { CustomElement, attributeObserverSymbol } from "./customelement.mjs";
|
19
19
|
import { instanceSymbol } from "../constants.mjs";
|
20
|
+
import { DeadMansSwitch } from "../util/deadmansswitch.mjs";
|
21
|
+
import { addErrorAttribute } from "./error.mjs";
|
20
22
|
|
21
23
|
export { CustomControl };
|
22
24
|
|
@@ -77,8 +79,8 @@ class CustomControl extends CustomElement {
|
|
77
79
|
);
|
78
80
|
}
|
79
81
|
|
80
|
-
//
|
81
|
-
|
82
|
+
// watch for attribute value changes
|
83
|
+
initValueAttributeObserver.call(this);
|
82
84
|
}
|
83
85
|
|
84
86
|
/**
|
@@ -348,14 +350,42 @@ function getInternal() {
|
|
348
350
|
return this[attachedInternalSymbol];
|
349
351
|
}
|
350
352
|
|
353
|
+
const debounceValueSymbol = Symbol("debounceValue");
|
354
|
+
|
351
355
|
/**
|
356
|
+
*
|
357
|
+
* @issue https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/290
|
358
|
+
*
|
352
359
|
* @private
|
353
360
|
* @return {object}
|
354
361
|
* @this CustomControl
|
355
362
|
*/
|
356
|
-
function
|
357
|
-
|
363
|
+
function initValueAttributeObserver() {
|
364
|
+
const self = this;
|
365
|
+
|
358
366
|
this[attributeObserverSymbol]["value"] = () => {
|
359
|
-
|
367
|
+
if (self[debounceValueSymbol] instanceof DeadMansSwitch) {
|
368
|
+
try {
|
369
|
+
self[debounceValueSymbol].touch();
|
370
|
+
return;
|
371
|
+
} catch (e) {
|
372
|
+
// catch Error("has already run");
|
373
|
+
if (e.message !== "has already run") {
|
374
|
+
throw e;
|
375
|
+
}
|
376
|
+
delete self[debounceValueSymbol];
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
self[debounceValueSymbol] = new DeadMansSwitch(50, () => {
|
381
|
+
requestAnimationFrame(() => {
|
382
|
+
const oldValue = self.getAttribute("value");
|
383
|
+
const newValue = self.getOption("value");
|
384
|
+
|
385
|
+
if (oldValue !== newValue) {
|
386
|
+
this.setOption("value", this.getAttribute("value"));
|
387
|
+
}
|
388
|
+
});
|
389
|
+
});
|
360
390
|
};
|
361
391
|
}
|