@ldmjs/ui 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -5
- package/dist/index.js +67 -2
- package/dist/types/eventBus.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Vue } from 'vue-class-component';
|
|
2
|
+
import { IEventBus } from './types/eventBus';
|
|
2
3
|
import { ldmuiOptions } from './types/options';
|
|
3
4
|
import { IToasted } from './types/toasted';
|
|
4
5
|
import { IInput, IWatcher } from './types/validation';
|
|
@@ -44,9 +45,8 @@ declare class ValidateMixin extends Vue {
|
|
|
44
45
|
validateSection: (section: number | string) => boolean;
|
|
45
46
|
customValidateFunc: () => string | boolean;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
declare const eventBus: IEventBus;
|
|
48
49
|
declare const ValidateMixinOptions: Record<string, any>;
|
|
49
|
-
|
|
50
50
|
declare const ldmui: {
|
|
51
51
|
install(vue: any, options?: ldmuiOptions): void;
|
|
52
52
|
}
|
|
@@ -54,8 +54,7 @@ declare const ldmui: {
|
|
|
54
54
|
export default ldmui;
|
|
55
55
|
|
|
56
56
|
export {
|
|
57
|
-
ValidateMixin,
|
|
58
|
-
|
|
59
|
-
isDefined, isObjectEmpty, uidGen, urlRegexp
|
|
57
|
+
ValidateMixin, ValidateMixinOptions, datetime, deepValueGetter, defaults, delay, getAliases,
|
|
58
|
+
isDefined, isObjectEmpty, uidGen, urlRegexp, eventBus
|
|
60
59
|
};
|
|
61
60
|
|
package/dist/index.js
CHANGED
|
@@ -226,6 +226,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
226
226
|
"default": () => (/* binding */ src),
|
|
227
227
|
defaults: () => (/* reexport */ defaults),
|
|
228
228
|
delay: () => (/* reexport */ delay),
|
|
229
|
+
eventBus: () => (/* reexport */ eventBus),
|
|
229
230
|
getAliases: () => (/* reexport */ getAliases),
|
|
230
231
|
isDefined: () => (/* reexport */ isDefined),
|
|
231
232
|
isObjectEmpty: () => (/* reexport */ isObjectEmpty),
|
|
@@ -9189,9 +9190,9 @@ function getNative(object, key) {
|
|
|
9189
9190
|
|
|
9190
9191
|
|
|
9191
9192
|
/* Built-in method references that are verified to be native. */
|
|
9192
|
-
var
|
|
9193
|
+
var _Map_Map = _getNative(_root, 'Map');
|
|
9193
9194
|
|
|
9194
|
-
/* harmony default export */ const _Map = (
|
|
9195
|
+
/* harmony default export */ const _Map = (_Map_Map);
|
|
9195
9196
|
|
|
9196
9197
|
;// CONCATENATED MODULE: ./node_modules/lodash-es/_nativeCreate.js
|
|
9197
9198
|
|
|
@@ -15171,6 +15172,69 @@ validate_mixin_decorate([
|
|
|
15171
15172
|
], ValidateMixin.prototype, "onErrorBagChanged", null);
|
|
15172
15173
|
const ValidateMixinOptions = mixin;
|
|
15173
15174
|
|
|
15175
|
+
;// CONCATENATED MODULE: ./src/eventBus.ts
|
|
15176
|
+
class EventBus {
|
|
15177
|
+
constructor() {
|
|
15178
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15179
|
+
this.listeners = {};
|
|
15180
|
+
this.once = [];
|
|
15181
|
+
}
|
|
15182
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15183
|
+
$on(eventName, callback) {
|
|
15184
|
+
if (eventName in this.listeners) {
|
|
15185
|
+
this.listeners[eventName].push(callback);
|
|
15186
|
+
}
|
|
15187
|
+
else {
|
|
15188
|
+
this.listeners[eventName] = [];
|
|
15189
|
+
this.listeners[eventName].push(callback);
|
|
15190
|
+
}
|
|
15191
|
+
}
|
|
15192
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15193
|
+
$once(eventName, callback) {
|
|
15194
|
+
this.$on(eventName, callback);
|
|
15195
|
+
this.once.push(eventName);
|
|
15196
|
+
}
|
|
15197
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15198
|
+
$off(eventName, callback) {
|
|
15199
|
+
const map = new Map();
|
|
15200
|
+
if (eventName in this.listeners) {
|
|
15201
|
+
this.listeners[eventName].forEach((listener, index) => {
|
|
15202
|
+
map.set(listener, index);
|
|
15203
|
+
});
|
|
15204
|
+
const index = map.get(callback);
|
|
15205
|
+
/* eslint-disable-next-line no-undefined */
|
|
15206
|
+
if (index !== undefined) {
|
|
15207
|
+
this.listeners[eventName].splice(index, 1);
|
|
15208
|
+
if (this.listeners[eventName]?.length === 0) {
|
|
15209
|
+
delete this.listeners[eventName];
|
|
15210
|
+
}
|
|
15211
|
+
}
|
|
15212
|
+
}
|
|
15213
|
+
}
|
|
15214
|
+
$flush() {
|
|
15215
|
+
for (const key in this.listeners) {
|
|
15216
|
+
this.listeners[key] = [];
|
|
15217
|
+
}
|
|
15218
|
+
this.listeners = {};
|
|
15219
|
+
}
|
|
15220
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15221
|
+
$emit(eventName, ...args) {
|
|
15222
|
+
if (eventName in this.listeners) {
|
|
15223
|
+
this.listeners[eventName].forEach(listener => {
|
|
15224
|
+
Function.prototype.apply.call(listener, this, args);
|
|
15225
|
+
if (this.once.includes(eventName)) {
|
|
15226
|
+
this.$off(eventName, listener);
|
|
15227
|
+
this.once = this.once.filter(evName => evName !== eventName);
|
|
15228
|
+
}
|
|
15229
|
+
});
|
|
15230
|
+
}
|
|
15231
|
+
}
|
|
15232
|
+
$has(eventName) {
|
|
15233
|
+
return Boolean(eventName in this.listeners && this.listeners[eventName]);
|
|
15234
|
+
}
|
|
15235
|
+
}
|
|
15236
|
+
const eventBus = new EventBus();
|
|
15237
|
+
|
|
15174
15238
|
;// CONCATENATED MODULE: ./src/vuetify.ts
|
|
15175
15239
|
const aliases = {
|
|
15176
15240
|
SmallButton: 'VBtn',
|
|
@@ -15260,6 +15324,7 @@ const ActiveDirectiveOptions = {
|
|
|
15260
15324
|
|
|
15261
15325
|
|
|
15262
15326
|
|
|
15327
|
+
|
|
15263
15328
|
|
|
15264
15329
|
|
|
15265
15330
|
const ldmuiPlugin = {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface IEventBus {
|
|
2
|
+
$on: (eventName: string, callback: (...args: any) => any) => void;
|
|
3
|
+
$once: (eventName: string, callback: (...args: any) => any) => void;
|
|
4
|
+
$off: (eventName: string, callback: (...args: any) => any) => void;
|
|
5
|
+
$emit: (eventName: string, ...args: any) => void;
|
|
6
|
+
$flush: () => void;
|
|
7
|
+
$has: (eventName: string) => boolean;
|
|
8
|
+
}
|