import { t } from "../../services/i18n.js"; import server from "../../services/server.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js"; import froca from "../../services/froca.js"; import ws from "../../services/ws.js"; import toastService from "../../services/toast.js"; import treeService from "../../services/tree.js"; import SearchString from "../search_options/search_string.js"; import FastSearch from "../search_options/fast_search.js"; import Ancestor from "../search_options/ancestor.js"; import IncludeArchivedNotes from "../search_options/include_archived_notes.js"; import OrderBy from "../search_options/order_by.js"; import SearchScript from "../search_options/search_script.js"; import Limit from "../search_options/limit.js"; import Debug from "../search_options/debug.js"; import appContext, { type EventData } from "../../components/app_context.js"; import bulkActionService from "../../services/bulk_action.js"; import { Dropdown } from "bootstrap"; import type FNote from "../../entities/fnote.js"; import type { AttributeType } from "../../entities/fattribute.js"; import { renderReactWidget } from "../react/react_utils.jsx"; const TPL = /*html*/`
`; const OPTION_CLASSES = [SearchString, SearchScript, Ancestor, FastSearch, IncludeArchivedNotes, OrderBy, Limit, Debug]; // TODO: Deduplicate with server interface SaveSearchNoteResponse { notePath: string; } export default class SearchDefinitionWidget extends NoteContextAwareWidget { private $component!: JQuery; private $actionList!: JQuery; private $searchOptions!: JQuery; private $searchButton!: JQuery; private $searchAndExecuteButton!: JQuery; private $saveToNoteButton!: JQuery; private $actionOptions!: JQuery; get name() { return "searchDefinition"; } doRender() { this.$widget = $(TPL); this.contentSized(); this.$component = this.$widget.find(".search-definition-widget"); this.$actionList = this.$widget.find(".action-list"); for (const actionGroup of bulkActionService.ACTION_GROUPS) { this.$actionList.append($('