native-document 1.0.134 → 1.0.135
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/native-document.components.min.js +98 -83
- package/package.json +1 -1
- package/src/components/BaseComponent.js +10 -1
- package/src/components/accordion/Accordion.js +2 -2
- package/src/components/alert/Alert.js +2 -2
- package/src/components/breadcrumb/BreadCrumb.js +2 -2
- package/src/components/dropdown/Dropdown.js +2 -2
- package/src/components/form/FormControl.js +3 -3
- package/src/components/layouts/HStack.js +1 -1
- package/src/components/layouts/Stack.js +1 -0
- package/src/components/layouts/VStack.js +1 -1
- package/src/components/list/List.js +3 -2
- package/src/components/list/ListGroup.js +2 -1
- package/src/components/menu/Menu.js +3 -2
- package/src/components/menu/MenuGroup.js +2 -1
- package/src/components/menu/MenuItem.js +2 -1
- package/src/components/modal/Modal.js +2 -2
- package/src/components/pagination/Pagination.js +2 -2
- package/src/components/popover/Popover.js +2 -2
- package/src/components/progress/Progress.js +2 -2
- package/src/components/slider/Slider.js +2 -2
- package/src/components/splitter/Splitter.js +2 -2
- package/src/components/stepper/Stepper.js +2 -2
- package/src/components/switch/Switch.js +2 -2
- package/src/components/tabs/Tabs.js +2 -2
- package/src/components/toast/Toast.js +2 -2
- package/src/core/utils/{EventEmitter.js → HasEventEmitter.js} +5 -6
|
@@ -21,7 +21,8 @@ var NativeComponents = (function (exports) {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
BaseComponent.extends = function(Component, ...parents) {
|
|
24
|
-
|
|
24
|
+
const MainParent = parents[0] || BaseComponent;
|
|
25
|
+
Component.prototype = Object.create(MainParent.prototype);
|
|
25
26
|
|
|
26
27
|
if(parents.length > 0) {
|
|
27
28
|
for(const parent of parents) {
|
|
@@ -31,6 +32,14 @@ var NativeComponents = (function (exports) {
|
|
|
31
32
|
Component.prototype.constructor = Component;
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
BaseComponent.use = function(Component, ...traits) {
|
|
36
|
+
if(traits.length > 0) {
|
|
37
|
+
for(const trait of traits) {
|
|
38
|
+
Object.assign(Component.prototype, trait.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
34
43
|
BaseComponent.obs = (value) => {
|
|
35
44
|
return value.__$Observable ? value : Observable(value);
|
|
36
45
|
};
|
|
@@ -79,22 +88,13 @@ var NativeComponents = (function (exports) {
|
|
|
79
88
|
return this;
|
|
80
89
|
};
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
constructor(message, context = {}) {
|
|
84
|
-
super(message);
|
|
85
|
-
this.name = 'NativeDocumentError';
|
|
86
|
-
this.context = context;
|
|
87
|
-
this.timestamp = new Date().toISOString();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function EventEmitter() {
|
|
91
|
+
function HasEventEmitter() {
|
|
92
92
|
|
|
93
93
|
this.__$events = null;
|
|
94
94
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
HasEventEmitter.prototype.on = function(eventName, callback) {
|
|
98
98
|
if(!this.__$events) {
|
|
99
99
|
this.__$events = new Map();
|
|
100
100
|
}
|
|
@@ -110,11 +110,11 @@ var NativeComponents = (function (exports) {
|
|
|
110
110
|
existingCallback.push(callback);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
HasEventEmitter.prototype.hasListeners = function(eventName) {
|
|
114
114
|
return !!this.__$events.get(eventName);
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
HasEventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
118
118
|
const callbacks = this.__$events.get(eventName);
|
|
119
119
|
if(!callbacks) {
|
|
120
120
|
// throw new NativeDocumentError(this.constructor.name, 'Event '+eventName+' not found');
|
|
@@ -131,7 +131,7 @@ var NativeComponents = (function (exports) {
|
|
|
131
131
|
}
|
|
132
132
|
return result;
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
HasEventEmitter.prototype.emit = HasEventEmitter.prototype.trigger;
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* Valid children types that can be rendered in the DOM
|
|
@@ -158,7 +158,7 @@ var NativeComponents = (function (exports) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
BaseComponent.extends(Accordion,
|
|
161
|
+
BaseComponent.extends(Accordion, HasEventEmitter);
|
|
162
162
|
|
|
163
163
|
Accordion.defaultTemplate = null;
|
|
164
164
|
|
|
@@ -367,16 +367,25 @@ var NativeComponents = (function (exports) {
|
|
|
367
367
|
// });
|
|
368
368
|
};
|
|
369
369
|
|
|
370
|
-
let DebugManager$
|
|
370
|
+
let DebugManager$2 = {};
|
|
371
371
|
{
|
|
372
|
-
DebugManager$
|
|
372
|
+
DebugManager$2 = {
|
|
373
373
|
log() {},
|
|
374
374
|
warn() {},
|
|
375
375
|
error() {},
|
|
376
376
|
disable() {}
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
|
-
var DebugManager$
|
|
379
|
+
var DebugManager$1 = DebugManager$2;
|
|
380
|
+
|
|
381
|
+
class NativeDocumentError extends Error {
|
|
382
|
+
constructor(message, context = {}) {
|
|
383
|
+
super(message);
|
|
384
|
+
this.name = 'NativeDocumentError';
|
|
385
|
+
this.context = context;
|
|
386
|
+
this.timestamp = new Date().toISOString();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
380
389
|
|
|
381
390
|
/**
|
|
382
391
|
*
|
|
@@ -858,17 +867,17 @@ var NativeComponents = (function (exports) {
|
|
|
858
867
|
const method = methods[name];
|
|
859
868
|
|
|
860
869
|
if (typeof method !== 'function') {
|
|
861
|
-
DebugManager$
|
|
870
|
+
DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
862
871
|
continue;
|
|
863
872
|
}
|
|
864
873
|
|
|
865
874
|
if (protectedMethods.has(name)) {
|
|
866
|
-
DebugManager$
|
|
875
|
+
DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
867
876
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
868
877
|
}
|
|
869
878
|
|
|
870
879
|
if (NDElement.prototype[name]) {
|
|
871
|
-
DebugManager$
|
|
880
|
+
DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
872
881
|
}
|
|
873
882
|
|
|
874
883
|
NDElement.prototype[name] = method;
|
|
@@ -1093,7 +1102,7 @@ var NativeComponents = (function (exports) {
|
|
|
1093
1102
|
}
|
|
1094
1103
|
}
|
|
1095
1104
|
if (cleanedCount > 0) {
|
|
1096
|
-
DebugManager$
|
|
1105
|
+
DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1097
1106
|
}
|
|
1098
1107
|
}
|
|
1099
1108
|
};
|
|
@@ -3949,7 +3958,7 @@ var NativeComponents = (function (exports) {
|
|
|
3949
3958
|
const $getStoreOrThrow = (method, name) => {
|
|
3950
3959
|
const item = $stores.get(name);
|
|
3951
3960
|
if (!item) {
|
|
3952
|
-
DebugManager$
|
|
3961
|
+
DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
3953
3962
|
throw new NativeDocumentError(
|
|
3954
3963
|
`Store.${method}('${name}') : store not found.`
|
|
3955
3964
|
);
|
|
@@ -3962,7 +3971,7 @@ var NativeComponents = (function (exports) {
|
|
|
3962
3971
|
*/
|
|
3963
3972
|
const $applyReadOnly = (observer, name, context) => {
|
|
3964
3973
|
const readOnlyError = (method) => () => {
|
|
3965
|
-
DebugManager$
|
|
3974
|
+
DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
3966
3975
|
throw new NativeDocumentError(
|
|
3967
3976
|
`Store.${context}('${name}') is read-only.`
|
|
3968
3977
|
);
|
|
@@ -3993,7 +4002,7 @@ var NativeComponents = (function (exports) {
|
|
|
3993
4002
|
*/
|
|
3994
4003
|
create(name, value) {
|
|
3995
4004
|
if ($stores.has(name)) {
|
|
3996
|
-
DebugManager$
|
|
4005
|
+
DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
3997
4006
|
throw new NativeDocumentError(
|
|
3998
4007
|
`Store.create('${name}') : a store with this name already exists.`
|
|
3999
4008
|
);
|
|
@@ -4014,7 +4023,7 @@ var NativeComponents = (function (exports) {
|
|
|
4014
4023
|
*/
|
|
4015
4024
|
createResettable(name, value) {
|
|
4016
4025
|
if ($stores.has(name)) {
|
|
4017
|
-
DebugManager$
|
|
4026
|
+
DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4018
4027
|
throw new NativeDocumentError(
|
|
4019
4028
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4020
4029
|
);
|
|
@@ -4050,7 +4059,7 @@ var NativeComponents = (function (exports) {
|
|
|
4050
4059
|
*/
|
|
4051
4060
|
createComposed(name, computation, dependencies) {
|
|
4052
4061
|
if ($stores.has(name)) {
|
|
4053
|
-
DebugManager$
|
|
4062
|
+
DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4054
4063
|
throw new NativeDocumentError(
|
|
4055
4064
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4056
4065
|
);
|
|
@@ -4073,7 +4082,7 @@ var NativeComponents = (function (exports) {
|
|
|
4073
4082
|
}
|
|
4074
4083
|
const depItem = $stores.get(depName);
|
|
4075
4084
|
if (!depItem) {
|
|
4076
|
-
DebugManager$
|
|
4085
|
+
DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4077
4086
|
throw new NativeDocumentError(
|
|
4078
4087
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4079
4088
|
);
|
|
@@ -4107,13 +4116,13 @@ var NativeComponents = (function (exports) {
|
|
|
4107
4116
|
reset(name) {
|
|
4108
4117
|
const item = $getStoreOrThrow('reset', name);
|
|
4109
4118
|
if (item.composed) {
|
|
4110
|
-
DebugManager$
|
|
4119
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4111
4120
|
throw new NativeDocumentError(
|
|
4112
4121
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4113
4122
|
);
|
|
4114
4123
|
}
|
|
4115
4124
|
if (!item.resettable) {
|
|
4116
|
-
DebugManager$
|
|
4125
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4117
4126
|
throw new NativeDocumentError(
|
|
4118
4127
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4119
4128
|
);
|
|
@@ -4134,7 +4143,7 @@ var NativeComponents = (function (exports) {
|
|
|
4134
4143
|
const item = $getStoreOrThrow('use', name);
|
|
4135
4144
|
|
|
4136
4145
|
if (item.composed) {
|
|
4137
|
-
DebugManager$
|
|
4146
|
+
DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4138
4147
|
throw new NativeDocumentError(
|
|
4139
4148
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4140
4149
|
);
|
|
@@ -4201,7 +4210,7 @@ var NativeComponents = (function (exports) {
|
|
|
4201
4210
|
get(name) {
|
|
4202
4211
|
const item = $stores.get(name);
|
|
4203
4212
|
if (!item) {
|
|
4204
|
-
DebugManager$
|
|
4213
|
+
DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4205
4214
|
return null;
|
|
4206
4215
|
}
|
|
4207
4216
|
return item.observer;
|
|
@@ -4223,7 +4232,7 @@ var NativeComponents = (function (exports) {
|
|
|
4223
4232
|
delete(name) {
|
|
4224
4233
|
const item = $stores.get(name);
|
|
4225
4234
|
if (!item) {
|
|
4226
|
-
DebugManager$
|
|
4235
|
+
DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4227
4236
|
return;
|
|
4228
4237
|
}
|
|
4229
4238
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4325,7 +4334,7 @@ var NativeComponents = (function (exports) {
|
|
|
4325
4334
|
return undefined;
|
|
4326
4335
|
},
|
|
4327
4336
|
set(target, prop, value) {
|
|
4328
|
-
DebugManager$
|
|
4337
|
+
DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4329
4338
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4330
4339
|
},
|
|
4331
4340
|
deleteProperty(target, prop) {
|
|
@@ -4614,7 +4623,7 @@ var NativeComponents = (function (exports) {
|
|
|
4614
4623
|
Alert.defaultContentTemplate = template.alertContent;
|
|
4615
4624
|
};
|
|
4616
4625
|
|
|
4617
|
-
BaseComponent.extends(Alert,
|
|
4626
|
+
BaseComponent.extends(Alert, HasEventEmitter);
|
|
4618
4627
|
|
|
4619
4628
|
/**
|
|
4620
4629
|
* Sets the variant style for the alert
|
|
@@ -5515,7 +5524,7 @@ var NativeComponents = (function (exports) {
|
|
|
5515
5524
|
|
|
5516
5525
|
Badge.preset = function(name, callback) {
|
|
5517
5526
|
if (Badge.prototype[name] || Badge[name]) {
|
|
5518
|
-
DebugManager$
|
|
5527
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in Badge.`);
|
|
5519
5528
|
return;
|
|
5520
5529
|
}
|
|
5521
5530
|
Badge[name] = (content, props) => callback(new Badge(content, props));
|
|
@@ -5623,7 +5632,7 @@ var NativeComponents = (function (exports) {
|
|
|
5623
5632
|
};
|
|
5624
5633
|
}
|
|
5625
5634
|
|
|
5626
|
-
BaseComponent.extends(Breadcrumb,
|
|
5635
|
+
BaseComponent.extends(Breadcrumb, HasEventEmitter);
|
|
5627
5636
|
|
|
5628
5637
|
Breadcrumb.use = function(template) {};
|
|
5629
5638
|
Breadcrumb.defaultTemplate = null;
|
|
@@ -5896,7 +5905,8 @@ var NativeComponents = (function (exports) {
|
|
|
5896
5905
|
MenuGroup.defaultTemplate = template.menuGroup;
|
|
5897
5906
|
};
|
|
5898
5907
|
|
|
5899
|
-
BaseComponent.extends(MenuGroup
|
|
5908
|
+
BaseComponent.extends(MenuGroup);
|
|
5909
|
+
BaseComponent.use(MenuGroup, HasItems);
|
|
5900
5910
|
|
|
5901
5911
|
MenuGroup.prototype.data = function(data) {
|
|
5902
5912
|
this.$description.data = data;
|
|
@@ -5942,7 +5952,8 @@ var NativeComponents = (function (exports) {
|
|
|
5942
5952
|
MenuItem.defaultTemplate = template.menuItem;
|
|
5943
5953
|
};
|
|
5944
5954
|
|
|
5945
|
-
BaseComponent.extends(MenuItem
|
|
5955
|
+
BaseComponent.extends(MenuItem);
|
|
5956
|
+
BaseComponent.use(MenuItem, HasItems);
|
|
5946
5957
|
|
|
5947
5958
|
|
|
5948
5959
|
MenuItem.prototype.label = function(label) {
|
|
@@ -6040,7 +6051,8 @@ var NativeComponents = (function (exports) {
|
|
|
6040
6051
|
|
|
6041
6052
|
}
|
|
6042
6053
|
|
|
6043
|
-
BaseComponent.extends(Menu
|
|
6054
|
+
BaseComponent.extends(Menu);
|
|
6055
|
+
BaseComponent.use(Menu, HasItems, HasEventEmitter);
|
|
6044
6056
|
|
|
6045
6057
|
Menu.defaultTemplate = null;
|
|
6046
6058
|
|
|
@@ -6279,7 +6291,7 @@ var NativeComponents = (function (exports) {
|
|
|
6279
6291
|
|
|
6280
6292
|
Divider.preset = function(name, callback) {
|
|
6281
6293
|
if (Divider.prototype[name] || Divider[name]) {
|
|
6282
|
-
DebugManager$
|
|
6294
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in Divider.`);
|
|
6283
6295
|
return;
|
|
6284
6296
|
}
|
|
6285
6297
|
Divider[name] = (label, props) => callback(new Divider(label, props));
|
|
@@ -6611,7 +6623,7 @@ var NativeComponents = (function (exports) {
|
|
|
6611
6623
|
this.$element = null;
|
|
6612
6624
|
}
|
|
6613
6625
|
|
|
6614
|
-
BaseComponent.extends(Dropdown,
|
|
6626
|
+
BaseComponent.extends(Dropdown, HasEventEmitter);
|
|
6615
6627
|
|
|
6616
6628
|
|
|
6617
6629
|
Dropdown.defaultTemplate = null;
|
|
@@ -7644,7 +7656,7 @@ var NativeComponents = (function (exports) {
|
|
|
7644
7656
|
if(!(this instanceof FormControl)) {
|
|
7645
7657
|
return new FormControl(configs);
|
|
7646
7658
|
}
|
|
7647
|
-
|
|
7659
|
+
HasEventEmitter.call(this);
|
|
7648
7660
|
|
|
7649
7661
|
this.$element = null;
|
|
7650
7662
|
this.$configs = configs;
|
|
@@ -7665,7 +7677,7 @@ var NativeComponents = (function (exports) {
|
|
|
7665
7677
|
return new FormControl(configs);
|
|
7666
7678
|
};
|
|
7667
7679
|
|
|
7668
|
-
BaseComponent.extends(FormControl,
|
|
7680
|
+
BaseComponent.extends(FormControl, HasEventEmitter);
|
|
7669
7681
|
|
|
7670
7682
|
Object.defineProperty(FormControl.prototype, 'isDirty', {
|
|
7671
7683
|
get() { return this.$isDirty; }
|
|
@@ -9350,7 +9362,8 @@ var NativeComponents = (function (exports) {
|
|
|
9350
9362
|
List.defaultTemplate = template.list;
|
|
9351
9363
|
};
|
|
9352
9364
|
|
|
9353
|
-
BaseComponent.extends(List
|
|
9365
|
+
BaseComponent.extends(List);
|
|
9366
|
+
BaseComponent.use(List, HasItems, HasEventEmitter);
|
|
9354
9367
|
|
|
9355
9368
|
List.defaultTemplate = null;
|
|
9356
9369
|
|
|
@@ -9543,7 +9556,8 @@ var NativeComponents = (function (exports) {
|
|
|
9543
9556
|
};
|
|
9544
9557
|
}
|
|
9545
9558
|
|
|
9546
|
-
BaseComponent.extends(ListGroup
|
|
9559
|
+
BaseComponent.extends(ListGroup);
|
|
9560
|
+
BaseComponent.use(ListGroup, HasItems);
|
|
9547
9561
|
|
|
9548
9562
|
ListGroup.defaultTemplate = null;
|
|
9549
9563
|
|
|
@@ -9610,7 +9624,7 @@ var NativeComponents = (function (exports) {
|
|
|
9610
9624
|
};
|
|
9611
9625
|
}
|
|
9612
9626
|
|
|
9613
|
-
BaseComponent.extends(Modal,
|
|
9627
|
+
BaseComponent.extends(Modal, HasEventEmitter);
|
|
9614
9628
|
|
|
9615
9629
|
// Theming
|
|
9616
9630
|
Modal.defaultLayout = null;
|
|
@@ -9770,7 +9784,7 @@ var NativeComponents = (function (exports) {
|
|
|
9770
9784
|
this.$element = null;
|
|
9771
9785
|
}
|
|
9772
9786
|
|
|
9773
|
-
BaseComponent.extends(Pagination,
|
|
9787
|
+
BaseComponent.extends(Pagination, HasEventEmitter);
|
|
9774
9788
|
|
|
9775
9789
|
Pagination.defaultTemplate = null;
|
|
9776
9790
|
|
|
@@ -10001,7 +10015,7 @@ var NativeComponents = (function (exports) {
|
|
|
10001
10015
|
}
|
|
10002
10016
|
}
|
|
10003
10017
|
|
|
10004
|
-
BaseComponent.extends(Popover,
|
|
10018
|
+
BaseComponent.extends(Popover, HasEventEmitter);
|
|
10005
10019
|
|
|
10006
10020
|
Popover.defaultTemplate = null;
|
|
10007
10021
|
|
|
@@ -10255,7 +10269,7 @@ var NativeComponents = (function (exports) {
|
|
|
10255
10269
|
};
|
|
10256
10270
|
}
|
|
10257
10271
|
|
|
10258
|
-
BaseComponent.extends(Progress,
|
|
10272
|
+
BaseComponent.extends(Progress, HasEventEmitter);
|
|
10259
10273
|
|
|
10260
10274
|
Progress.defaultTemplate = null;
|
|
10261
10275
|
|
|
@@ -10265,7 +10279,7 @@ var NativeComponents = (function (exports) {
|
|
|
10265
10279
|
|
|
10266
10280
|
Progress.preset = function(name, callback) {
|
|
10267
10281
|
if (Progress.prototype[name] || Progress[name]) {
|
|
10268
|
-
DebugManager$
|
|
10282
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in Progress.`);
|
|
10269
10283
|
return;
|
|
10270
10284
|
}
|
|
10271
10285
|
Progress[name] = (props) => callback(new Progress(props));
|
|
@@ -10497,7 +10511,7 @@ var NativeComponents = (function (exports) {
|
|
|
10497
10511
|
|
|
10498
10512
|
Skeleton.preset = function(name, callback) {
|
|
10499
10513
|
if (Skeleton.prototype[name] || Skeleton[name]) {
|
|
10500
|
-
DebugManager$
|
|
10514
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in Skeleton.`);
|
|
10501
10515
|
return;
|
|
10502
10516
|
}
|
|
10503
10517
|
Skeleton[name] = (props) => callback(new Skeleton(props));
|
|
@@ -10634,7 +10648,7 @@ var NativeComponents = (function (exports) {
|
|
|
10634
10648
|
};
|
|
10635
10649
|
}
|
|
10636
10650
|
|
|
10637
|
-
BaseComponent.extends(Slider,
|
|
10651
|
+
BaseComponent.extends(Slider, HasEventEmitter);
|
|
10638
10652
|
|
|
10639
10653
|
Slider.use = function(template) {};
|
|
10640
10654
|
Slider.defaultTemplate = null;
|
|
@@ -10813,7 +10827,7 @@ var NativeComponents = (function (exports) {
|
|
|
10813
10827
|
|
|
10814
10828
|
Spinner.preset = function(name, callback) {
|
|
10815
10829
|
if (Spinner.prototype[name] || Spinner[name]) {
|
|
10816
|
-
DebugManager$
|
|
10830
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in Spinner.`);
|
|
10817
10831
|
return;
|
|
10818
10832
|
}
|
|
10819
10833
|
Spinner[name] = (props) => callback(new Spinner(props));
|
|
@@ -10974,7 +10988,7 @@ var NativeComponents = (function (exports) {
|
|
|
10974
10988
|
this.$element = null;
|
|
10975
10989
|
}
|
|
10976
10990
|
|
|
10977
|
-
BaseComponent.extends(Splitter,
|
|
10991
|
+
BaseComponent.extends(Splitter, HasEventEmitter);
|
|
10978
10992
|
|
|
10979
10993
|
Splitter.defaultTemplate = null;
|
|
10980
10994
|
|
|
@@ -11155,7 +11169,7 @@ var NativeComponents = (function (exports) {
|
|
|
11155
11169
|
this.$element = null;
|
|
11156
11170
|
}
|
|
11157
11171
|
|
|
11158
|
-
BaseComponent.extends(Stepper,
|
|
11172
|
+
BaseComponent.extends(Stepper, HasEventEmitter);
|
|
11159
11173
|
|
|
11160
11174
|
Stepper.defaultTemplate = null;
|
|
11161
11175
|
Stepper.defaultStepTemplate = null;
|
|
@@ -12000,7 +12014,7 @@ var NativeComponents = (function (exports) {
|
|
|
12000
12014
|
this.tabsMap = {};
|
|
12001
12015
|
}
|
|
12002
12016
|
|
|
12003
|
-
BaseComponent.extends(Tabs,
|
|
12017
|
+
BaseComponent.extends(Tabs, HasEventEmitter);
|
|
12004
12018
|
|
|
12005
12019
|
Tabs.defaultTemplate = null;
|
|
12006
12020
|
Tabs.defaultTabTemplate = null;
|
|
@@ -12114,7 +12128,7 @@ var NativeComponents = (function (exports) {
|
|
|
12114
12128
|
};
|
|
12115
12129
|
}
|
|
12116
12130
|
|
|
12117
|
-
BaseComponent.extends(Toast,
|
|
12131
|
+
BaseComponent.extends(Toast, HasEventEmitter);
|
|
12118
12132
|
|
|
12119
12133
|
Toast.use = function(template) {};
|
|
12120
12134
|
Toast.defaultTemplate = null;
|
|
@@ -12319,9 +12333,9 @@ var NativeComponents = (function (exports) {
|
|
|
12319
12333
|
Tooltip.prototype.$build = function() {};
|
|
12320
12334
|
Tooltip.prototype.toNdElement = function() {};
|
|
12321
12335
|
|
|
12322
|
-
function Stack
|
|
12323
|
-
if (!(this instanceof Stack
|
|
12324
|
-
return new Stack
|
|
12336
|
+
function Stack(content, props = {}) {
|
|
12337
|
+
if (!(this instanceof Stack)) {
|
|
12338
|
+
return new Stack(content, props);
|
|
12325
12339
|
}
|
|
12326
12340
|
|
|
12327
12341
|
BaseComponent.call(this, props);
|
|
@@ -12336,57 +12350,58 @@ var NativeComponents = (function (exports) {
|
|
|
12336
12350
|
};
|
|
12337
12351
|
}
|
|
12338
12352
|
|
|
12339
|
-
BaseComponent.extends(Stack
|
|
12353
|
+
BaseComponent.extends(Stack);
|
|
12354
|
+
|
|
12340
12355
|
|
|
12341
|
-
Stack
|
|
12356
|
+
Stack.prototype.wrap = function(enabled = true) {
|
|
12342
12357
|
this.$description.wrap = enabled;
|
|
12343
12358
|
return this;
|
|
12344
12359
|
};
|
|
12345
12360
|
|
|
12346
|
-
Stack
|
|
12361
|
+
Stack.prototype.spacing = function(value) {
|
|
12347
12362
|
this.$description.spacing = value;
|
|
12348
12363
|
return this;
|
|
12349
12364
|
};
|
|
12350
12365
|
|
|
12351
|
-
Stack
|
|
12366
|
+
Stack.prototype.alignLeading = function() {
|
|
12352
12367
|
this.$description.alignment = 'leading';
|
|
12353
12368
|
return this;
|
|
12354
12369
|
};
|
|
12355
|
-
Stack
|
|
12370
|
+
Stack.prototype.alignCenter = function() {
|
|
12356
12371
|
this.$description.alignment = 'center';
|
|
12357
12372
|
return this;
|
|
12358
12373
|
};
|
|
12359
|
-
Stack
|
|
12374
|
+
Stack.prototype.alignTrailing = function() {
|
|
12360
12375
|
this.$description.alignment = 'trailing';
|
|
12361
12376
|
return this;
|
|
12362
12377
|
};
|
|
12363
|
-
Stack
|
|
12378
|
+
Stack.prototype.alignStretch = function() {
|
|
12364
12379
|
this.$description.alignment = 'stretch';
|
|
12365
12380
|
return this;
|
|
12366
12381
|
};
|
|
12367
12382
|
|
|
12368
|
-
Stack
|
|
12383
|
+
Stack.prototype.justifyStart = function() {
|
|
12369
12384
|
this.$description.justifyContent = 'start';
|
|
12370
12385
|
return this;
|
|
12371
12386
|
};
|
|
12372
|
-
Stack
|
|
12387
|
+
Stack.prototype.justifyCenter = function() {
|
|
12373
12388
|
this.$description.justifyContent = 'center';
|
|
12374
12389
|
return this;
|
|
12375
12390
|
};
|
|
12376
|
-
Stack
|
|
12391
|
+
Stack.prototype.justifyEnd = function() {
|
|
12377
12392
|
this.$description.justifyContent = 'end';
|
|
12378
12393
|
return this;
|
|
12379
12394
|
};
|
|
12380
|
-
Stack
|
|
12395
|
+
Stack.prototype.justifyBetween = function() {
|
|
12381
12396
|
this.$description.justifyContent = 'between';
|
|
12382
12397
|
return this;
|
|
12383
12398
|
};
|
|
12384
|
-
Stack
|
|
12399
|
+
Stack.prototype.justifyAround = function() {
|
|
12385
12400
|
this.$description.justifyContent = 'around';
|
|
12386
12401
|
return this;
|
|
12387
12402
|
};
|
|
12388
12403
|
|
|
12389
|
-
Stack
|
|
12404
|
+
Stack.prototype.center = function() {
|
|
12390
12405
|
this.alignCenter().justifyCenter();
|
|
12391
12406
|
return this;
|
|
12392
12407
|
};
|
|
@@ -12396,16 +12411,16 @@ var NativeComponents = (function (exports) {
|
|
|
12396
12411
|
return new VStack(content, props);
|
|
12397
12412
|
}
|
|
12398
12413
|
|
|
12399
|
-
Stack
|
|
12414
|
+
Stack.call(this, content, props);
|
|
12400
12415
|
|
|
12401
12416
|
this.$description.orientation = 'vertical';
|
|
12402
12417
|
this.$description.alignment = 'leading';
|
|
12403
12418
|
}
|
|
12404
|
-
BaseComponent.extends(VStack, Stack
|
|
12419
|
+
BaseComponent.extends(VStack, Stack);
|
|
12405
12420
|
|
|
12406
12421
|
VStack.preset = function(name, callback) {
|
|
12407
12422
|
if (VStack.prototype[name] || VStack[name]) {
|
|
12408
|
-
DebugManager$
|
|
12423
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in VStack.`);
|
|
12409
12424
|
return;
|
|
12410
12425
|
}
|
|
12411
12426
|
VStack[name] = (content, props) => callback(new VStack(content, props));
|
|
@@ -12434,7 +12449,7 @@ var NativeComponents = (function (exports) {
|
|
|
12434
12449
|
|
|
12435
12450
|
ZStack.preset = function(name, callback) {
|
|
12436
12451
|
if (ZStack.prototype[name] || ZStack[name]) {
|
|
12437
|
-
DebugManager$
|
|
12452
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in ZStack.`);
|
|
12438
12453
|
return;
|
|
12439
12454
|
}
|
|
12440
12455
|
ZStack[name] = (content, props) => callback(new ZStack(content, props));
|
|
@@ -12456,15 +12471,15 @@ var NativeComponents = (function (exports) {
|
|
|
12456
12471
|
return new HStack(content, props);
|
|
12457
12472
|
}
|
|
12458
12473
|
|
|
12459
|
-
Stack
|
|
12474
|
+
Stack.call(this, content, props);
|
|
12460
12475
|
this.$description.orientation = 'horizontal';
|
|
12461
12476
|
}
|
|
12462
12477
|
|
|
12463
|
-
BaseComponent.extends(HStack, Stack
|
|
12478
|
+
BaseComponent.extends(HStack, Stack);
|
|
12464
12479
|
|
|
12465
12480
|
HStack.preset = function(name, callback) {
|
|
12466
12481
|
if (HStack.prototype[name] || HStack[name]) {
|
|
12467
|
-
DebugManager$
|
|
12482
|
+
DebugManager$1.warn(`Warning: the ${name} method already exists in HStack.`);
|
|
12468
12483
|
return;
|
|
12469
12484
|
}
|
|
12470
12485
|
HStack[name] = (content, props) => callback(new HStack(content, props));
|
|
@@ -12536,7 +12551,7 @@ var NativeComponents = (function (exports) {
|
|
|
12536
12551
|
exports.Spinner = Spinner;
|
|
12537
12552
|
exports.Splitter = Splitter;
|
|
12538
12553
|
exports.SplitterPanel = SplitterPanel;
|
|
12539
|
-
exports.Stack = Stack
|
|
12554
|
+
exports.Stack = Stack;
|
|
12540
12555
|
exports.Stepper = Stepper;
|
|
12541
12556
|
exports.StepperStep = StepperStep;
|
|
12542
12557
|
exports.StringField = StringField;
|
package/package.json
CHANGED
|
@@ -18,7 +18,8 @@ Object.defineProperty( BaseComponent.prototype, 'nd', {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
BaseComponent.extends = function(Component, ...parents) {
|
|
21
|
-
|
|
21
|
+
const MainParent = parents[0] || BaseComponent;
|
|
22
|
+
Component.prototype = Object.create(MainParent.prototype);
|
|
22
23
|
|
|
23
24
|
if(parents.length > 0) {
|
|
24
25
|
for(const parent of parents) {
|
|
@@ -28,6 +29,14 @@ BaseComponent.extends = function(Component, ...parents) {
|
|
|
28
29
|
Component.prototype.constructor = Component;
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
BaseComponent.use = function(Component, ...traits) {
|
|
33
|
+
if(traits.length > 0) {
|
|
34
|
+
for(const trait of traits) {
|
|
35
|
+
Object.assign(Component.prototype, trait.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
31
40
|
BaseComponent.obs = (value) => {
|
|
32
41
|
return value.__$Observable ? value : Observable(value);
|
|
33
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -27,7 +27,7 @@ export default function Accordion(config = {}) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
BaseComponent.extends(Accordion,
|
|
30
|
+
BaseComponent.extends(Accordion, HasEventEmitter);
|
|
31
31
|
|
|
32
32
|
Accordion.defaultTemplate = null;
|
|
33
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Component for displaying alert messages with various styles and variants
|
|
@@ -41,7 +41,7 @@ Alert.use = function(template) {
|
|
|
41
41
|
Alert.defaultContentTemplate = template.alertContent;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
BaseComponent.extends(Alert,
|
|
44
|
+
BaseComponent.extends(Alert, HasEventEmitter);
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Sets the variant style for the alert
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Breadcrumb(config = {}) {
|
|
5
5
|
if (!(this instanceof Breadcrumb)) {
|
|
@@ -15,7 +15,7 @@ export default function Breadcrumb(config = {}) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
BaseComponent.extends(Breadcrumb,
|
|
18
|
+
BaseComponent.extends(Breadcrumb, HasEventEmitter);
|
|
19
19
|
|
|
20
20
|
Breadcrumb.use = function(template) {};
|
|
21
21
|
Breadcrumb.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import DropdownGroup from "./DropdownGroup";
|
|
4
4
|
import DropdownTrigger from "./DropdownTrigger";
|
|
5
5
|
import DropdownDivider from "./DropdownDivider";
|
|
@@ -35,7 +35,7 @@ export default function Dropdown(config = {}) {
|
|
|
35
35
|
this.$element = null;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
BaseComponent.extends(Dropdown,
|
|
38
|
+
BaseComponent.extends(Dropdown, HasEventEmitter);
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
Dropdown.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {debounce} from "../../core/utils/helpers";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator, Observable as $ } from "../../../index";
|
|
4
4
|
import NativeDocumentError from "../../../src/core/errors/NativeDocumentError";
|
|
5
5
|
import BaseComponent from "../BaseComponent";
|
|
@@ -12,7 +12,7 @@ export default function FormControl(configs) {
|
|
|
12
12
|
if(!(this instanceof FormControl)) {
|
|
13
13
|
return new FormControl(configs);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
HasEventEmitter.call(this);
|
|
16
16
|
|
|
17
17
|
this.$element = null;
|
|
18
18
|
this.$configs = configs;
|
|
@@ -33,7 +33,7 @@ FormControl.create = function (configs) {
|
|
|
33
33
|
return new FormControl(configs);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
BaseComponent.extends(FormControl,
|
|
36
|
+
BaseComponent.extends(FormControl, HasEventEmitter);
|
|
37
37
|
|
|
38
38
|
Object.defineProperty(FormControl.prototype, 'isDirty', {
|
|
39
39
|
get() { return this.$isDirty; }
|
|
@@ -8,7 +8,7 @@ export default function VStack(content, props = {}) {
|
|
|
8
8
|
return new VStack(content, props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
Stack.
|
|
11
|
+
Stack.call(this, content, props);
|
|
12
12
|
|
|
13
13
|
this.$description.orientation = 'vertical';
|
|
14
14
|
this.$description.alignment = 'leading';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import BaseComponent from "../BaseComponent";
|
|
3
|
-
import
|
|
3
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
4
4
|
import HasItems from "../$traits/HasItems";
|
|
5
5
|
import Dropdown from "../dropdown/Dropdown";
|
|
6
6
|
|
|
@@ -31,7 +31,8 @@ List.use = function(template) {
|
|
|
31
31
|
List.defaultTemplate = template.list;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
BaseComponent.extends(List
|
|
34
|
+
BaseComponent.extends(List);
|
|
35
|
+
BaseComponent.use(List, HasItems, HasEventEmitter);
|
|
35
36
|
|
|
36
37
|
List.defaultTemplate = null;
|
|
37
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import HasItems from "../$traits/HasItems";
|
|
4
4
|
import MenuDivider from "./MenuDivider";
|
|
5
5
|
import MenuGroup from "./MenuGroup";
|
|
@@ -24,7 +24,8 @@ export default function Menu(props = {}) {
|
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
BaseComponent.extends(Menu
|
|
27
|
+
BaseComponent.extends(Menu);
|
|
28
|
+
BaseComponent.use(Menu, HasItems, HasEventEmitter);
|
|
28
29
|
|
|
29
30
|
Menu.defaultTemplate = null;
|
|
30
31
|
|
|
@@ -23,7 +23,8 @@ MenuGroup.use = function(template) {
|
|
|
23
23
|
MenuGroup.defaultTemplate = template.menuGroup;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
BaseComponent.extends(MenuGroup
|
|
26
|
+
BaseComponent.extends(MenuGroup);
|
|
27
|
+
BaseComponent.use(MenuGroup, HasItems);
|
|
27
28
|
|
|
28
29
|
MenuGroup.prototype.data = function(data) {
|
|
29
30
|
this.$description.data = data;
|
|
@@ -32,7 +32,8 @@ MenuItem.use = function(template) {
|
|
|
32
32
|
MenuItem.defaultTemplate = template.menuItem;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
BaseComponent.extends(MenuItem
|
|
35
|
+
BaseComponent.extends(MenuItem);
|
|
36
|
+
BaseComponent.use(MenuItem, HasItems);
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
MenuItem.prototype.label = function(label) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export default function Modal(config = {}) {
|
|
@@ -22,7 +22,7 @@ export default function Modal(config = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
BaseComponent.extends(Modal,
|
|
25
|
+
BaseComponent.extends(Modal, HasEventEmitter);
|
|
26
26
|
|
|
27
27
|
// Theming
|
|
28
28
|
Modal.defaultLayout = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Pagination(config = {}) {
|
|
5
5
|
if(!(this instanceof Pagination)) {
|
|
@@ -31,7 +31,7 @@ export default function Pagination(config = {}) {
|
|
|
31
31
|
this.$element = null;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
BaseComponent.extends(Pagination,
|
|
34
|
+
BaseComponent.extends(Pagination, HasEventEmitter);
|
|
35
35
|
|
|
36
36
|
Pagination.defaultTemplate = null;
|
|
37
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Popover(config = {}) {
|
|
5
5
|
if (!(this instanceof Popover)) {
|
|
@@ -35,7 +35,7 @@ export default function Popover(config = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
BaseComponent.extends(Popover,
|
|
38
|
+
BaseComponent.extends(Popover, HasEventEmitter);
|
|
39
39
|
|
|
40
40
|
Popover.defaultTemplate = null;
|
|
41
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator} from "../../../index";
|
|
4
4
|
import DebugManager from "../../core/utils/debug-manager";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ export default function Progress(props = {}) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
BaseComponent.extends(Progress,
|
|
33
|
+
BaseComponent.extends(Progress, HasEventEmitter);
|
|
34
34
|
|
|
35
35
|
Progress.defaultTemplate = null;
|
|
36
36
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Slider(config = {}) {
|
|
5
5
|
if (!(this instanceof Slider)) {
|
|
@@ -33,7 +33,7 @@ export default function Slider(config = {}) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
BaseComponent.extends(Slider,
|
|
36
|
+
BaseComponent.extends(Slider, HasEventEmitter);
|
|
37
37
|
|
|
38
38
|
Slider.use = function(template) {};
|
|
39
39
|
Slider.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator} from "../../../index";
|
|
4
4
|
|
|
5
5
|
export default function Splitter(config = {}) {
|
|
@@ -18,7 +18,7 @@ export default function Splitter(config = {}) {
|
|
|
18
18
|
this.$element = null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
BaseComponent.extends(Splitter,
|
|
21
|
+
BaseComponent.extends(Splitter, HasEventEmitter);
|
|
22
22
|
|
|
23
23
|
Splitter.defaultTemplate = null;
|
|
24
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {$, Validator} from "../../../index";
|
|
4
4
|
|
|
5
5
|
export default function Stepper(config = {}) {
|
|
@@ -27,7 +27,7 @@ export default function Stepper(config = {}) {
|
|
|
27
27
|
this.$element = null;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
BaseComponent.extends(Stepper,
|
|
30
|
+
BaseComponent.extends(Stepper, HasEventEmitter);
|
|
31
31
|
|
|
32
32
|
Stepper.defaultTemplate = null;
|
|
33
33
|
Stepper.defaultStepTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
function Switch(config = {}) {
|
|
5
5
|
if (!(this instanceof Switch)) {
|
|
@@ -11,7 +11,7 @@ function Switch(config = {}) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
BaseComponent.extends(Switch,
|
|
14
|
+
BaseComponent.extends(Switch, HasEventEmitter);
|
|
15
15
|
|
|
16
16
|
// Theming
|
|
17
17
|
Switch.defaultTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export default function Tabs(config = {}) {
|
|
@@ -16,7 +16,7 @@ export default function Tabs(config = {}) {
|
|
|
16
16
|
this.tabsMap = {};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
BaseComponent.extends(Tabs,
|
|
19
|
+
BaseComponent.extends(Tabs, HasEventEmitter);
|
|
20
20
|
|
|
21
21
|
Tabs.defaultTemplate = null;
|
|
22
22
|
Tabs.defaultTabTemplate = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
-
import
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
|
|
4
4
|
export default function Toast(message, config = {}) {
|
|
5
5
|
if (!(this instanceof Toast)) {
|
|
@@ -22,7 +22,7 @@ export default function Toast(message, config = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
BaseComponent.extends(Toast,
|
|
25
|
+
BaseComponent.extends(Toast, HasEventEmitter);
|
|
26
26
|
|
|
27
27
|
Toast.use = function(template) {};
|
|
28
28
|
Toast.defaultTemplate = null;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import NativeDocumentError from "../errors/NativeDocumentError";
|
|
2
1
|
|
|
3
|
-
export default function
|
|
2
|
+
export default function HasEventEmitter() {
|
|
4
3
|
|
|
5
4
|
this.__$events = null;
|
|
6
5
|
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
HasEventEmitter.prototype.on = function(eventName, callback) {
|
|
10
9
|
if(!this.__$events) {
|
|
11
10
|
this.__$events = new Map();
|
|
12
11
|
}
|
|
@@ -22,11 +21,11 @@ EventEmitter.prototype.on = function(eventName, callback) {
|
|
|
22
21
|
existingCallback.push(callback);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
HasEventEmitter.prototype.hasListeners = function(eventName) {
|
|
26
25
|
return !!this.__$events.get(eventName);
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
HasEventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
30
29
|
const callbacks = this.__$events.get(eventName);
|
|
31
30
|
if(!callbacks) {
|
|
32
31
|
// throw new NativeDocumentError(this.constructor.name, 'Event '+eventName+' not found');
|
|
@@ -43,4 +42,4 @@ EventEmitter.prototype.trigger = async function(eventName, ...args) {
|
|
|
43
42
|
}
|
|
44
43
|
return result;
|
|
45
44
|
};
|
|
46
|
-
|
|
45
|
+
HasEventEmitter.prototype.emit = HasEventEmitter.prototype.trigger;
|