1.xit-web-res 추가

2.js파일 경로 변경
main
이범준 5 months ago
parent 1cb5668994
commit 60fd93e12c

@ -69,7 +69,7 @@
<dependency> <dependency>
<groupId>cokr.xit.base</groupId> <groupId>cokr.xit.base</groupId>
<artifactId>xit-web-ui</artifactId> <artifactId>xit-web-res</artifactId>
<version>23.04.01-SNAPSHOT</version> <version>23.04.01-SNAPSHOT</version>
</dependency> </dependency>

@ -221,7 +221,7 @@
<!-- base --> <!-- base -->
<script src="/resources/js/base/base.js"></script> <script src="/resources/js/base/base.js"></script>
<script src="/resources/js/base/dataset.js"></script> <script src="/webjars/js/base/dataset.js"></script>
<script src="/resources/js/base/user.js"></script> <script src="/resources/js/base/user.js"></script>
<script src="/resources/js/base/base-fims.js"></script> <script src="/resources/js/base/base-fims.js"></script>

@ -19,15 +19,15 @@
<script src="<c:url value="/resources/sneat/libs/bootstrap-datepicker/bootstrap-datepicker.js?${ver}"/>"></script> <script src="<c:url value="/resources/sneat/libs/bootstrap-datepicker/bootstrap-datepicker.js?${ver}"/>"></script>
<!-- base --> <!-- base -->
<script src="<c:url value="/resources/js/base/base.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/base.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/dataset.js?${ver}"/>"></script> <script src="<c:url value="/webjars/js/base/dataset.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/upload-support.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/upload-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/code.js?${ver}"/>"></script> <script src="<c:url value="/webjars/js/base/code.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/code-support.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/code-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/menu.js?${ver}"/>"></script> <script src="<c:url value="/webjars/js/base/menu.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/menu-support.js?${ver}"/>"></script> <script src="<c:url value="/webjars/js/base/menu-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/actionGroup.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/actionGroup.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/user.js?${ver}"/>"></script> <script src="<c:url value="/resources/js/base/user.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/base/authority.js?${ver}"/>"></script> <script src="<c:url value="/webjars/js/base/authority.js?${ver}"/>"></script>
<!-- 전체화면 비활성화 --> <!-- 전체화면 비활성화 -->

@ -40,7 +40,7 @@
<!-- base --> <!-- base -->
<script src="/resources/js/base/base.js"></script> <script src="/resources/js/base/base.js"></script>
<script src="/resources/js/base/dataset.js"></script> <script src="/webjars/js/base/dataset.js"></script>
<script src="/resources/js/base/base-fims.js"></script> <script src="/resources/js/base/base-fims.js"></script>
<script src="/resources/js/fims/pdfobject.js"></script> <script src="/resources/js/fims/pdfobject.js"></script>

