@agung_dhewe/webapps 1.1.2
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/LICENSE +28 -0
- package/README.md +2 -0
- package/jsconfig.json +10 -0
- package/libs/fgta5js-dist/fgta5js-v1.8.3.min.css +2 -0
- package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js +11 -0
- package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js.map +1 -0
- package/libs/fgta5js-dist/fonts/karla-italic-latin-ext.woff2 +0 -0
- package/libs/fgta5js-dist/fonts/karla-italic-latin.woff2 +0 -0
- package/libs/fgta5js-dist/fonts/karla-normal-latin-ext.woff2 +0 -0
- package/libs/fgta5js-dist/fonts/karla-normal-latin.woff2 +0 -0
- package/libs/fgta5js-dist/fonts/karla.css +142 -0
- package/libs/webmodule/module-edit.css +163 -0
- package/libs/webmodule/module-footer.css +22 -0
- package/libs/webmodule/module-list.css +25 -0
- package/libs/webmodule/module.css +52 -0
- package/libs/webmodule/module.js +195 -0
- package/libs/webmodule/pagehelper.mjs +45 -0
- package/modules/generator/appgen-components.mjs +142 -0
- package/modules/generator/appgen-icons.mjs +6 -0
- package/modules/generator/appgen-io.mjs +784 -0
- package/modules/generator/appgen-ui-search.mjs +173 -0
- package/modules/generator/appgen-ui-unique.mjs +153 -0
- package/modules/generator/appgen-ui.mjs +1181 -0
- package/modules/generator/generator-context.mjs +18 -0
- package/modules/generator/generator-designtemplate.html +1508 -0
- package/modules/generator/generator-ext.html +0 -0
- package/modules/generator/generator-ext.mjs +3 -0
- package/modules/generator/generator.css +642 -0
- package/modules/generator/generator.mjs +195 -0
- package/modules/generator/generator.png +0 -0
- package/modules/generator/generatorEdit.html +185 -0
- package/modules/generator/generatorEdit.mjs +238 -0
- package/modules/generator/generatorList.html +32 -0
- package/modules/generator/generatorList.mjs +243 -0
- package/modules/login/login.css +11 -0
- package/modules/login/login.html +12 -0
- package/modules/login/login.mjs +111 -0
- package/package.json +46 -0
- package/percobaan/simmpan-ke-minio.js +24 -0
- package/src/api.js +80 -0
- package/src/apis/generator.api.js +226 -0
- package/src/apis/login.api.js +109 -0
- package/src/bucket.js +24 -0
- package/src/context.js +26 -0
- package/src/datalog.sql +22 -0
- package/src/datarecords.js +0 -0
- package/src/db.js +61 -0
- package/src/generator/createApiExtenderModule.js +54 -0
- package/src/generator/createApiModule.js +218 -0
- package/src/generator/createIcon.js +62 -0
- package/src/generator/createInfoAboutExtender.js +42 -0
- package/src/generator/createInfoLogs.js +41 -0
- package/src/generator/createInfoRecordExtender.js +41 -0
- package/src/generator/createModuleContext.js +48 -0
- package/src/generator/createModuleDetilEditHtml.js +110 -0
- package/src/generator/createModuleDetilEditMjs.js +172 -0
- package/src/generator/createModuleDetilListHtml.js +146 -0
- package/src/generator/createModuleDetilListMjs.js +73 -0
- package/src/generator/createModuleEjs.js +51 -0
- package/src/generator/createModuleExtenderHtml.js +43 -0
- package/src/generator/createModuleExtenderMjs.js +43 -0
- package/src/generator/createModuleHeaderEditHtml.js +148 -0
- package/src/generator/createModuleHeaderEditMjs.js +197 -0
- package/src/generator/createModuleHeaderListHtml.js +144 -0
- package/src/generator/createModuleHeaderListMjs.js +67 -0
- package/src/generator/createModuleMjs.js +67 -0
- package/src/generator/createModuleRollup.js +42 -0
- package/src/generator/createProgramData.js +96 -0
- package/src/generator/createTable.js +156 -0
- package/src/generator/ddl.js +475 -0
- package/src/generator/helper.js +149 -0
- package/src/generator/templates/__rollup-module.ejs +90 -0
- package/src/generator/templates/api-extender-module.js.ejs +0 -0
- package/src/generator/templates/api-module.js.ejs +818 -0
- package/src/generator/templates/module-context.ejs +16 -0
- package/src/generator/templates/module-ext-about.ejs +1 -0
- package/src/generator/templates/module-ext-record.ejs +1 -0
- package/src/generator/templates/module-ext.html.ejs +3 -0
- package/src/generator/templates/module-ext.mjs.ejs +21 -0
- package/src/generator/templates/module-logs.ejs +14 -0
- package/src/generator/templates/module.ejs.ejs +48 -0
- package/src/generator/templates/module.mjs.ejs +256 -0
- package/src/generator/templates/moduleDetilEdit.html.ejs +34 -0
- package/src/generator/templates/moduleDetilEdit.mjs.ejs +792 -0
- package/src/generator/templates/moduleDetilList.html.ejs +26 -0
- package/src/generator/templates/moduleDetilList.mjs.ejs +319 -0
- package/src/generator/templates/moduleHeaderEdit.html.ejs +53 -0
- package/src/generator/templates/moduleHeaderEdit.mjs.ejs +807 -0
- package/src/generator/templates/moduleHeaderList.html.ejs +24 -0
- package/src/generator/templates/moduleHeaderList.mjs.ejs +308 -0
- package/src/generator/templates/sqlAddField.ejs +3 -0
- package/src/generator/templates/sqlAddForeignKey.ejs +12 -0
- package/src/generator/templates/sqlAddUniqueIndex.ejs +4 -0
- package/src/generator/templates/sqlCreateTable.ejs +9 -0
- package/src/generator/templates/sqlDropForeignKey.ejs +3 -0
- package/src/generator/templates/sqlDropUniqueIndex.ejs +4 -0
- package/src/generator/templates/sqlModifyField.ejs +6 -0
- package/src/generator/trygenerate.js +83 -0
- package/src/generator/worker.js +389 -0
- package/src/helper.js +82 -0
- package/src/logger.js +39 -0
- package/src/router.js +84 -0
- package/src/routers/defaultLoginApi.js +29 -0
- package/src/routers/defaultLoginAsset.js +18 -0
- package/src/routers/defaultLoginPage.js +36 -0
- package/src/routers/defaultRootIndex.js +16 -0
- package/src/routers/downloadHandler.js +51 -0
- package/src/routers/fileUploadApi.js +15 -0
- package/src/routers/generatorApi.js +30 -0
- package/src/routers/generatorAsset.js +18 -0
- package/src/routers/generatorPage.js +37 -0
- package/src/routers/handleError.js +43 -0
- package/src/routers/handleModuleNotfound.js +12 -0
- package/src/routers/moduleApi.js +34 -0
- package/src/routers/modulePage.js +102 -0
- package/src/sequencerdoc.js +311 -0
- package/src/sequencerline.js +214 -0
- package/src/session.js +57 -0
- package/src/startup.js +59 -0
- package/src/webapps.js +239 -0
- package/src/workermanager.js +83 -0
- package/templates/_lib_debug.ejs +11 -0
- package/templates/_lib_production.ejs +5 -0
- package/templates/application.page.ejs +143 -0
- package/templates/generator.page.ejs +131 -0
- package/templates/index.page.ejs +24 -0
- package/templates/login.page.ejs +102 -0
- package/templates/moduleError.ejs +16 -0
- package/templates/moduleNotfound.ejs +14 -0
- package/webapps.code-workspace +11 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// file: templateProcessor.js
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function kebabToCamel(str) {
|
|
6
|
+
return str
|
|
7
|
+
.split('-')
|
|
8
|
+
.map((part, index) =>
|
|
9
|
+
index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)
|
|
10
|
+
)
|
|
11
|
+
.join('');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function isFileExist(filepath) {
|
|
15
|
+
try {
|
|
16
|
+
await fs.access(filepath, fs.constants.F_OK);
|
|
17
|
+
return true;
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export function getSectionData(moduleName, entityName, data, sectionPart) {
|
|
25
|
+
const sectionName = kebabToCamel(`${moduleName}-${entityName}-${sectionPart}`)
|
|
26
|
+
|
|
27
|
+
let sectionTitle = capitalizeWords(`${sectionPart} ${data.title}`)
|
|
28
|
+
if (entityName=='header' && sectionPart=='list') {
|
|
29
|
+
sectionTitle = capitalizeWords(data.title)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
partName: sectionPart,
|
|
34
|
+
sectionName: sectionName,
|
|
35
|
+
sectionElementId: `${sectionName}-section`,
|
|
36
|
+
sectionTitle: sectionTitle,
|
|
37
|
+
primaryKey: data.pk,
|
|
38
|
+
table: data.table
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function capitalizeWords(input) {
|
|
43
|
+
if (typeof input !== 'string') return '';
|
|
44
|
+
|
|
45
|
+
return input
|
|
46
|
+
.split(' ')
|
|
47
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
48
|
+
.join(' ');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function createAdditionalAttributes(item) {
|
|
52
|
+
const cfg = []
|
|
53
|
+
|
|
54
|
+
// Default Value hanya untuk Textbox, Numberbox, Checkbox
|
|
55
|
+
if (['Textbox', 'Numberbox', 'Checkbox'].includes(item.component)) {
|
|
56
|
+
if (item.data_defaultvalue!='') {
|
|
57
|
+
cfg.push(`value="${item.data_defaultvalue}"`)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (item.index!='' && item.index!='0') {
|
|
62
|
+
cfg.push(`data-tabindex="${item.index}"`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if (item.input_inlinestyle.trim()!='') {
|
|
67
|
+
cfg.push(`style="${item.input_inlinestyle}"`)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (item.input_charcase != 'normal') {
|
|
71
|
+
cfg.push(`character-case="${item.input_charcase}"`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (item.Validation.isRequired) {
|
|
75
|
+
cfg.push('required')
|
|
76
|
+
|
|
77
|
+
if (item.Validation.messageRequired.trim()!='') {
|
|
78
|
+
cfg.push(`invalid-message-required="${item.Validation.messageRequired}"`)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (item.input_information.trim()!='') {
|
|
83
|
+
cfg.push(`description="${item.input_information}"`)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// data length in character
|
|
88
|
+
if (item.component=='Textbox') {
|
|
89
|
+
cfg.push(`autocomplete="off" spellcheck="false"`)
|
|
90
|
+
|
|
91
|
+
cfg.push(`maxlength="${item.data_length}"`)
|
|
92
|
+
|
|
93
|
+
if (item.Validation.isMinimum) {
|
|
94
|
+
cfg.push(`minlength="${item.Validation.Minimum}"`)
|
|
95
|
+
|
|
96
|
+
if (item.Validation.messageMinimum.trim()!='') {
|
|
97
|
+
cfg.push(`invalid-message-minlength="${item.Validation.messageMinimum}"`)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
} else if (item.component=='Numberbox') {
|
|
102
|
+
cfg.push(`maxlength="${item.data_length}"`)
|
|
103
|
+
|
|
104
|
+
if (item.Validation.isMinimum) {
|
|
105
|
+
cfg.push(`min="${item.Validation.Minimum}"`)
|
|
106
|
+
if (item.Validation.messageMinimum.trim()!='') {
|
|
107
|
+
cfg.push(`invalid-message-min="${item.Validation.messageMinimum}"`)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (item.Validation.isMaximum) {
|
|
112
|
+
cfg.push(`max="${item.Validation.Maximum}"`)
|
|
113
|
+
if (item.Validation.messageMaximum.trim()!='') {
|
|
114
|
+
cfg.push(`invalid-message-max="${item.Validation.messageMaximum}"`)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (item.data_type=='smallint') {
|
|
119
|
+
cfg.push(`digitgrouping="false"`)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
} else if (item.component=='Checkbox') {
|
|
123
|
+
cfg.push(`type="checkbox"`)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
} else if (item.component=='Combobox') {
|
|
127
|
+
if (item.Reference.bindingDisplay!='' && item.Reference.bindingDisplay!=null) {
|
|
128
|
+
cfg.push(`data-display="${item.Reference.bindingDisplay}"`)
|
|
129
|
+
} else {
|
|
130
|
+
cfg.push(`data-display="${item.Reference.bindingText}"`)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (item.Validation.hasCustomValidator) {
|
|
136
|
+
cfg.push(`validator="${item.Validation.customValidator}"`)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (item.Validation.messageDefault.trim()!='') {
|
|
140
|
+
cfg.push(`invalid-message="${item.Validation.messageDefault}"`)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
if (item.input_disabled) {
|
|
145
|
+
cfg.push('disabled')
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return cfg
|
|
149
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/************************************************************************
|
|
2
|
+
* minimize script using rollup
|
|
3
|
+
*
|
|
4
|
+
* you need to install rollup & terser to use this tools
|
|
5
|
+
*
|
|
6
|
+
* usage:
|
|
7
|
+
* npx rollup -c ./public/modules/<%=moduleName%>/__rollup.<%=moduleName%>.js
|
|
8
|
+
*
|
|
9
|
+
* This module is generated by fgta5 generator at <%= timeGenerated %>
|
|
10
|
+
************************************************************************/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import terser from '@rollup/plugin-terser';
|
|
14
|
+
import { writeFileSync } from 'fs';
|
|
15
|
+
import { readFile, unlink, access } from 'fs/promises';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
import { constants } from 'fs';
|
|
18
|
+
|
|
19
|
+
const currentdate = (new Date()).toISOString().split('T')[0]
|
|
20
|
+
const banner = `<%=moduleName%>
|
|
21
|
+
*
|
|
22
|
+
* build at ${currentdate}
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const filename = `version.txt`;
|
|
26
|
+
const filepath = join('public/modules/<%=moduleName%>', filename);
|
|
27
|
+
|
|
28
|
+
/* Hapus versi sebelumnya */
|
|
29
|
+
if (await isExists(filepath)) {
|
|
30
|
+
const previousVersionNumber = await readFile(filepath, 'utf8');
|
|
31
|
+
const previousFile = `public/modules/<%=moduleName%>/<%=moduleName%>-${previousVersionNumber}.min.mjs`
|
|
32
|
+
await unlink(previousFile);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Create New Version */
|
|
36
|
+
const newVersionNumber = getTimestampYYMMDDHHII()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// Simpan ke file
|
|
40
|
+
writeFileSync(filepath, newVersionNumber, 'utf8')
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
input: "public/modules/<%=moduleName%>/<%=moduleName%>.mjs", // File utama yang menjadi entry point
|
|
45
|
+
output: {
|
|
46
|
+
file: `public/modules/<%=moduleName%>/<%=moduleName%>-${newVersionNumber}.min.mjs`, // Lokasi output file hasil bundle
|
|
47
|
+
format: "esm", // Format modul ECMAScript
|
|
48
|
+
banner: `/*! ${banner}*/`,
|
|
49
|
+
// manualChunks: (id) => {
|
|
50
|
+
// console.log('Chunking:', id);
|
|
51
|
+
// if (id.includes('module.mjs') || id.includes('-ext.mjs') || id.includes('public/libs/webmodule')) return null;
|
|
52
|
+
// }
|
|
53
|
+
},
|
|
54
|
+
external: (id) => {
|
|
55
|
+
return id.includes('module.mjs') || id === '$fgta5' || id.includes('public/libs/webmodule');
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
preserveEntrySignatures: 'strict',
|
|
59
|
+
|
|
60
|
+
plugins: [
|
|
61
|
+
terser({
|
|
62
|
+
compress: {
|
|
63
|
+
pure_funcs: ['console.log', 'console.warn'] // hanya log dan warn dihilangkan, sedangkan error tidak
|
|
64
|
+
// drop_console: true // hapus console
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
function getTimestampYYMMDDHHII() {
|
|
72
|
+
const now = new Date();
|
|
73
|
+
const yy = String(now.getFullYear()).slice(-2);
|
|
74
|
+
const mm = String(now.getMonth() + 1).padStart(2, '0');
|
|
75
|
+
const dd = String(now.getDate()).padStart(2, '0');
|
|
76
|
+
const hh = String(now.getHours()).padStart(2, '0');
|
|
77
|
+
const ii = String(now.getMinutes()).padStart(2, '0');
|
|
78
|
+
return `${yy}${mm}${dd}${hh}${ii}`;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
async function isExists(filepath) {
|
|
83
|
+
try {
|
|
84
|
+
await access(filepath, constants.F_OK);
|
|
85
|
+
return true
|
|
86
|
+
} catch {
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
File without changes
|