Notify.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. var __defProp = Object.defineProperty;
  2. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5. var __export = (target, all) => {
  6. for (var name2 in all)
  7. __defProp(target, name2, { get: all[name2], enumerable: true });
  8. };
  9. var __copyProps = (to, from, except, desc) => {
  10. if (from && typeof from === "object" || typeof from === "function") {
  11. for (let key of __getOwnPropNames(from))
  12. if (!__hasOwnProp.call(to, key) && key !== except)
  13. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  14. }
  15. return to;
  16. };
  17. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  18. var stdin_exports = {};
  19. __export(stdin_exports, {
  20. default: () => stdin_default,
  21. notifyProps: () => notifyProps
  22. });
  23. module.exports = __toCommonJS(stdin_exports);
  24. var import_vue = require("vue");
  25. var import_utils = require("../utils");
  26. var import_popup = require("../popup");
  27. var import_shared = require("../popup/shared");
  28. const [name, bem] = (0, import_utils.createNamespace)("notify");
  29. const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
  30. const notifyProps = (0, import_utils.extend)({}, import_shared.popupSharedProps, {
  31. type: (0, import_utils.makeStringProp)("danger"),
  32. color: String,
  33. message: import_utils.numericProp,
  34. position: (0, import_utils.makeStringProp)("top"),
  35. className: import_utils.unknownProp,
  36. background: String,
  37. lockScroll: Boolean
  38. });
  39. var stdin_default = (0, import_vue.defineComponent)({
  40. name,
  41. props: notifyProps,
  42. emits: ["update:show"],
  43. setup(props, {
  44. emit,
  45. slots
  46. }) {
  47. const updateShow = (show) => emit("update:show", show);
  48. return () => (0, import_vue.createVNode)(import_popup.Popup, (0, import_vue.mergeProps)({
  49. "class": [bem([props.type]), props.className],
  50. "style": {
  51. color: props.color,
  52. background: props.background
  53. },
  54. "overlay": false,
  55. "duration": 0.2,
  56. "onUpdate:show": updateShow
  57. }, (0, import_utils.pick)(props, popupInheritProps)), {
  58. default: () => [slots.default ? slots.default() : props.message]
  59. });
  60. }
  61. });