fix
This commit is contained in:
parent
c8ec2e3759
commit
430b99b4b8
31
dist/remote/GBadge.js
vendored
31
dist/remote/GBadge.js
vendored
@ -1,4 +1,4 @@
|
|||||||
const p = {
|
const c = {
|
||||||
fontSize: "sm",
|
fontSize: "sm",
|
||||||
colorScheme: "teal",
|
colorScheme: "teal",
|
||||||
variant: "subtle",
|
variant: "subtle",
|
||||||
@ -17,29 +17,32 @@ function i() {
|
|||||||
);
|
);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
function l(t = {}) {
|
function d(t = {}) {
|
||||||
const { children: e, theme: r, chakraProviderProps: n, ...o } = t;
|
const { children: e, theme: r, chakraProviderProps: n, ...o } = t;
|
||||||
return {
|
return {
|
||||||
children: e,
|
children: e,
|
||||||
theme: r,
|
theme: r,
|
||||||
chakraProviderProps: n,
|
chakraProviderProps: n,
|
||||||
badgeProps: {
|
badgeProps: {
|
||||||
...p,
|
...c,
|
||||||
...o,
|
...o,
|
||||||
fontFamily: o.fontFamily || "var(--uikit-font-family, inherit)"
|
fontFamily: o.fontFamily || "var(--uikit-font-family, inherit)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
class m extends HTMLElement {
|
class l extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(), this._props = {}, this._root = null;
|
super(), this._props = {}, this._root = null, this._unmountTimer = null;
|
||||||
}
|
}
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
this._unmountTimer && (clearTimeout(this._unmountTimer), this._unmountTimer = null);
|
||||||
const { createRoot: e } = i();
|
const { createRoot: e } = i();
|
||||||
this._root || (this._root = e(this)), this.renderComponent();
|
this._root || (this._root = e(this)), this.renderComponent();
|
||||||
}
|
}
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
this._root && (this._root.unmount(), this._root = null);
|
!this._root || this._unmountTimer || (this._unmountTimer = setTimeout(() => {
|
||||||
|
this._unmountTimer = null, this._root && (this._root.unmount(), this._root = null);
|
||||||
|
}, 0));
|
||||||
}
|
}
|
||||||
set componentProps(e) {
|
set componentProps(e) {
|
||||||
this._props = e ?? {}, this.isConnected && this.renderComponent();
|
this._props = e ?? {}, this.isConnected && this.renderComponent();
|
||||||
@ -49,19 +52,25 @@ class m extends HTMLElement {
|
|||||||
}
|
}
|
||||||
renderComponent() {
|
renderComponent() {
|
||||||
if (!this._root) return;
|
if (!this._root) return;
|
||||||
const { React: e, ChakraProvider: r, Badge: n, theme: o, chakraProviderProps: s } = i(), { children: a, theme: c, chakraProviderProps: d, badgeProps: h } = l(this._props);
|
const {
|
||||||
|
React: e,
|
||||||
|
ChakraProvider: r,
|
||||||
|
Badge: n,
|
||||||
|
theme: o,
|
||||||
|
chakraProviderProps: s
|
||||||
|
} = i(), { children: a, theme: h, chakraProviderProps: m, badgeProps: u } = d(this._props);
|
||||||
this._root.render(
|
this._root.render(
|
||||||
e.createElement(
|
e.createElement(
|
||||||
r,
|
r,
|
||||||
{
|
{
|
||||||
theme: c || o,
|
theme: h || o,
|
||||||
resetCSS: !1,
|
resetCSS: !1,
|
||||||
...s || {},
|
...s || {},
|
||||||
...d || {}
|
...m || {}
|
||||||
},
|
},
|
||||||
e.createElement(n, h, a)
|
e.createElement(n, u, a)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.get("uikit-g-badge") || customElements.define("uikit-g-badge", m);
|
customElements.get("uikit-g-badge") || customElements.define("uikit-g-badge", l);
|
||||||
|
|||||||
135
dist/remote/Pagination.js
vendored
135
dist/remote/Pagination.js
vendored
@ -36,7 +36,7 @@ const H = {
|
|||||||
getPageNumbers: () => []
|
getPageNumbers: () => []
|
||||||
}
|
}
|
||||||
}, V = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], ne = /[۰-۹]/g, oe = /[٠-٩]/g;
|
}, V = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], ne = /[۰-۹]/g, oe = /[٠-٩]/g;
|
||||||
function k() {
|
function I() {
|
||||||
const t = window.__UIKIT_REMOTE_DEPS__, e = [];
|
const t = window.__UIKIT_REMOTE_DEPS__, e = [];
|
||||||
if (t?.React || e.push("React"), t?.createRoot || e.push("createRoot"), t?.ChakraProvider || e.push("ChakraProvider"), t?.Button || e.push("Button"), t?.HStack || e.push("HStack"), t?.IconButton || e.push("IconButton"), t?.Input || e.push("Input"), t?.Text || e.push("Text"), e.length)
|
if (t?.React || e.push("React"), t?.createRoot || e.push("createRoot"), t?.ChakraProvider || e.push("ChakraProvider"), t?.Button || e.push("Button"), t?.HStack || e.push("HStack"), t?.IconButton || e.push("IconButton"), t?.Input || e.push("Input"), t?.Text || e.push("Text"), e.length)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@ -57,11 +57,11 @@ function re(t) {
|
|||||||
return H[t] ? t : "full";
|
return H[t] ? t : "full";
|
||||||
}
|
}
|
||||||
function W(t, e) {
|
function W(t, e) {
|
||||||
const m = Number(t), g = Number(e);
|
const p = Number(t), h = Number(e);
|
||||||
return !g || g <= 0 || !m || Number.isNaN(m) ? 1 : Math.min(Math.max(m, 1), g);
|
return !h || h <= 0 || !p || Number.isNaN(p) ? 1 : Math.min(Math.max(p, 1), h);
|
||||||
}
|
}
|
||||||
function ie(t) {
|
function ie(t) {
|
||||||
const { React: e } = k();
|
const { React: e } = I();
|
||||||
return e.createElement(
|
return e.createElement(
|
||||||
"svg",
|
"svg",
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ function ie(t) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
function se(t) {
|
function se(t) {
|
||||||
const { React: e } = k();
|
const { React: e } = I();
|
||||||
return e.createElement(
|
return e.createElement(
|
||||||
"svg",
|
"svg",
|
||||||
{
|
{
|
||||||
@ -107,109 +107,109 @@ function se(t) {
|
|||||||
function ue({
|
function ue({
|
||||||
currentPage: t = 1,
|
currentPage: t = 1,
|
||||||
totalCount: e = 0,
|
totalCount: e = 0,
|
||||||
totalPages: m,
|
totalPages: p,
|
||||||
pageSize: g = 10,
|
pageSize: h = 10,
|
||||||
onPageChange: h,
|
onPageChange: g,
|
||||||
level: v = "full",
|
level: v = "full",
|
||||||
...B
|
...B
|
||||||
}) {
|
}) {
|
||||||
const { React: n, Button: K, HStack: S, IconButton: j, Input: O, Text: P } = k(), { useCallback: I, useEffect: N, useMemo: U, useRef: X, useState: R } = n, F = re(v), f = H[F], r = F === "simple", y = Number(g), $ = Number.isFinite(y) && y > 0 ? y : 10, L = Number(e), D = Number.isFinite(L) && L > 0 ? L : 0, A = Number(m), u = Number.isFinite(A) && A > 0 ? Math.ceil(A) : Math.ceil(D / $), i = W(t, u), [d, c] = R(
|
const { React: n, Button: K, HStack: k, IconButton: j, Input: O, Text: P } = I(), { useCallback: C, useEffect: N, useMemo: U, useRef: X, useState: R } = n, F = re(v), m = H[F], r = F === "simple", y = Number(h), $ = Number.isFinite(y) && y > 0 ? y : 10, L = Number(e), D = Number.isFinite(L) && L > 0 ? L : 0, A = Number(p), u = Number.isFinite(A) && A > 0 ? Math.ceil(A) : Math.ceil(D / $), i = W(t, u), [d, l] = R(
|
||||||
r ? "" : a(i)
|
r ? "" : a(i)
|
||||||
), [E, b] = R(!1), [p, l] = R(null), C = X(null), w = p ?? i, q = D > 0, J = U(() => r || u <= 0 ? [] : Array.from(
|
), [E, b] = R(!1), [f, c] = R(null), _ = X(null), w = f ?? i, q = D > 0, J = U(() => r || u <= 0 ? [] : Array.from(
|
||||||
new Set(
|
new Set(
|
||||||
f.getPageNumbers({
|
m.getPageNumbers({
|
||||||
currentPage: i,
|
currentPage: i,
|
||||||
totalPages: u
|
totalPages: u
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
).filter((o) => o >= 1 && o <= u).sort((o, s) => o - s), [f, r, i, u]), _ = I(() => {
|
).filter((o) => o >= 1 && o <= u).sort((o, s) => o - s), [m, r, i, u]), T = C(() => {
|
||||||
c(r ? "" : a(i)), b(!1), l(null);
|
l(r ? "" : a(i)), b(!1), c(null);
|
||||||
}, [r, i]), M = I(
|
}, [r, i]), M = C(
|
||||||
(o) => {
|
(o) => {
|
||||||
const s = W(o, u);
|
const s = W(o, u);
|
||||||
b(!1), c(r ? "" : a(i)), l(null), s !== i && h?.(s);
|
b(!1), l(r ? "" : a(i)), c(null), s !== i && g?.(s);
|
||||||
},
|
},
|
||||||
[r, h, i, u]
|
[r, g, i, u]
|
||||||
), x = I(() => {
|
), S = C(() => {
|
||||||
if (!d) {
|
if (!d) {
|
||||||
_(), C.current?.blur();
|
T(), _.current?.blur();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const o = parseInt(G(d), 10);
|
const o = parseInt(G(d), 10);
|
||||||
if (Number.isNaN(o)) {
|
if (Number.isNaN(o)) {
|
||||||
_(), C.current?.blur();
|
T(), _.current?.blur();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const s = W(o, u);
|
const s = W(o, u);
|
||||||
if (r) {
|
if (r) {
|
||||||
b(!1), c(""), s !== i ? (l(s), h?.(s)) : l(null), C.current?.blur();
|
b(!1), l(""), s !== i ? (c(s), g?.(s)) : c(null), _.current?.blur();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s !== i ? (l(s), c(a(s)), h?.(s)) : (c(a(i)), b(!1), l(null)), C.current?.blur();
|
s !== i ? (c(s), l(a(s)), g?.(s)) : (l(a(i)), b(!1), c(null)), _.current?.blur();
|
||||||
}, [
|
}, [
|
||||||
d,
|
d,
|
||||||
r,
|
r,
|
||||||
h,
|
g,
|
||||||
_,
|
T,
|
||||||
i,
|
i,
|
||||||
u
|
u
|
||||||
]), Q = I(() => {
|
]), Q = C(() => {
|
||||||
l(null), c(""), b(!0);
|
c(null), l(""), b(!0);
|
||||||
}, []), Y = I((o) => {
|
}, []), Y = C((o) => {
|
||||||
const s = o.target.value, te = G(s).replace(/\D/g, "");
|
const s = o.target.value, te = G(s).replace(/\D/g, "");
|
||||||
c(a(te));
|
l(a(te));
|
||||||
}, []);
|
}, []);
|
||||||
if (N(() => {
|
if (N(() => {
|
||||||
if (r) {
|
if (r) {
|
||||||
p !== null && i === p && l(null);
|
f !== null && i === f && c(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p !== null) {
|
if (f !== null) {
|
||||||
i === p && (l(null), b(!1), c(a(i)));
|
i === f && (c(null), b(!1), l(a(i)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
E || c(a(i));
|
E || l(a(i));
|
||||||
}, [E, r, p, i]), N(() => {
|
}, [E, r, f, i]), N(() => {
|
||||||
r && E && C.current?.focus();
|
r && E && _.current?.focus();
|
||||||
}, [E, r]), N(() => {
|
}, [E, r]), N(() => {
|
||||||
if (!E || !d || !r && p !== null) return;
|
if (!E || !d || !r && f !== null) return;
|
||||||
const o = setTimeout(() => {
|
const o = setTimeout(() => {
|
||||||
x();
|
S();
|
||||||
}, 1e3);
|
}, 1e3);
|
||||||
return () => clearTimeout(o);
|
return () => clearTimeout(o);
|
||||||
}, [x, d, E, r, p]), u <= 0) return null;
|
}, [S, d, E, r, f]), u <= 0) return null;
|
||||||
const z = () => n.createElement(O, {
|
const z = () => n.createElement(O, {
|
||||||
ref: C,
|
ref: _,
|
||||||
type: "text",
|
type: "text",
|
||||||
inputMode: "numeric",
|
inputMode: "numeric",
|
||||||
placeholder: "صفحه",
|
placeholder: "صفحه",
|
||||||
w: f.inputWidth,
|
w: m.inputWidth,
|
||||||
value: d,
|
value: d,
|
||||||
onFocus: () => {
|
onFocus: () => {
|
||||||
r || (b(!0), l(null), c(""));
|
r || (b(!0), c(null), l(""));
|
||||||
},
|
},
|
||||||
onChange: Y,
|
onChange: Y,
|
||||||
onBlur: () => {
|
onBlur: () => {
|
||||||
if (d) {
|
if (d) {
|
||||||
r && x();
|
r && S();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_();
|
T();
|
||||||
},
|
},
|
||||||
onKeyDown: (o) => {
|
onKeyDown: (o) => {
|
||||||
o.key === "Enter" && x(), o.key === "Escape" && _();
|
o.key === "Enter" && S(), o.key === "Escape" && T();
|
||||||
},
|
},
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
color: "#1D2939",
|
color: "#1D2939",
|
||||||
px: 1,
|
px: 1,
|
||||||
minW: 0,
|
minW: 0,
|
||||||
dir: "ltr"
|
dir: "ltr"
|
||||||
}), T = (o, s = !1) => n.createElement(
|
}), x = (o, s = !1) => n.createElement(
|
||||||
K,
|
K,
|
||||||
{
|
{
|
||||||
key: o,
|
key: o,
|
||||||
size: "md",
|
size: "md",
|
||||||
px: f.pageButtonPx,
|
px: m.pageButtonPx,
|
||||||
bg: s ? "#4B49AC" : "#e6e6f1",
|
bg: s ? "#4B49AC" : "#e6e6f1",
|
||||||
color: s ? "#e6e6f1" : "#4B49AC",
|
color: s ? "#e6e6f1" : "#4B49AC",
|
||||||
_hover: { bg: s ? "#4B49AC" : "#cbcbe8" },
|
_hover: { bg: s ? "#4B49AC" : "#cbcbe8" },
|
||||||
@ -219,9 +219,9 @@ function ue({
|
|||||||
a(o)
|
a(o)
|
||||||
), Z = r && u > 1 && w !== 1, ee = r && u > 1 && w !== u;
|
), Z = r && u > 1 && w !== 1, ee = r && u > 1 && w !== u;
|
||||||
return n.createElement(
|
return n.createElement(
|
||||||
S,
|
k,
|
||||||
{
|
{
|
||||||
justifyContent: f.justifyContent,
|
justifyContent: m.justifyContent,
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
py: "10px",
|
py: "10px",
|
||||||
px: "16px",
|
px: "16px",
|
||||||
@ -231,8 +231,8 @@ function ue({
|
|||||||
w: "100%",
|
w: "100%",
|
||||||
...B
|
...B
|
||||||
},
|
},
|
||||||
f.showPageSummary && n.createElement(
|
m.showPageSummary && n.createElement(
|
||||||
S,
|
k,
|
||||||
{ spacing: 2, whiteSpace: "nowrap" },
|
{ spacing: 2, whiteSpace: "nowrap" },
|
||||||
n.createElement(P, { fontWeight: "bold" }, "صفحه"),
|
n.createElement(P, { fontWeight: "bold" }, "صفحه"),
|
||||||
n.createElement(P, null, a(i)),
|
n.createElement(P, null, a(i)),
|
||||||
@ -240,7 +240,7 @@ function ue({
|
|||||||
n.createElement(P, null, a(u))
|
n.createElement(P, null, a(u))
|
||||||
),
|
),
|
||||||
n.createElement(
|
n.createElement(
|
||||||
S,
|
k,
|
||||||
{ spacing: 2, alignItems: "center", justifyContent: "center" },
|
{ spacing: 2, alignItems: "center", justifyContent: "center" },
|
||||||
n.createElement(j, {
|
n.createElement(j, {
|
||||||
size: "md",
|
size: "md",
|
||||||
@ -253,18 +253,18 @@ function ue({
|
|||||||
"aria-label": "صفحه قبلی"
|
"aria-label": "صفحه قبلی"
|
||||||
}),
|
}),
|
||||||
r ? [
|
r ? [
|
||||||
Z ? T(1) : null,
|
Z ? x(1) : null,
|
||||||
E ? n.createElement(
|
E ? n.createElement(
|
||||||
n.Fragment,
|
n.Fragment,
|
||||||
{ key: "input" },
|
{ key: "input" },
|
||||||
z()
|
z()
|
||||||
) : T(w, !0),
|
) : x(w, !0),
|
||||||
ee ? T(u) : null
|
ee ? x(u) : null
|
||||||
] : [
|
] : [
|
||||||
...J.map(
|
...J.map(
|
||||||
(o) => T(o, i === o)
|
(o) => x(o, i === o)
|
||||||
),
|
),
|
||||||
f.showInput ? n.createElement(
|
m.showInput ? n.createElement(
|
||||||
n.Fragment,
|
n.Fragment,
|
||||||
{ key: "input" },
|
{ key: "input" },
|
||||||
z()
|
z()
|
||||||
@ -281,8 +281,8 @@ function ue({
|
|||||||
"aria-label": "صفحه بعدی"
|
"aria-label": "صفحه بعدی"
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
f.showTotalCount && q && n.createElement(
|
m.showTotalCount && q && n.createElement(
|
||||||
S,
|
k,
|
||||||
{ spacing: 2, whiteSpace: "nowrap" },
|
{ spacing: 2, whiteSpace: "nowrap" },
|
||||||
n.createElement(
|
n.createElement(
|
||||||
P,
|
P,
|
||||||
@ -295,14 +295,17 @@ function ue({
|
|||||||
}
|
}
|
||||||
class ae extends HTMLElement {
|
class ae extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(), this._props = {}, this._root = null;
|
super(), this._props = {}, this._root = null, this._unmountTimer = null;
|
||||||
}
|
}
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
const { createRoot: e } = k();
|
this._unmountTimer && (clearTimeout(this._unmountTimer), this._unmountTimer = null);
|
||||||
|
const { createRoot: e } = I();
|
||||||
this._root || (this._root = e(this)), this.renderComponent();
|
this._root || (this._root = e(this)), this.renderComponent();
|
||||||
}
|
}
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
this._root && (this._root.unmount(), this._root = null);
|
!this._root || this._unmountTimer || (this._unmountTimer = setTimeout(() => {
|
||||||
|
this._unmountTimer = null, this._root && (this._root.unmount(), this._root = null);
|
||||||
|
}, 0));
|
||||||
}
|
}
|
||||||
set componentProps(e) {
|
set componentProps(e) {
|
||||||
this._props = e ?? {}, this.isConnected && this.renderComponent();
|
this._props = e ?? {}, this.isConnected && this.renderComponent();
|
||||||
@ -314,17 +317,17 @@ class ae extends HTMLElement {
|
|||||||
if (!this._root) return;
|
if (!this._root) return;
|
||||||
const {
|
const {
|
||||||
React: e,
|
React: e,
|
||||||
ChakraProvider: m,
|
ChakraProvider: p,
|
||||||
theme: g,
|
theme: h,
|
||||||
chakraProviderProps: h
|
chakraProviderProps: g
|
||||||
} = k(), { theme: v, chakraProviderProps: B, ...n } = this._props || {};
|
} = I(), { theme: v, chakraProviderProps: B, ...n } = this._props || {};
|
||||||
this._root.render(
|
this._root.render(
|
||||||
e.createElement(
|
e.createElement(
|
||||||
m,
|
p,
|
||||||
{
|
{
|
||||||
theme: v || g,
|
theme: v || h,
|
||||||
resetCSS: !1,
|
resetCSS: !1,
|
||||||
...h || {},
|
...g || {},
|
||||||
...B || {}
|
...B || {}
|
||||||
},
|
},
|
||||||
e.createElement(ue, n)
|
e.createElement(ue, n)
|
||||||
|
|||||||
@ -50,9 +50,15 @@ class GBadgeElement extends HTMLElement {
|
|||||||
|
|
||||||
this._props = {};
|
this._props = {};
|
||||||
this._root = null;
|
this._root = null;
|
||||||
|
this._unmountTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
if (this._unmountTimer) {
|
||||||
|
clearTimeout(this._unmountTimer);
|
||||||
|
this._unmountTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
const { createRoot } = getRemoteDeps();
|
const { createRoot } = getRemoteDeps();
|
||||||
|
|
||||||
if (!this._root) {
|
if (!this._root) {
|
||||||
@ -63,10 +69,16 @@ class GBadgeElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
if (this._root) {
|
if (!this._root || this._unmountTimer) return;
|
||||||
|
|
||||||
|
this._unmountTimer = setTimeout(() => {
|
||||||
|
this._unmountTimer = null;
|
||||||
|
|
||||||
|
if (!this._root) return;
|
||||||
|
|
||||||
this._root.unmount();
|
this._root.unmount();
|
||||||
this._root = null;
|
this._root = null;
|
||||||
}
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
set componentProps(value) {
|
set componentProps(value) {
|
||||||
@ -84,10 +96,16 @@ class GBadgeElement extends HTMLElement {
|
|||||||
renderComponent() {
|
renderComponent() {
|
||||||
if (!this._root) return;
|
if (!this._root) return;
|
||||||
|
|
||||||
const { React, ChakraProvider, Badge, theme: defaultTheme, chakraProviderProps: defaultProviderProps } =
|
const {
|
||||||
getRemoteDeps();
|
React,
|
||||||
|
ChakraProvider,
|
||||||
|
Badge,
|
||||||
|
theme: defaultTheme,
|
||||||
|
chakraProviderProps: defaultProviderProps,
|
||||||
|
} = getRemoteDeps();
|
||||||
|
|
||||||
const { children, theme, chakraProviderProps, badgeProps } = normalizeBadgeProps(this._props);
|
const { children, theme, chakraProviderProps, badgeProps } =
|
||||||
|
normalizeBadgeProps(this._props);
|
||||||
|
|
||||||
this._root.render(
|
this._root.render(
|
||||||
React.createElement(
|
React.createElement(
|
||||||
|
|||||||
@ -496,9 +496,15 @@ class PaginationElement extends HTMLElement {
|
|||||||
|
|
||||||
this._props = {};
|
this._props = {};
|
||||||
this._root = null;
|
this._root = null;
|
||||||
|
this._unmountTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
if (this._unmountTimer) {
|
||||||
|
clearTimeout(this._unmountTimer);
|
||||||
|
this._unmountTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
const { createRoot } = getRemoteDeps();
|
const { createRoot } = getRemoteDeps();
|
||||||
|
|
||||||
if (!this._root) {
|
if (!this._root) {
|
||||||
@ -509,10 +515,16 @@ class PaginationElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
if (this._root) {
|
if (!this._root || this._unmountTimer) return;
|
||||||
|
|
||||||
|
this._unmountTimer = setTimeout(() => {
|
||||||
|
this._unmountTimer = null;
|
||||||
|
|
||||||
|
if (!this._root) return;
|
||||||
|
|
||||||
this._root.unmount();
|
this._root.unmount();
|
||||||
this._root = null;
|
this._root = null;
|
||||||
}
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
set componentProps(value) {
|
set componentProps(value) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user