config.mjs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
  2. import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
  3. import { NOOP } from "../../../utils/functions.mjs";
  4. import { computed } from "vue";
  5. //#region ../../packages/components/cascader-panel/src/config.ts
  6. const CommonProps = buildProps({
  7. modelValue: { type: definePropType([
  8. Number,
  9. String,
  10. Array,
  11. Object
  12. ]) },
  13. options: {
  14. type: definePropType(Array),
  15. default: () => []
  16. },
  17. props: {
  18. type: definePropType(Object),
  19. default: () => ({})
  20. }
  21. });
  22. const DefaultProps = {
  23. expandTrigger: "click",
  24. multiple: false,
  25. checkStrictly: false,
  26. emitPath: true,
  27. lazy: false,
  28. lazyLoad: NOOP,
  29. value: "value",
  30. label: "label",
  31. children: "children",
  32. leaf: "leaf",
  33. disabled: "disabled",
  34. hoverThreshold: 500,
  35. checkOnClickNode: false,
  36. checkOnClickLeaf: true,
  37. showPrefix: true
  38. };
  39. /**
  40. * @deprecated Removed after 3.0.0, Use `CascaderPanelProps` instead.
  41. */
  42. const cascaderPanelProps = buildProps({
  43. ...CommonProps,
  44. border: {
  45. type: Boolean,
  46. default: true
  47. },
  48. renderLabel: { type: Function }
  49. });
  50. const emitChangeFn = (value) => true;
  51. const cascaderPanelEmits = {
  52. [UPDATE_MODEL_EVENT]: emitChangeFn,
  53. [CHANGE_EVENT]: emitChangeFn,
  54. close: () => true,
  55. "expand-change": (value) => value
  56. };
  57. const useCascaderConfig = (props) => {
  58. return computed(() => ({
  59. ...DefaultProps,
  60. ...props.props
  61. }));
  62. };
  63. //#endregion
  64. export { CommonProps, DefaultProps, cascaderPanelEmits, cascaderPanelProps, useCascaderConfig };
  65. //# sourceMappingURL=config.mjs.map