-
Notifications
You must be signed in to change notification settings - Fork 0
/
managment.ts
91 lines (55 loc) · 2.25 KB
/
managment.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import input from './exemples/ruculaManagment.json'
import { Rucula } from "./src/Rucula"
import { ruculaGlobal, } from "./src/global/GlobalConfig"
import "./public/style.css"
import "./public/normalize.css"
(()=> {
let ruculaWindow = {}
let abaView:any = null
const RUCULA_ELEMENT = "js"
if(window.location.search != ''){
let newWindow = window.decodeURIComponent(window.location.search.replace('?window=',''))
ruculaWindow = JSON.parse(newWindow)
}
if(window.location.search == ''){
ruculaWindow = input
}
let rucula = new Rucula(ruculaGlobal as any, ruculaWindow as any,RUCULA_ELEMENT);
if(window.location.search == ''){
let jss = document.getElementById("form-rucula-js");
jss?.addEventListener('input',() => {
visualizeWindow()
})
jss?.addEventListener('change',() => {
visualizeWindow()
})
function visualizeWindow(){
let obj = createJSON()
let path = `?window=${JSON.stringify(obj)}`;
if(abaView == null){
abaView = window.open(path)
}
if(abaView != null){
abaView.location.href = path;
}
function createJSON(){
let object = rucula.object.getSepareteObject();
let window = object.aliasWindow
window.frames = object.aliasFrame
window.frames.forEach((frame:any) => {
frame.fields = object.aliasField.filter((field:any) => field.frame == frame.alias)
});
let _items:any = []
object.aliasLayout.forEach((item:any) => {
let opt = [item.coluna1,item.coluna2,item.coluna3]
_items.push(opt as any)
})
window.layout = {
items: _items
}
window.button = object.aliasButton
return window
}
}
}
})()