@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.
- 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 +3 -1
- 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/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 +45 -38
- package/src/generator/helper.js +45 -27
- package/src/generator/templates/__rollup-module.ejs +1 -1
- 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/logger.js +12 -12
- package/src/notifier.js +29 -0
- package/src/routers/generatorPage.js +3 -1
- package/src/routers/modulePage.js +32 -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 +61 -18
- package/templates/_lib_debug.ejs +8 -8
- package/templates/_lib_production.ejs +2 -2
- package/templates/application.page.ejs +39 -6
- 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
|
@@ -10,13 +10,13 @@ const IO = new AppGenIO()
|
|
|
10
10
|
const URL_LAYOUT = 'appgen-layout'
|
|
11
11
|
const ME = {}
|
|
12
12
|
|
|
13
|
-
const ENT_COL_ID =
|
|
14
|
-
const ENT_COL_NAME =
|
|
15
|
-
const ENT_COL_TITLE =
|
|
16
|
-
const ENT_COL_TABLE =
|
|
17
|
-
const ENT_COL_PK =
|
|
18
|
-
const ENT_COL_BTNDESIGN =
|
|
19
|
-
const ENT_COL_BTNREMOVE =
|
|
13
|
+
const ENT_COL_ID = 'col_id'
|
|
14
|
+
const ENT_COL_NAME = 'col_name'
|
|
15
|
+
const ENT_COL_TITLE = 'col_title'
|
|
16
|
+
const ENT_COL_TABLE = 'col_table'
|
|
17
|
+
const ENT_COL_PK = 'col_pk'
|
|
18
|
+
const ENT_COL_BTNDESIGN = 'col_btndesign'
|
|
19
|
+
const ENT_COL_BTNREMOVE = 'col_btnremove'
|
|
20
20
|
|
|
21
21
|
const ATTR_NAME = 'name'
|
|
22
22
|
const ATTR_ENTITYID = 'data-entity-id'
|
|
@@ -79,34 +79,34 @@ const CURRENT = {
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
const generateId = (prefix = "el") => {
|
|
82
|
-
|
|
82
|
+
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 5)}`;
|
|
83
83
|
}
|
|
84
|
-
const isValidName = str => /^[_a-z0-9]+$/.test(str)
|
|
84
|
+
const isValidName = str => /^[_a-z0-9]+$/.test(str);
|
|
85
85
|
|
|
86
86
|
const capitalizeFirst = (str) => {
|
|
87
|
-
|
|
87
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const createInputElement = (type, entity_id, data={}) => {
|
|
90
|
+
const createInputElement = (type, entity_id, data = {}) => {
|
|
91
91
|
const input = document.createElement('input')
|
|
92
92
|
input.setAttribute('type', type)
|
|
93
93
|
input.setAttribute(ATTR_NAME, data.name)
|
|
94
94
|
input.setAttribute(ATTR_ENTITYID, entity_id)
|
|
95
95
|
input.value = data.value
|
|
96
|
-
return input
|
|
96
|
+
return input
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export default class AppGenUI {
|
|
100
100
|
#app
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
constructor(app) {
|
|
103
103
|
this.#app = app
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
IO.addFunction('addUnique', AppGenLayout_addUnique)
|
|
106
106
|
IO.addFunction('addSearch', AppGenLayout_addSearch)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
get App() { return this.#app}
|
|
109
|
+
get App() { return this.#app }
|
|
110
110
|
|
|
111
111
|
async NewData() {
|
|
112
112
|
await AppGenLayout_NewData(this)
|
|
@@ -141,13 +141,13 @@ export default class AppGenUI {
|
|
|
141
141
|
|
|
142
142
|
async reset() {
|
|
143
143
|
await IO.reset()
|
|
144
|
-
}
|
|
144
|
+
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
async function AppGenLayout_Render(self, context) {
|
|
150
|
-
ME.IconButton = document.getElementById('upload-icon')
|
|
150
|
+
ME.IconButton = document.getElementById('upload-icon')
|
|
151
151
|
ME.ComponentList = document.getElementById('crud-component-list')
|
|
152
152
|
ME.DesignTemplate = document.getElementById('DESIGNTEMPLATE')
|
|
153
153
|
ME.DataEntities = document.getElementById('data-entities')
|
|
@@ -157,7 +157,7 @@ async function AppGenLayout_Render(self, context) {
|
|
|
157
157
|
// ME.EntityDesigner = document.getElementById('entities-design')
|
|
158
158
|
ME.tbl_entity = document.getElementById('tbl_entity')
|
|
159
159
|
ME.btn_addEntity = document.getElementById('btn_addentity')
|
|
160
|
-
ME.btn_addEntity.addEventListener('click', (evt)=>{
|
|
160
|
+
ME.btn_addEntity.addEventListener('click', (evt) => {
|
|
161
161
|
btn_addEntity_click(self, evt)
|
|
162
162
|
})
|
|
163
163
|
|
|
@@ -167,7 +167,7 @@ async function AppGenLayout_Render(self, context) {
|
|
|
167
167
|
|
|
168
168
|
AppGenLayout_setUniqueME(ME)
|
|
169
169
|
AppGenLayout_setSearchME(ME)
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
console.log(context.appsUrls)
|
|
172
172
|
|
|
173
173
|
|
|
@@ -179,12 +179,12 @@ async function AppGenLayout_Render(self, context) {
|
|
|
179
179
|
AppGenLayout_startDesign(self, entity_id, suppress)
|
|
180
180
|
},
|
|
181
181
|
addComponentToDesigner: (droptarget, comp) => {
|
|
182
|
-
return AppGenLayout_addComponentToDesigner(self, droptarget, comp)
|
|
182
|
+
return AppGenLayout_addComponentToDesigner(self, droptarget, comp)
|
|
183
183
|
},
|
|
184
184
|
addAction: (data) => {
|
|
185
185
|
AppGenLayout_addAction(self, data)
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
})
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -193,80 +193,80 @@ function AppGenLayout_createButtons(self) {
|
|
|
193
193
|
ME.IconButton.style.backgroundImage = `url('data:image/svg+xml,${encodeURIComponent(ICON_DEFAULT)}')`;
|
|
194
194
|
console.log(ME.IconButton.style.backgroundImage)
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
const btnUpload = document.getElementById('btn_IconUpload')
|
|
198
|
-
btnUpload.addEventListener('change', (evt)=>{
|
|
198
|
+
btnUpload.addEventListener('change', (evt) => {
|
|
199
199
|
const file = btnUpload.files[0];
|
|
200
|
-
|
|
200
|
+
if (!file) return;
|
|
201
201
|
|
|
202
202
|
const validTypes = ["image/png", "image/svg+xml"];
|
|
203
203
|
if (!validTypes.includes(file.type)) {
|
|
204
204
|
alert("Hanya file PNG atau SVG yang diperbolehkan.");
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
const reader = new FileReader();
|
|
209
|
-
|
|
209
|
+
reader.onload = function (e) {
|
|
210
210
|
ME.IconButton.style.backgroundImage = `url('${e.target.result}')`
|
|
211
211
|
};
|
|
212
|
-
|
|
212
|
+
reader.readAsDataURL(file);
|
|
213
213
|
})
|
|
214
214
|
|
|
215
215
|
|
|
216
216
|
//button design summary
|
|
217
217
|
const btn_ShowSummary = document.getElementById('btn_ShowSummary')
|
|
218
|
-
btn_ShowSummary.addEventListener('click', (evt)=>{
|
|
218
|
+
btn_ShowSummary.addEventListener('click', (evt) => {
|
|
219
219
|
btn_ShowSummary_click(self, evt)
|
|
220
220
|
})
|
|
221
221
|
|
|
222
222
|
// button design detil
|
|
223
223
|
const btn_ShowDetail = document.getElementById('btn_ShowDetail')
|
|
224
|
-
btn_ShowDetail.addEventListener('click', (evt)=>{
|
|
224
|
+
btn_ShowDetail.addEventListener('click', (evt) => {
|
|
225
225
|
btn_ShowDetail_click(self, evt)
|
|
226
226
|
})
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
// menampilkan design fields
|
|
230
230
|
const btn_ShowFields = document.getElementById('btn_ShowFields')
|
|
231
|
-
btn_ShowFields.addEventListener('click', (evt)=>{
|
|
231
|
+
btn_ShowFields.addEventListener('click', (evt) => {
|
|
232
232
|
btn_ShowFields_click(self, evt)
|
|
233
233
|
})
|
|
234
234
|
|
|
235
235
|
// menampilkan design uniq
|
|
236
236
|
const btn_ShowUniq = document.getElementById('btn_ShowUniq')
|
|
237
|
-
btn_ShowUniq.addEventListener('click', (evt)=>{
|
|
237
|
+
btn_ShowUniq.addEventListener('click', (evt) => {
|
|
238
238
|
btn_ShowUniq_click(self, evt)
|
|
239
239
|
})
|
|
240
240
|
|
|
241
241
|
// menampilkan design search
|
|
242
242
|
const btn_ShowSearch = document.getElementById('btn_ShowSearch')
|
|
243
|
-
btn_ShowSearch.addEventListener('click', (evt)=>{
|
|
243
|
+
btn_ShowSearch.addEventListener('click', (evt) => {
|
|
244
244
|
btn_ShowSearch_click(self, evt)
|
|
245
245
|
})
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
function btn_ShowSummary_click(self, evt) {
|
|
249
249
|
CURRENT.Design.classList.add('design-view-as-summary')
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
const entitties = CURRENT.Design.querySelectorAll('div[name="design-data-field"]')
|
|
252
|
-
entitties.forEach(el=>{
|
|
252
|
+
entitties.forEach(el => {
|
|
253
253
|
el.classList.remove('minimized')
|
|
254
254
|
el.classList.remove('maximized')
|
|
255
255
|
})
|
|
256
256
|
|
|
257
|
-
const droptarget =
|
|
257
|
+
const droptarget = CURRENT.Design.querySelector('div[name="drop-target"')
|
|
258
258
|
droptarget.classList.add('minimized-drop-target')
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
function btn_ShowDetail_click(self, evt) {
|
|
262
262
|
CURRENT.Design.classList.remove('design-view-as-summary')
|
|
263
263
|
const entitties = CURRENT.Design.querySelectorAll('div[name="design-data-field"]')
|
|
264
|
-
entitties.forEach(el=>{
|
|
264
|
+
entitties.forEach(el => {
|
|
265
265
|
el.classList.remove('minimized')
|
|
266
266
|
el.classList.remove('maximized')
|
|
267
267
|
})
|
|
268
268
|
|
|
269
|
-
const droptarget =
|
|
269
|
+
const droptarget = CURRENT.Design.querySelector('div[name="drop-target"')
|
|
270
270
|
droptarget.classList.remove('minimized-drop-target')
|
|
271
271
|
}
|
|
272
272
|
|
|
@@ -279,7 +279,7 @@ function showOnly(toShow) {
|
|
|
279
279
|
} else {
|
|
280
280
|
node.classList.add('hidden')
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -290,10 +290,10 @@ function btn_ShowFields_click(self, evt) {
|
|
|
290
290
|
const entity_id = CURRENT.entity_id
|
|
291
291
|
const designer = ME.EntityDesigner.querySelector(`div[${ATTR_ENTITYID}="${entity_id}"]`)
|
|
292
292
|
let droptarget = designer.querySelector(`[name="${ATTR_DROPTARGET}"]`)
|
|
293
|
-
if (droptarget!=null) {
|
|
293
|
+
if (droptarget != null) {
|
|
294
294
|
droptarget.classList.remove('hidden')
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
function btn_ShowUniq_click(self, evt) {
|
|
@@ -312,28 +312,28 @@ function btn_ShowSearch_click(self, evt) {
|
|
|
312
312
|
|
|
313
313
|
function btn_addEntity_click(self, evt) {
|
|
314
314
|
ME.btn_addEntity.style.animation = 'tombolDiTekanMenghilang 0.3s forwards'
|
|
315
|
-
setTimeout(()=>{
|
|
315
|
+
setTimeout(() => {
|
|
316
316
|
ME.btn_addEntity.classList.add('hidden')
|
|
317
317
|
ME.btn_addEntity.style.animation = 'unset'
|
|
318
318
|
AppGenLayout_AddEntity(self, {})
|
|
319
319
|
}, 300)
|
|
320
320
|
|
|
321
321
|
// nanti muncul lagi setelah 1 detil
|
|
322
|
-
setTimeout(()=>{
|
|
322
|
+
setTimeout(() => {
|
|
323
323
|
ME.btn_addEntity.classList.remove('hidden')
|
|
324
324
|
ME.btn_addEntity.style.animation = 'tombolMunculLagi 0.3s forwards'
|
|
325
|
-
setTimeout(()=>{
|
|
325
|
+
setTimeout(() => {
|
|
326
326
|
ME.btn_addEntity.style.animation = 'unset'
|
|
327
327
|
}, 300)
|
|
328
328
|
}, 1000)
|
|
329
|
-
|
|
330
329
|
|
|
331
|
-
|
|
332
330
|
|
|
333
|
-
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
async function AppGenLayout_AddEntity(self, entity={}) {
|
|
336
|
+
async function AppGenLayout_AddEntity(self, entity = {}) {
|
|
337
337
|
const ID = entity[ENT_COL_ID] ?? generateId('en')
|
|
338
338
|
const tbl_entity = ME.tbl_entity
|
|
339
339
|
const tbody = tbl_entity.querySelector('tbody')
|
|
@@ -355,7 +355,7 @@ async function AppGenLayout_AddEntity(self, entity={}) {
|
|
|
355
355
|
}
|
|
356
356
|
tbody.appendChild(newtr)
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
|
|
360
360
|
|
|
361
361
|
const fn_set_input = (type, value, entity_column_identity, isheader) => {
|
|
@@ -367,18 +367,18 @@ async function AppGenLayout_AddEntity(self, entity={}) {
|
|
|
367
367
|
const input = col.appendChild(createInputElement(type, ID, data))
|
|
368
368
|
|
|
369
369
|
input.setAttribute('autocomplete', 'off')
|
|
370
|
-
if (type=='text') {
|
|
371
|
-
input.addEventListener('change', (evt)=>{
|
|
370
|
+
if (type == 'text') {
|
|
371
|
+
input.addEventListener('change', (evt) => {
|
|
372
372
|
AppGenLayout_entityInputChanged(self, evt)
|
|
373
373
|
})
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
|
|
377
|
-
if (isheader===true) {
|
|
378
|
-
type='hidden'
|
|
377
|
+
if (isheader === true) {
|
|
378
|
+
type = 'hidden'
|
|
379
379
|
input.setAttribute('type', 'hidden')
|
|
380
|
-
}
|
|
381
|
-
if (type=='hidden') {
|
|
380
|
+
}
|
|
381
|
+
if (type == 'hidden') {
|
|
382
382
|
col.innerHTML = `<span>${data['value']}</span>`
|
|
383
383
|
}
|
|
384
384
|
col.appendChild(input)
|
|
@@ -390,15 +390,15 @@ async function AppGenLayout_AddEntity(self, entity={}) {
|
|
|
390
390
|
fn_set_input('text', entity[ENT_COL_TITLE], ENT_COL_TITLE)
|
|
391
391
|
fn_set_input('text', entity[ENT_COL_TABLE], ENT_COL_TABLE)
|
|
392
392
|
fn_set_input('text', entity[ENT_COL_PK], ENT_COL_PK)
|
|
393
|
-
|
|
393
|
+
|
|
394
394
|
let btn_design = fn_set_input('button', "design", ENT_COL_BTNDESIGN)
|
|
395
|
-
btn_design.addEventListener('click', (evt)=>{
|
|
395
|
+
btn_design.addEventListener('click', (evt) => {
|
|
396
396
|
btn_design_click(self, evt)
|
|
397
397
|
})
|
|
398
398
|
|
|
399
|
-
if (entity.isheader!==true) {
|
|
399
|
+
if (entity.isheader !== true) {
|
|
400
400
|
let btn_remove = fn_set_input('button', "remove", ENT_COL_BTNREMOVE)
|
|
401
|
-
btn_remove.addEventListener('click', (evt)=>{
|
|
401
|
+
btn_remove.addEventListener('click', (evt) => {
|
|
402
402
|
btn_remove_click(self, evt)
|
|
403
403
|
})
|
|
404
404
|
}
|
|
@@ -407,7 +407,7 @@ async function AppGenLayout_AddEntity(self, entity={}) {
|
|
|
407
407
|
|
|
408
408
|
// tambahkan ke ME.EntityDesigner
|
|
409
409
|
AppGenLayout_addDesigner(self, ID, entity.isheader)
|
|
410
|
-
|
|
410
|
+
|
|
411
411
|
|
|
412
412
|
return ID
|
|
413
413
|
}
|
|
@@ -418,7 +418,7 @@ async function AppGenLayout_entityInputChanged(self, evt) {
|
|
|
418
418
|
const name = input.getAttribute(ATTR_NAME)
|
|
419
419
|
const entity_id = input.getAttribute(ATTR_ENTITYID)
|
|
420
420
|
const value = input.value
|
|
421
|
-
|
|
421
|
+
|
|
422
422
|
const data = {}
|
|
423
423
|
data[name] = value
|
|
424
424
|
|
|
@@ -427,7 +427,7 @@ async function AppGenLayout_entityInputChanged(self, evt) {
|
|
|
427
427
|
AppGenLayout_changeEntityInfo(self, entity_id, data)
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
if (name==ENT_COL_PK) {
|
|
430
|
+
if (name == ENT_COL_PK) {
|
|
431
431
|
AppGenLayout_designerFieldNameChanged(self, entity_id, input, true)
|
|
432
432
|
}
|
|
433
433
|
|
|
@@ -436,7 +436,7 @@ async function AppGenLayout_entityInputChanged(self, evt) {
|
|
|
436
436
|
|
|
437
437
|
async function AppGenLayout_CekEntityData(self, data) {
|
|
438
438
|
for (var name in data) {
|
|
439
|
-
if (data[name]==null || data[name].trim()=='') {
|
|
439
|
+
if (data[name] == null || data[name].trim() == '') {
|
|
440
440
|
await $fgta5.MessageBox.warning("lengkapi dahulu semua data entity")
|
|
441
441
|
return false
|
|
442
442
|
}
|
|
@@ -444,8 +444,8 @@ async function AppGenLayout_CekEntityData(self, data) {
|
|
|
444
444
|
|
|
445
445
|
const rule = "hanya boleh alphabet dan angka, dengan huruf kecil,<br>tanpa spasi, tanpa character khusus."
|
|
446
446
|
|
|
447
|
-
|
|
448
|
-
if (data[ENT_COL_NAME]!==undefined) {
|
|
447
|
+
|
|
448
|
+
if (data[ENT_COL_NAME] !== undefined) {
|
|
449
449
|
if (!isValidName(data[ENT_COL_NAME].trim())) {
|
|
450
450
|
await $fgta5.MessageBox.warning(`nama entity: <span style="font-weight:bold; color:red">${data[ENT_COL_NAME]}</span> tidak valid!<br>${rule}`)
|
|
451
451
|
return false
|
|
@@ -460,8 +460,8 @@ async function AppGenLayout_CekEntityData(self, data) {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
*/
|
|
463
|
-
|
|
464
|
-
if (data[ENT_COL_PK]!==undefined) {
|
|
463
|
+
|
|
464
|
+
if (data[ENT_COL_PK] !== undefined) {
|
|
465
465
|
if (!isValidName(data[ENT_COL_PK].trim())) {
|
|
466
466
|
await $fgta5.MessageBox.warning(`nama PK: <span style="font-weight:bold; color:red">${data[ENT_COL_PK]}</span> tidak valid!<br>${rule}`)
|
|
467
467
|
return false
|
|
@@ -477,18 +477,18 @@ async function btn_design_click(self, evt) {
|
|
|
477
477
|
const entity_id = btn.getAttribute(ATTR_ENTITYID)
|
|
478
478
|
const editores = ME.EntityDesigner.querySelectorAll(`div[name="${ID_ENTITYEDITOR}"]`)
|
|
479
479
|
const tr = btn.closest('tr')
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
|
|
481
|
+
|
|
482
482
|
const data = AppGenLayout_GetEntityData(self, tr)
|
|
483
483
|
const valid = await AppGenLayout_CekEntityData(self, data)
|
|
484
|
-
|
|
484
|
+
|
|
485
485
|
if (!valid) {
|
|
486
486
|
return
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
for (let el of editores) {
|
|
490
490
|
let ceid = el.getAttribute(ATTR_ENTITYID)
|
|
491
|
-
if (ceid==entity_id) {
|
|
491
|
+
if (ceid == entity_id) {
|
|
492
492
|
el.classList.remove(CLS_HIDDEN)
|
|
493
493
|
AppGenLayout_entityDesign(self, entity_id, tr)
|
|
494
494
|
AppGenLayout_startDesign(self, entity_id)
|
|
@@ -528,7 +528,7 @@ function AppGenLayout_changeEntityInfo(self, entity_id, data) {
|
|
|
528
528
|
const info = ME.EntityDesigner.querySelector(`div[${ATTR_ENTITYID}="${entity_id}"] div[name="${ID_DESIGNERINFO}"]`)
|
|
529
529
|
const ens = [ENT_COL_NAME, ENT_COL_TITLE, ENT_COL_TABLE, ENT_COL_PK]
|
|
530
530
|
for (var name of ens) {
|
|
531
|
-
if (data[name]!==undefined) {
|
|
531
|
+
if (data[name] !== undefined) {
|
|
532
532
|
const ed = info.querySelector(`div[name="${name}"]`)
|
|
533
533
|
ed.innerHTML = data[name]
|
|
534
534
|
}
|
|
@@ -543,15 +543,15 @@ async function btn_remove_click(self, evt) {
|
|
|
543
543
|
|
|
544
544
|
var sudahadadata = false
|
|
545
545
|
for (var name in data) {
|
|
546
|
-
if (data[name].trim()!='') {
|
|
546
|
+
if (data[name].trim() != '') {
|
|
547
547
|
sudahadadata = true
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
const remove = (tr) => {
|
|
552
552
|
var entity_id = tr.getAttribute(ATTR_ENTITYID)
|
|
553
|
-
var editor = ME.EntityDesigner.querySelector(`[${ATTR_ENTITYID}="${entity_id}"]`)
|
|
554
|
-
if (editor!=null) {
|
|
553
|
+
var editor = ME.EntityDesigner.querySelector(`[${ATTR_ENTITYID}="${entity_id}"]`)
|
|
554
|
+
if (editor != null) {
|
|
555
555
|
editor.remove()
|
|
556
556
|
}
|
|
557
557
|
tr.remove()
|
|
@@ -560,7 +560,7 @@ async function btn_remove_click(self, evt) {
|
|
|
560
560
|
|
|
561
561
|
if (sudahadadata) {
|
|
562
562
|
var ret = await $fgta5.MessageBox.confirm("Apakah anda yakin mau menghapus design entity ini?")
|
|
563
|
-
if (ret=='ok') {
|
|
563
|
+
if (ret == 'ok') {
|
|
564
564
|
remove(tr)
|
|
565
565
|
}
|
|
566
566
|
} else {
|
|
@@ -578,7 +578,7 @@ function AppGenLayout_addDesigner(self, ID, isheader) {
|
|
|
578
578
|
editem.classList.add(CLS_ENTITYEDITOR)
|
|
579
579
|
editem.setAttribute('name', ID_ENTITYEDITOR)
|
|
580
580
|
editem.setAttribute(ATTR_ENTITYID, ID)
|
|
581
|
-
|
|
581
|
+
|
|
582
582
|
// ambil data template untuk entity info
|
|
583
583
|
const tplInfo = ME.DesignTemplate.querySelector(`div[name="${ID_DESIGNERINFO}"]`)
|
|
584
584
|
const elinfo = tplInfo.cloneNode(true)
|
|
@@ -592,34 +592,86 @@ function AppGenLayout_addDesigner(self, ID, isheader) {
|
|
|
592
592
|
const elsearch = tplSearch.cloneNode(true)
|
|
593
593
|
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
|
|
596
596
|
// console.log(ME.EntityDesigner)
|
|
597
597
|
// eluniq.innerHTML = `designer unig ${ID}`
|
|
598
598
|
|
|
599
599
|
|
|
600
|
-
|
|
600
|
+
|
|
601
601
|
editem.appendChild(elinfo)
|
|
602
602
|
editem.appendChild(eluniq)
|
|
603
603
|
editem.appendChild(elsearch)
|
|
604
604
|
|
|
605
|
+
const chkfg = elinfo.querySelector('input[type="checkbox"][name="form-grid-layout"]')
|
|
606
|
+
const chkfn = elinfo.querySelector('input[type="checkbox"][name="allow-form-new"]')
|
|
607
|
+
const chkfe = elinfo.querySelector('input[type="checkbox"][name="allow-form-edit"]')
|
|
608
|
+
|
|
605
609
|
const chka = elinfo.querySelector('input[type="checkbox"][name="allow-row-add"]')
|
|
606
610
|
const chkr = elinfo.querySelector('input[type="checkbox"][name="allow-row-remove"]')
|
|
611
|
+
const chke = elinfo.querySelector('input[type="checkbox"][name="allow-row-edit"]')
|
|
612
|
+
|
|
613
|
+
chkfg.checked = true
|
|
614
|
+
chkfn.checked = true
|
|
615
|
+
chkfe.checked = true
|
|
607
616
|
|
|
608
617
|
chka.checked = true
|
|
609
618
|
chkr.checked = true
|
|
619
|
+
chke.checked = true
|
|
610
620
|
|
|
611
|
-
if (isheader===true) {
|
|
621
|
+
if (isheader === true) {
|
|
612
622
|
chka.disabled = true
|
|
613
623
|
chkr.disabled = true
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
624
|
+
|
|
625
|
+
// sembunykan data-control di header
|
|
626
|
+
{
|
|
627
|
+
const elems = elinfo.querySelectorAll('[data-control]')
|
|
628
|
+
for (var el of elems) {
|
|
629
|
+
el.classList.add('hidden')
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// tampilkan data-bindhead di header
|
|
634
|
+
{
|
|
635
|
+
const elems = elinfo.querySelectorAll('[data-bindhead]')
|
|
636
|
+
for (var el of elems) {
|
|
637
|
+
el.classList.remove('hidden')
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
// tampilkan data-entity-header
|
|
643
|
+
{
|
|
644
|
+
const elems = elinfo.querySelectorAll('[data-entity-header]')
|
|
645
|
+
for (var el of elems) {
|
|
646
|
+
el.classList.remove('hidden')
|
|
647
|
+
}
|
|
617
648
|
}
|
|
618
649
|
|
|
619
650
|
} else {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
651
|
+
|
|
652
|
+
// tampilkan data-control di header
|
|
653
|
+
{
|
|
654
|
+
const elems = elinfo.querySelectorAll('[data-autoid]')
|
|
655
|
+
for (var el of elems) {
|
|
656
|
+
el.classList.add('hidden')
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
// sembunyikan data-bindhead di header
|
|
662
|
+
{
|
|
663
|
+
const elems = elinfo.querySelectorAll('[data-bindhead]')
|
|
664
|
+
for (var el of elems) {
|
|
665
|
+
el.classList.add('hidden')
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// sembunyikan data-entity-header
|
|
670
|
+
{
|
|
671
|
+
const elems = elinfo.querySelectorAll('[data-entity-header]')
|
|
672
|
+
for (var el of elems) {
|
|
673
|
+
el.classList.add('hidden')
|
|
674
|
+
}
|
|
623
675
|
}
|
|
624
676
|
}
|
|
625
677
|
|
|
@@ -665,8 +717,8 @@ async function AppGenLayout_NewData(self) {
|
|
|
665
717
|
|
|
666
718
|
const btn = tbody.querySelector(`[name="col_btndesign"][${ATTR_ENTITYID}="${entity_id}"]`)
|
|
667
719
|
btn.click()
|
|
668
|
-
|
|
669
|
-
setTimeout(()=>{
|
|
720
|
+
|
|
721
|
+
setTimeout(() => {
|
|
670
722
|
IO.AutoSave()
|
|
671
723
|
}, 2000)
|
|
672
724
|
|
|
@@ -677,16 +729,16 @@ function AppGenLayout_highlightElement(self, droptarget) {
|
|
|
677
729
|
|
|
678
730
|
|
|
679
731
|
droptarget.style.animation = 'pulseHighlight 1s forwards'
|
|
680
|
-
setTimeout(()=>{
|
|
732
|
+
setTimeout(() => {
|
|
681
733
|
droptarget.style.animation = 'unset'
|
|
682
734
|
}, 1000)
|
|
683
735
|
|
|
684
736
|
}
|
|
685
737
|
|
|
686
738
|
function AppGenLayout_startDesign(self, entity_id, suppress) {
|
|
687
|
-
if (suppress===undefined) {
|
|
739
|
+
if (suppress === undefined) {
|
|
688
740
|
suppress = false
|
|
689
|
-
}
|
|
741
|
+
}
|
|
690
742
|
|
|
691
743
|
|
|
692
744
|
if (!suppress) {
|
|
@@ -699,7 +751,7 @@ function AppGenLayout_startDesign(self, entity_id, suppress) {
|
|
|
699
751
|
// cek apakah sudah ada drop target
|
|
700
752
|
const designer = ME.EntityDesigner.querySelector(`div[${ATTR_ENTITYID}="${entity_id}"]`)
|
|
701
753
|
let droptarget = designer.querySelector(`[name="${ATTR_DROPTARGET}"]`)
|
|
702
|
-
if (droptarget==null) {
|
|
754
|
+
if (droptarget == null) {
|
|
703
755
|
// blum ada, buat dulu
|
|
704
756
|
const tpl = ME.DesignTemplate.querySelector(`div[name="${ATTR_DROPTARGET}"]`)
|
|
705
757
|
droptarget = tpl.cloneNode(true)
|
|
@@ -726,53 +778,65 @@ function AppGenLayout_startDesign(self, entity_id, suppress) {
|
|
|
726
778
|
|
|
727
779
|
function AppGenLayout_setupDropTarget(self, droptarget) {
|
|
728
780
|
const dr = droptarget.getAttribute(ATTR_DROPTARGET)
|
|
729
|
-
if (dr===true) {
|
|
781
|
+
if (dr === true) {
|
|
730
782
|
// drop target sudah di setup
|
|
731
783
|
return
|
|
732
784
|
}
|
|
733
785
|
|
|
734
786
|
|
|
735
|
-
droptarget.addEventListener('dragover', (evt)=>{
|
|
787
|
+
droptarget.addEventListener('dragover', (evt) => {
|
|
736
788
|
evt.preventDefault()
|
|
737
789
|
droptarget.setAttribute(ATTR_DRAGOVER, '')
|
|
738
790
|
})
|
|
739
791
|
|
|
740
|
-
droptarget.addEventListener('dragleave', (evt)=>{
|
|
792
|
+
droptarget.addEventListener('dragleave', (evt) => {
|
|
741
793
|
droptarget.removeAttribute(ATTR_DRAGOVER)
|
|
742
794
|
// droptarget.classList.add('hidden')
|
|
743
795
|
})
|
|
744
796
|
|
|
745
|
-
droptarget.addEventListener('drop', (evt)=>{
|
|
797
|
+
droptarget.addEventListener('drop', (evt) => {
|
|
746
798
|
CURRENT.drop_valid = true
|
|
747
799
|
droptarget.removeAttribute(ATTR_DRAGOVER)
|
|
748
800
|
|
|
749
|
-
|
|
750
|
-
if (CURRENT.drag_action==DRAG_ICONTOOL) {
|
|
801
|
+
|
|
802
|
+
if (CURRENT.drag_action == DRAG_ICONTOOL) {
|
|
751
803
|
const compname = evt.dataTransfer.getData('compname');
|
|
752
804
|
AppGenLayout_addComponentToDesigner(self, droptarget, Components[compname])
|
|
753
805
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
806
|
+
|
|
807
|
+
const curel = droptarget.previousElementSibling
|
|
808
|
+
curel.classList.add('beri-jarak-scroll')
|
|
809
|
+
setTimeout(() => {
|
|
810
|
+
// jika drop untuk sisip element, scroll
|
|
811
|
+
curel.scrollIntoView({
|
|
757
812
|
behavior: 'smooth',
|
|
758
813
|
block: 'start'
|
|
759
814
|
});
|
|
815
|
+
curel.classList.remove('beri-jarak-scroll')
|
|
760
816
|
}, 300)
|
|
761
817
|
|
|
762
|
-
|
|
763
|
-
|
|
818
|
+
// setTimeout(() => {
|
|
819
|
+
// CURRENT.Design.appendChild(droptarget)
|
|
820
|
+
// droptarget.scrollIntoView({
|
|
821
|
+
// behavior: 'smooth',
|
|
822
|
+
// block: 'start'
|
|
823
|
+
// });
|
|
824
|
+
// }, 300)
|
|
825
|
+
|
|
826
|
+
} else if (CURRENT.drag_action == DRAG_REORDERFIELD) {
|
|
827
|
+
const datafield_id = evt.dataTransfer.getData('datafield_id');
|
|
764
828
|
const el = document.getElementById(datafield_id)
|
|
765
829
|
droptarget.after(el)
|
|
766
|
-
setTimeout(()=>{
|
|
830
|
+
setTimeout(() => {
|
|
767
831
|
droptarget.classList.add('hidden')
|
|
768
832
|
}, 300)
|
|
769
|
-
}
|
|
833
|
+
}
|
|
770
834
|
|
|
771
835
|
CURRENT.drag_action = ''
|
|
772
|
-
|
|
836
|
+
|
|
773
837
|
|
|
774
838
|
})
|
|
775
|
-
|
|
839
|
+
|
|
776
840
|
}
|
|
777
841
|
|
|
778
842
|
|
|
@@ -792,24 +856,24 @@ function AppGenLayout_createIconTool(self, comp, tpl) {
|
|
|
792
856
|
const tool = tpl.cloneNode(true)
|
|
793
857
|
const icon = tool.querySelector('div[data-icon')
|
|
794
858
|
const label = tool.querySelector('div[data-label]')
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
icon.innerHTML =comp.icon
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
icon.innerHTML = comp.icon
|
|
798
862
|
label.innerHTML = comp.title
|
|
799
863
|
|
|
800
864
|
|
|
801
|
-
tool.addEventListener('dragstart', (evt)=>{
|
|
865
|
+
tool.addEventListener('dragstart', (evt) => {
|
|
802
866
|
CURRENT.drop_valid = false
|
|
803
867
|
CURRENT.drag_action = DRAG_ICONTOOL
|
|
804
868
|
evt.dataTransfer.setData('compname', comp.name);
|
|
805
869
|
})
|
|
806
870
|
|
|
807
|
-
tool.addEventListener('dragend', (evt)=>{
|
|
808
|
-
if (CURRENT.droptarget==null) {
|
|
871
|
+
tool.addEventListener('dragend', (evt) => {
|
|
872
|
+
if (CURRENT.droptarget == null) {
|
|
809
873
|
return
|
|
810
874
|
}
|
|
811
875
|
const fields = CURRENT.Design.querySelectorAll('[name="design-data-field"]')
|
|
812
|
-
if (fields.length==0) {
|
|
876
|
+
if (fields.length == 0) {
|
|
813
877
|
return
|
|
814
878
|
}
|
|
815
879
|
if (!CURRENT.drop_valid) {
|
|
@@ -817,15 +881,15 @@ function AppGenLayout_createIconTool(self, comp, tpl) {
|
|
|
817
881
|
}
|
|
818
882
|
})
|
|
819
883
|
|
|
820
|
-
tool.addEventListener('dblclick', (evt)=>{
|
|
884
|
+
tool.addEventListener('dblclick', (evt) => {
|
|
821
885
|
// pindah drop target ke bawah
|
|
822
886
|
// droptarget.classList.remove('hidden')
|
|
823
887
|
CURRENT.droptarget.classList.remove('hidden')
|
|
824
888
|
CURRENT.Design.appendChild(CURRENT.droptarget)
|
|
825
889
|
AppGenLayout_addComponentToDesigner(self, CURRENT.droptarget, comp)
|
|
826
|
-
|
|
890
|
+
|
|
827
891
|
// terus sroll ke bawah
|
|
828
|
-
setTimeout(()=>{
|
|
892
|
+
setTimeout(() => {
|
|
829
893
|
CURRENT.droptarget.scrollIntoView({
|
|
830
894
|
behavior: 'smooth',
|
|
831
895
|
block: 'start'
|
|
@@ -853,7 +917,7 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
853
917
|
|
|
854
918
|
// setup datafiled
|
|
855
919
|
const comptype = datafield.querySelector('[name="component-type"]')
|
|
856
|
-
|
|
920
|
+
|
|
857
921
|
const compicon = comptype.querySelector('[name="icon"]')
|
|
858
922
|
const comptitle = comptype.querySelector('[name="title"]')
|
|
859
923
|
comptitle.innerHTML = comp.title
|
|
@@ -867,13 +931,13 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
867
931
|
}
|
|
868
932
|
|
|
869
933
|
compsummary.setAttribute('draggable', true)
|
|
870
|
-
compsummary.addEventListener('dragstart', (evt)=>{
|
|
934
|
+
compsummary.addEventListener('dragstart', (evt) => {
|
|
871
935
|
CURRENT.drop_valid = false
|
|
872
936
|
CURRENT.drag_action = DRAG_REORDERFIELD
|
|
873
937
|
evt.dataTransfer.setData('datafield_id', datafield_id);
|
|
874
938
|
})
|
|
875
|
-
compsummary.addEventListener('dragend', (evt)=>{
|
|
876
|
-
if (CURRENT.droptarget==null) {
|
|
939
|
+
compsummary.addEventListener('dragend', (evt) => {
|
|
940
|
+
if (CURRENT.droptarget == null) {
|
|
877
941
|
return
|
|
878
942
|
}
|
|
879
943
|
if (!CURRENT.drop_valid) {
|
|
@@ -889,32 +953,32 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
889
953
|
|
|
890
954
|
|
|
891
955
|
const obj_namesummary = datafield.querySelector('input[name="fieldname-summary"]')
|
|
892
|
-
obj_namesummary.addEventListener('dblclick', (evt)=>{
|
|
956
|
+
obj_namesummary.addEventListener('dblclick', (evt) => {
|
|
893
957
|
evt.stopPropagation() // mencegar trigger maximize/minimized saat dblclick textbox
|
|
894
958
|
})
|
|
895
959
|
|
|
896
960
|
// kalau data field dilewati DRAG ICON, munculkan droptarget di bawahnya
|
|
897
|
-
datafield.addEventListener('dragover', (evt)=>{
|
|
898
|
-
if (CURRENT.drag_action==DRAG_ICONTOOL || CURRENT.drag_action==DRAG_REORDERFIELD) {
|
|
961
|
+
datafield.addEventListener('dragover', (evt) => {
|
|
962
|
+
if (CURRENT.drag_action == DRAG_ICONTOOL || CURRENT.drag_action == DRAG_REORDERFIELD) {
|
|
899
963
|
evt.preventDefault()
|
|
900
964
|
droptarget.classList.remove('hidden')
|
|
901
965
|
|
|
902
966
|
const rect = datafield.getBoundingClientRect();
|
|
903
|
-
|
|
967
|
+
const offsetY = evt.clientY - rect.top;
|
|
904
968
|
const offsetX = evt.clientX - rect.left;
|
|
905
969
|
|
|
906
970
|
if (offsetX > rect.width - 100) {
|
|
907
971
|
return;
|
|
908
972
|
}
|
|
909
|
-
|
|
973
|
+
|
|
910
974
|
|
|
911
975
|
if (offsetY < rect.height / 2) {
|
|
912
|
-
setTimeout(()=>{
|
|
976
|
+
setTimeout(() => {
|
|
913
977
|
datafield.before(droptarget)
|
|
914
978
|
}, 300)
|
|
915
|
-
|
|
979
|
+
|
|
916
980
|
} else {
|
|
917
|
-
setTimeout(()=>{
|
|
981
|
+
setTimeout(() => {
|
|
918
982
|
datafield.after(droptarget)
|
|
919
983
|
}, 300)
|
|
920
984
|
}
|
|
@@ -926,12 +990,12 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
926
990
|
const btncs = datafield.querySelectorAll(`[class="field-remove-button"]`)
|
|
927
991
|
for (const btn of btncs) {
|
|
928
992
|
btn.innerHTML = ICON_CLOSE
|
|
929
|
-
btn.addEventListener('click', async (evt)=>{
|
|
993
|
+
btn.addEventListener('click', async (evt) => {
|
|
930
994
|
var res = await $fgta5.MessageBox.confirm('removing field is irreversible. Are you sure ?')
|
|
931
|
-
if (res=='ok') {
|
|
995
|
+
if (res == 'ok') {
|
|
932
996
|
// hapus
|
|
933
997
|
datafield.style.animation = 'fieldDihapus 0.3s forwards'
|
|
934
|
-
setTimeout(()=>{
|
|
998
|
+
setTimeout(() => {
|
|
935
999
|
datafield.remove()
|
|
936
1000
|
}, 300)
|
|
937
1001
|
}
|
|
@@ -941,9 +1005,9 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
941
1005
|
|
|
942
1006
|
const bars = datafield.querySelectorAll("div[field-handle-bar]")
|
|
943
1007
|
for (let bar of bars) {
|
|
944
|
-
bar.addEventListener('dblclick', (evt)=>{
|
|
1008
|
+
bar.addEventListener('dblclick', (evt) => {
|
|
945
1009
|
const varname = bar.getAttribute('name')
|
|
946
|
-
if (varname=='component-summary') {
|
|
1010
|
+
if (varname == 'component-summary') {
|
|
947
1011
|
datafield.classList.add('maximized')
|
|
948
1012
|
datafield.classList.remove('minimized')
|
|
949
1013
|
} else {
|
|
@@ -953,11 +1017,11 @@ function AppGenLayout_addComponentToDesigner(self, droptarget, comp) {
|
|
|
953
1017
|
})
|
|
954
1018
|
}
|
|
955
1019
|
|
|
956
|
-
AppGenGenLayout_HandleDataField(self, entity_id, comp, datafield)
|
|
1020
|
+
AppGenGenLayout_HandleDataField(self, entity_id, comp, datafield)
|
|
957
1021
|
|
|
958
1022
|
|
|
959
1023
|
return datafield
|
|
960
|
-
}
|
|
1024
|
+
}
|
|
961
1025
|
|
|
962
1026
|
|
|
963
1027
|
function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity) {
|
|
@@ -975,10 +1039,10 @@ function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity)
|
|
|
975
1039
|
for (var icoalpk of alliconspk) {
|
|
976
1040
|
icoalpk.innerHTML = ''
|
|
977
1041
|
}
|
|
978
|
-
|
|
1042
|
+
|
|
979
1043
|
const field = df.querySelector(`input[name="fieldname"][${ATTR_ENTITYID}="${entity_id}"]`)
|
|
980
1044
|
const current_fieldname_value = field.value
|
|
981
|
-
if (current_fieldname_value==primary_key) {
|
|
1045
|
+
if (current_fieldname_value == primary_key) {
|
|
982
1046
|
const iconspk = df.querySelectorAll(`[name="icon-pk"][${ATTR_ENTITYID}="${entity_id}"]`)
|
|
983
1047
|
for (var ico of iconspk) {
|
|
984
1048
|
ico.innerHTML = ICON_PK
|
|
@@ -989,10 +1053,10 @@ function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity)
|
|
|
989
1053
|
|
|
990
1054
|
// untuk primary key detail tipe data otomatis di set ke bigInt
|
|
991
1055
|
// ambil enentity header untuk pengecekan tipe data
|
|
992
|
-
if (current_fieldname_value==primary_key) {
|
|
1056
|
+
if (current_fieldname_value == primary_key) {
|
|
993
1057
|
const entityHeader = ME.DataEntities.querySelector('tr[data-isheader')
|
|
994
1058
|
const headerEntityId = entityHeader.getAttribute(ATTR_ENTITYID)
|
|
995
|
-
if (entity_id!=headerEntityId) {
|
|
1059
|
+
if (entity_id != headerEntityId) {
|
|
996
1060
|
// set tipedata untuk PK di detil menjadi bigint
|
|
997
1061
|
console.log('SET tO BIG INT')
|
|
998
1062
|
datatypeEl.value = 'bigint'
|
|
@@ -1005,7 +1069,7 @@ function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity)
|
|
|
1005
1069
|
|
|
1006
1070
|
|
|
1007
1071
|
let primary_key
|
|
1008
|
-
if (fromentity===true) {
|
|
1072
|
+
if (fromentity === true) {
|
|
1009
1073
|
// diedit dari tabel entity
|
|
1010
1074
|
primary_key = obj.value
|
|
1011
1075
|
|
|
@@ -1017,7 +1081,7 @@ function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity)
|
|
|
1017
1081
|
}
|
|
1018
1082
|
} else {
|
|
1019
1083
|
// diedit dari designer
|
|
1020
|
-
|
|
1084
|
+
primary_key = elpk.value
|
|
1021
1085
|
const df = obj.closest('[name="design-data-field"]') //cari [name="design-data-field"] terdekat
|
|
1022
1086
|
setPk(df, primary_key)
|
|
1023
1087
|
}
|
|
@@ -1032,7 +1096,7 @@ function AppGenLayout_designerFieldNameChanged(self, entity_id, obj, fromentity)
|
|
|
1032
1096
|
|
|
1033
1097
|
function AppGenLayout_handleActionForm(self) {
|
|
1034
1098
|
const btn_action_add = document.getElementById('btn_action_add')
|
|
1035
|
-
btn_action_add.addEventListener('click', (evt)=>{
|
|
1099
|
+
btn_action_add.addEventListener('click', (evt) => {
|
|
1036
1100
|
const txt_action_name = document.getElementById('txt_action_name')
|
|
1037
1101
|
const txt_action_title = document.getElementById('txt_action_title')
|
|
1038
1102
|
const txt_action_permission = document.getElementById('txt_action_permission')
|
|
@@ -1046,7 +1110,7 @@ function AppGenLayout_handleActionForm(self) {
|
|
|
1046
1110
|
}
|
|
1047
1111
|
|
|
1048
1112
|
async function AppGenLayout_addAction(self, data) {
|
|
1049
|
-
const tbody = document.getElementById('action-lists')
|
|
1113
|
+
const tbody = document.getElementById('action-lists')
|
|
1050
1114
|
const name = data.name
|
|
1051
1115
|
const title = data.title
|
|
1052
1116
|
const permission = data.permission ?? ''
|
|
@@ -1056,7 +1120,7 @@ async function AppGenLayout_addAction(self, data) {
|
|
|
1056
1120
|
return
|
|
1057
1121
|
}
|
|
1058
1122
|
|
|
1059
|
-
if (title.trim()=='') {
|
|
1123
|
+
if (title.trim() == '') {
|
|
1060
1124
|
await $fgta5.MessageBox.warning('title tidak valid')
|
|
1061
1125
|
return
|
|
1062
1126
|
}
|
|
@@ -1068,7 +1132,7 @@ async function AppGenLayout_addAction(self, data) {
|
|
|
1068
1132
|
const tdPermission = document.createElement('td')
|
|
1069
1133
|
const tdButton = document.createElement('td')
|
|
1070
1134
|
const rmButton = document.createElement('div')
|
|
1071
|
-
|
|
1135
|
+
|
|
1072
1136
|
|
|
1073
1137
|
tdName.innerHTML = `<div name="action-name" class="action-cell">${name}</div>`
|
|
1074
1138
|
tdTitle.innerHTML = `<div name="action-title" class="action-cell">${title}</div>`
|
|
@@ -1076,13 +1140,13 @@ async function AppGenLayout_addAction(self, data) {
|
|
|
1076
1140
|
|
|
1077
1141
|
rmButton.innerHTML = ICON_CLOSE
|
|
1078
1142
|
rmButton.classList.add("action-button-remove")
|
|
1079
|
-
rmButton.addEventListener('click', async (evt)=>{
|
|
1143
|
+
rmButton.addEventListener('click', async (evt) => {
|
|
1080
1144
|
var res = await $fgta5.MessageBox.confirm('Are you sure removing this action ?')
|
|
1081
|
-
if (res=='ok') {
|
|
1145
|
+
if (res == 'ok') {
|
|
1082
1146
|
tr.remove()
|
|
1083
1147
|
}
|
|
1084
1148
|
})
|
|
1085
|
-
|
|
1149
|
+
|
|
1086
1150
|
tdButton.appendChild(rmButton)
|
|
1087
1151
|
|
|
1088
1152
|
|
|
@@ -1100,25 +1164,28 @@ async function AppGenLayout_addAction(self, data) {
|
|
|
1100
1164
|
function AppGenGenLayout_HandleDataField(self, entity_id, comp, datafield) {
|
|
1101
1165
|
const fieldname = datafield.querySelector('input[name="fieldname"]')
|
|
1102
1166
|
const namesummary = datafield.querySelector('input[name="fieldname-summary"]')
|
|
1103
|
-
const objectname
|
|
1167
|
+
const objectname = datafield.querySelector('input[name="objectname"]')
|
|
1104
1168
|
const labeltext = datafield.querySelector('input[name="labeltext"]')
|
|
1105
1169
|
const placeholder = datafield.querySelector('input[name="placeholder"]')
|
|
1106
|
-
|
|
1107
1170
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1110
1174
|
const nameChanged = (value) => {
|
|
1111
|
-
if (objectname.value.trim()=='') {
|
|
1175
|
+
if (objectname.value.trim() == '') {
|
|
1112
1176
|
objectname.value = 'obj_' + fieldname.value
|
|
1113
1177
|
}
|
|
1114
1178
|
|
|
1115
|
-
if (labeltext.value.trim()=='') {
|
|
1179
|
+
if (labeltext.value.trim() == '') {
|
|
1116
1180
|
labeltext.value = capitalizeFirst(fieldname.value)
|
|
1117
1181
|
}
|
|
1118
1182
|
|
|
1119
|
-
if (placeholder
|
|
1120
|
-
placeholder.value
|
|
1183
|
+
if (placeholder != null) {
|
|
1184
|
+
if (placeholder.value.trim() == '') {
|
|
1185
|
+
placeholder.value = fieldname.value
|
|
1186
|
+
}
|
|
1121
1187
|
}
|
|
1188
|
+
|
|
1122
1189
|
}
|
|
1123
1190
|
|
|
1124
1191
|
const nameKeydown = (evt) => {
|
|
@@ -1139,40 +1206,40 @@ function AppGenGenLayout_HandleDataField(self, entity_id, comp, datafield) {
|
|
|
1139
1206
|
evt.preventDefault(); // blokir karakter lain
|
|
1140
1207
|
}
|
|
1141
1208
|
}
|
|
1142
|
-
|
|
1209
|
+
|
|
1143
1210
|
|
|
1144
1211
|
fieldname.setAttribute(ATTR_ENTITYID, entity_id)
|
|
1145
|
-
fieldname.addEventListener('change', (evt)=>{
|
|
1146
|
-
namesummary.value = fieldname.value
|
|
1212
|
+
fieldname.addEventListener('change', (evt) => {
|
|
1213
|
+
namesummary.value = fieldname.value
|
|
1147
1214
|
const entity_id = fieldname.getAttribute(ATTR_ENTITYID)
|
|
1148
1215
|
AppGenLayout_designerFieldNameChanged(self, entity_id, fieldname)
|
|
1149
1216
|
nameChanged(fieldname.value)
|
|
1150
1217
|
})
|
|
1151
1218
|
|
|
1152
|
-
|
|
1219
|
+
|
|
1153
1220
|
namesummary.setAttribute(ATTR_ENTITYID, entity_id)
|
|
1154
|
-
namesummary.addEventListener('change', (evt)=>{
|
|
1155
|
-
fieldname.value = namesummary.value
|
|
1221
|
+
namesummary.addEventListener('change', (evt) => {
|
|
1222
|
+
fieldname.value = namesummary.value
|
|
1156
1223
|
const entity_id = namesummary.getAttribute(ATTR_ENTITYID)
|
|
1157
1224
|
AppGenLayout_designerFieldNameChanged(self, entity_id, namesummary)
|
|
1158
1225
|
nameChanged(namesummary.value)
|
|
1159
1226
|
})
|
|
1160
1227
|
|
|
1161
1228
|
|
|
1162
|
-
fieldname.addEventListener('keydown', (evt)=>{
|
|
1229
|
+
fieldname.addEventListener('keydown', (evt) => {
|
|
1163
1230
|
nameKeydown(evt)
|
|
1164
|
-
});
|
|
1231
|
+
});
|
|
1165
1232
|
|
|
1166
|
-
namesummary.addEventListener('keydown', (evt)=>{
|
|
1233
|
+
namesummary.addEventListener('keydown', (evt) => {
|
|
1167
1234
|
nameKeydown(evt)
|
|
1168
1235
|
});
|
|
1169
1236
|
|
|
1170
1237
|
|
|
1171
|
-
if (comp.name=='Textbox') {
|
|
1238
|
+
if (comp.name == 'Textbox') {
|
|
1172
1239
|
const datalength = datafield.querySelector('input[name="datalength"]')
|
|
1173
1240
|
const maximum = datafield.querySelector('input[name="maximum"]')
|
|
1174
1241
|
maximum.value = datalength.value
|
|
1175
|
-
datalength.addEventListener('change', (evt)=>{
|
|
1242
|
+
datalength.addEventListener('change', (evt) => {
|
|
1176
1243
|
maximum.value = datalength.value
|
|
1177
1244
|
})
|
|
1178
1245
|
|