124 lines
3.3 KiB
JavaScript
124 lines
3.3 KiB
JavaScript
'use strict';
|
|
|
|
var vue = require('vue');
|
|
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
var event = require('../../../constants/event.js');
|
|
var shared = require('@vue/shared');
|
|
|
|
const CommonProps = runtime.buildProps({
|
|
/**
|
|
* @description specify which key of node object is used as the node's value
|
|
*/
|
|
modelValue: {
|
|
type: runtime.definePropType([Number, String, Array, Object])
|
|
},
|
|
/**
|
|
* @description data of the options, the key of `value` and `label` can be customize by `CascaderProps`.
|
|
*/
|
|
options: {
|
|
type: runtime.definePropType(Array),
|
|
default: () => []
|
|
},
|
|
/**
|
|
* @description configuration options, see the following `CascaderProps` table.
|
|
*/
|
|
props: {
|
|
type: runtime.definePropType(Object),
|
|
default: () => ({})
|
|
}
|
|
});
|
|
const DefaultProps = {
|
|
/**
|
|
* @description trigger mode of expanding options
|
|
*/
|
|
expandTrigger: "click",
|
|
/**
|
|
* @description whether multiple selection is enabled
|
|
*/
|
|
multiple: false,
|
|
/**
|
|
* @description whether checked state of a node not affects its parent and child nodes
|
|
*/
|
|
checkStrictly: false,
|
|
// whether all nodes can be selected
|
|
/**
|
|
* @description when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node.
|
|
*/
|
|
emitPath: true,
|
|
// whether to emit an array of all levels value in which node is located
|
|
/**
|
|
* @description whether to dynamic load child nodes, use with `lazyload` attribute
|
|
*/
|
|
lazy: false,
|
|
/**
|
|
* @description method for loading child nodes data, only works when `lazy` is true
|
|
*/
|
|
lazyLoad: shared.NOOP,
|
|
/**
|
|
* @description specify which key of node object is used as the node's value
|
|
*/
|
|
value: "value",
|
|
/**
|
|
* @description specify which key of node object is used as the node's label
|
|
*/
|
|
label: "label",
|
|
/**
|
|
* @description specify which key of node object is used as the node's children
|
|
*/
|
|
children: "children",
|
|
/**
|
|
* @description specify which key of node object is used as the node's leaf
|
|
*/
|
|
leaf: "leaf",
|
|
/**
|
|
* @description specify which key of node object is used as the node's disabled
|
|
*/
|
|
disabled: "disabled",
|
|
/**
|
|
* @description hover threshold of expanding options
|
|
*/
|
|
hoverThreshold: 500,
|
|
/**
|
|
* @description whether to check or uncheck node when clicking on the node
|
|
*/
|
|
checkOnClickNode: false,
|
|
/**
|
|
* @description whether to check or uncheck node when clicking on leaf node (last children).
|
|
*/
|
|
checkOnClickLeaf: true,
|
|
/**
|
|
* @description whether to show the radio or checkbox prefix
|
|
*/
|
|
showPrefix: true
|
|
};
|
|
const cascaderPanelProps = runtime.buildProps({
|
|
...CommonProps,
|
|
border: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
renderLabel: {
|
|
type: Function
|
|
}
|
|
});
|
|
const emitChangeFn = (value) => true;
|
|
const cascaderPanelEmits = {
|
|
[event.UPDATE_MODEL_EVENT]: emitChangeFn,
|
|
[event.CHANGE_EVENT]: emitChangeFn,
|
|
close: () => true,
|
|
"expand-change": (value) => value
|
|
};
|
|
const useCascaderConfig = (props) => {
|
|
return vue.computed(() => ({
|
|
...DefaultProps,
|
|
...props.props
|
|
}));
|
|
};
|
|
|
|
exports.CommonProps = CommonProps;
|
|
exports.DefaultProps = DefaultProps;
|
|
exports.cascaderPanelEmits = cascaderPanelEmits;
|
|
exports.cascaderPanelProps = cascaderPanelProps;
|
|
exports.useCascaderConfig = useCascaderConfig;
|
|
//# sourceMappingURL=config.js.map
|