preparing for display in the panel

This commit is contained in:
Artur
2025-11-10 10:12:53 +03:00
parent 5b7730d547
commit 73be45b013
5 changed files with 91 additions and 61 deletions

View File

@ -16,8 +16,6 @@ npm run build:all
### Update Font Awesome Icons (windows) ### Update Font Awesome Icons (windows)
Generate icon paths by category
```bash ```bash
cd .dev/svg-path-generator && npm i && npm run start && cd ../.. cd .dev/svg-path-generator && npm i && npm run start && cd ../..
``` ```

View File

@ -26,7 +26,7 @@
"url": "dist/index.html", "url": "dist/index.html",
"icons": "resources/%theme-type%(light|dark)/icon.svg", "icons": "resources/%theme-type%(light|dark)/icon.svg",
"EditorsSupport": ["word", "slide", "cell"], "EditorsSupport": ["word", "slide", "cell"],
"type": "window", "type": "panel",
"initDataType": "none", "initDataType": "none",
"buttons": [ "buttons": [

View File

@ -34,11 +34,11 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<base href="../" /> <base href="../" />
<title>AI Constructor</title> <title>AI Constructor</title>
<link rel="stylesheet" href="dist/styles.css" />
<link <link
rel="stylesheet" rel="stylesheet"
href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css"
/> />
<link rel="stylesheet" href="dist/styles.css" />
<script <script
type="text/javascript" type="text/javascript"
src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"
@ -55,16 +55,32 @@
<div class="overlay-close"></div> <div class="overlay-close"></div>
</div> </div>
<section class="content"> <section class="content">
<div class="sidebar"> <div id="search" class="search">
<div id="search" class="search"> <input
type="text"
id="searchFilter"
placeholder="Enter the name of the icon"
/>
</div>
<div id="categories-container" class="categories-container">
<span class="i18n">Category</span>
<div class="selectHolder">
<input <input
id="categorySelect"
class="control select text i18n"
type="text" type="text"
id="searchFilter" placeholder="Enter category name"
placeholder="Search icons" autocomplete="off"
/> />
</div> <div
<div id="categories-container" class="categories-container"> id="categorySelectList"
<div id="categories" class="categories"></div> class="selectList display-none"
></div>
<div
id="categories"
class="categories selectList display-none form-control"
></div>
</div> </div>
</div> </div>
<div id="icons-container" class="icons-container"> <div id="icons-container" class="icons-container">

View File

@ -35,7 +35,7 @@
/** @typedef {import('../types.js').IconCategoryType} IconCategoryType */ /** @typedef {import('../types.js').IconCategoryType} IconCategoryType */
class CategoriesPicker { class CategoriesPicker {
#container; #categories;
/** /**
* @param {string} category * @param {string} category
*/ */
@ -48,7 +48,7 @@ class CategoriesPicker {
*/ */
constructor(catalogOfIcons) { constructor(catalogOfIcons) {
/** @type {HTMLDivElement} */ /** @type {HTMLDivElement} */
this.#container = document.getElementById("categories"); this.#categories = document.getElementById("categories");
this.#addEventListener(); this.#addEventListener();
this.#show(catalogOfIcons); this.#show(catalogOfIcons);
} }
@ -70,11 +70,30 @@ class CategoriesPicker {
const categoryName = document.createElement("span"); const categoryName = document.createElement("span");
categoryContainer.appendChild(categoryName); categoryContainer.appendChild(categoryName);
categoryName.textContent = label; categoryName.textContent = label;
categoryName.setAttribute("data-id", id); categoryName.setAttribute("data-value", id);
categoryName.className = "category-name"; categoryName.className = "category-name";
/** ******************** */
var el = document.createElement("span");
el.className = "category";
el.setAttribute("data-value", id);
el.textContent = label;
this.#categories?.appendChild(el);
/*el.onclick = onStyleSelectOther();
if (json[i].name == lastStyle) {
el.setAttribute("selected", "");
selectInput(
elements.styleSelect,
el,
elements.styleSelectList,
false
);
}*/
}); });
this.#container?.appendChild(fragment); this.#categories?.appendChild(fragment);
} }
reset() { reset() {
@ -82,7 +101,7 @@ class CategoriesPicker {
return; return;
} }
this.#selectedCategory = ""; this.#selectedCategory = "";
this.#container this.#categories
?.querySelectorAll(".category.selected") ?.querySelectorAll(".category.selected")
.forEach((category) => { .forEach((category) => {
category.classList.remove("selected"); category.classList.remove("selected");
@ -97,7 +116,7 @@ class CategoriesPicker {
} }
#addEventListener() { #addEventListener() {
this.#container?.addEventListener("click", (e) => { /*this.#categories?.addEventListener("click", (e) => {
let categoryName; let categoryName;
const target = e.target; const target = e.target;
@ -108,14 +127,14 @@ class CategoriesPicker {
if (!categoryName) { if (!categoryName) {
return; return;
} }
let id = categoryName.getAttribute("data-id"); let id = categoryName.getAttribute("data-value");
if (typeof id !== "string") { if (typeof id !== "string") {
id = ""; id = "";
} }
let category = categoryName.parentElement; let category = categoryName.parentElement;
let wasSelected = category?.classList.contains("selected"); let wasSelected = category?.classList.contains("selected");
this.#container this.#categories
?.querySelectorAll(".category.selected") ?.querySelectorAll(".category.selected")
.forEach((category) => { .forEach((category) => {
category.classList.remove("selected"); category.classList.remove("selected");
@ -129,7 +148,7 @@ class CategoriesPicker {
this.#selectedCategory = id; this.#selectedCategory = id;
} }
this.#onSelectCategoryCallback(this.#selectedCategory); this.#onSelectCategoryCallback(this.#selectedCategory);
}); });*/
} }
} }