@ -1,188 +0,0 @@
class AuthorityControl {
constructor() {
this.authorities = new DatasetControl({
prefix:"authority",
prefixName:"권한",
keymapper:info => info.AUTH_ID,
dataGetter:obj => obj.authorityList,
formats: {
REG_DT:datetimeFormat
}
});
this.authorities.isBuiltIn = (info) => {
let current = info || this.authorities.getCurrent();
return current && current.AUTH_TYPE < 2;
};
this.authorities.isImplicit = (info) => {
let current = info || this.authorities.getCurrent();
return current && current.AUTH_TYPE === 1;
};
this.authorities.isAdmin = (info) => {
let current = info || this.authorities.getCurrent();
return current && current.AUTH_TYPE === 0;
};
this.users = new DatasetControl({
prefix:"user",
prefixName:"사용자",
keymapper:info => info.AUTH_ID + "-" + info.USER_ID,
dataGetter:obj => obj.userList,
formats: {
REG_DT:datetimeFormat
},
urls:{
load:wctx.url("/authority/user/list.do")
}
});
this.actions = new DatasetControl({
prefix:"action",
prefixName:"기능 그룹",
keymapper:info => info.AUTH_ID + "-" + info.GRP_ID,
dataGetter:obj => obj.actionList,
formats: {
REG_DT:datetimeFormat
},
urls:{
load:wctx.url("/authority/action/list.do")
}
});
this.linkedList = "users";
this.authorities.onDatasetChange = obj => this.onAuthorityListChange(obj);
this.authorities.onCurrentChange = item => {
this.onCurrentAuthorityChange(item);
let info = item ? item.data : null;
this.getLinkedList(this.linkedList, info);
};
this.authorities.onSelectionChange = selected => this.onAuthoritySelect(selected);
this.users.onDatasetChange = obj => this.onUserListChange(obj);
this.users.onCurrentChange = item => this.onCurrentUserChange(item);
this.users.onSelectionChange = selected => this.onUserSelect(selected);
this.actions.onDatasetChange = obj => this.onActionListChange(obj);
this.actions.onCurrentChange = item => this.onCurrentActionChange(item);
this.actions.onSelectionChange = selected => this.onActionSelect(selected);
}
getLinkedList(linked, info) {
if (!info)
info = this.authorities.getCurrent();
switch (this.linkedList = linked) {
case "users":
if (info && !this.authorities.isImplicit(info)) {
if (this.users.query.authIDs == info.AUTH_ID) return;
this.users.query.authIDs = info.AUTH_ID;
this.users.load();
} else {
this.users.query.authIDs = info.AUTH_ID;
this.users.dataset.clear();
}
break;
case "actions":
if (info && !this.authorities.isAdmin(info)) {
if (this.actions.query.authIDs == info.AUTH_ID) return;
this.actions.query.authIDs = info.AUTH_ID;
this.actions.load();
} else {
this.actions.query.authIDs = info.AUTH_ID;
this.actions.dataset.clear();
}
break;
default: break;
}
}
onAuthorityListChange(obj) {}
onCurrentAuthorityChange(item) {}
onAuthoritySelect(selected) {}
removeAuthorities() {
let authIDs = this.authorities.dataset.getKeys("selected");
this.authorities.remove({authIDs:authIDs.join(",")});
}
onUserListChange(obj) {}
onCurrentUserChange(item) {}
onUserSelect(selected) {}
onActionListChange(obj) {}
onCurrentActionChange(item) {}
onActionSelect(selected) {}
async addUsers() {
let userIDs = await new UserControl().selectUser(true);
let authID = this.authorities.dataset.getCurrent().AUTH_ID;
json.post({
url:wctx.url("/authority/user/add.do"),
data:{
authID:authID,
userIDs:userIDs.join(",")
},
success:resp => {
if (resp.saved)
this.users._load();
}
});
}
removeUsers() {
let selected = this.users.dataset.getDataset("selected").map(info => info.USER_ID);
let authID = this.authorities.dataset.getCurrent().AUTH_ID;
json.post({
url:wctx.url("/authority/user/remove.do"),
data:{
authID:authID,
userIDs:selected.join(",")
},
success:resp => {
if (resp.saved)
this.users._load();
}
});
}
async addActions() {
let actions = await new ActionGroupControl(false).selectActionGroup(true);
let authID = this.authorities.dataset.getCurrent().AUTH_ID;
json.post({
url:wctx.url("/authority/action/add.do"),
data:{
authID:authID,
groupIDs:actions.join(",")
},
success:resp => {
if (resp.saved)
this.actions._load();
}
});
}
removeActions() {
let selected = this.actions.dataset.getDataset("selected").map(info => info.GRP_ID);
let authID = this.authorities.dataset.getCurrent().AUTH_ID;
json.post({
url:wctx.url("/authority/action/remove.do"),
data:{
authID:authID,
groupIDs:selected.join(",")
},
success:resp => {
if (resp.saved)
this.actions._load();
}
});
}
}

