@agung_dhewe/webapps 1.1.2 → 1.2.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.

Potentially problematic release.


This version of @agung_dhewe/webapps might be problematic. Click here for more details.

Files changed (89) hide show
  1. package/lib/fgta5js-dist/fgta5js-v1.8.5.min.js +11 -0
  2. package/lib/fgta5js-dist/fgta5js-v1.8.5.min.js.map +1 -0
  3. package/{libs → lib}/webmodule/module-edit.css +73 -18
  4. package/{libs → lib}/webmodule/module-list.css +13 -0
  5. package/lib/webmodule/module-print.css +28 -0
  6. package/{libs → lib}/webmodule/module.css +13 -6
  7. package/{libs → lib}/webmodule/module.js +14 -4
  8. package/lib/webmodule/pagehelper.mjs +129 -0
  9. package/modules/generator/appgen-io.mjs +153 -76
  10. package/modules/generator/appgen-ui.mjs +234 -167
  11. package/modules/generator/generator-designtemplate-def.html +38 -0
  12. package/modules/generator/generator-designtemplate.html +11 -1492
  13. package/modules/generator/generator.css +103 -65
  14. package/modules/generator/generator.mjs +1 -1
  15. package/modules/generator/generator.svg +98 -0
  16. package/modules/generator/generatorEdit.mjs +43 -35
  17. package/modules/generator/generatorList.mjs +27 -0
  18. package/modules/generator/tpl-designerinfo.html +100 -0
  19. package/modules/generator/tpl-field-checkbox.html +200 -0
  20. package/modules/generator/tpl-field-combobox.html +228 -0
  21. package/modules/generator/tpl-field-datepicker.html +192 -0
  22. package/modules/generator/tpl-field-filebox.html +189 -0
  23. package/modules/generator/tpl-field-numberbox.html +218 -0
  24. package/modules/generator/tpl-field-textbox.html +255 -0
  25. package/modules/generator/tpl-field-timepicker.html +192 -0
  26. package/modules/generator/tpl-searchdesign.html +32 -0
  27. package/modules/generator/tpl-uniquedesign.html +25 -0
  28. package/modules/login/login.css +10 -2
  29. package/package.json +3 -1
  30. package/percobaan/coba-sequencer.js +16 -0
  31. package/src/api.js +12 -9
  32. package/src/apis/generator.api.js +35 -23
  33. package/src/apis/login.api.js +1 -0
  34. package/src/db.js +58 -32
  35. package/src/generator/createApiModule.js +4 -1
  36. package/src/generator/createIcon.js +24 -2
  37. package/src/generator/createLayoutCss.js +107 -0
  38. package/src/generator/createModuleDetilEditHtml.js +12 -1
  39. package/src/generator/createModuleDetilEditMjs.js +32 -28
  40. package/src/generator/createModuleDetilListHtml.js +14 -7
  41. package/src/generator/createModuleDetilListMjs.js +13 -1
  42. package/src/generator/createModuleHeaderEditHtml.js +13 -1
  43. package/src/generator/createModuleHeaderEditMjs.js +23 -2
  44. package/src/generator/createProgramData.js +3 -2
  45. package/src/generator/createTable.js +45 -38
  46. package/src/generator/helper.js +45 -27
  47. package/src/generator/templates/__rollup-module.ejs +1 -1
  48. package/src/generator/templates/api-module.js.ejs +171 -32
  49. package/src/generator/templates/layout.css.ejs +24 -0
  50. package/src/generator/templates/module-ext.html.ejs +1 -1
  51. package/src/generator/templates/module-ext.mjs.ejs +19 -1
  52. package/src/generator/templates/module.ejs.ejs +8 -0
  53. package/src/generator/templates/module.mjs.ejs +42 -5
  54. package/src/generator/templates/moduleDetilEdit.html.ejs +11 -0
  55. package/src/generator/templates/moduleDetilEdit.mjs.ejs +135 -30
  56. package/src/generator/templates/moduleDetilList.html.ejs +2 -1
  57. package/src/generator/templates/moduleDetilList.mjs.ejs +86 -11
  58. package/src/generator/templates/moduleHeaderEdit.html.ejs +8 -1
  59. package/src/generator/templates/moduleHeaderEdit.mjs.ejs +123 -36
  60. package/src/generator/templates/moduleHeaderList.html.ejs +5 -1
  61. package/src/generator/templates/moduleHeaderList.mjs.ejs +47 -15
  62. package/src/generator/trygenerate.js +18 -2
  63. package/src/generator/worker.js +83 -72
  64. package/src/logger.js +12 -12
  65. package/src/notifier.js +29 -0
  66. package/src/routers/generatorPage.js +3 -1
  67. package/src/routers/modulePage.js +32 -7
  68. package/src/sequencerdoc.js +22 -46
  69. package/src/sequencerline.js +16 -4
  70. package/src/session.js +69 -33
  71. package/src/startup.js +47 -10
  72. package/src/webapps.js +61 -18
  73. package/templates/_lib_debug.ejs +8 -8
  74. package/templates/_lib_production.ejs +2 -2
  75. package/templates/application.page.ejs +39 -6
  76. package/templates/generator.page.ejs +4 -3
  77. package/templates/index.page.ejs +2 -2
  78. package/templates/login.page.ejs +3 -3
  79. package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js +0 -11
  80. package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js.map +0 -1
  81. package/libs/webmodule/pagehelper.mjs +0 -45
  82. package/modules/generator/generator.png +0 -0
  83. /package/{libs/fgta5js-dist/fgta5js-v1.8.3.min.css → lib/fgta5js-dist/fgta5js-v1.8.5.min.css} +0 -0
  84. /package/{libs → lib}/fgta5js-dist/fonts/karla-italic-latin-ext.woff2 +0 -0
  85. /package/{libs → lib}/fgta5js-dist/fonts/karla-italic-latin.woff2 +0 -0
  86. /package/{libs → lib}/fgta5js-dist/fonts/karla-normal-latin-ext.woff2 +0 -0
  87. /package/{libs → lib}/fgta5js-dist/fonts/karla-normal-latin.woff2 +0 -0
  88. /package/{libs → lib}/fgta5js-dist/fonts/karla.css +0 -0
  89. /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 }: new Date()`
110
- } else if (item.component=='Numberbox') {
111
- setdefault = `${item.name }: ${item.data_defaultvalue}`
112
- } else if (item.component=='Checkbox') {
113
- if (item.data_defaultvalue==='true' || item.data_defaultvalue==='checked' || item.data_defaultvalue==='1') {
114
- setdefault = `${item.name }: true`
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 }: '${item.data_defaultvalue}'`
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: kebabToCamel(`${moduleName}-${sectionName}`),
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
- fields.push({
115
- component,
116
- dataName: columnDataName, //bindingDisplay!=null ? bindingDisplay : dataName,
117
- binding: columnDataBinding, //bindingDisplay!=null ? bindingDisplay : binding,
118
- label,
119
- additionalAttributes
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
- const title = context.title
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 program_id = await sequencer.yearlyshort('CNT')
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,18 +11,21 @@ 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
 
26
+ console.log(context.entities)
27
+
28
+
26
29
 
27
30
  // start geneate program code
28
31
  let sections = []
@@ -30,19 +33,23 @@ export async function createTable(context, options) {
30
33
 
31
34
  // prepare target file
32
35
  const targetFile = path.join(context.moduleDir, `${moduleName}-${entityName}.sql`)
33
-
34
-
36
+
37
+
35
38
  // reporting progress to parent process
36
- context.postMessage({message: `generating file: '${targetFile}`})
39
+ context.postMessage({ message: `generating file: '${targetFile}` })
37
40
 
38
41
 
39
42
  // start generate table for tis entity
40
43
  const entity = context.entities[entityName]
41
- const {table, descr, pk, identifierMethod} = entity
44
+ const { table, descr, pk, identifierMethod, skipRegenerateTable } = entity
42
45
  const pkData = entity.Items[pk]
43
- const {schema, tablename} = ddl.parseTableName(table)
44
- const {data_fieldname, data_type, data_length, description} = pkData
45
-
46
+ const { schema, tablename } = ddl.parseTableName(table)
47
+ const { data_fieldname, data_type, data_length, description } = pkData
48
+
49
+
50
+ if (skipRegenerateTable === true) {
51
+ continue
52
+ }
46
53
 
47
54
 
48
55
  const scriptContent = []
@@ -52,7 +59,7 @@ export async function createTable(context, options) {
52
59
 
53
60
  // Buat Table dengan field hanya untuk primary key
54
61
  {
55
- const sql = await ddl.createTable(schema, tablename, descr, {
62
+ const sql = await ddl.createTable(schema, tablename, descr, {
56
63
  fieldname: data_fieldname,
57
64
  datatype: data_type,
58
65
  length: data_length,
@@ -62,31 +69,31 @@ export async function createTable(context, options) {
62
69
  }
63
70
 
64
71
  const recordColumns = createRecordColumns()
65
- const entityItems = structuredClone({...entity.Items, ...recordColumns})
72
+ const entityItems = structuredClone({ ...entity.Items, ...recordColumns })
66
73
 
67
74
  // Buat Fields
68
75
  {
69
-
76
+
70
77
  for (var fieldname in entityItems) {
71
- if (fieldname==pk) {
78
+ if (fieldname == pk) {
72
79
  continue
73
80
  }
74
81
 
75
82
  const field = entityItems[fieldname]
76
- const {data_fieldname, data_type, data_length, data_precision, data_allownull, data_defaultvalue, description} = field
77
-
78
- const sql = await ddl.createField(schema, tablename, {
79
- fieldname: data_fieldname,
80
- datatype: data_type,
81
- length: data_length,
82
- precision: data_precision,
83
- allownull: data_allownull,
84
- defaultvalue: data_defaultvalue,
83
+ const { data_fieldname, data_type, data_length, data_precision, data_allownull, data_defaultvalue, description } = field
84
+
85
+ const sql = await ddl.createField(schema, tablename, {
86
+ fieldname: data_fieldname,
87
+ datatype: data_type,
88
+ length: data_length,
89
+ precision: data_precision,
90
+ allownull: data_allownull,
91
+ defaultvalue: data_defaultvalue,
85
92
  description: description
86
93
  })
87
94
  scriptContent.push(sql)
88
95
  }
89
-
96
+
90
97
  }
91
98
 
92
99
  // buat foreign key
@@ -99,8 +106,8 @@ export async function createTable(context, options) {
99
106
  return acc;
100
107
  }, {})
101
108
 
102
-
103
- const sql = await ddl.createFereignKey(schema, tablename, foreignKeys)
109
+
110
+ const sql = await ddl.createFereignKey(schema, tablename, foreignKeys)
104
111
  scriptContent.push(sql)
105
112
 
106
113
  }
@@ -112,9 +119,9 @@ export async function createTable(context, options) {
112
119
  {
113
120
  const sql = await ddl.createUniqueIndex(schema, tablename, entity.Uniques)
114
121
  scriptContent.push(sql)
115
- }
122
+ }
123
+
116
124
 
117
-
118
125
  let content = scriptContent.join("\n")
119
126
  await fs.writeFile(targetFile, content, 'utf8');
120
127
 
@@ -130,23 +137,23 @@ export async function createTable(context, options) {
130
137
  function createRecordColumns() {
131
138
  const records = {
132
139
  _createby: {
133
- data_fieldname: '_createby', data_type: 'bigint', data_allownull: false, description: 'user yang pertama kali membuat record ini',
134
- Reference: {table: '',pk: ''}
140
+ data_fieldname: '_createby', data_type: 'integer', data_allownull: false, description: 'user yang pertama kali membuat record ini',
141
+ Reference: { table: '', pk: '' }
135
142
  },
136
-
143
+
137
144
  _createdate: {
138
- data_fieldname: '_createdate', data_type: 'timestamp', data_allownull: false, description: 'waktu record dibuat pertama kali',
139
- Reference: {table: '',pk: ''}
145
+ data_fieldname: '_createdate', data_type: 'timestamp', data_allownull: false, data_defaultvalue: 'now()', description: 'waktu record dibuat pertama kali',
146
+ Reference: { table: '', pk: '' }
140
147
  },
141
-
148
+
142
149
  _modifyby: {
143
- data_fieldname: '_modifyby', data_type: 'bigint', data_allownull: true, description: 'user yang terakhir modifikasi record ini',
144
- Reference: {table: '',pk: ''}
150
+ data_fieldname: '_modifyby', data_type: 'integer', data_allownull: true, description: 'user yang terakhir modifikasi record ini',
151
+ Reference: { table: '', pk: '' }
145
152
  },
146
153
 
147
154
  _modifydate: {
148
155
  data_fieldname: '_modifydate', data_type: 'timestamp', data_allownull: true, description: 'waktu terakhir record dimodifikasi',
149
- Reference: {table: '',pk: ''}
156
+ Reference: { table: '', pk: '' }
150
157
  }
151
158
  }
152
159
 
@@ -6,7 +6,7 @@ export function kebabToCamel(str) {
6
6
  return str
7
7
  .split('-')
8
8
  .map((part, index) =>
9
- index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)
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
- cfg.push(`maxlength="${item.data_length}"`)
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
  }