yanzhen-design-vue
Version:
130 lines (129 loc) • 3.43 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const utilsVue = require("@yanzhen-libs/utils-vue");
const core = require("@yanzhen-lowcode/core");
require("../../../hooks/index.cjs");
require("../../../constants/index.cjs");
require("../../text-preview/index.cjs");
const index = require("../../../hooks/use-namespace/index.cjs");
const textPreview = require("../../text-preview/src/text-preview.cjs");
const event = require("../../../constants/event.cjs");
const ns = index.useNamespace("rich-text");
const richTextOptions = {
ns,
class: ns.b(),
name: ns.defineVNodeName()
};
const richTextApis = {
default: Symbol("rich-text-api"),
upload: Symbol("rich-text-api-upload")
};
const richTextTypes = ["default", "simple"];
const richTextName = richTextOptions.name;
const richTextProps = utilsVue.buildProps({
...core.apiProviderBaseProps,
...textPreview.textPreviewProps,
value: {
type: String,
default: ""
},
disabled: {
type: Boolean
},
zIndex: {
type: Number,
default: 1e3
},
showToolbar: {
type: Boolean,
default: true
},
toolbarKeys: {
type: utilsVue.definePropType(Array),
default: () => []
},
mode: {
type: String,
values: richTextTypes,
default: richTextTypes[0]
},
/**
* @description form-data fieldName ,默认值 'file'
*/
fieldName: {
type: String,
default: "file"
},
/**
* @description 选择文件时的类型限制,默认为 ['image/*', 'video/*'] 。如不想限制,则设置为 []
*/
allowedFileTypes: {
type: utilsVue.definePropType(Array),
default: () => ["image/*"]
},
/**
* @description 最多可上传几个文件,默认为 10
*/
maxNumberOfFiles: {
type: Number,
default: 10
},
/**
* @description 单个文件的最大体积限制,默认为 10MB
*/
maxFileSize: {
type: utilsVue.definePropType([String, Number]),
default: "10MB"
},
/**
* @description 超时时间,默认为 10 秒
*/
timeout: {
type: Number,
default: 10 * 1e3
},
/**
* @description 小于该值就插入 base64 格式(而不上传),默认为 0
*/
base64LimitSize: {
type: [String, Number],
default: 0
},
/**
* @description 小于该值就插入 base64 格式(而不上传),默认为 0
*/
onBeforeUpload: {
type: utilsVue.definePropType(Function)
},
/**
* @description 自定义编辑器 alert
*/
customAlert: {
type: utilsVue.definePropType(Function)
}
});
const richTextEmits = utilsVue.buildEmits({
[event.UPDATE_VALUE_EVENT]: (value) => true,
[event.CHANGE_EVENT]: (value) => true,
[event.BLUR_EVENT]: (e) => true,
input: (e) => true,
click: (e) => true
});
const richTextPreviewName = ns.defineVNodeName("preview");
const richTextPreviewProps = utilsVue.buildProps({
...richTextProps,
...textPreview.textPreviewProps
});
const richTextPreviewEmits = utilsVue.buildEmits({
...richTextEmits,
...textPreview.textPreviewEmits
});
exports.richTextApis = richTextApis;
exports.richTextEmits = richTextEmits;
exports.richTextName = richTextName;
exports.richTextOptions = richTextOptions;
exports.richTextPreviewEmits = richTextPreviewEmits;
exports.richTextPreviewName = richTextPreviewName;
exports.richTextPreviewProps = richTextPreviewProps;
exports.richTextProps = richTextProps;
exports.richTextTypes = richTextTypes;