How to use the vue-property-decorator.Emit function in vue-property-decorator

To help you get started, we’ve selected a few vue-property-decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ulaval / modul-components / src / components / transitions / slide-transition / slide-transition.ts View on Github external
@Prop({ default: 0 })
    public scrollToOffset: number; // the offset to add (in case of a sticky header)

    @Prop({ default: true })
    public disabled: boolean;

    public get transitionName(): string | undefined {
        return !this.disabled ? 'm--is' : undefined;
    }

    public get isLeftToRight(): boolean {
        return this.direction === MSlideTransitionDirection.LeftToRight;
    }

    @Emit('enter')
    private transitionEnter(el: HTMLElement, done): void {
        if (!this.disabled) {
            this.$scrollTo.goTo(this.$el as HTMLElement, this.scrollToOffset, ScrollToDuration.Regular);
            setTimeout(() => {
                this.transitionBeforeLeave(el);
            }, 100);
        } else {
            done();
        }
    }

    private transitionAfterEnter(): void {
        (this.$el as HTMLElement).style.removeProperty('height');
        (this.$el as HTMLElement).style.removeProperty('overflow');
    }
github ulaval / modul-components / src / components / popup / popup.ts View on Github external
public get popupBody(): Element {
        return (this.$children[0] as any).popupBody;
    }

    private get propOpen(): boolean {
        return this.open === undefined ? this.internalOpen : this.open;
    }

    private set propOpen(value: boolean) {
        if (!this.disabled) {
            this.internalOpen = value;
            this.$emit('update:open', value);
        }
    }

    @Emit('open')
    private onOpen(): void { }

    @Emit('close')
    private onClose(): void { }

    public get propOpenTrigger(): MOpenTrigger {
        return this.openTrigger; // todo: mobile + hover ??
    }

    public get propTrigger(): HTMLElement {
        return this.trigger || this.as().triggerHook || undefined;
    }

    private onPortalMounted(): void {
        this.$emit('portal-mounted');
    }
