75231b282fdbbae84858677ced7e00aa.json
11.1 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport DateBody from './DateBody';\nimport DateHeader from './DateHeader';\nimport { WEEK_DAY_COUNT } from '../../utils/dateUtil';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nvar DATE_ROW_COUNT = 6;\n\nfunction DatePanel(props) {\n var prefixCls = props.prefixCls,\n _props$panelName = props.panelName,\n panelName = _props$panelName === void 0 ? 'date' : _props$panelName,\n keyboardConfig = props.keyboardConfig,\n active = props.active,\n operationRef = props.operationRef,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n onViewDateChange = props.onViewDateChange,\n onPanelChange = props.onPanelChange,\n _onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-\").concat(panelName, \"-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, _objectSpread({\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff * WEEK_DAY_COUNT), 'key');\n },\n onPageUpDown: function onPageUpDown(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff), 'key');\n }\n }, keyboardConfig));\n }\n }; // ==================== View Operation ====================\n\n var onYearChange = function onYearChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onMonthChange = function onMonthChange(diff) {\n var newDate = generateConfig.addMonth(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(panelPrefixCls, _defineProperty({}, \"\".concat(panelPrefixCls, \"-active\"), active))\n }, /*#__PURE__*/React.createElement(DateHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n // View Operation\n onPrevYear: function onPrevYear() {\n onYearChange(-1);\n },\n onNextYear: function onNextYear() {\n onYearChange(1);\n },\n onPrevMonth: function onPrevMonth() {\n onMonthChange(-1);\n },\n onNextMonth: function onNextMonth() {\n onMonthChange(1);\n },\n onMonthClick: function onMonthClick() {\n onPanelChange('month', viewDate);\n },\n onYearClick: function onYearClick() {\n onPanelChange('year', viewDate);\n }\n })), /*#__PURE__*/React.createElement(DateBody, Object.assign({}, props, {\n onSelect: function onSelect(date) {\n return _onSelect(date, 'mouse');\n },\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n rowCount: DATE_ROW_COUNT\n })));\n}\n\nexport default DatePanel;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/panels/DatePanel/index.js"],"names":["_defineProperty","_objectSpread","React","classNames","DateBody","DateHeader","WEEK_DAY_COUNT","createKeyDownHandler","DATE_ROW_COUNT","DatePanel","props","prefixCls","_props$panelName","panelName","keyboardConfig","active","operationRef","generateConfig","value","viewDate","onViewDateChange","onPanelChange","_onSelect","onSelect","panelPrefixCls","concat","current","onKeyDown","event","onLeftRight","diff","addDate","onCtrlLeftRight","addYear","onUpDown","onPageUpDown","addMonth","onYearChange","newDate","onMonthChange","createElement","className","Object","assign","onPrevYear","onNextYear","onPrevMonth","onNextMonth","onMonthClick","onYearClick","date","rowCount"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,UAAP,MAAuB,cA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B,SAAS,CAAC4B,IAAD,EAAO,OAAP,CAAhB;AACD,KAHsE;AAIvEvC,IAAAA,SAAS,EAAEA,SAJ4D;AAKvEO,IAAAA,KAAK,EAAEA,KALgE;AAMvEC,IAAAA,QAAQ,EAAEA,QAN6D;AAOvEgC,IAAAA,QAAQ,EAAE3C;AAP6D,GAAzB,CAA9B,CAzBE,CAApB;AAkCD;;AAED,eAAeC,SAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport DateBody from './DateBody';\nimport DateHeader from './DateHeader';\nimport { WEEK_DAY_COUNT } from '../../utils/dateUtil';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nvar DATE_ROW_COUNT = 6;\n\nfunction DatePanel(props) {\n var prefixCls = props.prefixCls,\n _props$panelName = props.panelName,\n panelName = _props$panelName === void 0 ? 'date' : _props$panelName,\n keyboardConfig = props.keyboardConfig,\n active = props.active,\n operationRef = props.operationRef,\n generateConfig = props.generateConfig,\n value = props.value,\n viewDate = props.viewDate,\n onViewDateChange = props.onViewDateChange,\n onPanelChange = props.onPanelChange,\n _onSelect = props.onSelect;\n var panelPrefixCls = \"\".concat(prefixCls, \"-\").concat(panelName, \"-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, _objectSpread({\n onLeftRight: function onLeftRight(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n },\n onUpDown: function onUpDown(diff) {\n _onSelect(generateConfig.addDate(value || viewDate, diff * WEEK_DAY_COUNT), 'key');\n },\n onPageUpDown: function onPageUpDown(diff) {\n _onSelect(generateConfig.addMonth(value || viewDate, diff), 'key');\n }\n }, keyboardConfig));\n }\n }; // ==================== View Operation ====================\n\n var onYearChange = function onYearChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onMonthChange = function onMonthChange(diff) {\n var newDate = generateConfig.addMonth(viewDate, diff);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(panelPrefixCls, _defineProperty({}, \"\".concat(panelPrefixCls, \"-active\"), active))\n }, /*#__PURE__*/React.createElement(DateHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n // View Operation\n onPrevYear: function onPrevYear() {\n onYearChange(-1);\n },\n onNextYear: function onNextYear() {\n onYearChange(1);\n },\n onPrevMonth: function onPrevMonth() {\n onMonthChange(-1);\n },\n onNextMonth: function onNextMonth() {\n onMonthChange(1);\n },\n onMonthClick: function onMonthClick() {\n onPanelChange('month', viewDate);\n },\n onYearClick: function onYearClick() {\n onPanelChange('year', viewDate);\n }\n })), /*#__PURE__*/React.createElement(DateBody, Object.assign({}, props, {\n onSelect: function onSelect(date) {\n return _onSelect(date, 'mouse');\n },\n prefixCls: prefixCls,\n value: value,\n viewDate: viewDate,\n rowCount: DATE_ROW_COUNT\n })));\n}\n\nexport default DatePanel;"]},"metadata":{},"sourceType":"module"}