meteor-bootstrap_key-value-tag-input
Advanced tools
Comparing version 3.3.3 to 3.4.0
@@ -336,2 +336,4 @@ 'use strict'; | ||
entries.push(newEntry); | ||
var event = new CustomEvent("keyValueEntryAdded", { detail: newEntry }); | ||
emitEvent(event, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -371,2 +373,4 @@ return true; | ||
if (lastEntry) { | ||
var event_1 = new CustomEvent("keyValueEntryRemoved", { detail: lastEntry }); | ||
emitEvent(event_1, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -383,13 +387,18 @@ var editValue = (_a = lastEntry.editText, (_a !== null && _a !== void 0 ? _a : "")); | ||
templateInstance.entries.set(filtered); | ||
var event = new CustomEvent("keyValueEntryRemoved", { detail: entry }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function removeAllEntries(templateInstance) { | ||
var entries = templateInstance.entries.get(); | ||
templateInstance.entries.set([]); | ||
resetPartialEntry(templateInstance); | ||
templateInstance.textInput.val(""); | ||
var event = new CustomEvent("keyValueEntriesRemoved", { detail: entries }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitChange(templateInstance) { | ||
if (!tracker.Tracker.inFlush()) { | ||
tracker.Tracker.flush(); | ||
} | ||
var event = new CustomEvent("keyValueEntriesChanged", { detail: templateInstance.entries.get() }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitEvent(event, templateInstance) { | ||
tracker.Tracker.afterFlush(function () { | ||
@@ -396,0 +405,0 @@ window.setTimeout(function () { var _a; return (_a = templateInstance.element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event); }, 100); // make sure keyValueInput stays responsive; apply changes a little later |
{ | ||
"name": "meteor-bootstrap_key-value-tag-input", | ||
"version": "3.3.3", | ||
"version": "3.4.0", | ||
"description": "A reactive input field for tags and key-value data, developed for meteor apps running bootstrap.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -45,2 +45,11 @@ # Key Value Tag Input for Meteor and Bootstrap 4 | ||
}, | ||
"keyValueEntryAdded .filterInput"(event) { | ||
// event.detail will contain added key value entry. | ||
}, | ||
"keyValueEntryRemoved .filterInput"(event) { | ||
// event.detail will contain removed key value entry. | ||
}, | ||
"keyValueEntriesRemoved .filterInput"(event) { | ||
// event.detail will contain all removed key value entries. | ||
}, | ||
}); | ||
@@ -47,0 +56,0 @@ ``` |
@@ -317,2 +317,4 @@ import { ReactiveVar } from "meteor/reactive-var"; | ||
entries.push(newEntry); | ||
var event = new CustomEvent("keyValueEntryAdded", { detail: newEntry }); | ||
emitEvent(event, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -352,2 +354,4 @@ return true; | ||
if (lastEntry) { | ||
var event_1 = new CustomEvent("keyValueEntryRemoved", { detail: lastEntry }); | ||
emitEvent(event_1, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -364,13 +368,18 @@ var editValue = (_a = lastEntry.editText, (_a !== null && _a !== void 0 ? _a : "")); | ||
templateInstance.entries.set(filtered); | ||
var event = new CustomEvent("keyValueEntryRemoved", { detail: entry }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function removeAllEntries(templateInstance) { | ||
var entries = templateInstance.entries.get(); | ||
templateInstance.entries.set([]); | ||
resetPartialEntry(templateInstance); | ||
templateInstance.textInput.val(""); | ||
var event = new CustomEvent("keyValueEntriesRemoved", { detail: entries }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitChange(templateInstance) { | ||
if (!Tracker.inFlush()) { | ||
Tracker.flush(); | ||
} | ||
var event = new CustomEvent("keyValueEntriesChanged", { detail: templateInstance.entries.get() }); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitEvent(event, templateInstance) { | ||
Tracker.afterFlush(function () { | ||
@@ -377,0 +386,0 @@ window.setTimeout(function () { var _a; return (_a = templateInstance.element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event); }, 100); // make sure keyValueInput stays responsive; apply changes a little later |
@@ -13,3 +13,3 @@ import { Blaze } from "meteor/blaze"; | ||
import { | ||
KeyValueEntriesChangedEvent, | ||
KeyValueEntriesChangedEvent, KeyValueEntriesRemovedEvent, KeyValueEntryAddedEvent, KeyValueEntryRemovedEvent, | ||
KeyValueInputMultipleTypesData, | ||
@@ -356,2 +356,7 @@ KeyValueInputTemplateData, | ||
const event: KeyValueEntryAddedEvent = new CustomEvent( | ||
"keyValueEntryAdded", | ||
{ detail: newEntry }, | ||
); | ||
emitEvent(event, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -398,2 +403,7 @@ return true; | ||
if (lastEntry) { | ||
const event: KeyValueEntryRemovedEvent = new CustomEvent( | ||
"keyValueEntryRemoved", | ||
{ detail: lastEntry }, | ||
); | ||
emitEvent(event, templateInstance); | ||
templateInstance.entries.dep.changed(); | ||
@@ -413,12 +423,22 @@ | ||
templateInstance.entries.set(filtered); | ||
const event: KeyValueEntryRemovedEvent = new CustomEvent( | ||
"keyValueEntryRemoved", | ||
{ detail: entry }, | ||
); | ||
emitEvent(event, templateInstance); | ||
} | ||
function removeAllEntries(templateInstance: KeyValueInputTemplate) { | ||
const entries = templateInstance.entries.get(); | ||
templateInstance.entries.set([]); | ||
resetPartialEntry(templateInstance); | ||
templateInstance.textInput.val(""); | ||
const event: KeyValueEntriesRemovedEvent = new CustomEvent( | ||
"keyValueEntriesRemoved", | ||
{ detail: entries }, | ||
); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitChange(templateInstance: KeyValueInputTemplate) { | ||
if (!Tracker.inFlush()) { Tracker.flush(); } | ||
const event: KeyValueEntriesChangedEvent = new CustomEvent( | ||
@@ -428,2 +448,6 @@ "keyValueEntriesChanged", | ||
); | ||
emitEvent(event, templateInstance); | ||
} | ||
function emitEvent(event: CustomEvent, templateInstance: KeyValueInputTemplate) { | ||
Tracker.afterFlush(() => { | ||
@@ -430,0 +454,0 @@ window.setTimeout( |
@@ -25,3 +25,12 @@ import { KeyValueEntry, KeyValueEntryConstructionData, KeyValueType } from "../keyValueTypes"; | ||
} | ||
export interface KeyValueEntriesRemovedEvent<T = any> extends CustomEvent<Array<KeyValueEntry<T>>> { | ||
detail: Array<KeyValueEntry<T>>; | ||
} | ||
export interface KeyValueEntryRemovedEvent<T = any> extends CustomEvent<KeyValueEntry<T>> { | ||
detail: KeyValueEntry<T>; | ||
} | ||
export interface KeyValueEntryAddedEvent<T = any> extends CustomEvent<KeyValueEntry<T>> { | ||
detail: KeyValueEntry<T>; | ||
} | ||
export declare function clearEntries(keyValueInput: HTMLElement): void; | ||
export {}; |
@@ -30,4 +30,16 @@ import { KeyValueEntry, KeyValueEntryConstructionData, KeyValueType } from "../keyValueTypes"; | ||
export interface KeyValueEntriesRemovedEvent<T = any> extends CustomEvent<Array<KeyValueEntry<T>>> { | ||
detail: Array<KeyValueEntry<T>>; | ||
} | ||
export interface KeyValueEntryRemovedEvent<T = any> extends CustomEvent<KeyValueEntry<T>> { | ||
detail: KeyValueEntry<T>; | ||
} | ||
export interface KeyValueEntryAddedEvent<T = any> extends CustomEvent<KeyValueEntry<T>> { | ||
detail: KeyValueEntry<T>; | ||
} | ||
export function clearEntries(keyValueInput: HTMLElement) { | ||
keyValueInput.dispatchEvent(new CustomEvent("clearEntries")); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
224234
4778
151