pixuireactcomponents 1.2.33 → 1.2.34

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/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { Tabs } from "./ui/components/tab/Tabs";
2
2
  export { Tab } from "./ui/components/tab/Tab";
3
3
  export { Slider } from "./ui/components/slider/Slider";
4
4
  export { Progress } from "./ui/components/progress/Progress";
5
+ export { Dropdown } from "./ui/components/dropdown/Dropdown";
5
6
  export { DropdownOptionUI } from "./ui/components/dropdown/DropdownOptionUI";
6
7
  export { DropdownSpreadMainUI } from "./ui/components/dropdown/DropdownSpreadMainUI";
7
8
  export { DropdownUnspreadMainUI } from "./ui/components/dropdown/DropdownUnspreadMainUI";
@@ -12,4 +13,4 @@ export { EventDispatcherJs } from "./tools/EventDispatcherJs";
12
13
  export { Carousel } from "./ui/components/carousel/Carousel";
13
14
  export { Slapface } from "./ui/components/slapface/Slapface";
14
15
  export { Button } from "./ui/components/button/Button";
15
- export { Dropdown, DropdownConfig } from "./ui/components/dropdown/Dropdown";
16
+ export { ToggleGroup } from "./ui/components/togglegroup/ToggleGroup";
package/index.js CHANGED
@@ -13,4 +13,5 @@ export { EventDispatcherJs } from "./tools/EventDispatcherJs";
13
13
  export { Carousel } from "./ui/components/carousel/Carousel";
14
14
  export { Slapface } from "./ui/components/slapface/Slapface";
15
15
  export { Button } from "./ui/components/button/Button";
16
+ export { ToggleGroup } from "./ui/components/togglegroup/ToggleGroup";
16
17
  console.log("Hello, 欢迎使用PixUI React Components");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,11 +1,11 @@
1
1
  import { h, Component } from "preact";