@ -1,79 +0,0 @@
class CodeControl {
constructor() {
this.groups = new DatasetControl({
prefix:"group",
prefixName:"코드그룹",
keymapper:info => info.GRP_ID,
dataGetter:obj => obj.groupList,
formats: {
REG_DT:datetimeFormat
},
urls:{
load:wctx.url("/code/group/list.do"),
getInfo:wctx.url("/code/group/info.do"),
create:wctx.url("/code/group/create.do"),
update:wctx.url("/code/group/update.do"),
remove:wctx.url("/code/group/remove.do")
}
});
this.codes = new DatasetControl({
prefix:"code",
prefixName:"코드",
keymapper:info => info.CODE,
dataGetter:obj => obj.codeList,
formats: {
REG_DT:datetimeFormat
}
});
this.codes.remove = (params) => {
let selected = this.codes.dataset.getKeys("selected");
if (selected.length < 1) return;
if (!params) {
params = {};
}
params.groupID = this.groups.dataset.getCurrent()["GRP_ID"];
params.codes = selected.join(",");
ajax.post({
url:this.codes.urls.remove,
data:params,
success:resp => this.codes.onRemove(selected, resp)
});
};
this.groups.onDatasetChange = obj => this.onGroupListChange(obj);
this.groups.onCurrentChange = item => {
this.onCurrentGroupChange(item);
let info = item ? item.data : null;
if (info) {
this.codes.query.groupIDs = info.GRP_ID;
this.codes.load();
} else
this.codes.dataset.clear();
};
this.groups.onSelectionChange = selected => this.onGroupSelect(selected);
this.codes.onDatasetChange = obj => this.onCodeListChange(obj);
this.codes.onCurrentChange = item => this.onCurrentCodeChange(item);
this.codes.onSelectionChange = selected => this.onCodeSelect(selected);
}
onGroupListChange(obj) {}
onCurrentGroupChange(item) {}
onGroupSelect(selected) {}
newCode() {
this.codes.newInfo({GRP_ID:this.groups.getCurrent().GRP_ID})
}
onCodeListChange(obj) {}
onCurrentCodeChange(item) {}
onCodeSelect(selected) {}
}

File diff suppressed because it is too large Load Diff

