UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 3.38 kB
{"version":3,"file":"affix.mjs","sources":["../../../../../../packages/components/affix/src/affix.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isBoolean,\n isNumber,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { teleportProps } from '@element-plus/components/teleport'\n\nimport type { CSSProperties, ExtractPublicPropTypes } from 'vue'\nimport type Affix from './affix.vue'\n\nexport interface AffixProps {\n /**\n * @description affix element zIndex value\n * */\n zIndex?: CSSProperties['z-index']\n /**\n * @description target container. (CSS selector)\n */\n target?: string\n /**\n * @description offset distance\n * */\n offset?: number\n /**\n * @description position of affix\n * */\n position?: 'top' | 'bottom'\n /**\n * @description whether affix element is teleported, if `true` it will be teleported to where `append-to` sets\n * */\n teleported?: boolean\n /**\n * @description which element the affix element appends to\n * */\n appendTo?: string | HTMLElement\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `AffixProps` instead.\n */\nexport const affixProps = buildProps({\n /**\n * @description affix element zIndex value\n * */\n zIndex: {\n type: definePropType<CSSProperties['z-index']>([Number, String]),\n default: 100,\n },\n /**\n * @description target container. (CSS selector)\n */\n target: {\n type: String,\n default: '',\n },\n /**\n * @description offset distance\n * */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description position of affix\n * */\n position: {\n type: String,\n values: ['top', 'bottom'],\n default: 'top',\n },\n /**\n * @description whether affix element is teleported, if `true` it will be teleported to where `append-to` sets\n * */\n teleported: Boolean,\n /**\n * @description which element the affix element appends to\n * */\n appendTo: {\n type: teleportProps.to.type,\n default: 'body',\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `AffixProps` instead.\n */\nexport type AffixPropsPublic = ExtractPublicPropTypes<typeof affixProps>\n\nexport const affixEmits = {\n scroll: ({ scrollTop, fixed }: { scrollTop: number; fixed: boolean }) =>\n isNumber(scrollTop) && isBoolean(fixed),\n [CHANGE_EVENT]: (fixed: boolean) => isBoolean(fixed),\n}\nexport type AffixEmits = typeof affixEmits\n\nexport type AffixInstance = InstanceType<typeof Affix> & unknown\n"],"names":[],"mappings":";;;;;AA0CO,MAAM,aAAa,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAInC,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,cAAA,CAAyC,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,IAC/D,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,CAAC,KAAA,EAAO,QAAQ,CAAA;AAAA,IACxB,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,UAAA,EAAY,OAAA;AAAA;AAAA;AAAA;AAAA,EAIZ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,cAAc,EAAA,CAAG,IAAA;AAAA,IACvB,OAAA,EAAS;AAAA;AAEb,CAAU;AAOH,MAAM,UAAA,GAAa;AAAA,EACxB,MAAA,EAAQ,CAAC,EAAE,SAAA,EAAW,KAAA,OACpB,QAAA,CAAS,SAAS,CAAA,IAAK,SAAA,CAAU,KAAK,CAAA;AAAA,EACxC,CAAC,YAAY,GAAG,CAAC,KAAA,KAAmB,UAAU,KAAK;AACrD;;;;"}