zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
 
Object.defineProperty(exports, '__esModule', { value: true });
 
var vue = require('vue');
var dayjs = require('dayjs');
require('../../../../utils/index.js');
var shared = require('@vue/shared');
 
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
 
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
 
const useShortcut = (lang) => {
  const { emit } = vue.getCurrentInstance();
  const attrs = vue.useAttrs();
  const slots = vue.useSlots();
  const handleShortcutClick = (shortcut) => {
    const shortcutValues = shared.isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
    if (shortcutValues) {
      emit("pick", [
        dayjs__default["default"](shortcutValues[0]).locale(lang.value),
        dayjs__default["default"](shortcutValues[1]).locale(lang.value)
      ]);
      return;
    }
    if (shortcut.onClick) {
      shortcut.onClick({
        attrs,
        slots,
        emit
      });
    }
  };
  return handleShortcutClick;
};
 
exports.useShortcut = useShortcut;
//# sourceMappingURL=use-shortcut.js.map