esoftplay 0.0.127 → 0.0.128-a
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/assets/locale/id.json +104 -0
- package/bin/build.js +1 -0
- package/bin/locale.js +18 -0
- package/bin/router.js +16 -6
- package/error.ts +3 -2
- package/esp.ts +1 -1
- package/global.ts +21 -12
- package/lazy.ts +23 -0
- package/modules/lib/collaps.tsx +7 -3
- package/modules/lib/curl.ts +10 -10
- package/modules/lib/datepicker.tsx +17 -3
- package/modules/lib/dropdown.tsx +2 -1
- package/modules/lib/editbox.tsx +2 -1
- package/modules/lib/focus.tsx +1 -1
- package/modules/lib/global.tsx +30 -0
- package/modules/lib/image.tsx +4 -4
- package/modules/lib/image_crop.tsx +6 -6
- package/modules/lib/image_multi.tsx +2 -2
- package/modules/lib/image_shadow.tsx +2 -2
- package/modules/lib/infinite.tsx +5 -2
- package/modules/lib/list.tsx +2 -0
- package/modules/lib/loading.tsx +11 -18
- package/modules/lib/net_status.tsx +7 -6
- package/modules/lib/notification.ts +2 -2
- package/modules/lib/updater.tsx +6 -6
- package/modules/lib/utils.ts +2 -2
- package/modules/lib/version.tsx +4 -4
- package/modules/lib/video.tsx +4 -3
- package/modules/main/index.tsx +2 -2
- package/modules/use/deeplink.ts +2 -2
- package/modules/user/data.ts +7 -2
- package/package.json +1 -1
- package/subscribe.ts +51 -0
- package/_cache.ts +0 -84
- package/import_migrator.mjs +0 -46
- package/import_translator.mjs +0 -15
- package/modules/lib/direct_image.tsx +0 -46
- package/modules/lib/document.ts +0 -41
- package/modules/lib/input_base.tsx +0 -136
- package/modules/lib/input_base_data.ts +0 -10
- package/modules/lib/roll.tsx +0 -112
- package/modules/use/connect.ts +0 -45
- package/modules/use/data.ts +0 -9
- package/modules/use/form_persist.ts +0 -52
- package/modules/user/login.tsx +0 -176
- package/modules/user/notifbadge.tsx +0 -44
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lib/curl": {
|
|
3
|
+
"alert_title": "Oops..! Gagal menyambung ke server",
|
|
4
|
+
"alert_msg": "Sepertinya perangkatmu ada masalah jaringan",
|
|
5
|
+
"alert_ok": "Coba Lagi",
|
|
6
|
+
"alert_cancel": "Tutup",
|
|
7
|
+
"msg_failed": "Koneksi internet kamu tidak stabil, silahkan coba lagi",
|
|
8
|
+
"error_message": "Terjadi kesalahan, biar %s bereskan, silahkan coba lagi atau kembali ke halaman utama"
|
|
9
|
+
},
|
|
10
|
+
"lib/datepicker": {
|
|
11
|
+
"month1": "Januari",
|
|
12
|
+
"month2": "Februari",
|
|
13
|
+
"month3": "Maret",
|
|
14
|
+
"month4": "April",
|
|
15
|
+
"month5": "Mei",
|
|
16
|
+
"month6": "Juni",
|
|
17
|
+
"month7": "Juli",
|
|
18
|
+
"month8": "Agustus",
|
|
19
|
+
"month9": "September",
|
|
20
|
+
"month10": "Oktober",
|
|
21
|
+
"month11": "November",
|
|
22
|
+
"month12": "Desember",
|
|
23
|
+
"done": "Done"
|
|
24
|
+
},
|
|
25
|
+
"lib/dropdown": {
|
|
26
|
+
"select": "Select"
|
|
27
|
+
},
|
|
28
|
+
"lib/editbox": {
|
|
29
|
+
"btn_save": "Simpan"
|
|
30
|
+
},
|
|
31
|
+
"lib/document": {
|
|
32
|
+
"waiting_upload": "Mohon tunggu sedang mengunggah dokumen"
|
|
33
|
+
},
|
|
34
|
+
"lib/image_crop": {
|
|
35
|
+
"waiting": "Sedang menyiapkan...",
|
|
36
|
+
"waiting_crop": "Sedang memotong gambar..",
|
|
37
|
+
"alert_out": "Garis putus-putus tidak boleh keluar dari gambar",
|
|
38
|
+
"text_msg": "Geser dan cubit layar untuk menyesuaikan bagian foto yang ingin dipakai (pastikan bagian foto berada di dalam garis putus-putus) lalu crop jika sudah sesuai",
|
|
39
|
+
"btn_save": "SIMPAN"
|
|
40
|
+
},
|
|
41
|
+
"lib/image_multi": {
|
|
42
|
+
"selected": " Selected"
|
|
43
|
+
},
|
|
44
|
+
"lib/image_shadow": {
|
|
45
|
+
"error": "width and height is required"
|
|
46
|
+
},
|
|
47
|
+
"lib/image": {
|
|
48
|
+
"cam_title": "%s tidak dapat mengakses kamera ",
|
|
49
|
+
"cam_msg": "Mohon Pastikan anda memberikan izin %s untuk dapat mengambil foto",
|
|
50
|
+
"gallery_title": "%s tidak dapat mengakses galeri ",
|
|
51
|
+
"gallery_msg": "Mohon Pastikan anda memberikan izin %s untuk dapat mengambil foto",
|
|
52
|
+
"wait": "Mohon tunggu, Sedang mengunggah foto",
|
|
53
|
+
"wait_upload": "Mohon Tunggu, Sedang mengunggah foto"
|
|
54
|
+
},
|
|
55
|
+
"lib/infinite": {
|
|
56
|
+
"empty_data": "Belum ada data"
|
|
57
|
+
},
|
|
58
|
+
"lib/net_status": {
|
|
59
|
+
"online": "Device is Online",
|
|
60
|
+
"offline": "Device is Offline"
|
|
61
|
+
},
|
|
62
|
+
"lib/notification": {
|
|
63
|
+
"permission": "Please enable notifications permissions"
|
|
64
|
+
},
|
|
65
|
+
"lib/roll": {
|
|
66
|
+
"failed": "Failed to access"
|
|
67
|
+
},
|
|
68
|
+
"lib/updater": {
|
|
69
|
+
"alert_info": "Informasi",
|
|
70
|
+
"alert_msg": "Pembaharuan berhasil diinstall",
|
|
71
|
+
"ok": "Ok",
|
|
72
|
+
"alert_dev": "Development Mode",
|
|
73
|
+
"alert_dev_msg": "Update not working in development mode!",
|
|
74
|
+
"alert_title": "App is fine",
|
|
75
|
+
"alert_expo": "Your app is up-to-date",
|
|
76
|
+
"wait_check": "Sedang memeriksa versi terbaru",
|
|
77
|
+
"alert_update": "App is fine",
|
|
78
|
+
"alert_uptodate": "Your app is up-to-date"
|
|
79
|
+
},
|
|
80
|
+
"lib/utils": {
|
|
81
|
+
"toas_latlongfrom": "LatLongFrom tidak valid",
|
|
82
|
+
"toas_latlongto": "LatlongTo tidak valid"
|
|
83
|
+
},
|
|
84
|
+
"lib/version": {
|
|
85
|
+
"update": "Update",
|
|
86
|
+
"skip": "Nanti",
|
|
87
|
+
"update_now": "Update to a new version now",
|
|
88
|
+
"version_available": "A new version is available",
|
|
89
|
+
"btn_update": "Update Sekarang"
|
|
90
|
+
},
|
|
91
|
+
"lib/video": {
|
|
92
|
+
"missing_code": "Missing Youtube Code in Props"
|
|
93
|
+
},
|
|
94
|
+
"main/index": {
|
|
95
|
+
"helo_msg": "Hellow Esoftplay developer, jangan lupa bismillah dulu. (-̀ᴗ-́)و ̑̑"
|
|
96
|
+
},
|
|
97
|
+
"use/deeplink": {
|
|
98
|
+
"msg_err": "Oops...!"
|
|
99
|
+
},
|
|
100
|
+
"user/login": {
|
|
101
|
+
"username": "username",
|
|
102
|
+
"pass": "password"
|
|
103
|
+
}
|
|
104
|
+
}
|
package/bin/build.js
CHANGED
|
@@ -363,6 +363,7 @@ export default function App() {
|
|
|
363
363
|
cmd += "&& expo install " + installExpoLibs.join(" ")
|
|
364
364
|
execSync(cmd)
|
|
365
365
|
execSync("cd ../../ && node ./node_modules/esoftplay/bin/router.js || true")
|
|
366
|
+
execSync("cd ../../ && node ./node_modules/esoftplay/bin/locale.js")
|
|
366
367
|
console.log('App.js has been replace to App.tsx');
|
|
367
368
|
// /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
368
369
|
// if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
package/bin/locale.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const merge = require('lodash/merge')
|
|
3
|
+
|
|
4
|
+
function readAsJson(path) {
|
|
5
|
+
let out = ""
|
|
6
|
+
try { out = JSON.parse(fs.readFileSync(path, { encoding: 'utf8' })) } catch (e) { }
|
|
7
|
+
return out;
|
|
8
|
+
}
|
|
9
|
+
if (!fs.existsSync("./assets/locale/id.json")) {
|
|
10
|
+
fs.writeFileSync("./assets/locale/id.json", JSON.stringify({}, undefined, 2))
|
|
11
|
+
}
|
|
12
|
+
if (fs.existsSync("./assets/locale/id.json")) {
|
|
13
|
+
let masterLocale = readAsJson('./node_modules/esoftplay/assets/locale/id.json')
|
|
14
|
+
let projectLang = readAsJson("./assets/locale/id.json")
|
|
15
|
+
let _lg = merge(masterLocale, projectLang)
|
|
16
|
+
masterLocale = { ..._lg }
|
|
17
|
+
fs.writeFileSync("./assets/locale/id.json", JSON.stringify(masterLocale, undefined, 2))
|
|
18
|
+
}
|
package/bin/router.js
CHANGED
|
@@ -612,7 +612,9 @@ function createRouter() {
|
|
|
612
612
|
staticImport.push("export function applyStyle(style){ return style };\n")
|
|
613
613
|
staticImport.push("export { default as useGlobalState } from '../../../node_modules/esoftplay/global';\n")
|
|
614
614
|
staticImport.push("export { default as usePersistState } from '../../../node_modules/esoftplay/persist';\n")
|
|
615
|
+
staticImport.push("export { default as useGlobalSubscribe } from '../../../node_modules/esoftplay/subscribe';\n")
|
|
615
616
|
staticImport.push("export { default as useSafeState } from '../../../node_modules/esoftplay/state';\n")
|
|
617
|
+
staticImport.push("export { default as useLazyState } from '../../../node_modules/esoftplay/lazy';\n")
|
|
616
618
|
staticImport.push("export { default as esp } from '../../../node_modules/esoftplay/esp';\n")
|
|
617
619
|
// staticImport.push("export { default as createCache } from '../../../node_modules/esoftplay/_cache';\n")
|
|
618
620
|
staticImport.push("export { default as _global } from '../../../node_modules/esoftplay/_global';\n")
|
|
@@ -625,21 +627,28 @@ function createRouter() {
|
|
|
625
627
|
Navigations.push(nav);
|
|
626
628
|
}
|
|
627
629
|
AllRoutes.push(nav)
|
|
630
|
+
let fileExt = 'js'
|
|
628
631
|
Task += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")?.default' + "\n\t\t\t" + 'break;' + "\n";
|
|
629
632
|
TaskProperty += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")' + "\n\t\t\t" + 'break;' + "\n";
|
|
630
633
|
/* ADD ROUTER EACH FILE FOR STATIC IMPORT */
|
|
631
|
-
var item =
|
|
634
|
+
var item = `import { stable } from 'usestable';\n`
|
|
632
635
|
if (HookModules.includes(nav)) {
|
|
636
|
+
// fileExt = 'tsx'
|
|
633
637
|
item += "" +
|
|
638
|
+
"import React from 'react'\n" +
|
|
639
|
+
"const _" + ucword(module) + ucword(task) + " = React.lazy(() => import('../../../../." + Modules[module][task] + "')); \n" +
|
|
634
640
|
"import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../../." + Modules[module][task] + "';\n" +
|
|
635
|
-
"
|
|
641
|
+
"const UpdatedComponent = (OriginalComponent) => { function "+ucword(module) + ucword(task)+"Component(props) { return ( <React.Suspense><OriginalComponent {...props} /></React.Suspense> ) } return "+ucword(module) + ucword(task)+"Component; };\n" +
|
|
642
|
+
"const " + ucword(module) + ucword(task) + " = stable(UpdatedComponent(_" + ucword(module) + ucword(task) + ")); \n" +
|
|
636
643
|
"export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
|
|
637
644
|
} else if (UseLibs.includes(nav)) {
|
|
638
645
|
item += "" +
|
|
646
|
+
"import { default as _" + ucword(module) + ucword(task) + " } from '../../../../." + Modules[module][task] + "';\n" +
|
|
639
647
|
"import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../../." + Modules[module][task] + "';\n" +
|
|
640
|
-
"
|
|
648
|
+
"const " + ucword(module) + ucword(task) + " = _" + ucword(module) + ucword(task) + "; \n" +
|
|
641
649
|
"export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
|
|
642
650
|
} else {
|
|
651
|
+
item += "import { default as _" + ucword(module) + ucword(task) + " } from '../../../../." + Modules[module][task] + "';\n"
|
|
643
652
|
item += "export { _" + ucword(module) + ucword(task) + " as " + ucword(module) + ucword(task) + " };\n"
|
|
644
653
|
}
|
|
645
654
|
|
|
@@ -649,8 +658,8 @@ function createRouter() {
|
|
|
649
658
|
if (!fs.existsSync(tmpDir + nav))
|
|
650
659
|
fs.mkdirSync(tmpDir + nav)
|
|
651
660
|
|
|
652
|
-
if (isChange(tmpDir + nav + "/import.
|
|
653
|
-
fs.writeFile(tmpDir + nav + '/import.
|
|
661
|
+
if (isChange(tmpDir + nav + "/import." + fileExt, item)) {
|
|
662
|
+
fs.writeFile(tmpDir + nav + '/import.' + fileExt, item, { flag: 'w' }, function (err) {
|
|
654
663
|
if (err) {
|
|
655
664
|
return console.log(err);
|
|
656
665
|
}
|
|
@@ -728,7 +737,8 @@ function createRouter() {
|
|
|
728
737
|
const orientation = NavsOrientation[nav]
|
|
729
738
|
const [module, task] = nav.split('/')
|
|
730
739
|
const comp = ucword(module) + ucword(task)
|
|
731
|
-
importer.push(`import { ${comp}
|
|
740
|
+
importer.push(`import { ${comp}
|
|
741
|
+
} from ${'"esoftplay/cache/' + module + '/' + task + '/import"'} `)
|
|
732
742
|
if (orientation)
|
|
733
743
|
screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />")
|
|
734
744
|
else
|
package/error.ts
CHANGED
|
@@ -22,11 +22,12 @@ export function setError(error?: any) {
|
|
|
22
22
|
const config = esp?.config?.();
|
|
23
23
|
const routes = UserRoutes?.state()?.get?.();
|
|
24
24
|
const user = UserClass?.state()?.get?.();
|
|
25
|
-
const
|
|
25
|
+
const routesName = routes?.routes?.map((x) => x.name)
|
|
26
|
+
|
|
26
27
|
const _e = {
|
|
27
28
|
user,
|
|
28
29
|
error: String(error),
|
|
29
|
-
routes:
|
|
30
|
+
routes: routesName
|
|
30
31
|
};
|
|
31
32
|
try {
|
|
32
33
|
AsyncStorage.setItem(`${config?.domain}error`, JSON.stringify(_e));
|
package/esp.ts
CHANGED
|
@@ -122,7 +122,7 @@ const esp = {
|
|
|
122
122
|
function sprintf(string: string, index: number): string {
|
|
123
123
|
if (stringToBe[index] != undefined) {
|
|
124
124
|
string = string.replace("%s", stringToBe[index])
|
|
125
|
-
if (string
|
|
125
|
+
if (string?.includes?.("%s")) {
|
|
126
126
|
return sprintf(string, index + 1)
|
|
127
127
|
}
|
|
128
128
|
}
|
package/global.ts
CHANGED
|
@@ -20,7 +20,8 @@ export interface useGlobalOption {
|
|
|
20
20
|
inFile?: boolean,
|
|
21
21
|
listener?: (data: any) => void,
|
|
22
22
|
jsonBeautify?: boolean,
|
|
23
|
-
isUserData?: boolean
|
|
23
|
+
isUserData?: boolean,
|
|
24
|
+
onFinish?: () => void
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface useGlobalConnect<T> {
|
|
@@ -37,8 +38,8 @@ const Context = {
|
|
|
37
38
|
this.idx = 0
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
41
|
export const globalIdx = Context
|
|
42
|
+
let timeoutFinish: NodeJS.Timeout
|
|
42
43
|
export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
|
|
43
44
|
const STORAGE = o?.inFile ? Storage : AsyncStorage
|
|
44
45
|
const _idx = o?.persistKey || globalIdx.idx
|
|
@@ -50,21 +51,29 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
50
51
|
let persistKey = o?.persistKey
|
|
51
52
|
STORAGE.getItem(persistKey).then((p: any) => {
|
|
52
53
|
if (p) {
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
if (persistKey != '__globalReady')
|
|
55
|
+
if (p != undefined && typeof p == 'string' && (p.startsWith("{") || p.startsWith("[")))
|
|
56
|
+
try { set(JSON.parse(p)) } catch (error) { }
|
|
57
|
+
else {
|
|
58
|
+
if (p == "true" || p == "false") {
|
|
59
|
+
try { /* @ts-ignore */ set(eval(p)) } catch (error) { }
|
|
60
|
+
} else if (isNaN(p)) {
|
|
61
|
+
try { /* @ts-ignore */ set(p) } catch (error) { }
|
|
62
|
+
} else {
|
|
63
|
+
try { /* @ts-ignore */ set(eval(p)) } catch (error) { }
|
|
64
|
+
}
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
}
|
|
67
|
+
if (o?.onFinish) {
|
|
68
|
+
clearTimeout(timeoutFinish)
|
|
69
|
+
timeoutFinish = setTimeout(() => {
|
|
70
|
+
o.onFinish?.()
|
|
71
|
+
}, 50);
|
|
64
72
|
}
|
|
65
73
|
})
|
|
66
74
|
}
|
|
67
75
|
|
|
76
|
+
|
|
68
77
|
/* register to userData to automatically reset state and persist */
|
|
69
78
|
if (o?.isUserData) {
|
|
70
79
|
function resetFunction() {
|
package/lazy.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export default function useLazyState<T>(initialState: T): [T, (newValue: T) => () => void] {
|
|
4
|
+
const [, rerender] = useState({})
|
|
5
|
+
const dispatch = () => { rerender({}) }
|
|
6
|
+
const value = useRef(initialState)
|
|
7
|
+
const isMounted = useRef(true)
|
|
8
|
+
const setter = (newValue: T) => {
|
|
9
|
+
if (isMounted.current)
|
|
10
|
+
value.current = newValue;
|
|
11
|
+
return () => {
|
|
12
|
+
if (isMounted.current)
|
|
13
|
+
dispatch()
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
isMounted.current = true
|
|
19
|
+
return () => { isMounted.current = false }
|
|
20
|
+
}, [])
|
|
21
|
+
|
|
22
|
+
return [value.current, setter]
|
|
23
|
+
}
|
package/modules/lib/collaps.tsx
CHANGED
|
@@ -14,6 +14,7 @@ export interface LibCollapsProps {
|
|
|
14
14
|
show?: boolean,
|
|
15
15
|
header: (isShow: boolean) => any,
|
|
16
16
|
children: any,
|
|
17
|
+
onToggle?: (expanded: boolean) => void,
|
|
17
18
|
style?: any
|
|
18
19
|
}
|
|
19
20
|
export default function m(props: LibCollapsProps): any {
|
|
@@ -40,7 +41,7 @@ export default function m(props: LibCollapsProps): any {
|
|
|
40
41
|
runOnJS(setExpand)(false)
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
|
-
translateY.value = withTiming(opacity.value !== 0 ? -10 : 0, { duration: 300})
|
|
44
|
+
translateY.value = withTiming(opacity.value !== 0 ? -10 : 0, { duration: 300 })
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
function toggle() {
|
|
@@ -49,16 +50,19 @@ export default function m(props: LibCollapsProps): any {
|
|
|
49
50
|
} else {
|
|
50
51
|
toggleAnimation()
|
|
51
52
|
}
|
|
53
|
+
if (props.onToggle) {
|
|
54
|
+
props.onToggle(!expand)
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
return (
|
|
55
59
|
<Animated.View>
|
|
56
|
-
|
|
60
|
+
<Pressable onPress={toggle} style={{ zIndex: 11 }} >
|
|
57
61
|
{props.header(expand)}
|
|
58
62
|
</Pressable>
|
|
59
63
|
{expand &&
|
|
60
64
|
<Animated.View
|
|
61
|
-
style={[{ paddingBottom: expand ? 10 : 0, zIndex:10 }, animatedStyle]}>
|
|
65
|
+
style={[{ paddingBottom: expand ? 10 : 0, zIndex: 10 }, animatedStyle]}>
|
|
62
66
|
{props.children}
|
|
63
67
|
</Animated.View>
|
|
64
68
|
}
|
package/modules/lib/curl.ts
CHANGED
|
@@ -31,10 +31,10 @@ export default class m {
|
|
|
31
31
|
isSecure: boolean = false
|
|
32
32
|
fetchConf: any = ''
|
|
33
33
|
alertTimeout = {
|
|
34
|
-
title: "
|
|
35
|
-
message: "
|
|
36
|
-
ok: "
|
|
37
|
-
cancel: "
|
|
34
|
+
title: esp.lang("lib/curl", "alert_title"),
|
|
35
|
+
message: esp.lang("lib/curl", "alert_msg"),
|
|
36
|
+
ok: esp.lang("lib/curl", "alert_ok"),
|
|
37
|
+
cancel: esp.lang("lib/curl", "alert_cancel")
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) {
|
|
@@ -163,7 +163,7 @@ export default class m {
|
|
|
163
163
|
this.cancelTimeout()
|
|
164
164
|
let resText = await res.text()
|
|
165
165
|
if (res.status == 200 && resText == "") {
|
|
166
|
-
if (onFailed) onFailed({ message: "
|
|
166
|
+
if (onFailed) onFailed({ message: esp.lang("lib/curl", "msg_failed") }, false)
|
|
167
167
|
return
|
|
168
168
|
}
|
|
169
169
|
this.onFetched(resText,
|
|
@@ -176,7 +176,7 @@ export default class m {
|
|
|
176
176
|
}).catch((r) => {
|
|
177
177
|
this.cancelTimeout()
|
|
178
178
|
LibProgress.hide()
|
|
179
|
-
LibToastProperty.show(
|
|
179
|
+
LibToastProperty.show(esp.lang("lib/curl", "msg_failed"))
|
|
180
180
|
this.onFetchFailed(r)
|
|
181
181
|
})
|
|
182
182
|
}
|
|
@@ -363,7 +363,7 @@ export default class m {
|
|
|
363
363
|
this.resStatus = res.status
|
|
364
364
|
let resText = await res.text()
|
|
365
365
|
if (res.status == 200 && resText == "") {
|
|
366
|
-
if (onFailed) onFailed({ message: "
|
|
366
|
+
if (onFailed) onFailed({ message: esp.lang("lib/curl", "msg_failed") }, false)
|
|
367
367
|
return
|
|
368
368
|
}
|
|
369
369
|
//api_logger
|
|
@@ -379,7 +379,7 @@ export default class m {
|
|
|
379
379
|
if (__DEV__) {
|
|
380
380
|
console.warn(r)
|
|
381
381
|
} else
|
|
382
|
-
LibToastProperty.show("
|
|
382
|
+
LibToastProperty.show(esp.lang("lib/curl", "msg_failed"))
|
|
383
383
|
this.onFetchFailed(r)
|
|
384
384
|
LibProgress.hide()
|
|
385
385
|
})
|
|
@@ -417,10 +417,10 @@ export default class m {
|
|
|
417
417
|
ltext.includes('error')
|
|
418
418
|
) {
|
|
419
419
|
// reportApiError(this.fetchConf.options, resText)
|
|
420
|
-
out =
|
|
420
|
+
out = esp.lang("lib/curl", "error_message", esp.appjson()?.expo?.name)
|
|
421
421
|
}
|
|
422
422
|
if (ltext.includes('timeout exceeded')) {
|
|
423
|
-
out =
|
|
423
|
+
out = esp.lang("lib/curl", "msg_failed")
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
return out
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
|
-
import { useSafeState } from 'esoftplay';
|
|
3
|
+
import { esp, useSafeState } from 'esoftplay';
|
|
4
4
|
|
|
5
5
|
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
6
6
|
import { LibScrollpicker } from 'esoftplay/cache/lib/scrollpicker/import';
|
|
@@ -26,7 +26,21 @@ export default function m(props: LibDatepickerProps): any {
|
|
|
26
26
|
const refDate = useRef<any>(null)
|
|
27
27
|
const allYears = [1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101]
|
|
28
28
|
const allDates = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
|
|
29
|
-
const allMonths = props.monthsDisplay ||
|
|
29
|
+
const allMonths = props.monthsDisplay ||
|
|
30
|
+
[
|
|
31
|
+
esp.lang("lib/datepicker", "month1"),
|
|
32
|
+
esp.lang("lib/datepicker", "month2"),
|
|
33
|
+
esp.lang("lib/datepicker", "month3"),
|
|
34
|
+
esp.lang("lib/datepicker", "month4"),
|
|
35
|
+
esp.lang("lib/datepicker", "month5"),
|
|
36
|
+
esp.lang("lib/datepicker", "month6"),
|
|
37
|
+
esp.lang("lib/datepicker", "month7"),
|
|
38
|
+
esp.lang("lib/datepicker", "month8"),
|
|
39
|
+
esp.lang("lib/datepicker", "month9"),
|
|
40
|
+
esp.lang("lib/datepicker", "month10"),
|
|
41
|
+
esp.lang("lib/datepicker", "month11"),
|
|
42
|
+
esp.lang("lib/datepicker", "month12")
|
|
43
|
+
]
|
|
30
44
|
const minDate = props.minDate
|
|
31
45
|
const maxDate = props.maxDate
|
|
32
46
|
const selectedDate = props.selectedDate || minDate
|
|
@@ -164,7 +178,7 @@ export default function m(props: LibDatepickerProps): any {
|
|
|
164
178
|
<View style={{ flex: 1, backgroundColor: 'white' }} >
|
|
165
179
|
<View style={{ height: 44, alignItems: 'flex-end', backgroundColor: '#fafafa' }} >
|
|
166
180
|
<TouchableOpacity onPress={() => { getDateChange() }} >
|
|
167
|
-
<Text style={{ fontSize: 15, fontWeight: "500", paddingHorizontal: 16, paddingVertical: 13, fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorPrimary }} >
|
|
181
|
+
<Text style={{ fontSize: 15, fontWeight: "500", paddingHorizontal: 16, paddingVertical: 13, fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorPrimary }} >{esp.lang("lib/datepicker", "done")}</Text>
|
|
168
182
|
</TouchableOpacity>
|
|
169
183
|
</View>
|
|
170
184
|
<View style={{ height: 175, flexDirection: 'row' }} >
|
package/modules/lib/dropdown.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
|
+
import { esp } from 'esoftplay';
|
|
3
4
|
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
4
5
|
import React, { useEffect, useRef, useState } from "react";
|
|
5
6
|
import { FlatList, Modal, Platform, Pressable, TextInput, View, ViewProps } from "react-native";
|
|
@@ -59,7 +60,7 @@ export default function m(props: LibDropdownProps) {
|
|
|
59
60
|
pointerEvents="none"
|
|
60
61
|
editable={false}
|
|
61
62
|
style={[{ height: 40, borderWidth: 1, borderRadius: 2, borderColor: '#ccc' }, Platform.OS == 'web' ? { outlineWidth: 0 } : {}, props?.style]}
|
|
62
|
-
placeholder={props?.label ||
|
|
63
|
+
placeholder={props?.label || esp.lang("lib/dropdown", "select")}
|
|
63
64
|
value={currentValue?.value}
|
|
64
65
|
/>
|
|
65
66
|
</Pressable>
|
package/modules/lib/editbox.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
// noPage
|
|
3
|
+
import { esp } from 'esoftplay';
|
|
3
4
|
import { LibComponent } from 'esoftplay/cache/lib/component/import';
|
|
4
5
|
import { LibInput } from 'esoftplay/cache/lib/input/import';
|
|
5
6
|
import { LibKeyboard_avoid } from 'esoftplay/cache/lib/keyboard_avoid/import';
|
|
@@ -93,7 +94,7 @@ class m extends LibComponent<ComponentEditboxProps, ComponentEditboxState>{
|
|
|
93
94
|
ref={this.input}
|
|
94
95
|
{...props}
|
|
95
96
|
/>
|
|
96
|
-
<Button title="
|
|
97
|
+
<Button title={esp.lang("lib/editbox", "btn_save")} color={LibStyle.colorPrimary} onPress={() => { onSubmit(this.input?.current?.getText?.()); m.hide(); }} />
|
|
97
98
|
</View>
|
|
98
99
|
</TouchableOpacity>
|
|
99
100
|
</LibKeyboard_avoid>
|
package/modules/lib/focus.tsx
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
// noPage
|
|
3
|
+
|
|
4
|
+
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
5
|
+
import useGlobalState from 'esoftplay/global';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface LibGlobalArgs {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
export interface LibGlobalProps {
|
|
13
|
+
waitForFinish: boolean,
|
|
14
|
+
waitingView?: any,
|
|
15
|
+
children?: any
|
|
16
|
+
}
|
|
17
|
+
const globalReady = useGlobalState(false, {
|
|
18
|
+
persistKey: "__globalReady",
|
|
19
|
+
onFinish: () => {
|
|
20
|
+
globalReady.set(true)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export default function m(props: LibGlobalProps): any {
|
|
25
|
+
const [ready] = globalReady.useState();
|
|
26
|
+
if (props.waitForFinish)
|
|
27
|
+
return ready ? props.children : props.waitingView || <LibLoading />
|
|
28
|
+
else
|
|
29
|
+
return props.children
|
|
30
|
+
}
|
package/modules/lib/image.tsx
CHANGED
|
@@ -120,7 +120,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
if (finalStatus != 'granted') {
|
|
123
|
-
Alert.alert(esp.appjson().expo.name
|
|
123
|
+
Alert.alert(esp.lang("lib/image", "cam_title", esp.appjson().expo.name), esp.lang("lib/image", "cam_msg", esp.appjson().expo.name))
|
|
124
124
|
}
|
|
125
125
|
ImagePicker.launchCameraAsync({
|
|
126
126
|
allowsEditing: Platform.OS != 'ios' && options && options.crop ? true : false,
|
|
@@ -158,7 +158,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
158
158
|
finalStatus = status
|
|
159
159
|
}
|
|
160
160
|
if (finalStatus != 'granted') {
|
|
161
|
-
Alert.alert(esp.
|
|
161
|
+
Alert.alert(esp.lang("lib/image", "gallery_title"), esp.lang("lib/image", "gallery_msg"))
|
|
162
162
|
return
|
|
163
163
|
}
|
|
164
164
|
let max = 0
|
|
@@ -194,7 +194,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
194
194
|
let a: string[] = []
|
|
195
195
|
x.forEach(async (t: any, i) => {
|
|
196
196
|
if (i == 0) {
|
|
197
|
-
LibProgress.show("
|
|
197
|
+
LibProgress.show(esp.lang("lib/image", "wait"))
|
|
198
198
|
}
|
|
199
199
|
var wantedMaxSize = options?.maxDimension || 1280
|
|
200
200
|
var rawheight = t.height
|
|
@@ -238,7 +238,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
238
238
|
static processImage(result: any, maxDimension?: number): Promise<string> {
|
|
239
239
|
return new Promise((r) => {
|
|
240
240
|
if (!result.cancelled) {
|
|
241
|
-
LibProgress.show("
|
|
241
|
+
LibProgress.show(esp.lang("lib/image", "wait_upload"))
|
|
242
242
|
var wantedMaxSize = maxDimension || 1280
|
|
243
243
|
var rawheight = result.height
|
|
244
244
|
var rawwidth = result.width
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// withHooks
|
|
2
|
-
import { useSafeState } from 'esoftplay';
|
|
2
|
+
import { esp, useSafeState } from 'esoftplay';
|
|
3
3
|
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
4
4
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
5
5
|
import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
@@ -42,7 +42,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function resize(image: string) {
|
|
45
|
-
LibProgress.show("
|
|
45
|
+
LibProgress.show(esp.lang("lib/image_crop", "waiting"))
|
|
46
46
|
Image.getSize(image, async (actualWidth, actualHeight) => {
|
|
47
47
|
var wantedMaxSize = 900
|
|
48
48
|
var rawheight = actualHeight
|
|
@@ -85,7 +85,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function capture() {
|
|
88
|
-
LibProgress.show("
|
|
88
|
+
LibProgress.show(esp.lang("lib/image_crop", "waiting_crop"))
|
|
89
89
|
let crop = {
|
|
90
90
|
x: 0,
|
|
91
91
|
y: 0,
|
|
@@ -166,7 +166,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
166
166
|
LibProgress.hide()
|
|
167
167
|
}).catch(() => {
|
|
168
168
|
LibProgress.hide()
|
|
169
|
-
LibToastProperty.show("
|
|
169
|
+
LibToastProperty.show(esp.lang("lib/image_crop", "alert_out"))
|
|
170
170
|
})
|
|
171
171
|
})
|
|
172
172
|
})
|
|
@@ -231,7 +231,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
231
231
|
<Pressable
|
|
232
232
|
onPress={() => setHint(!hint)}
|
|
233
233
|
style={{ opacity: hint ? 1 : 0, position: 'absolute', left: 0, right: 0, bottom: 50, backgroundColor: 'rgba(0,0,0,0.5)', alignItems: 'center', justifyContent: 'center', padding: 30 }} >
|
|
234
|
-
<Text style={{ color: "white", textAlign: 'center' }} >{message || "
|
|
234
|
+
<Text style={{ color: "white", textAlign: 'center' }} >{message || esp.lang("lib/image_crop", "text_msg")}</Text>
|
|
235
235
|
</Pressable>
|
|
236
236
|
}
|
|
237
237
|
{
|
|
@@ -244,7 +244,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
244
244
|
}, () => { })
|
|
245
245
|
}}
|
|
246
246
|
style={{ height: 50, alignItems: 'center', justifyContent: 'center', backgroundColor: 'rgba(255,255,255,0.3)' }} >
|
|
247
|
-
<LibTextstyle textStyle="body" text="
|
|
247
|
+
<LibTextstyle textStyle="body" text={esp.lang("lib/image_crop", "btn_save")} style={{ color: "white" }} />
|
|
248
248
|
</TouchableOpacity>
|
|
249
249
|
</View>
|
|
250
250
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
3
|
//noPage
|
|
4
|
-
import { useSafeState } from 'esoftplay';
|
|
4
|
+
import { esp, useSafeState } from 'esoftplay';
|
|
5
5
|
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
6
6
|
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
7
7
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
@@ -88,7 +88,7 @@ export default function m(props: LibImage_multiProps): any {
|
|
|
88
88
|
<LibIcon name="close" />
|
|
89
89
|
</TouchableOpacity>
|
|
90
90
|
<View style={{ flex: 1, height: 50, justifyContent: 'center', alignItems: 'center' }} >
|
|
91
|
-
<LibTextstyle textStyle={"headline"} text={photos.filter((x: any) => x.selected).length + (max > 0 ? "/" + max : "") + "
|
|
91
|
+
<LibTextstyle textStyle={"headline"} text={photos.filter((x: any) => x.selected).length + (max > 0 ? "/" + max : "") + esp.lang("lib/image_multi", "selected")} style={{ color: "#000" }} />
|
|
92
92
|
</View>
|
|
93
93
|
<TouchableOpacity
|
|
94
94
|
onPress={() => LibNavigation.sendBackResult(photos.filter((x: any) => x.selected))}
|