zmp-cli 3.15.5 → 3.15.6-beta.1
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/README.md +1 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/init-zmp-ui.js +1 -216
- package/create/templates/app-parameters.js +9 -25
- package/create/templates/common/webpack/build.js +2 -40
- package/create/templates/copy-assets.js +1 -158
- package/create/templates/core/copy-assets.js +14 -82
- package/create/templates/core/generate-home-page.js +16 -38
- package/create/templates/core/generate-root.js +28 -63
- package/create/templates/core/generate-routes.js +12 -38
- package/create/templates/core/generate-scripts.js +16 -65
- package/create/templates/create-folders.js +1 -30
- package/create/templates/generate-config-xml.js +2 -9
- package/create/templates/generate-index.js +10 -35
- package/create/templates/generate-manifest.js +1 -49
- package/create/templates/generate-recoil.js +4 -16
- package/create/templates/generate-routes.js +1 -16
- package/create/templates/generate-scripts.js +1 -16
- package/create/templates/generate-service-worker.js +4 -10
- package/create/templates/generate-store.js +4 -15
- package/create/templates/generate-styles.js +10 -64
- package/create/templates/generate-webpack-config.js +43 -125
- package/create/templates/generate-zmp-custom.js +14 -72
- package/create/templates/react/copy-assets.js +1 -85
- package/create/templates/react/generate-home-page.js +20 -50
- package/create/templates/react/generate-root.js +15 -44
- package/create/templates/react/generate-routes.js +1 -16
- package/create/templates/react/generate-scripts.js +12 -38
- package/create/templates/react/pages/404.js +2 -10
- package/create/templates/react/pages/about.js +2 -10
- package/create/templates/react/pages/catalog.js +3 -17
- package/create/templates/react/pages/dynamic-route.js +2 -10
- package/create/templates/react/pages/form.js +6 -26
- package/create/templates/react/pages/index copy.js +1 -17
- package/create/templates/react/pages/index.js +1 -17
- package/create/templates/react/pages/settings.js +3 -17
- package/create/templates/react/pages/user.js +8 -27
- package/create/templates/react-typescript/components/app-items.js +2 -9
- package/create/templates/react-typescript/components/index.js +1 -9
- package/create/templates/react-typescript/components/navbar-back.js +2 -9
- package/create/templates/react-typescript/components/user-card.js +2 -9
- package/create/templates/react-typescript/copy-assets.js +1 -94
- package/create/templates/react-typescript/generate-home-page.js +20 -52
- package/create/templates/react-typescript/generate-root.js +14 -45
- package/create/templates/react-typescript/generate-routes.js +1 -12
- package/create/templates/react-typescript/generate-scripts.js +12 -37
- package/create/templates/react-typescript/pages/404.js +2 -10
- package/create/templates/react-typescript/pages/about.js +2 -10
- package/create/templates/react-typescript/pages/catalog.js +3 -17
- package/create/templates/react-typescript/pages/dynamic-route.js +2 -10
- package/create/templates/react-typescript/pages/form.js +6 -26
- package/create/templates/react-typescript/pages/index.js +1 -17
- package/create/templates/react-typescript/pages/settings.js +3 -17
- package/create/templates/react-typescript/pages/user.js +8 -27
- package/create/templates/svelte/copy-assets.js +1 -47
- package/create/templates/svelte/generate-home-page.js +20 -56
- package/create/templates/svelte/generate-root.js +22 -80
- package/create/templates/svelte/generate-routes.js +7 -22
- package/create/templates/svelte/generate-scripts.js +7 -23
- package/create/templates/vue/copy-assets.js +1 -67
- package/create/templates/vue/generate-home-page.js +2 -8
- package/create/templates/vue/generate-root.js +3 -13
- package/create/templates/vue/generate-routes.js +1 -7
- package/create/templates/vue/generate-scripts.js +9 -26
- package/create/templates/vue/global-components.d.js +1 -0
- package/create/templates/zaui/copy-assets.js +1 -90
- package/create/templates/zaui/generate-home-page.js +27 -53
- package/create/templates/zaui/generate-root.js +14 -34
- package/create/templates/zaui/generate-routes.js +1 -10
- package/create/templates/zaui/generate-scripts.js +6 -20
- package/create/templates/zaui/generate-user-card.js +3 -18
- package/create/templates/zaui/pages/about.js +3 -20
- package/create/templates/zaui/pages/form.js +3 -20
- package/create/templates/zaui/pages/index.js +1 -9
- package/create/templates/zaui/pages/user.js +3 -20
- package/create/utils/colors.js +1 -94
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-gitignore.js +1 -43
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/generate-package-json.js +1 -132
- package/create/utils/generate-readme.js +1 -28
- package/create/utils/get-options.js +1 -204
- package/create/utils/indent.js +1 -31
- package/create/utils/npm-scripts.js +1 -62
- package/create/utils/string.js +1 -13
- package/create/utils/styles-extension.js +1 -9
- package/create/utils/template-if.js +1 -9
- package/deploy/index.js +1 -148
- package/deploy/utils/get-options.js +1 -69
- package/deploy/utils/request-upload.js +1 -34
- package/deploy/utils/upload-app.js +1 -82
- package/index.js +1 -319
- package/login/index.js +1 -169
- package/login/utils/get-options.js +1 -58
- package/login/utils/zalo-login.js +1 -32
- package/migrate/icons/update-icon-v3.js +1 -19
- package/migrate/index.js +1 -60
- package/migrate/utils/get-options.js +1 -46
- package/migrate/utils/migrate-react.js +1 -33
- package/package.json +11 -39
- package/start/generate-hr-config.js +1 -59
- package/start/index.js +1 -382
- package/sync/index-to-app-config.js +1 -146
- package/sync/index.js +1 -55
- package/utils/axios.js +1 -15
- package/utils/check-update.js +1 -53
- package/utils/constants.js +1 -20
- package/utils/env.js +1 -39
- package/utils/error.js +1 -16
- package/utils/find-files-by-ext.js +1 -27
- package/utils/find-free-port.js +1 -11
- package/utils/fs-extra.js +1 -90
- package/utils/generate-pages-map.js +1 -17
- package/utils/get-app-info.js +1 -22
- package/utils/get-current-project.js +1 -25
- package/utils/get-ip.js +1 -19
- package/utils/log.js +1 -19
- package/utils/node-blob.js +1 -106
- package/utils/resumable.d.js +1 -0
- package/utils/resumable.js +1 -1204
- package/utils/spinner.js +1 -25
- package/utils/tunnel.js +1 -36
- package/.editorconfig +0 -15
- package/.eslintignore +0 -8
- package/.eslintrc.js +0 -10
- package/.vscode/launch.json +0 -23
- package/LICENSE +0 -21
- package/README.git.md +0 -37
- package/assets/index.js +0 -147
- package/build/dist/index.dev.js +0 -217
- package/config/dist/index.dev.js +0 -48
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/utils/dist/get-options.dev.js +0 -277
- package/deploy/dist/index.dev.js +0 -227
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/screenshots/wellcome.jpg +0 -0
- package/show-qr-app/assets/css/style.css +0 -87
- package/show-qr-app/assets/js/qrcode.min.js +0 -1
- package/show-qr-app/index.html +0 -57
- package/show-qr-app/package.json +0 -14
- package/start/dist/index.dev.js +0 -312
- package/ui/server.js +0 -194
- package/ui/www/css/app.css +0 -1
- package/ui/www/css/app.css.map +0 -1
- package/ui/www/fonts/ZMPIcons-Regular.eot +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.ttf +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff2 +0 -0
- package/ui/www/images/logo.png +0 -0
- package/ui/www/index.html +0 -1
- package/ui/www/js/app.js +0 -3
- package/ui/www/js/app.js.LICENSE.txt +0 -20
- package/ui/www/js/app.js.map +0 -1
- package/ui/www/static/icons/apple-touch-icon.png +0 -0
- package/ui/www/static/icons/favicon.png +0 -0
- package/utils/dist/get-app-info.dev.js +0 -54
|
@@ -1,17 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const copyForm = require('./form');
|
|
3
|
-
const copyDynamicRoute = require('./dynamic-route');
|
|
4
|
-
const copyAbout = require('./about');
|
|
5
|
-
const copy404 = require('./404');
|
|
6
|
-
const copySettings = require('./settings');
|
|
7
|
-
const copyCatalog = require('./catalog');
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
copyUser,
|
|
11
|
-
copyForm,
|
|
12
|
-
copyDynamicRoute,
|
|
13
|
-
copyAbout,
|
|
14
|
-
copy404,
|
|
15
|
-
copySettings,
|
|
16
|
-
copyCatalog,
|
|
17
|
-
};
|
|
1
|
+
"use strict";const e=require("./user"),r=require("./form"),u=require("./dynamic-route"),i=require("./about"),t=require("./404"),o=require("./settings"),q=require("./catalog");module.exports={copyUser:e,copyForm:r,copyDynamicRoute:u,copyAbout:i,copy404:t,copySettings:o,copyCatalog:q};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
if (options.stateManagement === 'recoil') {
|
|
6
|
-
return indent(
|
|
7
|
-
0,
|
|
8
|
-
`
|
|
1
|
+
"use strict";const e=require("../../../utils/indent");module.exports=t=>"recoil"===t.stateManagement?e(0,`
|
|
9
2
|
import React from "react";
|
|
10
3
|
import { useRecoilValue } from 'recoil';
|
|
11
4
|
import {
|
|
@@ -36,12 +29,7 @@ module.exports = (options) => {
|
|
|
36
29
|
};
|
|
37
30
|
|
|
38
31
|
export default SettingsPage;
|
|
39
|
-
`
|
|
40
|
-
).trim();
|
|
41
|
-
}
|
|
42
|
-
return indent(
|
|
43
|
-
0,
|
|
44
|
-
`
|
|
32
|
+
`).trim():e(0,`
|
|
45
33
|
import React from "react";
|
|
46
34
|
import {
|
|
47
35
|
Page,
|
|
@@ -71,6 +59,4 @@ module.exports = (options) => {
|
|
|
71
59
|
};
|
|
72
60
|
|
|
73
61
|
export default SettingsPage;
|
|
74
|
-
`
|
|
75
|
-
).trim();
|
|
76
|
-
};
|
|
62
|
+
`).trim();
|
|
@@ -1,37 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
const { template, stateManagement } = options;
|
|
5
|
-
const hideNavBar =
|
|
6
|
-
template === 'tabs'
|
|
7
|
-
? `
|
|
1
|
+
"use strict";const e=require("../../../utils/indent");module.exports=t=>{let{template:r,stateManagement:a}=t,s="tabs"===r?`
|
|
8
2
|
onPageBeforeIn={()=>{
|
|
9
3
|
//hide navbar
|
|
10
4
|
zmp.toolbar.hide('#app-tab-bar')
|
|
11
|
-
}}
|
|
12
|
-
: '';
|
|
13
|
-
const modules = ['Avatar', 'List', 'ListItem', 'Page', 'Title'];
|
|
14
|
-
if (stateManagement === 'store') {
|
|
15
|
-
modules.push('useStore');
|
|
16
|
-
}
|
|
17
|
-
if (template === 'tabs') {
|
|
18
|
-
modules.push('zmp');
|
|
19
|
-
}
|
|
20
|
-
return indent(
|
|
21
|
-
0,
|
|
22
|
-
`
|
|
5
|
+
}}`:"",i=["Avatar","List","ListItem","Page","Title"];return"store"===a&&i.push("useStore"),"tabs"===r&&i.push("zmp"),e(0,`
|
|
23
6
|
import React from 'react'
|
|
24
|
-
import { ${
|
|
25
|
-
import NavbarBack from '../components/navbar-back'${
|
|
7
|
+
import { ${i.join(", ")} } from 'zmp-framework/react'
|
|
8
|
+
import NavbarBack from '../components/navbar-back'${"recoil"===a?`
|
|
26
9
|
import { useRecoilValue } from 'recoil';
|
|
27
|
-
import { userState } from '../state'
|
|
10
|
+
import { userState } from '../state';`:""}
|
|
28
11
|
|
|
29
12
|
const UserPage = () => {
|
|
30
|
-
${
|
|
13
|
+
${"recoil"===a?"const user = useRecoilValue(userState);":"const user = useStore('user')"}
|
|
31
14
|
|
|
32
15
|
return (
|
|
33
16
|
<Page
|
|
34
|
-
name="user"${
|
|
17
|
+
name="user"${s}
|
|
35
18
|
>
|
|
36
19
|
<NavbarBack
|
|
37
20
|
title="User info"
|
|
@@ -51,6 +34,4 @@ module.exports = (options) => {
|
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
export default UserPage;
|
|
54
|
-
`
|
|
55
|
-
).trim();
|
|
56
|
-
};
|
|
37
|
+
`).trim()};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
return indent(
|
|
5
|
-
0,
|
|
6
|
-
`
|
|
1
|
+
"use strict";const o=require("../../../utils/indent");module.exports=e=>o(0,`
|
|
7
2
|
import React from 'react';
|
|
8
3
|
import { Icon, Grid, GridItem, ToastPreloader } from 'zmp-framework/react';
|
|
9
4
|
|
|
@@ -48,6 +43,4 @@ module.exports = (options) => {
|
|
|
48
43
|
AppItems.displayName = 'zmp-app-items'
|
|
49
44
|
|
|
50
45
|
export default AppItems
|
|
51
|
-
`
|
|
52
|
-
).trim();
|
|
53
|
-
};
|
|
46
|
+
`).trim();
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const copyNavbarBack = require('./navbar-back');
|
|
3
|
-
const copyUserCard = require('./user-card');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
copyAppItems,
|
|
7
|
-
copyNavbarBack,
|
|
8
|
-
copyUserCard,
|
|
9
|
-
};
|
|
1
|
+
"use strict";const e=require("./app-items"),r=require("./navbar-back"),s=require("./user-card");module.exports={copyAppItems:e,copyNavbarBack:r,copyUserCard:s};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
return indent(
|
|
5
|
-
0,
|
|
6
|
-
`
|
|
1
|
+
"use strict";const a=require("../../../utils/indent");module.exports=t=>a(0,`
|
|
7
2
|
import React from 'react';
|
|
8
3
|
import { Link, Navbar, NavLeft, Icon, NavTitle, NavRight } from 'zmp-framework/react';
|
|
9
4
|
|
|
@@ -35,6 +30,4 @@ module.exports = (options) => {
|
|
|
35
30
|
|
|
36
31
|
|
|
37
32
|
export default NavbarBack;
|
|
38
|
-
`
|
|
39
|
-
).trim();
|
|
40
|
-
};
|
|
33
|
+
`).trim();
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
return indent(
|
|
5
|
-
0,
|
|
6
|
-
`
|
|
1
|
+
"use strict";const r=require("../../../utils/indent");module.exports=e=>r(0,`
|
|
7
2
|
import React from 'react';
|
|
8
3
|
import { Avatar, Title } from 'zmp-framework/react';
|
|
9
4
|
import { userInfo } from 'zmp-sdk';
|
|
@@ -27,6 +22,4 @@ module.exports = (options) => {
|
|
|
27
22
|
UserCard.displayName = 'zmp-user-card'
|
|
28
23
|
|
|
29
24
|
export default UserCard;
|
|
30
|
-
`
|
|
31
|
-
).trim();
|
|
32
|
-
};
|
|
25
|
+
`).trim();
|
|
@@ -1,94 +1 @@
|
|
|
1
|
-
const path =
|
|
2
|
-
const generateHomePage = require('./generate-home-page');
|
|
3
|
-
const generateRoot = require('./generate-root');
|
|
4
|
-
const generateStore = require('../generate-store');
|
|
5
|
-
const generateRecoil = require('../generate-recoil');
|
|
6
|
-
const copyComponents = require('./components');
|
|
7
|
-
const copyPages = require('./pages');
|
|
8
|
-
const copyViteConfig = require('./vite.config');
|
|
9
|
-
|
|
10
|
-
module.exports = (options) => {
|
|
11
|
-
const cwd = options.cwd || process.cwd();
|
|
12
|
-
const { template, stateManagement } = options;
|
|
13
|
-
const toCopy = [];
|
|
14
|
-
|
|
15
|
-
// Copy Pages
|
|
16
|
-
let pages = [];
|
|
17
|
-
if (template !== 'blank')
|
|
18
|
-
pages.push(
|
|
19
|
-
...[
|
|
20
|
-
{ fileName: '404', content: 'copy404' },
|
|
21
|
-
{ fileName: 'about', content: 'copyAbout' },
|
|
22
|
-
{ fileName: 'dynamic-route', content: 'copyDynamicRoute' },
|
|
23
|
-
{ fileName: 'user', content: 'copyUser' },
|
|
24
|
-
{ fileName: 'form', content: 'copyForm' },
|
|
25
|
-
]
|
|
26
|
-
);
|
|
27
|
-
if (template === 'tabs') {
|
|
28
|
-
pages.push(
|
|
29
|
-
...[
|
|
30
|
-
{ fileName: 'catalog', content: 'copyCatalog' },
|
|
31
|
-
{ fileName: 'settings', content: 'copySettings' },
|
|
32
|
-
]
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
pages.forEach(({ fileName, content }) => {
|
|
37
|
-
const dest = path.resolve(cwd, 'src', 'pages', `${fileName}.tsx`);
|
|
38
|
-
toCopy.push({
|
|
39
|
-
content: copyPages[content](options),
|
|
40
|
-
to: dest,
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
toCopy.push({
|
|
44
|
-
content: generateHomePage(options),
|
|
45
|
-
to: path.resolve(cwd, 'src', 'pages', 'index.tsx'),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Copy compoents
|
|
49
|
-
const components = [
|
|
50
|
-
...(template !== 'blank'
|
|
51
|
-
? [
|
|
52
|
-
{ fileName: 'app-items', content: 'copyAppItems' },
|
|
53
|
-
{ fileName: 'navbar-back', content: 'copyNavbarBack' },
|
|
54
|
-
{ fileName: 'user-card', content: 'copyUserCard' },
|
|
55
|
-
]
|
|
56
|
-
: []),
|
|
57
|
-
];
|
|
58
|
-
components.forEach(({ fileName, content }) => {
|
|
59
|
-
const dest = path.resolve(cwd, 'src', 'components', `${fileName}.tsx`);
|
|
60
|
-
toCopy.push({
|
|
61
|
-
content: copyComponents[content](options),
|
|
62
|
-
to: dest,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
toCopy.push({
|
|
67
|
-
content: generateRoot(options),
|
|
68
|
-
to: path.resolve(cwd, 'src', 'components', 'app.tsx'),
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (stateManagement === 'recoil') {
|
|
72
|
-
toCopy.push({
|
|
73
|
-
content: generateRecoil(options),
|
|
74
|
-
to: path.resolve(cwd, 'src', 'state.ts'),
|
|
75
|
-
});
|
|
76
|
-
} else {
|
|
77
|
-
toCopy.push({
|
|
78
|
-
content: generateStore(options),
|
|
79
|
-
to: path.resolve(cwd, 'src', 'store.ts'),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
toCopy.push({
|
|
84
|
-
content: copyViteConfig(options),
|
|
85
|
-
to: path.resolve(cwd, 'vite.config.ts'),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
toCopy.push({
|
|
89
|
-
from: path.resolve(__dirname, '_tsconfig.json'),
|
|
90
|
-
to: path.resolve(cwd, 'tsconfig.json'),
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
return toCopy;
|
|
94
|
-
};
|
|
1
|
+
"use strict";const e=require("path"),t=require("./generate-home-page"),o=require("./generate-root"),n=require("../generate-store"),s=require("../generate-recoil"),r=require("./components"),c=require("./pages"),a=require("./vite.config");module.exports=p=>{let i=p.cwd||process.cwd(),{template:l,stateManagement:u}=p,m=[],f=[];return"blank"!==l&&f.push({fileName:"404",content:"copy404"},{fileName:"about",content:"copyAbout"},{fileName:"dynamic-route",content:"copyDynamicRoute"},{fileName:"user",content:"copyUser"},{fileName:"form",content:"copyForm"}),"tabs"===l&&f.push({fileName:"catalog",content:"copyCatalog"},{fileName:"settings",content:"copySettings"}),f.forEach(({fileName:t,content:o})=>{let n=e.resolve(i,"src","pages",`${t}.tsx`);m.push({content:c[o](p),to:n})}),m.push({content:t(p),to:e.resolve(i,"src","pages","index.tsx")}),[..."blank"!==l?[{fileName:"app-items",content:"copyAppItems"},{fileName:"navbar-back",content:"copyNavbarBack"},{fileName:"user-card",content:"copyUserCard"}]:[]].forEach(({fileName:t,content:o})=>{let n=e.resolve(i,"src","components",`${t}.tsx`);m.push({content:r[o](p),to:n})}),m.push({content:o(p),to:e.resolve(i,"src","components","app.tsx")}),"recoil"===u?m.push({content:s(p),to:e.resolve(i,"src","state.ts")}):m.push({content:n(p),to:e.resolve(i,"src","store.ts")}),m.push({content:a(p),to:e.resolve(i,"vite.config.ts")}),m.push({from:e.resolve(__dirname,"_tsconfig.json"),to:e.resolve(i,"tsconfig.json")}),m};
|
|
@@ -1,44 +1,23 @@
|
|
|
1
|
-
const
|
|
2
|
-
module.exports = (options) => {
|
|
3
|
-
const { name, template, theming, stateManagement } = options;
|
|
4
|
-
const { fillBars } = theming;
|
|
5
|
-
|
|
6
|
-
let description = '';
|
|
7
|
-
if (template === 'single-view' || template === 'blank') {
|
|
8
|
-
description = `
|
|
1
|
+
"use strict";const t=require("../../utils/indent");module.exports=e=>{let{name:a,template:i,theming:r,stateManagement:o}=e,{fillBars:s}=r,n="";return("single-view"===i||"blank"===i)&&(n=`
|
|
9
2
|
<p>Here is your blank ZMP app. Let's see what we have here.</p>
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
if (template === 'split-view') {
|
|
13
|
-
description = `
|
|
3
|
+
`),"split-view"===i&&(n=`
|
|
14
4
|
<p>This is an example of split view application layout, commonly used on tablets. The main approach of such kind of layout is that you can see different views at the same time.</p>
|
|
15
5
|
|
|
16
6
|
<p>Each view may have different layout, different navbar type (dynamic, fixed or static) or without navbar.</p>
|
|
17
7
|
|
|
18
8
|
<p>The fun thing is that you can easily control one view from another without any line of JavaScript just using "data-view" attribute on links.</p>
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
if (template === 'tabs') {
|
|
22
|
-
description = `
|
|
9
|
+
`),"tabs"===i&&(n=`
|
|
23
10
|
<p>Here is your blank ZMP app with tabs-layout. Let's see what we have here.</p>
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return indent(
|
|
28
|
-
0,
|
|
29
|
-
`
|
|
11
|
+
`),t(0,`
|
|
30
12
|
import React from 'react';
|
|
31
|
-
${
|
|
32
|
-
template === 'blank'
|
|
33
|
-
? `
|
|
13
|
+
${"blank"===i?`
|
|
34
14
|
import {
|
|
35
15
|
Page,
|
|
36
16
|
Navbar,
|
|
37
17
|
NavTitleLarge,
|
|
38
18
|
Card
|
|
39
19
|
} from 'zmp-framework/react';
|
|
40
|
-
`.trim()
|
|
41
|
-
: `
|
|
20
|
+
`.trim():`
|
|
42
21
|
import {
|
|
43
22
|
Page,
|
|
44
23
|
Navbar,
|
|
@@ -46,32 +25,27 @@ module.exports = (options) => {
|
|
|
46
25
|
List,
|
|
47
26
|
ListItem,
|
|
48
27
|
Card,
|
|
49
|
-
${
|
|
50
|
-
} from 'zmp-framework/react';${
|
|
28
|
+
${"store"===o?"useStore,":""}
|
|
29
|
+
} from 'zmp-framework/react';${"recoil"===o?`
|
|
51
30
|
import { useRecoilValue } from 'recoil';
|
|
52
|
-
import { userState } from '../state'
|
|
31
|
+
import { userState } from '../state';`:""}
|
|
53
32
|
import AppItems from '../components/app-items';
|
|
54
33
|
import UserCard from '../components/user-card';
|
|
55
|
-
`.trim()
|
|
56
|
-
}
|
|
34
|
+
`.trim()}
|
|
57
35
|
|
|
58
36
|
const HomePage = () => {
|
|
59
|
-
${
|
|
37
|
+
${"blank"!==i?"recoil"===o?"const user = useRecoilValue(userState);":"const user = useStore('user');":""}
|
|
60
38
|
return (
|
|
61
|
-
<Page name="home" ${
|
|
39
|
+
<Page name="home" ${"tabs"===i?"":"navbarLarge"}>${"tabs"!==i?`
|
|
62
40
|
{/* Top Navbar */}
|
|
63
|
-
<Navbar ${
|
|
64
|
-
<NavTitleLarge>${
|
|
65
|
-
</Navbar
|
|
66
|
-
: ''
|
|
67
|
-
}
|
|
41
|
+
<Navbar ${s?"fill":""}>
|
|
42
|
+
<NavTitleLarge>${a}</NavTitleLarge>
|
|
43
|
+
</Navbar>`:""}
|
|
68
44
|
{/* Page content */}
|
|
69
45
|
<Card inset>
|
|
70
|
-
${
|
|
46
|
+
${n.trim()}
|
|
71
47
|
</Card>
|
|
72
|
-
${
|
|
73
|
-
template !== 'blank' && template !== 'tabs'
|
|
74
|
-
? `
|
|
48
|
+
${"blank"!==i&&"tabs"!==i?`
|
|
75
49
|
{/* User info */}
|
|
76
50
|
<List>
|
|
77
51
|
<ListItem link="/user/">
|
|
@@ -88,9 +62,7 @@ module.exports = (options) => {
|
|
|
88
62
|
<ListItem title="Default Route (404)" link="/something-that-doesnt-exist" />
|
|
89
63
|
<ListItem title="About" link="/about/" />
|
|
90
64
|
</List>
|
|
91
|
-
`.trim()
|
|
92
|
-
: ''
|
|
93
|
-
}${template === 'tabs' ? `
|
|
65
|
+
`.trim():""}${"tabs"===i?`
|
|
94
66
|
{/* Grid apps */}
|
|
95
67
|
<AppItems />
|
|
96
68
|
|
|
@@ -100,14 +72,10 @@ module.exports = (options) => {
|
|
|
100
72
|
<ListItem title="Default Route (404)" link="/something-that-doesnt-exist" />
|
|
101
73
|
<ListItem title="About" link="/about/" />
|
|
102
74
|
</List>
|
|
103
|
-
`.trim()
|
|
104
|
-
: ''
|
|
105
|
-
}
|
|
75
|
+
`.trim():""}
|
|
106
76
|
</Page>
|
|
107
77
|
);
|
|
108
78
|
}
|
|
109
79
|
|
|
110
80
|
export default HomePage;
|
|
111
|
-
`
|
|
112
|
-
).trim();
|
|
113
|
-
};
|
|
81
|
+
`).trim()};
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
const appParameters = require('../app-parameters');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const { theming, template, stateManagement } = options;
|
|
7
|
-
// Views
|
|
8
|
-
let views = '';
|
|
9
|
-
if (
|
|
10
|
-
template === 'single-view' ||
|
|
11
|
-
template === 'split-view' ||
|
|
12
|
-
template === 'blank'
|
|
13
|
-
) {
|
|
14
|
-
views = indent(
|
|
15
|
-
0,
|
|
16
|
-
`
|
|
1
|
+
"use strict";const i=require("../../utils/template-if"),e=require("../../utils/indent"),a=require("../app-parameters");module.exports=t=>{let{theming:r,template:o,stateManagement:m}=t,n="";return("single-view"===o||"split-view"===o||"blank"===o)&&(n=e(0,`
|
|
17
2
|
{/* Your main view, should have "view-main" class */}
|
|
18
3
|
<View main className="safe-areas" url="/" />
|
|
19
|
-
`
|
|
20
|
-
).trim();
|
|
21
|
-
}
|
|
22
|
-
if (template === 'tabs') {
|
|
23
|
-
views = indent(
|
|
24
|
-
0,
|
|
25
|
-
`
|
|
4
|
+
`).trim()),"tabs"===o&&(n=e(0,`
|
|
26
5
|
{/* TabView container */}
|
|
27
6
|
<TabView className="safe-areas">
|
|
28
7
|
{/* Tabbar for switching Tab*/}
|
|
@@ -42,40 +21,30 @@ module.exports = (options) => {
|
|
|
42
21
|
<View id="view-catalog" name="catalog" tab url="/catalog/" />
|
|
43
22
|
<View id="view-settings" name="settings" tab url="/settings/" />
|
|
44
23
|
</TabView>
|
|
45
|
-
`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return indent(
|
|
50
|
-
0,
|
|
51
|
-
`
|
|
24
|
+
`)),e(0,`
|
|
52
25
|
import React from 'react';
|
|
53
|
-
${[
|
|
54
|
-
? `
|
|
26
|
+
${["blank","single-view"].indexOf(o)>=0?`
|
|
55
27
|
import { App, View } from 'zmp-framework/react';
|
|
56
|
-
`.trim()
|
|
57
|
-
: `
|
|
28
|
+
`.trim():`
|
|
58
29
|
import { App, TabView, View, Tabbar, Link } from 'zmp-framework/react';
|
|
59
30
|
`.trim()}
|
|
60
|
-
${
|
|
31
|
+
${i("recoil"===m,()=>"import { RecoilRoot } from 'recoil';",()=>"import store from '../store';")}
|
|
61
32
|
|
|
62
33
|
const MyApp = () => {
|
|
63
34
|
// ZMP Parameters
|
|
64
35
|
const zmpparams = {
|
|
65
|
-
${
|
|
36
|
+
${e(8,a(t))}
|
|
66
37
|
};
|
|
67
38
|
|
|
68
39
|
${`
|
|
69
|
-
return (${
|
|
70
|
-
<RecoilRoot
|
|
71
|
-
${
|
|
72
|
-
${
|
|
73
|
-
${
|
|
74
|
-
</RecoilRoot
|
|
40
|
+
return (${"recoil"===m?`
|
|
41
|
+
<RecoilRoot>`:""}
|
|
42
|
+
${e("recoil"===m?2:0,`<App {...zmpparams} ${r.darkTheme?"themeDark":""}>`)}
|
|
43
|
+
${e("recoil"===m?12:10,n)}
|
|
44
|
+
${e("recoil"===m?2:0,"</App>")}${"recoil"===m?`
|
|
45
|
+
</RecoilRoot>`:""}
|
|
75
46
|
);
|
|
76
47
|
`.trim()}
|
|
77
48
|
}
|
|
78
49
|
export default MyApp;
|
|
79
|
-
`
|
|
80
|
-
).trim();
|
|
81
|
-
};
|
|
50
|
+
`).trim()};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
module.exports =
|
|
2
|
-
const { template } = options;
|
|
3
|
-
|
|
4
|
-
if (template === 'blank') {
|
|
5
|
-
return [];
|
|
6
|
-
}
|
|
7
|
-
const routes = ['/user', '/form', '/dynamic-route', '/about', '/404'];
|
|
8
|
-
if (template === 'tabs') {
|
|
9
|
-
routes.push(...['/catalog', '/settings']);
|
|
10
|
-
}
|
|
11
|
-
return routes;
|
|
12
|
-
};
|
|
1
|
+
"use strict";module.exports=t=>{let{template:e}=t;if("blank"===e)return[];let r=["/user","/form","/dynamic-route","/about","/404"];return"tabs"===e&&r.push("/catalog","/settings"),r};
|
|
@@ -1,50 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
const stylesExtension = require('../../utils/styles-extension');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const { cssPreProcessor, theming, customBuild, includeTailwind } = options;
|
|
7
|
-
let scripts = '';
|
|
8
|
-
|
|
9
|
-
scripts += indent(
|
|
10
|
-
0,
|
|
11
|
-
`
|
|
1
|
+
"use strict";const t=require("../../utils/template-if"),o=require("../../utils/indent"),e=require("../../utils/styles-extension");module.exports=r=>{let{cssPreProcessor:p,theming:m,customBuild:s,includeTailwind:i}=r,n="";return(n+=o(0,`
|
|
12
2
|
// Import React and ReactDOM
|
|
13
3
|
import React from 'react';
|
|
14
4
|
import { createRoot } from 'react-dom/client';
|
|
15
5
|
|
|
16
6
|
// Import ZMP
|
|
17
|
-
import ZMP from '${
|
|
18
|
-
customBuild ? './zmp-custom.js' : 'zmp-framework/core/lite-bundle'
|
|
19
|
-
}';
|
|
7
|
+
import ZMP from '${s?"./zmp-custom.js":"zmp-framework/core/lite-bundle"}';
|
|
20
8
|
|
|
21
9
|
// Import ZMP-React Plugin
|
|
22
|
-
import ZMPReact from 'zmp-framework/react';${
|
|
10
|
+
import ZMPReact from 'zmp-framework/react';${i?`
|
|
23
11
|
|
|
24
12
|
// Import tailwind styles
|
|
25
|
-
import './css/tailwind.css'
|
|
13
|
+
import './css/tailwind.css';`:""}
|
|
26
14
|
|
|
27
15
|
// Import ZMP Styles
|
|
28
|
-
${
|
|
29
|
-
customBuild,
|
|
30
|
-
() => `
|
|
16
|
+
${t(s,()=>`
|
|
31
17
|
import './css/zmp-custom.less';
|
|
32
|
-
`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
theming.useUiKits ? 'zmp-bundle.min.css' : 'zmp.min.css'
|
|
36
|
-
}';
|
|
37
|
-
`
|
|
38
|
-
)}
|
|
18
|
+
`,()=>`
|
|
19
|
+
import 'zmp-framework/${m.useUiKits?"zmp-bundle.min.css":"zmp.min.css"}';
|
|
20
|
+
`)}
|
|
39
21
|
|
|
40
22
|
// Import Icons and App Custom Styles
|
|
41
|
-
${
|
|
42
|
-
theming.iconFonts,
|
|
43
|
-
() => `
|
|
23
|
+
${t(m.iconFonts,()=>`
|
|
44
24
|
import './css/icons.css';
|
|
45
|
-
`
|
|
46
|
-
)}
|
|
47
|
-
import './css/app.${stylesExtension(cssPreProcessor)}';
|
|
25
|
+
`)}
|
|
26
|
+
import './css/app.${e(p)}';
|
|
48
27
|
|
|
49
28
|
// Import App Component
|
|
50
29
|
import App from './components/app';
|
|
@@ -60,8 +39,4 @@ module.exports = (options) => {
|
|
|
60
39
|
// Mount React App
|
|
61
40
|
const root = createRoot(document.getElementById('app')!);
|
|
62
41
|
root.render(React.createElement(App));
|
|
63
|
-
`
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return scripts.trim();
|
|
67
|
-
};
|
|
42
|
+
`)).trim()};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
return indent(
|
|
6
|
-
0,
|
|
7
|
-
`
|
|
1
|
+
"use strict";const t=require("../../../utils/indent");module.exports=e=>t(0,`
|
|
8
2
|
import React from 'react';
|
|
9
3
|
import { Page, Card, Title, Box } from 'zmp-framework/react';
|
|
10
4
|
import NavbarBack from '../components/navbar-back';
|
|
@@ -22,6 +16,4 @@ module.exports = (options) => {
|
|
|
22
16
|
);
|
|
23
17
|
|
|
24
18
|
export default NotFoundPage;
|
|
25
|
-
`
|
|
26
|
-
).trim();
|
|
27
|
-
};
|
|
19
|
+
`).trim();
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
return indent(
|
|
6
|
-
0,
|
|
7
|
-
`
|
|
1
|
+
"use strict";const t=require("../../../utils/indent");module.exports=o=>t(0,`
|
|
8
2
|
import React from 'react'
|
|
9
3
|
import { Actions, ActionsButton, ActionsGroup, ActionsLabel, Button, Card, Page, Box } from 'zmp-framework/react';
|
|
10
4
|
import NavbarBack from '../components/navbar-back';
|
|
@@ -47,6 +41,4 @@ module.exports = (options) => {
|
|
|
47
41
|
}
|
|
48
42
|
|
|
49
43
|
export default AboutPage;
|
|
50
|
-
`
|
|
51
|
-
).trim();
|
|
52
|
-
};
|
|
44
|
+
`).trim();
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
if (options.stateManagement === 'recoil') {
|
|
6
|
-
return indent(
|
|
7
|
-
0,
|
|
8
|
-
`
|
|
1
|
+
"use strict";const t=require("../../../utils/indent");module.exports=e=>"recoil"===e.stateManagement?t(0,`
|
|
9
2
|
import React from "react";
|
|
10
3
|
import { useRecoilState } from 'recoil';
|
|
11
4
|
import { Page, Title, List, ListItem, Box, Button } from 'zmp-framework/react';
|
|
@@ -51,12 +44,7 @@ module.exports = (options) => {
|
|
|
51
44
|
};
|
|
52
45
|
|
|
53
46
|
export default CatalogPage;
|
|
54
|
-
`
|
|
55
|
-
).trim();
|
|
56
|
-
}
|
|
57
|
-
return indent(
|
|
58
|
-
0,
|
|
59
|
-
`
|
|
47
|
+
`).trim():t(0,`
|
|
60
48
|
import React from "react";
|
|
61
49
|
import {
|
|
62
50
|
Page,
|
|
@@ -107,6 +95,4 @@ module.exports = (options) => {
|
|
|
107
95
|
};
|
|
108
96
|
|
|
109
97
|
export default CatalogPage;
|
|
110
|
-
`
|
|
111
|
-
).trim();
|
|
112
|
-
};
|
|
98
|
+
`).trim();
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
return indent(
|
|
6
|
-
0,
|
|
7
|
-
`
|
|
1
|
+
"use strict";const t=require("../../../utils/indent");module.exports=e=>t(0,`
|
|
8
2
|
import React from 'react'
|
|
9
3
|
import { Button, Box, List, ListItem, Page } from 'zmp-framework/react'
|
|
10
4
|
import NavbarBack from '../components/navbar-back';
|
|
@@ -75,6 +69,4 @@ module.exports = (options) => {
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
export default DymanicRoutePage;
|
|
78
|
-
`
|
|
79
|
-
).trim();
|
|
80
|
-
};
|
|
72
|
+
`).trim();
|