@ -1,292 +0,0 @@
/** .
*/
class MenuSupport {
/** MenuSupport .
* @param selector {string} 메뉴를 담을 컨테이너에 대한 css selector
*/
constructor(conf) {
conf = conf || {};
this._selector = ifEmpty(conf.selector, "#menus");
this._containerSelector = ifEmpty(conf.containerSelector, "#layout-menu");
this._container = document.querySelector(this._containerSelector);
let onclick = conf.onclick || (menu => 'onclick="openMenu(\'{url}\')" '.replace(/{url}/gi, wctx.url(menu.url)));
this._onclick = (menu => menu && menu.url ? onclick(menu) : "");
this._horizontal = this._container && this._container.classList.contains('menu-horizontal');
this._orientation = this._horizontal ? "horizontal" : "vertical";
this._template = this._orientation + "-menu-template";
this._menuItem = '<li data-key="{menuID}" class="menu-item" title="{title}"><a {onclick}class="menu-link{toggle}"><i class="menu-icon tf-icons {imageConf}"></i><div data-i18n="{menuName}">{menuName}</div></a>{menuSub}</li>';
this._menuSub = '<ul class="menu-sub">{children}</ul>';
this._menus = [];
this._init();
}
/** .
* @param menus {array} 메뉴 정보 배열<br />
* 메뉴 정보의 레이아웃은 다음과 같다.<br />
* {"id":메뉴 아이디, "name":"메뉴 이름", "url":"실행 url", "parentID":"상위 메뉴 아이디", "description":"메뉴 설명", "imageConf":"이미지 설정", "displayWindow":"표시 창", "children":[하위 메뉴 배열]}
* @returns MenuSupport
*/
setMenuInfo(menus) {
let setParent = menu => {
let children = menu.children || [];
if (children.length < 1) return;
children.forEach(child => {
child.parent = menu;
setParent(child);
});
};
menus.forEach(menu => setParent(menu));
this._menus = menus;
let menuItemTag = menu => {
let tag = this._menuItem
.replace(/{menuID}/gi, menu.id)
.replace(/{menuName}/gi, menu.name)
.replace(/{onclick}/gi, this._onclick(menu))
.replace(/{title}/gi, (menu.description || ""))
.replace(/{imageConf}/gi, (menu.imageConf || "bx bx-layout"));
let parent = menu.children && menu.children.length > 0;
tag = tag.replace(/{toggle}/gi, !parent ? "" : " menu-toggle");
if (!parent)
return tag.replace(/{menuSub}/gi, "");
let children = menu.children.map(child => menuItemTag(child)).join("\n\t")
return tag.replace(/{menuSub}/gi, this._menuSub.replace(/{children}/gi, children));
}
let tags = (menus || []).map(menu => menuItemTag(menu));
document.querySelector(this._selector).innerHTML = tags.join("");
return this._init();
}
_toggleMenuAwares(collapse) {
document.querySelectorAll(".menu-aware").forEach(menuAware => menuAware.style.width = collapse ? "calc(100% - 5.25rem)" : "");
}
_init() {
let menu = new Menu(this._container, {
orientation: this._orientation,
closeChildren: this._horizontal,
showDropdownOnHover: localStorage.getItem('templateCustomizer-' + this._template + '--ShowDropdownOnHover')
? localStorage.getItem('templateCustomizer-' + this._template + '--ShowDropdownOnHover') === 'true'
: window.templateCustomizer !== undefined
? window.templateCustomizer.settings.defaultShowDropdownOnHover
: true
});
window.Helpers.scrollToActive(false); //animate = false
window.Helpers.mainMenu = menu;
//Sets toggler
document.querySelectorAll('.layout-menu-toggle').forEach(item => {
item.addEventListener('click', event => {
if (event.fired) {
return delete event.fired;
}
event.fired = true;
event.preventDefault();
window.Helpers.toggleCollapsed();
if (config.enableMenuLocalStorage && !window.Helpers.isSmallScreen()) {
try {
localStorage.setItem(
'templateCustomizer-' + this._template + '--LayoutCollapsed',
String(window.Helpers.isCollapsed())
);
} catch (e) {}
}
this._toggleMenuAwares(Helpers.isCollapsed());
});
});
// Display menu toggle (layout-menu-toggle) on hover with delay
let delay = (elem, callback) => {
let timeout = null;
elem.onmouseenter = () => {
// Set timeout to be a timer which will invoke callback after 300ms (not for small screen)
timeout = !Helpers.isSmallScreen() ? setTimeout(callback, 300) : setTimeout(callback, 0);
};
elem.onmouseleave = () => {
// Clear any timers set to timeout
document.querySelector('.layout-menu-toggle').classList.remove('d-block');
clearTimeout(timeout);
};
};
if (this._container) {
delay(this._container, () => {
// not for small screen
if (!Helpers.isSmallScreen()) {
document.querySelector('.layout-menu-toggle').classList.add('d-block');
}
});
}
// Detect swipe gesture on the target element and call swipe In
window.Helpers.swipeIn('.drag-target', function (e) {
window.Helpers.setCollapsed(false);
});
// Detect swipe gesture on the target element and call swipe Out
window.Helpers.swipeOut(this._containerSelector, function (e) {
if (window.Helpers.isSmallScreen()) window.Helpers.setCollapsed(true);
});
// Display in main menu when menu scrolls
let menuInnerContainer = document.getElementsByClassName('menu-inner'),
menuInnerShadow = document.getElementsByClassName('menu-inner-shadow')[0];
if (menuInnerContainer.length > 0 && menuInnerShadow) {
menuInnerContainer[0].addEventListener('ps-scroll-y', function () {
if (this.querySelector('.ps__thumb-y').offsetTop) {
menuInnerShadow.style.display = 'block';
} else {
menuInnerShadow.style.display = 'none';
}
});
}
return this;
}
open(url) {
top.document.location.href = url;
}
/** url .
* @param url {string} 메뉴 url
* @returns MenuSupport
*/
setActive(url) {
let menu = this.getMenu(url);
if (!menu) return this;
document
.querySelectorAll(this._selector + " li")
.forEach(li => li.classList.remove("active", "open"));
let a = document.querySelector(this._selector + " li[data-key=\"" + menu.id + "\"]");
if (!a) return this;
let activate = (e, open) => {
e.classList.add("active");
let p = e.parentNode;
let tag = (p != this._container ? p : null) ? p.tagName : "";
if (!tag) return;
if ("li" == tag.toLowerCase()) {
p.classList.add("active");
if (open)
p.classList.add("open");
}
activate(p, true);
};
activate(a);
return this;
}
/** url .
* @param url {string} 메뉴 url
* @returns 지정하는 url의 메뉴 정보
*/
getMenu(url) {
let find = menus => {
for (let i = 0; i < menus.length; ++i) {
let menu = menus[i];
if (url == menu.url)
return menu;
let found = find(menu.children || []);
if (found)
return found;
}
return null;
};
return find(this._menus);
}
breadcrumb(url, separator = " / ") {
let menu = this.getMenu(url);
if (!menu)
return "";
let getName = menu => {
let name = menu.name;
let parent = !menu.parent ? "" : getName(menu.parent);
return parent ? parent + separator + name : name;
}
return getName(menu);
}
}
class TabControl extends Dataset {
constructor(conf) {
if (!conf)
conf = {};
conf.keymapper = info => {
if (!info.index) {
info.index = "ndx-" + new Date().getTime();
}
return info.index;
};
conf.dataGetter = obj => null;
super(conf);
this.sticky = conf.sticky || {};
this.maxCount = conf.maxCount || 8;
this.getMenu = conf.getMenu || ((url) => {throw "getMenu(url) missing"});
}
getTab(by) {
if (by.startsWith("ndx-"))
return this.getData(by, "item");
if (by != this.sticky.url) {
let found = this._items.filter(item => item.data.url == by),
empty = !found || found.length < 1;
if (empty)
return null;
found = found[0];
return !found.unreachable ? found : null;
} else {
let found = this._items.filter(item => item.data.url == this.sticky.url);
if (!found || found.length < 1) {
this.addData([this.sticky]);
}
}
}
open(url) {
if (!url
|| url.startsWith("javascript:void")
|| url == this.sticky.url)
return;
let tab = this.getTab(url);
if (tab)
return this.setCurrent(tab.data.index);
ajax.get({
url: wctx.url(url),
success: resp => {
let menu = this.getMenu(url);
if (!menu)
throw "Menu not found for " + url;
if (this.length == this.maxCount) {
let index = isEmpty(this.sticky) ? 0 : 1,
first = this._items[index];
this.close(first.data.url)
}
menu.content = resp;
this.addData([menu]);
this.open(url);
}
});
}
close(url) {
let tab = this.getTab(url);
this.erase(tab.data.index);
}
}

