1 line
20 KiB
JSON
1 line
20 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { getRowFormat, pickProps, toArray } from \"../utils/miscUtil\";\nimport { fillTimeFormat } from \"./useLocale\";\nfunction checkShow(format, keywords, show) {\n return show !== null && show !== void 0 ? show : keywords.some(function (keyword) {\n return format.includes(keyword);\n });\n}\nvar showTimeKeys = [\n// 'format',\n'showNow', 'showHour', 'showMinute', 'showSecond', 'showMillisecond', 'use12Hours', 'hourStep', 'minuteStep', 'secondStep', 'millisecondStep', 'hideDisabledOptions', 'defaultValue', 'disabledHours', 'disabledMinutes', 'disabledSeconds', 'disabledMilliseconds', 'disabledTime', 'changeOnScroll', 'defaultOpenValue'];\n\n/**\n * Get SharedTimeProps from props.\n */\nfunction pickTimeProps(props) {\n var timeProps = pickProps(props, showTimeKeys);\n var format = props.format,\n picker = props.picker;\n var propFormat = null;\n if (format) {\n propFormat = format;\n if (Array.isArray(propFormat)) {\n propFormat = propFormat[0];\n }\n propFormat = _typeof(propFormat) === 'object' ? propFormat.format : propFormat;\n }\n if (picker === 'time') {\n timeProps.format = propFormat;\n }\n return [timeProps, propFormat];\n}\nfunction isStringFormat(format) {\n return format && typeof format === 'string';\n}\n/** Check if all the showXXX is `undefined` */\nfunction existShowConfig(showHour, showMinute, showSecond, showMillisecond) {\n return [showHour, showMinute, showSecond, showMillisecond].some(function (show) {\n return show !== undefined;\n });\n}\n\n/** Fill the showXXX if needed */\nfunction fillShowConfig(hasShowConfig, showHour, showMinute, showSecond, showMillisecond) {\n var parsedShowHour = showHour;\n var parsedShowMinute = showMinute;\n var parsedShowSecond = showSecond;\n if (!hasShowConfig && !parsedShowHour && !parsedShowMinute && !parsedShowSecond && !showMillisecond) {\n parsedShowHour = true;\n parsedShowMinute = true;\n parsedShowSecond = true;\n } else if (hasShowConfig) {\n var _parsedShowHour, _parsedShowMinute, _parsedShowSecond;\n var existFalse = [parsedShowHour, parsedShowMinute, parsedShowSecond].some(function (show) {\n return show === false;\n });\n var existTrue = [parsedShowHour, parsedShowMinute, parsedShowSecond].some(function (show) {\n return show === true;\n });\n var defaultShow = existFalse ? true : !existTrue;\n parsedShowHour = (_parsedShowHour = parsedShowHour) !== null && _parsedShowHour !== void 0 ? _parsedShowHour : defaultShow;\n parsedShowMinute = (_parsedShowMinute = parsedShowMinute) !== null && _parsedShowMinute !== void 0 ? _parsedShowMinute : defaultShow;\n parsedShowSecond = (_parsedShowSecond = parsedShowSecond) !== null && _parsedShowSecond !== void 0 ? _parsedShowSecond : defaultShow;\n }\n return [parsedShowHour, parsedShowMinute, parsedShowSecond, showMillisecond];\n}\n\n/**\n * Get `showHour`, `showMinute`, `showSecond` or other from the props.\n * This is pure function, will not get `showXXX` from the `format` prop.\n */\nexport function getTimeProps(componentProps) {\n var showTime = componentProps.showTime;\n var _pickTimeProps = pickTimeProps(componentProps),\n _pickTimeProps2 = _slicedToArray(_pickTimeProps, 2),\n pickedProps = _pickTimeProps2[0],\n propFormat = _pickTimeProps2[1];\n var showTimeConfig = showTime && _typeof(showTime) === 'object' ? showTime : {};\n var timeConfig = _objectSpread(_objectSpread({\n defaultOpenValue: showTimeConfig.defaultOpenValue || showTimeConfig.defaultValue\n }, pickedProps), showTimeConfig);\n var showMillisecond = timeConfig.showMillisecond;\n var showHour = timeConfig.showHour,\n showMinute = timeConfig.showMinute,\n showSecond = timeConfig.showSecond;\n var hasShowConfig = existShowConfig(showHour, showMinute, showSecond, showMillisecond);\n var _fillShowConfig =
|