{"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../packages/components/date-picker-panel/src/props/shared.ts"],"sourcesContent":["import { buildProps, definePropType, isArray } from '@element-plus/utils'\nimport { datePickTypes } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type { DatePickType } from '@element-plus/constants'\nimport type { DayOrDays } from '@element-plus/components/time-picker'\n\nconst selectionModes = [\n  'date',\n  'dates',\n  'year',\n  'years',\n  'month',\n  'months',\n  'week',\n  'range',\n]\n\nexport type RangeState = {\n  endDate: null | Dayjs\n  selecting: boolean\n}\n\nexport type DisabledDateType = (date: Date) => boolean\nexport type CellClassNameType = (date: Date) => string\n\nexport const datePickerSharedProps = buildProps({\n  cellClassName: {\n    type: definePropType<CellClassNameType>(Function),\n  },\n  disabledDate: {\n    type: definePropType<DisabledDateType>(Function),\n  },\n  date: {\n    type: definePropType<Dayjs>(Object),\n    required: true,\n  },\n  minDate: {\n    type: definePropType<Dayjs | null>(Object),\n  },\n  maxDate: {\n    type: definePropType<Dayjs | null>(Object),\n  },\n  parsedValue: {\n    type: definePropType<Dayjs | Dayjs[]>([Object, Array]),\n  },\n  rangeState: {\n    type: definePropType<RangeState>(Object),\n    default: () => ({\n      endDate: null,\n      selecting: false,\n    }),\n  },\n  disabled: Boolean,\n} as const)\n\nexport const panelSharedProps = buildProps({\n  type: {\n    type: definePropType<DatePickType>(String),\n    required: true,\n    values: datePickTypes,\n  },\n  dateFormat: String,\n  timeFormat: String,\n  showNow: {\n    type: Boolean,\n    default: true,\n  },\n  showConfirm: Boolean,\n  showFooter: {\n    type: Boolean,\n    default: true,\n  },\n  showWeekNumber: Boolean,\n  border: Boolean,\n  disabled: Boolean,\n  editable: {\n    type: Boolean,\n    default: true,\n  },\n} as const)\n\nexport const panelRangeSharedProps = buildProps({\n  unlinkPanels: Boolean,\n  visible: {\n    type: Boolean,\n    default: true,\n  },\n  showConfirm: Boolean,\n  showFooter: {\n    type: Boolean,\n    default: true,\n  },\n  border: Boolean,\n  disabled: Boolean,\n  parsedValue: {\n    type: definePropType<DayOrDays>(Array),\n  },\n} as const)\n\nexport const selectionModeWithDefault = (\n  mode: (typeof selectionModes)[number]\n) => {\n  return {\n    type: String,\n    values: selectionModes,\n    default: mode,\n  }\n}\n\nexport const rangePickerSharedEmits = {\n  pick: (range: [Dayjs, Dayjs]) => isArray(range),\n}\n\nexport type RangePickerSharedEmits = typeof rangePickerSharedEmits\nexport type PanelRangeSharedProps = ExtractPropTypes<\n  typeof panelRangeSharedProps\n>\nexport type PanelRangeSharedPropsPublic = ExtractPublicPropTypes<\n  typeof panelRangeSharedProps\n>\n"],"mappings":";;;;;AAQA,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAUD,MAAa,wBAAwB,WAAW;CAC9C,eAAe,EACb,MAAM,eAAkC,SAAS,EAClD;CACD,cAAc,EACZ,MAAM,eAAiC,SAAS,EACjD;CACD,MAAM;EACJ,MAAM,eAAsB,OAAO;EACnC,UAAU;EACX;CACD,SAAS,EACP,MAAM,eAA6B,OAAO,EAC3C;CACD,SAAS,EACP,MAAM,eAA6B,OAAO,EAC3C;CACD,aAAa,EACX,MAAM,eAAgC,CAAC,QAAQ,MAAM,CAAC,EACvD;CACD,YAAY;EACV,MAAM,eAA2B,OAAO;EACxC,gBAAgB;GACd,SAAS;GACT,WAAW;GACZ;EACF;CACD,UAAU;CACX,CAAU;AAEX,MAAa,mBAAmB,WAAW;CACzC,MAAM;EACJ,MAAM,eAA6B,OAAO;EAC1C,UAAU;EACV,QAAQ;EACT;CACD,YAAY;CACZ,YAAY;CACZ,SAAS;EACP,MAAM;EACN,SAAS;EACV;CACD,aAAa;CACb,YAAY;EACV,MAAM;EACN,SAAS;EACV;CACD,gBAAgB;CAChB,QAAQ;CACR,UAAU;CACV,UAAU;EACR,MAAM;EACN,SAAS;EACV;CACF,CAAU;AAEX,MAAa,wBAAwB,WAAW;CAC9C,cAAc;CACd,SAAS;EACP,MAAM;EACN,SAAS;EACV;CACD,aAAa;CACb,YAAY;EACV,MAAM;EACN,SAAS;EACV;CACD,QAAQ;CACR,UAAU;CACV,aAAa,EACX,MAAM,eAA0B,MAAM,EACvC;CACF,CAAU;AAEX,MAAa,4BACX,SACG;AACH,QAAO;EACL,MAAM;EACN,QAAQ;EACR,SAAS;EACV;;AAGH,MAAa,yBAAyB,EACpC,OAAO,UAA0B,QAAQ,MAAM,EAChD"}