@wcardinal/wcardinal-ui 0.429.0 → 0.430.0

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.
Files changed (32) hide show
  1. package/dist/types/wcardinal/ui/d-chart-selection-simple.d.ts +27 -3
  2. package/dist/types/wcardinal/ui/d-view-gesture-impl.d.ts +1 -0
  3. package/dist/types/wcardinal/ui/d-view.d.ts +9 -0
  4. package/dist/types/wcardinal/ui/util/util-gesture-data.d.ts +1 -0
  5. package/dist/types/wcardinal/ui/util/util-gesture-tap.d.ts +16 -2
  6. package/dist/wcardinal/ui/d-chart-selection-simple.js +45 -8
  7. package/dist/wcardinal/ui/d-chart-selection-simple.js.map +1 -1
  8. package/dist/wcardinal/ui/d-view-gesture-impl.js +7 -0
  9. package/dist/wcardinal/ui/d-view-gesture-impl.js.map +1 -1
  10. package/dist/wcardinal/ui/d-view.js.map +1 -1
  11. package/dist/wcardinal/ui/util/util-gesture-data.js.map +1 -1
  12. package/dist/wcardinal/ui/util/util-gesture-tap.js +58 -7
  13. package/dist/wcardinal/ui/util/util-gesture-tap.js.map +1 -1
  14. package/dist/wcardinal/ui/util/util-gesture.js +3 -1
  15. package/dist/wcardinal/ui/util/util-gesture.js.map +1 -1
  16. package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
  17. package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
  18. package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
  19. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
  20. package/dist/wcardinal-ui-theme-dark.js +1 -1
  21. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  22. package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
  23. package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
  24. package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
  25. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
  26. package/dist/wcardinal-ui-theme-white.js +1 -1
  27. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  28. package/dist/wcardinal-ui.cjs.js +114 -17
  29. package/dist/wcardinal-ui.js +114 -17
  30. package/dist/wcardinal-ui.min.js +2 -2
  31. package/dist/wcardinal-ui.min.js.map +1 -1
  32. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.429.0
2
+ Winter Cardinal UI v0.430.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15975,12 +15975,30 @@
15975
15975
  */
