306 lines
8.5 KiB
TypeScript
306 lines
8.5 KiB
TypeScript
import type {
|
|
ActiveEntityViewSchema,
|
|
activeResearchType,
|
|
ActiveTab,
|
|
EntityViewSchema,
|
|
ListEntity,
|
|
qruleActiveTab,
|
|
qruleActiveTabGetter,
|
|
SelectedItemEntity,
|
|
SimilarInfo,
|
|
} from "~/types/entityType";
|
|
|
|
export const useEntityStore = defineStore("entityStore", {
|
|
persist: {
|
|
storage: piniaPluginPersistedstate.localStorage(),
|
|
pick: [
|
|
"draftSchema",
|
|
"draftActiveStep",
|
|
"draftActiveSchema",
|
|
"draftSaveBoxSchema",
|
|
|
|
"diffType",
|
|
|
|
"activeTab",
|
|
"isReadingMode",
|
|
"entityViewSchema",
|
|
"activeEntityViewSchema",
|
|
|
|
"qruleActiveTab",
|
|
"qruleSchema",
|
|
"qruleActiveSchema",
|
|
|
|
"listHighlightText",
|
|
"activeResearchType",
|
|
],
|
|
},
|
|
state: () => ({
|
|
activeTab: undefined as ActiveTab | undefined,
|
|
entityViewSchema: undefined as EntityViewSchema | undefined,
|
|
activeEntityViewSchema: undefined as ActiveEntityViewSchema | undefined,
|
|
selectedItemEntity: undefined as SelectedItemEntity | undefined,
|
|
listEntity: undefined as ListEntity | undefined,
|
|
similarInfo: {} as SimilarInfo | undefined,
|
|
vuexEntity: undefined, //پیدا نکردم
|
|
qruleActiveSchema: undefined as qruleActiveTabGetter | undefined,
|
|
qruleActiveTab: undefined as qruleActiveTab | undefined,
|
|
activeResearchType: undefined as activeResearchType | undefined,
|
|
isReadingMode: false,
|
|
fontSize: undefined as undefined | string,
|
|
selectedText: undefined as undefined | string,
|
|
showSidebar: false,
|
|
statusId: undefined,
|
|
statusButton: undefined,
|
|
statusEntityViewPage: undefined,
|
|
textSteps: [],
|
|
listHighlightText: [],
|
|
breadCrumb: [],
|
|
|
|
// draft law
|
|
nlpTree: undefined,
|
|
draftActiveStep: undefined,
|
|
draftActiveSchema: undefined,
|
|
draftSchema: undefined,
|
|
draftSaveBoxSchema: [],
|
|
// draft law
|
|
|
|
qruleSchema: undefined,
|
|
diffType: undefined,
|
|
queryParams: undefined,
|
|
statusRemovCheckBox: undefined,
|
|
requestSimilar: false, // این متغییر دیگه نباید استفاده شود
|
|
newSimilar: false, // این متغییر دیگه نباید استفاده شود
|
|
showModal: false,
|
|
changePagForFish: 0,
|
|
itemEditForFish: undefined,
|
|
fishActions: undefined,
|
|
annotationActions: undefined,
|
|
itemEditForAnnotation: undefined,
|
|
showModalAnnotation: false,
|
|
}),
|
|
getters: {
|
|
// start: draft page
|
|
nlpTreeGetter(state) {
|
|
return state.nlpTree;
|
|
},
|
|
draftActiveStepGetter(state) {
|
|
return state.draftActiveStep;
|
|
},
|
|
draftSchemaGetter(state) {
|
|
return state.draftSchema;
|
|
},
|
|
draftActiveSchemaGetter(state) {
|
|
return state.draftActiveSchema;
|
|
},
|
|
draftSaveBoxSchemaGetter(state) {
|
|
return state.draftSaveBoxSchema;
|
|
},
|
|
// end: draft page
|
|
|
|
vuexEntityGetter(state) {
|
|
return state.vuexEntity;
|
|
},
|
|
breadCrumbGetter(state) {
|
|
return state.breadCrumb;
|
|
},
|
|
activeTabGetter(state) {
|
|
return state.activeTab;
|
|
},
|
|
entityViewSchemaGetter(state) {
|
|
return state.entityViewSchema;
|
|
},
|
|
activeEntityViewSchemaGetter(state) {
|
|
return state.activeEntityViewSchema;
|
|
},
|
|
qruleActiveTabGetter(state) {
|
|
return state.qruleActiveTab;
|
|
},
|
|
qruleActiveSchemaGetter(state) {
|
|
return state.qruleActiveSchema;
|
|
},
|
|
selectedItemEntityGetter(state) {
|
|
return state.selectedItemEntity;
|
|
},
|
|
listEntityGetter(state) {
|
|
return state.listEntity;
|
|
},
|
|
fontSizeGerrer(state) {
|
|
return state.fontSize;
|
|
},
|
|
statusButtonGetter(state) {
|
|
return state.statusButton;
|
|
},
|
|
statusEntityViewPageGetter(state) {
|
|
return state.statusEntityViewPage;
|
|
},
|
|
textStepsGetter(state) {
|
|
return state.textSteps;
|
|
},
|
|
showSidebarGetter(state) {
|
|
return state.showSidebar;
|
|
},
|
|
similarInfoGetter(state) {
|
|
return state.similarInfo;
|
|
},
|
|
selectedTextGetter(state) {
|
|
return state.selectedText;
|
|
},
|
|
listHighlightTextGetter(state) {
|
|
return state.listHighlightText;
|
|
},
|
|
activeResearchTypeGetter(state) {
|
|
return state.activeResearchType;
|
|
},
|
|
isReadingModeGetter(state) {
|
|
return state.isReadingMode;
|
|
},
|
|
},
|
|
actions: {
|
|
// start: draft page
|
|
nlpTreeSetter(nlpTree = undefined) {
|
|
this.nlpTree = nlpTree;
|
|
},
|
|
draftActiveStepSetter(draftActiveStep = undefined) {
|
|
this.draftActiveStep = draftActiveStep;
|
|
},
|
|
draftSchemaSetter(draftSchema = undefined) {
|
|
this.draftSchema = draftSchema;
|
|
},
|
|
draftActiveSchemaSetter(draftActiveSchema = undefined) {
|
|
this.draftActiveSchema = draftActiveSchema;
|
|
},
|
|
draftSaveBoxSchemaSetter(draftSaveBoxSchema = []) {
|
|
this.draftSaveBoxSchema = draftSaveBoxSchema;
|
|
},
|
|
// end: draft page
|
|
|
|
vuexEntitySetter(vuexEntity = undefined) {
|
|
this.vuexEntity = vuexEntity;
|
|
},
|
|
breadCrumbSetter(newItem = undefined) {
|
|
if (!newItem) this.breadCrumb = [];
|
|
else this.breadCrumb = [...this.breadCrumb, newItem];
|
|
},
|
|
activeTabSetter(activeTab = undefined) {
|
|
this.activeTab = activeTab;
|
|
},
|
|
entityViewSchemaSetter(entityViewSchema = undefined) {
|
|
this.entityViewSchema = entityViewSchema;
|
|
},
|
|
activeEntityViewSchemaSetter(activeEntityViewSchema = undefined) {
|
|
this.activeEntityViewSchema = activeEntityViewSchema;
|
|
},
|
|
qruleActiveTabSetter(qruleActiveTab = undefined) {
|
|
this.qruleActiveTab = qruleActiveTab;
|
|
},
|
|
qruleSchemaSetter(qruleSchema = undefined) {
|
|
this.qruleSchema = qruleSchema;
|
|
},
|
|
qruleActiveSchemaSetter(qruleActiveSchema = undefined) {
|
|
this.qruleActiveSchema = qruleActiveSchema;
|
|
},
|
|
diffTypeSetter(diffType) {
|
|
this.diffType = diffType;
|
|
},
|
|
|
|
SET_ITEM_ENTITY(item) {
|
|
this.selectedItemEntity = item;
|
|
},
|
|
SET_LIST_ENTITY(list) {
|
|
this.listEntity = list;
|
|
},
|
|
SET_FONT(fontSize) {
|
|
this.fontSize = fontSize;
|
|
},
|
|
// SET_QUERY( queryParams) {
|
|
// this.queryParams = queryParams;
|
|
// },
|
|
SET_ITEM_LIST_SELECTED_ID(itemListIdSelected) {
|
|
this.itemListIdSelected = itemListIdSelected;
|
|
},
|
|
SET_STATUS_BUTTON(statusButton) {
|
|
this.statusButton = statusButton;
|
|
},
|
|
SET_STATUS_ENTITY_VIEWPAGE(statusEntityViewPage) {
|
|
this.statusEntityViewPage = statusEntityViewPage;
|
|
},
|
|
SET_STATUS_REMOVE_CHECKBOX(statusRemovCheckBox) {
|
|
this.statusRemovCheckBox = statusRemovCheckBox;
|
|
},
|
|
SET_TEXT_STEPS(textSteps) {
|
|
this.textSteps = textSteps;
|
|
},
|
|
SET_SHOW_SIDEBAR(showSidebar) {
|
|
this.showSidebar = showSidebar;
|
|
},
|
|
SET_REQUEST_SIMILAR(requestSimilar) {
|
|
this.requestSimilar = requestSimilar;
|
|
},
|
|
SET_NEW_SIMILAR(newSimilar) {
|
|
this.newSimilar = newSimilar;
|
|
},
|
|
selectedTextSetter(selectedText) {
|
|
this.selectedText = selectedText;
|
|
},
|
|
SET_SHOW_MODAL(showModal) {
|
|
this.showModal = showModal;
|
|
},
|
|
SET_CHANGE_PAG_FOR_FISH(changePagForFish) {
|
|
this.changePagForFish = changePagForFish;
|
|
},
|
|
itemEditForFishSetter(itemEditForFish) {
|
|
this.itemEditForFish = itemEditForFish;
|
|
},
|
|
fishActionsSetter(fishActions) {
|
|
this.fishActions = fishActions;
|
|
},
|
|
annotationActionsSetter(annotationActions) {
|
|
this.annotationActions = annotationActions;
|
|
},
|
|
itemEditForAnnotationSetter(itemEditForAnnotation) {
|
|
this.itemEditForAnnotation = itemEditForAnnotation;
|
|
},
|
|
showModalAnnotationSetter(showModalAnnotation) {
|
|
this.showModalAnnotation = showModalAnnotation;
|
|
},
|
|
similarInfoSetter(similarInfo) {
|
|
this.similarInfo = similarInfo;
|
|
},
|
|
listHighlightTextSetter(listHighlightText) {
|
|
// this.listHighlightText = listHighlightText;
|
|
// if (!this.listHighlightText.includes(listHighlightText)) {
|
|
// this.listHighlightText.push(listHighlightText);
|
|
// }
|
|
const exists = this.listHighlightText.some(
|
|
(item) => item.text === listHighlightText.text
|
|
);
|
|
|
|
if (!exists) {
|
|
this.listHighlightText.push(listHighlightText);
|
|
}
|
|
},
|
|
removeHighlightTextSetter(listHighlightText) {
|
|
this.listHighlightText = this.listHighlightText.filter(
|
|
(item) => item.text !== listHighlightText.text
|
|
);
|
|
},
|
|
toggleShowHighlightSetter(newState) {
|
|
this.listHighlightText.forEach((item) => (item.show = newState));
|
|
},
|
|
activeResearchTypeSetter(activeResearchType) {
|
|
this.activeResearchType = activeResearchType;
|
|
},
|
|
isReadingModeSetter(isReadingMode) {
|
|
this.isReadingMode = isReadingMode;
|
|
},
|
|
},
|
|
});
|
|
// export default {
|
|
// namespaced:true,
|
|
|
|
// state,
|
|
// actions,
|
|
// mutations,
|
|
// getters
|
|
// };
|