@ -1,77 +0,0 @@
class MenuControl extends DatasetControl {
constructor() {
super({
keymapper: info => info ? info.id : "",
prefix:"menu",
prefixName:"메뉴"
});
this.urls.load = this.url("/tree.do");
delete this.urls.getInfo;
this.menus = [];
}
setData(obj) {
let list = [];
let asList = array => {
if (!array || array.length < 1) return;
for (var i = 0; i < array.length; ++i) {
let menu = array[i];
list.push(menu);
asList(menu.children);
}
};
asList(this.menus = Array.isArray(obj) ? obj : obj.menus);
super.setData(list);
}
move(parentID, menuID) {
json.post({
url:wctx.url("/menu/move.do"),
data:{
parentID:parentID,
menuIDs:menuID
},
success:resp => {
this._load();
this.onMenusChanged();
}
});
}
reorder(menuIDs) {
json.post({
url:wctx.url("/menu/reorder.do"),
data:{
menuIDs:Array.isArray(menuIDs) ? menuIDs.join(",") : menuIDs
},
success:resp => {
this._load();
this.onMenusChanged();
}
});
}
onSave(resp) {
super.onSave(resp);
this.onMenusChanged();
}
onRemove(selected, resp) {
super.onRemove(selected, resp);
this.onMenusChanged();
}
onMenusChanged() {}
async getUserMenus() {
return new Promise((resolve, reject) => {
json.get({
url:this.url("/userMenus.do"),
data:{},
success:resp => resolve(resp.userMenus)
});
});
}
}
Loading…
Cancel
Save