UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 5.08 kB
{"version":3,"file":"props.mjs","sources":["../../../../../../packages/components/virtual-list/src/props.ts"],"sourcesContent":["import {\n buildProp,\n buildProps,\n definePropType,\n mutable,\n} from '@element-plus/utils/props'\nimport { VERTICAL } from './defaults'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type { StyleValue } from '@element-plus/utils/types'\nimport type { ItemSize } from './types'\n\nconst itemSize = buildProp({\n type: definePropType<number | ItemSize>([Number, Function]),\n required: true,\n} as const)\n\nconst estimatedItemSize = buildProp({\n type: Number,\n} as const)\n\nconst cache = buildProp({\n type: Number,\n default: 2,\n} as const)\n\nconst direction = buildProp({\n type: String,\n values: ['ltr', 'rtl'],\n default: 'ltr',\n} as const)\n\nconst initScrollOffset = buildProp({\n type: Number,\n default: 0,\n} as const)\n\nconst total = buildProp({\n type: Number,\n required: true,\n} as const)\n\nconst layout = buildProp({\n type: String,\n values: ['horizontal', 'vertical'],\n default: VERTICAL,\n} as const)\n\nexport const virtualizedProps = buildProps({\n className: {\n type: String,\n default: '',\n },\n\n containerElement: {\n type: definePropType<string | Element>([String, Object]),\n default: 'div',\n },\n\n data: {\n type: definePropType<any[]>(Array),\n default: () => mutable([] as const),\n },\n\n /**\n * @description controls the horizontal direction.\n */\n direction,\n\n height: {\n type: [String, Number],\n required: true,\n },\n\n innerElement: {\n type: [String, Object],\n default: 'div',\n },\n\n style: {\n type: definePropType<StyleValue>([Object, String, Array]),\n },\n\n useIsScrolling: {\n type: Boolean,\n default: false,\n },\n\n width: {\n type: [Number, String],\n required: false,\n },\n\n perfMode: {\n type: Boolean,\n default: true,\n },\n scrollbarAlwaysOn: {\n type: Boolean,\n default: false,\n },\n} as const)\n\nexport const virtualizedListProps = buildProps({\n /**\n * @description describes how many items should be pre rendered to the head\n * and the tail of the window\n */\n cache,\n\n estimatedItemSize,\n\n /**\n * @description controls the list's orientation\n */\n layout,\n\n initScrollOffset,\n\n /**\n * @description describes the total number of the list.\n */\n total,\n\n itemSize,\n ...virtualizedProps,\n} as const)\n\nexport const virtualizedGridProps = buildProps({\n columnCache: cache,\n columnWidth: itemSize,\n estimatedColumnWidth: estimatedItemSize,\n estimatedRowHeight: estimatedItemSize,\n initScrollLeft: initScrollOffset,\n initScrollTop: initScrollOffset,\n rowCache: cache,\n rowHeight: itemSize,\n totalColumn: total,\n totalRow: total,\n ...virtualizedProps,\n} as const)\n\nexport const virtualizedScrollbarProps = buildProps({\n layout,\n total,\n ratio: {\n type: Number,\n required: true,\n },\n clientSize: {\n type: Number,\n required: true,\n },\n scrollFrom: {\n type: Number,\n required: true,\n },\n visible: Boolean,\n} as const)\n\nexport type VirtualizedProps = ExtractPropTypes<typeof virtualizedProps>\nexport type VirtualizedListProps = ExtractPropTypes<typeof virtualizedListProps>\nexport type VirtualizedGridProps = ExtractPropTypes<typeof virtualizedGridProps>\n\nexport type VirtualizedScrollbarProps = ExtractPropTypes<\n typeof virtualizedScrollbarProps\n>\n"],"names":[],"mappings":";;;AAYA,MAAM,WAAW,UAAU;AAAA,EACzB,MAAM,eAAkC,CAAC,QAAQ;AAAA,EACjD,UAAU;AAAA;AAGZ,MAAM,oBAAoB,UAAU;AAAA,EAClC,MAAM;AAAA;AAGR,MAAM,QAAQ,UAAU;AAAA,EACtB,MAAM;AAAA,EACN,SAAS;AAAA;AAGX,MAAM,YAAY,UAAU;AAAA,EAC1B,MAAM;AAAA,EACN,QAAQ,CAAC,OAAO;AAAA,EAChB,SAAS;AAAA;AAGX,MAAM,mBAAmB,UAAU;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA;AAGX,MAAM,QAAQ,UAAU;AAAA,EACtB,MAAM;AAAA,EACN,UAAU;AAAA;AAGZ,MAAM,SAAS,UAAU;AAAA,EACvB,MAAM;AAAA,EACN,QAAQ,CAAC,cAAc;AAAA,EACvB,SAAS;AAAA;MAGE,mBAAmB,WAAW;AAAA,EACzC,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;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