github yanghuayi / vue-ts-admin / src / components / FilterTable / MFilter.tsx View on Github external
this.tableList.map((item) => {
        if (item.dataIndex) {
          this.checkList.push(item.dataIndex);
        }
        return false;
      });
    }
  }

  // methods
  @Emit()
  onSearch(): void {
    this.$emit('search', Object.assign(this.params, this.Form.getFieldsValue()));
  }

  @Emit()
  reset(): void {
    this.Form.resetFields();
    this.$emit('clearOut');
    this.params = JSON.parse(JSON.stringify(this.initParams));
    this.$emit('search', this.Form.resetFields());
  }

  @Emit()
  levelcodeChange(val: any, key: string): void {
    const value = JSON.parse(JSON.stringify(val));
    this.params.levelCode = value.pop();
  }

  @Emit()
  openSetting(): void {
    this.setModel = true;
github ulaval / modul-components / src / components / repeater / repeater.ts View on Github external
default: 0
    })
    minItemCount: number;

    @Prop({
        default: Infinity
    })
    maxItemCount: number;

    mounted(): void {
        if (!this.$scopedSlots.row && !this.$scopedSlots.item) {
            throw new Error('MRepeater requires content to be provided through row or item slot.');
        }
    }

    @Emit('add')
    onAddBtnClick(): void { }

    @Emit('delete')
    onDeleteBtnClick(index: number): void { }

    getRowProps(item: MRepeaterItem, index: number): MRepeaterRowProps {
        return {
            ...this.getItemProps(item, index),
            canDelete: this.canDelete
        };
    }

    getRowListeners(item: MRepeaterItem, index: number): MRepeaterRowListeners {
        return {
            onDelete: () => this.onDeleteBtnClick(index)
        };
github ulaval / modul-components / src / components / tree / tree-node / tree-node.ts View on Github external
};

    private selectedChildrenCount: number = 0;

    @Watch('isSelected')
    public notifyParentOfChildCheckboxState(): void {
        if (this.withCheckboxes) {
            if (!this.hasChildren || this.isParentAutoSelect) {
                this.$emit('auto-select-child-checkbox-change', this.isSelected);
            } else if (this.isButtonAutoSelect && this.hasChildren) {
                this.onAutoSelectChildCheckboxChange(this.isSelected, true);
            }
        }
    }

    @Emit('click')
    public emitClick(path: string): string {
        return path;
    }

    protected mounted(): void {
        this.internalOpen = this.open || this.isParentOfOpenedFolder() || this.isParentOfSelectedFile;
        if (this.isSelected) {
            this.notifyParentOfChildCheckboxState();
        }
    }

    public onClick(): void {
        if (this.isFolder) {
            this.internalOpen = !this.internalOpen;
            this.$emit('update:open', this.internalOpen);
        } else if (this.selectable) {
github ulaval / modul-components / src / components / calendar / calendar-renderer / abstract-calendar-renderer.ts View on Github external
onMonthNext(event: Event): void {
    }

    @Emit(CalendarEvent.MONTH_PREVIOUS)
    onMonthPrevious(event: Event): void {
    }

    @Emit(CalendarEvent.YEAR_SELECT)
    onYearSelect(year: YearState): void {
    }

    @Emit(CalendarEvent.YEAR_MONTH_SELECT)
    onYearMonthSelect(year: YearState, month: MonthState): void {
    }

    @Emit(CalendarEvent.YEAR_NEXT)
    onYearNext(event: Event): void {
    }

    @Emit(CalendarEvent.YEAR_PREVIOUS)
    onYearPrevious(event: Event): void {
    }
}
github gamejolt / frontend-lib / components / community / join-widget / join-widget.ts View on Github external
@Prop(String)
	eventLabel?: string;

	@State
	app!: AppStore;

	@State
	grid!: GridClient;

	isProcessing = false;

	@Emit('join')
	join(_community: Community) {}

	@Emit('leave')
	leave(_community: Community) {}

	get badge() {
		return !this.hideCount && this.community.member_count
			? number(this.community.member_count)
			: '';
	}

	get tooltipContainer() {
		return findTooltipContainer(this);
	}

	async onClick() {
		if (!this.app.user || this.isProcessing) {
			return;
		}
github gamejolt / frontend-lib / components / popper / popper.ts View on Github external
}
	}

	@Emit('hide')
	private hideDone() {
		this.isVisible = false;
	}

	private clearHideTimeout() {
		if (this.hideTimeout) {
			clearTimeout(this.hideTimeout);
			this.hideTimeout = undefined;
		}
	}

	@Emit('auto-hide')
	private onAutoHide() {}
}
github ulaval / modul-components / src / components / flag / flag.ts View on Github external
import { FLAG_NAME } from '../component-names';
import WithRender from './flag.html?style=./flag.scss';

@WithRender
@Component
export class MFlag extends ModulVue {
    @Prop({ required: true })
    public iso: string;
    @Prop()
    public title: string;
    @Prop({ default: '20px' })
    public size: string;
    @Prop({ default: false })
    public squared: boolean;

    @Emit('click')
    onClick(event: Event): void { }

    @Emit('keydown')
    onKeydown(event: Event): void { }

    private get hasTitle(): boolean {
        return !!this.title;
    }

    private get height(): string {
        return this.size;
    }

    private get width(): string {
        return ((parseInt(this.size, 10) * 4) / 3) + 'px';
    }
github fe6 / water / src / components / inputnumber / src / InputNumber.vue View on Github external
@Emit('change')
    setValue(val: number | string): ReturnParamsEntity {
      this.setNumber(val);

      const reParams: ReturnParamsEntity = {
        value: this.number,
        original: this.originalNumber,
      };

      this.returnModal();
      (this.change as Function)(reParams);

      return reParams;
    }

    @Emit('model')
    returnModal(): number | string {
      return this.number;
    }

    changeValue(ev: MouseEvent) {
      this.setValue((this.parser as Function)(getValueFromEvent(ev)));
    }

    focusFn() {
      this.write = !this.readonly;
    }

    blurFn(ev: MouseEvent) {
      let value = (this.parser as Function)(getValueFromEvent(ev));
      if (value >= this.max) {
        value = this.max;