@signal24/vue-foundation 3.0.0 → 3.3.2

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": "@signal24/vue-foundation",
3
- "version": "3.0.0",
3
+ "version": "3.3.2",
4
4
  "description": "Common components, directives, and helpers for Vue 3 apps",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <modal class="vf-alert" :class="classes">
3
- <h1 v-if="!this.isBare" slot="header">{{ title }}</h1>
3
+ <h1 v-if="!this.isBare" v-slot:header>{{ title }}</h1>
4
4
 
5
5
  <div v-if="isHtml" v-html="message" class="user-message"></div>
6
6
  <div v-else v-user-text="message"></div>
7
7
 
8
- <template v-if="!this.isBare" slot="footer">
8
+ <template v-if="!this.isBare" v-slot:footer>
9
9
  <template v-if="shouldConfirm">
10
10
  <button class="primary" @click="ok" v-autofocus>Confirm</button>
11
11
  <button class="default" @click="$dismiss()">Cancel</button>
@@ -538,6 +538,7 @@ export default {
538
538
  border-style: solid;
539
539
  border-width: 5px 5px 0 5px;
540
540
  border-color: #333333 transparent transparent transparent;
541
+ pointer-events: none;
541
542
  }
542
543
 
543
544
  &.open:after {
@@ -55,10 +55,25 @@ const filterFns = {
55
55
  }
56
56
  };
57
57
 
58
+ function registerFilters(filters) {
59
+ for (let filterName of Object.keys(filters)) {
60
+ registerFilter(filterName, filters[filterName]);
61
+ }
62
+ }
63
+
64
+ function registerFilter(name, fn) {
65
+ filterFns[name] = fn;
66
+ }
67
+
58
68
  app.config.globalProperties.$filter = (value, ...filters) => {
59
69
  for (let filter of filters) {
60
70
  value = filterFns[filter](value);
61
71
  }
62
72
 
63
73
  return value;
74
+ };
75
+
76
+ export {
77
+ registerFilter,
78
+ registerFilters
64
79
  };
@@ -7,7 +7,7 @@ Object.defineProperty(Array.prototype, 'diff', {
7
7
  return false;
8
8
  }
9
9
  }
10
-
10
+
11
11
  return true;
12
12
  });
13
13
  }
@@ -29,19 +29,12 @@ Object.defineProperty(Array.prototype, 'intersect', {
29
29
  return true;
30
30
  }
31
31
  }
32
-
32
+
33
33
  return false;
34
34
  });
35
35
  }
36
36
  });
37
37
 
