yanzhen-design-vue
Version:
93 lines (92 loc) • 2.49 kB
JavaScript
import { apiProviderBaseProps } from "@yanzhen-lowcode/core";
import { buildProps, definePropType, buildEmits, propsSeparate } from "@yanzhen-libs/utils-vue";
import { pick } from "lodash-es";
import "../../../hooks/index.mjs";
import "./enum/index.mjs";
import { usuallyType, Usually } from "./constants/usually.mjs";
import { contactsModelValueProps } from "./hook/use-contacts-model-value.mjs";
import { showTabKeysProps } from "./hook/use-contacts-commom-props.mjs";
import { contactsOptionsProps } from "./hook/use-contacts-options.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { getApiSymbol } from "./enum/contacts.mjs";
const ns = useNamespace("contacts");
const triggerTypes = ["click", "hover"];
const contactsOptions = {
ns,
class: ns.b(),
name: ns.defineVNodeName(),
triggerTypes
};
const contactsName = contactsOptions.name;
const contactsProps = buildProps({
...apiProviderBaseProps,
...contactsOptionsProps(),
...contactsModelValueProps(),
...showTabKeysProps,
selfId: String,
title: {
type: String,
default: "通讯录"
},
/**
* 常用联系人的类型
*/
usuallyUserRequestType: {
type: definePropType(String),
values: Object.values(usuallyType),
default: Usually.ALL
},
// 可选用户
optionalList: {
type: definePropType(Array),
default: () => []
},
// 是否需要外部用户
needOutUser: {
type: [String, Boolean, Number],
values: ["0", "1", 0, 1, "Y", "N", false, true],
default: false
},
multiple: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: "请选择"
},
/**
* @description 翻页功能 每页条数
*/
pageSize: {
type: Number,
default: 100
},
allExpand: {
type: Boolean,
default: true
},
// 禁用的id列表(不区分类型);从外部传入,内部只参与判断;
disableIds: definePropType(Array),
onChange: definePropType(Function),
onClick: definePropType(Function),
onSearch: definePropType(Function),
["onUpdate:selectedValue"]: definePropType(Function)
});
const contactsApis = getApiSymbol();
const contactsEmits = buildEmits(propsSeparate(contactsProps).emits);
const contactsPickProps = (props) => {
return pick(props, ...Object.keys(contactsProps));
};
export {
contactsApis,
contactsEmits,
contactsName,
contactsOptions,
contactsPickProps,
contactsProps
};