Merge branch 'susu' into dev
This commit is contained in:
@@ -118,7 +118,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -167,12 +166,12 @@
|
|||||||
|
|
||||||
function renderNode(node, parentUl, depth) {
|
function renderNode(node, parentUl, depth) {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
// 1depth와 2depth는 기본적으로 확장, 3depth는 축소
|
// 1depth와 2depth는 기본적으로 확장, 3depth 이상은 접힘
|
||||||
li.className = depth <= 1 ? '' : 'folding';
|
li.className = depth <= 1 ? '' : 'folding';
|
||||||
|
|
||||||
const button = document.createElement('button');
|
const button = document.createElement('button');
|
||||||
button.type = 'button';
|
button.type = 'button';
|
||||||
button.className = 'tit';
|
button.className = (!node.nodes || node.nodes.length === 0) ? '' : 'tit' + (depth === 1 ? ' onedepth' : depth === 2 ? ' twodepth' : '');
|
||||||
button.setAttribute('data-id', node.id || '');
|
button.setAttribute('data-id', node.id || '');
|
||||||
button.setAttribute('data-parent-id', node.parentId || '');
|
button.setAttribute('data-parent-id', node.parentId || '');
|
||||||
button.setAttribute('data-order-no', node.orderNo || '0');
|
button.setAttribute('data-order-no', node.orderNo || '0');
|
||||||
@@ -181,19 +180,15 @@
|
|||||||
textSpan.textContent = node.text || node.codeText;
|
textSpan.textContent = node.text || node.codeText;
|
||||||
button.appendChild(textSpan);
|
button.appendChild(textSpan);
|
||||||
|
|
||||||
button.onclick = function (e) {
|
button.onclick = function () {
|
||||||
// 하위 노드가 있고, depth가 2 이하인 경우 토글 동작
|
|
||||||
if (node.nodes && node.nodes.length > 0 && depth <= 2) {
|
|
||||||
toggleNode(this);
|
|
||||||
}
|
|
||||||
// 항상 노드 선택 동작 수행
|
|
||||||
selectNode(this);
|
selectNode(this);
|
||||||
};
|
};
|
||||||
li.appendChild(button);
|
li.appendChild(button);
|
||||||
|
|
||||||
if (node.nodes && node.nodes.length > 0) {
|
if (node.nodes && node.nodes.length > 0) {
|
||||||
const childUl = document.createElement('ul');
|
const childUl = document.createElement('ul');
|
||||||
childUl.className = depth === 1 ? 'list-detail' : 'list-detail';
|
// 중간 노드(depth >= 2)는 list-depth, 리프 노드의 하위는 list-detail
|
||||||
|
childUl.className = node.nodes.some(child => child.nodes && child.nodes.length > 0) ? 'list-depth' : 'list-detail';
|
||||||
li.appendChild(childUl);
|
li.appendChild(childUl);
|
||||||
node.nodes.forEach(child => renderNode(child, childUl, depth + 1));
|
node.nodes.forEach(child => renderNode(child, childUl, depth + 1));
|
||||||
}
|
}
|
||||||
@@ -219,7 +214,7 @@
|
|||||||
// 상위 노드 확장
|
// 상위 노드 확장
|
||||||
let parent = currentNode.parentElement;
|
let parent = currentNode.parentElement;
|
||||||
while (parent && parent.tagName === 'LI') {
|
while (parent && parent.tagName === 'LI') {
|
||||||
parent.classList.add('open');
|
parent.classList.remove('folding');
|
||||||
parent = parent.parentElement.parentElement;
|
parent = parent.parentElement.parentElement;
|
||||||
}
|
}
|
||||||
selectNode(currentNode);
|
selectNode(currentNode);
|
||||||
@@ -228,11 +223,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNode(button) {
|
|
||||||
const li = button.parentElement;
|
|
||||||
li.classList.toggle('open');
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectNode(button) {
|
function selectNode(button) {
|
||||||
const treeWrap = document.querySelector('#tree');
|
const treeWrap = document.querySelector('#tree');
|
||||||
const f = document.formDto;
|
const f = document.formDto;
|
||||||
@@ -241,15 +231,18 @@
|
|||||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||||
if (previouslySelected) {
|
if (previouslySelected) {
|
||||||
previouslySelected.classList.remove('selected');
|
previouslySelected.classList.remove('selected');
|
||||||
|
if (previouslySelected.classList.contains('tit')) {
|
||||||
|
previouslySelected.parentNode.classList.add('folding');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 새 노드 선택
|
|
||||||
button.classList.add('selected');
|
button.classList.add('selected');
|
||||||
|
if (button.classList.contains('tit')) {
|
||||||
|
button.parentNode.classList.remove('folding');
|
||||||
|
}
|
||||||
// 노드 데이터 추출
|
// 노드 데이터 추출
|
||||||
const data = {
|
const data = {
|
||||||
id: button.getAttribute('data-id'),
|
id: button.getAttribute('data-id'),
|
||||||
text: button.querySelector('span:not(.toggle-icon)').textContent,
|
text: button.querySelector('span').textContent,
|
||||||
parentId: button.getAttribute('data-parent-id'),
|
parentId: button.getAttribute('data-parent-id'),
|
||||||
orderNo: parseInt(button.getAttribute('data-order-no')) || 0
|
orderNo: parseInt(button.getAttribute('data-order-no')) || 0
|
||||||
};
|
};
|
||||||
@@ -280,20 +273,20 @@
|
|||||||
|
|
||||||
const parentId = selectedButton.getAttribute('data-id');
|
const parentId = selectedButton.getAttribute('data-id');
|
||||||
const parentLi = selectedButton.parentElement;
|
const parentLi = selectedButton.parentElement;
|
||||||
let ul = parentLi.querySelector('.list-twodepth') || parentLi.querySelector('.list-threedepth');
|
let ul = parentLi.querySelector('.list-depth') || parentLi.querySelector('.list-detail');
|
||||||
const depth = parentLi.parentElement.classList.contains('list-onedepth') ? 2 : 3;
|
const depth = parentLi.parentElement.classList.contains('list-onedepth') ? 2 : 3;
|
||||||
|
|
||||||
if (!ul) {
|
if (!ul) {
|
||||||
ul = document.createElement('ul');
|
ul = document.createElement('ul');
|
||||||
ul.className = depth === 2 ? 'list-twodepth' : 'list-threedepth';
|
ul.className = 'list-detail'; // 새로 추가된 노드는 기본적으로 list-detail
|
||||||
parentLi.appendChild(ul);
|
parentLi.appendChild(ul);
|
||||||
}
|
}
|
||||||
|
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
|
// 새 노드는 기본적으로 표시 (depth에 따라 folding은 renderNode에서 처리)
|
||||||
const button = document.createElement('button');
|
const button = document.createElement('button');
|
||||||
button.type = 'button';
|
button.type = 'button';
|
||||||
button.className = depth === 2 ? 'tit twodepth' : '';
|
button.className = 'tit' + (depth === 2 ? ' twodepth' : '');
|
||||||
button.classList.add('no-toggle');
|
|
||||||
button.setAttribute('data-id', 'code.new.temp');
|
button.setAttribute('data-id', 'code.new.temp');
|
||||||
button.setAttribute('data-parent-id', parentId);
|
button.setAttribute('data-parent-id', parentId);
|
||||||
button.setAttribute('data-order-no', '0');
|
button.setAttribute('data-order-no', '0');
|
||||||
@@ -304,15 +297,11 @@
|
|||||||
|
|
||||||
button.onclick = function () {
|
button.onclick = function () {
|
||||||
selectNode(this);
|
selectNode(this);
|
||||||
if (depth <= 2 && this.classList.contains('toggle-icon')) {
|
|
||||||
toggleNode(this);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
li.appendChild(button);
|
li.appendChild(button);
|
||||||
ul.appendChild(li);
|
ul.appendChild(li);
|
||||||
|
|
||||||
parentLi.classList.add('open');
|
parentLi.classList.remove('folding');
|
||||||
selectedButton.classList.replace('no-toggle', 'toggle-icon');
|
|
||||||
selectNode(button);
|
selectNode(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +342,7 @@
|
|||||||
const selectedNode = treeWrap.querySelector('button.selected');
|
const selectedNode = treeWrap.querySelector('button.selected');
|
||||||
|
|
||||||
if (!selectedNode) {
|
if (!selectedNode) {
|
||||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
alert('저장할 노드를 선택하세요.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +392,7 @@
|
|||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
id: selectedNode.getAttribute('data-id'),
|
id: selectedNode.getAttribute('data-id'),
|
||||||
text: selectedNode.querySelector('span:not(.toggle-icon)').textContent
|
text: selectedNode.querySelector('span').textContent
|
||||||
};
|
};
|
||||||
|
|
||||||
if (confirm("'" + info.text + "' 메뉴를 정말 삭제하시겠습니까?")) {
|
if (confirm("'" + info.text + "' 메뉴를 정말 삭제하시겠습니까?")) {
|
||||||
@@ -411,7 +400,7 @@
|
|||||||
const parentLi = selectedNode.parentElement.parentElement.parentElement;
|
const parentLi = selectedNode.parentElement.parentElement.parentElement;
|
||||||
selectedNode.parentElement.remove();
|
selectedNode.parentElement.remove();
|
||||||
if (!parentLi.querySelector('ul')) {
|
if (!parentLi.querySelector('ul')) {
|
||||||
parentLi.querySelector('.toggle-icon')?.classList.replace('toggle-icon', 'no-toggle');
|
// 하위 노드가 없으면 버튼 스타일 유지
|
||||||
}
|
}
|
||||||
alert('삭제되었습니다.');
|
alert('삭제되었습니다.');
|
||||||
cleanFormFields();
|
cleanFormFields();
|
||||||
@@ -447,7 +436,7 @@
|
|||||||
f.inUse.value = 'true';
|
f.inUse.value = 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
function move(dir) {
|
function move(direction) {
|
||||||
const treeWrap = document.querySelector('#tree');
|
const treeWrap = document.querySelector('#tree');
|
||||||
const selectedNode = treeWrap.querySelector('button.selected');
|
const selectedNode = treeWrap.querySelector('button.selected');
|
||||||
if (!selectedNode) {
|
if (!selectedNode) {
|
||||||
@@ -470,14 +459,14 @@
|
|||||||
const currentLi = selectedNode.parentElement;
|
const currentLi = selectedNode.parentElement;
|
||||||
let targetItem;
|
let targetItem;
|
||||||
|
|
||||||
switch (dir) {
|
switch (direction) {
|
||||||
case 'up':
|
case 'up':
|
||||||
targetItem = siblings.find((li, idx) => {
|
targetItem = siblings.find((li, idx) => {
|
||||||
const btn = li.querySelector('button');
|
const btn = li.querySelector('button');
|
||||||
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) < info.orderNo && siblings[idx + 1] === currentLi;
|
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) < info.orderNo && siblings[idx + 1] === currentLi;
|
||||||
});
|
});
|
||||||
if (!targetItem) {
|
if (!targetItem) {
|
||||||
alert(/*[[#{operation.uri.move.cannot.before}]]*/);
|
alert('더 이상 위로 이동할 수 없습니다.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -487,7 +476,7 @@
|
|||||||
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) > info.orderNo && siblings[idx - 1] === currentLi;
|
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) > info.orderNo && siblings[idx - 1] === currentLi;
|
||||||
});
|
});
|
||||||
if (!targetItem) {
|
if (!targetItem) {
|
||||||
alert(/*[[#{operation.uri.move.cannot.after}]]*/);
|
alert('더 이상 아래로 이동할 수 없습니다.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -524,25 +513,33 @@
|
|||||||
function collapse() {
|
function collapse() {
|
||||||
const treeWrap = document.querySelector('#tree');
|
const treeWrap = document.querySelector('#tree');
|
||||||
const lis = treeWrap.querySelectorAll('li');
|
const lis = treeWrap.querySelectorAll('li');
|
||||||
lis.forEach(li => li.classList.remove('open'));
|
lis.forEach(li => {
|
||||||
treeWrap.querySelectorAll('.list-onedepth > li').forEach(li => li.classList.add('open'));
|
li.classList.add('folding');
|
||||||
|
});
|
||||||
|
// 1depth는 기본적으로 열림
|
||||||
|
treeWrap.querySelectorAll('.list-onedepth > li').forEach(li => {
|
||||||
|
li.classList.remove('folding');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function expand() {
|
function expand() {
|
||||||
const treeWrap = document.querySelector('#tree');
|
const treeWrap = document.querySelector('#tree');
|
||||||
const lis = treeWrap.querySelectorAll('li');
|
const lis = treeWrap.querySelectorAll('li');
|
||||||
lis.forEach(li => li.classList.add('open'));
|
lis.forEach(li => {
|
||||||
|
li.classList.remove('folding');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchNode() {
|
function searchNode() {
|
||||||
const searchVal = $('#searchNode').val().trim();
|
const searchVal = $('#searchNode').val().trim();
|
||||||
if (!searchVal) {
|
if (!searchVal) {
|
||||||
|
alert('검색어를 입력하세요.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const treeWrap = document.querySelector('#tree');
|
const treeWrap = document.querySelector('#tree');
|
||||||
const buttons = treeWrap.querySelectorAll('button');
|
const buttons = treeWrap.querySelectorAll('button');
|
||||||
const matchingNode = Array.from(buttons).find(btn => btn.querySelector('span:not(.toggle-icon)').textContent.toLowerCase().includes(searchVal.toLowerCase()));
|
const matchingNode = Array.from(buttons).find(btn => btn.querySelector('span').textContent.toLowerCase().includes(searchVal.toLowerCase()));
|
||||||
|
|
||||||
if (matchingNode) {
|
if (matchingNode) {
|
||||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||||
@@ -551,10 +548,10 @@
|
|||||||
}
|
}
|
||||||
matchingNode.classList.add('selected');
|
matchingNode.classList.add('selected');
|
||||||
matchingNode.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
matchingNode.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
let parent = matchingNode.parentElement;
|
let parentLi = matchingNode.parentElement;
|
||||||
while (parent && parent.tagName === 'LI') {
|
while (parentLi && parentLi.tagName === 'LI') {
|
||||||
parent.classList.add('open');
|
parentLi.classList.remove('folding');
|
||||||
parent = parent.parentElement.parentElement;
|
parentLi = parentLi.parentElement.parentElement;
|
||||||
}
|
}
|
||||||
selectNode(matchingNode);
|
selectNode(matchingNode);
|
||||||
} else {
|
} else {
|
||||||
@@ -563,5 +560,4 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -27,8 +27,7 @@ public class CreateAdminValidator implements Validator {
|
|||||||
.filter(password -> !password.matches(PASSWORD_REGEX))
|
.filter(password -> !password.matches(PASSWORD_REGEX))
|
||||||
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
|
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
|
||||||
|
|
||||||
Optional.ofNullable(vo.getRoleIds())
|
Optional.ofNullable(vo.getRoleId())
|
||||||
.filter(ids -> ids.size() < 1)
|
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
ids ->
|
ids ->
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
|
|||||||
Reference in New Issue
Block a user