Skip to content

Commit

Permalink
chore: rename package files to index
Browse files Browse the repository at this point in the history
  • Loading branch information
keerl committed Nov 7, 2021
1 parent 8497f6c commit 40ecec7
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 14 deletions.
160 changes: 160 additions & 0 deletions src/collectionview/index-common.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import { ChangedData, CoreTypes, ItemsSource, KeyedTemplate, Label, Property, Template, View } from '@nativescript/core';
import { CollectionView as CollectionViewDefinition, Orientation } from '.';
export declare const CollectionViewTraceCategory = "NativescriptCollectionView";
export declare enum ContentInsetAdjustmentBehavior {
Always = 0,
Automatic = 1,
Never = 2,
ScrollableAxes = 3
}
export declare enum CLogTypes {
log,
info,
warning,
error
}
export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
export declare enum ListViewViewTypes {
ItemView = 0
}
export declare namespace knownTemplates {
const itemTemplate = "itemTemplate";
}
export declare namespace knownMultiTemplates {
const itemTemplates = "itemTemplates";
}
export interface Plugin {
onLayout?: Function;
}
export declare abstract class CollectionViewBase extends View implements CollectionViewDefinition {
static itemLoadingEvent: string;
static scrollEvent: string;
static scrollStartEvent: string;
static scrollEndEvent: string;
static itemTapEvent: string;
static displayItemEvent: string;
static itemReorderedEvent: string;
static itemReorderStartingEvent: string;
static itemReorderStartedEvent: string;
static loadMoreItemsEvent: string;
static dataPopulatedEvent: string;
static knownFunctions: string[];
isBounceEnabled: boolean;
isScrollEnabled: boolean;
reverseLayout: boolean;
orientation: Orientation;
itemTemplate: string | Template;
itemTemplates: string | KeyedTemplate[];
isItemsSourceIn: boolean;
rowHeight: CoreTypes.PercentLengthType;
colWidth: CoreTypes.PercentLengthType;
verticalSpacing: CoreTypes.LengthType;
horizontalSpacing: CoreTypes.LengthType;
_innerWidth: number;
_innerHeight: number;
_effectiveRowHeight: number;
_effectiveColWidth: number;
loadMoreThreshold: number;
scrollOffset: number;
reorderEnabled: boolean;
reorderLongPressEnabled: boolean;
protected _dataUpdatesSuspended: boolean;
scrollBarIndicatorVisible: boolean;
layoutStyle: string;
plugins: string[];
static plugins: {
[k: string]: Plugin;
};
static registerPlugin(key: string, plugin: Plugin): void;
static layoutStyles: {
[k: string]: {
createLayout: Function;
createDelegate?: Function;
};
};
static registerLayoutStyle(style: string, generator: {
createLayout: Function;
createDelegate?: Function;
}): void;
protected _itemTemplatesInternal: Map<string, KeyedTemplate>;
protected _defaultTemplate: KeyedTemplate;
constructor();
abstract refresh(): any;
abstract refreshVisibleItems(): any;
abstract isItemAtIndexVisible(index: number): any;
abstract scrollToIndex(index: number, animated: boolean): any;
protected updateInnerSize(): void;
onLayout(left: number, top: number, right: number, bottom: number): void;
items: any[] | ItemsSource;
_prepareItem(item: View, index: number): any;
notifyLoading(args: any): void;
getItemAtIndex(index: number): any;
isHorizontal(): boolean;
computeSpanCount(): number;
_onRowHeightPropertyChanged(oldValue: CoreTypes.PercentLengthType, newValue: CoreTypes.PercentLengthType): void;
_onColWidthPropertyChanged(oldValue: CoreTypes.PercentLengthType, newValue: CoreTypes.PercentLengthType): void;
onItemViewLoaderChanged(): void;
_itemViewLoader: any;
get itemViewLoader(): any;
set itemViewLoader(value: any);
get padding(): string | CoreTypes.LengthType;
set padding(value: string | CoreTypes.LengthType);
get paddingTop(): CoreTypes.LengthType;
set paddingTop(value: CoreTypes.LengthType);
get paddingRight(): CoreTypes.LengthType;
set paddingRight(value: CoreTypes.LengthType);
get paddingBottom(): CoreTypes.LengthType;
set paddingBottom(value: CoreTypes.LengthType);
get paddingLeft(): CoreTypes.LengthType;
set paddingLeft(value: CoreTypes.LengthType);
resolveTemplateView(template: any): View;
_getDefaultItemContent(): Label;
getTemplateFromSelector(templateKey: any): KeyedTemplate;
getViewForViewType(viewType: ListViewViewTypes, templateKey: string): any;
private _itemTemplateSelectorBindable;
_itemTemplateSelector: Function;
onItemTemplateSelectorChanged(oldValue: any, newValue: any): void;
private _itemIdGeneratorBindable;
_itemIdGenerator: (item: any, index: number, items: any) => number;
onItemIdGeneratorChanged(oldValue: any, newValue: any): void;
onTemplateAdded(t: any): void;
onTemplateRemoved(key: any): void;
addTemplate(key: any, t: any): void;
removeTemplate(key: any): void;
onItemTemplatesChanged(oldValue: any, newValue: any): void;
onItemTemplateChanged(oldValue: any, newValue: any): void;
onItemTemplatesPropertyChanged(oldValue: any, newValue: any): void;
onItemTemplatePropertyChanged(oldValue: any, newValue: any): void;
onItemsChangedInternal: (oldValue: any, newValue: any) => void;
spanSize: (item: any, index: number) => number;
onSpanSizeChangedInternal: (oldValue: any, newValue: any) => void;
_isDataDirty: boolean;
onLoaded(): void;
onSourceCollectionChanged(event: ChangedData<any>): void;
onSourceCollectionChangedInternal(event: ChangedData<any>): void;
suspendUpdates(): void;
updatesSuspended(): boolean;
resumeUpdates(refresh: boolean): void;
abstract getViewForItemAtIndex(index: number): View;
abstract startDragging(index: number): any;
draggingView: View;
_callItemReorderedEvent(oldPosition: any, newPosition: any, item: any): void;
_reorderItemInSource(oldPosition: number, newPosition: number, callEvents?: boolean): void;
shouldMoveItemAtIndex(index: number): boolean;
}
export declare const rowHeightProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>;
export declare const colWidthProperty: Property<CollectionViewBase, CoreTypes.PercentLengthType>;
export declare const orientationProperty: Property<CollectionViewBase, Orientation>;
export declare const itemTemplateProperty: Property<CollectionViewBase, string | Template>;
export declare const itemTemplatesProperty: Property<CollectionViewBase, KeyedTemplate[]>;
export declare const itemTemplateSelectorProperty: Property<CollectionViewBase, Function>;
export declare const itemIdGeneratorProperty: Property<CollectionViewBase, Function>;
export declare const itemsProperty: Property<CollectionViewBase, Function>;
export declare const spanSizeProperty: Property<CollectionViewBase, Function>;
export declare const isScrollEnabledProperty: Property<CollectionViewBase, boolean>;
export declare const isBounceEnabledProperty: Property<CollectionViewBase, boolean>;
export declare const reverseLayoutProperty: Property<CollectionViewBase, boolean>;
export declare const loadMoreThresholdProperty: Property<CollectionViewBase, number>;
export declare const reorderingEnabledProperty: Property<CollectionViewBase, boolean>;
export declare const reorderLongPressEnabledProperty: Property<CollectionViewBase, boolean>;
export declare const scrollBarIndicatorVisibleProperty: Property<CollectionViewBase, boolean>;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
removeWeakEventListener,
widthProperty
} from '@nativescript/core';
import { CollectionView as CollectionViewDefinition, CollectionViewItemEventData, Orientation } from './collectionview';
import { CollectionView as CollectionViewDefinition, CollectionViewItemEventData, Orientation } from '.'

