angular - import file from ionic2-calendar directly into ionic page to use a method -
i trying import part of ionic2-calendar (or whole thing) directly ionic
page. d.ts
file trying import looks this:
...npm_modules/ionic2-calendar/monthview.d.ts:
import { oninit, onchanges, eventemitter, simplechanges, templateref } '@angular/core'; import { slides } 'ionic-angular'; import { icalendarcomponent, ievent, imonthview, imonthviewrow, itimeselected, irange, calendarmode, idateformatter } './calendar'; import { calendarservice } './calendar.service'; import { imonthviewdisplayeventtemplatecontext } "./calendar"; export declare class monthviewcomponent implements icalendarcomponent, oninit, onchanges { private calendarservice; slider: slides; monthviewdisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthviewinactivedisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthvieweventdetailtemplate: templateref<imonthviewdisplayeventtemplatecontext>; formatday: string; formatdayheader: string; formatmonthtitle: string; eventsource: ievent[]; startingdaymonth: number; showeventdetail: boolean; noeventslabel: string; autoselect: boolean; markdisabled: (date: date) => boolean; locale: string; dateformatter: idateformatter; dir: string; lockswipetoprev: boolean; lockswipes: boolean; onrangechanged: eventemitter<irange>; oneventselected: eventemitter<ievent>; ontimeselected: eventemitter<itimeselected>; ontitlechanged: eventemitter<string>; views: imonthview[]; currentviewindex: number; selecteddate: imonthviewrow; range: irange; mode: calendarmode; direction: number; private moveonselected; private inited; private callbackoninit; private currentdatechangedfromparentsubscription; private eventsourcechangedsubscription; private formatdaylabel; private formatdayheaderlabel; private formattitle; constructor(calendarservice: calendarservice); ngoninit(): void; ngondestroy(): void; ngonchanges(changes: simplechanges): void; ngafterviewinit(): void; onslidechanged(): void; move(direction: number): void; createdateobject(date: date): imonthviewrow; static getdates(startdate: date, n: number): date[]; getviewdata(starttime: date): imonthview; gethighlightclass(date: imonthviewrow): string; getrange(currentdate: date): irange; ondataloaded(): void; refreshview(): void; gettitle(): string; private compareevent(event1, event2); select(viewdate: imonthviewrow): void; slideview(direction: number): void; updatecurrentview(currentviewstartdate: date, view: imonthview): void; eventselected(event: ievent): void; }
in page import this:
import { monthviewcomponent } 'ionic2-calendar/monthview';
then output monthviewcomponent
see looks like:
console.log(json.stringify(monthviewcomponent));
it outputs:
undefined
i doing use method, part of monthviewcomponent
, in page. have tried importing ngcalendarmodule
main module ionic2-calendar
, outputs undefined
. how use method monthviewcomponent
module inside page?
i tried adding typings.json
module, , ran typings install
, created index.d.ts file of monthviewcomponent
contents, still returns undefined:
typings.json
{ "globaldependencies": { "jic": "file:./src/assets/jic.d.ts", }, "dependencies": { "debug": "registry:npm/debug#2.0.0+20170504163145", "monthviewcomponent": "file:./node_modules/ionic2-calendar/monthview.d.ts" } }
it created typings/modules/monthviewcomponent/index.d.ts
// generated typings // source: node_modules/ionic2-calendar/calendar.d.ts declare module '~monthviewcomponent/calendar' { import { eventemitter, oninit, templateref } '@angular/core'; import { calendarservice } '~monthviewcomponent/calendar.service'; export interface ievent { allday: boolean; endtime: date; starttime: date; title: string; } export interface irange { starttime: date; endtime: date; } export interface iview { } export interface idayview extends iview { alldayevents: idisplayalldayevent[]; rows: idayviewrow[]; } export interface idayviewrow { events: idisplayevent[]; time: date; } export interface imonthview extends iview { dates: imonthviewrow[]; dayheaders: string[]; } export interface imonthviewrow { current?: boolean; date: date; events: ievent[]; hasevent?: boolean; label: string; secondary: boolean; selected?: boolean; disabled: boolean; } export interface iweekview extends iview { dates: iweekviewdaterow[]; rows: iweekviewrow[][]; dayheaders: string[]; } export interface iweekviewdaterow { date: date; events: idisplayevent[]; } export interface iweekviewrow { events: idisplayevent[]; time: date; } export interface idisplayevent { endindex: number; endoffset?: number; event: ievent; startindex: number; startoffset?: number; overlapnumber?: number; position?: number; } export interface idisplayalldayevent { event: ievent; } export interface icalendarcomponent { currentviewindex: number; direction: number; eventsource: ievent[]; getrange: { (date: date): irange; }; getviewdata: { (date: date): iview; }; mode: calendarmode; range: irange; views: iview[]; ondataloaded: { (): void; }; onrangechanged: eventemitter<irange>; } export interface itimeselected { events: ievent[]; selectedtime: date; disabled: boolean; } export interface imonthviewdisplayeventtemplatecontext { view: iview; row: number; col: number; } export interface imonthvieweventdetailtemplatecontext { selecteddate: itimeselected; noeventslabel: string; } export interface idateformatter { formatmonthviewday?: { (date: date): string; }; formatmonthviewdayheader?: { (date: date): string; }; formatmonthviewtitle?: { (date: date): string; }; formatweekviewdayheader?: { (date: date): string; }; formatweekviewtitle?: { (date: date): string; }; formatweekviewhourcolumn?: { (date: date): string; }; formatdayviewtitle?: { (date: date): string; }; formatdayviewhourcolumn?: { (date: date): string; }; } export type calendarmode = 'day' | 'month' | 'week'; export type querymode = 'local' | 'remote'; export enum step { quarterhour = 15, halfhour = 30, hour = 60, } export class calendarcomponent implements oninit { private calendarservice; private locale; currentdate: date; eventsource: ievent[]; calendarmode: calendarmode; formatday: string; formatdayheader: string; formatdaytitle: string; formatweektitle: string; formatmonthtitle: string; formatweekviewdayheader: string; formathourcolumn: string; showeventdetail: boolean; startingdaymonth: number; startingdayweek: number; alldaylabel: string; noeventslabel: string; querymode: querymode; step: step; autoselect: boolean; markdisabled: (date: date) => boolean; monthviewdisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthviewinactivedisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthvieweventdetailtemplate: templateref<imonthvieweventdetailtemplatecontext>; weekviewalldayeventtemplate: templateref<idisplayalldayevent>; weekviewnormaleventtemplate: templateref<idisplayevent>; dayviewalldayeventtemplate: templateref<idisplayalldayevent>; dayviewnormaleventtemplate: templateref<idisplayevent>; dateformatter: idateformatter; dir: string; scrolltohour: number; preservescrollposition: boolean; lockswipetoprev: boolean; lockswipes: boolean; oncurrentdatechanged: eventemitter<date>; onrangechanged: eventemitter<irange>; oneventselected: eventemitter<ievent>; ontimeselected: eventemitter<itimeselected>; ontitlechanged: eventemitter<string>; private _currentdate; private hourparts; private currentdatechangedfromchildrensubscription; constructor(calendarservice: calendarservice, locale: string); ngoninit(): void; ngondestroy(): void; rangechanged(range: irange): void; eventselected(event: ievent): void; timeselected(timeselected: itimeselected): void; titlechanged(title: string): void; loadevents(): void; } } declare module 'monthviewcomponent/calendar' { export * '~monthviewcomponent/calendar'; } // generated typings // source: node_modules/ionic2-calendar/calendar.service.d.ts declare module '~monthviewcomponent/calendar.service' { import { observable } 'rxjs/observable'; import { icalendarcomponent, calendarmode, querymode } '~monthviewcomponent/calendar'; export class calendarservice { querymode: querymode; currentdatechangedfromparent$: observable<date>; currentdatechangedfromchildren$: observable<date>; eventsourcechanged$: observable<void>; private _currentdate; private currentdatechangedfromparent; private currentdatechangedfromchildren; private eventsourcechanged; constructor(); setcurrentdate(val: date, fromparent?: boolean): void; readonly currentdate: date; rangechanged(component: icalendarcomponent): void; private getstep(mode); getadjacentcalendardate(mode: calendarmode, direction: number): date; getadjacentviewstarttime(component: icalendarcomponent, direction: number): date; populateadjacentviews(component: icalendarcomponent): void; loadevents(): void; } } declare module 'monthviewcomponent/calendar.service' { export * '~monthviewcomponent/calendar.service'; } // generated typings // source: node_modules/ionic2-calendar/monthview.d.ts declare module '~monthviewcomponent/monthview' { import { oninit, onchanges, eventemitter, simplechanges, templateref } '@angular/core'; import { slides } 'ionic-angular'; import { icalendarcomponent, ievent, imonthview, imonthviewrow, itimeselected, irange, calendarmode, idateformatter } '~monthviewcomponent/calendar'; import { calendarservice } '~monthviewcomponent/calendar.service'; import { imonthviewdisplayeventtemplatecontext } '~monthviewcomponent/calendar'; export class monthviewcomponent implements icalendarcomponent, oninit, onchanges { private calendarservice; slider: slides; monthviewdisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthviewinactivedisplayeventtemplate: templateref<imonthviewdisplayeventtemplatecontext>; monthvieweventdetailtemplate: templateref<imonthviewdisplayeventtemplatecontext>; formatday: string; formatdayheader: string; formatmonthtitle: string; eventsource: ievent[]; startingdaymonth: number; showeventdetail: boolean; noeventslabel: string; autoselect: boolean; markdisabled: (date: date) => boolean; locale: string; dateformatter: idateformatter; dir: string; lockswipetoprev: boolean; lockswipes: boolean; onrangechanged: eventemitter<irange>; oneventselected: eventemitter<ievent>; ontimeselected: eventemitter<itimeselected>; ontitlechanged: eventemitter<string>; views: imonthview[]; currentviewindex: number; selecteddate: imonthviewrow; range: irange; mode: calendarmode; direction: number; private moveonselected; private inited; private callbackoninit; private currentdatechangedfromparentsubscription; private eventsourcechangedsubscription; private formatdaylabel; private formatdayheaderlabel; private formattitle; constructor(calendarservice: calendarservice); ngoninit(): void; ngondestroy(): void; ngonchanges(changes: simplechanges): void; ngafterviewinit(): void; onslidechanged(): void; move(direction: number): void; createdateobject(date: date): imonthviewrow; static getdates(startdate: date, n: number): date[]; getviewdata(starttime: date): imonthview; gethighlightclass(date: imonthviewrow): string; getrange(currentdate: date): irange; ondataloaded(): void; refreshview(): void; gettitle(): string; private compareevent(event1, event2); select(viewdate: imonthviewrow): void; slideview(direction: number): void; updatecurrentview(currentviewstartdate: date, view: imonthview): void; eventselected(event: ievent): void; } } declare module 'monthviewcomponent/monthview' { export * '~monthviewcomponent/monthview'; } declare module 'monthviewcomponent' { export * '~monthviewcomponent/monthview'; }
what else need tell ionic/angular2 link this? thanks
Comments
Post a Comment