主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
import { motionValue } from './index.mjs';
|
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
import { useEffect } from 'react';
|
|
import { warning } from 'motion-utils';
|
|
import { scroll } from '../render/dom/scroll/index.mjs';
|
|
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
|
|
function refWarning(name, ref) {
|
|
warning(Boolean(!ref || ref.current), `You have defined a ${name} options but the provided ref is not yet hydrated, probably because it's defined higher up the tree. Try calling useScroll() in the same component as the ref, or setting its \`layoutEffect: false\` option.`);
|
|
}
|
|
const createScrollMotionValues = () => ({
|
|
scrollX: motionValue(0),
|
|
scrollY: motionValue(0),
|
|
scrollXProgress: motionValue(0),
|
|
scrollYProgress: motionValue(0),
|
|
});
|
|
function useScroll({ container, target, layoutEffect = true, ...options } = {}) {
|
|
const values = useConstant(createScrollMotionValues);
|
|
const useLifecycleEffect = layoutEffect
|
|
? useIsomorphicLayoutEffect
|
|
: useEffect;
|
|
useLifecycleEffect(() => {
|
|
refWarning("target", target);
|
|
refWarning("container", container);
|
|
return scroll((_progress, { x, y }) => {
|
|
values.scrollX.set(x.current);
|
|
values.scrollXProgress.set(x.progress);
|
|
values.scrollY.set(y.current);
|
|
values.scrollYProgress.set(y.progress);
|
|
}, {
|
|
...options,
|
|
container: (container === null || container === void 0 ? void 0 : container.current) || undefined,
|
|
target: (target === null || target === void 0 ? void 0 : target.current) || undefined,
|
|
});
|
|
}, [container, target, JSON.stringify(options.offset)]);
|
|
return values;
|
|
}
|
|
|
|
export { useScroll };
|