fix pagination bug
This commit is contained in:
parent
e9d96339e2
commit
6555f89424
94
dist/remote-ui.js
vendored
94
dist/remote-ui.js
vendored
@ -1,24 +1,24 @@
|
|||||||
import g, { useRef as d, useEffect as h } from "react";
|
import k, { useRef as d, useEffect as h } from "react";
|
||||||
import { createRoot as k } from "react-dom/client";
|
import { createRoot as v } from "react-dom/client";
|
||||||
import { Text as v, Input as w, IconButton as y, HStack as E, Button as x, Badge as C, ChakraProvider as I } from "@chakra-ui/react";
|
import { Text as w, Input as y, IconButton as E, HStack as x, Button as C, Badge as I, ChakraProvider as T, useTheme as D } from "@chakra-ui/react";
|
||||||
import { a as f, D as B } from "./chunks/constants-CRZ9QfxV.js";
|
import { a as m, D as P } from "./chunks/constants-CRZ9QfxV.js";
|
||||||
import { jsx as D } from "react/jsx-runtime";
|
import { jsx as g } from "react/jsx-runtime";
|
||||||
import { AppHeader as z } from "./remote-ui-app-header.js";
|
import { AppHeader as N } from "./remote-ui-app-header.js";
|
||||||
import { AppSidebar as N } from "./remote-ui-app-sidebar.js";
|
import { AppSidebar as J } from "./remote-ui-app-sidebar.js";
|
||||||
function S(e = {}) {
|
function S(e = {}) {
|
||||||
if (typeof window > "u") return;
|
if (typeof window > "u") return;
|
||||||
const t = window[f] || {};
|
const t = window[m] || {};
|
||||||
window[f] = {
|
window[m] = {
|
||||||
...t,
|
...t,
|
||||||
React: e.React || t.React || g,
|
React: e.React || t.React || k,
|
||||||
createRoot: e.createRoot || t.createRoot || k,
|
createRoot: e.createRoot || t.createRoot || v,
|
||||||
ChakraProvider: e.ChakraProvider || t.ChakraProvider || I,
|
ChakraProvider: e.ChakraProvider || t.ChakraProvider || T,
|
||||||
Badge: e.Badge || t.Badge || C,
|
Badge: e.Badge || t.Badge || I,
|
||||||
Button: e.Button || t.Button || x,
|
Button: e.Button || t.Button || C,
|
||||||
HStack: e.HStack || t.HStack || E,
|
HStack: e.HStack || t.HStack || x,
|
||||||
IconButton: e.IconButton || t.IconButton || y,
|
IconButton: e.IconButton || t.IconButton || E,
|
||||||
Input: e.Input || t.Input || w,
|
Input: e.Input || t.Input || y,
|
||||||
Text: e.Text || t.Text || v,
|
Text: e.Text || t.Text || w,
|
||||||
...e.deps || {},
|
...e.deps || {},
|
||||||
theme: Object.prototype.hasOwnProperty.call(e, "theme") ? e.theme : t.theme,
|
theme: Object.prototype.hasOwnProperty.call(e, "theme") ? e.theme : t.theme,
|
||||||
chakraProviderProps: {
|
chakraProviderProps: {
|
||||||
@ -28,15 +28,15 @@ function S(e = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const a = /* @__PURE__ */ new Map();
|
const a = /* @__PURE__ */ new Map();
|
||||||
function T(e = []) {
|
function b(e = []) {
|
||||||
if (typeof window > "u") return !1;
|
if (typeof window > "u") return !1;
|
||||||
const t = window[f];
|
const t = window[m];
|
||||||
return e.every((r) => t == null ? void 0 : t[r]);
|
return e.every((r) => t == null ? void 0 : t[r]);
|
||||||
}
|
}
|
||||||
function b(e = []) {
|
function H(e = []) {
|
||||||
typeof window > "u" || T(e) || S();
|
typeof window > "u" || b(e) || S();
|
||||||
}
|
}
|
||||||
function H(e, t) {
|
function G(e, t) {
|
||||||
const r = `${e}:${t}`;
|
const r = `${e}:${t}`;
|
||||||
return a.has(r) || a.set(
|
return a.has(r) || a.set(
|
||||||
r,
|
r,
|
||||||
@ -49,26 +49,26 @@ function H(e, t) {
|
|||||||
})
|
})
|
||||||
), a.get(r);
|
), a.get(r);
|
||||||
}
|
}
|
||||||
function P({
|
function B({
|
||||||
componentName: e,
|
componentName: e,
|
||||||
tagName: t,
|
tagName: t,
|
||||||
defaultRemoteUrl: r,
|
defaultRemoteUrl: r,
|
||||||
requiredDeps: u,
|
requiredDeps: u,
|
||||||
normalizeProps: m
|
normalizeProps: f
|
||||||
}) {
|
}) {
|
||||||
return function({
|
return function({
|
||||||
theme: p,
|
theme: s,
|
||||||
chakraProviderProps: s,
|
chakraProviderProps: p,
|
||||||
...l
|
...l
|
||||||
}) {
|
}) {
|
||||||
const c = d(null), n = d(null), i = d(null);
|
const c = d(null), n = d(null), i = d(null);
|
||||||
return i.current = {
|
return i.current = {
|
||||||
...m ? m(l) : l,
|
...f ? f(l) : l,
|
||||||
...p !== void 0 ? { theme: p } : {},
|
...s !== void 0 ? { theme: s } : {},
|
||||||
...s ? { chakraProviderProps: s } : {}
|
...p ? { chakraProviderProps: p } : {}
|
||||||
}, h(() => {
|
}, h(() => {
|
||||||
let R = !0;
|
let R = !0;
|
||||||
return b(u), H(e, r).then(() => {
|
return H(u), G(e, r).then(() => {
|
||||||
if (!R || !c.current) return;
|
if (!R || !c.current) return;
|
||||||
const o = document.createElement(t);
|
const o = document.createElement(t);
|
||||||
o.componentProps = i.current, c.current.appendChild(o), n.current = o;
|
o.componentProps = i.current, c.current.appendChild(o), n.current = o;
|
||||||
@ -82,7 +82,7 @@ function P({
|
|||||||
};
|
};
|
||||||
}, [e, r, t]), h(() => {
|
}, [e, r, t]), h(() => {
|
||||||
n.current && (n.current.componentProps = i.current);
|
n.current && (n.current.componentProps = i.current);
|
||||||
}), /* @__PURE__ */ D(
|
}), /* @__PURE__ */ g(
|
||||||
"span",
|
"span",
|
||||||
{
|
{
|
||||||
ref: c,
|
ref: c,
|
||||||
@ -93,26 +93,26 @@ function P({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function G(e) {
|
function O(e) {
|
||||||
if (typeof e == "string" || typeof e == "number")
|
if (typeof e == "string" || typeof e == "number")
|
||||||
return e;
|
return e;
|
||||||
e != null && console.warn(
|
e != null && console.warn(
|
||||||
"[uikit/remote/ui] GBadge only accepts text/number children across the remote boundary."
|
"[uikit/remote/ui] GBadge only accepts text/number children across the remote boundary."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const $ = P({
|
const K = B({
|
||||||
componentName: "GBadge",
|
componentName: "GBadge",
|
||||||
tagName: "uikit-g-badge",
|
tagName: "uikit-g-badge",
|
||||||
defaultRemoteUrl: B.GBadge,
|
defaultRemoteUrl: P.GBadge,
|
||||||
requiredDeps: ["React", "createRoot", "ChakraProvider", "Badge"],
|
requiredDeps: ["React", "createRoot", "ChakraProvider", "Badge"],
|
||||||
normalizeProps: ({ children: e, ...t }) => ({
|
normalizeProps: ({ children: e, ...t }) => ({
|
||||||
...t,
|
...t,
|
||||||
children: G(e)
|
children: O(e)
|
||||||
})
|
})
|
||||||
}), j = P({
|
}), _ = B({
|
||||||
componentName: "Pagination",
|
componentName: "Pagination",
|
||||||
tagName: "uikit-pagination",
|
tagName: "uikit-pagination",
|
||||||
defaultRemoteUrl: B.Pagination,
|
defaultRemoteUrl: P.Pagination,
|
||||||
requiredDeps: [
|
requiredDeps: [
|
||||||
"React",
|
"React",
|
||||||
"createRoot",
|
"createRoot",
|
||||||
@ -124,10 +124,20 @@ const $ = P({
|
|||||||
"Text"
|
"Text"
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
function L({ theme: e, ...t }) {
|
||||||
|
const r = D();
|
||||||
|
return /* @__PURE__ */ g(
|
||||||
|
_,
|
||||||
|
{
|
||||||
|
...t,
|
||||||
|
theme: e ?? r
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
export {
|
export {
|
||||||
z as AppHeader,
|
N as AppHeader,
|
||||||
N as AppSidebar,
|
J as AppSidebar,
|
||||||
$ as GBadge,
|
K as GBadge,
|
||||||
j as Pagination,
|
L as Pagination,
|
||||||
S as setupUikitRemoteDeps
|
S as setupUikitRemoteDeps
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
dist/remote/index.html
vendored
2
dist/remote/index.html
vendored
@ -5,7 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="color-scheme" content="light" />
|
<meta name="color-scheme" content="light" />
|
||||||
<title>UI Kit Remote Demo</title>
|
<title>UI Kit Remote Demo</title>
|
||||||
<script type="module" crossorigin src="./demo-assets/index-LJMONNgk.js"></script>
|
<script type="module" crossorigin src="./demo-assets/index-CGeO2iR0.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { useTheme } from "@chakra-ui/react";
|
||||||
|
|
||||||
import { DEFAULT_REMOTE_URLS } from "../_core/constants";
|
import { DEFAULT_REMOTE_URLS } from "../_core/constants";
|
||||||
import { createRemoteElementComponent } from "../_core/createRemoteElementComponent";
|
import { createRemoteElementComponent } from "../_core/createRemoteElementComponent";
|
||||||
|
|
||||||
export const Pagination = createRemoteElementComponent({
|
const RemotePagination = createRemoteElementComponent({
|
||||||
componentName: "Pagination",
|
componentName: "Pagination",
|
||||||
tagName: "uikit-pagination",
|
tagName: "uikit-pagination",
|
||||||
defaultRemoteUrl: DEFAULT_REMOTE_URLS.Pagination,
|
defaultRemoteUrl: DEFAULT_REMOTE_URLS.Pagination,
|
||||||
@ -18,3 +20,15 @@ export const Pagination = createRemoteElementComponent({
|
|||||||
"Text",
|
"Text",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export function Pagination({ theme, ...props }) {
|
||||||
|
const hostTheme = useTheme();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<RemotePagination
|
||||||
|
{...props}
|
||||||
|
theme={theme ?? hostTheme}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user