2
2
  export declare class Slapface extends Component<any, any> {
3
3
  private LoadGroup;
4
- private jumpButton;
5
4
  private settingsitems;
6
5
  private btn_closeButton;
7
6
  private pic_loading;
8
7
  private actDisplay;
8
+ private jumpFun;
9
9
  closeAct: () => void;
10
10
  constructor(props: any);
11
11
  render(): h.JSX.Element;
@@ -36,7 +36,9 @@ var settingsitems = {
36
36
  var jumpButton = {
37
37
  pic_changtai: '',
38
38
  pic_yaxia: '',
39
- pic_xuanfu: ''
39
+ pic_xuanfu: '',
40
+ rightPos: 0,
41
+ bottomPos: 0
40
42
  };
41
43
  var slapfaceNode = /** @class */ (function () {
42
44
  function slapfaceNode(par_index) {
@@ -105,23 +107,22 @@ var Slapface = /** @class */ (function (_super) {
105
107
  for (var i = 0; i < _this.LoadGroup.length; i++) {
106
108
  _this.LoadGroup[i].isLoadDone = false;
107
109
  }
108
- _this.jumpButton = _this.props.jumpButton ? _this.props.jumpButton : jumpButton;
109
110
  _this.settingsitems = _this.props.settingsitems ? _this.props.settingsitems : settingsitems;
110
111
  _this.btn_closeButton = _this.props.btn_closeButton ? _this.props.btn_closeButton : '';
111
112
  _this.pic_loading = _this.props.pic_loading;
112
113
  _this.actDisplay = "flex";
114
+ _this.jumpFun = props.jumpFun;
113
115
  return _this;
114
116
  }
115
117
  Slapface.prototype.render = function () {
116
118
  var slapfaceinfo = {
117
119
  LoadGroup: this.LoadGroup,
118
- jumpButton: this.jumpButton,
119
120
  settingsitems: this.settingsitems,
120
121
  btn_closeButton: this.btn_closeButton,
121
122
  pic_loading: this.pic_loading
122
123
  };
123
124
  return (h("div", { style: { display: this.actDisplay, width: "100%", height: "100%" } },
124
- h("div", { style: { width: '100%', height: '100%', backgroundColor: "rgba(0,0,0,0.5)" } }, h(Group, __assign({}, slapfaceinfo, { closeAct: this.closeAct })))));
125
+ h("div", { style: { width: '100%', height: '100%', backgroundColor: "rgba(0,0,0,0.5)" } }, h(Group, __assign({}, slapfaceinfo, { closeAct: this.closeAct, jumpFun: this.jumpFun })))));
125
126
  };
126
127
  return Slapface;
127
128
  }(Component));
@@ -135,11 +136,13 @@ var Group = /** @class */ (function (_super) {
135
136
  isLoadDone: false,
136
137
  picture: "",
137
138
  width: 0,
138
- height: 0
139
+ height: 0,
140
+ jumpButton: jumpButton,
139
141
  }
140
142
  ];
141
143
  _this.groupArr = emptyGroup.concat(_this.props.LoadGroup);
142
144
  _this.groupIndexList = new slapfaceNodeList(_this.groupArr);
145
+ _this.jumpFun = props.jumpFun;
143
146
  _this.loadDisplay = "hidden";
144
147
  _this.elseDisplay = "visible";
145
148
  _this.firstFrameDisplay = "none";
@@ -175,14 +178,12 @@ var Group = /** @class */ (function (_super) {
175
178
  Group.prototype.closeClick = function (e) {
176
179
  e === null || e === void 0 ? void 0 : e.stopPropagation();
177
180
  var nextIndex = this.groupIndexList.CheckReady();
178
- // setTimeout(() => {
179
- // this.loadDisplay = "visible"
180
- // }, 50);
181
181
  this.loadDisplay = "visible";
182
182
  this.elseDisplay = "hidden";
183
183
  if (nextIndex != -1) {
184
184
  if (this.props.settingsitems.ani_switch_type == 2) {
185
- this.picBack.className = SlapfaceLess.groupBack;
185
+ // this.picBack.className = SlapfaceLess.groupBack
186
+ this.picBack.className = SlapfaceLess.groupBackReverse;
186
187
  }
187
188
  this.setState({ curIndex: nextIndex });
188
189
  }
@@ -195,18 +196,20 @@ var Group = /** @class */ (function (_super) {
195
196
  if (this.state.curIndex == -1) {
196
197
  this.setState({ curIndex: this.groupIndexList.CheckReady() });
197
198
  }
198
- return (h("div", { style: { width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', position: 'absolute' } },
199
+ return (h("div", { style: { width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center' } },
199
200
  h("div", { onClick: function () { if (_this.props.settingsitems.is_mask == false)
200
201
  return; _this.closeClick(); }, style: { position: "absolute", width: "100%", height: "100%" } }),
201
- h("div", { ref: function (div) { _this.picBack = div; }, style: { position: "absolute" }, onAnimationEnd: function () { setTimeout(function () { _this.picBack.className = SlapfaceLess.groupBackReverse; }, 0); } },
202
+ h("div", { ref: function (div) { _this.picBack = div; }, style: { position: "relative" } },
202
203
  h("img", { src: this.groupArr[this.state.curIndex].picture, style: { visibility: this.elseDisplay, width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height }, onLoad: function () { var curIndex = _this.state.curIndex; if (!_this.groupArr[curIndex].isLoadDone) {
203
204
  _this.groupArr[curIndex].isLoadDone = true;
204
205
  _this.loadDisplay = "hidden";
205
206
  _this.elseDisplay = "visible";
207
+ if (_this.props.settingsitems.ani_switch_type == 2)
208
+ _this.picBack.className = SlapfaceLess.groupBack;
206
209
  _this.forceUpdate();
207
210
  } } }),
208
211
  h(CloseButton, { firstFrameDisplay: this.firstFrameDisplay, btn_closeButton: this.props.btn_closeButton, elseDisplay: this.elseDisplay, onClick: function (e) { _this.closeClick(e); } }),
209
- h(JumpButton, { firstFrameDisplay: this.firstFrameDisplay, elseDisplay: this.elseDisplay, jumpButton: this.props.jumpButton })),
212
+ h(JumpButton, { firstFrameDisplay: this.firstFrameDisplay, elseDisplay: this.elseDisplay, jumpButton: this.groupArr[this.state.curIndex].jumpButton, jumpFun: function () { _this.jumpFun(_this.state.curIndex); } })),
210
213
  h("div", { ref: function (div) { _this.loadPic = div; }, className: SlapfaceLess.loading_anim, style: { backgroundImage: "url(".concat(this.props.pic_loading, ")"), width: "300px", height: "300px", position: "absolute", visibility: this.loadDisplay } }, " ")));
211
214
  };
212
215
  return Group;
@@ -217,18 +220,20 @@ var CloseButton = /** @class */ (function (_super) {
217
220
  return _super !== null && _super.apply(this, arguments) || this;
218
221
  }
219
222
  CloseButton.prototype.render = function () {
220
- return (h("button", { className: SlapfaceLess.closeButton, style: { display: this.props.firstFrameDisplay, visibility: this.props.elseDisplay, backgroundSize: "contain", backgroundImage: "url(".concat(this.props.btn_closeButton, ")") }, onClick: this.props.onClick }));
223
+ return (h("button", { className: SlapfaceLess.closeButton, style: { display: this.props.firstFrameDisplay, visibility: this.props.elseDisplay, backgroundImage: "url(".concat(this.props.btn_closeButton, ")") }, onClick: this.props.onClick }));
221
224
  };
222
225
  return CloseButton;
223
226
  }(Component));
224
227
  var JumpButton = /** @class */ (function (_super) {
225
228
  __extends(JumpButton, _super);
226
- function JumpButton() {
227
- return _super !== null && _super.apply(this, arguments) || this;
229
+ function JumpButton(props) {
230
+ return _super.call(this, props) || this;
228
231
  }
229
232
  JumpButton.prototype.render = function () {
230
233
  var _this = this;
231
- return (h("div", { className: SlapfaceLess.jumpButton, style: { display: this.props.firstFrameDisplay, visibility: this.props.elseDisplay }, onMouseDown: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_yaxia; }, onMouseUp: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOver: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOut: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_changtai; } },
234
+ if (!this.props.jumpButton)
235
+ return;
236
+ return (h("div", { onClick: function () { _this.props.jumpFun(); }, style: { display: this.props.firstFrameDisplay, visibility: this.props.elseDisplay, position: "absolute", bottom: "".concat(this.props.jumpButton.bottomPos, "px"), right: "".concat(this.props.jumpButton.rightPos, "px") }, onMouseDown: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_yaxia; _this.forceUpdate(); }, onMouseUp: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; _this.forceUpdate(); } },
232
237
  h("img", { ref: function (img) { _this.jumpbtnImg = img; }, src: this.props.jumpButton.pic_changtai })));
233
238
  };
234
239
  return JumpButton;
@@ -13,9 +13,11 @@
13
13
  .closeButton{
14
14
  width:36px;
15
15
  height:36px;
16
- background-size: contain;
17
16
  /* float: left; */
18
17
  position: absolute;
18
+ // background-position: center;
19
+ background-repeat: no-repeat;
20
+ background-size: contain;
19
21
  right:0px;
20
22
  top:0px;
21
23
  }
@@ -64,19 +66,12 @@
64
66
  bottom:0px;
65
67
  }
66
68
 
67
- .jumpButton{
68
- position: absolute;
69
- right:50%;
70
- bottom:10%;
71
- /* top:80%; */
72
- transform: translate(50%, -50%);
73
- }
74
69
  .slapImage{
75
70
  box-sizing: content-box;
76
71
  /* border-width: 5px;
77
72
  border-color: black;
78
73
  border-style: solid; */
79
- position: relative;
74
+ position: absolute;
80
75
  left:50%;
81
76
  top:50%;
82
77
  transform:translate(-50%,-50%);
@@ -0,0 +1,13 @@
1
+ import { h, Component } from "preact";
2
+ export declare class ToggleGroup extends Component<any, any> {
3
+ private isMultiOption;
4
+ private toggleArray;
5
+ private togglePic;
6
+ private currentIndex;
7
+ private items;
8
+ private refreshAll;
9
+ private GenerateToggleItem;
10
+ private checkSelected;
11
+ constructor(props: any);
12
+ render(props: any): h.JSX.Element;
13
+ }
@@ -0,0 +1,99 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import { h, Component } from "preact";
17
+ var ToggleGroup = /** @class */ (function (_super) {
18
+ __extends(ToggleGroup, _super);
19
+ function ToggleGroup(props) {
20
+ var _this = _super.call(this, props) || this;
21
+ _this.GenerateToggleItem = function (toggleItem, togglePic, index, refreshAll) {
22
+ return h(Toggle, { toggleText: toggleItem.toggleText, selectedFun: toggleItem.selectedFun, notSelectedFun: toggleItem.notSelectedFun, isSelected: toggleItem.isSelected, selected_pic: togglePic.selected_pic, not_selected_pic: togglePic.not_selected_pic, index: index, checkSelected: _this.checkSelected, refreshAll: _this.refreshAll });
23
+ };
24
+ _this.checkSelected = function (index) {
25
+ if (_this.isMultiOption)
26
+ return;
27
+ else {
28
+ if (index == _this.currentIndex) {
29
+ _this.toggleArray[index].isSelected = false;
30
+ _this.currentIndex = -1;
31
+ }
32
+ else {
33
+ if (_this.currentIndex == -1) {
34
+ _this.currentIndex = index;
35
+ _this.toggleArray[index].isSelected = true;
36
+ return;
37
+ }
38
+ _this.refreshAll = !_this.refreshAll;
39
+ _this.toggleArray[_this.currentIndex].isSelected = false;
40
+ _this.toggleArray[_this.currentIndex].notSelectedFun();
41
+ _this.toggleArray[index].isSelected = true;
42
+ _this.currentIndex = index;
43
+ _this.items = [];
44
+ _this.forceUpdate();
45
+ }
46
+ }
47
+ };
48
+ _this.toggleArray = props.toggleArray;
49
+ for (var i = 0; i < _this.toggleArray.length; i++) {
50
+ _this.toggleArray[i].isSelected = false;
51
+ }
52
+ _this.togglePic = props.togglePic;
53
+ _this.isMultiOption = props.isMultiOption != undefined ? props.isMultiOption : true;
54
+ _this.currentIndex = -1;
55
+ _this.refreshAll = true;
56
+ _this.items = [];
57
+ return _this;
58
+ }
59
+ ToggleGroup.prototype.render = function (props) {
60
+ for (var i = 0; i < this.toggleArray.length; i++) {
61
+ this.items.push(this.GenerateToggleItem(this.toggleArray[i], this.togglePic, i, this.refreshAll));
62
+ }
63
+ return (h("div", { style: { flexDirection: "row" } }, this.items));
64
+ };
65
+ return ToggleGroup;
66
+ }(Component));
67
+ export { ToggleGroup };
68
+ var Toggle = /** @class */ (function (_super) {
69
+ __extends(Toggle, _super);
70
+ function Toggle(props) {
71
+ var _this = _super.call(this, props) || this;
72
+ _this.selected_pic = props.selected_pic;
73
+ _this.not_selected_pic = props.not_selected_pic;
74
+ _this.toggleText = props.toggleText;
75
+ _this.selectedFun = props.selectedFun;
76
+ _this.notSelectedFun = props.notSelectedFun;
77
+ _this.index = props.index;
78
+ _this.checkSelected = props.checkSelected;
79
+ _this.refreshAll = props.refreshAll;
80
+ _this.state = {
81
+ isSelected: props.isSelected
82
+ };
83
+ return _this;
84
+ }
85
+ Toggle.prototype.render = function (props) {
86
+ var _this = this;
87
+ if (props.refreshAll != this.refreshAll && props.isSelected != this.state.isSelected) {
88
+ this.setState({ isSelected: !this.state.isSelected });
89
+ return;
90
+ }
91
+ this.refreshAll = props.refreshAll;
92
+ return (h("div", { style: { alignItems: "flex-end", flexDirection: "row" } },
93
+ h("div", { style: { width: "36px", height: "36px", backgroundSize: "contain", backgroundImage: "url(".concat(this.state.isSelected ? this.selected_pic : this.not_selected_pic, ")") }, onClick: function () { _this.state.isSelected ? _this.notSelectedFun() : _this.selectedFun(); _this.setState({ isSelected: !_this.state.isSelected }); _this.checkSelected(_this.index); } }),
94
+ h("div", null,
95
+ h("text", null, "".concat(this.toggleText))),
96
+ h("div", { style: { width: "50px" } })));
97
+ };
98
+ return Toggle;
99
+ }(Component));