View File

@ -23,60 +23,57 @@ body {
overflow-y: auto; overflow-y: auto;
height: inherit; height: inherit;
display: flex; display: flex;
flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
} }
.sidebar { .search {
height: 100%; margin: 4px 12px;
min-width: 215px; height: 30px;
box-sizing: border-box; box-sizing: border-box;
.search { input {
margin: 4px 12px;
height: 30px; height: 30px;
width: calc(100% - 12px);
box-sizing: border-box; box-sizing: border-box;
input {
height: 30px;
width: calc(100% - 12px);
box-sizing: border-box;
}
} }
.categories-container { }
height: calc(100% - 38px); .categories-container {
overflow-y: scroll; height: calc(100% - 38px);
box-sizing: border-box; overflow-y: scroll;
background-color: var(--color-pad); box-sizing: border-box;
} background-color: var(--color-pad);
.category { }
cursor: pointer; .category {
color: var(--font-color); cursor: pointer;
user-select: none; color: var(--font-color);
line-height: 22px; user-select: none;
position: relative; line-height: 22px;
position: relative;
&::before {
content: "📁 ";
position: absolute;
left: 4px;
}
&.selected {
background: var(--color-pad-selected);
&::before { &::before {
content: "📁 "; content: " ";
position: absolute;
left: 4px;
} }
&.selected { }
background: var(--color-pad-selected); .category-name {
&::before { display: block;
content: "✅ "; min-width: 160px;
} box-sizing: border-box;
} padding: 4px 12px 4px 33px;
.category-name { border-radius: 3px;
display: block; &:hover {
min-width: 160px; color: var(--font-color-hover);
box-sizing: border-box; background-color: var(--color-pad-hover);
padding: 4px 12px 4px 33px;
border-radius: 3px;
&:hover {
color: var(--font-color-hover);
background-color: var(--color-pad-hover);
}
} }
} }
} }
.icons-container { .icons-container {
height: 100%; height: 100%;
width: 100%; width: 100%;