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