主要功能: - 修改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>
84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
/*
|
|
** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
** Licensed under MIT License.
|
|
*/
|
|
|
|
/* jshint node:true */
|
|
"use strict";
|
|
|
|
if (process.platform !== "darwin") {
|
|
throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
|
|
}
|
|
|
|
const Native = require("./fsevents.node");
|
|
const events = Native.constants;
|
|
|
|
function watch(path, since, handler) {
|
|
if (typeof path !== "string") {
|
|
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`);
|
|
}
|
|
if ("function" === typeof since && "undefined" === typeof handler) {
|
|
handler = since;
|
|
since = Native.flags.SinceNow;
|
|
}
|
|
if (typeof since !== "number") {
|
|
throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`);
|
|
}
|
|
if (typeof handler !== "function") {
|
|
throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
|
|
}
|
|
|
|
let instance = Native.start(Native.global, path, since, handler);
|
|
if (!instance) throw new Error(`could not watch: ${path}`);
|
|
return () => {
|
|
const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined);
|
|
instance = undefined;
|
|
return result;
|
|
};
|
|
}
|
|
|
|
function getInfo(path, flags) {
|
|
return {
|
|
path,
|
|
flags,
|
|
event: getEventType(flags),
|
|
type: getFileType(flags),
|
|
changes: getFileChanges(flags),
|
|
};
|
|
}
|
|
|
|
function getFileType(flags) {
|
|
if (events.ItemIsFile & flags) return "file";
|
|
if (events.ItemIsDir & flags) return "directory";
|
|
if (events.MustScanSubDirs & flags) return "directory";
|
|
if (events.ItemIsSymlink & flags) return "symlink";
|
|
}
|
|
function anyIsTrue(obj) {
|
|
for (let key in obj) {
|
|
if (obj[key]) return true;
|
|
}
|
|
return false;
|
|
}
|
|
function getEventType(flags) {
|
|
if (events.ItemRemoved & flags) return "deleted";
|
|
if (events.ItemRenamed & flags) return "moved";
|
|
if (events.ItemCreated & flags) return "created";
|
|
if (events.ItemModified & flags) return "modified";
|
|
if (events.RootChanged & flags) return "root-changed";
|
|
if (events.ItemCloned & flags) return "cloned";
|
|
if (anyIsTrue(flags)) return "modified";
|
|
return "unknown";
|
|
}
|
|
function getFileChanges(flags) {
|
|
return {
|
|
inode: !!(events.ItemInodeMetaMod & flags),
|
|
finder: !!(events.ItemFinderInfoMod & flags),
|
|
access: !!(events.ItemChangeOwner & flags),
|
|
xattrs: !!(events.ItemXattrMod & flags),
|
|
};
|
|
}
|
|
|
|
exports.watch = watch;
|
|
exports.getInfo = getInfo;
|
|
exports.constants = events;
|