726de38e610ee9112ac3c22ed9d6af570834a9d2addad5d8fc9ea210674d6b48434d93ec6df01967622e2ade5d1a57697a06bca60f9a4115edae55b0b25410 797 B

123456789101112131415161718192021222324252627282930
  1. import { getCurrentInstance, useAttrs, useSlots } from 'vue';
  2. import dayjs from 'dayjs';
  3. import { isFunction } from '@vue/shared';
  4. const useShortcut = (lang) => {
  5. const { emit } = getCurrentInstance();
  6. const attrs = useAttrs();
  7. const slots = useSlots();
  8. const handleShortcutClick = (shortcut) => {
  9. const shortcutValues = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
  10. if (shortcutValues) {
  11. emit("pick", [
  12. dayjs(shortcutValues[0]).locale(lang.value),
  13. dayjs(shortcutValues[1]).locale(lang.value)
  14. ]);
  15. return;
  16. }
  17. if (shortcut.onClick) {
  18. shortcut.onClick({
  19. attrs,
  20. slots,
  21. emit
  22. });
  23. }
  24. };
  25. return handleShortcutClick;
  26. };
  27. export { useShortcut };
  28. //# sourceMappingURL=use-shortcut.mjs.map