38
- Object.defineProperty(Array.prototype, 'unique', {
39
- enumerable: false,
40
- value: function() {
41
- return [...new Set(this)]
42
- }
43
- });
44
-
45
38
  Object.defineProperty(Array.prototype, 'keyBy', {
46
39
  enumerable: false,
47
40
  value: function(keyProp) {
@@ -77,7 +70,7 @@ Object.defineProperty(Array.prototype, 'pluck', {
77
70
  Object.defineProperty(Array.prototype, 'remove', {
78
71
  enumerable: false,
79
72
  value: function(element) {
80
- let index = this.indexOf(element);
73
+ const index = this.indexOf(element);
81
74
  index > -1 && this.splice(index, 1);
82
75
  }
83
76
  });
@@ -85,7 +78,7 @@ Object.defineProperty(Array.prototype, 'remove', {
85
78
  Object.defineProperty(Array.prototype, 'replace', {
86
79
  enumerable: false,
87
80
  value: function(element, replacement) {
88
- let index = this.indexOf(element);
81
+ const index = this.indexOf(element);
89
82
  index > -1 && this.splice(index, 1, replacement);
90
83
  }
91
84
  });
@@ -98,3 +91,10 @@ Object.defineProperty(Array.prototype, 'sortBy', {
98
91
  });
99
92
  }
100
93
  });
94
+
95
+ Object.defineProperty(Array.prototype, 'unique', {
96
+ enumerable: false,
97
+ value: function() {
98
+ return [...new Set(this)]
99
+ }
100
+ });
@@ -0,0 +1,3 @@
1
+ import app from '../app';
2
+
3
+ app.config.globalProperties.$delay = ms => new Promise(resolve => setTimeout(resolve, ms));
@@ -15,6 +15,12 @@ app.config.globalProperties.$reportError = err => {
15
15
  }
16
16
  }
17
17
 
18
+ app.config.globalProperties.$throwUserError = msg => {
19
+ let err = new Error(msg);
20
+ err.code = 'USERERR';
21
+ throw err;
22
+ };
23
+
18
24
  Object.defineProperty(Error.prototype, 'userMessage', {
19
25
  get() {
20
26
  if (this.code == 'USERERR')
@@ -1,5 +1,6 @@
1
1
  import './array';
2
2
  import './context-menu';
3
+ import './delay';
3
4
  import './error';
4
5
  import './http';
5
6
  import './mask';
package/src/index.js CHANGED
@@ -7,14 +7,16 @@ import vfConfig from './config';
7
7
  import app, { setRootComponent } from './app';
8
8
  import './components';
9
9
  import './directives';
10
- import './filters';
10
+ import { registerFilter, registerFilters } from './filters';
11
11
  import './helpers';
12
12
  import './plugins';
13
13
 
14
14
  export default {
15
+ getApp,
15
16
  configure,
16
17
  mount,
17
- getApp
18
+ registerFilter,
19
+ registerFilters
18
20
  };
19
21
 
20
22
  function configure(options) {
@@ -4,6 +4,19 @@ import InfiniteScrollHook from './infinite-scroll/hook';
4
4
 
5
5
  class InfiniteScroll {
6
6
  static install(app, options) {
7
+ const scrollableValues = ['auto', 'scroll'];
8
+ const discoverScrollableAncestorEl = function(el) {
9
+ el = el.parentElement;
10
+ if (!el) return null;
11
+
12
+ const computedStyle = window.getComputedStyle(el);
13
+ if (scrollableValues.includes(computedStyle.overflow) || scrollableValues.includes(computedStyle.overflowX) || scrollableValues.includes(computedStyle.overflowY)) {
14
+ return el;
15
+ }
16
+
17
+ return discoverScrollableAncestorEl(el);
18
+ };
19
+
7
20
  const installScrollHook = function() {
8
21
  if (this.$options.windowScrolledToBottom) {
9
22
  this._windowScrollHook = new InfiniteScrollHook(window, this.$options.windowScrolledToBottom.bind(this));
@@ -14,6 +27,16 @@ class InfiniteScroll {
14
27
  this._elScrollHook = new InfiniteScrollHook(this.$el, this.$options.elScrolledToBottom.bind(this));
15
28
  this._elScrollHook.install();
16
29
  }
30
+
31
+ if (this.$options.ancestorScrolledToBottom) {
32
+ const scrollableAncestorEl = discoverScrollableAncestorEl(this.$el);
33
+ if (scrollableAncestorEl) {
34
+ this._ancestorScrollHook = new InfiniteScrollHook(scrollableAncestorEl, this.$options.ancestorScrolledToBottom.bind(this));
35
+ this._ancestorScrollHook.install();
36
+ } else {
37
+ console.warn('no scollable ancestor found for component:', this);
38
+ }
39
+ }
17
40
  };
18
41
 
19
42
  const reinstallScrollHook = function() {
@@ -24,6 +47,10 @@ class InfiniteScroll {
24
47
  if (this._elScrollHandler) {
25
48
  this._elScrollHandler.install();
26
49
  }
50
+
51
+ if (this._ancestorScrollHook) {
52
+ this._ancestorScrollHook.install();
53
+ }
27
54
  };
28
55
 
29
56
  const removeScrollHook = function() {
@@ -34,6 +61,10 @@ class InfiniteScroll {
34
61
  if (this._elScrollHandler) {
35
62
  this._elScrollHandler.uninstall();
36
63
  }
64
+
65
+ if (this._ancestorScrollHook) {
66
+ this._ancestorScrollHook.uninstall();
67
+ }
37
68
  }
38
69
 
39
70
  app.mixin({