pixuireactcomponents 1.2.32 → 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 +2 -1
- package/index.js +1 -0
- package/package.json +1 -1
- package/ui/components/outlinetext/OutlineText.js +43 -43
- package/ui/components/slapface/Slapface.d.ts +1 -1
- package/ui/components/slapface/Slapface.js +22 -17
- package/ui/components/slapface/{less/Slapface.less → Slapface.less} +3 -8
- package/ui/components/slider/Slider.js +2 -2
- package/ui/components/togglegroup/ToggleGroup.d.ts +13 -0
- package/ui/components/togglegroup/ToggleGroup.js +99 -0
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 {
|
|
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,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
4
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
9
|
-
if (typeof b !==
|
|
10
|
-
throw new TypeError(
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
11
|
extendStatics(d, b);
|
|
12
12
|
function __() { this.constructor = d; }
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -16,65 +16,65 @@ let __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
import { Component, h } from 'preact';
|
|
17
17
|
export var FontStyle;
|
|
18
18
|
(function (FontStyle) {
|
|
19
|
-
FontStyle[FontStyle[
|
|
20
|
-
FontStyle[FontStyle[
|
|
21
|
-
FontStyle[FontStyle[
|
|
22
|
-
FontStyle[FontStyle[
|
|
19
|
+
FontStyle[FontStyle["Normal"] = 0] = "Normal";
|
|
20
|
+
FontStyle[FontStyle["Bold"] = 1] = "Bold";
|
|
21
|
+
FontStyle[FontStyle["Italic"] = 2] = "Italic";
|
|
22
|
+
FontStyle[FontStyle["BoldAndItalic"] = 3] = "BoldAndItalic";
|
|
23
23
|
})(FontStyle || (FontStyle = {}));
|
|
24
24
|
export var TextAnchor;
|
|
25
25
|
(function (TextAnchor) {
|
|
26
|
-
TextAnchor[TextAnchor[
|
|
27
|
-
TextAnchor[TextAnchor[
|
|
28
|
-
TextAnchor[TextAnchor[
|
|
29
|
-
TextAnchor[TextAnchor[
|
|
30
|
-
TextAnchor[TextAnchor[
|
|
31
|
-
TextAnchor[TextAnchor[
|
|
32
|
-
TextAnchor[TextAnchor[
|
|
33
|
-
TextAnchor[TextAnchor[
|
|
34
|
-
TextAnchor[TextAnchor[
|
|
26
|
+
TextAnchor[TextAnchor["UpperLeft"] = 0] = "UpperLeft";
|
|
27
|
+
TextAnchor[TextAnchor["UpperCenter"] = 1] = "UpperCenter";
|
|
28
|
+
TextAnchor[TextAnchor["UpperRight"] = 2] = "UpperRight";
|
|
29
|
+
TextAnchor[TextAnchor["MiddleLeft"] = 3] = "MiddleLeft";
|
|
30
|
+
TextAnchor[TextAnchor["MiddleCenter"] = 4] = "MiddleCenter";
|
|
31
|
+
TextAnchor[TextAnchor["MiddleRight"] = 5] = "MiddleRight";
|
|
32
|
+
TextAnchor[TextAnchor["LowerLeft"] = 6] = "LowerLeft";
|
|
33
|
+
TextAnchor[TextAnchor["LowerCenter"] = 7] = "LowerCenter";
|
|
34
|
+
TextAnchor[TextAnchor["LowerRight"] = 8] = "LowerRight";
|
|
35
35
|
})(TextAnchor || (TextAnchor = {}));
|
|
36
36
|
export var HorizontalWrapMode;
|
|
37
37
|
(function (HorizontalWrapMode) {
|
|
38
|
-
HorizontalWrapMode[HorizontalWrapMode[
|
|
39
|
-
HorizontalWrapMode[HorizontalWrapMode[
|
|
38
|
+
HorizontalWrapMode[HorizontalWrapMode["Wrap"] = 0] = "Wrap";
|
|
39
|
+
HorizontalWrapMode[HorizontalWrapMode["Overflow"] = 1] = "Overflow";
|
|
40
40
|
})(HorizontalWrapMode || (HorizontalWrapMode = {}));
|
|
41
41
|
export var VerticalWrapMode;
|
|
42
42
|
(function (VerticalWrapMode) {
|
|
43
|
-
VerticalWrapMode[VerticalWrapMode[
|
|
44
|
-
VerticalWrapMode[VerticalWrapMode[
|
|
43
|
+
VerticalWrapMode[VerticalWrapMode["Truncate"] = 0] = "Truncate";
|
|
44
|
+
VerticalWrapMode[VerticalWrapMode["Overflow"] = 1] = "Overflow";
|
|
45
45
|
})(VerticalWrapMode || (VerticalWrapMode = {}));
|
|
46
|
-
|
|
46
|
+
var defaultStyle = {
|
|
47
47
|
width: 200,
|
|
48
48
|
height: 200
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
var OutlineText = /** @class */ (function (_super) {
|
|
51
51
|
__extends(OutlineText, _super);
|
|
52
52
|
function OutlineText(props) {
|
|
53
|
-
|
|
53
|
+
var _this = _super.call(this, props) || this;
|
|
54
54
|
_this.OnLoad = function (e) {
|
|
55
55
|
console.log('!!!!!!!!!!!!!!');
|
|
56
56
|
if (!window.require) {
|
|
57
57
|
console.error('need puerts env');
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
var CS = window.require('csharp');
|
|
60
60
|
if (!CS) {
|
|
61
61
|
console.error('need puerts env');
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
var puerts = window.require('puerts');
|
|
65
65
|
console.log('?????');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
var windowId = window.external.id;
|
|
67
|
+
var handle = e.target.attachment.handle;
|
|
68
|
+
var attachment = CS.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
|
|
69
69
|
if (!attachment) {
|
|
70
70
|
console.error("can't get relected attachment, handle:".concat(handle));
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
console.log('windowId:' + windowId.toString() + ' handle:' + handle.toString());
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
var placeholder = attachment.GetMountingGameObject();
|
|
75
|
+
var text = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
|
|
76
76
|
_this.text = text;
|
|
77
|
-
|
|
77
|
+
var outline = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Outline));
|
|
78
78
|
_this.outline = outline;
|
|
79
79
|
_this.updateOutlineText();
|
|
80
80
|
};
|
|
@@ -86,20 +86,20 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
86
86
|
};
|
|
87
87
|
OutlineText.prototype.colorRgb = function (colorStr) {
|
|
88
88
|
//十六进制颜色值的正则表达式
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
var reg = /^#([0-9a-fA-f]{0,}|)$/;
|
|
90
|
+
var matchRes = colorStr.toString().toLowerCase().match(reg);
|
|
91
|
+
var transColor = '';
|
|
92
92
|
if (matchRes.length > 0)
|
|
93
93
|
transColor = matchRes[matchRes.length - 1];
|
|
94
94
|
// eslint-disable-next-line @typescript-eslint/no-array-constructor
|
|
95
|
-
|
|
95
|
+
var colorList = new Array();
|
|
96
96
|
while (transColor != '') {
|
|
97
|
-
|
|
97
|
+
var hex = '0x' + transColor.substring(0, 2);
|
|
98
98
|
colorList.push(parseInt(hex, 16));
|
|
99
99
|
transColor = transColor.substring(2, transColor.length);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
for (
|
|
101
|
+
var r, g, b, a = 1;
|
|
102
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
103
103
|
if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
|
|
104
104
|
r = colorList[i] / 255;
|
|
105
105
|
}
|
|
@@ -113,11 +113,11 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
113
113
|
a = colorList[i] / 255;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
var CS = window.require('csharp');
|
|
117
117
|
return CS.UnityEngine.Color(r, g, b, a);
|
|
118
118
|
};
|
|
119
119
|
OutlineText.prototype.updateOutlineText = function () {
|
|
120
|
-
|
|
120
|
+
var CS = window.require('csharp');
|
|
121
121
|
this.text.text = this.props.text;
|
|
122
122
|
this.text.font = CS.com.tencent.pandora.TextPartner.GetFont.Invoke(this.props.font);
|
|
123
123
|
this.text.fontStyle = this.props.fontStyle;
|
|
@@ -132,8 +132,8 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
132
132
|
this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
|
|
133
133
|
};
|
|
134
134
|
OutlineText.prototype.render = function () {
|
|
135
|
-
return (h(
|
|
136
|
-
h(
|
|
135
|
+
return (h("div", { style: this.props.style },
|
|
136
|
+
h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
|
|
137
137
|
};
|
|
138
138
|
OutlineText.defaultProps = {
|
|
139
139
|
style: defaultStyle,
|
|
@@ -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;
|
|
@@ -26,7 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
26
26
|
};
|
|
27
27
|
import { h, Component } from "preact";
|
|
28
28
|
//@ts-ignore
|
|
29
|
-
import SlapfaceLess from "./
|
|
29
|
+
import SlapfaceLess from "./Slapface.less";
|
|
30
30
|
//默认配置项
|
|
31
31
|
var settingsitems = {
|
|
32
32
|
ani_switch_type: 1,
|
|
@@ -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'
|
|
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; },
|
|
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.
|
|
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,
|
|
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
|
|
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
|
-
|
|
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,13 +66,6 @@
|
|
|
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;
|
|
@@ -142,8 +142,8 @@ var Slider = /** @class */ (function (_super) {
|
|
|
142
142
|
_this.setState({
|
|
143
143
|
percent: _this.state.percent - 1
|
|
144
144
|
}, function () {
|
|
145
|
-
if (_this.props.
|
|
146
|
-
_this.props.
|
|
145
|
+
if (_this.props.onDecClick) {
|
|
146
|
+
_this.props.onDecClick(_this.state.percent);
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
}
|
|
@@ -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));
|