eb1e3f4b588c894acc329d14300467c2.json
7.72 KB
{"ast":null,"code":"import * as React from 'react';\nimport DecadeHeader from './DecadeHeader';\nimport DecadeBody, { DECADE_COL_COUNT } from './DecadeBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nexport var DECADE_UNIT_DIFF = 10;\nexport var DECADE_DISTANCE_COUNT = DECADE_UNIT_DIFF * 10;\n\nfunction DecadePanel(props) {\n var prefixCls = props.prefixCls,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n viewDate = props.viewDate,\n operationRef = props.operationRef,\n onSelect = props.onSelect,\n onPanelChange = props.onPanelChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-decade-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT), 'key');\n },\n onUpDown: function onUpDown(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF * DECADE_COL_COUNT), 'key');\n },\n onEnter: function onEnter() {\n onPanelChange('year', viewDate);\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onDecadesChange = function onDecadesChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onInternalSelect = function onInternalSelect(date) {\n onSelect(date, 'mouse');\n onPanelChange('year', date);\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: panelPrefixCls\n }, /*#__PURE__*/React.createElement(DecadeHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevDecades: function onPrevDecades() {\n onDecadesChange(-1);\n },\n onNextDecades: function onNextDecades() {\n onDecadesChange(1);\n }\n })), /*#__PURE__*/React.createElement(DecadeBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: onInternalSelect\n })));\n}\n\nexport default DecadePanel;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/panels/DecadePanel/index.js"],"names":["React","DecadeHeader","DecadeBody","DECADE_COL_COUNT","createKeyDownHandler","DECADE_UNIT_DIFF","DECADE_DISTANCE_COUNT","DecadePanel","props","prefixCls","onViewDateChange","generateConfig","viewDate","operationRef","onSelect","onPanelChange","panelPrefixCls","concat","current","onKeyDown","event","onLeftRight","diff","addYear","onCtrlLeftRight","onUpDown","onEnter","onDecadesChange","newDate","onInternalSelect","date","createElement","className","Object","assign","onPrevDecades","onNextDecades"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,UAAP,IAAqBC,gBAArB,QAA6C,cAA7C;AACA,SAASC,oBAAT,QAAqC,oBAArC;AACA,OAAO,IAAIC,gBAAgB,GAAG,EAAvB;AACP,OAAO,IAAIC,qBAAqB,GAAGD,gBAAgB,GAAG,EAA/C;;AAEP,SAASE,WAAT,CAAqBC,KAArB,EAA4B;AAC1B,MAAIC,SAAS,GAAGD,KAAK,CAACC,SAAtB;AAAA,MACIC,gBAAgB,GAAGF,KAAK,CAACE,gBAD7B;AAAA,MAEIC,cAAc,GAAGH,KAAK,CAACG,cAF3B;AAAA,MAGIC,QAAQ,GAAGJ,KAAK,CAACI,QAHrB;AAAA,MAIIC,YAAY,GAAGL,KAAK,CAACK,YAJzB;AAAA,MAKIC,QAAQ,GAAGN,KAAK,CAACM,QALrB;AAAA,MAMIC,aAAa,GAAGP,KAAK,CAACO,aAN1B;AAOA,MAAIC,cAAc,GAAG,GAAGC,MAAH,CAAUR,SAAV,EAAqB,eAArB,CAArB,CAR0B,CAQkC;;AAE5DI,EAAAA,YAAY,CAACK,OAAb,GAAuB;AACrBC,IAA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AR;AACAf,IAAAA,aAAa,CAAC,MAAD,EAASe,IAAT,CAAb;AACD,GAHD;;AAKA,SAAO,aAAa9B,KAAK,CAAC+B,aAAN,CAAoB,KAApB,EAA2B;AAC7CC,IAAAA,SAAS,EAAEhB;AADkC,GAA3B,EAEjB,aAAahB,KAAK,CAAC+B,aAAN,CAAoB9B,YAApB,EAAkCgC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB1B,KAAlB,EAAyB;AACzEC,IAAAA,SAAS,EAAEA,SAD8D;AAEzE0B,IAAAA,aAAa,EAAE,SAASA,aAAT,GAAyB;AACtCR,MAAAA,eAAe,CAAC,CAAC,CAAF,CAAf;AACD,KAJwE;AAKzES,IAAAA,aAAa,EAAE,SAASA,aAAT,GAAyB;AACtCT,MAAAA,eAAe,CAAC,CAAD,CAAf;AACD;AAPwE,GAAzB,CAAlC,CAFI,EAUf,aAAa3B,KAAK,CAAC+B,aAAN,CAAoB7B,UAApB,EAAgC+B,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB1B,KAAlB,EAAyB;AACzEC,IAAAA,SAAS,EAAEA,SAD8D;AAEzEK,IAAAA,QAAQ,EAAEe;AAF+D,GAAzB,CAAhC,CAVE,CAApB;AAcD;;AAED,eAAetB,WAAf","sourcesContent":["import * as React from 'react';\nimport DecadeHeader from './DecadeHeader';\nimport DecadeBody, { DECADE_COL_COUNT } from './DecadeBody';\nimport { createKeyDownHandler } from '../../utils/uiUtil';\nexport var DECADE_UNIT_DIFF = 10;\nexport var DECADE_DISTANCE_COUNT = DECADE_UNIT_DIFF * 10;\n\nfunction DecadePanel(props) {\n var prefixCls = props.prefixCls,\n onViewDateChange = props.onViewDateChange,\n generateConfig = props.generateConfig,\n viewDate = props.viewDate,\n operationRef = props.operationRef,\n onSelect = props.onSelect,\n onPanelChange = props.onPanelChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-decade-panel\"); // ======================= Keyboard =======================\n\n operationRef.current = {\n onKeyDown: function onKeyDown(event) {\n return createKeyDownHandler(event, {\n onLeftRight: function onLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF), 'key');\n },\n onCtrlLeftRight: function onCtrlLeftRight(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT), 'key');\n },\n onUpDown: function onUpDown(diff) {\n onSelect(generateConfig.addYear(viewDate, diff * DECADE_UNIT_DIFF * DECADE_COL_COUNT), 'key');\n },\n onEnter: function onEnter() {\n onPanelChange('year', viewDate);\n }\n });\n }\n }; // ==================== View Operation ====================\n\n var onDecadesChange = function onDecadesChange(diff) {\n var newDate = generateConfig.addYear(viewDate, diff * DECADE_DISTANCE_COUNT);\n onViewDateChange(newDate);\n onPanelChange(null, newDate);\n };\n\n var onInternalSelect = function onInternalSelect(date) {\n onSelect(date, 'mouse');\n onPanelChange('year', date);\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: panelPrefixCls\n }, /*#__PURE__*/React.createElement(DecadeHeader, Object.assign({}, props, {\n prefixCls: prefixCls,\n onPrevDecades: function onPrevDecades() {\n onDecadesChange(-1);\n },\n onNextDecades: function onNextDecades() {\n onDecadesChange(1);\n }\n })), /*#__PURE__*/React.createElement(DecadeBody, Object.assign({}, props, {\n prefixCls: prefixCls,\n onSelect: onInternalSelect\n })));\n}\n\nexport default DecadePanel;"]},"metadata":{},"sourceType":"module"}