first commit

This commit is contained in:
SnhAenIgseAl
2026-03-31 16:44:41 +08:00
parent dd513eda30
commit 7bde226505
219 changed files with 33046 additions and 9 deletions
@@ -0,0 +1,3 @@
"use strict";
require("../../../../common/vendor.js");
require("../../locale/index.js");
@@ -0,0 +1,12 @@
"use strict";
var common_vendor = require("../../../../common/vendor.js");
var uni_modules_wotDesignUni_components_composables_useParent = require("./useParent.js");
var uni_modules_wotDesignUni_components_wdCellGroup_types = require("../wd-cell-group/types.js");
function useCell() {
const { parent: cellGroup, index } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdCellGroup_types.CELL_GROUP_KEY);
const border = common_vendor.computed$1(() => {
return cellGroup && cellGroup.props.border && index.value;
});
return { border };
}
exports.useCell = useCell;
@@ -0,0 +1,80 @@
"use strict";
var common_vendor = require("../../../../common/vendor.js");
function isVNode(value) {
return value ? value.__v_isVNode === true : false;
}
function flattenVNodes(children) {
const result = [];
const traverse = (children2) => {
if (Array.isArray(children2)) {
children2.forEach((child) => {
var _a;
if (isVNode(child)) {
result.push(child);
if ((_a = child.component) == null ? void 0 : _a.subTree) {
result.push(child.component.subTree);
traverse(child.component.subTree.children);
}
if (child.children) {
traverse(child.children);
}
}
});
}
};
traverse(children);
return result;
}
const findVNodeIndex = (vnodes, vnode) => {
const index = vnodes.indexOf(vnode);
if (index === -1) {
return vnodes.findIndex((item) => vnode.key !== void 0 && vnode.key !== null && item.type === vnode.type && item.key === vnode.key);
}
return index;
};
function sortChildren(parent, publicChildren, internalChildren) {
const vnodes = parent && parent.subTree && parent.subTree.children ? flattenVNodes(parent.subTree.children) : [];
internalChildren.sort((a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode));
const orderedPublicChildren = internalChildren.map((item) => item.proxy);
publicChildren.sort((a, b) => {
const indexA = orderedPublicChildren.indexOf(a);
const indexB = orderedPublicChildren.indexOf(b);
return indexA - indexB;
});
}
function useChildren(key) {
const publicChildren = common_vendor.reactive([]);
const internalChildren = common_vendor.reactive([]);
const parent = common_vendor.getCurrentInstance();
const linkChildren = (value) => {
const link = (child) => {
if (child.proxy) {
internalChildren.push(child);
publicChildren.push(child.proxy);
sortChildren(parent, publicChildren, internalChildren);
}
};
const unlink = (child) => {
const index = internalChildren.indexOf(child);
publicChildren.splice(index, 1);
internalChildren.splice(index, 1);
};
common_vendor.provide(
key,
Object.assign(
{
link,
unlink,
children: publicChildren,
internalChildren
},
value
)
);
};
return {
children: publicChildren,
linkChildren
};
}
exports.useChildren = useChildren;
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,21 @@
"use strict";
var common_vendor = require("../../../../common/vendor.js");
function useParent(key) {
const parent = common_vendor.inject(key, null);
if (parent) {
const instance = common_vendor.getCurrentInstance();
const { link, unlink, internalChildren } = parent;
link(instance);
common_vendor.onUnmounted(() => unlink(instance));
const index = common_vendor.computed$1(() => internalChildren.indexOf(instance));
return {
parent,
index
};
}
return {
parent: null,
index: common_vendor.ref(-1)
};
}
exports.useParent = useParent;
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");
@@ -0,0 +1,13 @@
"use strict";
var uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
var uni_modules_wotDesignUni_locale_index = require("../../locale/index.js");
const useTranslate = (name) => {
const prefix = name ? uni_modules_wotDesignUni_components_common_util.camelCase(name) + "." : "";
const translate = (key, ...args) => {
const currentMessages = uni_modules_wotDesignUni_locale_index.Locale.messages();
const message = uni_modules_wotDesignUni_components_common_util.getPropByPath(currentMessages, prefix + key);
return uni_modules_wotDesignUni_components_common_util.isFunction(message) ? message(...args) : uni_modules_wotDesignUni_components_common_util.isDef(message) ? message : `${prefix}${key}`;
};
return { translate };
};
exports.useTranslate = useTranslate;
@@ -0,0 +1,2 @@
"use strict";
require("../../../../common/vendor.js");