element-plus
Version:
A Component Library for Vue 3
1 lines • 6.22 kB
Source Map (JSON)
{"version":3,"file":"props.mjs","names":[],"sources":["../../../../../../packages/components/virtual-list/src/props.ts"],"sourcesContent":["import {\n buildProp,\n buildProps,\n definePropType,\n mutable,\n} from '@element-plus/utils'\nimport { VERTICAL } from './defaults'\n\nimport type { ExtractPropTypes, ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type { GridItemKeyGetter, 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 innerProps: {\n type: definePropType<Record<string, unknown>>(Object),\n default: () => ({}),\n },\n\n style: {\n type: definePropType<StyleValue>([Object, String, Array]),\n },\n\n useIsScrolling: Boolean,\n\n width: {\n type: [Number, String],\n required: false,\n },\n\n perfMode: {\n type: Boolean,\n default: true,\n },\n scrollbarAlwaysOn: Boolean,\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\nconst scrollbarSize = {\n type: Number,\n default: 6,\n} as const\n\nconst startGap = { type: Number, default: 0 } as const\nconst endGap = { type: Number, default: 2 } 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 itemKey: {\n type: definePropType<GridItemKeyGetter>(Function),\n default: ({\n columnIndex,\n rowIndex,\n }: {\n columnIndex: number\n rowIndex: number\n }) => `${rowIndex}:${columnIndex}`,\n },\n rowCache: cache,\n rowHeight: itemSize,\n totalColumn: total,\n totalRow: total,\n hScrollbarSize: scrollbarSize,\n vScrollbarSize: scrollbarSize,\n scrollbarStartGap: startGap,\n scrollbarEndGap: endGap,\n role: String,\n ...virtualizedProps,\n} as const)\n\nexport const virtualizedScrollbarProps = buildProps({\n alwaysOn: Boolean,\n class: String,\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 scrollbarSize,\n startGap,\n endGap,\n\n visible: Boolean,\n} as const)\n\nexport type VirtualizedProps = ExtractPropTypes<typeof virtualizedProps>\nexport type VirtualizedPropsPublic = ExtractPublicPropTypes<\n typeof virtualizedProps\n>\nexport type VirtualizedListProps = ExtractPropTypes<typeof virtualizedListProps>\nexport type VirtualizedListPropsPublic = ExtractPublicPropTypes<\n typeof virtualizedListProps\n>\nexport type VirtualizedGridProps = ExtractPropTypes<typeof virtualizedGridProps>\nexport type VirtualizedGridPropsPublic = ExtractPublicPropTypes<\n typeof virtualizedGridProps\n>\n\nexport type VirtualizedScrollbarProps = ExtractPropTypes<\n typeof virtualizedScrollbarProps\n>\nexport type VirtualizedScrollbarPropsPublic = ExtractPublicPropTypes<\n typeof vir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