@unicom-cloud/ui-common 0.1.18 → 0.1.19
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/.virtual/_rolldown/runtime.js +1 -1
- package/.vite/manifest.json +86 -171
- package/development/index.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +1 -1
- package/flex/utils.js +1 -1
- package/higher-order/index.js +1 -1
- package/higher-order/with-speech-synthesis/index.js +1 -1
- package/hooks/create-deep-compare-effect/index.js +1 -1
- package/hooks/create-update-effect/index.js +1 -1
- package/hooks/create-use-storage-state/index.d.ts +2 -1
- package/hooks/create-use-storage-state/index.js +44 -35
- package/hooks/index.js +1 -1
- package/hooks/use-async-effect/index.js +1 -1
- package/hooks/use-boolean/index.js +1 -1
- package/hooks/use-click-away/index.js +1 -1
- package/hooks/use-computed-state/index.js +1 -1
- package/hooks/use-controllable-value/index.js +1 -1
- package/hooks/use-cookie-state/index.js +1 -1
- package/hooks/use-count-down/index.js +1 -1
- package/hooks/use-counter/index.js +1 -1
- package/hooks/use-create/index.js +1 -1
- package/hooks/use-creation/index.js +1 -1
- package/hooks/use-debounce/index.js +1 -1
- package/hooks/use-debounce-effect/index.js +1 -1
- package/hooks/use-debounce-fn/index.js +1 -1
- package/hooks/use-deep-compare-effect/index.js +1 -1
- package/hooks/use-deep-compare-layout-effect/index.js +1 -1
- package/hooks/use-document-visibility/index.js +1 -1
- package/hooks/use-drag/index.js +1 -1
- package/hooks/use-drop/index.js +1 -1
- package/hooks/use-effect-event/index.js +1 -1
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-listener/index.d.ts +3 -2
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-event-target/index.js +1 -1
- package/hooks/use-external/index.js +1 -1
- package/hooks/use-favicon/index.js +1 -1
- package/hooks/use-focus-within/index.js +1 -1
- package/hooks/use-force-update/index.js +1 -1
- package/hooks/use-fullscreen/index.js +1 -1
- package/hooks/use-get-state/index.js +1 -1
- package/hooks/use-history-travel/index.js +1 -1
- package/hooks/use-hover/index.js +1 -1
- package/hooks/use-id/index.js +1 -1
- package/hooks/use-in-view/index.js +1 -1
- package/hooks/use-in-viewport/index.js +1 -1
- package/hooks/use-infinite-scroll/index.js +1 -1
- package/hooks/use-intersection-observer/index.js +1 -1
- package/hooks/use-intersection-observers/index.js +25 -25
- package/hooks/use-interval/index.js +1 -1
- package/hooks/use-is-first-render/index.js +1 -1
- package/hooks/use-isomorphic-layout-effect/index.js +1 -1
- package/hooks/use-key-press/index.js +1 -1
- package/hooks/use-keyboard-event/index.js +1 -1
- package/hooks/use-latest/index.js +1 -1
- package/hooks/use-listen-window-resize/index.js +1 -1
- package/hooks/use-local-storage-state/index.js +1 -1
- package/hooks/use-lock-fn/index.js +1 -1
- package/hooks/use-long-press/index.js +1 -1
- package/hooks/use-map/index.js +1 -1
- package/hooks/use-media/index.js +1 -1
- package/hooks/use-memo/index.js +1 -1
- package/hooks/use-memoized-fn/index.js +1 -1
- package/hooks/use-merge-props/index.js +1 -1
- package/hooks/use-merge-value/index.js +1 -1
- package/hooks/use-mobile/index.js +1 -1
- package/hooks/use-mount/index.js +1 -1
- package/hooks/use-mouse/index.js +1 -1
- package/hooks/use-move/index.js +1 -1
- package/hooks/use-mutation-observer/index.js +1 -1
- package/hooks/use-mutation-observers/index.js +24 -24
- package/hooks/use-network/index.js +1 -1
- package/hooks/use-online-status/index.js +1 -1
- package/hooks/use-overflow-hidden/index.js +17 -16
- package/hooks/use-override-ref/index.js +1 -1
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-paste-image/index.js +1 -1
- package/hooks/use-persist-callback/index.js +1 -1
- package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
- package/hooks/use-previous/index.js +1 -1
- package/hooks/use-raf-interval/index.js +1 -1
- package/hooks/use-raf-state/index.js +1 -1
- package/hooks/use-raf-timeout/index.js +1 -1
- package/hooks/use-reactive/index.js +1 -1
- package/hooks/use-ref-latest/index.js +1 -1
- package/hooks/use-refs/index.js +1 -1
- package/hooks/use-request/index.js +1 -1
- package/hooks/use-request/src/Fetch.js +1 -1
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
- package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useThrottlePlugin.js +1 -1
- package/hooks/use-request/src/useRequest.d.ts +6 -2
- package/hooks/use-request/src/useRequest.js +1 -1
- package/hooks/use-request/src/useRequestImplement.js +1 -1
- package/hooks/use-request/src/utils/cache.js +1 -1
- package/hooks/use-request/src/utils/cachePromise.js +1 -1
- package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
- package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
- package/hooks/use-request/src/utils/isOnline.js +1 -1
- package/hooks/use-request/src/utils/limit.js +1 -1
- package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
- package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
- package/hooks/use-reset-state/index.js +1 -1
- package/hooks/use-resize-observer/index.js +1 -1
- package/hooks/use-resize-observers/index.js +25 -25
- package/hooks/use-responsive/index.js +1 -1
- package/hooks/use-safe-state/index.js +1 -1
- package/hooks/use-scroll/index.js +1 -1
- package/hooks/use-selections/index.js +1 -1
- package/hooks/use-session-storage-state/index.js +1 -1
- package/hooks/use-set/index.js +1 -1
- package/hooks/use-set-state/index.js +1 -1
- package/hooks/use-size/index.js +1 -1
- package/hooks/use-state-callback/index.js +1 -1
- package/hooks/use-state-with-promise/index.js +1 -1
- package/hooks/use-sync-state/index.js +1 -1
- package/hooks/use-text-selection/index.js +1 -1
- package/hooks/use-theme/index.js +1 -1
- package/hooks/use-throttle/index.js +1 -1
- package/hooks/use-throttle-effect/index.js +1 -1
- package/hooks/use-throttle-fn/index.js +1 -1
- package/hooks/use-timeout/index.js +1 -1
- package/hooks/use-title/index.js +1 -1
- package/hooks/use-toggle/index.js +1 -1
- package/hooks/use-tracked-effect/index.js +1 -1
- package/hooks/use-unmount/index.js +1 -1
- package/hooks/use-unmounted-ref/index.js +1 -1
- package/hooks/use-update/index.js +1 -1
- package/hooks/use-update-effect/index.js +1 -1
- package/hooks/use-update-layout-effect/index.js +1 -1
- package/hooks/use-url-state/index.js +1 -1
- package/hooks/use-virtual-list/index.js +1 -1
- package/hooks/use-watch/index.js +1 -1
- package/hooks/use-web-socket/index.js +1 -1
- package/hooks/use-why-did-you-update/index.js +1 -1
- package/hooks/use-window-size/index.js +1 -1
- package/hooks/utils/createEffectWithTarget.js +1 -1
- package/hooks/utils/depsAreSame.js +1 -1
- package/hooks/utils/depsEqual.js +1 -1
- package/hooks/utils/domTarget.js +1 -1
- package/hooks/utils/getDocumentOrShadow.js +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/isAppleDevice.js +1 -1
- package/hooks/utils/isBrowser.js +1 -1
- package/hooks/utils/isDev.js +1 -1
- package/hooks/utils/rect.js +1 -1
- package/hooks/utils/useDeepCompareWithTarget.js +1 -1
- package/hooks/utils/useEffectWithTarget.js +1 -1
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
- package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
- package/icons/file/index.js +1 -1
- package/index.js +487 -480
- package/package.json +1 -1
- package/progress/index.js +1 -1
- package/resize-observer/Collection.js +1 -1
- package/resize-observer/SingleObserver.js +1 -1
- package/resize-observer/index.js +2 -2
- package/resize-observer/observerUtil.js +1 -1
- package/space/index.js +1 -1
- package/style/animation.less +4 -4
- package/style.css +1 -1
- package/suspense-fallback-test/index.js +1 -1
- package/test.d.ts +0 -0
- package/test.js +5 -0
- package/timer/index.js +1 -1
- package/transition-group/ChildMapping.js +1 -1
- package/transition-group/Transition.d.ts +37 -41
- package/transition-group/Transition.js +96 -102
- package/transition-group/{CSSTransition.d.ts → TransitionCSS.d.ts} +9 -9
- package/transition-group/TransitionCSS.js +73 -0
- package/transition-group/TransitionGroup.d.ts +1 -1
- package/transition-group/TransitionGroup.js +2 -2
- package/transition-group/{ReplaceTransition.d.ts → TransitionReplace.d.ts} +5 -5
- package/transition-group/{ReplaceTransition.js → TransitionReplace.js} +2 -2
- package/transition-group/{SwitchTransition.d.ts → TransitionSwitch.d.ts} +10 -10
- package/transition-group/{SwitchTransition.js → TransitionSwitch.js} +3 -3
- package/transition-group/context.d.ts +2 -0
- package/transition-group/context.js +7 -0
- package/transition-group/index.d.ts +5 -5
- package/transition-group/index.js +6 -6
- package/utils/callOrReturn.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +1 -1
- package/utils/constant.js +1 -1
- package/utils/copy.js +1 -1
- package/utils/date.js +1 -1
- package/utils/dayjs.d.ts +1 -1
- package/utils/dayjs.js +19 -13
- package/utils/dom.js +15 -15
- package/utils/emitter.js +1 -1
- package/utils/fileRead.js +1 -1
- package/utils/fileToDataURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.d.ts +4 -2
- package/utils/findRootElement.js +1 -1
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getScrollBarHeight.d.ts +3 -0
- package/utils/getScrollBarHeight.js +7 -0
- package/utils/getScrollBarSize.d.ts +3 -0
- package/utils/getScrollBarSize.js +10 -0
- package/utils/getScrollBarWidth.d.ts +3 -0
- package/utils/getScrollBarWidth.js +7 -0
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +1 -1
- package/utils/index.d.ts +3 -0
- package/utils/index.js +221 -214
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.d.ts +6 -6
- package/utils/is.js +15 -15
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/math.js +1 -1
- package/utils/mergeProps.js +1 -1
- package/utils/mergedToString.js +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/omit.d.ts +5 -1
- package/utils/omit.js +4 -8
- package/utils/pad.js +1 -1
- package/utils/pick.d.ts +4 -1
- package/utils/pick.js +5 -10
- package/utils/pinyin.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/ref.js +1 -1
- package/utils/resizeObserver.js +21 -21
- package/utils/saveAs.js +1 -1
- package/utils/screenfull.js +1 -1
- package/utils/scrollIntoViewIfNeeded.js +1 -1
- package/utils/setCreateRoot.js +1 -1
- package/utils/setDarkTheme.js +1 -1
- package/utils/setDir.js +1 -1
- package/utils/setPrimaryColor.js +1 -1
- package/utils/setTheme.js +1 -1
- package/utils/string.js +1 -1
- package/utils/style.js +1 -1
- package/utils/throttleByRaf.js +1 -1
- package/utils/throttleByRaf2.js +1 -1
- package/utils/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tree.js +1 -1
- package/utils/tween.js +1 -1
- package/utils/uuid.js +1 -1
- package/utils/validate.js +1 -1
- package/utils/warning.js +1 -1
- package/version/index.js +11 -14
- package/motion/CSSMotion.d.ts +0 -77
- package/motion/CSSMotion.js +0 -76
- package/motion/CSSMotionList.d.ts +0 -34
- package/motion/CSSMotionList.js +0 -82
- package/motion/context.d.ts +0 -9
- package/motion/context.js +0 -14
- package/motion/hooks/useDomMotionEvents.d.ts +0 -3
- package/motion/hooks/useDomMotionEvents.js +0 -19
- package/motion/hooks/useNextFrame.d.ts +0 -7
- package/motion/hooks/useNextFrame.js +0 -22
- package/motion/hooks/useStatus.d.ts +0 -5
- package/motion/hooks/useStatus.js +0 -92
- package/motion/hooks/useStepQueue.d.ts +0 -8
- package/motion/hooks/useStepQueue.js +0 -39
- package/motion/index.d.ts +0 -9
- package/motion/index.js +0 -9
- package/motion/interface.d.ts +0 -22
- package/motion/interface.js +0 -6
- package/motion/util/diff.d.ts +0 -20
- package/motion/util/diff.js +0 -50
- package/motion/util/motion.d.ts +0 -10
- package/motion/util/motion.js +0 -37
- package/transition-group/CSSTransition.js +0 -73
- package/transition-group/PqbCSSTransition.d.ts +0 -4
- package/transition-group/PqbCSSTransition.js +0 -34
- package/transition-group/TransitionGroupContext.d.ts +0 -3
- package/transition-group/TransitionGroupContext.js +0 -7
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui-common","version":"0.1.
|
|
1
|
+
{"name":"@unicom-cloud/ui-common","version":"0.1.19","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|
package/progress/index.js
CHANGED
package/resize-observer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 潘启宝 2026-03
|
|
1
|
+
/* 潘启宝 2026-04-03 14:07:44 星期五 */
|
|
2
2
|
import { isFunction as e } from "../utils/is.js";
|
|
3
3
|
import t from "../utils/toArray.js";
|
|
4
4
|
import { Collection as n } from "./Collection.js";
|
|
@@ -17,7 +17,7 @@ function o(n, i) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
var s = i.forwardRef(o);
|
|
20
|
-
s.Collection = n;
|
|
20
|
+
s.displayName = "ResizeObserver", s.Collection = n;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { s as default };
|
|
23
23
|
/* 独立思考,明辨是非 */
|
package/space/index.js
CHANGED
package/style/animation.less
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
animation: ~'@{ui-common-prefix}-keyframes-vibrate' 0.3s linear infinite both;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.@{ui-common-prefix}-animation-blink-
|
|
11
|
-
.@{ui-common-prefix}-animation-blink-
|
|
10
|
+
.@{ui-common-prefix}-animation-blink-appear,
|
|
11
|
+
.@{ui-common-prefix}-animation-blink-enter {
|
|
12
12
|
opacity: 0;
|
|
13
13
|
}
|
|
14
|
-
.@{ui-common-prefix}-animation-blink-
|
|
15
|
-
.@{ui-common-prefix}-animation-blink-
|
|
14
|
+
.@{ui-common-prefix}-animation-blink-appear-active,
|
|
15
|
+
.@{ui-common-prefix}-animation-blink-enter-active {
|
|
16
16
|
opacity: 1;
|
|
17
17
|
transition: opacity 0.3s linear;
|
|
18
18
|
}
|
package/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-
|
|
1
|
+
:root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-appear,.pqbc-animation-blink-enter{opacity:0}.pqbc-animation-blink-appear-active,.pqbc-animation-blink-enter-active{opacity:1;transition:opacity .3s linear}.pqbc-animation-blink-enter-done{animation:.5s linear pqbc-keyframes-blink}.pqbc-display-none{display:none!important}.pqbc-visibility-hidden{visibility:hidden!important}.pqbc-overflow-hidden{overflow:hidden}.pqbc-cursor-pointer{cursor:pointer}.pqbc-filter-invert-100{filter:invert()}.pqbc-filter-grayscale-100{filter:grayscale()}.pqbc-isolation-isolate{isolation:isolate}.pqbc-direction-rtl{direction:rtl}.pqbc-line-height-1{line-height:1}.pqbc-text-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow:hidden}.pqbc-line-clamp-2,.pqbc-line-clamp-3,.pqbc-line-clamp-4,.pqbc-line-clamp-5{text-overflow:ellipsis;white-space:normal;-webkit-box-orient:vertical;display:-webkit-box;display:-moz-box;overflow:hidden}.pqbc-line-clamp-2{line-clamp:2;-webkit-line-clamp:2}.pqbc-line-clamp-3{line-clamp:3;-webkit-line-clamp:3}.pqbc-line-clamp-4{line-clamp:4;-webkit-line-clamp:4}.pqbc-line-clamp-5{line-clamp:5;-webkit-line-clamp:5}.pqb-theme-dark,.pqbm-theme-dark,.pqb-theme-dark *,.pqbm-theme-dark *{color-scheme:dark}[dir=rtl] *,.pqbc-with-speech-synthesis-rtl{direction:rtl}.pqbc-empty{width:100%}.pqbc-empty .pqbc-empty-description{line-height:1}.pqbc-development{flex-direction:column;justify-content:center;align-items:center;gap:10px;width:100%;height:100%;min-height:300px;display:flex}.pqbc-development-icon,.pqbc-development-img{width:50px;height:50px}.pqbc-development-label{--color-neutral:#868788;color:var(--pqbc-color-neutral-6,var(--pqb-color-neutral-6,var(--pqbm-color-neutral-6,--color-neutral)));font-size:20px}.pqbc-space-vertical{width:100%}.pqbc-space-rtl{direction:rtl}.pqbc-icons-file{position:relative}.pqbc-icons-file-svg{width:30px;height:30px}.pqbc-icons-file-svg-bg{--primary:26, 94, 255;fill:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))))}.pqbc-icons-file-svg-tr{fill:#fff;fill-opacity:.7}.pqbc-icons-file-svg-text{fill:#fff;text-align:center;font-size:66px;font-weight:bolder}.pqbc-flex{box-sizing:border-box;margin:0;padding:0;display:flex}.pqbc-flex-inline{display:inline-flex}.pqbc-flex:empty{display:none}.pqbc-flex-rtl{direction:rtl}.pqbc-progress{pointer-events:none}.pqbc-progress-bar{--primary:26, 94, 255;background-color:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))));z-index:870227;width:100%;height:2px;position:fixed;inset-block-start:0;inset-inline-start:0}.pqbc-timer-rtl{direction:rtl}
|
|
2
2
|
/*$vite$:1*/
|
package/test.d.ts
ADDED
|
File without changes
|
package/test.js
ADDED
package/timer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 潘启宝 2026-03
|
|
1
|
+
/* 潘启宝 2026-04-03 14:07:44 星期五 */
|
|
2
2
|
import { isFunction as e } from "../utils/is.js";
|
|
3
3
|
import t from "../utils/className.js";
|
|
4
4
|
import { forwardRef as n, useEffect as r, useImperativeHandle as i, useRef as a, useState as o } from "react";
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const UNMOUNTED = "unmounted";
|
|
3
|
-
export declare const EXITED = "exited";
|
|
4
2
|
export declare const ENTERING = "entering";
|
|
5
3
|
export declare const ENTERED = "entered";
|
|
6
4
|
export declare const EXITING = "exiting";
|
|
5
|
+
export declare const EXITED = "exited";
|
|
6
|
+
export declare const UNMOUNTED = "unmounted";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Transition 组件允许你通过简单的声明式 API,
|
|
9
|
+
* 描述组件状态随时间的过渡。
|
|
10
|
+
* 最常用于组件的挂载和卸载动画,
|
|
11
|
+
* 也可用于组件在位状态切换。
|
|
12
12
|
*
|
|
13
13
|
* ---
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* [`
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* name of the component).
|
|
15
|
+
* 注意:`Transition` 是一个与平台无关的基础组件。
|
|
16
|
+
* 如果你在使用 CSS 过渡,可能更适合使用
|
|
17
|
+
* [`TransitionCSS`](https://reactcommunity.org/react-transition-group/css-transition)。
|
|
18
|
+
* 它继承了 Transition 的所有功能,
|
|
19
|
+
* 还包含了适配 CSS 过渡所需的额外特性。
|
|
21
20
|
*
|
|
22
21
|
* ---
|
|
23
22
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* 默认情况下,Transition 组件不会改变所渲染组件的行为,
|
|
24
|
+
* 它只追踪组件的「进入」和「退出」状态。
|
|
25
|
+
* 你需要自行为这些状态定义样式和行为。
|
|
26
|
+
* 例如,你可以在组件进入/退出时添加样式:
|
|
28
27
|
*
|
|
29
28
|
* ```jsx
|
|
30
29
|
* import { Transition } from 'react-transition-group';
|
|
@@ -47,7 +46,7 @@ export declare const EXITING = "exiting";
|
|
|
47
46
|
* function Fade({ in: inProp }) {
|
|
48
47
|
* const refElement = useRef(null);
|
|
49
48
|
* return (
|
|
50
|
-
* <Transition refElement={refElement} in={inProp}
|
|
49
|
+
* <Transition refElement={refElement} in={inProp} duration={duration}>
|
|
51
50
|
* {state => (
|
|
52
51
|
* <div ref={refElement} style={{
|
|
53
52
|
* ...defaultStyle,
|
|
@@ -61,18 +60,16 @@ export declare const EXITING = "exiting";
|
|
|
61
60
|
* }
|
|
62
61
|
* ```
|
|
63
62
|
*
|
|
64
|
-
*
|
|
65
|
-
* - `'entering'`
|
|
66
|
-
* - `'entered'`
|
|
67
|
-
* - `'exiting'`
|
|
68
|
-
* - `'exited'`
|
|
63
|
+
* Transition 共有 4 种主要状态:
|
|
64
|
+
* - `'entering'` 进入中
|
|
65
|
+
* - `'entered'` 已进入
|
|
66
|
+
* - `'exiting'` 退出中
|
|
67
|
+
* - `'exited'` 已退出
|
|
69
68
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* the following example (we'll use the
|
|
75
|
-
* [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
|
|
69
|
+
* 过渡状态由 `in` 属性控制。
|
|
70
|
+
* 当 `in={true}` 时,组件开始「进入」阶段。
|
|
71
|
+
* 在此阶段,组件状态会切换为 `entering`,
|
|
72
|
+
* 持续过渡时长后切换为 `entered`。
|
|
76
73
|
*
|
|
77
74
|
* ```jsx
|
|
78
75
|
* import { Transition } from 'react-transition-group';
|
|
@@ -83,7 +80,7 @@ export declare const EXITING = "exiting";
|
|
|
83
80
|
* const refElement = useRef(null);
|
|
84
81
|
* return (
|
|
85
82
|
* <div>
|
|
86
|
-
* <Transition refElement={refElement} in={inProp}
|
|
83
|
+
* <Transition refElement={refElement} in={inProp} duration={500}>
|
|
87
84
|
* {state => ()}
|
|
88
85
|
* </Transition>
|
|
89
86
|
* <button onClick={() => setInProp(true)}>
|
|
@@ -94,12 +91,11 @@ export declare const EXITING = "exiting";
|
|
|
94
91
|
* }
|
|
95
92
|
* ```
|
|
96
93
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* to `'entered'`.
|
|
94
|
+
* 点击按钮后,组件状态变为 `entering`,
|
|
95
|
+
* 持续 500ms 后切换为 `entered`。
|
|
100
96
|
*
|
|
101
|
-
*
|
|
102
|
-
* `
|
|
97
|
+
* 当 `in={false}` 时,过程类似,
|
|
98
|
+
* 状态从 `exiting` 变为 `exited`。
|
|
103
99
|
*/
|
|
104
100
|
declare class Transition extends React.Component {
|
|
105
101
|
#private;
|
|
@@ -113,18 +109,18 @@ declare class Transition extends React.Component {
|
|
|
113
109
|
componentDidMount(): void;
|
|
114
110
|
componentDidUpdate(prevProps: any): void;
|
|
115
111
|
componentWillUnmount(): void;
|
|
116
|
-
|
|
112
|
+
getDurations: () => {
|
|
117
113
|
exit: any;
|
|
118
114
|
enter: any;
|
|
119
115
|
appear: any;
|
|
120
116
|
};
|
|
121
|
-
updateStatus(mounting: boolean | undefined, nextStatus: any)
|
|
122
|
-
performEnter(mounting: any)
|
|
123
|
-
performExit()
|
|
124
|
-
cancelNextCallback()
|
|
117
|
+
updateStatus: (mounting: boolean | undefined, nextStatus: any) => void;
|
|
118
|
+
performEnter: (mounting: any) => void;
|
|
119
|
+
performExit: () => void;
|
|
120
|
+
cancelNextCallback: () => void;
|
|
125
121
|
safeSetState(nextState: any, callback: any): void;
|
|
126
|
-
setNextCallback(callback: any)
|
|
127
|
-
onTransitionEnd(
|
|
122
|
+
setNextCallback: (callback: any) => null;
|
|
123
|
+
onTransitionEnd: (duration: any, handler: any) => void;
|
|
128
124
|
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
129
125
|
}
|
|
130
126
|
export default Transition;
|
|
@@ -1,26 +1,90 @@
|
|
|
1
|
-
/* 潘启宝 2026-03
|
|
2
|
-
import { isFunction as e } from "../utils/is.js";
|
|
3
|
-
import { forceReflow as
|
|
4
|
-
import
|
|
5
|
-
import { NOOP as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { jsx as
|
|
1
|
+
/* 潘启宝 2026-04-03 14:07:44 星期五 */
|
|
2
|
+
import { isFunction as e, isNull as t, isNullOrUndefined as n, isNumber as r, isObject as i } from "../utils/is.js";
|
|
3
|
+
import { forceReflow as a } from "../utils/dom.js";
|
|
4
|
+
import o from "../utils/findRootElement.js";
|
|
5
|
+
import { NOOP as s } from "../utils/constant.js";
|
|
6
|
+
import { TransitionGroupContext as c } from "./context.js";
|
|
7
|
+
import l from "react";
|
|
8
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
9
9
|
//#region components/common/transition-group/Transition.tsx
|
|
10
|
-
var
|
|
10
|
+
var d = "entering", f = "entered", p = "exiting", m = "exited", h = "unmounted", g = class extends l.Component {
|
|
11
11
|
static {
|
|
12
|
-
this.contextType =
|
|
13
|
-
}
|
|
14
|
-
constructor(
|
|
15
|
-
super(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
this.contextType = c;
|
|
13
|
+
}
|
|
14
|
+
constructor(o, s) {
|
|
15
|
+
super(o, s), this.getDurations = () => {
|
|
16
|
+
let { duration: e } = this.props, t, n, r;
|
|
17
|
+
return t = n = r = e, i(e) && (t = e.exit, n = e.enter, r = e.appear ?? n), {
|
|
18
|
+
exit: t,
|
|
19
|
+
enter: n,
|
|
20
|
+
appear: r
|
|
21
|
+
};
|
|
22
|
+
}, this.updateStatus = (e = !1, n) => {
|
|
23
|
+
if (t(n)) this.props.unmountOnExit && this.state.status === "exited" && this.setState({ status: h });
|
|
24
|
+
else if (this.cancelNextCallback(), n === "entering") {
|
|
25
|
+
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
26
|
+
let e = this.#n();
|
|
27
|
+
e && a(e);
|
|
28
|
+
}
|
|
29
|
+
this.performEnter(e);
|
|
30
|
+
} else this.performExit();
|
|
31
|
+
}, this.performEnter = (e) => {
|
|
32
|
+
let { enter: t } = this.props, n = this.context ? this.context.isMounting : e, [r, i] = [this.#n(), n], a = this.getDurations(), o = n ? a.appear : a.enter;
|
|
33
|
+
if (!(e || t)) {
|
|
34
|
+
this.safeSetState({ status: f }, () => {
|
|
35
|
+
this.props.onEntered(r);
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.props.onEnter(r, i), this.safeSetState({ status: d }, () => {
|
|
40
|
+
this.props.onEntering(r, i), this.onTransitionEnd(o, () => {
|
|
41
|
+
this.safeSetState({ status: f }, () => {
|
|
42
|
+
this.props.onEntered(r, i);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, this.performExit = () => {
|
|
47
|
+
let { exit: e } = this.props, t = this.getDurations(), n = this.#n();
|
|
48
|
+
if (!e) {
|
|
49
|
+
this.safeSetState({ status: m }, () => {
|
|
50
|
+
this.props.onExited(n);
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.props.onExit(n), this.safeSetState({ status: p }, () => {
|
|
55
|
+
this.props.onExiting(n), this.onTransitionEnd(t.exit, () => {
|
|
56
|
+
this.safeSetState({ status: m }, () => {
|
|
57
|
+
this.props.onExited(n);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}, this.cancelNextCallback = () => {
|
|
62
|
+
n(this.#t) || (this.#t.cancel(), this.#t = null);
|
|
63
|
+
}, this.setNextCallback = (e) => {
|
|
64
|
+
let t = !0;
|
|
65
|
+
return this.#t = (n) => {
|
|
66
|
+
t && (t = !1, this.#t = null, e(n));
|
|
67
|
+
}, this.#t.cancel = () => {
|
|
68
|
+
t = !1;
|
|
69
|
+
}, this.#t;
|
|
70
|
+
}, this.onTransitionEnd = (t, n) => {
|
|
71
|
+
let { setTimeout: i, clearTimeout: a } = window;
|
|
72
|
+
this.setNextCallback(n);
|
|
73
|
+
let o = this.#n(), s = this.props.addEndListener;
|
|
74
|
+
if (!o || !r(t) && !e(s)) {
|
|
75
|
+
a(this.#e), this.#e = i(this.#t, 0);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
e(s) && s(o, this.#t), r(t) && (a(this.#e), this.#e = i(this.#t, t));
|
|
79
|
+
};
|
|
80
|
+
let c = s, l = c && !c.isMounting ? o.enter : o.appear, u;
|
|
81
|
+
this.appearStatus = null, o.in ? l ? (u = m, this.appearStatus = d) : u = f : u = o.unmountOnExit || o.mountOnEnter ? h : m, this.state = { status: u };
|
|
21
82
|
}
|
|
83
|
+
#e = -1;
|
|
84
|
+
#t = null;
|
|
85
|
+
#n = () => o(this.props.refElement) || o(this);
|
|
22
86
|
static getDerivedStateFromProps({ in: e }, t) {
|
|
23
|
-
return e && t.status === "unmounted" ? { status:
|
|
87
|
+
return e && t.status === "unmounted" ? { status: m } : null;
|
|
24
88
|
}
|
|
25
89
|
componentDidMount() {
|
|
26
90
|
this.updateStatus(!0, this.appearStatus);
|
|
@@ -29,97 +93,27 @@ var s = "unmounted", c = "exited", l = "entering", u = "entered", d = "exiting",
|
|
|
29
93
|
let t = null;
|
|
30
94
|
if (e !== this.props) {
|
|
31
95
|
let { status: e } = this.state;
|
|
32
|
-
this.props.in ? e !== "entering" && e !== "entered" && (t =
|
|
96
|
+
this.props.in ? e !== "entering" && e !== "entered" && (t = d) : (e === "entering" || e === "entered") && (t = p);
|
|
33
97
|
}
|
|
34
98
|
this.updateStatus(!1, t);
|
|
35
99
|
}
|
|
36
100
|
componentWillUnmount() {
|
|
37
101
|
this.cancelNextCallback();
|
|
38
102
|
}
|
|
39
|
-
getTimeouts() {
|
|
40
|
-
let { timeout: e } = this.props, t, n, r;
|
|
41
|
-
return t = n = r = e, e != null && typeof e != "number" && (t = e.exit, n = e.enter, r = e.appear === void 0 ? n : e.appear), {
|
|
42
|
-
exit: t,
|
|
43
|
-
enter: n,
|
|
44
|
-
appear: r
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
updateStatus(e = !1, n) {
|
|
48
|
-
if (n !== null) if (this.cancelNextCallback(), n === "entering") {
|
|
49
|
-
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
50
|
-
let e = this.#e();
|
|
51
|
-
e && t(e);
|
|
52
|
-
}
|
|
53
|
-
this.performEnter(e);
|
|
54
|
-
} else this.performExit();
|
|
55
|
-
else this.props.unmountOnExit && this.state.status === "exited" && this.setState({ status: s });
|
|
56
|
-
}
|
|
57
|
-
performEnter(e) {
|
|
58
|
-
let { enter: t } = this.props, n = this.context ? this.context.isMounting : e, [r, i] = [this.#e(), n], a = this.getTimeouts(), o = n ? a.appear : a.enter;
|
|
59
|
-
if (!e && !t) {
|
|
60
|
-
this.safeSetState({ status: u }, () => {
|
|
61
|
-
this.props.onEntered(r);
|
|
62
|
-
});
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.props.onEnter(r, i), this.safeSetState({ status: l }, () => {
|
|
66
|
-
this.props.onEntering(r, i), this.onTransitionEnd(o, () => {
|
|
67
|
-
this.safeSetState({ status: u }, () => {
|
|
68
|
-
this.props.onEntered(r, i);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
performExit() {
|
|
74
|
-
let { exit: e } = this.props, t = this.getTimeouts(), n = this.#e();
|
|
75
|
-
if (!e) {
|
|
76
|
-
this.safeSetState({ status: c }, () => {
|
|
77
|
-
this.props.onExited(n);
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
this.props.onExit(n), this.safeSetState({ status: d }, () => {
|
|
82
|
-
this.props.onExiting(n), this.onTransitionEnd(t.exit, () => {
|
|
83
|
-
this.safeSetState({ status: c }, () => {
|
|
84
|
-
this.props.onExited(n);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
cancelNextCallback() {
|
|
90
|
-
this.nextCallback !== null && (this.nextCallback.cancel(), this.nextCallback = null);
|
|
91
|
-
}
|
|
92
103
|
safeSetState(e, t) {
|
|
93
104
|
t = this.setNextCallback(t), this.setState(e, t);
|
|
94
105
|
}
|
|
95
|
-
setNextCallback(e) {
|
|
96
|
-
let t = !0;
|
|
97
|
-
return this.nextCallback = (n) => {
|
|
98
|
-
t && (t = !1, this.nextCallback = null, e(n));
|
|
99
|
-
}, this.nextCallback.cancel = () => {
|
|
100
|
-
t = !1;
|
|
101
|
-
}, this.nextCallback;
|
|
102
|
-
}
|
|
103
|
-
onTransitionEnd(e, t) {
|
|
104
|
-
this.setNextCallback(t);
|
|
105
|
-
let n = this.#e(), r = this.props.addEndListener;
|
|
106
|
-
if (!n || e == null && !r) {
|
|
107
|
-
setTimeout(this.nextCallback, 0);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
r && r(n, this.nextCallback), e != null && setTimeout(this.nextCallback, e);
|
|
111
|
-
}
|
|
112
106
|
render() {
|
|
113
107
|
let t = this.state.status;
|
|
114
108
|
if (t === "unmounted") return null;
|
|
115
|
-
let { children: n, in: r, mountOnEnter:
|
|
116
|
-
return /* @__PURE__ */
|
|
109
|
+
let { children: n, in: r, mountOnEnter: i, unmountOnExit: a, appear: o, enter: s, exit: d, duration: f, addEndListener: p, onEnter: m, onEntering: h, onEntered: g, onExit: _, onExiting: v, onExited: y, refElement: b, ...x } = this.props;
|
|
110
|
+
return /* @__PURE__ */ u(c.Provider, {
|
|
117
111
|
value: null,
|
|
118
|
-
children: e(n) ? n(t, x) :
|
|
112
|
+
children: e(n) ? n(t, x) : l.cloneElement(l.Children.only(n), x)
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
};
|
|
122
|
-
|
|
116
|
+
g.defaultProps = {
|
|
123
117
|
in: !1,
|
|
124
118
|
mountOnEnter: !1,
|
|
125
119
|
unmountOnExit: !1,
|
|
@@ -127,13 +121,13 @@ f.defaultProps = {
|
|
|
127
121
|
enter: !0,
|
|
128
122
|
exit: !0,
|
|
129
123
|
refElement: void 0,
|
|
130
|
-
onEnter:
|
|
131
|
-
onEntering:
|
|
132
|
-
onEntered:
|
|
133
|
-
onExit:
|
|
134
|
-
onExiting:
|
|
135
|
-
onExited:
|
|
136
|
-
},
|
|
124
|
+
onEnter: s,
|
|
125
|
+
onEntering: s,
|
|
126
|
+
onEntered: s,
|
|
127
|
+
onExit: s,
|
|
128
|
+
onExiting: s,
|
|
129
|
+
onExited: s
|
|
130
|
+
}, g.UNMOUNTED = h, g.EXITED = m, g.ENTERING = d, g.ENTERED = f, g.EXITING = p;
|
|
137
131
|
//#endregion
|
|
138
|
-
export {
|
|
132
|
+
export { f as ENTERED, d as ENTERING, m as EXITED, p as EXITING, h as UNMOUNTED, g as default };
|
|
139
133
|
/* 独立思考,明辨是非 */
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
* [`Transition`](https://reactcommunity.org/react-transition-group/transition)
|
|
7
7
|
* component, so it inherits all of its props.
|
|
8
8
|
*
|
|
9
|
-
* `
|
|
9
|
+
* `TransitionCSS` applies a pair of class names during the `appear`, `enter`,
|
|
10
10
|
* and `exit` states of the transition. The first class is applied and then a
|
|
11
11
|
* second `*-active` class in order to activate the CSS transition. After the
|
|
12
12
|
* transition, matching `*-done` class names are applied to persist the
|
|
@@ -18,11 +18,11 @@ import React from 'react';
|
|
|
18
18
|
* const refElement = useRef(null);
|
|
19
19
|
* return (
|
|
20
20
|
* <div>
|
|
21
|
-
* <
|
|
21
|
+
* <TransitionCSS refElement={refElement} in={inProp} duration={200} classNames="my-element">
|
|
22
22
|
* <div ref={refElement}>
|
|
23
23
|
* {"I'll receive my-element-* classes"}
|
|
24
24
|
* </div>
|
|
25
|
-
* </
|
|
25
|
+
* </TransitionCSS>
|
|
26
26
|
* <button type="button" onClick={() => setInProp(true)}>
|
|
27
27
|
* Click to Enter
|
|
28
28
|
* </button>
|
|
@@ -33,8 +33,8 @@ import React from 'react';
|
|
|
33
33
|
*
|
|
34
34
|
* When the `in` prop is set to `true`, the child component will first receive
|
|
35
35
|
* the class `example-enter`, then the `example-enter-active` will be added in
|
|
36
|
-
* the next tick. `
|
|
37
|
-
* reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/
|
|
36
|
+
* the next tick. `TransitionCSS` [forces a
|
|
37
|
+
* reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/TransitionCSS.js#L208-L215)
|
|
38
38
|
* between before adding the `example-enter-active`. This is an important trick
|
|
39
39
|
* because it allows us to transition between `example-enter` and
|
|
40
40
|
* `example-enter-active` even though they were added immediately one after
|
|
@@ -69,7 +69,7 @@ import React from 'react';
|
|
|
69
69
|
* [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
|
|
70
70
|
* prop, make sure to define styles for `.appear-*` classes as well.
|
|
71
71
|
*/
|
|
72
|
-
declare class
|
|
72
|
+
declare class TransitionCSS extends React.Component {
|
|
73
73
|
static defaultProps: {
|
|
74
74
|
classNames: string;
|
|
75
75
|
};
|
|
@@ -90,8 +90,8 @@ declare class CSSTransition extends React.Component {
|
|
|
90
90
|
activeClassName: any;
|
|
91
91
|
doneClassName: any;
|
|
92
92
|
};
|
|
93
|
-
addClass(element: any, type: any, phase: any)
|
|
94
|
-
removeClasses(element: any, type: any)
|
|
93
|
+
addClass: (element: any, type: any, phase: any) => void;
|
|
94
|
+
removeClasses: (element: any, type: any) => void;
|
|
95
95
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
96
96
|
}
|
|
97
|
-
export default
|
|
97
|
+
export default TransitionCSS;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* 潘启宝 2026-04-03 14:07:44 星期五 */
|
|
2
|
+
import { isElementByInstanceof as e, isFunction as t, isString as n } from "../utils/is.js";
|
|
3
|
+
import { forceReflow as r } from "../utils/dom.js";
|
|
4
|
+
import i from "../utils/findRootElement.js";
|
|
5
|
+
import a from "./Transition.js";
|
|
6
|
+
import o from "react";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
//#region components/common/transition-group/TransitionCSS.tsx
|
|
9
|
+
function c(t, r, i = "add") {
|
|
10
|
+
e(t) && r && n(r) && r.split(" ").filter(Boolean).forEach((e, n, r) => {
|
|
11
|
+
t.classList[i](e);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
var l = class extends o.Component {
|
|
15
|
+
constructor(...e) {
|
|
16
|
+
super(...e), this.appliedClasses = {
|
|
17
|
+
appear: {},
|
|
18
|
+
enter: {},
|
|
19
|
+
exit: {}
|
|
20
|
+
}, this.onEnter = (e, n) => {
|
|
21
|
+
let [r, i] = this.resolveArguments(e, n);
|
|
22
|
+
this.removeClasses(r, "exit"), this.addClass(r, i ? "appear" : "enter", "base"), t(this.props.onEnter) && this.props.onEnter(r, n);
|
|
23
|
+
}, this.onEntering = (e, n) => {
|
|
24
|
+
let [r, i] = this.resolveArguments(e, n), a = i ? "appear" : "enter";
|
|
25
|
+
this.addClass(r, a, "active"), t(this.props.onEntering) && this.props.onEntering(r, n);
|
|
26
|
+
}, this.onEntered = (e, n) => {
|
|
27
|
+
let [r, i] = this.resolveArguments(e, n), a = i ? "appear" : "enter";
|
|
28
|
+
this.removeClasses(r, a), this.addClass(r, a, "done"), t(this.props.onEntered) && this.props.onEntered(r, n);
|
|
29
|
+
}, this.onExit = (e) => {
|
|
30
|
+
let [n] = this.resolveArguments(e);
|
|
31
|
+
this.removeClasses(n, "appear"), this.removeClasses(n, "enter"), this.addClass(n, "exit", "base"), t(this.props.onExit) && this.props.onExit(n);
|
|
32
|
+
}, this.onExiting = (e) => {
|
|
33
|
+
let [n] = this.resolveArguments(e);
|
|
34
|
+
this.addClass(n, "exit", "active"), t(this.props.onExiting) && this.props.onExiting(n);
|
|
35
|
+
}, this.onExited = (e) => {
|
|
36
|
+
let [n] = this.resolveArguments(e);
|
|
37
|
+
this.removeClasses(n, "exit"), this.addClass(n, "exit", "done"), t(this.props.onExited) && this.props.onExited(n);
|
|
38
|
+
}, this.resolveArguments = (e, t) => [i(this.props.refElement) || e, t], this.getClassNames = (e) => {
|
|
39
|
+
let { classNames: t, duration: r } = this.props;
|
|
40
|
+
r == 0 && (t = "");
|
|
41
|
+
let i = n(t), a = i && t ? `${t}-` : "", o = i ? `${a}${e}` : t[e];
|
|
42
|
+
return {
|
|
43
|
+
baseClassName: o,
|
|
44
|
+
activeClassName: i ? `${o}-active` : t[`${e}Active`],
|
|
45
|
+
doneClassName: i ? `${o}-done` : t[`${e}Done`]
|
|
46
|
+
};
|
|
47
|
+
}, this.addClass = (e, t, n) => {
|
|
48
|
+
let i = this.getClassNames(t)[`${n}ClassName`], { doneClassName: a } = this.getClassNames("enter");
|
|
49
|
+
t === "appear" && n === "done" && a && (i += ` ${a}`), n === "active" && e && r(e), i && (this.appliedClasses[t][n] = i, c(e, i, "add"));
|
|
50
|
+
}, this.removeClasses = (e, t) => {
|
|
51
|
+
let { base: n, active: r, done: i } = this.appliedClasses[t];
|
|
52
|
+
this.appliedClasses[t] = {}, n && c(e, n, "remove"), r && c(e, r, "remove"), i && c(e, i, "remove");
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.defaultProps = { classNames: "" };
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
let { classNames: e, ...t } = this.props;
|
|
60
|
+
return /* @__PURE__ */ s(a, {
|
|
61
|
+
...t,
|
|
62
|
+
onEnter: this.onEnter,
|
|
63
|
+
onEntered: this.onEntered,
|
|
64
|
+
onEntering: this.onEntering,
|
|
65
|
+
onExit: this.onExit,
|
|
66
|
+
onExiting: this.onExiting,
|
|
67
|
+
onExited: this.onExited
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { l as default };
|
|
73
|
+
/* 独立思考,明辨是非 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* The `<TransitionGroup>` component manages a set of transition components
|
|
4
|
-
* (`<Transition>` and `<
|
|
4
|
+
* (`<Transition>` and `<TransitionCSS>`) in a list. Like with the transition
|
|
5
5
|
* components, `<TransitionGroup>` is a state machine for managing the mounting
|
|
6
6
|
* and unmounting of components over time.
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 潘启宝 2026-03
|
|
1
|
+
/* 潘启宝 2026-04-03 14:07:44 星期五 */
|
|
2
2
|
import { getChildMapping as e, getInitialChildMapping as t, getNextChildMapping as n } from "./ChildMapping.js";
|
|
3
|
-
import r from "./
|
|
3
|
+
import { TransitionGroupContext as r } from "./context.js";
|
|
4
4
|
import i from "react";
|
|
5
5
|
import { jsx as a } from "react/jsx-runtime";
|
|
6
6
|
//#region components/common/transition-group/TransitionGroup.tsx
|