esoftplay 0.0.113 → 0.0.114

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 (40) hide show
  1. package/bin/build.js +14 -29
  2. package/bin/cli.js +8 -7
  3. package/bin/router.js +2 -0
  4. package/error.ts +16 -12
  5. package/esp.ts +26 -3
  6. package/modules/lib/curl.ts +27 -7
  7. package/modules/lib/datepicker.tsx +4 -5
  8. package/modules/lib/document.ts +1 -1
  9. package/modules/{content → lib}/gallery.tsx +3 -3
  10. package/modules/lib/image.tsx +2 -2
  11. package/modules/lib/infinite.tsx +4 -3
  12. package/modules/lib/roll.tsx +1 -1
  13. package/modules/lib/scrollpicker.tsx +219 -0
  14. package/modules/lib/timepicker.tsx +5 -6
  15. package/modules/{content → lib}/video.tsx +3 -3
  16. package/modules/lib/worker.tsx +4 -4
  17. package/modules/lib/workloop.tsx +1 -0
  18. package/modules/lib/workview.tsx +1 -1
  19. package/modules/main/index.tsx +19 -0
  20. package/modules/use/curl.ts +1 -1
  21. package/modules/user/class.ts +1 -1
  22. package/modules/user/index.tsx +19 -8
  23. package/modules/user/login.tsx +1 -1
  24. package/package.json +1 -1
  25. package/modules/content/audio.tsx +0 -126
  26. package/modules/content/bookmark.tsx +0 -81
  27. package/modules/content/category.tsx +0 -59
  28. package/modules/content/category_list.tsx +0 -52
  29. package/modules/content/comment.tsx +0 -173
  30. package/modules/content/comment_item.tsx +0 -60
  31. package/modules/content/config.tsx +0 -79
  32. package/modules/content/detail.tsx +0 -150
  33. package/modules/content/header.tsx +0 -49
  34. package/modules/content/index.tsx +0 -52
  35. package/modules/content/item.tsx +0 -112
  36. package/modules/content/item_header.tsx +0 -59
  37. package/modules/content/list.tsx +0 -60
  38. package/modules/content/search.tsx +0 -37
  39. package/modules/lib/menu.tsx +0 -51
  40. package/modules/lib/menusub.tsx +0 -58