export const CollectionViewTraceCategory = 'NativescriptCollectionView';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import {
reorderingEnabledProperty,
reverseLayoutProperty,
scrollBarIndicatorVisibleProperty
} from './collectionview';
import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isScrollEnabledProperty, orientationProperty } from './collectionview-common';
} from '.';
import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isScrollEnabledProperty, orientationProperty } from './index-common';

export * from './collectionview-common';
export * from './index-common';

declare module '@nativescript/core/ui/core/view' {
interface View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventData, View } from '@nativescript/core';
import { Pointer } from '@nativescript/core/ui/gestures';
import { CollectionViewBase } from './collectionview-common';
export * from './collectionview-common';
import { CollectionViewBase } from './index-common';
export * from './index-common';

export type Orientation = 'horizontal' | 'vertical';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import {
} from '@nativescript/core';
import { Pointer } from '@nativescript/core/ui/gestures';
import { layout } from '@nativescript/core/utils/utils';
import { CollectionViewItemEventData, Orientation, reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from './collectionview';
import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isBounceEnabledProperty, isScrollEnabledProperty, itemTemplatesProperty, orientationProperty } from './collectionview-common';
import { CollectionViewItemEventData, Orientation, reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from '.';
import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isBounceEnabledProperty, isScrollEnabledProperty, itemTemplatesProperty, orientationProperty } from './index-common';

