1
This commit is contained in:
parent
d59355e6b8
commit
48926cd9d4
|
|
@ -132,7 +132,7 @@
|
||||||
<button
|
<button
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@click="handleSearch"
|
@click="handleSearch"
|
||||||
class="cursor-pointer flex items-center justify-center h-10 p-2 bg-primary text-white rounded-l-lg hover:bg-primary-400 dark:hover:bg-dark-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 active:scale-95"
|
class="cursor-pointer flex items-center justify-center h-10 p-2 bg-primary text-white rounded-l-lg hover:bg-primary-400 dark:hover:bg-dark-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 active:scale-95"
|
||||||
aria-label="جستجو"
|
aria-label="جستجو"
|
||||||
>
|
>
|
||||||
جستجو
|
جستجو
|
||||||
|
|
@ -504,7 +504,7 @@ const loadHistoryFromLocal = () => {
|
||||||
const parsed = JSON.parse(stored);
|
const parsed = JSON.parse(stored);
|
||||||
historyResults.value = parsed.slice(
|
historyResults.value = parsed.slice(
|
||||||
0,
|
0,
|
||||||
resolvedProps.value.maxHistoryItems
|
resolvedProps.value.maxHistoryItems,
|
||||||
);
|
);
|
||||||
recentSearches.value = historyResults.value
|
recentSearches.value = historyResults.value
|
||||||
.slice(0, 5)
|
.slice(0, 5)
|
||||||
|
|
@ -520,7 +520,7 @@ const saveHistoryToLocal = () => {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
LOCAL_STORAGE_KEY,
|
LOCAL_STORAGE_KEY,
|
||||||
JSON.stringify(historyResults.value)
|
JSON.stringify(historyResults.value),
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("خطا در ذخیره تاریخچه:", err);
|
console.error("خطا در ذخیره تاریخچه:", err);
|
||||||
|
|
@ -533,39 +533,39 @@ const hasVisibleResults = computed(
|
||||||
showResults.value &&
|
showResults.value &&
|
||||||
(showAutocompleteList.value ||
|
(showAutocompleteList.value ||
|
||||||
showHistoryList.value ||
|
showHistoryList.value ||
|
||||||
showEmptyState.value)
|
showEmptyState.value),
|
||||||
);
|
);
|
||||||
const showAutocompleteList = computed(
|
const showAutocompleteList = computed(
|
||||||
() =>
|
() =>
|
||||||
showResults.value &&
|
showResults.value &&
|
||||||
autocompleteResults.value.length > 0 &&
|
autocompleteResults.value.length > 0 &&
|
||||||
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete
|
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete,
|
||||||
);
|
);
|
||||||
const showHistoryList = computed(
|
const showHistoryList = computed(
|
||||||
() => showResults.value && searchQuery.value.length === 0
|
() => showResults.value && searchQuery.value.length === 0,
|
||||||
);
|
);
|
||||||
const showEmptyState = computed(
|
const showEmptyState = computed(
|
||||||
() =>
|
() =>
|
||||||
showResults.value &&
|
showResults.value &&
|
||||||
!showAutocompleteList.value &&
|
!showAutocompleteList.value &&
|
||||||
!showHistoryList.value &&
|
!showHistoryList.value &&
|
||||||
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete
|
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete,
|
||||||
);
|
);
|
||||||
const totalResults = computed(
|
const totalResults = computed(
|
||||||
() =>
|
() =>
|
||||||
(showAutocompleteList.value ? autocompleteResults.value.length : 0) +
|
(showAutocompleteList.value ? autocompleteResults.value.length : 0) +
|
||||||
(showHistoryList.value ? historyResults.value.length : 0)
|
(showHistoryList.value ? historyResults.value.length : 0),
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectedFilterIcon = computed(
|
const selectedFilterIcon = computed(
|
||||||
() =>
|
() =>
|
||||||
quickFilters.value.find((f) => f.value === selectedFilter.value)?.icon ||
|
quickFilters.value.find((f) => f.value === selectedFilter.value)?.icon ||
|
||||||
"i-heroicons-funnel"
|
"i-heroicons-funnel",
|
||||||
);
|
);
|
||||||
const selectedFilterLabel = computed(
|
const selectedFilterLabel = computed(
|
||||||
() =>
|
() =>
|
||||||
quickFilters.value.find((f) => f.value === selectedFilter.value)?.label ||
|
quickFilters.value.find((f) => f.value === selectedFilter.value)?.label ||
|
||||||
"فیلتر"
|
"فیلتر",
|
||||||
);
|
);
|
||||||
|
|
||||||
// فرمت زمان
|
// فرمت زمان
|
||||||
|
|
@ -599,6 +599,8 @@ const fetchAutocomplete = async () => {
|
||||||
let url = `${resolvedProps.value.autocompleteUrl}/q=${searchQuery.value}`;
|
let url = `${resolvedProps.value.autocompleteUrl}/q=${searchQuery.value}`;
|
||||||
if (selectedFilter.value !== "all") url += `&filter=${selectedFilter.value}`;
|
if (selectedFilter.value !== "all") url += `&filter=${selectedFilter.value}`;
|
||||||
try {
|
try {
|
||||||
|
console.log("url", url);
|
||||||
|
|
||||||
const response = await httpService.getRequest(url);
|
const response = await httpService.getRequest(url);
|
||||||
const hits = response?.hits?.hits || [];
|
const hits = response?.hits?.hits || [];
|
||||||
autocompleteResults.value = hits
|
autocompleteResults.value = hits
|
||||||
|
|
@ -611,8 +613,8 @@ const fetchAutocomplete = async () => {
|
||||||
hit._source?.type === "product"
|
hit._source?.type === "product"
|
||||||
? "i-heroicons-shopping-bag"
|
? "i-heroicons-shopping-bag"
|
||||||
: hit._source?.type === "article"
|
: hit._source?.type === "article"
|
||||||
? "i-heroicons-newspaper"
|
? "i-heroicons-newspaper"
|
||||||
: "i-heroicons-document-text",
|
: "i-heroicons-document-text",
|
||||||
}))
|
}))
|
||||||
.slice(0, 6);
|
.slice(0, 6);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -654,7 +656,7 @@ const addToHistory = (item) => {
|
||||||
if (historyResults.value.length > resolvedProps.value.maxHistoryItems) {
|
if (historyResults.value.length > resolvedProps.value.maxHistoryItems) {
|
||||||
historyResults.value = historyResults.value.slice(
|
historyResults.value = historyResults.value.slice(
|
||||||
0,
|
0,
|
||||||
resolvedProps.value.maxHistoryItems
|
resolvedProps.value.maxHistoryItems,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
recentSearches.value = historyResults.value.slice(0, 5).map((i) => i.label);
|
recentSearches.value = historyResults.value.slice(0, 5).map((i) => i.label);
|
||||||
|
|
@ -882,7 +884,7 @@ const handleKeyDown = (event) => {
|
||||||
if (selectedIndex.value >= 0) {
|
if (selectedIndex.value >= 0) {
|
||||||
if (activeSection.value === "autocomplete") {
|
if (activeSection.value === "autocomplete") {
|
||||||
handleAutocompleteSelect(
|
handleAutocompleteSelect(
|
||||||
autocompleteResults.value[selectedIndex.value]
|
autocompleteResults.value[selectedIndex.value],
|
||||||
);
|
);
|
||||||
} else if (activeSection.value === "history") {
|
} else if (activeSection.value === "history") {
|
||||||
const historyIndex = selectedIndex.value - autocompleteCount;
|
const historyIndex = selectedIndex.value - autocompleteCount;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ function isList(text) {
|
||||||
(line) =>
|
(line) =>
|
||||||
line.trim().startsWith("*") ||
|
line.trim().startsWith("*") ||
|
||||||
line.trim().startsWith("-") ||
|
line.trim().startsWith("-") ||
|
||||||
/^\d+\./.test(line.trim())
|
/^\d+\./.test(line.trim()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const toolbarGroups = [
|
const toolbarGroups = [
|
||||||
|
|
@ -254,7 +254,7 @@ function generateDetailsHtml(item) {
|
||||||
|
|
||||||
html += `${escapeHtml(item.title) || "بدون عنوان"}`;
|
html += `${escapeHtml(item.title) || "بدون عنوان"}`;
|
||||||
if (item.link_url) {
|
if (item.link_url) {
|
||||||
html += `<a href="${item.link_url}">${item.link_label}</a>`;
|
html += `<a class="link-url" href="${item.link_url}">${item.link_label}</a>`;
|
||||||
}
|
}
|
||||||
html += "</summary>";
|
html += "</summary>";
|
||||||
|
|
||||||
|
|
@ -297,7 +297,7 @@ watch(
|
||||||
loadFromJson();
|
loadFromJson();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
{ deep: true, immediate: true }
|
{ deep: true, immediate: true },
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
editor.value = new Editor({
|
editor.value = new Editor({
|
||||||
|
|
@ -342,8 +342,8 @@ onBeforeUnmount(() => {
|
||||||
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) – رنگها در main.css تعریف شدهاند */
|
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) – رنگها در main.css تعریف شدهاند */
|
||||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||||
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
--shadow-md:
|
||||||
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||||
--radius: 0.75rem;
|
--radius: 0.75rem;
|
||||||
--radius-sm: 0.5rem;
|
--radius-sm: 0.5rem;
|
||||||
--radius-lg: 1rem;
|
--radius-lg: 1rem;
|
||||||
|
|
@ -365,7 +365,7 @@ onBeforeUnmount(() => {
|
||||||
border: 1px solid var(--color-primary-200);
|
border: 1px solid var(--color-primary-200);
|
||||||
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
||||||
margin: 2rem auto 0;
|
margin: 2rem auto 0;
|
||||||
max-width: 900px;
|
max-width: 1200px;
|
||||||
box-shadow: var(--shadow-sm);
|
box-shadow: var(--shadow-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -421,7 +421,7 @@ onBeforeUnmount(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-content {
|
.editor-content {
|
||||||
max-width: 900px;
|
max-width: 1200px;
|
||||||
margin: 0 auto 2rem;
|
margin: 0 auto 2rem;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
background: var(--color-white-normal);
|
background: var(--color-white-normal);
|
||||||
|
|
@ -433,8 +433,14 @@ onBeforeUnmount(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tiptap {
|
.tiptap {
|
||||||
font-family: "Vazir", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
|
font-family:
|
||||||
Roboto, sans-serif;
|
"Vazir",
|
||||||
|
"Inter",
|
||||||
|
-apple-system,
|
||||||
|
BlinkMacSystemFont,
|
||||||
|
"Segoe UI",
|
||||||
|
Roboto,
|
||||||
|
sans-serif;
|
||||||
color: var(--color-dark-primary-700);
|
color: var(--color-dark-primary-700);
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
|
|
||||||
|
|
@ -553,14 +559,15 @@ onBeforeUnmount(() => {
|
||||||
padding: 1.25rem 1.25rem 1.25rem 3.5rem;
|
padding: 1.25rem 1.25rem 1.25rem 3.5rem;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to right,
|
to right,
|
||||||
var(--color-dark-primary-50),
|
var(--color-primary-100),
|
||||||
var(--color-white-normal)
|
var(--color-white-normal)
|
||||||
);
|
);
|
||||||
|
color: var(--color-primary-700);
|
||||||
border-radius: var(--radius) var(--radius) 0 0;
|
border-radius: var(--radius) var(--radius) 0 0;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
color: var(--color-dark-primary-800);
|
color: var(--color-dark-primary-800);
|
||||||
cursor: pointer;
|
// cursor: pointer;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
|
|
@ -568,15 +575,6 @@ onBeforeUnmount(() => {
|
||||||
&::-webkit-details-marker {
|
&::-webkit-details-marker {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: linear-gradient(
|
|
||||||
to right,
|
|
||||||
var(--color-primary-100),
|
|
||||||
var(--color-white-normal)
|
|
||||||
);
|
|
||||||
color: var(--color-primary-700);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
|
|
@ -641,6 +639,10 @@ onBeforeUnmount(() => {
|
||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
border-right: 2px dashed var(--color-primary-100);
|
border-right: 2px dashed var(--color-primary-100);
|
||||||
}
|
}
|
||||||
|
.link-url {
|
||||||
|
color: blue;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideDown {
|
@keyframes slideDown {
|
||||||
|
|
|
||||||
|
|
@ -40,72 +40,144 @@ const myContentSchema = computed(() => {
|
||||||
pagination: props.pagination,
|
pagination: props.pagination,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const headerTools = computed(() => [
|
const headerTools = ref([
|
||||||
{
|
[
|
||||||
items: [
|
{
|
||||||
{
|
items: [
|
||||||
type: "dropdown",
|
{ key: "label", label: "کد:", style: "code-title" },
|
||||||
key: "dropdown",
|
{
|
||||||
name: "refine_codes",
|
type: "dropdown",
|
||||||
dropdownSchema: {
|
key: "dropdown",
|
||||||
width: "18em",
|
name: "refine_codes",
|
||||||
modelValue: null, // ✅ اینو بذار
|
dropdownSchema: {
|
||||||
optionAttribute: "title",
|
width: "18em",
|
||||||
valueAttribute: "value",
|
modelValue: null,
|
||||||
searchable: false,
|
optionAttribute: "title",
|
||||||
placeholder: "انتخاب کنید",
|
valueAttribute: "value",
|
||||||
items: refineCodes,
|
searchable: false,
|
||||||
|
placeholder: "انتخاب کنید",
|
||||||
|
items: refineCodes,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
{ key: "label", label: "نوع رابطه:", style: "code-title" },
|
||||||
{
|
{
|
||||||
key: "autoComplation",
|
type: "dropdown",
|
||||||
placeholder: "جستجوی ...",
|
key: "dropdown",
|
||||||
debounceTime: 500,
|
name: "refine_codes",
|
||||||
// autocompleteUrl: "/repo/monir/complation/sanad",
|
dropdownSchema: {
|
||||||
minCharsForAutocomplete: 3,
|
width: "10em",
|
||||||
maxHistoryItems: 20,
|
modelValue: null,
|
||||||
showSearchButton: false,
|
optionAttribute: "title",
|
||||||
filters: [
|
valueAttribute: "value",
|
||||||
{
|
searchable: false,
|
||||||
label: "همه اجزاء",
|
placeholder: "انتخاب کنید",
|
||||||
value: "all",
|
items: [
|
||||||
|
{
|
||||||
|
title: "تعارض",
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "تینت",
|
||||||
|
value: "2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ییی",
|
||||||
|
value: "3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ییی",
|
||||||
|
value: "4",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
label: "عنوان جلسه",
|
{ key: "label", label: "وضعیت اعتبار:", style: "code-title" },
|
||||||
value: "title",
|
{
|
||||||
|
type: "dropdown",
|
||||||
|
key: "dropdown",
|
||||||
|
name: "refine_codes",
|
||||||
|
dropdownSchema: {
|
||||||
|
width: "10em",
|
||||||
|
modelValue: null,
|
||||||
|
optionAttribute: "title",
|
||||||
|
valueAttribute: "value",
|
||||||
|
searchable: false,
|
||||||
|
placeholder: "انتخاب کنید",
|
||||||
|
placeholder: "انتخاب کنید",
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
title: "تعارض",
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "تینت",
|
||||||
|
value: "2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ییی",
|
||||||
|
value: "3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "ییی",
|
||||||
|
value: "4",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
label: "عنوان دوره",
|
],
|
||||||
value: "branch",
|
},
|
||||||
},
|
{
|
||||||
{
|
items: [
|
||||||
label: " فقط فهرست",
|
{
|
||||||
value: "mindex",
|
key: "autoComplation",
|
||||||
},
|
placeholder: "جستجوی ...",
|
||||||
{
|
debounceTime: 500,
|
||||||
label: " فقط کدها",
|
// autocompleteUrl: "/repo/monir/complation/sanad",
|
||||||
value: "codes",
|
minCharsForAutocomplete: 3,
|
||||||
},
|
maxHistoryItems: 20,
|
||||||
{
|
showSearchButton: false,
|
||||||
label: " دوره",
|
filters: [
|
||||||
value: "advance",
|
{
|
||||||
},
|
label: "همه اجزاء",
|
||||||
],
|
value: "all",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "prevNext",
|
label: "عنوان جلسه",
|
||||||
name: "entityNavigator",
|
value: "title",
|
||||||
prevDisabled: false,
|
},
|
||||||
nextDisabled: true,
|
{
|
||||||
},
|
label: "عنوان دوره",
|
||||||
],
|
value: "branch",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: " فقط فهرست",
|
||||||
|
value: "mindex",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: " فقط کدها",
|
||||||
|
value: "codes",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: " دوره",
|
||||||
|
value: "advance",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "prevNext",
|
||||||
|
name: "entityNavigator",
|
||||||
|
prevDisabled: false,
|
||||||
|
nextDisabled: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function headerToolsAction({ action, data }) {
|
function headerToolsAction({ action, data }) {
|
||||||
if (action == "auto-complation") {
|
if (action == "auto-complation") {
|
||||||
if (data.action == "complete-search") {
|
if (data.action == "complete-search") {
|
||||||
console.log("data ==> ", data);
|
// console.log("data ==> ", data);
|
||||||
|
|
||||||
emit("my-header-tools-search", data.item);
|
emit("my-header-tools-search", data.item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,8 @@ function myContentAction({ action, payload }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function myHeaderToolsSearch(data) {
|
function myHeaderToolsSearch(textSearch) {
|
||||||
// console.log("dataqqqq ==> ", data);
|
console.log("dataqqqq ==> ", textSearch);
|
||||||
getListConflict(data);
|
getListConflict(textSearch);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user