native-document 1.0.247 → 1.0.248

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.247",
3
+ "version": "1.0.248",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -0,0 +1,60 @@
1
+ import { $ } from '../../../../core/data/Observable';
2
+ import Field from '../Field';
3
+
4
+
5
+ export default function AddressSearchField(name, props = {}) {
6
+ if(!(this instanceof AddressSearchField)) {
7
+ return new AddressSearchField(name, props);
8
+ }
9
+
10
+ Field.call(this, name, 'input', props);
11
+
12
+ Object.assign(this.$description, {
13
+ renderSuggestion: null
14
+ });
15
+
16
+ }
17
+
18
+ AddressSearchField.defaultTemplate = null;
19
+
20
+ AddressSearchField.prototype = Object.create(Field.prototype);
21
+ AddressSearchField.prototype.constructor = AddressSearchField;
22
+
23
+ /**
24
+ * Registers the render template for AddressSearchField.
25
+ * @param {(description: {
26
+ * value: Observable<string>,
27
+ * placeholder: string|null,
28
+ * debounceMs: number,
29
+ * disabled: Observable<boolean>|null,
30
+ * loading: Observable<boolean>|null,
31
+ * props: GlobalAttributes,
32
+ * }, instance: AddressSearchField) => NdChild} template
33
+ */
34
+ AddressSearchField.use = function(template) {
35
+ AddressSearchField.defaultTemplate = template;
36
+ };
37
+
38
+
39
+ /**
40
+ * @param {Observable} $loading
41
+ * @return {this}
42
+ */
43
+ AddressSearchField.prototype.loading = function($loading){
44
+ this.$description.loading = $loading;
45
+ return this;
46
+ };
47
+
48
+ /**
49
+ * @param {(sugesstion: *) => {}} callback
50
+ * @return {AddressSearchField}
51
+ */
52
+ AddressSearchField.prototype.onSuggestions = function(callback){
53
+ this.$description.callback = callback;
54
+ return this;
55
+ };
56
+
57
+ AddressSearchField.prototype.renderSuggestion = function(renderFn){
58
+ this.$description.renderSuggestion = renderFn;
59
+ return this;
60
+ };
@@ -63,4 +63,13 @@ SearchField.prototype.constructor = SearchField;
63
63
  SearchField.prototype.debounce = function(ms) {
64
64
  this.$description.debounce = ms;
65
65
  return this;
66
- };
66
+ };
67
+
68
+ /**
69
+ * @param {Observable} $loading
70
+ * @return {this}
71
+ */
72
+ SearchField.prototype.loading = function($loading){
73
+ this.$description.loading = $loading;
74
+ return this;
75
+ };
@@ -149,4 +149,5 @@ ListGroup.prototype.hideIfEmpty = function() {
149
149
  */
150
150
  ListGroup.prototype.showTitleWhen = function($observable) {
151
151
  this.$description.showTitleWhen = $observable;
152
+ return this;
152
153
  };
@@ -0,0 +1,15 @@
1
+ import BaseComponent from '../../BaseComponent';
2
+
3
+
4
+ export default function AddressMapPicker() {
5
+ if(!(this instanceof AddressMapPicker)) {
6
+ return new AddressMapPicker();
7
+ }
8
+
9
+ this.$description = {
10
+
11
+ };
12
+
13
+ };
14
+
15
+ BaseComponent.extends(AddressMapPicker);
@@ -646,6 +646,28 @@ ObservableItem.prototype.clone = function() {
646
646
  return new ObservableItem(clonedValue);
647
647
  };
648
648
 
649
+ /**
650
+ * @param {ObservableItem} targetObservable
651
+ * @return {(function())|*}
652
+ */
653
+ ObservableItem.prototype.sync = function(targetObservable) {
654
+ if(this === targetObservable) {
655
+ return () => {};
656
+ }
657
+
658
+ const updateTargetObservable = (newValue) => targetObservable.set(newValue);
659
+ const updateCurrentObservable = (newValue) => this.set(newValue);
660
+
661
+ this.subscribe(updateTargetObservable);
662
+ targetObservable.subscribe(updateCurrentObservable);
663
+
664
+
665
+ return () => {
666
+ this.unsubscribe(updateTargetObservable);
667
+ targetObservable.unsubscribe(updateCurrentObservable);
668
+ };
669
+ };
670
+
649
671
 
650
672
  ObservableItem.prototype.fnSet = function(value) {
651
673
  return () => this.set(value);