export * from './collectionview-common';
export * from './index-common';

const infinity = layout.makeMeasureSpec(0, layout.UNSPECIFIED);

Expand Down
4 changes: 2 additions & 2 deletions src/collectionview/react/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as React from 'react';
import { CoreTypes, ItemEventData, ItemsSource, KeyedTemplate, View } from '@nativescript/core';
import { NSVElement, NSVRoot, NativeScriptProps, render as RNSRender, ViewAttributes, registerElement, unmountComponentAtNode } from 'react-nativescript';
import { CollectionView as NativeScriptCollectionView } from '../collectionview';
import { CollectionView as NativeScriptCollectionView } from '..'

export type CellViewContainer = View;
type CellFactory = (item: any) => React.ReactElement;


export function registerCollectionView() {
registerElement('collectionView', () => require('../collectionview').CollectionView);
registerElement('collectionView', () => require('..').CollectionView);
}

interface CollectionViewAttributes extends ViewAttributes {
Expand Down
2 changes: 1 addition & 1 deletion src/collectionview/svelte/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { profile } from '@nativescript/core/profiling';
import { ContentView, LayoutBase, StackLayout, ViewBase } from '@nativescript/core/ui';
import { NativeViewElementNode, TemplateElement, ViewNode, createElement, registerElement } from 'svelte-native/dom';
import { flush } from 'svelte/internal';
import { CollectionView } from '../collectionview';
import { CollectionView } from '..'

declare module '@nativescript/core/ui/core/view-base' {
interface ViewBase {
Expand Down
2 changes: 1 addition & 1 deletion src/collectionview/vue/component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { profile } from '@nativescript/core';
import { Observable } from '@nativescript/core/data/observable';
import { ObservableArray } from '@nativescript/core/data/observable-array';
import { CollectionView } from '../collectionview';
import { CollectionView } from '..'

function extend(to, _from): any {
for (const key in _from) {
Expand Down
2 changes: 1 addition & 1 deletion src/collectionview/vue/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CollectionView } from '../collectionview';
import { CollectionView } from '..'

const CollectionViewPlugin = {
install(Vue, options) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CollectionView } from '@nativescript-community/ui-collectionview';

export default function install() {
CollectionView.registerLayoutStyle('waterfall', {
createLayout: (collectionview: CollectionView) => new androidx.recyclerview.widget.StaggeredGridLayoutManager(1, 1),
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 40ecec7

Please sign in to comment.