From f46a01daf2e2c95d44dc4a81d32e228d3b6cd238 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 4 Jun 2025 09:12:20 +0800 Subject: [PATCH 1/3] master --- src/pages/unitTable/renderColsOpts.tsx | 48 +++++++------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/src/pages/unitTable/renderColsOpts.tsx b/src/pages/unitTable/renderColsOpts.tsx index 16761d4..67c4644 100644 --- a/src/pages/unitTable/renderColsOpts.tsx +++ b/src/pages/unitTable/renderColsOpts.tsx @@ -442,41 +442,19 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, case "operate": col = { ...col, - width: 176, - fixed: "right" // render: (__: string, record: any) => { - // let items: MenuProps["items"] = [ - // { - // key: "DeleteList", - // label: i18n?.["删除"], - // onClick: () => postMessageToParent("DEL", record) - // }, - // { - // key: "Log", - // label: i18n?.["操作日志"], - // onClick: () => postMessageToParent("log", record) - // } - // ]; - // isSpecial && items.shift(); - // return ( - // - // - // {isSpecial ? ( - // - // ) : ( - // - // )} - // - // + ))} + + ); + } }; break; default: From 57811df6e2e7ec37bd7141265b049e357a7f3251 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 4 Jun 2025 11:22:44 +0800 Subject: [PATCH 2/3] master --- src/pages/demo/index.less | 22 ++++++ .../demo/website/[picLazyLoading]/index.tsx | 48 +++++++++++++ src/pages/demo/website/default.jpeg | Bin 0 -> 8236 bytes src/pages/demo/website/index.tsx | 43 ++++++++++++ src/pages/demo/website/slideInItem.tsx | 64 ++++++++++++++++++ 5 files changed, 177 insertions(+) create mode 100644 src/pages/demo/index.less create mode 100644 src/pages/demo/website/[picLazyLoading]/index.tsx create mode 100644 src/pages/demo/website/default.jpeg create mode 100644 src/pages/demo/website/index.tsx create mode 100644 src/pages/demo/website/slideInItem.tsx diff --git a/src/pages/demo/index.less b/src/pages/demo/index.less new file mode 100644 index 0000000..43b13e3 --- /dev/null +++ b/src/pages/demo/index.less @@ -0,0 +1,22 @@ +.block { + height: 300px; + border: 3px solid #ccc; + margin-bottom: 20px; + color: white; + padding: 24px; + line-height: 32px; + font-size: 24px; +} + +.lazyloadImg{ + display: flex; + flex-wrap: wrap; + &>li{ + width: 400px; + margin-right: 10px; + margin-bottom: 10px; + img{ + width: 100%; + } + } +} diff --git a/src/pages/demo/website/[picLazyLoading]/index.tsx b/src/pages/demo/website/[picLazyLoading]/index.tsx new file mode 100644 index 0000000..fd37f4d --- /dev/null +++ b/src/pages/demo/website/[picLazyLoading]/index.tsx @@ -0,0 +1,48 @@ +import React, { useEffect, useRef } from "react"; +import styles from "../../index.less"; + +interface OwnProps {} + +type Props = OwnProps; + +const Index: React.FC = (props) => { + const itemRef = useRef([]); + const ob = new IntersectionObserver((entries) => { + for (const entry of entries) { + if (entry.isIntersecting) { + const img: any = entry.target; + img.src = img.dataset.src; + ob.unobserve(entry.target); + } + } + }); + useEffect(() => { + if (itemRef.current) { + _.forEach(itemRef.current, (item) => { + ob.observe(item); + }); + } + + return () => { + if (itemRef.current) { + _.forEach(itemRef.current, (item) => { + ob.unobserve(item); + }); + } + }; + }, [itemRef.current]); + return ( + + ); +}; + +export default Index; diff --git a/src/pages/demo/website/default.jpeg b/src/pages/demo/website/default.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..deb573f41e2b97e1683d77f800949d1a46ac6cad GIT binary patch literal 8236 zcmeHKXH-*J*FGUY07D0*BM<~ZP(qO+26PAnM!GaXr8p8%kY?zijHrn88kCMo2}S8e z#6s1fmr$i<06~fJaq<;Lt~7 z&;SAf07AO}bp)IROpJ^$Mg}Gr493jN!~*AGg&#No=jY;P=MfeV6%iH?5;}~KmpUwd zOhQOV`sC4LClr*FltiV}G*ywO$YvMKSUO^~2c!V;u96ZFwFCckDO8TgblCsK4 zRWK51OiE5k zC1mI1<~@G$G{4~4^YV(ys_L5BSFhi^ZEk68Ywzjp>mL{#A`MSYP0!5Ek$<0GSY2EH zyz%Ah=GOK%To3^L6Bh0M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?DX|JnE=nExm$2S7`bR(UuTDIpS)6QYB8HF z(H@k8`k0;=%|?9Mu?kHoAwusF4__RTcu^K~eF+O%h*g_4+Ad z#?n>Zl0va$yUL0XgBF+BkDbp zdBO8BY%XS2VM{0F;5V^u8ZQeXtRr)m_Bd3xxot7F#R>z(9R=eJq+07p)0AIza<)7& z9eE(#3m7Fo-n>W=+xR2{jT#9x*{Ji1^PMRD_dQEJgU$DDa4X&8d3M;bzm#ZQ8&rbN zQ%u898mPdB7tY?OIiHlgZhei}pPyB|?0TabLWGuP9Qyoq&AhIoK-`3WChgdqF7YPkMF3RO{0Y4*&nmZa`j2R@W%@p}k!3zebtD!P)mu9NI zo^w~3PzZ)Ozx)7DiThhPyyyQ`w9*oJ2thhKm_?D6f!E|HCH&#&baOv)n*A&3{u#N| S5B`4a;|~q|Ki2@1O8OTqOMu4! literal 0 HcmV?d00001 diff --git a/src/pages/demo/website/index.tsx b/src/pages/demo/website/index.tsx new file mode 100644 index 0000000..fe98cd2 --- /dev/null +++ b/src/pages/demo/website/index.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import SlideInItem from "./slideInItem"; + +interface OwnProps {} + +type Props = OwnProps; + +const list = [ + { id: 1, bg: "red" }, + { id: 2, bg: "blue" }, + { id: 3, bg: "green" }, + { id: 4, bg: "yellowgreen" }, + { id: 5, bg: "orange" }, + { id: 6, bg: "pink" }, + { id: 7, bg: "antiquewhite" }, + { id: 8, bg: "darkseagreen" }, + { id: 9, bg: "purple" }, + { id: 10, bg: "red" }, + { id: 11, bg: "black" } +]; +const Index: React.FC = (props) => { + const map = new WeakMap(); + const ob = new IntersectionObserver((entries) => { + for (const entry of entries) { + if (entry.isIntersecting) { + const animation = map.get(entry.target); + if (animation) { + animation.play(); + ob.unobserve(entry.target); + } + } + } + }); + return ( + <> + {list.map((item, index) => { + return ; + })} + + ); +}; + +export default Index; diff --git a/src/pages/demo/website/slideInItem.tsx b/src/pages/demo/website/slideInItem.tsx new file mode 100644 index 0000000..6b82e92 --- /dev/null +++ b/src/pages/demo/website/slideInItem.tsx @@ -0,0 +1,64 @@ +import React, { useEffect, useRef } from "react"; +import styles from "../index.less"; + +interface OwnProps { + item: any; + ob: any; + map: any; +} + +type Props = OwnProps; +const SLIDE_FADE_DISTANCE = 50; +const SLIDE_FADE_DURATION = 1000; + +const isBelowViewport = (el: HTMLDivElement) => { + const rect = el.getBoundingClientRect(); + return rect.top - SLIDE_FADE_DISTANCE > window.innerHeight; +}; +const slideInItem: React.FC = (props) => { + const { item, ob, map } = props; + const itemRef = useRef(null); + + useEffect(() => { + if (itemRef.current && ob) { + if (!isBelowViewport(itemRef.current)) { + return; + } + const animation = itemRef.current.animate( + [ + { + transform: `translateY(${SLIDE_FADE_DISTANCE}px)`, + opacity: 0.1 + }, + { + transform: `translateY(0)`, + opacity: 1 + } + ], + { + duration: SLIDE_FADE_DURATION, + easing: "ease-in-out", + fill: "forwards" // 当动画完成后,保留最后一个关键帧的样式 + } + ); + animation.pause(); + map.set(itemRef.current, animation); + ob.observe(itemRef.current); + } + + return () => { + ob.unobserve(itemRef.current); + }; + }, [itemRef.current]); + + return ( +
+

The most popular component library

+ +
for Tailwind CSS
+

daisyUI adds component class names to Tailwind CSS so you can make beautiful websites faster than ever.

+
+ ); +}; + +export default slideInItem; From 2be569f8ebe704dc031cdbe4376b1649d2f27fbf Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 11 Jun 2025 09:55:13 +0800 Subject: [PATCH 3/3] master --- src/pages/unitTable/renderColsOpts.tsx | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/pages/unitTable/renderColsOpts.tsx b/src/pages/unitTable/renderColsOpts.tsx index 67c4644..c38e0ee 100644 --- a/src/pages/unitTable/renderColsOpts.tsx +++ b/src/pages/unitTable/renderColsOpts.tsx @@ -464,6 +464,36 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, return col; }) ]; + } else if (type === "declare") { + return [ + ..._.map(initialState, (g) => { + let col = { ...g, ellipsis: true }; + switch (g.dataIndex) { + case "operate": + col = { + ...col, + ellipsis: false, + width: 120, + render: (__: string, record: any) => { + return ( + + {_.map(col?.operateType, (o) => ( + + ))} + + ); + } + }; + break; + default: + col = { ...col }; + break; + } + return col; + }) + ]; } return initialState; }, [initialState, type, i18n, extraParams]);