2a36158e5ce2d32d28937edcce213322.json
9.84 KB
{"ast":null,"code":"import * as React from 'react';\nimport { WEEK_DAY_COUNT, getWeekStartDate, isSameDate, isSameMonth, formatValue } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport PanelBody from '../PanelBody';\n\nfunction DateBody(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n prefixColumn = props.prefixColumn,\n locale = props.locale,\n rowCount = props.rowCount,\n viewDate = props.viewDate,\n value = props.value,\n dateRender = props.dateRender;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var baseDate = getWeekStartDate(locale.locale, generateConfig, viewDate);\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale.locale);\n var today = generateConfig.getNow(); // ============================== Header ==============================\n\n var headerCells = [];\n var weekDaysLocale = locale.shortWeekDays || (generateConfig.locale.getShortWeekDays ? generateConfig.locale.getShortWeekDays(locale.locale) : []);\n\n if (prefixColumn) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: \"empty\",\n \"aria-label\": \"empty cell\"\n }));\n }\n\n for (var i = 0; i < WEEK_DAY_COUNT; i += 1) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: i\n }, weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]));\n } // =============================== Body ===============================\n\n\n var getCellClassName = useCellClassName({\n cellPrefixCls: cellPrefixCls,\n today: today,\n value: value,\n generateConfig: generateConfig,\n rangedValue: prefixColumn ? null : rangedValue,\n hoverRangedValue: prefixColumn ? null : hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameDate(generateConfig, current, target);\n },\n isInView: function isInView(date) {\n return isSameMonth(generateConfig, date, viewDate);\n },\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addDate(date, offset);\n }\n });\n var getCellNode = dateRender ? function (date) {\n return dateRender(date, today);\n } : undefined;\n return /*#__PURE__*/React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: rowCount,\n colNum: WEEK_DAY_COUNT,\n baseDate: baseDate,\n getCellNode: getCellNode,\n getCellText: generateConfig.getDate,\n getCellClassName: getCellClassName,\n getCellDate: generateConfig.addDate,\n titleCell: function titleCell(date) {\n return formatValue(date, {\n locale: locale,\n format: 'YYYY-MM-DD',\n generateConfig: generateConfig\n });\n },\n headerCells: headerCells\n }));\n}\n\nexport default DateBody;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/panels/DatePanel/DateBody.js"],"names":["React","WEEK_DAY_COUNT","getWeekStartDate","isSameDate","isSameMonth","formatValue","RangeContext","useCellClassName","PanelBody","DateBody","props","prefixCls","generateConfig","prefixColumn","locale","rowCount","viewDate","value","dateRender","_React$useContext","useContext","rangedValue","hoverRangedValue","baseDate","cellPrefixCls","concat","weekFirstDay","getWeekFirstDay","today","getNow","headerCells","weekDaysLocale","shortWeekDays","getShortWeekDays","push","createElement","key","i","getCellClassName","isSameCell","current","target","isInView","date","offsetCell","offset","addDate","getCellNode","undefined","Object","assign","rowNum","colNum","getCellText","getDate","getCellDate","titleCell","format"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,cAAT,EAAyBC,gBAAzB,EAA2CC,UAA3C,EAAuDC,WAAvD,EAAoEC,WAApE,QAAuF,sBAAvF;AACA,OAAOC,YAAP,MAAyB,oBAAzB;AACA,OAAOC,gBAAP,MAA6B,8BAA7B;AACA,OAAOC,SAAP,MAAsB,cAAtB;;AAEA,SAASC,QAAT,CAAkBC,KAAlB,EAAyB;AACvB,MAAIC,SAAS,GAAGD,KAAK,CAACC,SAAtB;AAAA,MACIC,cAAc,GAAGF,KAAK,CAACE,cAD3B;AAAA,MAEIC,YAAY,GAAGH,KAAK,CAACG,YAFzB;A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CAAoB3B,SAApB,EAA+ByC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBxC,KAAlB,EAAyB;AAC1EyC,IAAAA,MAAM,EAAEpC,QADkE;AAE1EqC,IAAAA,MAAM,EAAEnD,cAFkE;AAG1EsB,IAAAA,QAAQ,EAAEA,QAHgE;AAI1EwB,IAAAA,WAAW,EAAEA,WAJ6D;AAK1EM,IAAAA,WAAW,EAAEzC,cAAc,CAAC0C,OAL8C;AAM1EhB,IAAAA,gBAAgB,EAAEA,gBANwD;AAO1EiB,IAAAA,WAAW,EAAE3C,cAAc,CAACkC,OAP8C;AAQ1EU,IAAAA,SAAS,EAAE,SAASA,SAAT,CAAmBb,IAAnB,EAAyB;AAClC,aAAOtC,WAAW,CAACsC,IAAD,EAAO;AACvB7B,QAAAA,MAAM,EAAEA,MADe;AAEvB2C,QAAAA,MAAM,EAAE,YAFe;AAGvB7C,QAAAA,cAAc,EAAEA;AAHO,OAAP,CAAlB;AAKD,KAdyE;AAe1EkB,IAAAA,WAAW,EAAEA;AAf6D,GAAzB,CAA/B,CAApB;AAiBD;;AAED,eAAerB,QAAf","sourcesContent":["import * as React from 'react';\nimport { WEEK_DAY_COUNT, getWeekStartDate, isSameDate, isSameMonth, formatValue } from '../../utils/dateUtil';\nimport RangeContext from '../../RangeContext';\nimport useCellClassName from '../../hooks/useCellClassName';\nimport PanelBody from '../PanelBody';\n\nfunction DateBody(props) {\n var prefixCls = props.prefixCls,\n generateConfig = props.generateConfig,\n prefixColumn = props.prefixColumn,\n locale = props.locale,\n rowCount = props.rowCount,\n viewDate = props.viewDate,\n value = props.value,\n dateRender = props.dateRender;\n\n var _React$useContext = React.useContext(RangeContext),\n rangedValue = _React$useContext.rangedValue,\n hoverRangedValue = _React$useContext.hoverRangedValue;\n\n var baseDate = getWeekStartDate(locale.locale, generateConfig, viewDate);\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale.locale);\n var today = generateConfig.getNow(); // ============================== Header ==============================\n\n var headerCells = [];\n var weekDaysLocale = locale.shortWeekDays || (generateConfig.locale.getShortWeekDays ? generateConfig.locale.getShortWeekDays(locale.locale) : []);\n\n if (prefixColumn) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: \"empty\",\n \"aria-label\": \"empty cell\"\n }));\n }\n\n for (var i = 0; i < WEEK_DAY_COUNT; i += 1) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: i\n }, weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]));\n } // =============================== Body ===============================\n\n\n var getCellClassName = useCellClassName({\n cellPrefixCls: cellPrefixCls,\n today: today,\n value: value,\n generateConfig: generateConfig,\n rangedValue: prefixColumn ? null : rangedValue,\n hoverRangedValue: prefixColumn ? null : hoverRangedValue,\n isSameCell: function isSameCell(current, target) {\n return isSameDate(generateConfig, current, target);\n },\n isInView: function isInView(date) {\n return isSameMonth(generateConfig, date, viewDate);\n },\n offsetCell: function offsetCell(date, offset) {\n return generateConfig.addDate(date, offset);\n }\n });\n var getCellNode = dateRender ? function (date) {\n return dateRender(date, today);\n } : undefined;\n return /*#__PURE__*/React.createElement(PanelBody, Object.assign({}, props, {\n rowNum: rowCount,\n colNum: WEEK_DAY_COUNT,\n baseDate: baseDate,\n getCellNode: getCellNode,\n getCellText: generateConfig.getDate,\n getCellClassName: getCellClassName,\n getCellDate: generateConfig.addDate,\n titleCell: function titleCell(date) {\n return formatValue(date, {\n locale: locale,\n format: 'YYYY-MM-DD',\n generateConfig: generateConfig\n });\n },\n headerCells: headerCells\n }));\n}\n\nexport default DateBody;"]},"metadata":{},"sourceType":"module"}