主要功能: - 修改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>
69 lines
2.5 KiB
JavaScript
69 lines
2.5 KiB
JavaScript
'use strict';
|
|
|
|
var identity = require('../../nodes/identity.js');
|
|
var Scalar = require('../../nodes/Scalar.js');
|
|
|
|
// If the value associated with a merge key is a single mapping node, each of
|
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
// already exists in it. If the value associated with the merge key is a
|
|
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
const MERGE_KEY = '<<';
|
|
const merge = {
|
|
identify: value => value === MERGE_KEY ||
|
|
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
default: 'key',
|
|
tag: 'tag:yaml.org,2002:merge',
|
|
test: /^<<$/,
|
|
resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
|
|
addToJSMap: addMergeToJSMap
|
|
}),
|
|
stringify: () => MERGE_KEY
|
|
};
|
|
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
(identity.isScalar(key) &&
|
|
(!key.type || key.type === Scalar.Scalar.PLAIN) &&
|
|
merge.identify(key.value))) &&
|
|
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
function addMergeToJSMap(ctx, map, value) {
|
|
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (identity.isSeq(value))
|
|
for (const it of value.items)
|
|
mergeValue(ctx, map, it);
|
|
else if (Array.isArray(value))
|
|
for (const it of value)
|
|
mergeValue(ctx, map, it);
|
|
else
|
|
mergeValue(ctx, map, value);
|
|
}
|
|
function mergeValue(ctx, map, value) {
|
|
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (!identity.isMap(source))
|
|
throw new Error('Merge sources must be maps or map aliases');
|
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
for (const [key, value] of srcMap) {
|
|
if (map instanceof Map) {
|
|
if (!map.has(key))
|
|
map.set(key, value);
|
|
}
|
|
else if (map instanceof Set) {
|
|
map.add(key);
|
|
}
|
|
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
Object.defineProperty(map, key, {
|
|
value,
|
|
writable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
exports.isMergeKey = isMergeKey;
|
|
exports.merge = merge;
|