qc-ui-lit 0.0.8 → 0.1.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.
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { r as e } from "../AMap/AMap.js";
|
|
2
2
|
import { LitElement as t, css as n, html as r } from "lit";
|
|
3
3
|
import { customElement as i } from "lit/decorators.js";
|
|
4
|
+
//#region src/tools/debounce/debounce.ts
|
|
5
|
+
function a(e, t = 300, n = !1) {
|
|
6
|
+
let r = null, i, a = function(...a) {
|
|
7
|
+
let o = n && !r;
|
|
8
|
+
return r && clearTimeout(r), r = setTimeout(() => {
|
|
9
|
+
r = null, n || (i = e.apply(this, a));
|
|
10
|
+
}, t), o && (i = e.apply(this, a)), i;
|
|
11
|
+
};
|
|
12
|
+
return a.cancel = () => {
|
|
13
|
+
r &&= (clearTimeout(r), null);
|
|
14
|
+
}, a.flush = function() {
|
|
15
|
+
return r && (clearTimeout(r), r = null, i = e.apply(this)), i;
|
|
16
|
+
}, a;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
4
19
|
//#region src/components/Resize/qc-resize.ts
|
|
5
|
-
var
|
|
20
|
+
var o = class extends t {
|
|
6
21
|
constructor(...e) {
|
|
7
22
|
super(...e), this.resizeObserver = new ResizeObserver((e) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
});
|
|
23
|
+
this.onResize(e[0].contentRect);
|
|
24
|
+
}), this.onResize = a((e) => {
|
|
25
|
+
this.dispatchEvent(new CustomEvent("resize", { detail: { rect: e } }));
|
|
26
|
+
}, 400);
|
|
12
27
|
}
|
|
13
28
|
firstUpdated() {
|
|
14
29
|
let e = this.renderRoot.querySelector("#qc-resize");
|
|
@@ -28,6 +43,6 @@ var a = class extends t {
|
|
|
28
43
|
`;
|
|
29
44
|
}
|
|
30
45
|
};
|
|
31
|
-
|
|
46
|
+
o = e([i("qc-resize")], o);
|
|
32
47
|
//#endregion
|
|
33
|
-
export { a as t };
|
|
48
|
+
export { a as n, o as t };
|
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class QCResize extends LitElement {
|
|
8
8
|
resizeObserver: ResizeObserver;
|
|
9
|
+
onResize: import("@/tools").DebouncedFunction<(rect: DOMRectReadOnly) => void>;
|
|
9
10
|
firstUpdated(): void;
|
|
10
11
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
11
12
|
static styles: import("lit").CSSResult;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e, t } from "./components/AMap/AMap.js";
|
|
2
2
|
import { t as n } from "./components/Loading/Loading.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
export { t as AMap,
|
|
3
|
+
import { n as r, t as i } from "./components/Resize/Resize.js";
|
|
4
|
+
import { t as a } from "./components/ECharts/ECharts.js";
|
|
5
|
+
export { t as AMap, a as EChartsElement, n as QCLoading, i as QCResize, r as debounce, e as loadAMap };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DebouncedFunction<T extends (...args: any[]) => any> = {
|
|
2
|
+
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
3
|
+
cancel(): void;
|
|
4
|
+
flush(): ReturnType<T> | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, immediate?: boolean): DebouncedFunction<T>;
|
|
7
|
+
export default debounce;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import debounce from './debounce/debounce';
|
|
1
2
|
export * from './loadAMap/loadAMap';
|
|
3
|
+
export * from './debounce/debounce';
|
|
2
4
|
declare const _default: {
|
|
3
5
|
loadAMap: (options: import(".").Options) => Promise<void>;
|
|
6
|
+
debounce: typeof debounce;
|
|
4
7
|
};
|
|
5
8
|
export default _default;
|