15976
15976
  var UtilGestureTap = /** @class */ (function () {
15977
15977
  function UtilGestureTap(on, options) {
15978
- var _a;
15979
- this._onTap = on === null || on === void 0 ? void 0 : on.tap;
15980
- this._threshold = (_a = options === null || options === void 0 ? void 0 : options.threshold) !== null && _a !== void 0 ? _a : 10;
15978
+ if (on != null) {
15979
+ this._onTap = on.tap;
15980
+ this._onLongPress = on.longpress;
15981
+ }
15982
+ this._threshold = this.toThreshold(options);
15981
15983
  this._unused = [];
15982
15984
  this._used = new Map();
15983
15985
  }
15986
+ UtilGestureTap.prototype.toThreshold = function (options) {
15987
+ var _a, _b;
15988
+ if (options != null) {
15989
+ var threshold = options.threshold;
15990
+ if (threshold != null) {
15991
+ return {
15992
+ distance: (_a = threshold.distance) !== null && _a !== void 0 ? _a : 10,
15993
+ long: (_b = threshold.long) !== null && _b !== void 0 ? _b : 500
15994
+ };
15995
+ }
15996
+ }
15997
+ return {
15998
+ distance: 10,
15999
+ long: 500
16000
+ };
16001
+ };
15984
16002
  UtilGestureTap.prototype.newData = function (target) {
15985
16003
  var used = this._used;
15986
16004
  var result = used.get(target);
@@ -16003,6 +16021,11 @@
16003
16021
  var target = data.target;
16004
16022
  if (target) {
16005
16023
  if (this._used.delete(target)) {
16024
+ var timeoutId = data.timeoutId;
16025
+ if (timeoutId != null) {
16026
+ data.timeoutId = undefined;
16027
+ window.clearTimeout(timeoutId);
16028
+ }
16006
16029
  data.target = undefined;
16007
16030
  data.pointers.clear();
16008
16031
  this._unused.push(data);
@@ -16023,7 +16046,7 @@
16023
16046
  };
16024
16047
  UtilGestureTap.prototype.onDown = function (target, e) {
16025
16048
  var _a;
16026
- if (this._onTap == null) {
16049
+ if (this._onTap == null && this._onLongPress == null) {
16027
16050
  return;
16028
16051
  }
16029
16052
  var layer = DApplications.getLayer(target);
@@ -16046,6 +16069,8 @@
16046
16069
  data.start(e);
16047
16070
  // Event handler
16048
16071
  data.bind(e);
16072
+ // Long press
16073
+ this.start(target, data, e);
16049
16074
  }
16050
16075
  };
16051
16076
  UtilGestureTap.prototype.onMove = function (e, data) {
@@ -16098,10 +16123,36 @@
16098
16123
  // Delete this data
16099
16124
  this.deleteData(data);
16100
16125
  };
16126
+ UtilGestureTap.prototype.onLongPress = function (target, data, e) {
16127
+ data.timeoutId = undefined;
16128
+ if (data.distance < this._threshold.distance) {
16129
+ data.distance = this._threshold.distance;
16130
+ var onLongPress = this._onLongPress;
16131
+ if (onLongPress != null) {
16132
+ onLongPress(target, e);
16133
+ }
16134
+ }
16135
+ };
16136
+ UtilGestureTap.prototype.start = function (target, data, e) {
16137
+ var _this = this;
16138
+ var thresholdLong = this._threshold.long;
16139
+ if (0 <= thresholdLong) {
16140
+ data.timeoutId = window.setTimeout(function () {
16141
+ _this.onLongPress(target, data, e);
16142
+ }, thresholdLong);
16143
+ }
16144
+ };
16101
16145
  UtilGestureTap.prototype.end = function (target, data, e) {
16102
- var onTap = this._onTap;
16103
- if (onTap && data.distance < this._threshold) {
16104
- onTap(target, e);
16146
+ var timeoutId = data.timeoutId;
16147
+ if (timeoutId != null) {
16148
+ data.timeoutId = undefined;
16149
+ window.clearTimeout(timeoutId);
16150
+ }
16151
+ if (data.distance < this._threshold.distance) {
16152
+ var onTap = this._onTap;
16153
+ if (onTap) {
16154
+ onTap(target, e);
16155
+ }
16105
16156
  }
16106
16157
  };
16107
16158
  UtilGestureTap.prototype.stop = function (target) {
@@ -16214,7 +16265,7 @@
16214
16265
  UtilGesture.prototype.onDown = function (target, e) {
16215
16266
  var _a;
16216
16267
  if (this._touch && !this.isTouch(e)) {
16217
- return this._tap.onDown(target, e);
16268
+ return;
16218
16269
  }
16219
16270
  if (!this._checkerStart(e, this._modifier, target)) {
16220
16271
  return this._tap.onDown(target, e);
@@ -16249,6 +16300,8 @@
16249
16300
  }
16250
16301
  // Event handler
16251
16302
  data.bind(e);
16303
+ // Tap
16304
+ this._tap.start(target, data, e);
16252
16305
  }
16253
16306
  };
16254
16307
  UtilGesture.prototype.newOnMove = function (data) {
@@ -16437,6 +16490,9 @@
16437
16490
  },
16438
16491
  tap: function (target, e) {
16439
16492
  _this.onTap(target, e);
16493
+ },
16494
+ longpress: function (target, e) {
16495
+ _this.onLongPress(target, e);
16440
16496
  }
16441
16497
  }
16442
16498
  });
@@ -16459,6 +16515,10 @@
16459
16515
  var parent = this._parent;
16460
16516
  parent.emit("gesturetap", target, e, parent);
16461
16517
  };
16518
+ DViewGestureImpl.prototype.onLongPress = function (target, e) {
16519
+ var parent = this._parent;
16520
+ parent.emit("gesturelongpress", target, e, parent);
16521
+ };
16462
16522
  DViewGestureImpl.prototype.onGestureMove = function (target, dx, dy, x, y, ds, work) {
16463
16523
  if (target != null) {
16464
16524
  // Scale
@@ -62862,6 +62922,9 @@
62862
62922
  _this._onTapBound = function (target, e) {
62863
62923
  _this.onTap(e);
62864
62924
  };
62925
+ _this._onLongPressBound = function (target, e) {
62926
+ _this.onLongPress(e);
62927
+ };
62865
62928
  return _this;
62866
62929
  }
62867
62930
  DChartSelectionSimple.prototype.toDismiss = function (options) {
@@ -62869,13 +62932,31 @@
62869
62932
  if (options != null) {
62870
62933
  var dismiss = options.dismiss;
62871
62934
  if (dismiss != null) {
62872
- if (dismiss.enable === false) {
62873
- return undefined;
62874
- }
62875
- return toEnum((_a = dismiss.modifier) !== null && _a !== void 0 ? _a : UtilGestureModifier.NOT_NONE, UtilGestureModifier);
62935
+ return {
62936
+ enable: (_a = dismiss.enable) !== null && _a !== void 0 ? _a : true,
62937
+ tap: this.toDismissTap(dismiss.tap),
62938
+ longPress: this.toDismissLongPress(dismiss.longPress)
62939
+ };
62876
62940
  }
62877
62941
  }
62878
- return UtilGestureModifier.NOT_NONE;
62942
+ return {
62943
+ enable: true,
62944
+ tap: this.toDismissTap(),
62945
+ longPress: this.toDismissLongPress()
62946
+ };
62947
+ };
62948
+ DChartSelectionSimple.prototype.toDismissTap = function (options) {
62949
+ var _a, _b;
62950
+ return {
62951
+ enable: (_a = options === null || options === void 0 ? void 0 : options.enable) !== null && _a !== void 0 ? _a : true,
62952
+ modifier: toEnum((_b = options === null || options === void 0 ? void 0 : options.modifier) !== null && _b !== void 0 ? _b : UtilGestureModifier.NOT_NONE, UtilGestureModifier)
62953
+ };
62954
+ };
62955
+ DChartSelectionSimple.prototype.toDismissLongPress = function (options) {
62956
+ var _a;
62957
+ return {
62958
+ enable: (_a = options === null || options === void 0 ? void 0 : options.enable) !== null && _a !== void 0 ? _a : true
62959
+ };
62879
62960
  };
62880
62961
  DChartSelectionSimple.prototype.newSelected = function (point, options) {
62881
62962
  return new DChartSelectionSubImpl(this.toSelectedOptions(point, options));
@@ -62929,7 +63010,9 @@
62929
63010
  }
62930
63011
  var dismiss = this._dismiss;
62931
63012
  var selected = this._selected;
62932
- if (dismiss != null && UtilGestureModifiers.match(e, dismiss)) {
63013
+ if (dismiss.enable &&
63014
+ dismiss.tap.enable &&
63015
+ UtilGestureModifiers.match(e, dismiss.tap.modifier)) {
62933
63016
  selected.unset();
62934
63017
  }
62935
63018
  else {
@@ -62944,6 +63027,16 @@
62944
63027
  }
62945
63028
  }
62946
63029
  };
63030
+ DChartSelectionSimple.prototype.onLongPress = function (e) {
63031
+ var container = this._container;
63032
+ if (container == null) {
63033
+ return;
63034
+ }
63035
+ var dismiss = this._dismiss;
63036
+ if (dismiss.enable && dismiss.longPress.enable) {
63037
+ this._selected.unset();
63038
+ }
63039
+ };
62947
63040
  DChartSelectionSimple.prototype.onMove = function (e) {
62948
63041
  var container = this._container;
62949
63042
  if (container == null) {
@@ -62974,16 +63067,20 @@
62974
63067
  this._selected.bind(container);
62975
63068
  this._hovered.bind(container);
62976
63069
  var plotArea = container.plotArea;
63070
+ var plotAreaView = plotArea.view;
62977
63071
  plotArea.on(UtilPointerEvent.move, this._onMoveBound);
62978
- plotArea.view.on("gesturetap", this._onTapBound);
63072
+ plotAreaView.on("gesturetap", this._onTapBound);
63073
+ plotAreaView.on("gesturelongpress", this._onLongPressBound);
62979
63074
  };
62980
63075
  DChartSelectionSimple.prototype.unbind = function () {
62981
63076
  var container = this._container;
62982
63077
  this._container = null;
62983
63078
  if (container != null) {
62984
63079
  var plotArea = container.plotArea;
63080
+ var plotAreaView = plotArea.view;
62985
63081
  plotArea.off(UtilPointerEvent.move, this._onMoveBound);
62986
- plotArea.view.off("gesturetap", this._onTapBound);
63082
+ plotAreaView.off("gesturetap", this._onTapBound);
63083
+ plotAreaView.off("gesturelongpress", this._onLongPressBound);
62987
63084
  }
62988
63085
  this._selected.unbind();
62989
63086
  this._hovered.unbind();