fc1230b70f740f54ee5db1834883972bb0b50f77d37f34a5e75609782e09da061daee9d5707307d13174d5998dd05299c1ad43d8bcd637aa208172a105bceb 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. require('../../time-picker/index.js');
  5. var index = require('../../date-picker-panel/index.js');
  6. var props = require('./props.js');
  7. var constants = require('../../date-picker-panel/src/constants.js');
  8. var constants$1 = require('../../time-picker/src/constants.js');
  9. var picker = require('../../time-picker/src/common/picker.js');
  10. var event = require('../../../constants/event.js');
  11. function _isSlot(s) {
  12. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  13. }
  14. var DatePicker = vue.defineComponent({
  15. name: "ElDatePicker",
  16. install: null,
  17. props: props.datePickerProps,
  18. emits: [event.UPDATE_MODEL_EVENT],
  19. setup(props, {
  20. expose,
  21. emit,
  22. slots
  23. }) {
  24. const isDefaultFormat = vue.computed(() => {
  25. return !props.format;
  26. });
  27. vue.provide(constants.ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, isDefaultFormat);
  28. vue.provide(constants$1.PICKER_POPPER_OPTIONS_INJECTION_KEY, vue.reactive(vue.toRef(props, "popperOptions")));
  29. const commonPicker = vue.ref();
  30. const refProps = {
  31. focus: () => {
  32. var _a;
  33. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  34. },
  35. blur: () => {
  36. var _a;
  37. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  38. },
  39. handleOpen: () => {
  40. var _a;
  41. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  42. },
  43. handleClose: () => {
  44. var _a;
  45. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  46. }
  47. };
  48. expose(refProps);
  49. const onModelValueUpdated = (val) => {
  50. emit(event.UPDATE_MODEL_EVENT, val);
  51. };
  52. return () => {
  53. var _a;
  54. const format = (_a = props.format) != null ? _a : constants$1.DEFAULT_FORMATS_DATEPICKER[props.type] || constants$1.DEFAULT_FORMATS_DATE;
  55. return vue.createVNode(picker["default"], vue.mergeProps(props, {
  56. "format": format,
  57. "type": props.type,
  58. "ref": commonPicker,
  59. "onUpdate:modelValue": onModelValueUpdated
  60. }), {
  61. default: (scopedProps) => vue.createVNode(index.ElDatePickerPanel, vue.mergeProps({
  62. "border": false
  63. }, scopedProps), _isSlot(slots) ? slots : {
  64. default: () => [slots]
  65. }),
  66. "range-separator": slots["range-separator"]
  67. });
  68. };
  69. }
  70. });
  71. exports["default"] = DatePicker;
  72. //# sourceMappingURL=date-picker.js.map