esoftplay-event 0.0.2-t → 0.0.2-u
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/event/htmltext.tsx +40 -28
- package/event/message.tsx +2 -2
- package/event/order_detail.tsx +37 -547
- package/event/order_detail_addons.tsx +60 -0
- package/event/order_detail_addons_booked.tsx +61 -0
- package/event/order_detail_coupon.tsx +66 -0
- package/event/order_detail_instruction.tsx +96 -0
- package/event/order_detail_payment.tsx +1 -1
- package/event/order_detail_reschedule.tsx +109 -0
- package/event/order_detail_return.tsx +1 -1
- package/event/order_detail_review.tsx +174 -0
- package/event/order_detail_tnc.tsx +76 -0
- package/event/review_add.tsx +2 -2
- package/event/seat.tsx +130 -378
- package/event/seat_map.tsx +8 -8
- package/event/seat_map_new.tsx +191 -24
- package/event/test.tsx +8 -8
- package/id.json +9 -0
- package/package.json +1 -1
package/event/htmltext.tsx
CHANGED
|
@@ -9,15 +9,11 @@ export interface EventHtmltextProps extends TextProps {
|
|
|
9
9
|
export default function m({ style, children, ...props }: EventHtmltextProps): JSX.Element {
|
|
10
10
|
const renderChildren = (child: ReactNode) => {
|
|
11
11
|
if (typeof child === 'string') {
|
|
12
|
-
return
|
|
12
|
+
return parseRecursive(child).map((part, index) => (
|
|
13
13
|
<Text key={index} style={[style, part.style]}>
|
|
14
|
-
{part.
|
|
14
|
+
{part.children}
|
|
15
15
|
</Text>
|
|
16
16
|
));
|
|
17
|
-
} else if (React.isValidElement(child)) {
|
|
18
|
-
return React.cloneElement(child, {
|
|
19
|
-
style: [style, child.props.style], // Merge styles properly
|
|
20
|
-
});
|
|
21
17
|
} else if (Array.isArray(child)) {
|
|
22
18
|
return child.map((nestedChild, index) => (
|
|
23
19
|
<React.Fragment key={index}>{renderChildren(nestedChild)}</React.Fragment>
|
|
@@ -29,32 +25,48 @@ export default function m({ style, children, ...props }: EventHtmltextProps): JS
|
|
|
29
25
|
return <Text {...props}>{renderChildren(children)}</Text>;
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
interface ParsedPart {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
style: TextStyle;
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
33
|
+
const parseRecursive = (htmlString: string): ParsedPart[] => {
|
|
34
|
+
const regex = /<(b|i|u|span|br)(?:\s+style=["']color:\s*(.*?)["'])?\s*>(.*?)<\/\1>|<br\s*\/?>/i;
|
|
35
|
+
const match = htmlString.match(regex);
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
parts.push({ text: '\n', style: {} });
|
|
50
|
-
}
|
|
37
|
+
if (!match) {
|
|
38
|
+
return [{ children: htmlString, style: {} }];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const parts: ParsedPart[] = [];
|
|
42
|
+
const [fullMatch, tag, color, content] = match;
|
|
43
|
+
const index = match.index!;
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
45
|
+
if (index > 0) {
|
|
46
|
+
parts.push({ children: htmlString.substring(0, index), style: {} });
|
|
47
|
+
}
|
|
48
|
+
let currentStyle: TextStyle = {};
|
|
49
|
+
switch (tag?.toLowerCase()) {
|
|
50
|
+
case 'b': currentStyle.fontWeight = 'bold'; break;
|
|
51
|
+
case 'i': currentStyle.fontStyle = 'italic'; break;
|
|
52
|
+
case 'u': currentStyle.textDecorationLine = 'underline'; break;
|
|
53
|
+
case 'span': if (color) currentStyle.color = color.trim(); break;
|
|
54
|
+
case 'br':
|
|
55
|
+
parts.push({ children: '\n', style: {} });
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (tag !== 'br' && content !== undefined) {
|
|
60
|
+
const nestedParts = parseRecursive(content).map(p => ({
|
|
61
|
+
...p,
|
|
62
|
+
style: { ...currentStyle, ...p.style }
|
|
63
|
+
}));
|
|
64
|
+
parts.push(...nestedParts);
|
|
65
|
+
}
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
const remaining = htmlString.substring(index + fullMatch.length);
|
|
68
|
+
if (remaining) {
|
|
69
|
+
parts.push(...parseRecursive(remaining));
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
return parts;
|
package/event/message.tsx
CHANGED
|
@@ -21,8 +21,8 @@ export default function m(props: EventMessageProps): any {
|
|
|
21
21
|
return (
|
|
22
22
|
<View style={[{ flex: 1, alignItems: 'center', justifyContent: 'center' }, props.style]}>
|
|
23
23
|
<View style={{ justifyContent: 'center', alignItems: 'center', padding: 10 }}>
|
|
24
|
-
<LibPicture source={esp.assets('img_failed_msg.png')} style={{ width: LibStyle.width * 0.8, height:
|
|
25
|
-
<View style={{ width: LibStyle.width - 40, justifyContent: 'center', alignItems: 'center', padding:
|
|
24
|
+
<LibPicture source={esp.assets('img_failed_msg.png')} style={{ width: LibStyle.width * 0.8, height: 150, resizeMode: 'contain' }} />
|
|
25
|
+
<View style={{ width: LibStyle.width - 40, justifyContent: 'center', alignItems: 'center', padding: 10, borderRadius: 10, marginTop: 10 }}>
|
|
26
26
|
<Text allowFontScaling={false} style={[{ flexWrap: 'wrap', fontSize: 14, lineHeight: 20, fontWeight: "bold", marginBottom: 5, color: "#4a4a4a", textAlign: "center" }, props.textStyle]}>{props.message}</Text>
|
|
27
27
|
</View>
|
|
28
28
|
</View>
|