mention.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var helper = require('./helper.js');
  4. var input = require('../../input/src/input.js');
  5. var runtime = require('../../../utils/vue/props/runtime.js');
  6. var shared = require('@vue/shared');
  7. var event = require('../../../constants/event.js');
  8. const mentionProps = runtime.buildProps({
  9. ...input.inputProps,
  10. options: {
  11. type: runtime.definePropType(Array),
  12. default: () => []
  13. },
  14. prefix: {
  15. type: runtime.definePropType([String, Array]),
  16. default: "@",
  17. validator: (val) => {
  18. if (shared.isString(val))
  19. return val.length === 1;
  20. return val.every((v) => shared.isString(v) && v.length === 1);
  21. }
  22. },
  23. split: {
  24. type: String,
  25. default: " ",
  26. validator: (val) => val.length === 1
  27. },
  28. filterOption: {
  29. type: runtime.definePropType([Boolean, Function]),
  30. default: () => helper.filterOption,
  31. validator: (val) => {
  32. if (val === false)
  33. return true;
  34. return shared.isFunction(val);
  35. }
  36. },
  37. placement: {
  38. type: runtime.definePropType(String),
  39. default: "bottom"
  40. },
  41. showArrow: Boolean,
  42. offset: {
  43. type: Number,
  44. default: 0
  45. },
  46. whole: Boolean,
  47. checkIsWhole: {
  48. type: runtime.definePropType(Function)
  49. },
  50. modelValue: String,
  51. loading: Boolean,
  52. popperClass: {
  53. type: String,
  54. default: ""
  55. },
  56. popperOptions: {
  57. type: runtime.definePropType(Object),
  58. default: () => ({})
  59. }
  60. });
  61. const mentionEmits = {
  62. [event.UPDATE_MODEL_EVENT]: (value) => shared.isString(value),
  63. input: (value) => shared.isString(value),
  64. search: (pattern, prefix) => shared.isString(pattern) && shared.isString(prefix),
  65. select: (option, prefix) => shared.isString(option.value) && shared.isString(prefix),
  66. focus: (evt) => evt instanceof FocusEvent,
  67. blur: (evt) => evt instanceof FocusEvent
  68. };
  69. exports.mentionEmits = mentionEmits;
  70. exports.mentionProps = mentionProps;
  71. //# sourceMappingURL=mention.js.map