@@ -1,112 +0,0 @@
1
- // withHooks
2
- // noPage
3
-
4
- import { ContentBookmarkProperty, ContentConfig, LibIcon, LibNavigation, LibPicture, LibStyle, LibUtils } from 'esoftplay';
5
- import React from 'react';
6
- import { Image, Linking, Pressable, Text, View } from 'react-native';
7
-
8
-
9
- export interface ContentItemArgs {
10
-
11
- }
12
- export interface ContentItemProps {
13
- id: string,
14
- title: string,
15
- intro: string,
16
- description: string,
17
- image: string,
18
- created: string,
19
- updated: string,
20
- url: string,
21
- publish: string,
22
- type_id: string,
23
- created_by: string,
24
- created_by_alias: string,
25
- modified_by: string,
26
- revised: string,
27
- hits: string,
28
- rating: string,
29
- last_hits: string,
30
- is_popimage: string,
31
- is_front: string,
32
- is_config: string,
33
- config: string,
34
- }
35
- export default function m(props: ContentItemProps): any {
36
- const isBook = ContentBookmarkProperty.state().useSelector(s => s.ids.includes(Number(props.id)))
37
- const configlist = ContentConfig.state().get().list
38
- if (props.created == 'sponsor')
39
- if (props.title == '')
40
- return (
41
- <Pressable onPress={() => Linking.openURL(props.url)} >
42
- <Image source={{ uri: props.image }} style={styleId_Z1pdPtF} />
43
- </Pressable>
44
- )
45
- else if (props.image === "")
46
- return (
47
- <Pressable
48
- onPress={() => Linking.openURL(props.url)}
49
- style={styleId_Z1S0WHq} >
50
- <View style={styleId_Z13iiKo} >
51
- <Text style={styleId_Z14zkzb} >{props.created.toUpperCase()}</Text>
52
- <Text numberOfLines={2} ellipsizeMode='tail' style={styleId_1NrPkO} >{props.title}</Text>
53
- <View style={styleId_Z1i5LUH} >
54
- <Text style={styleId_mzCdS} >{props.created_by_alias}</Text>
55
- </View>
56
- </View>
57
- </Pressable>
58
- )
59
- else
60
- return (
61
- <Pressable
62
- onPress={() => LibNavigation.push('content/detail', { ...props })}
63
- style={styleId_Z1S0WHq} >
64
- <Image source={{ uri: props.image }} style={styleId_Zl1hMr} />
65
- <View style={styleId_Z13iiKo} >
66
- <Text style={styleId_Z14zkzb} >{props.created.toUpperCase()}</Text>
67
- <Text numberOfLines={2} ellipsizeMode='tail' style={styleId_1NrPkO} >{props.title}</Text>
68
- <View style={styleId_Z1i5LUH} >
69
- <Text style={styleId_mzCdS} >{props.created_by_alias}</Text>
70
- </View>
71
- </View>
72
- </Pressable>
73
- )
74
-
75
- return (
76
- <Pressable
77
- onPress={() => LibNavigation.push('content/detail', { ...props })}
78
- style={styleId_Z1S0WHq} >
79
- {
80
- configlist.thumbnail == 1 &&
81
- <LibPicture source={{ uri: props.image }} style={styleId_Zl1hMr} />
82
- }
83
- <View style={styleId_Z13iiKo} >
84
- {
85
- configlist.created == 1 &&
86
- <Text style={styleId_Z14zkzb} >{LibUtils.moment(props.created, 'id').format('DD MMM YYYY HH:mm').toUpperCase()}</Text>
87
- }
88
- {
89
- configlist.title == 1 &&
90
- <Text numberOfLines={2} ellipsizeMode='tail' style={styleId_1NrPkO} >{props.title}</Text>
91
- }
92
- {
93
- configlist.author == 1 &&
94
- <View style={styleId_Z1i5LUH} >
95
- <Text style={styleId_mzCdS} >{props.created_by_alias}</Text>
96
- </View>
97
- }
98
- </View>
99
- <Pressable onPress={() => ContentBookmarkProperty.toggle(props)} >
100
- <LibIcon name={isBook ? 'bookmark' : 'bookmark-plus-outline'} color={'#FD5593'} size={24} />
101
- </Pressable>
102
- </Pressable>
103
- )
104
- }
105
- const styleId_Z1pdPtF: any = { width: LibStyle.width, height: 110, resizeMode: 'contain' }
106
- const styleId_Z1S0WHq: any = { paddingHorizontal: 16, paddingVertical: 16, flexDirection: 'row', borderBottomWidth: 1, borderTopWidth: 1, borderBottomColor: '#f2f2f2', borderTopColor: '#f8f8f8' }
107
- const styleId_Z13iiKo: any = { flex: 1, marginLeft: 16, paddingTop: 0 }
108
- const styleId_Z14zkzb: any = { fontSize: 10, fontWeight: "500", letterSpacing: 1.5, color: "#686868" }
109
- const styleId_1NrPkO: any = { fontSize: 17, fontWeight: "500", lineHeight: 21, color: "#060606", marginTop: 5, }
110
- const styleId_Z1i5LUH: any = { flexDirection: 'row', marginTop: 5 }
111
- const styleId_mzCdS: any = { fontSize: 14, lineHeight: 20, color: LibStyle.colorPrimary, }
112
- const styleId_Zl1hMr: any = { height: 90, width: 110, borderRadius: 8, backgroundColor: '#f8f8f8' }
@@ -1,59 +0,0 @@
1
- // withHooks
2
- // noPage
3
-
4
- import { applyStyle, ContentBookmarkProperty, LibIcon, LibNavigation, LibStyle, LibUtils } from 'esoftplay';
5
- import { LinearGradient } from 'expo-linear-gradient';
6
- import React from 'react';
7
- import { ImageBackground, Pressable, Text, View } from 'react-native';
8
-
9
- export interface ContentItem_headerArgs {
10
-
11
- }
12
- export interface ContentItem_headerProps {
13
- id: string,
14
- title: string,
15
- intro: string,
16
- description: string,
17
- image: string,
18
- created: string,
19
- updated: string,
20
- url: string,
21
- publish: string,
22
- type_id: string,
23
- created_by: string,
24
- created_by_alias: string,
25
- modified_by: string,
26
- revised: string,
27
- hits: string,
28
- rating: string,
29
- last_hits: string,
30
- is_popimage: string,
31
- is_front: string,
32
- is_config: string,
33
- config: string,
34
- }
35
- const itemHeight = LibStyle.width * 3 / 4
36
- export default function m(props: ContentItem_headerProps): any {
37
- const isBook = ContentBookmarkProperty.state().useSelector(s => s.ids.includes(Number(props.id)))
38
-
39
- return (
40
- <Pressable onPress={() => LibNavigation.push('content/detail', { ...props })} >
41
- <ImageBackground
42
- source={{ uri: props.image }}
43
- style={applyStyle({ height: itemHeight, width: LibStyle.width, justifyContent: 'flex-end' })} >
44
- <LinearGradient colors={['transparent', 'rgba(0,0,0,0.8)']} style={applyStyle({ padding: 16 })} >
45
- <Text style={applyStyle({ fontSize: 10, fontWeight: "500", letterSpacing: 1.5, color: "white", textTransform: 'uppercase' })} >{LibUtils.moment(props.created, 'id').format('DD MMM YYYY HH:mm')}</Text>
46
- <Text style={applyStyle({ fontSize: 24, fontWeight: "500", lineHeight: 30, color: "white", marginTop: 5 })} >{props.title}</Text>
47
- <View style={applyStyle({ flexDirection: 'row', marginTop: 5 })} >
48
- <View style={applyStyle({ backgroundColor: 'rgba(255,255,255,0.6)', borderRadius: 4, paddingHorizontal: 10, })} >
49
- <Text style={applyStyle({ fontSize: 14, lineHeight: 20, color: LibStyle.colorPrimary, })} >{props.created_by_alias}</Text>
50
- </View>
51
- </View>
52
- </LinearGradient>
53
- <Pressable onPress={() => ContentBookmarkProperty.toggle(props)} style={applyStyle({ position: 'absolute', top: 16, right: 16 })} >
54
- <LibIcon name={isBook ? 'bookmark' : 'bookmark-plus-outline'} color={'#FD5593'} size={30} />
55
- </Pressable>
56
- </ImageBackground>
57
- </Pressable>
58
- )
59
- }
@@ -1,60 +0,0 @@
1
- // withHooks
2
-
3
- import { ContentCategory_list, ContentConfig, ContentHeader, ContentItem, ContentItem_header, esp, LibCarrousel, LibInfinite, LibNavigation, LibObject, LibStyle, UserRoutes, useSafeState } from 'esoftplay';
4
- import React, { useRef } from 'react';
5
- import { View } from 'react-native';
6
-
7
-
8
- export interface ContentListArgs {
9
-
10
- }
11
- export interface ContentListProps {
12
-
13
- }
14
- export default function m(props: ContentListProps): any {
15
-
16
- const routes = UserRoutes.state().get()
17
-
18
- let { url, title, id } = useRef<any>(LibNavigation.getArgsAll(props)).current
19
- const conf = esp.config()
20
- url = url || conf.content
21
- id = id || 0
22
- const [data, setData] = useSafeState<any[]>([])
23
- const [header, setHeader] = useSafeState<any[]>([])
24
-
25
- return (
26
- <View style={{ flex: 1 }} >
27
- <ContentHeader backButton={routes?.index != undefined && routes?.index > 0} title={title || esp.appjson()?.expo?.name} searchButton />
28
- <LibInfinite
29
- url={url}
30
- injectData={data}
31
- ListHeaderComponent={
32
- <>
33
- <ContentCategory_list id={id} />
34
- <LibCarrousel
35
- autoplay
36
- bullets
37
- bulletsContainerStyle={{ justifyContent: 'flex-end', marginRight: 10 }}
38
- chosenBulletStyle={{ width: 8, height: 4, borderRadius: 2, marginHorizontal: 4 }}
39
- bulletStyle={{ width: 4, height: 4, borderRadius: 2, marginHorizontal: 4 }}
40
- style={{ height: 3 / 4 * LibStyle.width }}>
41
- {header.map(item => <ContentItem_header {...item} />)}
42
- </LibCarrousel>
43
- </>
44
- }
45
- onResult={(res) => {
46
- ContentConfig.state().set(LibObject.set(ContentConfig.state().get(), res.config)('list'))
47
- }}
48
- onDataChange={(data: any[], page) => {
49
- if (page == 0) {
50
- setData(LibObject.splice(data, 0, 4)())
51
- setHeader(data.slice(0, 4).filter((row) => row.created != 'sponsor'))
52
- } else {
53
- setData(data)
54
- }
55
- }}
56
- renderItem={(item) => <ContentItem {...item} />}
57
- />
58
- </View>
59
- )
60
- }
@@ -1,37 +0,0 @@
1
- // withHooks
2
-
3
- import { ContentHeader, esp, LibInput, LibNavigation } from 'esoftplay';
4
- import React, { useRef } from 'react';
5
- import { View } from 'react-native';
6
-
7
-
8
- export interface ContentSearchArgs {
9
-
10
- }
11
- export interface ContentSearchProps {
12
-
13
- }
14
- export default function m(props: ContentSearchProps): any {
15
- const searchInput = useRef<LibInput>(null)
16
- const content = esp.config('content')
17
-
18
- function doSearch() {
19
- const keyword = encodeURIComponent(searchInput.current?.getText() || '')
20
- LibNavigation.push('content/list', { title: 'Cari untuk ' + keyword, url: content + 'search.htm?id=' + keyword })
21
- }
22
-
23
- return (
24
- <View>
25
- <ContentHeader title="Cari Artikel" backButton />
26
- <LibInput base
27
- ref={searchInput}
28
- autoFocus
29
- placeholder={"Cari artikel"}
30
- returnKeyType="search"
31
- onChangeText={(text) => { }}
32
- onSubmitEditing={() => doSearch()}
33
- style={{ flex: 1, minHeight: 40, paddingHorizontal: 8, borderRadius: 8, backgroundColor: '#f5f5f5', marginVertical: 16, marginHorizontal: 16 }}
34
- />
35
- </View>
36
- )
37
- }
@@ -1,51 +0,0 @@
1
- // noPage
2
-
3
- import { LibComponent, LibMenusub } from "esoftplay";
4
- import React from "react";
5
- import { FlatList } from "react-native";
6
-
7
-
8
- export interface LibMenuProps {
9
- onItemSelected: (item: any) => void,
10
- parent?: number,
11
- style?: any,
12
- data: any,
13
- selectedId: number
14
- }
15
-
16
- export interface LibMenuState {
17
-
18
- }
19
-
20
- export default class emenu extends LibComponent<LibMenuProps, LibMenuState> {
21
-
22
- props: LibMenuProps
23
- constructor(props: LibMenuProps) {
24
- super(props);
25
- this.props = props
26
- }
27
-
28
- onItemSelected(item: any): void {
29
- if (this.props.onItemSelected) {
30
- delete item.data
31
- this.props.onItemSelected(item)
32
- }
33
- }
34
- render(): any {
35
- var parent = this.props.parent ? this.props.parent : 0
36
- var style = this.props.style ? this.props.style : {}
37
- var data = this.props.data
38
- if (parent == 0) {
39
- data = this.props.data.filter((item: any) => item.par_id == parent)
40
- }
41
- return (
42
- <FlatList
43
- style={style}
44
- data={data}
45
- nestedScrollEnabled
46
- keyExtractor={(item: any) => (item.id).toString()}
47
- renderItem={({ item }: any) => <LibMenusub {...item} selectedId={this.props.selectedId} data={this.props.data} parent={parent} onClick={(item: any) => this.onItemSelected(item)} />}
48
- />
49
- )
50
- }
51
- }
@@ -1,58 +0,0 @@
1
- // noPage
2
-
3
- import { LibComponent, LibIcon, LibMenu, LibStyle, LibUtils } from "esoftplay";
4
- import React from "react";
5
- import { Text, TouchableOpacity, View } from "react-native";
6
- const { colorPrimary } = LibStyle;
7
-
8
- export interface LibMenusubProps {
9
- data: any,
10
- id: number,
11
- selectedId: number,
12
- title: string,
13
- onClick: (data: any) => void
14
- }
15
-
16
- export interface LibMenusubState {
17
- expanded: boolean
18
- }
19
-
20
- export default class Emenusub extends LibComponent<LibMenusubProps, LibMenusubState> {
21
-
22
- props: LibMenusubProps
23
- constructor(props: LibMenusubProps) {
24
- super(props)
25
- this.props = props
26
- }
27
-
28
- state = {
29
- expanded: false
30
- }
31
-
32
- render(): any {
33
- var data = this.props.data.filter((item: any) => item.par_id == this.props.id)
34
- return (
35
- <View>
36
- <View style={{ flexDirection: "row", borderRadius: 5, margin: 5, paddingRight: 5, alignItems: "center", backgroundColor: this.props.selectedId == this.props.id ? LibUtils.hexToRgba(colorPrimary, 0.2) : "transparent" }}>
37
- <TouchableOpacity
38
- style={{ flex: 1 }}
39
- onPress={() => {
40
- this.props.onClick(this.props)
41
- }}>
42
- <Text style={{ color: this.props.selectedId == this.props.id ? colorPrimary : "#353535", flex: 1, padding: 12, fontSize: 15 }} >{this.props.title} </Text>
43
- </TouchableOpacity>
44
- {
45
- data.length > 0 ?
46
- <TouchableOpacity onPress={() => this.setState({ expanded: !this.state.expanded })} >
47
- <View style={{ paddingLeft: 10, flexDirection: "column" }}>
48
- <LibIcon.Ionicons name={!this.state.expanded ? "ios-arrow-down" : "ios-arrow-up"} style={{ color: colorPrimary, fontSize: 20, paddingRight: 16 }} />
49
- </View>
50
- </TouchableOpacity>
51
- : null
52
- }
53
- </View>
54
- {this.state.expanded ? <LibMenu style={{ paddingLeft: 15 }} selectedId={this.props.selectedId} onItemSelected={(item: any) => { this.props.onClick(item) }} parent={this.props.id} data={data} /> : null}
55
- </View>
56
- )
57
- }
58
- }