brew-js-react 0.1.7 → 0.1.8

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.
@@ -1,4 +1,5 @@
1
- import { defineAliasProperty, definePrototype, extend } from "../include/zeta-dom/util.js";
1
+ import $ from "../include/external/jquery.js";
2
+ import { defineAliasProperty, defineHiddenProperty, definePrototype, each, extend, makeArray } from "../include/zeta-dom/util.js";
2
3
  import { app } from "../app.js";
3
4
  import Mixin from "./Mixin.js";
4
5
  import ClassNameMixin from "./ClassNameMixin.js";
@@ -10,6 +11,7 @@ export default function ScrollableMixin() {
10
11
  ClassNameMixin.call(self, ['scrollable-x', 'scrollable-x-l', 'scrollable-x-r', 'scrollable-y', 'scrollable-y-d', 'scrollable-y-u']);
11
12
  self.target = Mixin.scrollableTarget;
12
13
  self.pageIndex = 0;
14
+ self.scrolling = false;
13
15
  }
14
16
 
15
17
  definePrototype(ScrollableMixin, ClassNameMixin, {
@@ -33,9 +35,17 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
33
35
  },
34
36
  initElement: function (element, state) {
35
37
  var self = this;
36
- app.on(element, 'statechange', function (e) {
37
- if ('pageIndex' in e.newValues) {
38
- extend(self, { pageIndex: e.newValues.pageIndex });
38
+ app.on(element, {
39
+ statechange: function (e) {
40
+ if ('pageIndex' in e.newValues) {
41
+ extend(self, { pageIndex: e.newValues.pageIndex });
42
+ }
43
+ },
44
+ scrollStart: function() {
45
+ self.scrolling = true;
46
+ },
47
+ scrollStop: function() {
48
+ self.scrolling = false;
39
49
  }
40
50
  }, true);
41
51
  },
@@ -45,3 +55,10 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
45
55
  return mixin;
46
56
  }
47
57
  });
58
+
59
+ each('destroy enable disable setOptions refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement', function (i, v) {
60
+ defineHiddenProperty(ScrollableMixin.prototype, v, function () {
61
+ var obj = $(this.elements());
62
+ return obj.scrollable.apply(obj, [v].concat(makeArray(arguments)));
63
+ });
64
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brew-js-react",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -17,7 +17,7 @@
17
17
  "homepage": "https://hackmd.io/@misonou/brew-js-react",
18
18
  "repository": "github:misonou/brew-js-react",
19
19
  "dependencies": {
20
- "brew-js": ">=0.2.1",
20
+ "brew-js": ">=0.3.2",
21
21
  "waterpipe": "^2.5.0",
22
22
  "zeta-dom": ">=0.1.13",
23
23
  "zeta-dom-react": ">=0.1.1"