@agung_dhewe/webapps 1.1.2 → 1.2.4
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/lib/fgta5js-dist/fgta5js-v1.8.5.min.js +11 -0
- package/lib/fgta5js-dist/fgta5js-v1.8.5.min.js.map +1 -0
- package/{libs → lib}/webmodule/module-edit.css +73 -18
- package/{libs → lib}/webmodule/module-list.css +13 -0
- package/lib/webmodule/module-print.css +28 -0
- package/{libs → lib}/webmodule/module.css +13 -6
- package/{libs → lib}/webmodule/module.js +14 -4
- package/lib/webmodule/pagehelper.mjs +129 -0
- package/modules/generator/appgen-io.mjs +153 -76
- package/modules/generator/appgen-ui.mjs +234 -167
- package/modules/generator/generator-designtemplate-def.html +38 -0
- package/modules/generator/generator-designtemplate.html +11 -1492
- package/modules/generator/generator.css +103 -65
- package/modules/generator/generator.mjs +1 -1
- package/modules/generator/generator.svg +98 -0
- package/modules/generator/generatorEdit.mjs +43 -35
- package/modules/generator/generatorList.mjs +27 -0
- package/modules/generator/tpl-designerinfo.html +100 -0
- package/modules/generator/tpl-field-checkbox.html +200 -0
- package/modules/generator/tpl-field-combobox.html +228 -0
- package/modules/generator/tpl-field-datepicker.html +192 -0
- package/modules/generator/tpl-field-filebox.html +189 -0
- package/modules/generator/tpl-field-numberbox.html +218 -0
- package/modules/generator/tpl-field-textbox.html +255 -0
- package/modules/generator/tpl-field-timepicker.html +192 -0
- package/modules/generator/tpl-searchdesign.html +32 -0
- package/modules/generator/tpl-uniquedesign.html +25 -0
- package/modules/login/login.css +10 -2
- package/package.json +5 -3
- package/percobaan/coba-sequencer.js +16 -0
- package/src/api.js +12 -9
- package/src/apis/generator.api.js +35 -23
- package/src/apis/login.api.js +1 -0
- package/src/context.js +12 -2
- package/src/db.js +58 -32
- package/src/generator/createApiModule.js +4 -1
- package/src/generator/createIcon.js +24 -2
- package/src/generator/createLayoutCss.js +107 -0
- package/src/generator/createModuleDetilEditHtml.js +12 -1
- package/src/generator/createModuleDetilEditMjs.js +32 -28
- package/src/generator/createModuleDetilListHtml.js +14 -7
- package/src/generator/createModuleDetilListMjs.js +13 -1
- package/src/generator/createModuleHeaderEditHtml.js +13 -1
- package/src/generator/createModuleHeaderEditMjs.js +23 -2
- package/src/generator/createProgramData.js +3 -2
- package/src/generator/createTable.js +42 -38
- package/src/generator/helper.js +45 -27
- package/src/generator/templates/__rollup-module copy.ejs +90 -0
- package/src/generator/templates/__rollup-module.ejs +102 -31
- package/src/generator/templates/api-module.js.ejs +171 -32
- package/src/generator/templates/layout.css.ejs +24 -0
- package/src/generator/templates/module-ext.html.ejs +1 -1
- package/src/generator/templates/module-ext.mjs.ejs +19 -1
- package/src/generator/templates/module.ejs.ejs +8 -0
- package/src/generator/templates/module.mjs.ejs +42 -5
- package/src/generator/templates/moduleDetilEdit.html.ejs +11 -0
- package/src/generator/templates/moduleDetilEdit.mjs.ejs +135 -30
- package/src/generator/templates/moduleDetilList.html.ejs +2 -1
- package/src/generator/templates/moduleDetilList.mjs.ejs +86 -11
- package/src/generator/templates/moduleHeaderEdit.html.ejs +8 -1
- package/src/generator/templates/moduleHeaderEdit.mjs.ejs +123 -36
- package/src/generator/templates/moduleHeaderList.html.ejs +5 -1
- package/src/generator/templates/moduleHeaderList.mjs.ejs +47 -15
- package/src/generator/trygenerate.js +18 -2
- package/src/generator/worker.js +83 -72
- package/src/helper.js +12 -13
- package/src/logger.js +12 -12
- package/src/notifier.js +29 -0
- package/src/routers/generatorApi.js +9 -3
- package/src/routers/generatorPage.js +3 -1
- package/src/routers/moduleApi.js +1 -1
- package/src/routers/modulePage.js +42 -7
- package/src/sequencerdoc.js +22 -46
- package/src/sequencerline.js +16 -4
- package/src/session.js +69 -33
- package/src/startup.js +47 -10
- package/src/webapps.js +62 -18
- package/templates/_lib_debug.ejs +8 -8
- package/templates/_lib_production.ejs +2 -2
- package/templates/application.page.ejs +43 -8
- package/templates/generator.page.ejs +4 -3
- package/templates/index.page.ejs +2 -2
- package/templates/login.page.ejs +3 -3
- package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js +0 -11
- package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js.map +0 -1
- package/libs/webmodule/pagehelper.mjs +0 -45
- package/modules/generator/generator.png +0 -0
- /package/{libs/fgta5js-dist/fgta5js-v1.8.3.min.css → lib/fgta5js-dist/fgta5js-v1.8.5.min.css} +0 -0
- /package/{libs → lib}/fgta5js-dist/fonts/karla-italic-latin-ext.woff2 +0 -0
- /package/{libs → lib}/fgta5js-dist/fonts/karla-italic-latin.woff2 +0 -0
- /package/{libs → lib}/fgta5js-dist/fonts/karla-normal-latin-ext.woff2 +0 -0
- /package/{libs → lib}/fgta5js-dist/fonts/karla-normal-latin.woff2 +0 -0
- /package/{libs → lib}/fgta5js-dist/fonts/karla.css +0 -0
- /package/{libs → lib}/webmodule/module-footer.css +0 -0
|
@@ -8,9 +8,9 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
8
8
|
const __dirname = path.dirname(__filename);
|
|
9
9
|
|
|
10
10
|
export async function createModuleDetilEditMjs(context, options) {
|
|
11
|
-
const overwrite = options.overwrite===true
|
|
11
|
+
const overwrite = options.overwrite === true
|
|
12
12
|
const moduleName = context.moduleName
|
|
13
|
-
const title = context.title
|
|
13
|
+
// const title = context.title // ini title header
|
|
14
14
|
const sectionPart = 'edit'
|
|
15
15
|
|
|
16
16
|
try {
|
|
@@ -24,23 +24,25 @@ export async function createModuleDetilEditMjs(context, options) {
|
|
|
24
24
|
const entityData = context.entities[entityName]
|
|
25
25
|
|
|
26
26
|
// process selain header
|
|
27
|
-
if (entityName=='header') {
|
|
27
|
+
if (entityName == 'header') {
|
|
28
28
|
continue
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
const title = entityData.title
|
|
31
32
|
const sectionName = entityName
|
|
33
|
+
const extenderDetil = kebabToCamel(`extender-${sectionName}`)
|
|
32
34
|
const modulePart = kebabToCamel(`${moduleName}-${sectionName}-${sectionPart}`)
|
|
33
35
|
const targetFile = path.join(context.moduleDir, `${modulePart}.mjs`)
|
|
34
36
|
|
|
35
37
|
// cek dulu apakah file ada
|
|
36
38
|
var fileExists = await isFileExist(targetFile)
|
|
37
39
|
if (fileExists && !overwrite) {
|
|
38
|
-
context.postMessage({message: `skip file: '${targetFile}`})
|
|
40
|
+
context.postMessage({ message: `skip file: '${targetFile}` })
|
|
39
41
|
return
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// reporting progress to parent process
|
|
43
|
-
context.postMessage({message: `generating file: '${targetFile}`})
|
|
45
|
+
context.postMessage({ message: `generating file: '${targetFile}` })
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
const tablename = entityData.table
|
|
@@ -65,60 +67,60 @@ export async function createModuleDetilEditMjs(context, options) {
|
|
|
65
67
|
const elementId = `${modulePart}-${item.input_name}`
|
|
66
68
|
|
|
67
69
|
|
|
68
|
-
if (component=='Filebox') {
|
|
70
|
+
if (component == 'Filebox') {
|
|
69
71
|
detilHasUpload = true
|
|
70
72
|
uploadFields.push({
|
|
71
73
|
elementId,
|
|
72
74
|
fieldname,
|
|
73
75
|
inputname
|
|
74
76
|
})
|
|
75
|
-
} else if (component=='Combobox') {
|
|
77
|
+
} else if (component == 'Combobox') {
|
|
76
78
|
comboboxList.push({
|
|
77
79
|
inputname
|
|
78
80
|
})
|
|
79
|
-
}
|
|
81
|
+
}
|
|
80
82
|
|
|
81
83
|
// setup handles
|
|
82
84
|
const handles = []
|
|
83
85
|
for (let eventname in item.Handle) {
|
|
84
86
|
let createhandle = item.Handle[eventname]
|
|
85
87
|
if (createhandle) {
|
|
86
|
-
if (eventname=='selecting' && component=='Combobox') {
|
|
88
|
+
if (eventname == 'selecting' && component == 'Combobox') {
|
|
87
89
|
handles.push({
|
|
88
90
|
eventname,
|
|
89
91
|
appId: item.Reference.loaderApiModule,
|
|
90
92
|
path: item.Reference.loaderApiPath,
|
|
91
93
|
field_value: item.Reference.bindingValue,
|
|
92
|
-
field_text: item.Reference.bindingText,
|
|
94
|
+
field_text: item.Reference.bindingText,
|
|
93
95
|
})
|
|
94
96
|
} else {
|
|
95
|
-
handles.push({eventname})
|
|
97
|
+
handles.push({ eventname })
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
if (handles.length>0) {
|
|
101
|
-
fieldHandles.push({component, inputname, handles})
|
|
102
|
+
if (handles.length > 0) {
|
|
103
|
+
fieldHandles.push({ component, inputname, handles })
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
|
|
105
107
|
// setup default values
|
|
106
108
|
let setdefault
|
|
107
109
|
if (item.data_defaultvalue != '') {
|
|
108
|
-
if (item.component=='Datepicker' || item.component=='Timepicker') {
|
|
109
|
-
setdefault = `${item.name
|
|
110
|
-
} else if (item.component=='Numberbox') {
|
|
111
|
-
setdefault = `${item.name
|
|
112
|
-
} else if (item.component=='Checkbox') {
|
|
113
|
-
if (item.data_defaultvalue==='true' || item.data_defaultvalue==='checked' || item.data_defaultvalue==='1') {
|
|
114
|
-
setdefault = `${item.name
|
|
110
|
+
if (item.component == 'Datepicker' || item.component == 'Timepicker') {
|
|
111
|
+
setdefault = `${item.name}: new Date()`
|
|
112
|
+
} else if (item.component == 'Numberbox') {
|
|
113
|
+
setdefault = `${item.name}: ${item.data_defaultvalue}`
|
|
114
|
+
} else if (item.component == 'Checkbox') {
|
|
115
|
+
if (item.data_defaultvalue === 'true' || item.data_defaultvalue === 'checked' || item.data_defaultvalue === '1') {
|
|
116
|
+
setdefault = `${item.name}: true`
|
|
115
117
|
}
|
|
116
118
|
} else {
|
|
117
|
-
setdefault = `${item.name
|
|
119
|
+
setdefault = `${item.name}: '${item.data_defaultvalue}'`
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
|
|
121
|
-
if (setdefault!=null) {
|
|
123
|
+
if (setdefault != null) {
|
|
122
124
|
defaultInits.push(setdefault)
|
|
123
125
|
}
|
|
124
126
|
|
|
@@ -127,15 +129,15 @@ export async function createModuleDetilEditMjs(context, options) {
|
|
|
127
129
|
|
|
128
130
|
|
|
129
131
|
// add to field config data
|
|
130
|
-
fields.push({
|
|
132
|
+
fields.push({
|
|
131
133
|
component,
|
|
132
134
|
fieldname,
|
|
133
135
|
inputname,
|
|
134
136
|
elementId
|
|
135
137
|
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
139
141
|
const detilPrimaryKey = entityData.pk
|
|
140
142
|
|
|
141
143
|
|
|
@@ -146,10 +148,12 @@ export async function createModuleDetilEditMjs(context, options) {
|
|
|
146
148
|
modulePart,
|
|
147
149
|
moduleName,
|
|
148
150
|
sectionName,
|
|
151
|
+
extenderDetil,
|
|
152
|
+
headerModulePartEdit,
|
|
149
153
|
entityName,
|
|
150
154
|
headerPrimaryKey,
|
|
151
155
|
detilPrimaryKey,
|
|
152
|
-
moduleSection:
|
|
156
|
+
moduleSection: kebabToCamel(`${moduleName}-${sectionName}`),
|
|
153
157
|
moduleList: kebabToCamel(`${moduleName}-${sectionName}-list`),
|
|
154
158
|
fields,
|
|
155
159
|
fieldHandles,
|
|
@@ -162,7 +166,7 @@ export async function createModuleDetilEditMjs(context, options) {
|
|
|
162
166
|
const tplFilePath = path.join(__dirname, 'templates', 'moduleDetilEdit.mjs.ejs')
|
|
163
167
|
const template = await fs.readFile(tplFilePath, 'utf-8');
|
|
164
168
|
const content = ejs.render(template, variables)
|
|
165
|
-
|
|
169
|
+
|
|
166
170
|
await fs.writeFile(targetFile, content, 'utf8');
|
|
167
171
|
}
|
|
168
172
|
} catch (err) {
|
|
@@ -15,6 +15,8 @@ export async function createModuleDetilListHtml(context, options) {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
|
+
|
|
19
|
+
const entityHeader = context.entities['header']
|
|
18
20
|
|
|
19
21
|
for (let entityName in context.entities) {
|
|
20
22
|
// process selain header
|
|
@@ -110,14 +112,19 @@ export async function createModuleDetilListHtml(context, options) {
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
|
|
115
|
+
const addToFields = fieldName!=entityHeader.pk
|
|
116
|
+
|
|
113
117
|
// masukkan ke fields
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
if (addToFields) {
|
|
119
|
+
fields.push({
|
|
120
|
+
component,
|
|
121
|
+
dataName: columnDataName, //bindingDisplay!=null ? bindingDisplay : dataName,
|
|
122
|
+
binding: columnDataBinding, //bindingDisplay!=null ? bindingDisplay : binding,
|
|
123
|
+
label,
|
|
124
|
+
additionalAttributes
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
|
|
@@ -19,6 +19,8 @@ export async function createModuleDetilListMjs(context, options) {
|
|
|
19
19
|
const headerEntityData = context.entities['header']
|
|
20
20
|
const headerModulePartEdit = kebabToCamel(`${moduleName}-header-edit`)
|
|
21
21
|
const headerPrimaryKey = headerEntityData.pk
|
|
22
|
+
const bindHeadTitle = headerEntityData.bindHeadTitle ?? ''
|
|
23
|
+
const bindHeadDescr = headerEntityData.bindHeadDescr ?? ''
|
|
22
24
|
|
|
23
25
|
for (let entityName in context.entities) {
|
|
24
26
|
// process selain header
|
|
@@ -27,6 +29,7 @@ export async function createModuleDetilListMjs(context, options) {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const sectionName = entityName
|
|
32
|
+
const extenderDetil = kebabToCamel(`extender-${sectionName}`)
|
|
30
33
|
const modulePart = kebabToCamel(`${moduleName}-${sectionName}-${sectionPart}`)
|
|
31
34
|
const targetFile = path.join(context.moduleDir, `${modulePart}.mjs`)
|
|
32
35
|
|
|
@@ -46,7 +49,10 @@ export async function createModuleDetilListMjs(context, options) {
|
|
|
46
49
|
const entityData = context.entities[entityName]
|
|
47
50
|
const sectionData = getSectionData(moduleName, entityName, entityData, 'edit')
|
|
48
51
|
const title = entityData.title
|
|
49
|
-
|
|
52
|
+
const allowRowAdd = entityData.allowRowAdd
|
|
53
|
+
const allowRowRemove = entityData.allowRowRemove
|
|
54
|
+
const allowRowEdit = entityData.allowRowEdit
|
|
55
|
+
|
|
50
56
|
|
|
51
57
|
const variables = {
|
|
52
58
|
timeGenerated: context.timeGenerated,
|
|
@@ -54,8 +60,14 @@ export async function createModuleDetilListMjs(context, options) {
|
|
|
54
60
|
modulePart,
|
|
55
61
|
moduleName,
|
|
56
62
|
sectionName,
|
|
63
|
+
extenderDetil,
|
|
57
64
|
headerModulePartEdit,
|
|
58
65
|
headerPrimaryKey,
|
|
66
|
+
bindHeadTitle,
|
|
67
|
+
bindHeadDescr,
|
|
68
|
+
allowRowAdd,
|
|
69
|
+
allowRowRemove,
|
|
70
|
+
allowRowEdit,
|
|
59
71
|
moduleEdit: kebabToCamel(`${moduleName}-${sectionName}-edit`),
|
|
60
72
|
|
|
61
73
|
}
|
|
@@ -10,6 +10,7 @@ const __dirname = path.dirname(__filename);
|
|
|
10
10
|
export async function createModuleHeaderEditHtml(context, options) {
|
|
11
11
|
const overwrite = options.overwrite===true
|
|
12
12
|
const moduleName = context.moduleName
|
|
13
|
+
const actions = context.actions
|
|
13
14
|
const title = context.title
|
|
14
15
|
const sectionPart = 'edit'
|
|
15
16
|
|
|
@@ -114,11 +115,21 @@ export async function createModuleHeaderEditHtml(context, options) {
|
|
|
114
115
|
const title = entityData.title
|
|
115
116
|
sectionDetils.push({
|
|
116
117
|
listModulePart,
|
|
117
|
-
title
|
|
118
|
+
title,
|
|
119
|
+
entityName: detilEntityName
|
|
118
120
|
})
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
|
|
124
|
+
// ambil data actions
|
|
125
|
+
const actionList = []
|
|
126
|
+
for (let action of context.actions) {
|
|
127
|
+
const namepart = kebabToCamel(`btn_action-${action.name}`)
|
|
128
|
+
const elid = `${modulePart}-${namepart}`
|
|
129
|
+
action.elementId = elid
|
|
130
|
+
actionList.push(action)
|
|
131
|
+
}
|
|
132
|
+
|
|
122
133
|
const variables = {
|
|
123
134
|
timeGenerated: context.timeGenerated,
|
|
124
135
|
title: title,
|
|
@@ -130,6 +141,7 @@ export async function createModuleHeaderEditHtml(context, options) {
|
|
|
130
141
|
primaryKeyElementId: primaryKeyElementId,
|
|
131
142
|
fields: fields,
|
|
132
143
|
sectionDetils: sectionDetils,
|
|
144
|
+
actionList,
|
|
133
145
|
detilCount
|
|
134
146
|
}
|
|
135
147
|
|
|
@@ -10,12 +10,17 @@ const __dirname = path.dirname(__filename);
|
|
|
10
10
|
export async function createModuleHeaderEditMjs(context, options) {
|
|
11
11
|
const overwrite = options.overwrite===true
|
|
12
12
|
const moduleName = context.moduleName
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
const actions = context.actions
|
|
14
15
|
const sectionPart = 'edit'
|
|
15
16
|
const timeGenerated = context.timeGenerated
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
19
|
|
|
20
|
+
|
|
21
|
+
const headerEntityData = context.entities['header']
|
|
22
|
+
const title = headerEntityData.title
|
|
23
|
+
|
|
19
24
|
// Data Detil
|
|
20
25
|
const entitiesDetil = []
|
|
21
26
|
for (let entityName in context.entities) {
|
|
@@ -86,6 +91,7 @@ export async function createModuleHeaderEditMjs(context, options) {
|
|
|
86
91
|
const elementId = `${modulePart}-${item.input_name}`
|
|
87
92
|
|
|
88
93
|
|
|
94
|
+
|
|
89
95
|
if (component=='Filebox') {
|
|
90
96
|
headerHasUpload = true
|
|
91
97
|
uploadFields.push({
|
|
@@ -158,7 +164,19 @@ export async function createModuleHeaderEditMjs(context, options) {
|
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
|
|
167
|
+
// ambil data actions
|
|
168
|
+
const actionList = []
|
|
169
|
+
for (let action of context.actions) {
|
|
170
|
+
const buttonName = kebabToCamel(`btn_action-${action.name}`)
|
|
171
|
+
const elid = `${modulePart}-${buttonName}`
|
|
172
|
+
action.buttonName = buttonName
|
|
173
|
+
action.elementId = elid
|
|
174
|
+
actionList.push(action)
|
|
175
|
+
}
|
|
176
|
+
|
|
161
177
|
|
|
178
|
+
const allowFormNew = entityData.allowFormNew
|
|
179
|
+
const allowFormEdit = entityData.allowFormEdit
|
|
162
180
|
|
|
163
181
|
|
|
164
182
|
const variables = {
|
|
@@ -166,6 +184,8 @@ export async function createModuleHeaderEditMjs(context, options) {
|
|
|
166
184
|
moduleDescription: context.descr,
|
|
167
185
|
title,
|
|
168
186
|
tablename,
|
|
187
|
+
allowFormNew,
|
|
188
|
+
allowFormEdit,
|
|
169
189
|
modulePart,
|
|
170
190
|
moduleName,
|
|
171
191
|
moduleSection: kebabToCamel(`${moduleName}-${sectionName}`),
|
|
@@ -177,7 +197,8 @@ export async function createModuleHeaderEditMjs(context, options) {
|
|
|
177
197
|
headerHasUpload,
|
|
178
198
|
entitiesDetil,
|
|
179
199
|
uploadFields,
|
|
180
|
-
comboboxList
|
|
200
|
+
comboboxList,
|
|
201
|
+
actionList
|
|
181
202
|
}
|
|
182
203
|
|
|
183
204
|
|
|
@@ -64,8 +64,9 @@ export async function createProgramData(context, options) {
|
|
|
64
64
|
if (row==null) {
|
|
65
65
|
// insert
|
|
66
66
|
const sequencer = createSequencerLine(tx, {})
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const seqdata = await sequencer.yearlyshort('PROG')
|
|
68
|
+
const program_id = seqdata.id
|
|
69
|
+
|
|
69
70
|
obj.program_id = program_id
|
|
70
71
|
obj._createby = user_id
|
|
71
72
|
obj._createdate = (new Date()).toISOString()
|
|
@@ -11,15 +11,15 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
11
11
|
const __dirname = path.dirname(__filename);
|
|
12
12
|
|
|
13
13
|
export async function createTable(context, options) {
|
|
14
|
-
const skipGenerate = options.skipGenerate===true
|
|
14
|
+
const skipGenerate = options.skipGenerate === true
|
|
15
15
|
const moduleName = context.moduleName
|
|
16
16
|
const title = context.title
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
21
|
if (skipGenerate) {
|
|
22
|
-
context.postMessage({message: `skip generate table(s)`})
|
|
22
|
+
context.postMessage({ message: `skip generate table(s)` })
|
|
23
23
|
return
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -30,19 +30,23 @@ export async function createTable(context, options) {
|
|
|
30
30
|
|
|
31
31
|
// prepare target file
|
|
32
32
|
const targetFile = path.join(context.moduleDir, `${moduleName}-${entityName}.sql`)
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
35
|
// reporting progress to parent process
|
|
36
|
-
context.postMessage({message: `generating file: '${targetFile}`})
|
|
36
|
+
context.postMessage({ message: `generating file: '${targetFile}` })
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
// start generate table for tis entity
|
|
40
40
|
const entity = context.entities[entityName]
|
|
41
|
-
const {table, descr, pk, identifierMethod} = entity
|
|
41
|
+
const { table, descr, pk, identifierMethod, skipRegenerateTable } = entity
|
|
42
42
|
const pkData = entity.Items[pk]
|
|
43
|
-
const {schema, tablename} = ddl.parseTableName(table)
|
|
44
|
-
const {data_fieldname, data_type, data_length, description} = pkData
|
|
45
|
-
|
|
43
|
+
const { schema, tablename } = ddl.parseTableName(table)
|
|
44
|
+
const { data_fieldname, data_type, data_length, description } = pkData
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if (skipRegenerateTable === true) {
|
|
48
|
+
continue
|
|
49
|
+
}
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
const scriptContent = []
|
|
@@ -52,7 +56,7 @@ export async function createTable(context, options) {
|
|
|
52
56
|
|
|
53
57
|
// Buat Table dengan field hanya untuk primary key
|
|
54
58
|
{
|
|
55
|
-
const sql =
|
|
59
|
+
const sql = await ddl.createTable(schema, tablename, descr, {
|
|
56
60
|
fieldname: data_fieldname,
|
|
57
61
|
datatype: data_type,
|
|
58
62
|
length: data_length,
|
|
@@ -62,31 +66,31 @@ export async function createTable(context, options) {
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
const recordColumns = createRecordColumns()
|
|
65
|
-
const entityItems = structuredClone({...entity.Items, ...recordColumns})
|
|
69
|
+
const entityItems = structuredClone({ ...entity.Items, ...recordColumns })
|
|
66
70
|
|
|
67
71
|
// Buat Fields
|
|
68
72
|
{
|
|
69
|
-
|
|
73
|
+
|
|
70
74
|
for (var fieldname in entityItems) {
|
|
71
|
-
if (fieldname==pk) {
|
|
75
|
+
if (fieldname == pk) {
|
|
72
76
|
continue
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
const field = entityItems[fieldname]
|
|
76
|
-
const {data_fieldname, data_type, data_length, data_precision, data_allownull, data_defaultvalue, description} = field
|
|
77
|
-
|
|
78
|
-
const sql =
|
|
79
|
-
fieldname: data_fieldname,
|
|
80
|
-
datatype: data_type,
|
|
81
|
-
length: data_length,
|
|
82
|
-
precision: data_precision,
|
|
83
|
-
allownull: data_allownull,
|
|
84
|
-
defaultvalue: data_defaultvalue,
|
|
80
|
+
const { data_fieldname, data_type, data_length, data_precision, data_allownull, data_defaultvalue, description } = field
|
|
81
|
+
|
|
82
|
+
const sql = await ddl.createField(schema, tablename, {
|
|
83
|
+
fieldname: data_fieldname,
|
|
84
|
+
datatype: data_type,
|
|
85
|
+
length: data_length,
|
|
86
|
+
precision: data_precision,
|
|
87
|
+
allownull: data_allownull,
|
|
88
|
+
defaultvalue: data_defaultvalue,
|
|
85
89
|
description: description
|
|
86
90
|
})
|
|
87
91
|
scriptContent.push(sql)
|
|
88
92
|
}
|
|
89
|
-
|
|
93
|
+
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
// buat foreign key
|
|
@@ -99,8 +103,8 @@ export async function createTable(context, options) {
|
|
|
99
103
|
return acc;
|
|
100
104
|
}, {})
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
const sql =
|
|
106
|
+
|
|
107
|
+
const sql = await ddl.createFereignKey(schema, tablename, foreignKeys)
|
|
104
108
|
scriptContent.push(sql)
|
|
105
109
|
|
|
106
110
|
}
|
|
@@ -112,9 +116,9 @@ export async function createTable(context, options) {
|
|
|
112
116
|
{
|
|
113
117
|
const sql = await ddl.createUniqueIndex(schema, tablename, entity.Uniques)
|
|
114
118
|
scriptContent.push(sql)
|
|
115
|
-
}
|
|
119
|
+
}
|
|
120
|
+
|
|
116
121
|
|
|
117
|
-
|
|
118
122
|
let content = scriptContent.join("\n")
|
|
119
123
|
await fs.writeFile(targetFile, content, 'utf8');
|
|
120
124
|
|
|
@@ -130,23 +134,23 @@ export async function createTable(context, options) {
|
|
|
130
134
|
function createRecordColumns() {
|
|
131
135
|
const records = {
|
|
132
136
|
_createby: {
|
|
133
|
-
data_fieldname: '_createby', data_type: '
|
|
134
|
-
Reference: {table: '',pk: ''}
|
|
137
|
+
data_fieldname: '_createby', data_type: 'integer', data_allownull: false, description: 'user yang pertama kali membuat record ini',
|
|
138
|
+
Reference: { table: '', pk: '' }
|
|
135
139
|
},
|
|
136
|
-
|
|
140
|
+
|
|
137
141
|
_createdate: {
|
|
138
|
-
data_fieldname: '_createdate', data_type: 'timestamp', data_allownull: false, description: 'waktu record dibuat pertama kali',
|
|
139
|
-
Reference: {table: '',pk: ''}
|
|
142
|
+
data_fieldname: '_createdate', data_type: 'timestamp', data_allownull: false, data_defaultvalue: 'now()', description: 'waktu record dibuat pertama kali',
|
|
143
|
+
Reference: { table: '', pk: '' }
|
|
140
144
|
},
|
|
141
|
-
|
|
145
|
+
|
|
142
146
|
_modifyby: {
|
|
143
|
-
data_fieldname: '_modifyby', data_type: '
|
|
144
|
-
Reference: {table: '',pk: ''}
|
|
147
|
+
data_fieldname: '_modifyby', data_type: 'integer', data_allownull: true, description: 'user yang terakhir modifikasi record ini',
|
|
148
|
+
Reference: { table: '', pk: '' }
|
|
145
149
|
},
|
|
146
150
|
|
|
147
151
|
_modifydate: {
|
|
148
152
|
data_fieldname: '_modifydate', data_type: 'timestamp', data_allownull: true, description: 'waktu terakhir record dimodifikasi',
|
|
149
|
-
Reference: {table: '',pk: ''}
|
|
153
|
+
Reference: { table: '', pk: '' }
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
|
package/src/generator/helper.js
CHANGED
|
@@ -6,7 +6,7 @@ export function kebabToCamel(str) {
|
|
|
6
6
|
return str
|
|
7
7
|
.split('-')
|
|
8
8
|
.map((part, index) =>
|
|
9
|
-
|
|
9
|
+
index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)
|
|
10
10
|
)
|
|
11
11
|
.join('');
|
|
12
12
|
}
|
|
@@ -23,11 +23,11 @@ export async function isFileExist(filepath) {
|
|
|
23
23
|
|
|
24
24
|
export function getSectionData(moduleName, entityName, data, sectionPart) {
|
|
25
25
|
const sectionName = kebabToCamel(`${moduleName}-${entityName}-${sectionPart}`)
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
let sectionTitle = capitalizeWords(`${sectionPart} ${data.title}`)
|
|
28
|
-
if (entityName=='header' && sectionPart=='list') {
|
|
28
|
+
if (entityName == 'header' && sectionPart == 'list') {
|
|
29
29
|
sectionTitle = capitalizeWords(data.title)
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
partName: sectionPart,
|
|
@@ -50,42 +50,50 @@ export function capitalizeWords(input) {
|
|
|
50
50
|
|
|
51
51
|
export function createAdditionalAttributes(item) {
|
|
52
52
|
const cfg = []
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
// Default Value hanya untuk Textbox, Numberbox, Checkbox
|
|
55
55
|
if (['Textbox', 'Numberbox', 'Checkbox'].includes(item.component)) {
|
|
56
|
-
if (item.data_defaultvalue!='') {
|
|
56
|
+
if (item.data_defaultvalue != '') {
|
|
57
57
|
cfg.push(`value="${item.data_defaultvalue}"`)
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
if (item.index!='' && item.index!='0') {
|
|
61
|
+
if (item.index != '' && item.index != '0') {
|
|
62
62
|
cfg.push(`data-tabindex="${item.index}"`)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
if (item.input_inlinestyle.trim()!='') {
|
|
66
|
+
if (item.input_inlinestyle.trim() != '') {
|
|
67
67
|
cfg.push(`style="${item.input_inlinestyle}"`)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (item.input_charcase != 'normal') {
|
|
71
71
|
cfg.push(`character-case="${item.input_charcase}"`)
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
if (item.Validation.isRequired) {
|
|
75
75
|
cfg.push('required')
|
|
76
76
|
|
|
77
|
-
if (item.Validation.messageRequired.trim()!='') {
|
|
77
|
+
if (item.Validation.messageRequired.trim() != '') {
|
|
78
78
|
cfg.push(`invalid-message-required="${item.Validation.messageRequired}"`)
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
if (item.input_information.trim()!='') {
|
|
82
|
+
if (item.input_information.trim() != '') {
|
|
83
83
|
cfg.push(`description="${item.input_information}"`)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
|
|
87
|
+
// multiline, hanya untuk textbox
|
|
88
|
+
if (item.component == 'Textbox') {
|
|
89
|
+
if (item.input_multiline) {
|
|
90
|
+
cfg.push('multiline')
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
87
95
|
// data length in character
|
|
88
|
-
if (item.component=='Textbox') {
|
|
96
|
+
if (item.component == 'Textbox') {
|
|
89
97
|
cfg.push(`autocomplete="off" spellcheck="false"`)
|
|
90
98
|
|
|
91
99
|
cfg.push(`maxlength="${item.data_length}"`)
|
|
@@ -93,57 +101,67 @@ export function createAdditionalAttributes(item) {
|
|
|
93
101
|
if (item.Validation.isMinimum) {
|
|
94
102
|
cfg.push(`minlength="${item.Validation.Minimum}"`)
|
|
95
103
|
|
|
96
|
-
if (item.Validation.messageMinimum.trim()!='') {
|
|
104
|
+
if (item.Validation.messageMinimum.trim() != '') {
|
|
97
105
|
cfg.push(`invalid-message-minlength="${item.Validation.messageMinimum}"`)
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
} else if (item.component=='Numberbox') {
|
|
102
|
-
|
|
109
|
+
} else if (item.component == 'Numberbox') {
|
|
110
|
+
|
|
111
|
+
if (item.data_precision > 0) {
|
|
112
|
+
const datalen = Number(item.data_length) + 1
|
|
113
|
+
cfg.push(`precision="${item.data_precision}"`)
|
|
114
|
+
cfg.push(`maxlength="${datalen}"`)
|
|
115
|
+
} else {
|
|
116
|
+
cfg.push(`maxlength="${item.data_length}"`)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
103
121
|
|
|
104
122
|
if (item.Validation.isMinimum) {
|
|
105
123
|
cfg.push(`min="${item.Validation.Minimum}"`)
|
|
106
|
-
if (item.Validation.messageMinimum.trim()!='') {
|
|
124
|
+
if (item.Validation.messageMinimum.trim() != '') {
|
|
107
125
|
cfg.push(`invalid-message-min="${item.Validation.messageMinimum}"`)
|
|
108
126
|
}
|
|
109
127
|
}
|
|
110
128
|
|
|
111
129
|
if (item.Validation.isMaximum) {
|
|
112
130
|
cfg.push(`max="${item.Validation.Maximum}"`)
|
|
113
|
-
if (item.Validation.messageMaximum.trim()!='') {
|
|
131
|
+
if (item.Validation.messageMaximum.trim() != '') {
|
|
114
132
|
cfg.push(`invalid-message-max="${item.Validation.messageMaximum}"`)
|
|
115
133
|
}
|
|
116
134
|
}
|
|
117
135
|
|
|
118
|
-
if (item.data_type=='smallint') {
|
|
136
|
+
if (item.data_type == 'smallint') {
|
|
119
137
|
cfg.push(`digitgrouping="false"`)
|
|
120
|
-
}
|
|
138
|
+
}
|
|
121
139
|
|
|
122
|
-
} else if (item.component=='Checkbox') {
|
|
140
|
+
} else if (item.component == 'Checkbox') {
|
|
123
141
|
cfg.push(`type="checkbox"`)
|
|
124
142
|
|
|
125
143
|
|
|
126
|
-
} else if (item.component=='Combobox') {
|
|
127
|
-
if (item.Reference.bindingDisplay!='' && item.Reference.bindingDisplay!=null) {
|
|
144
|
+
} else if (item.component == 'Combobox') {
|
|
145
|
+
if (item.Reference.bindingDisplay != '' && item.Reference.bindingDisplay != null) {
|
|
128
146
|
cfg.push(`data-display="${item.Reference.bindingDisplay}"`)
|
|
129
147
|
} else {
|
|
130
148
|
cfg.push(`data-display="${item.Reference.bindingText}"`)
|
|
131
149
|
}
|
|
132
|
-
|
|
133
|
-
}
|
|
150
|
+
|
|
151
|
+
}
|
|
134
152
|
|
|
135
153
|
if (item.Validation.hasCustomValidator) {
|
|
136
154
|
cfg.push(`validator="${item.Validation.customValidator}"`)
|
|
137
155
|
}
|
|
138
156
|
|
|
139
|
-
if (item.Validation.messageDefault.trim()!='') {
|
|
157
|
+
if (item.Validation.messageDefault.trim() != '') {
|
|
140
158
|
cfg.push(`invalid-message="${item.Validation.messageDefault}"`)
|
|
141
|
-
}
|
|
159
|
+
}
|
|
142
160
|
|
|
143
161
|
|
|
144
162
|
if (item.input_disabled) {
|
|
145
163
|
cfg.push('disabled')
|
|
146
164
|
}
|
|
147
165
|
|
|
148
|
-
return cfg
|
|
166
|
+
return cfg
|
|
149
167
|
}
|