@topvisor/ui 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/dialog_selectorRegions-D9DQxYlD.amd.js +2 -0
- package/.chunks/dialog_selectorRegions-D9DQxYlD.amd.js.map +1 -0
- package/.chunks/dialog_selectorRegions-kjMlLJUX.es.js +186 -0
- package/.chunks/dialog_selectorRegions-kjMlLJUX.es.js.map +1 -0
- package/assets/project.css +1 -1
- package/icomoon/Topvisor icons.json +226 -41
- package/icomoon/demo.html +364 -252
- package/icomoon/fonts/Topvisor-2.eot +0 -0
- package/icomoon/fonts/Topvisor-2.svg +9 -1
- package/icomoon/fonts/Topvisor-2.ttf +0 -0
- package/icomoon/fonts/Topvisor-2.woff +0 -0
- package/icomoon/selection.json +1 -1
- package/icomoon/style.css +29 -5
- package/package.json +7 -7
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +1 -1
- package/project/project.js.map +1 -1
- package/utils/string.amd.js +1 -1
- package/utils/string.amd.js.map +1 -1
- package/utils/string.js +9 -9
- package/utils/string.js.map +1 -1
- package/.chunks/dialog_selectorRegions-B09GIvNe.amd.js +0 -2
- package/.chunks/dialog_selectorRegions-B09GIvNe.amd.js.map +0 -1
- package/.chunks/dialog_selectorRegions-BgrX75Zl.es.js +0 -181
- package/.chunks/dialog_selectorRegions-BgrX75Zl.es.js.map +0 -1
package/project/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sources":["../../src/components/project/selectorCompetitors/selectorCompetitors.vue","../../src/components/project/selectorRegion/utils/consts.ts","../../src/components/project/selectorRegion/utils/utils.ts","../../src/components/project/selectorRegion/composables/selectSearcher.ts","../../src/components/project/selectorRegion/composables/selectRegion.ts","../../src/components/project/selectorRegion/composables/compare.ts","../../src/components/project/selectorRegion/composables/selectorRegion.ts","../../src/components/project/selectorRegion/selectorRegion.vue","../../src/components/project/tagSelector/tagsDefaults.ts","../../src/components/project/tagSelector/utils/utils.ts","../../src/components/project/tagSelector/popupListItem/tagPopupListItem.vue","../../src/components/project/tagSelector/popupOpener/popupOpener.vue","../../src/components/project/tagSelector/tagSelector.vue","../../src/components/project/selectorCompetitors/composables.ts","../../src/components/project/tagSelector/utils/el.ts","../../src/components/project/project.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Props } from './selectorCompetitors';\nimport Core from '@/core/core/core';\nimport Button from '@/components/forms/button/button.vue';\nimport Popup from '@/components/popup/popup/popup.vue';\nimport ListItem from '@/components/popup/popup/listItem.vue';\nimport Menu from '@/components/formsExt/menu/menu.vue';\nimport { useI18n } from '@/core/plugins/i18n';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowSelectAllItem: true,\n});\nconst model = defineModel<Props['modelValue']>();\n\nconst selectAllItem = computed(() => {\n\tif (props.showSelectAllItem) {\n\t\treturn {\n\t\t\ticon: '',\n\t\t\ttitle: useI18n().Common.Select_all,\n\t\t\tvalue: 'all',\n\t\t\tcontent: '',\n\t\t};\n\t}\n});\n</script>\n\n<template>\n\t<div class=\"top-selectorCompetitors\">\n\t\t<Popup v-if=\"Core.state.isMobile\">\n\t\t\t<template #opener>\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-selectorCompetitors_opener\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\ticon=\"\"\n\t\t\t\t\ticon2=\"\"\n\t\t\t\t>\n\t\t\t\t\t{{ items.find((item) => item.value === model?.[0])?.content }}\n\t\t\t\t</Button>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<ListItem\n\t\t\t\t\tv-for=\"(item, index) in items\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'top-active': model?.includes(item.value)\n\t\t\t\t\t}\"\n\t\t\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t\t\t:title=\"item.title\"\n\t\t\t\t\t@click=\"() => model = [item.value]\"\n\t\t\t\t>\n\t\t\t\t\t<span class=\"top-ellipsis1\">\n\t\t\t\t\t\t{{ item.content }}\n\t\t\t\t\t</span>\n\t\t\t\t</ListItem>\n\t\t\t</template>\n\t\t</Popup>\n\n\t\t<Menu\n\t\t\tv-else\n\t\t\tv-model=\"model\"\n\t\t\t:items=\"items\"\n\t\t\t:isMultiple=\"true\"\n\t\t\tstyling=\"bar\"\n\t\t\t:canBeEmptyMultiple=\"false\"\n\t\t\t:selectAllItem=\"selectAllItem\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-selectorCompetitors_opener.top-button {\n\twidth: 100%;\n}\n</style>\n","import type { Region, SearcherIndexed } from '../selectorRegion';\nimport { useI18n } from '@/core/plugins/i18n';\n\n/**\n * Ключ ПС - для выбора нескольких ПС или регионов\n */\nexport const searhcerCompareKey = -1;\n\n/**\n * Ключ ПС или индекса Региона, используется для ПС или Региона, не настроенных в проекте\n *\n * Также, используется для API с возможностью не указывать регион, см. `props.autoRegion`\n */\nexport const dummyIndex = -2;\n\n/**\n * Регион - без региона\n */\nexport const globalRegionIndex = -1;\n\nexport const searchersNames = {\n\t0: 'Yandex',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GoogleStore',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n};\n\nexport const regionUndefined: Region = {\n\tkey: dummyIndex,\n\tname: '--',\n\tindex: dummyIndex,\n};\n\nexport const searcherUndefined: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: '--',\n\tregions: [regionUndefined],\n\tregionByIndex: new Map([[dummyIndex, regionUndefined]]),\n};\n\nconst regionAuto: Region = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tindex: dummyIndex,\n};\n\nconst searcherAuto: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tregions: [regionAuto],\n\tregionByIndex: new Map([[dummyIndex, regionAuto]]),\n};\n\nconst regionGlobal: Region = {\n\tcountryCode: '00',\n\tdepth: 1,\n\tdevice: 0,\n\tkey: globalRegionIndex,\n\tindex: globalRegionIndex,\n\tlang: 'ru',\n\tname: 'Without region',\n};\n\nexport const getRegionAuto = () => {\n\tregionAuto.name = useI18n().Common.Autoselect!;\n\n\treturn regionAuto;\n};\n\nexport const getSearcherAuto = () => {\n\tgetRegionAuto();\n\n\tsearcherAuto.name = useI18n().Common.Autoselect!;\n\tconsole.log(searcherAuto);\n\n\treturn searcherAuto;\n};\n\nexport const getRegionGlobal = () => {\n\tregionGlobal.name = useI18n().Keywords.Without_region!;\n\n\treturn regionGlobal;\n};\n","import type { Region, Searcher, SearcherByKey, SearcherIndexed } from '../selectorRegion';\nimport { dummyIndex, getRegionGlobal, getSearcherAuto, regionUndefined, searchersNames, searcherUndefined } from './consts';\nimport { useAsyncTopDialog } from '@/components/dialog/dialog/composables/utils';\n\n/**\n * Генерация Map ПС с Map регионов из массива searchers\n * - ключ для ПС - searcherKey\n * - ключ для региона - regionIndex\n *\n * Если поисковиков в списке нет, в список будет добавлен searcherUndefined\n *\n * Если регионов в списке нет, в список будет добавлен regionUndefined\n *\n * @param forFrequency - получить массив для просмотра частоты (или ставок)\n * @param autoRegion - добавить элемент с ключем -2, который в API заменяется на нужный ключ в зависимости от контекста\n * @param searchers - поисковики с регионами проекта, см.: get/projects_2/projects, show_searchers_and_regions = 1\n */\nexport const genSearcherByKey = (\n\tforFrequency: boolean = false,\n\tautoRegion: boolean = false,\n\tsearchers: Searcher[] = [],\n) => {\n\tlet searcherByKey: SearcherByKey;\n\n\tif (forFrequency) {\n\t\tsearcherByKey = genSearchersMapVolume(searchers);\n\t} else {\n\t\tsearcherByKey = genSearchersMapCommon(searchers);\n\t}\n\n\tif (autoRegion) searcherByKey.set(dummyIndex, getSearcherAuto());\n\tif (!searcherByKey.size) searcherByKey.set(dummyIndex, searcherUndefined);\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами\n *\n * @param searchers\n * @param onlyEnabledRegions\n * @param forceSearchersKeys - ключи ПС, которые нееобходимо вывести в любом случае\n * @param forFrequency - для частоты будут выводиться только Яндекс, Google и Mail\n */\nconst genSearchersMapCommon = (\n\tsearchers: Searcher[],\n\tonlyEnabledRegions: boolean = true,\n\tforceSearchersKeys: Searcher['key'][] = [],\n\tforFrequency: boolean = false,\n) => {\n\tconst searcherByKey: Map<Searcher['key'], SearcherIndexed> = new Map();\n\n\t// настроенные ПС\n\tsearchers.forEach((searcher) => {\n\t\tif (!searcher.enabled) return;\n\t\tif (forFrequency && typeof searcher.key === 'number' && searcher.key > 1) return;\n\n\t\tconst searcherI = { ...searcher } as SearcherIndexed;\n\t\tsearcherI.regionByIndex = new Map();\n\n\t\tif (searcher.regions) {\n\t\t\tsearcher.regions.forEach((region: Region) => {\n\t\t\t\tif (onlyEnabledRegions && !region.enabled) return;\n\n\t\t\t\tconst regionI = { ...region };\n\t\t\t\tsearcherI.regionByIndex.set(regionI.index, regionI);\n\t\t\t});\n\t\t}\n\n\t\tif (!searcherI.regionByIndex.size && !forceSearchersKeys.length) {\n\t\t\t// searcherI.regionByIndex.set(regionUndefined.index, regionUndefined);\n\t\t}\n\n\t\tif (\n\t\t\t// режим вывода ПС без регионов\n\t\t\t!searcher.regions ||\n\n\t\t\t// есть включенные регионы\n\t\t\tsearcherI.regionByIndex.size ||\n\n\t\t\t// запрошен вывод конкретных ПС\n\t\t\tforceSearchersKeys.length\n\t\t) {\n\t\t\tif (typeof searcherI.key === 'number') searcherByKey.set(searcherI.key, searcherI);\n\t\t}\n\t});\n\n\t// дополнительные ПС\n\tforceSearchersKeys.forEach((searcherKey) => {\n\t\tif (searcherByKey.has(searcherKey)) return;\n\n\t\tconst searcherI: SearcherIndexed = {\n\t\t\tkey: searcherKey,\n\t\t\tname: searchersNames[searcherKey],\n\t\t\tregions: [],\n\t\t\tregionByIndex: new Map(),\n\t\t};\n\n\t\tsearcherByKey.set(searcherI.key, searcherI);\n\t});\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами для проверки частоты (Яндекс, Google, Mail если добавлен в проект)\n *\n * @param searchers\n */\nconst genSearchersMapVolume = (searchers: Searcher[]) => {\n\tconst serarcherByKey = genSearchersMapCommon(searchers, false, [0, 1], true);\n\n\t// в Mail нет регионов\n\tif (serarcherByKey.has(2)) {\n\t\tconst searcherMail = serarcherByKey.get(2);\n\t\tif (searcherMail) searcherMail.regionByIndex = new Map();\n\t}\n\n\t// добавление глобального региона\n\tserarcherByKey.forEach((searcher) => {\n\t\tif (!searcher.regionByIndex) return;\n\n\t\tconst region = { ...getRegionGlobal() };\n\t\tsearcher.regionByIndex.set(region.index, region);\n\t});\n\n\treturn serarcherByKey;\n};\n\n/**\n * Поиск региона по заданному критерию из списка поисковиков проекта\n *\n * @param forFrequency - поиск региона для просмотра частоты или ставок\n * @param searchRegion - объект с параметрами региона, который следует найти\n * @param searchers\n */\nexport const findRegion = (forFrequency: boolean, searchRegion: Partial<Region>, searchers: Searcher[] = []) => {\n\tconst searcherByKey = genSearcherByKey(forFrequency, false, searchers);\n\n\tlet findedRegion: Region | undefined;\n\n\t// поиск ПС\n\tsearcherByKey.forEach((searcher) => {\n\t\tif (searchRegion.searcher_key !== undefined && searchRegion.searcher_key != searcher.key) return;\n\t\tif (!searcher.regions) return;\n\n\t\t// поиск региона\n\t\tsearcher.regions.forEach((region) => {\n\t\t\tif (findedRegion) return;\n\n\t\t\tif (searchRegion.key !== undefined && searchRegion.key != region.key) return;\n\t\t\tif (searchRegion.index !== undefined && searchRegion.index != region.index) return;\n\n\t\t\tif (!forFrequency) {\n\t\t\t\tif (searchRegion.lang !== undefined && searchRegion.lang != region.lang) return;\n\t\t\t\tif (searchRegion.device !== undefined && searchRegion.device != region.device) return;\n\t\t\t}\n\n\t\t\tregion.searcher_key = searcher.key;\n\t\t\tfindedRegion = region;\n\n\t\t\treturn false;\n\t\t});\n\n\t\tif (findedRegion) return false;\n\t});\n\n\treturn findedRegion;\n};\n\n/**\n * Открыть диалоговое окно с выбором нескольких регионов\n *\n * @see import('../dialog_selectorRegions/types').Props\n */\nexport const dialogSelectorRegions = useAsyncTopDialog(() => {\n\treturn import('@/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue');\n});\n","import { computed, type ComputedRef, ref } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport type { Props, SearcherByKey } from '../selectorRegion';\nimport type { Option, Options } from '@/components/forms/select/select';\nimport { dummyIndex, searhcerCompareKey } from '../utils/consts';\nimport { getSearcherGIcon } from '@/core/utils/searchers';\n\n/**\n * Создание и управление реактивными переменными для выбора ПС\n *\n * @param props - входные props компонента\n * @param mapSearchers - Map ПС (реактивная)\n */\nexport const useSelectSearcher = (\n\tprops: Props,\n\tmapSearchers: ComputedRef<SearcherByKey>,\n) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Ключ выбранной поисковой системы\n\t */\n\tconst searcherKey = ref(mapSearchers.value.keys().next().value ?? dummyIndex);\n\n\t/**\n\t * Коллекция опций для выбора ПС\n\t */\n\tconst optionBySearcherKey = computed(() => {\n\t\tconst res: Options = new Map();\n\t\tmapSearchers.value.forEach((searcher) => {\n\t\t\tlet option: Option = {\n\t\t\t\tvalue: searcher.key,\n\t\t\t\ttitle: searcher.name,\n\t\t\t};\n\n\t\t\tif (props.addSearcherIcon) option.icon = getSearcherGIcon(searcher.key);\n\n\t\t\tres.set(searcher.key, option);\n\t\t});\n\n\t\t// добавить режим сравнения, если есть хотя бы одна ПС с одним регионом\n\t\tif (props.addCompare && !res.has(dummyIndex)) {\n\t\t\tconst dummyOption: Option = {\n\t\t\t\tvalue: '',\n\t\t\t\ttitle: '--------------------',\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t\tres.set(dummyOption.value, dummyOption);\n\n\t\t\tconst compareOption: Option = {\n\t\t\t\tvalue: searhcerCompareKey,\n\t\t\t\ttitle: i18n.Common.Compare!,\n\t\t\t};\n\t\t\tres.set(compareOption.value, compareOption);\n\t\t}\n\n\t\treturn res;\n\t});\n\n\treturn {\n\t\tsearcherKey,\n\t\toptionBySearcherKey,\n\t};\n};\n","import { computed, type ComputedRef, ref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { getDeviceGIcon, getLangLabel } from '@/core/utils/searchers';\nimport type { Option } from '@/components/forms/select/select';\nimport { dummyIndex } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для выбора региона\n *\n * @param props - входные props компонента\n * @param activeSearcherIndexed - объект активной поисковой системы (реактивная)\n * @param regionsIndexes - входные индексы регионов/ПС\n */\nexport const useSelectRegion = (props: Props, activeSearcherIndexed: ComputedRef<SearcherIndexed>) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Индекс выбранного региона\n\t */\n\tconst regionIndex = ref(dummyIndex);\n\n\tif (props.modelValue.length === 1) {\n\t\tregionIndex.value = props.modelValue[0];\n\t}\n\n\tif (regionIndex.value === dummyIndex) {\n\t\tif (props.forFrequency) {\n\t\t\t// в качетсве ключа используется region.key, а не region.index\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.values().next().value?.key ?? dummyIndex;\n\t\t} else {\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.keys().next().value ?? dummyIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Коллекция опций для выбора региона\n\t */\n\tconst optionByRegionIndex = computed(() => {\n\t\tconst options = new Map<number, Option>();\n\n\t\tactiveSearcherIndexed.value.regionByIndex?.forEach((region) => {\n\t\t\tlet regionLabel = region.name;\n\n\t\t\t// на частоту в текущей версии устройство и язык не влияют\n\t\t\t// обратите внимание, в качетсве ключа используется region.key, а не region.index\n\t\t\tif (props.forFrequency) {\n\t\t\t\tconst option: Option = {\n\t\t\t\t\tvalue: region.key,\n\t\t\t\t\ttitle: regionLabel,\n\t\t\t\t};\n\t\t\t\tif (!options.has(region.key)) options.set(region.key, option);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (region.device) {\n\t\t\t\tregionLabel += ' (' + i18n.Common['Device_' + region.device] + ')';\n\t\t\t}\n\n\t\t\tconst langLabel = getLangLabel(activeSearcherIndexed.value.key || 0, region.lang ?? '');\n\t\t\tif (langLabel) regionLabel += ' / ' + langLabel;\n\n\t\t\tconst option: Option = {\n\t\t\t\tvalue: region.index,\n\t\t\t\ttitle: regionLabel,\n\t\t\t\ticon: region.device ? getDeviceGIcon(region.device) : undefined,\n\t\t\t};\n\n\t\t\toptions.set(region.index, option);\n\t\t});\n\n\t\treturn options;\n\t});\n\n\t/**\n\t * Выбор максимально похожего региона в новой коллекции регионов\n\t */\n\twatch(optionByRegionIndex, (optionByRegionIndex, oldOptionByRegionIndex) => {\n\t\tif (props.onlySearcher || regionIndex.value !== undefined && optionByRegionIndex.get(regionIndex.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet newRegionIndex = optionByRegionIndex.keys().next().value as Region['index'];\n\t\tif (regionIndex.value === dummyIndex || newRegionIndex === dummyIndex) {\n\t\t\tregionIndex.value = newRegionIndex;\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionName = (oldOptionByRegionIndex?.get(regionIndex.value) as Option)?.title || '';\n\t\tlet regionMatchLevel = -1;\n\t\tfor (const [index, option] of optionByRegionIndex.entries()) {\n\t\t\tconst title = (option as Option).title;\n\n\t\t\tif (typeof title !== 'string' || typeof index === 'string') {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// полное совпадение\n\t\t\tif (title === regionName) {\n\t\t\t\tnewRegionIndex = index;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst regexpDevice = new RegExp(` \\\\((${i18n.Common['Device_1']}|${i18n.Common['Device_2']})\\\\)`);\n\t\t\tlet regionNameCompare = regionName;\n\t\t\tlet regionMatchLevelI = 3;\n\n\t\t\t// без устройства\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без устройства и без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\t\t\t\tregionNameCompare = regionNameCompare.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\tif (title.indexOf(regionNameCompare) === -1) continue;\n\t\t\tif (regionMatchLevelI <= regionMatchLevel) continue;\n\n\t\t\tregionMatchLevel = regionMatchLevelI;\n\t\t\tnewRegionIndex = index;\n\t\t}\n\n\t\tregionIndex.value = newRegionIndex;\n\t});\n\n\treturn {\n\t\tregionIndex,\n\t\toptionByRegionIndex,\n\t};\n};\n","import { type ComputedRef, ref, watch } from 'vue';\nimport type { Props, SearcherByKey } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для сравнения\n *\n * @param props - входные props компонента\n * @param searcherByKey - Map ПС (реактивная)\n * @param allRegionsIndexes - Все доступные индексы регионов (реактивная)\n */\nexport const useCompare = (props: Props, searcherByKey: ComputedRef<SearcherByKey>, allRegionsIndexes: ComputedRef<Set<number>>) => {\n\t/**\n\t * Индексы регионов/ПС в сравнение\n\t */\n\tconst regionsIndexes = ref<number[]>([]);\n\n\t/**\n\t * Загрузка индексов регионов для сравнения\n\t *\n\t * Если в modelValue передано несколько регионов, они будут установлены как выбранные для сравнения\n\t */\n\tconst compareLoad = () => {\n\t\tif (props.onlySearcher && searcherByKey.value) {\n\t\t\tregionsIndexes.value = Array.from(searcherByKey.value.keys());\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionsIndexesSaved: Props['modelValue'] = [];\n\n\t\tif (props.modelValue.length > 1) {\n\t\t\tregionsIndexesSaved = [...props.modelValue];\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t// загрузить индексы регионов, если они были сохранены\n\t\t\t\tregionsIndexesSaved = JSON.parse(\n\t\t\t\t\tlocalStorage.getItem('ui:project:regionSelector' + props.projectId + ':regionsIndexes') as string,\n\t\t\t\t) ?? [];\n\t\t\t} catch (e) {\n\n\t\t\t}\n\t\t}\n\n\t\t// убрать из сравнения регионы, которых нет в props.searchers\n\t\tif (regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = regionsIndexesSaved.filter((regionIndex) => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\t// если не сохранено ни одного региона, выбрать все регионы проекта\n\t\tif (!regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = Array.from(allRegionsIndexes.value);\n\t\t}\n\n\t\tregionsIndexes.value = [...regionsIndexesSaved];\n\t};\n\n\t/**\n\t * Сохранение выбранных регионов\n\t */\n\tconst compareSave = () => {\n\t\tif (regionsIndexes.value.length) {\n\t\t\tlocalStorage.setItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes', JSON.stringify(regionsIndexes.value));\n\t\t} else {\n\t\t\tlocalStorage.removeItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes');\n\t\t}\n\t};\n\n\twatch(regionsIndexes, () => {\n\t\tcompareSave();\n\t});\n\n\tif (props.addCompare) {\n\t\t// if (props.compareRegionsIndexes?.length) {\n\t\t// \tcompareRegionsIndexes.value = [...props.compareRegionsIndexes];\n\t\t// } else {\n\t\t// \tcompareLoad();\n\t\t// }\n\n\t\tcompareLoad();\n\t}\n\n\treturn {\n\t\tregionsIndexes,\n\t};\n};\n","import { computed, watch } from 'vue';\nimport { findRegion, genSearcherByKey } from '../utils/utils';\nimport { dummyIndex, globalRegionIndex, searcherUndefined, searhcerCompareKey } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\nimport { useSelectSearcher } from './selectSearcher';\nimport { useSelectRegion } from './selectRegion';\nimport { useCompare } from './compare';\n\n/**\n * Создание и управления рективными переменными компонента\n *\n * @param props - входные props компонента\n */\nexport const useSelectorRegion = (props: Props) => {\n\tconst searcherByKey = computed(() => {\n\t\treturn genSearcherByKey(props.forFrequency, props.autoRegion, props.searchers);\n\t});\n\n\tconst activeSearcherIndexed = computed(() => {\n\t\treturn searcherByKey.value.get(selectSearcher.searcherKey.value) || searcherUndefined;\n\t});\n\n\t/**\n\t * Все индексы регионов из searcherByKey\n\t *\n\t * Активность регионов определяется в searcherByKey\n\t */\n\tconst allRegionsIndexes = computed(() => {\n\t\tconst regionsIndexes = new Set<number>();\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\tsearcher.regionByIndex.forEach((region) => {\n\t\t\t\tif (region.index === globalRegionIndex) return;\n\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\tregionsIndexes.add(region.index);\n\t\t\t});\n\t\t});\n\n\t\treturn regionsIndexes;\n\t});\n\n\tconst selectSearcher = useSelectSearcher(props, searcherByKey);\n\tconst selectRegion = useSelectRegion(props, activeSearcherIndexed);\n\tconst compare = useCompare(props, searcherByKey, allRegionsIndexes);\n\n\t// контроль за внешним изменением списка ПС\n\twatch(searcherByKey, () => {\n\t\t// возможные значения для сравнения регионов/пс\n\t\tif (props.onlySearcher) {\n\t\t\tcompare.regionsIndexes.value = Array.from(searcherByKey.value.keys());\n\t\t} else {\n\t\t\tcompare.regionsIndexes.value = compare.regionsIndexes.value.filter(regionIndex => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\tif (selectSearcher.searcherKey.value === searhcerCompareKey) return;\n\n\t\tlet newSearcherKey = searcherByKey.value.keys().next().value;\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t// определить выбранную ПС\n\t\t\tif (props.onlySearcher && searcher.key === selectSearcher.searcherKey.value) {\n\t\t\t\tnewSearcherKey = selectSearcher.searcherKey.value;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tselectRegion.regionIndex.value &&\n\t\t\t\tsearcher.regionByIndex?.has(selectRegion.regionIndex.value)\n\t\t\t) {\n\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t}\n\n\t\t\t// выбрать первую ПС с выбранным регионом\n\t\t\tif (!props.onlySearcher) {\n\t\t\t\tlet regionsNewSearcher: SearcherIndexed['regionByIndex'] | undefined;\n\n\t\t\t\tif (newSearcherKey !== undefined) {\n\t\t\t\t\tregionsNewSearcher = searcherByKey.value.get(newSearcherKey)?.regionByIndex;\n\t\t\t\t}\n\n\t\t\t\tconst regionsCurrentSearcher = searcherByKey.value.get(searcher.key)?.regionByIndex;\n\t\t\t\tif (\n\t\t\t\t\tregionsNewSearcher?.has(dummyIndex) &&\n\t\t\t\t\t!regionsCurrentSearcher?.has(dummyIndex)\n\t\t\t\t) {\n\t\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// if (props.addCompare && !selectSearcher.optionBySearcherKey.value.has(dummyIndex)) {\n\t\t// \tif (!selectRegion.regionIndex.value && compare.regionsIndexes.value?.length) newSearcherKey = searhcerCompareKey;\n\t\t// }\n\n\t\t// if (props.onlySearcher && selectRegion.regionIndex.value !== dummyIndex) newSearcherKey = selectRegion.regionIndex.value;\n\n\t\tif (newSearcherKey !== undefined) {\n\t\t\tselectSearcher.searcherKey.value = newSearcherKey;\n\t\t}\n\n\t\tif (\n\t\t\tselectRegion.regionIndex.value !== undefined &&\n\t\t\t!(activeSearcherIndexed.value?.regionByIndex)?.has(selectRegion.regionIndex.value)\n\t\t) {\n\t\t\tselectRegion.regionIndex.value = activeSearcherIndexed.value?.regions?.keys().next().value as number;\n\t\t}\n\t}, { immediate: true });\n\n\tconst getSearcherKey = () => {\n\t\tif (selectSearcher.searcherKey.value === searhcerCompareKey || selectSearcher.searcherKey.value === dummyIndex) return;\n\n\t\treturn selectSearcher.searcherKey.value;\n\t};\n\n\tconst getRegionIndex = () => {\n\t\tif (props.onlySearcher) return;\n\n\t\tif (selectRegion.regionIndex.value === dummyIndex) return;\n\n\t\tlet res: Region['index'] | undefined = selectRegion.regionIndex.value;\n\n\t\t// в качестве ключа используется region.key\n\t\tif (props.forFrequency) {\n\t\t\tconst regionKey = selectRegion.regionIndex.value;\n\t\t\tconst region = findRegion(props.forFrequency, { searcher_key: getSearcherKey(), key: regionKey } as Region, props.searchers);\n\n\t\t\tres = region?.index;\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Получить выбранную ПС\n\t */\n\tconst getSearcher = () => {\n\t\tconst searcherKey = getSearcherKey();\n\t\tif (searcherKey === undefined) return;\n\n\t\treturn searcherByKey.value.get(searcherKey);\n\t};\n\n\t/**\n\t * Получить выбранный регион\n\t */\n\tconst getRegion = () => {\n\t\tconst regionIndex = getRegionIndex();\n\t\tif (regionIndex === undefined) return;\n\n\t\treturn getSearcher()?.regionByIndex?.get(regionIndex);\n\t};\n\n\treturn {\n\t\tselectSearcher,\n\t\tselectRegion,\n\t\tcompare,\n\n\t\tsearcherByKey,\n\t\tallRegionsIndexes,\n\n\t\tgetSearcher,\n\t\tgetRegion,\n\t};\n};\n","<script setup lang=\"ts\">\nimport { watch } from 'vue';\nimport type { Props, Region } from './selectorRegion';\nimport Select from '@/components/forms/select/select.vue';\nimport Button from '@/components/forms/button/button.vue';\nimport { useSelectorRegion } from './composables/selectorRegion';\nimport { dummyIndex, globalRegionIndex, searhcerCompareKey } from './utils/consts';\nimport { dialogSelectorRegions } from '@/components/project/selectorRegion/utils/utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsearchers: () => [],\n\t// compareRegionsIndexes: () => [],\n\taddSearcherIcon: true,\n\taddRegionIcon: true,\n\taddChanger: true,\n});\n\nconst model = defineModel<Props['modelValue']>({ required: true });\nconst modelSingle = defineModel<Props['modelValueSingle']>('modelValueSingle');\n\nconst {\n\tselectSearcher,\n\tselectRegion,\n\tcompare,\n\n\tsearcherByKey,\n\tallRegionsIndexes,\n\n\tgetSearcher,\n\tgetRegion,\n} = useSelectorRegion(props);\n\nconst onClickCompare = () => {\n\tconst regions: Region[] = [];\n\n\tsearcherByKey.value.forEach((searcher) => {\n\t\tif (!searcher.enabled) return;\n\n\t\tsearcher.regions.forEach((region) => {\n\t\t\tif (!region.enabled) return;\n\n\t\t\tregions.push(region);\n\t\t});\n\t});\n\n\tdialogSelectorRegions.open('selectorRegions', {\n\t\tregions,\n\t\tregionsIndexes: compare.regionsIndexes.value,\n\t\t'@update:regionsIndexes': (regionsIndexes: number[]) => compare.regionsIndexes.value = regionsIndexes,\n\t});\n};\n\nwatch([selectRegion.regionIndex, selectSearcher.searcherKey, compare.regionsIndexes], () => {\n\tif (selectSearcher.searcherKey.value === searhcerCompareKey && compare.regionsIndexes.value.length) {\n\t\tif (JSON.stringify(model.value) === JSON.stringify(compare.regionsIndexes.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tmodel.value = [...compare.regionsIndexes.value];\n\t} else {\n\t\tif (props.onlySearcher) {\n\t\t\tmodel.value = [selectSearcher.searcherKey.value];\n\n\t\t\tif (selectSearcher.searcherKey.value === dummyIndex && !props.autoRegion) model.value.length = 0;\n\t\t} else {\n\t\t\tmodel.value = [selectRegion.regionIndex.value];\n\n\t\t\t// не добавлять несуществующий регион в результаты\n\t\t\tif (selectRegion.regionIndex.value === dummyIndex && !props.autoRegion) model.value.length = 0;\n\t\t}\n\t}\n\n\t// регионов нет\n\tif (!props.onlySearcher && !allRegionsIndexes.value.size) {\n\t\tselectSearcher.searcherKey.value = dummyIndex;\n\t}\n});\n\nif (modelSingle.value) {\n\twatch(modelSingle, () => {\n\t\tif (modelSingle.value) {\n\t\t\tmodel.value = [modelSingle.value];\n\t\t}\n\t}, { immediate: true });\n}\n\nwatch(model, () => {\n\tif (model.value[0]) {\n\t\tmodelSingle.value = model.value[0];\n\t}\n\n\t// проверка входных данных v-model на корректность\n\tif (props.onlySearcher) {\n\t\tif (\n\t\t\t!model.value.length ||\n\t\t\tmodel.value.length === 1 && !searcherByKey.value.has(model.value[0]) ||\n\t\t\tmodel.value.length === 1 && model.value[0] === dummyIndex && !props.autoRegion\n\t\t) {\n\t\t\tlet defaultKey: number | undefined = searcherByKey.value.keys().next().value;\n\n\t\t\t// запретить устанавливать несуществующий регион\n\t\t\tif (defaultKey === dummyIndex && !props.autoRegion) {\n\t\t\t\tdefaultKey = undefined;\n\n\t\t\t\tmodelSingle.value = dummyIndex;\n\t\t\t}\n\n\t\t\tif (defaultKey !== undefined) {\n\t\t\t\tmodel.value = [defaultKey];\n\t\t\t}else{\n\t\t\t\tmodel.value.length = 0;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tmodel.value.length > 1 &&\n\t\t\tJSON.stringify(model.value) !== JSON.stringify(compare.regionsIndexes.value)\n\t\t) {\n\t\t\tmodel.value = [...compare.regionsIndexes.value];\n\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\tlet newModel = [...new Set(model.value)];\n\n\t\tlet defaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.keys().next().value;\n\t\tif (props.forFrequency) {\n\t\t\tdefaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.values().next().value?.key;\n\t\t}\n\n\t\t// запретить устанавливать несуществующий регион\n\t\tif (defaultIndex === dummyIndex && !props.autoRegion) {\n\t\t\tdefaultIndex = undefined;\n\n\t\t\tmodelSingle.value = dummyIndex;\n\t\t}\n\n\t\tif (!newModel.length) {\n\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t} else if (newModel.length === 1) {\n\t\t\tlet all = allRegionsIndexes.value;\n\n\t\t\tif (props.forFrequency) {\n\t\t\t\tall = new Set();\n\t\t\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t\t\tsearcher.regionByIndex.forEach((region) => {\n\t\t\t\t\t\tif (region.index === globalRegionIndex) return;\n\t\t\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\t\t\tall.add(region.key);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// убрано, так как dummyIndex запрещено выбирать в model\n\t\t\t// if (!all.has(newModel[0]) && newModel[0] !== dummyIndex) {\n\t\t\tif (!all.has(newModel[0])) {\n\t\t\t\tnewModel = [];\n\t\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tnewModel = newModel.filter(index => allRegionsIndexes.value.has(index));\n\t\t\tif (!newModel.length && defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t}\n\n\t\tif (JSON.stringify(model.value) !== JSON.stringify(newModel)) {\n\t\t\tmodel.value = newModel;\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// входные данные v-model совпадают с внутренними значениями\n\tif (\n\t\tmodel.value.length === 1 &&\n\t\tmodel.value[0] === (props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value)\n\t) {\n\t\treturn;\n\t}\n\n\t// if (\n\t// \tmodel.value.length > 1 &&\n\t// \tselectorSearcher.searcherKey.value === searhcerCompareKey &&\n\t// \tJSON.stringify(model.value) === JSON.stringify(selectorCompare.regionsIndexes.value)\n\t// ) {\n\t// \treturn;\n\t// }\n\n\t// обновление regionIndex, searcherKey, selectorCompare.regionsIndexes\n\tif (props.onlySearcher) {\n\t\t// if (!model.value.length) {\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\n\t\t//\n\t\t// \treturn;\n\t\t// }\n\n\t\tif (model.value.length === 1) {\n\t\t\tselectSearcher.searcherKey.value = model.value[0];\n\n\t\t\treturn;\n\t\t}\n\n\t\tselectSearcher.searcherKey.value = searhcerCompareKey;\n\n\t\treturn;\n\t} else {\n\t\tif (!model.value.length) {\n\t\t\t// selectSearcher.searcherKey.value = dummyIndex;\n\t\t\t// selectRegion.regionIndex.value = dummyIndex;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (model.value.length === 1 && selectSearcher.searcherKey.value !== searhcerCompareKey) {\n\t\t\tselectRegion.regionIndex.value = model.value[0];\n\n\t\t\tlet newSearherKey: number | undefined;\n\t\t\tfor (const searcher of searcherByKey.value.values()) {\n\t\t\t\tfor (const region of searcher.regionByIndex.values()) {\n\t\t\t\t\tconst currentRegionIndex = props.forFrequency ? region.key : region.index;\n\t\t\t\t\tif (currentRegionIndex === selectRegion.regionIndex.value) {\n\t\t\t\t\t\tnewSearherKey = searcher.key;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\tselectSearcher.searcherKey.value = newSearherKey;\n\t\t\t}\n\t\t} else {\n\t\t\tselectSearcher.searcherKey.value = searhcerCompareKey;\n\t\t\tcompare.regionsIndexes.value = [...model.value];\n\t\t}\n\t}\n}, { immediate: true });\n\ndefineExpose({\n\tgetSearcher,\n\tgetRegion,\n});\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-selectorRegion': true,\n\t\t\t'top-selectorRegion-onlySearcher': onlySearcher,\n\t\t}\"\n\t>\n\t\t<Select\n\t\t\t:options=\"selectSearcher.optionBySearcherKey.value\"\n\t\t\tv-model=\"selectSearcher.searcherKey.value\"\n\t\t\tname=\"searcher_key\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t/>\n\n\t\t<Select\n\t\t\tv-if=\"!onlySearcher && selectSearcher.searcherKey.value !== searhcerCompareKey\"\n\t\t\tclass=\"top-select-region\"\n\t\t\t:options=\"selectRegion.optionByRegionIndex.value\"\n\t\t\tv-model=\"selectRegion.regionIndex.value\"\n\t\t\t:name=\"forFrequency ? 'region_key' : 'region_index'\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t\t:data-top-icon=\"addRegionIcon ? '' : undefined\"\n\t\t/>\n\n\t\t<Button\n\t\t\tv-if=\"addCompare && !onlySearcher && selectSearcher.searcherKey.value === searhcerCompareKey\"\n\t\t\tname=\"compare\"\n\t\t\t@click=\"onClickCompare\"\n\t\t\t:data-count-compare-regions-indexes=\"compare.regionsIndexes.value.length\"\n\t\t>\n\t\t\t{{ $i18n.Common.Selected_regions }}\n\t\t</Button>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/searcherColors.css\";\n\n.top-selectorRegion {\n\twidth: 320px;\n\tdisplay: inline-flex;\n\tvertical-align: middle;\n}\n\n.top-selectorRegion > .top-select {\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > .top-select:focus-within {\n\tz-index: 4;\n}\n\n.top-selectorRegion > .top-select > .top-select_select:hover,\n.top-selectorRegion > .top-select > .top-select_select.top-error {\n\tz-index: 1;\n}\n\n.top-selectorRegion > .top-select-searcher_key {\n\twidth: 120px;\n\tmax-width: 140px;\n\tmargin-right: -1px;\n}\n\n.top-selectorRegion > .top-select-region > select {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n}\n\n.top-selectorRegion > .top-select-region {\n\t--top-icon-size: 20px;\n\t--top-icon-color: var(--color-text-primary-1);\n\n\t--top-icon2-size: 20px;\n\t--top-icon2-color: var(--color-text-primary-1);\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2] {\n\t--top-icon2-size: 16px;\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2]:after {\n\ttext-indent: -4px;\n}\n\n.top-selectorRegion > [name=\"compare\"] {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > [name=\"compare\"]:after {\n\tcontent: \"(\" attr(data-count-compare-regions-indexes) \")\";\n\tmargin: 0 0 0 6px;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key > select {\n\tborder-top-right-radius: 0;\n\tborder-bottom-right-radius: 0;\n\tmargin-right: 0;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key[data-value=\"-1\"] > select {\n\tborder-right: none;\n}\n\n.top-selectorRegion-onlySearcher {\n\twidth: 120px;\n}\n</style>\n","import type { Tag } from './types';\n\nexport default [\n\t{\n\t\tid: '1',\n\t\tname: 'Without Tag',\n\t\tcolor_id: '1',\n\t},\n\t{\n\t\tid: '2',\n\t\tname: 'Red',\n\t\tcolor_id: '2',\n\t},\n\t{\n\t\tid: '3',\n\t\tname: 'Orange',\n\t\tcolor_id: '3',\n\t},\n\t{\n\t\tid: '4',\n\t\tname: 'Yellow',\n\t\tcolor_id: '4',\n\t},\n\t{\n\t\tid: '5',\n\t\tname: 'Blue',\n\t\tcolor_id: '5',\n\t},\n\t{\n\t\tid: '6',\n\t\tname: 'Purple',\n\t\tcolor_id: '6',\n\t},\n\t{\n\t\tid: '7',\n\t\tname: 'Green',\n\t\tcolor_id: '7',\n\t},\n\t{\n\t\tid: '8',\n\t\tname: 'Magenta',\n\t\tcolor_id: '8',\n\t},\n\t{\n\t\tid: '9',\n\t\tname: 'Dark blue',\n\t\tcolor_id: '9',\n\t},\n\t{\n\t\tid: '10',\n\t\tname: 'Turquoise',\n\t\tcolor_id: '10',\n\t},\n] as Tag[];\n","import type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Tag, TagIdExclude } from '../types';\n\n/**\n * Полуичить значение исключения тега tagId\n */\nexport const genTagIdExcluded = (tagId: Tag['id']): TagIdExclude => {\n\treturn '-' + tagId as TagIdExclude;\n};\n\n/**\n * Вернуть чистый tagId без exclude флага\n */\nexport const genTagIdClear = (tagId: Tag['id'] | TagIdExclude) => {\n\tif (tagId[0] === '-') return tagId.substring(1) as Tag['id'];\n\n\treturn tagId as Tag['id'];\n};\n\n/**\n * Получить инфомрацию о теге по его id\n */\nexport const getTagById = (tagId: Tag['id'] | TagIdExclude, tags: TagSelectorOpenerProps['tags']) => {\n\ttagId = genTagIdClear(tagId);\n\n\tconst tag = tags.find(tag => tag.id === tagId);\n\tif (!tag) return;\n\n\treturn tag;\n};\n","<script setup lang=\"ts\">\nimport { computed, nextTick, ref } from 'vue';\nimport type { Emits, Props } from './types';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\nimport TopPopupListItem from '@/components/popup/popup/listItem.vue';\n\nconst props = defineProps<Props>();\nconst emit = defineEmits<Emits>();\n\nconst name = defineModel<Props['name']>('name', {\n\trequired: true,\n});\n\nconst elName = ref<HTMLElement | null>(null);\n\n/**\n * @todo Удалить через пол года после выхода версии firefox с поддержкой contenteditable plaintext-only, включая бета версии\n */\nconst firefoxProps = computed(() => {\n\tif (navigator.userAgent.indexOf('Firefox') != -1) {\n\n\t\treturn {\n\t\t\tcontenteditable: inEdit.value,\n\t\t\tonpaste: (event: Event) => event.preventDefault(),\n\t\t};\n\t}\n\n\treturn {};\n});\n\n/**\n * Включен режим редактирвоания\n */\nconst inEdit = ref(false);\n\n/**\n * Включить режим редактирование\n */\nconst turnToEdit = async () => {\n\tinEdit.value = true;\n\n\tawait nextTick();\n\n\telName.value?.focus();\n};\n\n/**\n * Применить редактирование\n */\nconst editCommit = () => {\n\tconst name = elName.value?.innerText;\n\tif (!name) return editCancel();\n\n\tif (elName.value) elName.value.innerText = name;\n\n\tinEdit.value = false;\n\n\temit('update:name', name);\n};\n\n/**\n * Отменить редактирование\n */\nconst editCancel = async () => {\n\tif (elName.value) elName.value.innerText = props.name;\n\n\tinEdit.value = false;\n};\n\n/**\n * Применить выбор\n */\nconst changeSelect = (e: MouseEvent) => {\n\t// в режиме редактирования выбор не применяется\n\tif (inEdit.value) return;\n\n\t// тег запрещено выбирать\n\tif (props.disabled) return;\n\n\tlet toState: Props['state'] = 'selected';\n\n\tif (props.canExclude) {\n\t\tif (e.ctrlKey || e.metaKey) {\n\t\t\ttoState = 'excluded';\n\t\t}\n\t}\n\n\tif (props.state == toState) {\n\t\ttoState = '';\n\t}\n\n\tif (toState === '') emit('unselect');\n\tif (toState === 'selected') emit('select');\n\tif (toState === 'excluded') emit('exclude');\n};\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\t:class=\"{\n\t\t\t'top-tagSelector_tagListItem': true,\n\t\t\t'top-tagSelector_tagListItem-inEdit': inEdit,\n\t\t\t'top-tagSelector_tagListItem-disabled': disabled,\n\t\t\t'top-tagSelector_tagListItem-canExclude': canExclude,\n\t\t\t'top-tagSelector-active': !!state,\n\t\t\t'top-tagSelector-excluded': state === 'excluded'\n\t\t}\"\n\t\t@click.stop=\"changeSelect\"\n\t>\n\t\t<TopTagIcon\n\t\t\t:id\n\t\t\t:name\n\t\t\t:colorId\n\t\t\t:state\n\t\t/>\n\n\t\t<span\n\t\t\tref=\"elName\"\n\t\t\tclass=\"top-tagSelector_tagListItemName\"\n\t\t\t:contenteditable=\"inEdit ? 'plaintext-only' : false\"\n\t\t\t:=\"firefoxProps\"\n\t\t\t@keydown.enter.stop=\"editCommit\"\n\t\t\t@keydown.esc.stop=\"editCancel\"\n\t\t>\n\t\t\t{{ name }}\n\t\t</span>\n\n\t\t<template v-if=\"editable\">\n\t\t\t<span\n\t\t\t\tv-if=\"!inEdit\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click=\"turnToEdit\"\n\t\t\t></span>\n\n\t\t\t<span\n\t\t\t\tv-else\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click.stop=\"editCommit\"\n\t\t\t></span>\n\t\t</template>\n\t</TopPopupListItem>\n</template>\n\n<style>\n.top-tagSelector_tagListItem.top-popup_listItem {\n\tpadding-top: var(--top-padding-2) !important;\n\tpadding-bottom: var(--top-padding-2) !important;\n\tgap: 10px;\n}\n\n.top-tagSelector_tagListItemName {\n\tborder-radius: var(--top-radius-1);\n\twidth: 120px;\n\tpadding: 4px 2px;\n\tmargin: -4px -2px;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\tflex-grow: 1;\n}\n\n/* редактирование */\n.top-tagSelector_edit {\n\t--top-icon-size: 18px;\n\t--top-icon-color: var(--color-text-3);\n\n\twidth: 20px;\n\tflex-grow: 0;\n}\n\n.top-tagSelector_edit:before {\n\tline-height: 0;\n}\n\n.top-tagSelector_edit { opacity: 0; }\n.top-tagSelector_edit:hover {\n\t--top-icon-color: var(--color-text-primary);\n}\n\n.top-tagSelector_tagListItem:hover .top-tagSelector_edit,\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_edit {\n\tcursor: pointer;\n\topacity: 1;\n}\n\n.top-tagSelector_tagListItem-inEdit {\n\tbackground: var(--color-layout-front-3) !important;\n\toutline: 1px dashed var(--color-line-2);\n\toutline-offset: -1px;\n}\n\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_tagListItemName {\n\tcursor: text;\n\tbackground: var(--color-layout-front-1);\n}\n\n/* disabled */\n.top-tagSelector_tagListItem-disabled {\n\tcursor: not-allowed !important;\n\topacity: 0.85;\n}\n.top-tagSelector_tagListItem-disabled:hover {\n\tbackground: inherit;\n}\n.top-tagSelector_tagListItem-disabled [data-tag_id] {\n\topacity: 0.6;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Props, TagSelectorTarget } from './types';\nimport TopPopupOpener from '../../../popup/popup/opener.vue';\nimport TopButton from '@/components/forms/button/button.vue';\nimport { genTagIdClear, getTagById } from '../utils/utils';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\n\ndefineOptions({\n\tinheritAttrs: false,\n});\n\nconst props = defineProps<Props>();\n\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\nconst component = props.useTopButton ? TopButton : 'div';\nconst componentSlotName = props.useTopButton ? 'html' : 'default';\n\nconst topTagSelectorTarget: TagSelectorTarget = {\n\tmodel,\n\tmode: props.mode,\n\ttargetId: props.targetId,\n\tfilters: props.filters,\n\tpayload: props.payload,\n};\n</script>\n\n<template>\n\t<TopPopupOpener :id>\n\t\t<component\n\t\t\t:is=\"component\"\n\t\t\t:class=\"{\n\t\t\t\t'top-tagSelector': true,\n\t\t\t\t'top-tagSelector-filter': props.mode === 'filter',\n\t\t\t\t'top-tagSelector-setter_single': props.mode === 'setter' && !filters,\n\t\t\t\t'top-tagSelector-setter_several': props.mode === 'setter' && filters,\n\t\t\t\t'top-tagSelector-selectedOne': !model.length || model.length === 1,\n\t\t\t\t'top-tagSelector-toTwoLine': model.length > 5,\n\t\t\t}\"\n\t\t\tcolor=\"theme\"\n\t\t\tstyling=\"\"\n\t\t\tv-top-data:topTagSelectorTarget=\"topTagSelectorTarget\"\n\t\t\t:=$attrs\n\t\t>\n\t\t\t<template #[componentSlotName]>\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-if=\"!model.length && mode === 'filter'\"\n\t\t\t\t\tid=\"all\"\n\t\t\t\t\tcolorId=\"\"\n\t\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t\tstate=\"\"\n\t\t\t\t/>\n\n\t\t\t\t<!-- Массовое редактирование -->\n\t\t\t\t<div v-if=\"mode === 'setter' && filters\">\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- Список тегов -->\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-else\n\t\t\t\t\tv-for=\"tagId in model\"\n\t\t\t\t\t:id=\"genTagIdClear(tagId)\"\n\t\t\t\t\t:colorId=\"getTagById(tagId, tags)?.color_id ?? ''\"\n\t\t\t\t\t:name=\"getTagById(tagId, tags)?.name ?? ''\"\n\t\t\t\t\t:state=\"genTagIdClear(tagId) === tagId ? 'selected' : 'excluded'\"\n\t\t\t\t/>\n\t\t\t</template>\n\t\t</component>\n\t</TopPopupOpener>\n</template>\n\n<style>\n.top-tagSelector {\n\tcursor: pointer;\n\tmin-width: 0;\n\twhite-space: nowrap;\n\tjustify-content: left;\n}\n\n.top-tagSelector.top-button {\n\twidth: 112px;\n\tvertical-align: middle;\n}\n\n.top-tagSelector.top-button.top-select_arrow {\n\twidth: calc(112px + 20px);\n}\n\n.top-tagSelector-filter {\n\tgap: var(--top-gap-1);\n}\n\n/* все теги в фильтре */\n.top-tagSelector-filter [data-tag_id=\"all\"] {\n\tmargin-left: 0;\n}\n.top-tagSelector-filter [data-tag_id=\"all\"]:before {\n\tborder: none;\n\tmargin-left: 3px;\n\topacity: 0.5;\n}\n\n/* фильтр по одному тегу */\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id]:after {\n\tcontent: attr(title);\n\tmargin-left: 20px;\n\tmin-width: 74px;\n\ttext-align: left;\n\tline-height: 1.2;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n}\n\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id=\"all\"]:after {\n\tmargin-left: 0;\n}\n\n/* фильтр по многим тегам */\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine {\n\tflex-wrap: wrap;\n\talign-content: center;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id] {\n\t--top-tag-selector-size: 8px;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id]:nth-child(5) {\n\tmargin-right: 5px;\n}\n\n/* установка тегов */\n.top-tagSelector-setter_single {\n\tposition: relative;\n\tdisplay: flex !important; flex-direction: column; flex-wrap: wrap; align-items: stretch !important;\n}\n\n.top-tagSelector-setter_single [data-tag_id] {\n\twidth: auto; min-height: 20%; min-width: 50%;\n\tflex: 1 1 auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, reactive, ref, shallowRef, watch } from 'vue';\n\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport { debounce } from '@/core/utils/lodash';\n\nimport type { Option } from '@/components/forms/select/select';\nimport TopSelect from '@/components/forms/select/select.vue';\n\nimport TopButton from '@/components/forms/button/button.vue';\n\nimport type { PopupEvent } from '@/components/popup/popup/popup';\nimport TopPopup from '../../popup/popup/popup.vue';\nimport TopPopupListItem from '../../popup/popup/listItem.vue';\n\nimport type { Emits, FiltersAction, Props, Tag } from './types';\nimport tagsDefaults from './tagsDefaults';\nimport { genTagIdExcluded } from './utils/utils';\n\nimport type { Props as TagListItemProps } from './popupListItem/types';\nimport TopTagListItem from './popupListItem/tagPopupListItem.vue';\n\nimport type { TagSelectorTarget } from './popupOpener/types';\nimport TopTagSelectorPopupOpener from './popupOpener/popupOpener.vue';\n\nconst i18n = useI18n();\n\nconst props = withDefaults(defineProps<Props>(), {\n\ttagsMax: 10,\n\trequiredForSetter: true,\n\temitDelay: 500,\n});\n\n/**\n * Выбранные теги кнопки в этом компоненте\n *\n * Редактирвоание ведется только через `editTarget.model`\n */\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\n/**\n * Список тегов\n */\nconst tags = defineModel<Tag[]>('tags', {\n\tdefault: reactive(tagsDefaults),\n});\n\nconst emit = defineEmits<Emits>();\n\nconst emitDebounce: typeof emit = debounce((name, e) => {\n\temit(name, e);\n}, props.emitDelay);\n\n// требуется сразу указать один тег\nif (props.singleMode && !model.value.length) {\n\tmodel.value = [tags.value[0].id];\n}\n\nconst id = props.id ?? 'top-popup-id-' + Math.random() + '';\n\nconst filtersAction = ref<FiltersAction>('add');\n\n/**\n * Сгенерировать опции для выбора дейсвтия массого редактирования\n */\nconst genFiltersActionOptions = () => {\n\tconst tagsText = ' ' + i18n.Common.Tags?.toLowerCase();\n\n\tconst res = new Map<FiltersAction, Option>();\n\tres.set('add', { value: 'add', title: i18n.Common.Add + tagsText });\n\tres.set('replace', { value: 'replace', title: i18n.Common.Replace + tagsText });\n\tres.set('delete', { value: 'delete', title: i18n.Common.Delete + tagsText });\n\n\treturn res;\n};\n\n/**\n * Целевой объект редактирвоания тегов\n *\n * Определяется кнопкой, которая открыла popup выбора тегов\n */\nlet target = shallowRef<TagSelectorTarget>({\n\tmodel,\n\tmode: 'filter',\n\ttargetId: undefined,\n\tfilters: undefined,\n\tpayload: undefined,\n});\n\nwatch(model, () => {\n\temitDebounce('selector', model.value);\n});\n\n/**\n * Можно ли выбрать еще теги\n */\nconst disabled = computed(() => {\n\tif (target.value.mode !== 'setter') return;\n\n\tif (!props.maxTagsForSetter) return;\n\n\t// массовая смена тегов, количество тегов в результате узнать невозможно\n\tif (target.value.filters) return;\n\n\treturn target.value.model.value.length >= props.maxTagsForSetter;\n});\n\nconst genTargetTagState = (tagId: Tag['id'] | 'all'): TagListItemProps['state'] => {\n\tif (tagId !== 'all') {\n\t\tif (target.value.model.value.includes(tagId)) return 'selected';\n\n\t\tif (target.value.model.value.includes(genTagIdExcluded(tagId))) return 'excluded';\n\t}\n\n\t// Все теги, ни один из тегов не выбран\n\tif (tagId === 'all' && !target.value.model.value.length) return 'selected';\n\n\treturn '';\n};\n\nconst updateTargetModel = (tagId: Tag['id'], action: 'unselect' | 'select' | 'exclude') => {\n\tconst tagIdExcluded = genTagIdExcluded(tagId);\n\n\tlet tagsIds = target.value.model.value.filter(modelTagId => modelTagId !== tagId && modelTagId !== tagIdExcluded);\n\n\tif (action === 'select') tagsIds.push(tagId);\n\tif (action === 'exclude') tagsIds.push(tagIdExcluded);\n\n\t// режим редактирвоания тегов одного объекта с требованием указать хотя бы один тег\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined && props.requiredForSetter) {\n\t\t// нельзя снимать выделение со всех тегов\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds.push('1');\n\t\t}\n\n\t\t// при первом выборе сразу снять тег \"Без тега\"\n\t\tif (tagsIds.length === 2 && target.value.model.value.length === 1 && target.value.model.value[0] === '1') {\n\t\t\ttagsIds = tagsIds.filter((tagId) => tagId !== '1');\n\t\t}\n\t}\n\n\t// режим выбора одного тега\n\tif (props.singleMode && !target.value.filters) {\n\t\t// нужно указать хотя бы один тег\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds = target.value.model.value;\n\t\t}\n\n\t\tif (tagsIds.length > 1) {\n\t\t\ttagsIds = [tagsIds[tagsIds.length - 1]];\n\t\t}\n\t}\n\n\t// всегда выводить теги в порядке, указанном в настройках tags\n\ttagsIds.sort((a, b) => {\n\t\tif (!props.tags) return 0;\n\n\t\tconst aIndex = props.tags.findIndex((tag) => tag.id === a);\n\t\tconst bIndex = props.tags.findIndex((tag) => tag.id === b);\n\n\t\treturn aIndex - bIndex;\n\t});\n\n\ttarget.value.model.value = tagsIds;\n\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined) {\n\t\temitDebounce('setter', {\n\t\t\ttagsIds: tagsIds as Tag['id'][],\n\t\t\ttargetId: target.value.targetId,\n\t\t\tpayload: target.value.payload,\n\t\t});\n\t}\n};\n\nconst classString = computed(() => {\n\tlet res = 'top-tagSelector_popup';\n\n\tif (target.value.mode === 'filter') res += ' top-tagSelector_popup-filter';\n\tif (target.value.mode === 'setter') res += ' top-tagSelector_popup-setter';\n\n\treturn res;\n});\n\n/**\n * Добавить тег\n */\nconst addTag = () => {\n\tconst tagName = prompt('', 'New tag');\n\tif (!tagName || tagName === 'New tag') return;\n\n\tconst tagId = tags.value.length + 1;\n\n\ttags.value.push({\n\t\tid: String(tagId) as Tag['id'],\n\t\tname: tagName,\n\t\tcolor_id: String((tagId - 1) % 10 + 1) as Tag['color_id'],\n\t});\n\n\temit('tagsChanged', tags.value);\n};\n\nconst onOpen = (popupEvent: PopupEvent) => {\n\t// popup открыт другой кнопкой c другим modelValue, для редактирвоания объектов\n\ttarget.value = storage(popupEvent.elPopupOpener, 'topTagSelectorTarget');\n\tif (!target.value) throw new Error('Open popup TopTagSelector required v-data:topTagSelectorTarget');\n\n\t// при начале массовой установки тегов сбросить состояние формы\n\tif (target.value.filters) {\n\t\tfiltersAction.value = 'add';\n\t\ttarget.value.model.value = [];\n\t}\n\n\tif (!Core.$?.ui['sortable']) {\n\t\tconsole.info('Для работы сортировки требуется глобальная загрузка jQuery UI Sortable');\n\n\t\treturn;\n\t}\n\n\tif (!Core.state.isMobile && !Core.state.isMobileUA && tags.value) {\n\t\t$(popupEvent.elPopup).sortable({\n\t\t\titems: 'li:has([data-tag_id]:not([data-tag_id=\"all\"]))',\n\n\t\t\t/**\n\t\t\t * @todo Удалить `[contenteditable=\"true\"]` через пол года после выхода версии firefox с поддержкой contenteditable plaintext-only, включая бета версии\n\t\t\t */\n\t\t\tcancel: '[contenteditable=\"plaintext-only\"], [contenteditable=\"true\"]',\n\n\t\t\tdistance: 10,\n\t\t\tstop: function (_e, ui) {\n\t\t\t\tif (!tags.value) return;\n\n\t\t\t\tconst $tags = $(ui.item).parent().find('[data-tag_id]');\n\n\t\t\t\tconst tagsSorted: Tag['id'][] = [];\n\t\t\t\t$tags.each((_index, elTag) => {\n\t\t\t\t\tif (!tags.value) return;\n\n\t\t\t\t\tconst tagId = $(elTag).attr('data-tag_id') as Tag['id'];\n\t\t\t\t\ttagsSorted.push(tagId);\n\t\t\t\t});\n\n\t\t\t\ttags.value.sort((tagIdA, tagIdB) => {\n\t\t\t\t\tconst a = tagsSorted.findIndex(tagSorted => tagSorted === tagIdA.id);\n\t\t\t\t\tconst b = tagsSorted.findIndex(tagSorted => tagSorted === tagIdB.id);\n\n\t\t\t\t\treturn a - b;\n\t\t\t\t});\n\n\t\t\t\temitDebounce('tagsChanged', tags.value);\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst onClose = (popupEvent: PopupEvent) => {\n\tif (!Core.$?.ui['sortable']) return;\n\n\tif ($(popupEvent.elPopup).data('ui-sortable')) {\n\t\t$(popupEvent.elPopup).sortable('destroy');\n\t}\n};\n</script>\n\n<template>\n\t<TopTagSelectorPopupOpener\n\t\tclass=\"top-select_arrow\"\n\t\tv-model=\"model\"\n\t\t:id\n\t\t:tags\n\t\tmode=\"filter\"\n\t\tuseTopButton\n\t/>\n\n\t<TopPopup\n\t\t:id\n\t\t:class=\"classString\"\n\t\t@open=\"onOpen($event)\"\n\t\t@close=\"onClose($event)\"\n\t\t:transition-duration=\"50\"\n\t>\n\t\t<!-- Массовое редактирвоание-->\n\t\t<template #header v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopSelect\n\t\t\t\tv-model=\"filtersAction\"\n\t\t\t\t:options=\"genFiltersActionOptions()\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #footer v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopButton color=\"theme\">\n\t\t\t\t{{ $i18n.Common.Cancel }}\n\t\t\t</TopButton>\n\n\t\t\t<TopButton\n\t\t\t\t@click=\"emitDebounce('setter', {\n\t\t\t\t\ttagsIds: target.model.value as Tag['id'][],\n\t\t\t\t\tfilters: target.filters,\n\t\t\t\t\tfiltersAction,\n\t\t\t\t\tpayload: target.payload,\n\t\t\t\t})\"\n\t\t\t>\n\t\t\t\t{{ filtersAction === 'add' ? $i18n.Common['Add'] : '' }}\n\t\t\t\t{{ filtersAction === 'replace' ? $i18n.Common['Replace'] : '' }}\n\t\t\t\t{{ filtersAction === 'delete' ? $i18n.Common['Remove'] : '' }}\n\t\t\t</TopButton>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopTagListItem\n\t\t\t\tv-if=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\tid=\"all\"\n\t\t\t\tcolorId=\"\"\n\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t:state=\"target.model.value.length ? '' : 'selected'\"\n\t\t\t\t@select=\"target.model.value = []\"\n\t\t\t/>\n\n\t\t\t<TopTagListItem\n\t\t\t\tv-for=\"tag in tags\"\n\t\t\t\t:key=\"tag.id\"\n\t\t\t\t:id=\"tag.id\"\n\t\t\t\t:colorId=\"tag.color_id\"\n\t\t\t\t:name=\"tag.name\"\n\t\t\t\t:state=\"genTargetTagState(tag.id)\"\n\t\t\t\t:canExclude=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\t:editable=\"tagsEditable\"\n\t\t\t\t:disabled=\"disabled && genTargetTagState(tag.id) === ''\"\n\t\t\t\t@unselect=\"updateTargetModel(tag.id, 'unselect')\"\n\t\t\t\t@select=\"updateTargetModel(tag.id, 'select')\"\n\t\t\t\t@exclude=\"updateTargetModel(tag.id, 'exclude')\"\n\t\t\t\t@update:name=\"tag.name = $event as string, emitDebounce('tagsChanged', tags);\"\n\t\t\t/>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"tagsEditable && tags.length < tagsMax && tags.length < 20\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t@click.stop=\"addTag\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.Add }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-tagSelector_popup .top-popup {\n\tuser-select: none;\n\tmin-width: 220px !important;\n\ttext-align: left;\n}\n\n.top-tagSelector_popup .top-popup_header .top-select{\n\tflex-grow: 1;\n}\n</style>\n","import type { MaybeRefOrGetter } from 'vue';\nimport { computed, toValue } from 'vue';\nimport type { Item } from '@/components/project/selectorCompetitors/selectorCompetitors';\nimport type { Competitor } from '@/components/project/selectorCompetitors/types/competitor';\n\nexport const useItemsFromCompetitors = (competitors: MaybeRefOrGetter<Competitor[]>, projectId: MaybeRefOrGetter<number>) => {\n\treturn computed(() => {\n\t\tconst activeCompetitors = toValue(competitors).filter(competitor => competitor.on >= 0 || competitor.id === projectId);\n\n\t\tconst items: Item[] = activeCompetitors.map(competitor => {\n\t\t\treturn {\n\t\t\t\tvalue: competitor.id,\n\t\t\t\ttitle: competitor.url + ` [${competitor.id}]`,\n\t\t\t\ticon: competitor.id === toValue(projectId) ? '' : '',\n\t\t\t\tcontent: competitor.name,\n\t\t\t};\n\t\t});\n\n\t\treturn items;\n\t});\n};\n","import { isRef, type Ref, ref, unref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport TopPopupWorker from '@/components/popup/lib/worker';\nimport type { OpenerProps as PopupOpenerProps } from '@/components/popup/popup/popup';\nimport type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Props as TagIconProps } from '../tagIcon/types';\nimport { genTagIdClear, getTagById } from '../utils/utils';\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorPopupOpener для работы вне vue\n *\n * Требует монтирования компонента TopTagSelecor\n */\nexport const genElPopupOpener = (\n\tprops: TagSelectorOpenerProps & { modelValue: TagSelectorOpenerProps['modelValue'] | Ref<TagSelectorOpenerProps['modelValue']> },\n\tpropsPopup?: Partial<PopupOpenerProps>,\n\thtmlSetterSeveral?: string,\n): HTMLElement => {\n\tif (!propsPopup) propsPopup = { id: props.id };\n\n\tpropsPopup.id = props.id;\n\n\tconst el = TopPopupWorker.genElPopupOpener('div', propsPopup as PopupOpenerProps);\n\n\tel.classList.add('top-tagSelector');\n\tif (props.useTopButton) el.classList.add('top-button', 'top-color_theme');\n\tif (props.mode === 'filter') el.classList.add('top-tagSelector-filter');\n\tif (props.mode === 'setter' && !props.filters) el.classList.add('top-tagSelector-setter_single');\n\tif (props.mode === 'setter' && props.filters) el.classList.add('top-tagSelector-setter_several');\n\n\t// прокcи клик: lazy connect\n\tel.onclick = (e) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tel.onclick = null;\n\n\t\tconst model = ref(props.modelValue);\n\n\t\tconst target: TagSelectorTarget = {\n\t\t\tmodel,\n\t\t\tmode: props.mode,\n\t\t\ttargetId: props.targetId,\n\t\t\tfilters: props.filters,\n\t\t\tpayload: props.payload,\n\t\t};\n\n\t\tstorage(el, 'topTagSelectorTarget', target);\n\n\t\tdelete el.dataset.topPopupDisabled;\n\n\t\tif (!isRef(props.modelValue)) {\n\t\t\twatch(model, () => {\n\t\t\t\tprops.modelValue = model.value;\n\n\t\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t\t});\n\t\t}\n\n\t\t// выполнение клика\n\t\tel.click();\n\t};\n\n\tif (isRef(props.modelValue)) {\n\t\twatch(props.modelValue, () => elPopupOpenerRender(el, props, htmlSetterSeveral));\n\t} else {\n\t\tstorage(el, 'topTagSelectorRender', (modelValue: TagSelectorOpenerProps['modelValue']) => {\n\t\t\tprops.modelValue = modelValue;\n\n\t\t\tconst target = storage(el, 'topTagSelectorTarget');\n\t\t\tif (target) target.model.value = modelValue;\n\n\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t});\n\t}\n\n\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\n\treturn el;\n};\n\n/**\n * Вызвать перерисовку элемента, который был создан через genElPopupOpener()\n *\n * Работет только для элементов не с реактивным modelValue\n */\nexport const renderElPopupOpener = (el: HTMLElement, modelValue: TagSelectorOpenerProps['modelValue']) => {\n\tstorage(el, 'topTagSelectorRender')?.(modelValue);\n};\n\n/**\n * Отрисовать TopTagSelecorPopupOpener\n */\nconst elPopupOpenerRender = (el, props: TagSelectorOpenerProps, htmlSetterSeveral?: string) => {\n\tconst tagsIds = unref(props.modelValue);\n\n\tel.classList.toggle('top-tagSelector-selectedOne', !tagsIds.length || tagsIds.length === 1);\n\tel.classList.toggle('top-tagSelector-toTwoLine', tagsIds.length > 5);\n\n\tif (props.mode === 'setter' && props.filters) {\n\t\tel.innerHTML = `<div>${htmlSetterSeveral}</div>`;\n\n\t\treturn;\n\t}\n\n\tel.innerHTML = '';\n\n\tif (!tagsIds.length && props.mode === 'filter') {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: 'all',\n\t\t\tcolorId: '',\n\t\t\tname: useI18n().Common?.All_tags ?? '',\n\t\t\tstate: '',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t}\n\n\ttagsIds.forEach(tagId => {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: genTagIdClear(tagId),\n\t\t\tcolorId: getTagById(tagId, props.tags)?.color_id ?? '',\n\t\t\tname: getTagById(tagId, props.tags)?.name ?? '',\n\t\t\tstate: genTagIdClear(tagId) === tagId ? 'selected' : 'excluded',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t});\n};\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorTagIcon для работы вне vue\n */\nconst genElTagIcon = (props: TagIconProps) => {\n\tconst el = document.createElement('div');\n\n\tel.classList.add('top-tagSelector_tagIcon');\n\tel.classList.toggle('top-tagSelector-active', !!props.state);\n\tel.classList.toggle('top-tagSelector-excluded', props.state === 'excluded');\n\n\tel.dataset.tag_id = props.id;\n\tel.dataset.tag_color_id = props.colorId;\n\tel.title = props.name;\n\n\treturn el;\n};\n","import type { ComponentCustomProps } from 'vue';\n\nimport SelectorCompetitors from './selectorCompetitors/selectorCompetitors.vue';\nimport SelectorRegion from './selectorRegion/selectorRegion.vue';\n\nimport TagSelector from './tagSelector/tagSelector.vue';\nimport TagSelectorPopupOpener from './tagSelector/popupOpener/popupOpener.vue';\nimport TagSelectorTagIcon from './tagSelector/tagIcon/tagIcon.vue';\n\nexport const TopSelectorCompetitors = SelectorCompetitors as typeof SelectorCompetitors & ComponentCustomProps;\nexport { useItemsFromCompetitors } from './selectorCompetitors/composables';\n\nexport { findRegion, genSearcherByKey, dialogSelectorRegions } from './selectorRegion/utils/utils';\nexport const TopSelectorRegion = SelectorRegion as typeof SelectorRegion & ComponentCustomProps;\n\nexport type { Emits as TopTagSelectorEmits, Tag, TagId, TagIdExclude } from './tagSelector/types';\nexport {\n\tgenElPopupOpener as genElTopTagSelectorPopupOpener,\n\trenderElPopupOpener as renderElTopTagSelectorPopupOpener,\n} from './tagSelector/utils/el';\nexport const TopTagSelector = TagSelector as typeof TagSelector & ComponentCustomProps;\nexport const TopTagSelectorPopupOpener = TagSelectorPopupOpener as typeof TagSelectorPopupOpener & ComponentCustomProps;\nexport const TopTagSelectorTagIcon = TagSelectorTagIcon as typeof TagSelectorTagIcon & ComponentCustomProps;\n"],"names":["props","__props","model","useModel","selectAllItem","computed","useI18n","searhcerCompareKey","dummyIndex","globalRegionIndex","searchersNames","regionUndefined","searcherUndefined","regionAuto","searcherAuto","regionGlobal","getRegionAuto","getSearcherAuto","getRegionGlobal","genSearcherByKey","forFrequency","autoRegion","searchers","searcherByKey","genSearchersMapVolume","genSearchersMapCommon","onlyEnabledRegions","forceSearchersKeys","searcher","searcherI","region","regionI","searcherKey","serarcherByKey","searcherMail","findRegion","searchRegion","findedRegion","dialogSelectorRegions","useAsyncTopDialog","useSelectSearcher","mapSearchers","i18n","ref","optionBySearcherKey","res","option","getSearcherGIcon","dummyOption","compareOption","useSelectRegion","activeSearcherIndexed","regionIndex","_b","_a","_c","optionByRegionIndex","options","regionLabel","option2","langLabel","getLangLabel","getDeviceGIcon","watch","optionByRegionIndex2","oldOptionByRegionIndex","newRegionIndex","regionName","regionMatchLevel","index","title","regexpDevice","regionNameCompare","regionMatchLevelI","useCompare","allRegionsIndexes","regionsIndexes","compareLoad","regionsIndexesSaved","compareSave","useSelectorRegion","selectSearcher","selectRegion","compare","newSearcherKey","regionsNewSearcher","regionsCurrentSearcher","_d","getSearcherKey","getRegionIndex","regionKey","getSearcher","modelSingle","getRegion","onClickCompare","regions","defaultKey","newModel","defaultIndex","_e","all","newSearherKey","__expose","tagsDefaults","genTagIdExcluded","tagId","genTagIdClear","getTagById","tags","tag","tag2","emit","__emit","name","elName","firefoxProps","inEdit","event","turnToEdit","nextTick","editCommit","name2","editCancel","changeSelect","e","toState","component","_sfc_main$8","componentSlotName","topTagSelectorTarget","emitDebounce","debounce","id","filtersAction","genFiltersActionOptions","tagsText","target","shallowRef","disabled","genTargetTagState","updateTargetModel","action","tagIdExcluded","tagsIds","modelTagId","tagId2","a","b","aIndex","bIndex","classString","addTag","tagName","onOpen","popupEvent","storage","Core","ui","$tags","tagsSorted","_index","elTag","tagIdA","tagIdB","tagSorted","onClose","useItemsFromCompetitors","competitors","projectId","toValue","competitor","genElPopupOpener","propsPopup","htmlSetterSeveral","el","Worker","isRef","elPopupOpenerRender","modelValue","renderElPopupOpener","unref","elTagIcon","genElTagIcon","TopSelectorCompetitors","_sfc_main$5","TopSelectorRegion","_sfc_main$4","TopTagSelector","_sfc_main","TopTagSelectorPopupOpener","_sfc_main$1","TopTagSelectorTagIcon","_sfc_main$3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,UAAAA,IAAAC,GAGAC,IAAAC,EAAAF,GAAA,YAAA,GAEAG,IAAAC,EAAA,MAAA;AACC,UAAAL,EAAA;AACC,eAAA;AAAA,UAAO,MAAA;AAAA,UACA,OAAAM,EAAA,EAAA,OAAA;AAAA,UACkB,OAAA;AAAA,UACjB,SAAA;AAAA,QACE;AAAA,IAEX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICjBMC,IAAA,IAOAC,IAAA,IAKAC,KAAA,IAEAC,KAAA;AAAA,EAAuB,GAAA;AAAA,EAC1B,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACC,IAAA;AAEL,GAEOC,KAAA;AAAA,EAAgC,KAAAH;AAAA,EACjC,MAAA;AAAA,EACC,OAAAA;AAEP,GAEOI,KAAA;AAAA,EAA2C,KAAAJ;AAAA,EAC5C,MAAA;AAAA,EACC,SAAA,CAAAG,EAAA;AAAA,EACmB,eAAA,oBAAA,IAAA,CAAA,CAAAH,GAAAG,EAAA,CAAA,CAAA;AAE1B,GAEAE,KAAA;AAAA,EAA2B,KAAAL;AAAA,EACrB,MAAA;AAAA,EACC,OAAAA;AAEP,GAEAM,KAAA;AAAA,EAAsC,KAAAN;AAAA,EAChC,MAAA;AAAA,EACC,SAAA,CAAAK,EAAA;AAAA,EACc,eAAA,oBAAA,IAAA,CAAA,CAAAL,GAAAK,EAAA,CAAA,CAAA;AAErB,GAEAE,KAAA;AAAA,EAA6B,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AA,SAAA,UAAA;AACC,UAAAqL,IAAAC,GAAA;AAAA,MAA+B,IAAA;AAAA,MAC1B,SAAA;AAAA,MACK,QAAAhI,IAAAhD,EAAA,EAAA,WAAA,gBAAAgD,EAAA,aAAA;AAAA,MAC2B,OAAA;AAAA,IAC7B,CAAA;AAGR,IAAAwH,EAAA,OAAAO,CAAA;AAAA,EAAmB;AAGpB,EAAAtC,EAAA,QAAA,CAAAtC,MAAA;;AACC,UAAA4E,IAAAC,GAAA;AAAA,MAA+B,IAAA5E,EAAAD,CAAA;AAAA,MACP,WAAAnD,IAAAqD,GAAAF,GAAAzG,EAAA,IAAA,MAAA,gBAAAsD,EAAA,aAAA;AAAA,MAC6B,QAAAD,IAAAsD,GAAAF,GAAAzG,EAAA,IAAA,MAAA,gBAAAqD,EAAA,SAAA;AAAA,MACP,OAAAqD,EAAAD,CAAA,MAAAA,IAAA,aAAA;AAAA,IACQ,CAAA;AAGtD,IAAAqE,EAAA,OAAAO,CAAA;AAAA,EAAmB,CAAA;AAErB,GAOAC,KAAA,CAAAtL,MAAA;AACC,QAAA8K,IAAA,SAAA,cAAA,KAAA;AAEA,SAAAA,EAAA,UAAA,IAAA,yBAAA,GACAA,EAAA,UAAA,OAAA,0BAAA,CAAA,CAAA9K,EAAA,KAAA,GACA8K,EAAA,UAAA,OAAA,4BAAA9K,EAAA,UAAA,UAAA,GAEA8K,EAAA,QAAA,SAAA9K,EAAA,IACA8K,EAAA,QAAA,eAAA9K,EAAA,SACA8K,EAAA,QAAA9K,EAAA,MAEA8K;AACD,GC7IOS,KAAAC,IAIAC,KAAAC,IAOAC,KAAAC,IACAC,KAAAC,IACAC,KAAAC;"}
|
|
1
|
+
{"version":3,"file":"project.js","sources":["../../src/components/project/selectorCompetitors/selectorCompetitors.vue","../../src/components/project/selectorRegion/utils/consts.ts","../../src/components/project/selectorRegion/utils/utils.ts","../../src/components/project/selectorRegion/composables/selectSearcher.ts","../../src/components/project/selectorRegion/composables/selectRegion.ts","../../src/components/project/selectorRegion/composables/compare.ts","../../src/components/project/selectorRegion/composables/selectorRegion.ts","../../src/components/project/selectorRegion/selectorRegion.vue","../../src/components/project/tagSelector/tagsDefaults.ts","../../src/components/project/tagSelector/utils/utils.ts","../../src/components/project/tagSelector/popupListItem/tagPopupListItem.vue","../../src/components/project/tagSelector/popupOpener/popupOpener.vue","../../src/components/project/tagSelector/tagSelector.vue","../../src/components/project/selectorCompetitors/composables.ts","../../src/components/project/tagSelector/utils/el.ts","../../src/components/project/project.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Props } from './selectorCompetitors';\nimport Core from '@/core/core/core';\nimport Button from '@/components/forms/button/button.vue';\nimport Popup from '@/components/popup/popup/popup.vue';\nimport ListItem from '@/components/popup/popup/listItem.vue';\nimport Menu from '@/components/formsExt/menu/menu.vue';\nimport { useI18n } from '@/core/plugins/i18n';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowSelectAllItem: true,\n});\nconst model = defineModel<Props['modelValue']>();\n\nconst selectAllItem = computed(() => {\n\tif (props.showSelectAllItem) {\n\t\treturn {\n\t\t\ticon: '',\n\t\t\ttitle: useI18n().Common.Select_all,\n\t\t\tvalue: 'all',\n\t\t\tcontent: '',\n\t\t};\n\t}\n});\n</script>\n\n<template>\n\t<div class=\"top-selectorCompetitors\">\n\t\t<Popup v-if=\"Core.state.isMobile\">\n\t\t\t<template #opener>\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-selectorCompetitors_opener\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\ticon=\"\"\n\t\t\t\t\ticon2=\"\"\n\t\t\t\t>\n\t\t\t\t\t{{ items.find((item) => item.value === model?.[0])?.content }}\n\t\t\t\t</Button>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<ListItem\n\t\t\t\t\tv-for=\"(item, index) in items\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'top-active': model?.includes(item.value)\n\t\t\t\t\t}\"\n\t\t\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t\t\t:title=\"item.title\"\n\t\t\t\t\t@click=\"() => model = [item.value]\"\n\t\t\t\t>\n\t\t\t\t\t<span class=\"top-ellipsis1\">\n\t\t\t\t\t\t{{ item.content }}\n\t\t\t\t\t</span>\n\t\t\t\t</ListItem>\n\t\t\t</template>\n\t\t</Popup>\n\n\t\t<Menu\n\t\t\tv-else\n\t\t\tv-model=\"model\"\n\t\t\t:items=\"items\"\n\t\t\t:isMultiple=\"true\"\n\t\t\tstyling=\"bar\"\n\t\t\t:canBeEmptyMultiple=\"false\"\n\t\t\t:selectAllItem=\"selectAllItem\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-selectorCompetitors_opener.top-button {\n\twidth: 100%;\n}\n</style>\n","import type { Region, SearcherIndexed } from '../selectorRegion';\nimport { useI18n } from '@/core/plugins/i18n';\n\n/**\n * Ключ ПС - для выбора нескольких ПС или регионов\n */\nexport const searhcerCompareKey = -1;\n\n/**\n * Ключ ПС или индекса Региона, используется для ПС или Региона, не настроенных в проекте\n *\n * Также, используется для API с возможностью не указывать регион, см. `props.autoRegion`\n */\nexport const dummyIndex = -2;\n\n/**\n * Регион - без региона\n */\nexport const globalRegionIndex = -1;\n\nexport const searchersNames = {\n\t0: 'Yandex',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GoogleStore',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n};\n\nexport const regionUndefined: Region = {\n\tkey: dummyIndex,\n\tname: '--',\n\tindex: dummyIndex,\n};\n\nexport const searcherUndefined: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: '--',\n\tregions: [regionUndefined],\n\tregionByIndex: new Map([[dummyIndex, regionUndefined]]),\n};\n\nconst regionAuto: Region = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tindex: dummyIndex,\n};\n\nconst searcherAuto: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tregions: [regionAuto],\n\tregionByIndex: new Map([[dummyIndex, regionAuto]]),\n};\n\nconst regionGlobal: Region = {\n\tcountryCode: '00',\n\tdepth: 1,\n\tdevice: 0,\n\tkey: globalRegionIndex,\n\tindex: globalRegionIndex,\n\tlang: 'ru',\n\tname: 'Without region',\n};\n\nexport const getRegionAuto = () => {\n\tregionAuto.name = useI18n().Common.Autoselect!;\n\n\treturn regionAuto;\n};\n\nexport const getSearcherAuto = () => {\n\tgetRegionAuto();\n\n\tsearcherAuto.name = useI18n().Common.Autoselect!;\n\tconsole.log(searcherAuto);\n\n\treturn searcherAuto;\n};\n\nexport const getRegionGlobal = () => {\n\tregionGlobal.name = useI18n().Keywords.Without_region!;\n\n\treturn regionGlobal;\n};\n","import type { Region, Searcher, SearcherByKey, SearcherIndexed } from '../selectorRegion';\nimport { dummyIndex, getRegionGlobal, getSearcherAuto, regionUndefined, searchersNames, searcherUndefined } from './consts';\nimport { useAsyncTopDialog } from '@/components/dialog/dialog/composables/utils';\n\n/**\n * Генерация Map ПС с Map регионов из массива searchers\n * - ключ для ПС - searcherKey\n * - ключ для региона - regionIndex\n *\n * Если поисковиков в списке нет, в список будет добавлен searcherUndefined\n *\n * Если регионов в списке нет, в список будет добавлен regionUndefined\n *\n * @param forFrequency - получить массив для просмотра частоты (или ставок)\n * @param autoRegion - добавить элемент с ключем -2, который в API заменяется на нужный ключ в зависимости от контекста\n * @param searchers - поисковики с регионами проекта, см.: get/projects_2/projects, show_searchers_and_regions = 1\n */\nexport const genSearcherByKey = (\n\tforFrequency: boolean = false,\n\tautoRegion: boolean = false,\n\tsearchers: Searcher[] = [],\n) => {\n\tlet searcherByKey: SearcherByKey;\n\n\tif (forFrequency) {\n\t\tsearcherByKey = genSearchersMapVolume(searchers);\n\t} else {\n\t\tsearcherByKey = genSearchersMapCommon(searchers);\n\t}\n\n\tif (autoRegion) searcherByKey.set(dummyIndex, getSearcherAuto());\n\tif (!searcherByKey.size) searcherByKey.set(dummyIndex, searcherUndefined);\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами\n *\n * @param searchers\n * @param onlyEnabledRegions\n * @param forceSearchersKeys - ключи ПС, которые нееобходимо вывести в любом случае\n * @param forFrequency - для частоты будут выводиться только Яндекс, Google и Mail\n */\nconst genSearchersMapCommon = (\n\tsearchers: Searcher[],\n\tonlyEnabledRegions: boolean = true,\n\tforceSearchersKeys: Searcher['key'][] = [],\n\tforFrequency: boolean = false,\n) => {\n\tconst searcherByKey: Map<Searcher['key'], SearcherIndexed> = new Map();\n\n\t// настроенные ПС\n\tsearchers.forEach((searcher) => {\n\t\tif (!searcher.enabled) return;\n\t\tif (forFrequency && typeof searcher.key === 'number' && searcher.key > 1) return;\n\n\t\tconst searcherI = { ...searcher } as SearcherIndexed;\n\t\tsearcherI.regionByIndex = new Map();\n\n\t\tif (searcher.regions) {\n\t\t\tsearcher.regions.forEach((region: Region) => {\n\t\t\t\tif (onlyEnabledRegions && !region.enabled) return;\n\n\t\t\t\tconst regionI = { ...region };\n\t\t\t\tsearcherI.regionByIndex.set(regionI.index, regionI);\n\t\t\t});\n\t\t}\n\n\t\tif (!searcherI.regionByIndex.size && !forceSearchersKeys.length) {\n\t\t\t// searcherI.regionByIndex.set(regionUndefined.index, regionUndefined);\n\t\t}\n\n\t\tif (\n\t\t\t// режим вывода ПС без регионов\n\t\t\t!searcher.regions ||\n\n\t\t\t// есть включенные регионы\n\t\t\tsearcherI.regionByIndex.size ||\n\n\t\t\t// запрошен вывод конкретных ПС\n\t\t\tforceSearchersKeys.length\n\t\t) {\n\t\t\tif (typeof searcherI.key === 'number') searcherByKey.set(searcherI.key, searcherI);\n\t\t}\n\t});\n\n\t// дополнительные ПС\n\tforceSearchersKeys.forEach((searcherKey) => {\n\t\tif (searcherByKey.has(searcherKey)) return;\n\n\t\tconst searcherI: SearcherIndexed = {\n\t\t\tkey: searcherKey,\n\t\t\tname: searchersNames[searcherKey],\n\t\t\tregions: [],\n\t\t\tregionByIndex: new Map(),\n\t\t};\n\n\t\tsearcherByKey.set(searcherI.key, searcherI);\n\t});\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами для проверки частоты (Яндекс, Google, Mail если добавлен в проект)\n *\n * @param searchers\n */\nconst genSearchersMapVolume = (searchers: Searcher[]) => {\n\tconst serarcherByKey = genSearchersMapCommon(searchers, false, [0, 1], true);\n\n\t// в Mail нет регионов\n\tif (serarcherByKey.has(2)) {\n\t\tconst searcherMail = serarcherByKey.get(2);\n\t\tif (searcherMail) searcherMail.regionByIndex = new Map();\n\t}\n\n\t// добавление глобального региона\n\tserarcherByKey.forEach((searcher) => {\n\t\tif (!searcher.regionByIndex) return;\n\n\t\tconst region = { ...getRegionGlobal() };\n\t\tsearcher.regionByIndex.set(region.index, region);\n\t});\n\n\treturn serarcherByKey;\n};\n\n/**\n * Поиск региона по заданному критерию из списка поисковиков проекта\n *\n * @param forFrequency - поиск региона для просмотра частоты или ставок\n * @param searchRegion - объект с параметрами региона, который следует найти\n * @param searchers\n */\nexport const findRegion = (forFrequency: boolean, searchRegion: Partial<Region>, searchers: Searcher[] = []) => {\n\tconst searcherByKey = genSearcherByKey(forFrequency, false, searchers);\n\n\tlet findedRegion: Region | undefined;\n\n\t// поиск ПС\n\tsearcherByKey.forEach((searcher) => {\n\t\tif (searchRegion.searcher_key !== undefined && searchRegion.searcher_key != searcher.key) return;\n\t\tif (!searcher.regions) return;\n\n\t\t// поиск региона\n\t\tsearcher.regions.forEach((region) => {\n\t\t\tif (findedRegion) return;\n\n\t\t\tif (searchRegion.key !== undefined && searchRegion.key != region.key) return;\n\t\t\tif (searchRegion.index !== undefined && searchRegion.index != region.index) return;\n\n\t\t\tif (!forFrequency) {\n\t\t\t\tif (searchRegion.lang !== undefined && searchRegion.lang != region.lang) return;\n\t\t\t\tif (searchRegion.device !== undefined && searchRegion.device != region.device) return;\n\t\t\t}\n\n\t\t\tregion.searcher_key = searcher.key;\n\t\t\tfindedRegion = region;\n\n\t\t\treturn false;\n\t\t});\n\n\t\tif (findedRegion) return false;\n\t});\n\n\treturn findedRegion;\n};\n\n/**\n * Открыть диалоговое окно с выбором нескольких регионов\n *\n * @see import('../dialog_selectorRegions/types').Props\n */\nexport const dialogSelectorRegions = useAsyncTopDialog(() => {\n\treturn import('@/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue');\n});\n","import { computed, type ComputedRef, ref } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport type { Props, SearcherByKey } from '../selectorRegion';\nimport type { Option, Options } from '@/components/forms/select/select';\nimport { dummyIndex, searhcerCompareKey } from '../utils/consts';\nimport { getSearcherGIcon } from '@/core/utils/searchers';\n\n/**\n * Создание и управление реактивными переменными для выбора ПС\n *\n * @param props - входные props компонента\n * @param mapSearchers - Map ПС (реактивная)\n */\nexport const useSelectSearcher = (\n\tprops: Props,\n\tmapSearchers: ComputedRef<SearcherByKey>,\n) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Ключ выбранной поисковой системы\n\t */\n\tconst searcherKey = ref(mapSearchers.value.keys().next().value ?? dummyIndex);\n\n\t/**\n\t * Коллекция опций для выбора ПС\n\t */\n\tconst optionBySearcherKey = computed(() => {\n\t\tconst res: Options = new Map();\n\t\tmapSearchers.value.forEach((searcher) => {\n\t\t\tlet option: Option = {\n\t\t\t\tvalue: searcher.key,\n\t\t\t\ttitle: searcher.name,\n\t\t\t};\n\n\t\t\tif (props.addSearcherIcon) option.icon = getSearcherGIcon(searcher.key);\n\n\t\t\tres.set(searcher.key, option);\n\t\t});\n\n\t\t// добавить режим сравнения, если есть хотя бы одна ПС с одним регионом\n\t\tif (props.addCompare && !res.has(dummyIndex)) {\n\t\t\tconst dummyOption: Option = {\n\t\t\t\tvalue: '',\n\t\t\t\ttitle: '--------------------',\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t\tres.set(dummyOption.value, dummyOption);\n\n\t\t\tconst compareOption: Option = {\n\t\t\t\tvalue: searhcerCompareKey,\n\t\t\t\ttitle: i18n.Common.Compare!,\n\t\t\t};\n\t\t\tres.set(compareOption.value, compareOption);\n\t\t}\n\n\t\treturn res;\n\t});\n\n\treturn {\n\t\tsearcherKey,\n\t\toptionBySearcherKey,\n\t};\n};\n","import { computed, type ComputedRef, ref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { getDeviceGIcon, getLangLabel } from '@/core/utils/searchers';\nimport type { Option } from '@/components/forms/select/select';\nimport { dummyIndex } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для выбора региона\n *\n * @param props - входные props компонента\n * @param activeSearcherIndexed - объект активной поисковой системы (реактивная)\n * @param regionsIndexes - входные индексы регионов/ПС\n */\nexport const useSelectRegion = (props: Props, activeSearcherIndexed: ComputedRef<SearcherIndexed>) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Индекс выбранного региона\n\t */\n\tconst regionIndex = ref(dummyIndex);\n\n\tif (props.modelValue.length === 1) {\n\t\tregionIndex.value = props.modelValue[0];\n\t}\n\n\tif (regionIndex.value === dummyIndex) {\n\t\tif (props.forFrequency) {\n\t\t\t// в качетсве ключа используется region.key, а не region.index\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.values().next().value?.key ?? dummyIndex;\n\t\t} else {\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.keys().next().value ?? dummyIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Коллекция опций для выбора региона\n\t */\n\tconst optionByRegionIndex = computed(() => {\n\t\tconst options = new Map<number, Option>();\n\n\t\tactiveSearcherIndexed.value.regionByIndex?.forEach((region) => {\n\t\t\tlet regionLabel = region.name;\n\n\t\t\t// на частоту в текущей версии устройство и язык не влияют\n\t\t\t// обратите внимание, в качетсве ключа используется region.key, а не region.index\n\t\t\tif (props.forFrequency) {\n\t\t\t\tconst option: Option = {\n\t\t\t\t\tvalue: region.key,\n\t\t\t\t\ttitle: regionLabel,\n\t\t\t\t};\n\t\t\t\tif (!options.has(region.key)) options.set(region.key, option);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (region.device) {\n\t\t\t\tregionLabel += ' (' + i18n.Common['Device_' + region.device] + ')';\n\t\t\t}\n\n\t\t\tconst langLabel = getLangLabel(activeSearcherIndexed.value.key || 0, region.lang ?? '');\n\t\t\tif (langLabel) regionLabel += ' / ' + langLabel;\n\n\t\t\tconst option: Option = {\n\t\t\t\tvalue: region.index,\n\t\t\t\ttitle: regionLabel,\n\t\t\t\ticon: region.device ? getDeviceGIcon(region.device) : undefined,\n\t\t\t};\n\n\t\t\toptions.set(region.index, option);\n\t\t});\n\n\t\treturn options;\n\t});\n\n\t/**\n\t * Выбор максимально похожего региона в новой коллекции регионов\n\t */\n\twatch(optionByRegionIndex, (optionByRegionIndex, oldOptionByRegionIndex) => {\n\t\tif (props.onlySearcher || regionIndex.value !== undefined && optionByRegionIndex.get(regionIndex.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet newRegionIndex = optionByRegionIndex.keys().next().value as Region['index'];\n\t\tif (regionIndex.value === dummyIndex || newRegionIndex === dummyIndex) {\n\t\t\tregionIndex.value = newRegionIndex;\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionName = (oldOptionByRegionIndex?.get(regionIndex.value) as Option)?.title || '';\n\t\tlet regionMatchLevel = -1;\n\t\tfor (const [index, option] of optionByRegionIndex.entries()) {\n\t\t\tconst title = (option as Option).title;\n\n\t\t\tif (typeof title !== 'string' || typeof index === 'string') {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// полное совпадение\n\t\t\tif (title === regionName) {\n\t\t\t\tnewRegionIndex = index;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst regexpDevice = new RegExp(` \\\\((${i18n.Common['Device_1']}|${i18n.Common['Device_2']})\\\\)`);\n\t\t\tlet regionNameCompare = regionName;\n\t\t\tlet regionMatchLevelI = 3;\n\n\t\t\t// без устройства\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без устройства и без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\t\t\t\tregionNameCompare = regionNameCompare.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\tif (title.indexOf(regionNameCompare) === -1) continue;\n\t\t\tif (regionMatchLevelI <= regionMatchLevel) continue;\n\n\t\t\tregionMatchLevel = regionMatchLevelI;\n\t\t\tnewRegionIndex = index;\n\t\t}\n\n\t\tregionIndex.value = newRegionIndex;\n\t});\n\n\treturn {\n\t\tregionIndex,\n\t\toptionByRegionIndex,\n\t};\n};\n","import { type ComputedRef, ref, watch } from 'vue';\nimport type { Props, SearcherByKey } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для сравнения\n *\n * @param props - входные props компонента\n * @param searcherByKey - Map ПС (реактивная)\n * @param allRegionsIndexes - Все доступные индексы регионов (реактивная)\n */\nexport const useCompare = (props: Props, searcherByKey: ComputedRef<SearcherByKey>, allRegionsIndexes: ComputedRef<Set<number>>) => {\n\t/**\n\t * Индексы регионов/ПС в сравнение\n\t */\n\tconst regionsIndexes = ref<number[]>([]);\n\n\t/**\n\t * Загрузка индексов регионов для сравнения\n\t *\n\t * Если в modelValue передано несколько регионов, они будут установлены как выбранные для сравнения\n\t */\n\tconst compareLoad = () => {\n\t\tif (props.onlySearcher && searcherByKey.value) {\n\t\t\tregionsIndexes.value = Array.from(searcherByKey.value.keys());\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionsIndexesSaved: Props['modelValue'] = [];\n\n\t\tif (props.modelValue.length > 1) {\n\t\t\tregionsIndexesSaved = [...props.modelValue];\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t// загрузить индексы регионов, если они были сохранены\n\t\t\t\tregionsIndexesSaved = JSON.parse(\n\t\t\t\t\tlocalStorage.getItem('ui:project:regionSelector' + props.projectId + ':regionsIndexes') as string,\n\t\t\t\t) ?? [];\n\t\t\t} catch (e) {\n\n\t\t\t}\n\t\t}\n\n\t\t// убрать из сравнения регионы, которых нет в props.searchers\n\t\tif (regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = regionsIndexesSaved.filter((regionIndex) => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\t// если не сохранено ни одного региона, выбрать все регионы проекта\n\t\tif (!regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = Array.from(allRegionsIndexes.value);\n\t\t}\n\n\t\tregionsIndexes.value = [...regionsIndexesSaved];\n\t};\n\n\t/**\n\t * Сохранение выбранных регионов\n\t */\n\tconst compareSave = () => {\n\t\tif (regionsIndexes.value.length) {\n\t\t\tlocalStorage.setItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes', JSON.stringify(regionsIndexes.value));\n\t\t} else {\n\t\t\tlocalStorage.removeItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes');\n\t\t}\n\t};\n\n\twatch(regionsIndexes, () => {\n\t\tcompareSave();\n\t});\n\n\tif (props.addCompare) {\n\t\t// if (props.compareRegionsIndexes?.length) {\n\t\t// \tcompareRegionsIndexes.value = [...props.compareRegionsIndexes];\n\t\t// } else {\n\t\t// \tcompareLoad();\n\t\t// }\n\n\t\tcompareLoad();\n\t}\n\n\treturn {\n\t\tregionsIndexes,\n\t};\n};\n","import { computed, watch } from 'vue';\nimport { findRegion, genSearcherByKey } from '../utils/utils';\nimport { dummyIndex, globalRegionIndex, searcherUndefined, searhcerCompareKey } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\nimport { useSelectSearcher } from './selectSearcher';\nimport { useSelectRegion } from './selectRegion';\nimport { useCompare } from './compare';\n\n/**\n * Создание и управления рективными переменными компонента\n *\n * @param props - входные props компонента\n */\nexport const useSelectorRegion = (props: Props) => {\n\tconst searcherByKey = computed(() => {\n\t\treturn genSearcherByKey(props.forFrequency, props.autoRegion, props.searchers);\n\t});\n\n\tconst activeSearcherIndexed = computed(() => {\n\t\treturn searcherByKey.value.get(selectSearcher.searcherKey.value) || searcherUndefined;\n\t});\n\n\t/**\n\t * Все индексы регионов из searcherByKey\n\t *\n\t * Активность регионов определяется в searcherByKey\n\t */\n\tconst allRegionsIndexes = computed(() => {\n\t\tconst regionsIndexes = new Set<number>();\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\tsearcher.regionByIndex.forEach((region) => {\n\t\t\t\tif (region.index === globalRegionIndex) return;\n\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\tregionsIndexes.add(region.index);\n\t\t\t});\n\t\t});\n\n\t\treturn regionsIndexes;\n\t});\n\n\tconst selectSearcher = useSelectSearcher(props, searcherByKey);\n\tconst selectRegion = useSelectRegion(props, activeSearcherIndexed);\n\tconst compare = useCompare(props, searcherByKey, allRegionsIndexes);\n\n\t// контроль за внешним изменением списка ПС\n\twatch(searcherByKey, () => {\n\t\t// возможные значения для сравнения регионов/пс\n\t\tif (props.onlySearcher) {\n\t\t\tcompare.regionsIndexes.value = Array.from(searcherByKey.value.keys());\n\t\t} else {\n\t\t\tcompare.regionsIndexes.value = compare.regionsIndexes.value.filter(regionIndex => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\tif (selectSearcher.searcherKey.value === searhcerCompareKey) return;\n\n\t\tlet newSearcherKey = searcherByKey.value.keys().next().value;\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t// определить выбранную ПС\n\t\t\tif (props.onlySearcher && searcher.key === selectSearcher.searcherKey.value) {\n\t\t\t\tnewSearcherKey = selectSearcher.searcherKey.value;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tselectRegion.regionIndex.value &&\n\t\t\t\tsearcher.regionByIndex?.has(selectRegion.regionIndex.value)\n\t\t\t) {\n\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t}\n\n\t\t\t// выбрать первую ПС с выбранным регионом\n\t\t\tif (!props.onlySearcher) {\n\t\t\t\tlet regionsNewSearcher: SearcherIndexed['regionByIndex'] | undefined;\n\n\t\t\t\tif (newSearcherKey !== undefined) {\n\t\t\t\t\tregionsNewSearcher = searcherByKey.value.get(newSearcherKey)?.regionByIndex;\n\t\t\t\t}\n\n\t\t\t\tconst regionsCurrentSearcher = searcherByKey.value.get(searcher.key)?.regionByIndex;\n\t\t\t\tif (\n\t\t\t\t\tregionsNewSearcher?.has(dummyIndex) &&\n\t\t\t\t\t!regionsCurrentSearcher?.has(dummyIndex)\n\t\t\t\t) {\n\t\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// if (props.addCompare && !selectSearcher.optionBySearcherKey.value.has(dummyIndex)) {\n\t\t// \tif (!selectRegion.regionIndex.value && compare.regionsIndexes.value?.length) newSearcherKey = searhcerCompareKey;\n\t\t// }\n\n\t\t// if (props.onlySearcher && selectRegion.regionIndex.value !== dummyIndex) newSearcherKey = selectRegion.regionIndex.value;\n\n\t\tif (newSearcherKey !== undefined) {\n\t\t\tselectSearcher.searcherKey.value = newSearcherKey;\n\t\t}\n\n\t\tif (\n\t\t\tselectRegion.regionIndex.value !== undefined &&\n\t\t\t!(activeSearcherIndexed.value?.regionByIndex)?.has(selectRegion.regionIndex.value)\n\t\t) {\n\t\t\tselectRegion.regionIndex.value = activeSearcherIndexed.value?.regions?.keys().next().value as number;\n\t\t}\n\t}, { immediate: true });\n\n\tconst getSearcherKey = () => {\n\t\tif (selectSearcher.searcherKey.value === searhcerCompareKey || selectSearcher.searcherKey.value === dummyIndex) return;\n\n\t\treturn selectSearcher.searcherKey.value;\n\t};\n\n\tconst getRegionIndex = () => {\n\t\tif (props.onlySearcher) return;\n\n\t\tif (selectRegion.regionIndex.value === dummyIndex) return;\n\n\t\tlet res: Region['index'] | undefined = selectRegion.regionIndex.value;\n\n\t\t// в качестве ключа используется region.key\n\t\tif (props.forFrequency) {\n\t\t\tconst regionKey = selectRegion.regionIndex.value;\n\t\t\tconst region = findRegion(props.forFrequency, { searcher_key: getSearcherKey(), key: regionKey } as Region, props.searchers);\n\n\t\t\tres = region?.index;\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Получить выбранную ПС\n\t */\n\tconst getSearcher = () => {\n\t\tconst searcherKey = getSearcherKey();\n\t\tif (searcherKey === undefined) return;\n\n\t\treturn searcherByKey.value.get(searcherKey);\n\t};\n\n\t/**\n\t * Получить выбранный регион\n\t */\n\tconst getRegion = () => {\n\t\tconst regionIndex = getRegionIndex();\n\t\tif (regionIndex === undefined) return;\n\n\t\treturn getSearcher()?.regionByIndex?.get(regionIndex);\n\t};\n\n\treturn {\n\t\tselectSearcher,\n\t\tselectRegion,\n\t\tcompare,\n\n\t\tsearcherByKey,\n\t\tallRegionsIndexes,\n\n\t\tgetSearcher,\n\t\tgetRegion,\n\t};\n};\n","<script setup lang=\"ts\">\nimport { watch } from 'vue';\nimport type { Props, Region } from './selectorRegion';\nimport Select from '@/components/forms/select/select.vue';\nimport Button from '@/components/forms/button/button.vue';\nimport { useSelectorRegion } from './composables/selectorRegion';\nimport { dummyIndex, globalRegionIndex, searhcerCompareKey } from './utils/consts';\nimport { dialogSelectorRegions } from '@/components/project/selectorRegion/utils/utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsearchers: () => [],\n\t// compareRegionsIndexes: () => [],\n\taddSearcherIcon: true,\n\taddRegionIcon: true,\n\taddChanger: true,\n});\n\nconst model = defineModel<Props['modelValue']>({ required: true });\nconst modelSingle = defineModel<Props['modelValueSingle']>('modelValueSingle');\n\nconst {\n\tselectSearcher,\n\tselectRegion,\n\tcompare,\n\n\tsearcherByKey,\n\tallRegionsIndexes,\n\n\tgetSearcher,\n\tgetRegion,\n} = useSelectorRegion(props);\n\nconst onClickCompare = () => {\n\tconst regions: Region[] = [];\n\n\tsearcherByKey.value.forEach((searcher) => {\n\t\tif (!searcher.enabled) return;\n\n\t\tsearcher.regions.forEach((region) => {\n\t\t\tif (!region.enabled) return;\n\n\t\t\tregions.push(region);\n\t\t});\n\t});\n\n\tdialogSelectorRegions.open('selectorRegions', {\n\t\tregions,\n\t\tregionsIndexes: compare.regionsIndexes.value,\n\t\t'@update:regionsIndexes': (regionsIndexes: number[]) => compare.regionsIndexes.value = regionsIndexes,\n\t});\n};\n\nwatch([selectRegion.regionIndex, selectSearcher.searcherKey, compare.regionsIndexes], () => {\n\tif (selectSearcher.searcherKey.value === searhcerCompareKey && compare.regionsIndexes.value.length) {\n\t\tif (JSON.stringify(model.value) === JSON.stringify(compare.regionsIndexes.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tmodel.value = [...compare.regionsIndexes.value];\n\t} else {\n\t\tif (props.onlySearcher) {\n\t\t\tmodel.value = [selectSearcher.searcherKey.value];\n\n\t\t\tif (selectSearcher.searcherKey.value === dummyIndex && !props.autoRegion) model.value.length = 0;\n\t\t} else {\n\t\t\tmodel.value = [selectRegion.regionIndex.value];\n\n\t\t\t// не добавлять несуществующий регион в результаты\n\t\t\tif (selectRegion.regionIndex.value === dummyIndex && !props.autoRegion) model.value.length = 0;\n\t\t}\n\t}\n\n\t// регионов нет\n\tif (!props.onlySearcher && !allRegionsIndexes.value.size) {\n\t\tselectSearcher.searcherKey.value = dummyIndex;\n\t}\n});\n\nif (modelSingle.value) {\n\twatch(modelSingle, () => {\n\t\tif (modelSingle.value) {\n\t\t\tmodel.value = [modelSingle.value];\n\t\t}\n\t}, { immediate: true });\n}\n\nwatch(model, () => {\n\tif (model.value[0]) {\n\t\tmodelSingle.value = model.value[0];\n\t}\n\n\t// проверка входных данных v-model на корректность\n\tif (props.onlySearcher) {\n\t\tif (\n\t\t\t!model.value.length ||\n\t\t\tmodel.value.length === 1 && !searcherByKey.value.has(model.value[0]) ||\n\t\t\tmodel.value.length === 1 && model.value[0] === dummyIndex && !props.autoRegion\n\t\t) {\n\t\t\tlet defaultKey: number | undefined = searcherByKey.value.keys().next().value;\n\n\t\t\t// запретить устанавливать несуществующий регион\n\t\t\tif (defaultKey === dummyIndex && !props.autoRegion) {\n\t\t\t\tdefaultKey = undefined;\n\n\t\t\t\tmodelSingle.value = dummyIndex;\n\t\t\t}\n\n\t\t\tif (defaultKey !== undefined) {\n\t\t\t\tmodel.value = [defaultKey];\n\t\t\t}else{\n\t\t\t\tmodel.value.length = 0;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tmodel.value.length > 1 &&\n\t\t\tJSON.stringify(model.value) !== JSON.stringify(compare.regionsIndexes.value)\n\t\t) {\n\t\t\tmodel.value = [...compare.regionsIndexes.value];\n\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\tlet newModel = [...new Set(model.value)];\n\n\t\tlet defaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.keys().next().value;\n\t\tif (props.forFrequency) {\n\t\t\tdefaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.values().next().value?.key;\n\t\t}\n\n\t\t// запретить устанавливать несуществующий регион\n\t\tif (defaultIndex === dummyIndex && !props.autoRegion) {\n\t\t\tdefaultIndex = undefined;\n\n\t\t\tmodelSingle.value = dummyIndex;\n\t\t}\n\n\t\tif (!newModel.length) {\n\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t} else if (newModel.length === 1) {\n\t\t\tlet all = allRegionsIndexes.value;\n\n\t\t\tif (props.forFrequency) {\n\t\t\t\tall = new Set();\n\t\t\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t\t\tsearcher.regionByIndex.forEach((region) => {\n\t\t\t\t\t\tif (region.index === globalRegionIndex) return;\n\t\t\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\t\t\tall.add(region.key);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// убрано, так как dummyIndex запрещено выбирать в model\n\t\t\t// if (!all.has(newModel[0]) && newModel[0] !== dummyIndex) {\n\t\t\tif (!all.has(newModel[0])) {\n\t\t\t\tnewModel = [];\n\t\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tnewModel = newModel.filter(index => allRegionsIndexes.value.has(index));\n\t\t\tif (!newModel.length && defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t}\n\n\t\tif (JSON.stringify(model.value) !== JSON.stringify(newModel)) {\n\t\t\tmodel.value = newModel;\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// входные данные v-model совпадают с внутренними значениями\n\tif (\n\t\tmodel.value.length === 1 &&\n\t\tmodel.value[0] === (props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value)\n\t) {\n\t\treturn;\n\t}\n\n\t// if (\n\t// \tmodel.value.length > 1 &&\n\t// \tselectorSearcher.searcherKey.value === searhcerCompareKey &&\n\t// \tJSON.stringify(model.value) === JSON.stringify(selectorCompare.regionsIndexes.value)\n\t// ) {\n\t// \treturn;\n\t// }\n\n\t// обновление regionIndex, searcherKey, selectorCompare.regionsIndexes\n\tif (props.onlySearcher) {\n\t\t// if (!model.value.length) {\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\n\t\t//\n\t\t// \treturn;\n\t\t// }\n\n\t\tif (model.value.length === 1) {\n\t\t\tselectSearcher.searcherKey.value = model.value[0];\n\n\t\t\treturn;\n\t\t}\n\n\t\tselectSearcher.searcherKey.value = searhcerCompareKey;\n\n\t\treturn;\n\t} else {\n\t\tif (!model.value.length) {\n\t\t\t// selectSearcher.searcherKey.value = dummyIndex;\n\t\t\t// selectRegion.regionIndex.value = dummyIndex;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (model.value.length === 1 && selectSearcher.searcherKey.value !== searhcerCompareKey) {\n\t\t\tselectRegion.regionIndex.value = model.value[0];\n\n\t\t\tlet newSearherKey: number | undefined;\n\t\t\tfor (const searcher of searcherByKey.value.values()) {\n\t\t\t\tfor (const region of searcher.regionByIndex.values()) {\n\t\t\t\t\tconst currentRegionIndex = props.forFrequency ? region.key : region.index;\n\t\t\t\t\tif (currentRegionIndex === selectRegion.regionIndex.value) {\n\t\t\t\t\t\tnewSearherKey = searcher.key;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\tselectSearcher.searcherKey.value = newSearherKey;\n\t\t\t}\n\t\t} else {\n\t\t\tselectSearcher.searcherKey.value = searhcerCompareKey;\n\t\t\tcompare.regionsIndexes.value = [...model.value];\n\t\t}\n\t}\n}, { immediate: true });\n\ndefineExpose({\n\tgetSearcher,\n\tgetRegion,\n});\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-selectorRegion': true,\n\t\t\t'top-selectorRegion-onlySearcher': onlySearcher,\n\t\t}\"\n\t>\n\t\t<Select\n\t\t\t:options=\"selectSearcher.optionBySearcherKey.value\"\n\t\t\tv-model=\"selectSearcher.searcherKey.value\"\n\t\t\tname=\"searcher_key\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t/>\n\n\t\t<Select\n\t\t\tv-if=\"!onlySearcher && selectSearcher.searcherKey.value !== searhcerCompareKey\"\n\t\t\tclass=\"top-select-region\"\n\t\t\t:options=\"selectRegion.optionByRegionIndex.value\"\n\t\t\tv-model=\"selectRegion.regionIndex.value\"\n\t\t\t:name=\"forFrequency ? 'region_key' : 'region_index'\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t\t:data-top-icon=\"addRegionIcon ? '' : undefined\"\n\t\t/>\n\n\t\t<Button\n\t\t\tv-if=\"addCompare && !onlySearcher && selectSearcher.searcherKey.value === searhcerCompareKey\"\n\t\t\tname=\"compare\"\n\t\t\t@click=\"onClickCompare\"\n\t\t\t:data-count-compare-regions-indexes=\"compare.regionsIndexes.value.length\"\n\t\t>\n\t\t\t{{ $i18n.Common.Selected_regions }}\n\t\t</Button>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/searcherColors.css\";\n\n.top-selectorRegion {\n\twidth: 340px;\n\tdisplay: inline-flex;\n\tvertical-align: middle;\n}\n\n.top-selectorRegion > .top-select {\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > .top-select:focus-within {\n\tz-index: 4;\n}\n\n.top-selectorRegion > .top-select > .top-select_select:hover,\n.top-selectorRegion > .top-select > .top-select_select.top-error {\n\tz-index: 1;\n}\n\n.top-selectorRegion > .top-select-searcher_key {\n\twidth: 140px;\n\tmax-width: 160px;\n\tmargin-right: -1px;\n}\n\n.top-selectorRegion > .top-select-region > select {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n}\n\n.top-selectorRegion > .top-select-region {\n\t--top-icon-size: 20px;\n\t--top-icon-color: var(--color-text-primary-1);\n\n\t--top-icon2-size: 20px;\n\t--top-icon2-color: var(--color-text-primary-1);\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2] {\n\t--top-icon2-size: 16px;\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2]:after {\n\ttext-indent: -4px;\n}\n\n.top-selectorRegion > [name=\"compare\"] {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > [name=\"compare\"]:after {\n\tcontent: \"(\" attr(data-count-compare-regions-indexes) \")\";\n\tmargin: 0 0 0 6px;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key > select {\n\tborder-top-right-radius: 0;\n\tborder-bottom-right-radius: 0;\n\tmargin-right: 0;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key[data-value=\"-1\"] > select {\n\tborder-right: none;\n}\n\n.top-selectorRegion-onlySearcher {\n\twidth: 140px;\n}\n</style>\n","import type { Tag } from './types';\n\nexport default [\n\t{\n\t\tid: '1',\n\t\tname: 'Without Tag',\n\t\tcolor_id: '1',\n\t},\n\t{\n\t\tid: '2',\n\t\tname: 'Red',\n\t\tcolor_id: '2',\n\t},\n\t{\n\t\tid: '3',\n\t\tname: 'Orange',\n\t\tcolor_id: '3',\n\t},\n\t{\n\t\tid: '4',\n\t\tname: 'Yellow',\n\t\tcolor_id: '4',\n\t},\n\t{\n\t\tid: '5',\n\t\tname: 'Blue',\n\t\tcolor_id: '5',\n\t},\n\t{\n\t\tid: '6',\n\t\tname: 'Purple',\n\t\tcolor_id: '6',\n\t},\n\t{\n\t\tid: '7',\n\t\tname: 'Green',\n\t\tcolor_id: '7',\n\t},\n\t{\n\t\tid: '8',\n\t\tname: 'Magenta',\n\t\tcolor_id: '8',\n\t},\n\t{\n\t\tid: '9',\n\t\tname: 'Dark blue',\n\t\tcolor_id: '9',\n\t},\n\t{\n\t\tid: '10',\n\t\tname: 'Turquoise',\n\t\tcolor_id: '10',\n\t},\n] as Tag[];\n","import type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Tag, TagIdExclude } from '../types';\n\n/**\n * Полуичить значение исключения тега tagId\n */\nexport const genTagIdExcluded = (tagId: Tag['id']): TagIdExclude => {\n\treturn '-' + tagId as TagIdExclude;\n};\n\n/**\n * Вернуть чистый tagId без exclude флага\n */\nexport const genTagIdClear = (tagId: Tag['id'] | TagIdExclude) => {\n\tif (tagId[0] === '-') return tagId.substring(1) as Tag['id'];\n\n\treturn tagId as Tag['id'];\n};\n\n/**\n * Получить инфомрацию о теге по его id\n */\nexport const getTagById = (tagId: Tag['id'] | TagIdExclude, tags: TagSelectorOpenerProps['tags']) => {\n\ttagId = genTagIdClear(tagId);\n\n\tconst tag = tags.find(tag => tag.id === tagId);\n\tif (!tag) return;\n\n\treturn tag;\n};\n","<script setup lang=\"ts\">\nimport { computed, nextTick, ref } from 'vue';\nimport type { Emits, Props } from './types';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\nimport TopPopupListItem from '@/components/popup/popup/listItem.vue';\n\nconst props = defineProps<Props>();\nconst emit = defineEmits<Emits>();\n\nconst name = defineModel<Props['name']>('name', {\n\trequired: true,\n});\n\nconst elName = ref<HTMLElement | null>(null);\n\n/**\n * @todo Удалить через пол года после выхода версии firefox с поддержкой contenteditable plaintext-only, включая бета версии\n */\nconst firefoxProps = computed(() => {\n\tif (navigator.userAgent.indexOf('Firefox') != -1) {\n\n\t\treturn {\n\t\t\tcontenteditable: inEdit.value,\n\t\t\tonpaste: (event: Event) => event.preventDefault(),\n\t\t};\n\t}\n\n\treturn {};\n});\n\n/**\n * Включен режим редактирвоания\n */\nconst inEdit = ref(false);\n\n/**\n * Включить режим редактирование\n */\nconst turnToEdit = async () => {\n\tinEdit.value = true;\n\n\tawait nextTick();\n\n\telName.value?.focus();\n};\n\n/**\n * Применить редактирование\n */\nconst editCommit = () => {\n\tconst name = elName.value?.innerText;\n\tif (!name) return editCancel();\n\n\tif (elName.value) elName.value.innerText = name;\n\n\tinEdit.value = false;\n\n\temit('update:name', name);\n};\n\n/**\n * Отменить редактирование\n */\nconst editCancel = async () => {\n\tif (elName.value) elName.value.innerText = props.name;\n\n\tinEdit.value = false;\n};\n\n/**\n * Применить выбор\n */\nconst changeSelect = (e: MouseEvent) => {\n\t// в режиме редактирования выбор не применяется\n\tif (inEdit.value) return;\n\n\t// тег запрещено выбирать\n\tif (props.disabled) return;\n\n\tlet toState: Props['state'] = 'selected';\n\n\tif (props.canExclude) {\n\t\tif (e.ctrlKey || e.metaKey) {\n\t\t\ttoState = 'excluded';\n\t\t}\n\t}\n\n\tif (props.state == toState) {\n\t\ttoState = '';\n\t}\n\n\tif (toState === '') emit('unselect');\n\tif (toState === 'selected') emit('select');\n\tif (toState === 'excluded') emit('exclude');\n};\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\t:class=\"{\n\t\t\t'top-tagSelector_tagListItem': true,\n\t\t\t'top-tagSelector_tagListItem-inEdit': inEdit,\n\t\t\t'top-tagSelector_tagListItem-disabled': disabled,\n\t\t\t'top-tagSelector_tagListItem-canExclude': canExclude,\n\t\t\t'top-tagSelector-active': !!state,\n\t\t\t'top-tagSelector-excluded': state === 'excluded'\n\t\t}\"\n\t\t@click.stop=\"changeSelect\"\n\t>\n\t\t<TopTagIcon\n\t\t\t:id\n\t\t\t:name\n\t\t\t:colorId\n\t\t\t:state\n\t\t/>\n\n\t\t<span\n\t\t\tref=\"elName\"\n\t\t\tclass=\"top-tagSelector_tagListItemName\"\n\t\t\t:contenteditable=\"inEdit ? 'plaintext-only' : false\"\n\t\t\t:=\"firefoxProps\"\n\t\t\t@keydown.enter.stop=\"editCommit\"\n\t\t\t@keydown.esc.stop=\"editCancel\"\n\t\t>\n\t\t\t{{ name }}\n\t\t</span>\n\n\t\t<template v-if=\"editable\">\n\t\t\t<span\n\t\t\t\tv-if=\"!inEdit\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click=\"turnToEdit\"\n\t\t\t></span>\n\n\t\t\t<span\n\t\t\t\tv-else\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click.stop=\"editCommit\"\n\t\t\t></span>\n\t\t</template>\n\t</TopPopupListItem>\n</template>\n\n<style>\n.top-tagSelector_tagListItem.top-popup_listItem {\n\tpadding-top: var(--top-padding-2) !important;\n\tpadding-bottom: var(--top-padding-2) !important;\n\tgap: 10px;\n}\n\n.top-tagSelector_tagListItemName {\n\tborder-radius: var(--top-radius-1);\n\twidth: 120px;\n\tpadding: 4px 2px;\n\tmargin: -4px -2px;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\tflex-grow: 1;\n}\n\n/* редактирование */\n.top-tagSelector_edit {\n\t--top-icon-size: 18px;\n\t--top-icon-color: var(--color-text-3);\n\n\twidth: 20px;\n\tflex-grow: 0;\n}\n\n.top-tagSelector_edit:before {\n\tline-height: 0;\n}\n\n.top-tagSelector_edit { opacity: 0; }\n.top-tagSelector_edit:hover {\n\t--top-icon-color: var(--color-text-primary);\n}\n\n.top-tagSelector_tagListItem:hover .top-tagSelector_edit,\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_edit {\n\tcursor: pointer;\n\topacity: 1;\n}\n\n.top-tagSelector_tagListItem-inEdit {\n\tbackground: var(--color-layout-front-3) !important;\n\toutline: 1px dashed var(--color-line-2);\n\toutline-offset: -1px;\n}\n\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_tagListItemName {\n\tcursor: text;\n\tbackground: var(--color-layout-front-1);\n}\n\n/* disabled */\n.top-tagSelector_tagListItem-disabled {\n\tcursor: not-allowed !important;\n\topacity: 0.85;\n}\n.top-tagSelector_tagListItem-disabled:hover {\n\tbackground: inherit;\n}\n.top-tagSelector_tagListItem-disabled [data-tag_id] {\n\topacity: 0.6;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Props, TagSelectorTarget } from './types';\nimport TopPopupOpener from '../../../popup/popup/opener.vue';\nimport TopButton from '@/components/forms/button/button.vue';\nimport { genTagIdClear, getTagById } from '../utils/utils';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\n\ndefineOptions({\n\tinheritAttrs: false,\n});\n\nconst props = defineProps<Props>();\n\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\nconst component = props.useTopButton ? TopButton : 'div';\nconst componentSlotName = props.useTopButton ? 'html' : 'default';\n\nconst topTagSelectorTarget: TagSelectorTarget = {\n\tmodel,\n\tmode: props.mode,\n\ttargetId: props.targetId,\n\tfilters: props.filters,\n\tpayload: props.payload,\n};\n</script>\n\n<template>\n\t<TopPopupOpener :id>\n\t\t<component\n\t\t\t:is=\"component\"\n\t\t\t:class=\"{\n\t\t\t\t'top-tagSelector': true,\n\t\t\t\t'top-tagSelector-filter': props.mode === 'filter',\n\t\t\t\t'top-tagSelector-setter_single': props.mode === 'setter' && !filters,\n\t\t\t\t'top-tagSelector-setter_several': props.mode === 'setter' && filters,\n\t\t\t\t'top-tagSelector-selectedOne': !model.length || model.length === 1,\n\t\t\t\t'top-tagSelector-toTwoLine': model.length > 5,\n\t\t\t}\"\n\t\t\tcolor=\"theme\"\n\t\t\tstyling=\"\"\n\t\t\tv-top-data:topTagSelectorTarget=\"topTagSelectorTarget\"\n\t\t\t:=$attrs\n\t\t>\n\t\t\t<template #[componentSlotName]>\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-if=\"!model.length && mode === 'filter'\"\n\t\t\t\t\tid=\"all\"\n\t\t\t\t\tcolorId=\"\"\n\t\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t\tstate=\"\"\n\t\t\t\t/>\n\n\t\t\t\t<!-- Массовое редактирование -->\n\t\t\t\t<div v-if=\"mode === 'setter' && filters\">\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- Список тегов -->\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-else\n\t\t\t\t\tv-for=\"tagId in model\"\n\t\t\t\t\t:id=\"genTagIdClear(tagId)\"\n\t\t\t\t\t:colorId=\"getTagById(tagId, tags)?.color_id ?? ''\"\n\t\t\t\t\t:name=\"getTagById(tagId, tags)?.name ?? ''\"\n\t\t\t\t\t:state=\"genTagIdClear(tagId) === tagId ? 'selected' : 'excluded'\"\n\t\t\t\t/>\n\t\t\t</template>\n\t\t</component>\n\t</TopPopupOpener>\n</template>\n\n<style>\n.top-tagSelector {\n\tcursor: pointer;\n\tmin-width: 0;\n\twhite-space: nowrap;\n\tjustify-content: left;\n}\n\n.top-tagSelector.top-button {\n\twidth: 112px;\n\tvertical-align: middle;\n}\n\n.top-tagSelector.top-button.top-select_arrow {\n\twidth: calc(112px + 20px);\n}\n\n.top-tagSelector-filter {\n\tgap: var(--top-gap-1);\n}\n\n/* все теги в фильтре */\n.top-tagSelector-filter [data-tag_id=\"all\"] {\n\tmargin-left: 0;\n}\n.top-tagSelector-filter [data-tag_id=\"all\"]:before {\n\tborder: none;\n\tmargin-left: 3px;\n\topacity: 0.5;\n}\n\n/* фильтр по одному тегу */\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id]:after {\n\tcontent: attr(title);\n\tmargin-left: 20px;\n\tmin-width: 74px;\n\ttext-align: left;\n\tline-height: 1.2;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n}\n\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id=\"all\"]:after {\n\tmargin-left: 0;\n}\n\n/* фильтр по многим тегам */\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine {\n\tflex-wrap: wrap;\n\talign-content: center;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id] {\n\t--top-tag-selector-size: 8px;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id]:nth-child(5) {\n\tmargin-right: 5px;\n}\n\n/* установка тегов */\n.top-tagSelector-setter_single {\n\tposition: relative;\n\tdisplay: flex !important; flex-direction: column; flex-wrap: wrap; align-items: stretch !important;\n}\n\n.top-tagSelector-setter_single [data-tag_id] {\n\twidth: auto; min-height: 20%; min-width: 50%;\n\tflex: 1 1 auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, reactive, ref, shallowRef, watch } from 'vue';\n\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport { debounce } from '@/core/utils/lodash';\n\nimport type { Option } from '@/components/forms/select/select';\nimport TopSelect from '@/components/forms/select/select.vue';\n\nimport TopButton from '@/components/forms/button/button.vue';\n\nimport type { PopupEvent } from '@/components/popup/popup/popup';\nimport TopPopup from '../../popup/popup/popup.vue';\nimport TopPopupListItem from '../../popup/popup/listItem.vue';\n\nimport type { Emits, FiltersAction, Props, Tag } from './types';\nimport tagsDefaults from './tagsDefaults';\nimport { genTagIdExcluded } from './utils/utils';\n\nimport type { Props as TagListItemProps } from './popupListItem/types';\nimport TopTagListItem from './popupListItem/tagPopupListItem.vue';\n\nimport type { TagSelectorTarget } from './popupOpener/types';\nimport TopTagSelectorPopupOpener from './popupOpener/popupOpener.vue';\n\nconst i18n = useI18n();\n\nconst props = withDefaults(defineProps<Props>(), {\n\ttagsMax: 10,\n\trequiredForSetter: true,\n\temitDelay: 500,\n});\n\n/**\n * Выбранные теги кнопки в этом компоненте\n *\n * Редактирвоание ведется только через `editTarget.model`\n */\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\n/**\n * Список тегов\n */\nconst tags = defineModel<Tag[]>('tags', {\n\tdefault: reactive(tagsDefaults),\n});\n\nconst emit = defineEmits<Emits>();\n\nconst emitDebounce: typeof emit = debounce((name, e) => {\n\temit(name, e);\n}, props.emitDelay);\n\n// требуется сразу указать один тег\nif (props.singleMode && !model.value.length) {\n\tmodel.value = [tags.value[0].id];\n}\n\nconst id = props.id ?? 'top-popup-id-' + Math.random() + '';\n\nconst filtersAction = ref<FiltersAction>('add');\n\n/**\n * Сгенерировать опции для выбора дейсвтия массого редактирования\n */\nconst genFiltersActionOptions = () => {\n\tconst tagsText = ' ' + i18n.Common.Tags?.toLowerCase();\n\n\tconst res = new Map<FiltersAction, Option>();\n\tres.set('add', { value: 'add', title: i18n.Common.Add + tagsText });\n\tres.set('replace', { value: 'replace', title: i18n.Common.Replace + tagsText });\n\tres.set('delete', { value: 'delete', title: i18n.Common.Delete + tagsText });\n\n\treturn res;\n};\n\n/**\n * Целевой объект редактирвоания тегов\n *\n * Определяется кнопкой, которая открыла popup выбора тегов\n */\nlet target = shallowRef<TagSelectorTarget>({\n\tmodel,\n\tmode: 'filter',\n\ttargetId: undefined,\n\tfilters: undefined,\n\tpayload: undefined,\n});\n\nwatch(model, () => {\n\temitDebounce('selector', model.value);\n});\n\n/**\n * Можно ли выбрать еще теги\n */\nconst disabled = computed(() => {\n\tif (target.value.mode !== 'setter') return;\n\n\tif (!props.maxTagsForSetter) return;\n\n\t// массовая смена тегов, количество тегов в результате узнать невозможно\n\tif (target.value.filters) return;\n\n\treturn target.value.model.value.length >= props.maxTagsForSetter;\n});\n\nconst genTargetTagState = (tagId: Tag['id'] | 'all'): TagListItemProps['state'] => {\n\tif (tagId !== 'all') {\n\t\tif (target.value.model.value.includes(tagId)) return 'selected';\n\n\t\tif (target.value.model.value.includes(genTagIdExcluded(tagId))) return 'excluded';\n\t}\n\n\t// Все теги, ни один из тегов не выбран\n\tif (tagId === 'all' && !target.value.model.value.length) return 'selected';\n\n\treturn '';\n};\n\nconst updateTargetModel = (tagId: Tag['id'], action: 'unselect' | 'select' | 'exclude') => {\n\tconst tagIdExcluded = genTagIdExcluded(tagId);\n\n\tlet tagsIds = target.value.model.value.filter(modelTagId => modelTagId !== tagId && modelTagId !== tagIdExcluded);\n\n\tif (action === 'select') tagsIds.push(tagId);\n\tif (action === 'exclude') tagsIds.push(tagIdExcluded);\n\n\t// режим редактирвоания тегов одного объекта с требованием указать хотя бы один тег\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined && props.requiredForSetter) {\n\t\t// нельзя снимать выделение со всех тегов\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds.push('1');\n\t\t}\n\n\t\t// при первом выборе сразу снять тег \"Без тега\"\n\t\tif (tagsIds.length === 2 && target.value.model.value.length === 1 && target.value.model.value[0] === '1') {\n\t\t\ttagsIds = tagsIds.filter((tagId) => tagId !== '1');\n\t\t}\n\t}\n\n\t// режим выбора одного тега\n\tif (props.singleMode && !target.value.filters) {\n\t\t// нужно указать хотя бы один тег\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds = target.value.model.value;\n\t\t}\n\n\t\tif (tagsIds.length > 1) {\n\t\t\ttagsIds = [tagsIds[tagsIds.length - 1]];\n\t\t}\n\t}\n\n\t// всегда выводить теги в порядке, указанном в настройках tags\n\ttagsIds.sort((a, b) => {\n\t\tif (!props.tags) return 0;\n\n\t\tconst aIndex = props.tags.findIndex((tag) => tag.id === a);\n\t\tconst bIndex = props.tags.findIndex((tag) => tag.id === b);\n\n\t\treturn aIndex - bIndex;\n\t});\n\n\ttarget.value.model.value = tagsIds;\n\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined) {\n\t\temitDebounce('setter', {\n\t\t\ttagsIds: tagsIds as Tag['id'][],\n\t\t\ttargetId: target.value.targetId,\n\t\t\tpayload: target.value.payload,\n\t\t});\n\t}\n};\n\nconst classString = computed(() => {\n\tlet res = 'top-tagSelector_popup';\n\n\tif (target.value.mode === 'filter') res += ' top-tagSelector_popup-filter';\n\tif (target.value.mode === 'setter') res += ' top-tagSelector_popup-setter';\n\n\treturn res;\n});\n\n/**\n * Добавить тег\n */\nconst addTag = () => {\n\tconst tagName = prompt('', 'New tag');\n\tif (!tagName || tagName === 'New tag') return;\n\n\tconst tagId = tags.value.length + 1;\n\n\ttags.value.push({\n\t\tid: String(tagId) as Tag['id'],\n\t\tname: tagName,\n\t\tcolor_id: String((tagId - 1) % 10 + 1) as Tag['color_id'],\n\t});\n\n\temit('tagsChanged', tags.value);\n};\n\nconst onOpen = (popupEvent: PopupEvent) => {\n\t// popup открыт другой кнопкой c другим modelValue, для редактирвоания объектов\n\ttarget.value = storage(popupEvent.elPopupOpener, 'topTagSelectorTarget');\n\tif (!target.value) throw new Error('Open popup TopTagSelector required v-data:topTagSelectorTarget');\n\n\t// при начале массовой установки тегов сбросить состояние формы\n\tif (target.value.filters) {\n\t\tfiltersAction.value = 'add';\n\t\ttarget.value.model.value = [];\n\t}\n\n\tif (!Core.$?.ui['sortable']) {\n\t\tconsole.info('Для работы сортировки требуется глобальная загрузка jQuery UI Sortable');\n\n\t\treturn;\n\t}\n\n\tif (!Core.state.isMobile && !Core.state.isMobileUA && tags.value) {\n\t\t$(popupEvent.elPopup).sortable({\n\t\t\titems: 'li:has([data-tag_id]:not([data-tag_id=\"all\"]))',\n\n\t\t\t/**\n\t\t\t * @todo Удалить `[contenteditable=\"true\"]` через пол года после выхода версии firefox с поддержкой contenteditable plaintext-only, включая бета версии\n\t\t\t */\n\t\t\tcancel: '[contenteditable=\"plaintext-only\"], [contenteditable=\"true\"]',\n\n\t\t\tdistance: 10,\n\t\t\tstop: function (_e, ui) {\n\t\t\t\tif (!tags.value) return;\n\n\t\t\t\tconst $tags = $(ui.item).parent().find('[data-tag_id]');\n\n\t\t\t\tconst tagsSorted: Tag['id'][] = [];\n\t\t\t\t$tags.each((_index, elTag) => {\n\t\t\t\t\tif (!tags.value) return;\n\n\t\t\t\t\tconst tagId = $(elTag).attr('data-tag_id') as Tag['id'];\n\t\t\t\t\ttagsSorted.push(tagId);\n\t\t\t\t});\n\n\t\t\t\ttags.value.sort((tagIdA, tagIdB) => {\n\t\t\t\t\tconst a = tagsSorted.findIndex(tagSorted => tagSorted === tagIdA.id);\n\t\t\t\t\tconst b = tagsSorted.findIndex(tagSorted => tagSorted === tagIdB.id);\n\n\t\t\t\t\treturn a - b;\n\t\t\t\t});\n\n\t\t\t\temitDebounce('tagsChanged', tags.value);\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst onClose = (popupEvent: PopupEvent) => {\n\tif (!Core.$?.ui['sortable']) return;\n\n\tif ($(popupEvent.elPopup).data('ui-sortable')) {\n\t\t$(popupEvent.elPopup).sortable('destroy');\n\t}\n};\n</script>\n\n<template>\n\t<TopTagSelectorPopupOpener\n\t\tclass=\"top-select_arrow\"\n\t\tv-model=\"model\"\n\t\t:id\n\t\t:tags\n\t\tmode=\"filter\"\n\t\tuseTopButton\n\t/>\n\n\t<TopPopup\n\t\t:id\n\t\t:class=\"classString\"\n\t\t@open=\"onOpen($event)\"\n\t\t@close=\"onClose($event)\"\n\t\t:transition-duration=\"50\"\n\t>\n\t\t<!-- Массовое редактирвоание-->\n\t\t<template #header v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopSelect\n\t\t\t\tv-model=\"filtersAction\"\n\t\t\t\t:options=\"genFiltersActionOptions()\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #footer v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopButton color=\"theme\">\n\t\t\t\t{{ $i18n.Common.Cancel }}\n\t\t\t</TopButton>\n\n\t\t\t<TopButton\n\t\t\t\t@click=\"emitDebounce('setter', {\n\t\t\t\t\ttagsIds: target.model.value as Tag['id'][],\n\t\t\t\t\tfilters: target.filters,\n\t\t\t\t\tfiltersAction,\n\t\t\t\t\tpayload: target.payload,\n\t\t\t\t})\"\n\t\t\t>\n\t\t\t\t{{ filtersAction === 'add' ? $i18n.Common['Add'] : '' }}\n\t\t\t\t{{ filtersAction === 'replace' ? $i18n.Common['Replace'] : '' }}\n\t\t\t\t{{ filtersAction === 'delete' ? $i18n.Common['Remove'] : '' }}\n\t\t\t</TopButton>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopTagListItem\n\t\t\t\tv-if=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\tid=\"all\"\n\t\t\t\tcolorId=\"\"\n\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t:state=\"target.model.value.length ? '' : 'selected'\"\n\t\t\t\t@select=\"target.model.value = []\"\n\t\t\t/>\n\n\t\t\t<TopTagListItem\n\t\t\t\tv-for=\"tag in tags\"\n\t\t\t\t:key=\"tag.id\"\n\t\t\t\t:id=\"tag.id\"\n\t\t\t\t:colorId=\"tag.color_id\"\n\t\t\t\t:name=\"tag.name\"\n\t\t\t\t:state=\"genTargetTagState(tag.id)\"\n\t\t\t\t:canExclude=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\t:editable=\"tagsEditable\"\n\t\t\t\t:disabled=\"disabled && genTargetTagState(tag.id) === ''\"\n\t\t\t\t@unselect=\"updateTargetModel(tag.id, 'unselect')\"\n\t\t\t\t@select=\"updateTargetModel(tag.id, 'select')\"\n\t\t\t\t@exclude=\"updateTargetModel(tag.id, 'exclude')\"\n\t\t\t\t@update:name=\"tag.name = $event as string, emitDebounce('tagsChanged', tags);\"\n\t\t\t/>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"tagsEditable && tags.length < tagsMax && tags.length < 20\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t@click.stop=\"addTag\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.Add }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-tagSelector_popup .top-popup {\n\tuser-select: none;\n\tmin-width: 220px !important;\n\ttext-align: left;\n}\n\n.top-tagSelector_popup .top-popup_header .top-select{\n\tflex-grow: 1;\n}\n</style>\n","import type { MaybeRefOrGetter } from 'vue';\nimport { computed, toValue } from 'vue';\nimport type { Item } from '@/components/project/selectorCompetitors/selectorCompetitors';\nimport type { Competitor } from '@/components/project/selectorCompetitors/types/competitor';\n\nexport const useItemsFromCompetitors = (competitors: MaybeRefOrGetter<Competitor[]>, projectId: MaybeRefOrGetter<number>) => {\n\treturn computed(() => {\n\t\tconst activeCompetitors = toValue(competitors).filter(competitor => competitor.on >= 0 || competitor.id === projectId);\n\n\t\tconst items: Item[] = activeCompetitors.map(competitor => {\n\t\t\treturn {\n\t\t\t\tvalue: competitor.id,\n\t\t\t\ttitle: competitor.url + ` [${competitor.id}]`,\n\t\t\t\ticon: competitor.id === toValue(projectId) ? '' : '',\n\t\t\t\tcontent: competitor.name,\n\t\t\t};\n\t\t});\n\n\t\treturn items;\n\t});\n};\n","import { isRef, type Ref, ref, unref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport TopPopupWorker from '@/components/popup/lib/worker';\nimport type { OpenerProps as PopupOpenerProps } from '@/components/popup/popup/popup';\nimport type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Props as TagIconProps } from '../tagIcon/types';\nimport { genTagIdClear, getTagById } from '../utils/utils';\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorPopupOpener для работы вне vue\n *\n * Требует монтирования компонента TopTagSelecor\n */\nexport const genElPopupOpener = (\n\tprops: TagSelectorOpenerProps & { modelValue: TagSelectorOpenerProps['modelValue'] | Ref<TagSelectorOpenerProps['modelValue']> },\n\tpropsPopup?: Partial<PopupOpenerProps>,\n\thtmlSetterSeveral?: string,\n): HTMLElement => {\n\tif (!propsPopup) propsPopup = { id: props.id };\n\n\tpropsPopup.id = props.id;\n\n\tconst el = TopPopupWorker.genElPopupOpener('div', propsPopup as PopupOpenerProps);\n\n\tel.classList.add('top-tagSelector');\n\tif (props.useTopButton) el.classList.add('top-button', 'top-color_theme');\n\tif (props.mode === 'filter') el.classList.add('top-tagSelector-filter');\n\tif (props.mode === 'setter' && !props.filters) el.classList.add('top-tagSelector-setter_single');\n\tif (props.mode === 'setter' && props.filters) el.classList.add('top-tagSelector-setter_several');\n\n\t// прокcи клик: lazy connect\n\tel.onclick = (e) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tel.onclick = null;\n\n\t\tconst model = ref(props.modelValue);\n\n\t\tconst target: TagSelectorTarget = {\n\t\t\tmodel,\n\t\t\tmode: props.mode,\n\t\t\ttargetId: props.targetId,\n\t\t\tfilters: props.filters,\n\t\t\tpayload: props.payload,\n\t\t};\n\n\t\tstorage(el, 'topTagSelectorTarget', target);\n\n\t\tdelete el.dataset.topPopupDisabled;\n\n\t\tif (!isRef(props.modelValue)) {\n\t\t\twatch(model, () => {\n\t\t\t\tprops.modelValue = model.value;\n\n\t\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t\t});\n\t\t}\n\n\t\t// выполнение клика\n\t\tel.click();\n\t};\n\n\tif (isRef(props.modelValue)) {\n\t\twatch(props.modelValue, () => elPopupOpenerRender(el, props, htmlSetterSeveral));\n\t} else {\n\t\tstorage(el, 'topTagSelectorRender', (modelValue: TagSelectorOpenerProps['modelValue']) => {\n\t\t\tprops.modelValue = modelValue;\n\n\t\t\tconst target = storage(el, 'topTagSelectorTarget');\n\t\t\tif (target) target.model.value = modelValue;\n\n\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t});\n\t}\n\n\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\n\treturn el;\n};\n\n/**\n * Вызвать перерисовку элемента, который был создан через genElPopupOpener()\n *\n * Работет только для элементов не с реактивным modelValue\n */\nexport const renderElPopupOpener = (el: HTMLElement, modelValue: TagSelectorOpenerProps['modelValue']) => {\n\tstorage(el, 'topTagSelectorRender')?.(modelValue);\n};\n\n/**\n * Отрисовать TopTagSelecorPopupOpener\n */\nconst elPopupOpenerRender = (el, props: TagSelectorOpenerProps, htmlSetterSeveral?: string) => {\n\tconst tagsIds = unref(props.modelValue);\n\n\tel.classList.toggle('top-tagSelector-selectedOne', !tagsIds.length || tagsIds.length === 1);\n\tel.classList.toggle('top-tagSelector-toTwoLine', tagsIds.length > 5);\n\n\tif (props.mode === 'setter' && props.filters) {\n\t\tel.innerHTML = `<div>${htmlSetterSeveral}</div>`;\n\n\t\treturn;\n\t}\n\n\tel.innerHTML = '';\n\n\tif (!tagsIds.length && props.mode === 'filter') {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: 'all',\n\t\t\tcolorId: '',\n\t\t\tname: useI18n().Common?.All_tags ?? '',\n\t\t\tstate: '',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t}\n\n\ttagsIds.forEach(tagId => {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: genTagIdClear(tagId),\n\t\t\tcolorId: getTagById(tagId, props.tags)?.color_id ?? '',\n\t\t\tname: getTagById(tagId, props.tags)?.name ?? '',\n\t\t\tstate: genTagIdClear(tagId) === tagId ? 'selected' : 'excluded',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t});\n};\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorTagIcon для работы вне vue\n */\nconst genElTagIcon = (props: TagIconProps) => {\n\tconst el = document.createElement('div');\n\n\tel.classList.add('top-tagSelector_tagIcon');\n\tel.classList.toggle('top-tagSelector-active', !!props.state);\n\tel.classList.toggle('top-tagSelector-excluded', props.state === 'excluded');\n\n\tel.dataset.tag_id = props.id;\n\tel.dataset.tag_color_id = props.colorId;\n\tel.title = props.name;\n\n\treturn el;\n};\n","import type { ComponentCustomProps } from 'vue';\n\nimport SelectorCompetitors from './selectorCompetitors/selectorCompetitors.vue';\nimport SelectorRegion from './selectorRegion/selectorRegion.vue';\n\nimport TagSelector from './tagSelector/tagSelector.vue';\nimport TagSelectorPopupOpener from './tagSelector/popupOpener/popupOpener.vue';\nimport TagSelectorTagIcon from './tagSelector/tagIcon/tagIcon.vue';\n\nexport const TopSelectorCompetitors = SelectorCompetitors as typeof SelectorCompetitors & ComponentCustomProps;\nexport { useItemsFromCompetitors } from './selectorCompetitors/composables';\n\nexport { findRegion, genSearcherByKey, dialogSelectorRegions } from './selectorRegion/utils/utils';\nexport const TopSelectorRegion = SelectorRegion as typeof SelectorRegion & ComponentCustomProps;\n\nexport type { Emits as TopTagSelectorEmits, Tag, TagId, TagIdExclude } from './tagSelector/types';\nexport {\n\tgenElPopupOpener as genElTopTagSelectorPopupOpener,\n\trenderElPopupOpener as renderElTopTagSelectorPopupOpener,\n} from './tagSelector/utils/el';\nexport const TopTagSelector = TagSelector as typeof TagSelector & ComponentCustomProps;\nexport const TopTagSelectorPopupOpener = TagSelectorPopupOpener as typeof TagSelectorPopupOpener & ComponentCustomProps;\nexport const TopTagSelectorTagIcon = TagSelectorTagIcon as typeof TagSelectorTagIcon & ComponentCustomProps;\n"],"names":["props","__props","model","useModel","selectAllItem","computed","useI18n","searhcerCompareKey","dummyIndex","globalRegionIndex","searchersNames","regionUndefined","searcherUndefined","regionAuto","searcherAuto","regionGlobal","getRegionAuto","getSearcherAuto","getRegionGlobal","genSearcherByKey","forFrequency","autoRegion","searchers","searcherByKey","genSearchersMapVolume","genSearchersMapCommon","onlyEnabledRegions","forceSearchersKeys","searcher","searcherI","region","regionI","searcherKey","serarcherByKey","searcherMail","findRegion","searchRegion","findedRegion","dialogSelectorRegions","useAsyncTopDialog","useSelectSearcher","mapSearchers","i18n","ref","optionBySearcherKey","res","option","getSearcherGIcon","dummyOption","compareOption","useSelectRegion","activeSearcherIndexed","regionIndex","_b","_a","_c","optionByRegionIndex","options","regionLabel","option2","langLabel","getLangLabel","getDeviceGIcon","watch","optionByRegionIndex2","oldOptionByRegionIndex","newRegionIndex","regionName","regionMatchLevel","index","title","regexpDevice","regionNameCompare","regionMatchLevelI","useCompare","allRegionsIndexes","regionsIndexes","compareLoad","regionsIndexesSaved","compareSave","useSelectorRegion","selectSearcher","selectRegion","compare","newSearcherKey","regionsNewSearcher","regionsCurrentSearcher","_d","getSearcherKey","getRegionIndex","regionKey","getSearcher","modelSingle","getRegion","onClickCompare","regions","defaultKey","newModel","defaultIndex","_e","all","newSearherKey","__expose","tagsDefaults","genTagIdExcluded","tagId","genTagIdClear","getTagById","tags","tag","tag2","emit","__emit","name","elName","firefoxProps","inEdit","event","turnToEdit","nextTick","editCommit","name2","editCancel","changeSelect","e","toState","component","_sfc_main$8","componentSlotName","topTagSelectorTarget","emitDebounce","debounce","id","filtersAction","genFiltersActionOptions","tagsText","target","shallowRef","disabled","genTargetTagState","updateTargetModel","action","tagIdExcluded","tagsIds","modelTagId","tagId2","a","b","aIndex","bIndex","classString","addTag","tagName","onOpen","popupEvent","storage","Core","ui","$tags","tagsSorted","_index","elTag","tagIdA","tagIdB","tagSorted","onClose","useItemsFromCompetitors","competitors","projectId","toValue","competitor","genElPopupOpener","propsPopup","htmlSetterSeveral","el","Worker","isRef","elPopupOpenerRender","modelValue","renderElPopupOpener","unref","elTagIcon","genElTagIcon","TopSelectorCompetitors","_sfc_main$5","TopSelectorRegion","_sfc_main$4","TopTagSelector","_sfc_main","TopTagSelectorPopupOpener","_sfc_main$1","TopTagSelectorTagIcon","_sfc_main$3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,UAAAA,IAAAC,GAGAC,IAAAC,EAAAF,GAAA,YAAA,GAEAG,IAAAC,EAAA,MAAA;AACC,UAAAL,EAAA;AACC,eAAA;AAAA,UAAO,MAAA;AAAA,UACA,OAAAM,EAAA,EAAA,OAAA;AAAA,UACkB,OAAA;AAAA,UACjB,SAAA;AAAA,QACE;AAAA,IAEX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICjBMC,IAAA,IAOAC,IAAA,IAKAC,KAAA,IAEAC,KAAA;AAAA,EAAuB,GAAA;AAAA,EAC1B,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACC,IAAA;AAEL,GAEOC,KAAA;AAAA,EAAgC,KAAAH;AAAA,EACjC,MAAA;AAAA,EACC,OAAAA;AAEP,GAEOI,KAAA;AAAA,EAA2C,KAAAJ;AAAA,EAC5C,MAAA;AAAA,EACC,SAAA,CAAAG,EAAA;AAAA,EACmB,eAAA,oBAAA,IAAA,CAAA,CAAAH,GAAAG,EAAA,CAAA,CAAA;AAE1B,GAEAE,KAAA;AAAA,EAA2B,KAAAL;AAAA,EACrB,MAAA;AAAA,EACC,OAAAA;AAEP,GAEAM,KAAA;AAAA,EAAsC,KAAAN;AAAA,EAChC,MAAA;AAAA,EACC,SAAA,CAAAK,EAAA;AAAA,EAC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(S,
|
|
1
|
+
define(["require","exports","./check.amd","../.chunks/forms-CJ5N_pAq.amd"],function(S,c,i,u){"use strict";if(typeof p>"u")var p=window.Vue;const h=e=>{e+="";let l=0;if(!e.length)return l;for(let a=0;a<e.length;a++){const n=e.charCodeAt(a);l=(l<<5)-l+n,l=l&l}return l<0&&(l*=-1),l},s=e=>/^\w+:\/\/([\w-]+\.)+[\w-]+(:\d+)?(\/|$)/.test(e),f=e=>{let l=e+"";l=l.replace("-","–");let a=l.split("."),n=a[0],o=a.length>1?"."+a[1]:"";if(n.replace(/[+–]/,"").length<=4)return l;const r=/(\d+)(\d{3})/;for(;r.test(n);)n=n.replace(r,"$1 $2");return n+o},d=e=>e===void 0?"":e.replace(/\r\n|\r|\n/g,"<br>"),g=(e,l=2,a=1e3,n="")=>{const o=Math.pow(10,l);let r=String(e);return Math.abs(e)>Math.pow(a,3)?r=Math.round(e/Math.pow(a,3)*o)/o+" <small>G"+n+"</small>":Math.abs(e)>Math.pow(a,2)?r=Math.round(e/Math.pow(a,2)*o)/o+" <small>M"+n+"</small>":Math.abs(e)>a?r=Math.round(e/a*o)/o+" <small>K"+n+"</small>":r=Math.round(e*o)/o+"",r=r.replace(/^(-?\d+)(\d{3})/,"$1 $2"),r},m=(e,l,a=1)=>{if(e==null)return"";if(e+="",l==null||e.length<=l)return e;if(a===0)e=e.substr(e.length-l,l),e="..."+e;else if(a===1){const n=e.substr(0,l/2),o=e.substr(e.length-l/2,Math.ceil(l/2));e=n+"..."+o}else a===2&&(e=e.substr(0,l),e=e+"...");return e},w=(e,l,a,n)=>{if(u.useI18nLang().value==="en")return e===1?a:l;const o=e%100,r=e%10;return o>=5&&o<=20||r===0?l:r===1?a:r>=2&&r<=4?n:r>=5&&r<=9?l:n},C=e=>{if(u.useI18nLang().value!="ru"||e=="")return e;const l=e.split(" ");return $.map(l,function(a,n){a=a+"а",a=a.replace("оа","о"),a=a.replace("аяа","ой"),a=a.replace("шийа","шого"),a=a.replace("ыйа","ого"),a=a.replace("йа","я"),a=a.replace("ьа","я"),a=a.replace("яа","и"),a=a.replace("оваа","овой"),a=a.replace("аа","ы"),a=a.replace("кия","кого"),a=a.replace("каи","кой"),l[n]=a}),e=l.join(" "),e},M=e=>{const l={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"j",з:"z",и:"i",й:"i",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"shch",ъ:"",ы:"y",ь:"",э:"e",ю:"u",я:"ya"},a=e.split(" ");return $.map(a,function(n,o){const r=[];for(let t=0;t<n.length;++t)r.push(l[n[t]]||l[n[t].toLowerCase()]==null&&n[t]||l[n[t].toLowerCase()].replace(/^(.)/,function(A){return A.toUpperCase()}));a[o]=r.join("")}),e=a.join(" "),e},b=e=>(typeof e=="string"&&(e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")),e),k=(e,l)=>{let a=null;switch(l.operator){case"CONTAINS":case"REGEXP":try{let n=l.values[0];l.operator!="REGEXP"&&(n=n.replace(/([()\[\]])/g,"\\$1")),a=new RegExp("("+n+")","gi")}catch{return e}break}return e=e.replace(a,'<b class="found">$1</b>'),e},y=e=>{var l;return(l=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:l.map(a=>a.toLowerCase()).join("_")},v=e=>`/controller/file/?src=${"/cloud/common/flags/"+e.toUpperCase()+".svg"}`,L=e=>{const l=i.getDomainRegexp(),a="(([\\/?\\w&=%+#;:-]*(\\.\\w+)?))*",n=new RegExp(`(^|[\\s>(),])([a-z0-9а-яё_.]+@${l}${a})`,"gui");e=e.replace(n,'$1<a href="mailto:$2" target="_blank" rel="noopener">↑[$2]↓</a>');const o=new RegExp(`(^|[\\s>(),])(https?://)?(${l}${a})`,"gui");return e=e.replace(o,'$1<a href="√$2$3" target="_blank" rel="nofollow noopener">$2$3</a>'),e=e.replaceAll("√http","http"),e=e.replaceAll("√","http://"),e=e.replaceAll(/(↑\[|]↓)/g,""),e},R=e=>e.charAt(0).toUpperCase()+e.slice(1),E=(e=20)=>{const l="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";let a="";for(let n=0;n<e;n++)a+=l[Math.floor(Math.random()*l.length)];return a};c.addCommasWhite=f,c.addLinkTags=L,c.camelToSnakeCase=y,c.ellipsis=m,c.genFlagLinkByCountryCode=v,c.genIntHash=h,c.getRandomHash=E,c.highlightHtml=k,c.htmlspecialchars=b,c.isUrl=s,c.nl2br=d,c.numberEnding=w,c.numberWithWord=g,c.rusToLatin=M,c.toCapitalize=R,c.toRoditPadej=C,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=string.amd.js.map
|
package/utils/string.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.amd.js","sources":["../../src/core/utils/string.ts"],"sourcesContent":["/**\n * Работа со строками\n * @packageDocumentation\n */\n\nimport { getDomainRegexp } from '@/core/utils/check';\nimport { useI18nLang } from '@/core/plugins/i18n';\n\n/**\n * Сгенерировать числовой хэш от строки для идентификатора\n */\nexport const genIntHash = (string: string): number => {\n\tstring += '';\n\n\tlet hash = 0;\n\tif (!string.length) return hash;\n\n\tfor (let i = 0; i < string.length; i++) {\n\t\tconst char = string.charCodeAt(i);\n\t\thash = ((hash << 5) - hash) + char;\n\t\thash = hash & hash;\n\t}\n\n\tif (hash < 0) hash *= -1;\n\n\treturn hash;\n};\n\n/**\n * Проверить что переданная строка является URL\n */\nexport const isUrl = (url: string): boolean => {\n\treturn /^\\w+:\\/\\/([\\w-]+\\.)+[\\w-]+(:\\d+)?(\\/|$)/.test(url);\n};\n\n/**\n * Добавляет пробелы между разрядами если требуется\n * @param nStr строка с числом\n */\nexport const addCommasWhite = (n: number | string): string => {\n\tlet nStr = n + '';\n\n\tnStr = nStr.replace('-', '–');\n\n\tlet x = nStr.split('.');\n\tlet x1 = x[0];\n\tlet x2 = (x.length > 1) ? ('.' + x[1]) : '';\n\n\tif (x1.replace(/[+–]/, '').length <= 4) return nStr;\n\n\tconst rgx = /(\\d+)(\\d{3})/;\n\twhile (rgx.test(x1)) {\n\t\tx1 = x1.replace(rgx, '$1' + ' ' + '$2');\n\t}\n\treturn x1 + x2;\n};\n\n/**\n * Вставляет HTML-код разрыва строки перед каждым переводом строки\n */\nexport const nl2br = (str: string): string => {\n\tif (str === undefined) return '';\n\n\treturn str.replace(/\\r\\n|\\r|\\n/g, '<br>');\n};\n\n/**\n * Перевести число без деситичной приставки в число с деситичной приставкой степеней тысячи (с параметрами по умолчанию 1255 -> '1.26 K')\n * @param number\n * @param precision - точность, количество знаков после запятой\n * @param dimension - размерность, по умолчанию 1000\n * @param suffix - суффикс к десятичной приставке (по умолчанию выводится латинская заглавная буква)\n */\nexport const numberWithWord = (number: number, precision = 2, dimension = 1000, suffix = ''): string => {\n\tconst k = Math.pow(10, precision);\n\n\tlet numberStr = String(number);\n\tif (Math.abs(number) > Math.pow(dimension, 3)) {\n\t\tnumberStr = Math.round(number / Math.pow(dimension, 3) * k) / k + ' <small>G' + suffix + '</small>';\n\t} else if (Math.abs(number) > Math.pow(dimension, 2)) {\n\t\tnumberStr = Math.round(number / Math.pow(dimension, 2) * k) / k + ' <small>M' + suffix + '</small>';\n\t} else if (Math.abs(number) > dimension) {\n\t\tnumberStr = Math.round(number / dimension * k) / k + ' <small>K' + suffix + '</small>';\n\t}\n\n\tnumberStr = numberStr.replace(/^(-?\\d+)(\\d{3})/, '$1 $2');\n\n\treturn numberStr;\n};\n\n/**\n * Обрезать текст под три точки\n * @param string\n * @param max_length - максимальное количество символов текста, остальное обрежеться\n * @param pos - область обрезки 0-начало | 1-середина | 2-конец строки\n */\nexport const ellipsis = (string: string, max_length: number, pos: 0 | 1 | 2 = 1): string => {\n\tif (string == undefined) return '';\n\n\tstring += '';\n\tif (max_length == undefined || string.length <= max_length) return string;\n\n\tif (pos === 0) {\n\t\tstring = string.substr(string.length - max_length, max_length);\n\t\tstring = '...' + string;\n\t} else if (pos === 1) {\n\t\tconst string1 = string.substr(0, max_length / 2);\n\t\tconst string2 = string.substr(string.length - max_length / 2, Math.ceil(max_length / 2));\n\t\tstring = string1 + '...' + string2;\n\t} else if (pos === 2) {\n\t\tstring = string.substr(0, max_length);\n\t\tstring = string + '...';\n\t}\n\n\treturn string;\n};\n\n/**\n * Сгенерировать строку текста для вывода количества в разном склонении\n * @param num\n * @param ending0 - родительный падеж, множ. число (10 модулей)\n * @param ending1 - именительный падеж, ед. число (1 модуль)\n * @param ending2 - винительный падеж, множ. число (3 модуля)\n */\nexport const numberEnding = (num: number, ending0: string, ending1: string, ending2: string): string => {\n\t// склонение по множественному числу\n\tif (useI18nLang().value === 'en') {\n\t\tif (num === 1) {\n\t\t\treturn ending1;\n\t\t} else {\n\t\t\treturn ending0;\n\t\t}\n\t}\n\n\tconst num100 = num % 100;\n\tconst num10 = num % 10;\n\n\tif (num100 >= 5 && num100 <= 20) {\n\t\treturn ending0;\n\t} else if (num10 === 0) {\n\t\treturn ending0;\n\t} else if (num10 === 1) {\n\t\treturn ending1;\n\t} else if (num10 >= 2 && num10 <= 4) {\n\t\treturn ending2;\n\t} else if (num10 >= 5 && num10 <= 9) {\n\t\treturn ending0;\n\t} else {\n\t\treturn ending2;\n\t}\n};\n\n/**\n * Перевести строку в родительный падеж\n */\nexport const toRoditPadej = (str: string): string => {\n\tif (useI18nLang().value != 'ru' || str == '') return str;\n\n\tconst str_array = str.split(' ');\n\n\t$.map(str_array, function (str, index) {\n\t\tstr = str + 'а';\n\t\tstr = str.replace('оа', 'о');\n\t\tstr = str.replace('аяа', 'ой');\n\t\tstr = str.replace('шийа', 'шого');\n\t\tstr = str.replace('ыйа', 'ого');\n\t\tstr = str.replace('йа', 'я');\n\t\tstr = str.replace('ьа', 'я');\n\t\tstr = str.replace('яа', 'и');\n\t\tstr = str.replace('оваа', 'овой');\n\t\tstr = str.replace('аа', 'ы');\n\t\tstr = str.replace('кия', 'кого');\n\t\tstr = str.replace('каи', 'кой');\n\n\t\tstr_array[index] = str;\n\t});\n\n\tstr = str_array.join(' ');\n\n\treturn str;\n};\n\n/**\n * Транслитерация текста\n */\nexport const rusToLatin = (str: string): string => {\n\tconst ru: { [index: string]: string } = {\n\t\t'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',\n\t\t'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',\n\t\t'й': 'i', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n',\n\t\t'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',\n\t\t'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch',\n\t\t'ш': 'sh', 'щ': 'shch', 'ъ': '', 'ы': 'y', 'ь': '',\n\t\t'э': 'e', 'ю': 'u', 'я': 'ya',\n\t};\n\n\tconst str_array = str.split(' ');\n\n\t$.map(str_array, function (str, index) {\n\t\tconst newStr: string[] = [];\n\t\tfor (let i = 0; i < str.length; ++i) {\n\t\t\tnewStr.push(\n\t\t\t\tru[str[i]] || ru[str[i].toLowerCase()] == undefined && str[i] || ru[str[i].toLowerCase()].replace(/^(.)/, function (match) {\n\t\t\t\t\treturn match.toUpperCase();\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tstr_array[index] = newStr.join('');\n\t});\n\n\tstr = str_array.join(' ');\n\n\treturn str;\n};\n\n/**\n * Замена html-символов (`&`, `<`, `>`, `\"`, `'`) на имена литер (`&` -> `&`)\n */\nexport const htmlspecialchars = (str: string): string => {\n\tif (typeof (str) == 'string') {\n\t\tstr = str\n\t\t\t.replace(/&/g, '&')\n\t\t\t.replace(/</g, '<')\n\t\t\t.replace(/>/g, '>')\n\t\t\t.replace(/\"/g, '"')\n\t\t\t.replace(/'/g, ''');\n\t}\n\treturn str;\n};\n\n/**\n * Выделить нужное в тексте желтым цветом\n * поиск происходит по строке fieldFilter.values[0]\n */\nexport const highlightHtml = (text: string, fieldFilter: { operator: 'CONTAINS' | 'REGEXP', values: string[] }): string => {\n\tlet regExp: RegExp | null = null;\n\n\tswitch (fieldFilter.operator) {\n\t\tcase 'CONTAINS':\n\t\tcase 'REGEXP':\n\t\t\ttry {\n\t\t\t\tlet regExpString = fieldFilter.values[0];\n\t\t\t\tif (fieldFilter.operator != 'REGEXP') regExpString = regExpString.replace(/([()\\[\\]])/g, '\\\\$1');\n\n\t\t\t\tregExp = new RegExp('(' + regExpString + ')', 'gi');\n\t\t\t} catch (exception) {\n\t\t\t\treturn text;\n\t\t\t}\n\n\t\t\tbreak;\n\t}\n\n\ttext = text.replace(regExp!, '<b class=\"found\">$1</b>');\n\n\treturn text;\n};\n\n/**\n * Пример: logHTTPCodesHundreds => log_http_codes_hundreds\n */\nexport const camelToSnakeCase = (str: string): string | undefined => {\n\treturn str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(token => token.toLowerCase()).join('_');\n};\n\n/**\n * Получить url изображения флага, по коду страны по стандарту ISO 3166-1 alpha-2\n *\n * @todo Опубликовать в CDN или брать c публичного CDN\n */\nexport const genFlagLinkByCountryCode = (countryCode: string) => {\n\tconst urlImage = '/cloud/common/flags/' + countryCode.toUpperCase() + '.svg';\n\treturn `/controller/file/?src=${urlImage}`;\n};\n\n/**\n * Обернуть все ссылки и email в тексте в html-тег `<a>`.\n *\n * Для email ставиться префикс `mailto:`\n */\nexport const addLinkTags = (text: string): string => {\n\tconst domainRegexp = getDomainRegexp();\n\tconst afterDomainRegexp = '(([\\\\/?\\\\w&=%+#;:-]*(\\\\.\\\\w+)?))*';\n\n\tconst regexpMailto = new RegExp(`(^|[\\\\s>(),])([a-z0-9а-яё_.]+@${domainRegexp}${afterDomainRegexp})`, 'gui');\n\ttext = text.replace(regexpMailto, `$1<a href=\"mailto:$2\" target=\"_blank\" rel=\"noopener\">↑[$2]↓</a>`);\n\n\tconst regexpLink = new RegExp(`(^|[\\\\s>(),])(https?:\\/\\/)?(${domainRegexp}${afterDomainRegexp})`, 'gui');\n\ttext = text.replace(regexpLink, `$1<a href=\"√$2$3\" target=\"_blank\" rel=\"nofollow noopener\">$2$3</a>`);\n\n\ttext = text.replaceAll('√http', 'http');\n\ttext = text.replaceAll('√', 'http://');\n\ttext = text.replaceAll(/(↑\\[|]↓)/g, '');\n\n\treturn text;\n};\n\n/**\n * Перевести первую букву строки в верхний регистр\n */\nexport const toCapitalize = (str: string): string => {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n};\n\n/**\n * Получить случайную строку\n */\nexport const getRandomHash = (length: number = 20): string => {\n\tconst l = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';\n\n\tlet result = '';\n\tfor (let i = 0; i < length; i++) {\n\t\tresult += l[Math.floor(Math.random() * l.length)];\n\t}\n\n\treturn result;\n};\n"],"names":["genIntHash","string","hash","i","isUrl","url","addCommasWhite","n","nStr","x1","x","x2","rgx","nl2br","str","numberWithWord","number","precision","dimension","suffix","numberStr","k","ellipsis","max_length","pos","string1","string2","numberEnding","num","ending0","ending1","ending2","forms","num100","num10","toRoditPadej","str2","str_array","index","rusToLatin","ru","match","htmlspecialchars","highlightHtml","text","fieldFilter","regExpString","regExp","camelToSnakeCase","genFlagLinkByCountryCode","countryCode","addLinkTags","domainRegexp","utils_check","regexpMailto","afterDomainRegexp","regexpLink","toCapitalize","getRandomHash","length","result"],"mappings":"2IAWa,MAAAA,EAAAC,GAAA,eAIZ,GAAA,CAAAA,EAAA,OAAA,OAAAC,EAEA,QAAAC,EAAA,EAAAA,EAAAF,EAAA,OAAAE,IAAA,sCAGCD,EAAAA,EAAAA,CAAc,CAGf,OAAA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AA,IAAA,OAAA,6BAAAJ,CAAA,GAAAG,CAAA,IAAA,KAAA,yLAOAX,CACD,EAKaa,EAAA3C,GACZA,EAAA,OAAA,CAAA,EAAA,YAAA,EAAAA,EAAA,MAAA,CAAA,EAMY4C,EAAA,CAAAC,EAAA,KAAA,mFAIZ,QAAAxD,EAAA,EAAAA,EAAAwD,EAAAxD,IACCyD,GAAA,EAAA,KAAA,MAAA,KAAA,OAAA,EAAA,EAAA,MAAA,CAAA,EAGD,OAAAA,CACD"}
|
|
1
|
+
{"version":3,"file":"string.amd.js","sources":["../../src/core/utils/string.ts"],"sourcesContent":["/**\n * Работа со строками\n * @packageDocumentation\n */\n\nimport { getDomainRegexp } from '@/core/utils/check';\nimport { useI18nLang } from '@/core/plugins/i18n';\n\n/**\n * Сгенерировать числовой хэш от строки для идентификатора\n */\nexport const genIntHash = (string: string): number => {\n\tstring += '';\n\n\tlet hash = 0;\n\tif (!string.length) return hash;\n\n\tfor (let i = 0; i < string.length; i++) {\n\t\tconst char = string.charCodeAt(i);\n\t\thash = ((hash << 5) - hash) + char;\n\t\thash = hash & hash;\n\t}\n\n\tif (hash < 0) hash *= -1;\n\n\treturn hash;\n};\n\n/**\n * Проверить что переданная строка является URL\n */\nexport const isUrl = (url: string): boolean => {\n\treturn /^\\w+:\\/\\/([\\w-]+\\.)+[\\w-]+(:\\d+)?(\\/|$)/.test(url);\n};\n\n/**\n * Добавляет пробелы между разрядами если требуется\n * @param nStr строка с числом\n */\nexport const addCommasWhite = (n: number | string): string => {\n\tlet nStr = n + '';\n\n\tnStr = nStr.replace('-', '–');\n\n\tlet x = nStr.split('.');\n\tlet x1 = x[0];\n\tlet x2 = (x.length > 1) ? ('.' + x[1]) : '';\n\n\tif (x1.replace(/[+–]/, '').length <= 4) return nStr;\n\n\tconst rgx = /(\\d+)(\\d{3})/;\n\twhile (rgx.test(x1)) {\n\t\tx1 = x1.replace(rgx, '$1' + ' ' + '$2');\n\t}\n\treturn x1 + x2;\n};\n\n/**\n * Вставляет HTML-код разрыва строки перед каждым переводом строки\n */\nexport const nl2br = (str: string): string => {\n\tif (str === undefined) return '';\n\n\treturn str.replace(/\\r\\n|\\r|\\n/g, '<br>');\n};\n\n/**\n * Перевести число без деситичной приставки в число с деситичной приставкой степеней тысячи (с параметрами по умолчанию 1255 -> '1.26 K')\n * @param number\n * @param precision - точность, количество знаков после запятой\n * @param dimension - размерность, по умолчанию 1000\n * @param suffix - суффикс к десятичной приставке (по умолчанию выводится латинская заглавная буква)\n */\nexport const numberWithWord = (number: number, precision = 2, dimension = 1000, suffix = ''): string => {\n\tconst k = Math.pow(10, precision);\n\n\tlet numberStr = String(number);\n\tif (Math.abs(number) > Math.pow(dimension, 3)) {\n\t\tnumberStr = Math.round(number / Math.pow(dimension, 3) * k) / k + ' <small>G' + suffix + '</small>';\n\t} else if (Math.abs(number) > Math.pow(dimension, 2)) {\n\t\tnumberStr = Math.round(number / Math.pow(dimension, 2) * k) / k + ' <small>M' + suffix + '</small>';\n\t} else if (Math.abs(number) > dimension) {\n\t\tnumberStr = Math.round(number / dimension * k) / k + ' <small>K' + suffix + '</small>';\n\t} else {\n\t\tnumberStr = Math.round(number * k) / k + '';\n\t}\n\n\tnumberStr = numberStr.replace(/^(-?\\d+)(\\d{3})/, '$1 $2');\n\n\treturn numberStr;\n};\n\n/**\n * Обрезать текст под три точки\n * @param string\n * @param max_length - максимальное количество символов текста, остальное обрежеться\n * @param pos - область обрезки 0-начало | 1-середина | 2-конец строки\n */\nexport const ellipsis = (string: string, max_length: number, pos: 0 | 1 | 2 = 1): string => {\n\tif (string == undefined) return '';\n\n\tstring += '';\n\tif (max_length == undefined || string.length <= max_length) return string;\n\n\tif (pos === 0) {\n\t\tstring = string.substr(string.length - max_length, max_length);\n\t\tstring = '...' + string;\n\t} else if (pos === 1) {\n\t\tconst string1 = string.substr(0, max_length / 2);\n\t\tconst string2 = string.substr(string.length - max_length / 2, Math.ceil(max_length / 2));\n\t\tstring = string1 + '...' + string2;\n\t} else if (pos === 2) {\n\t\tstring = string.substr(0, max_length);\n\t\tstring = string + '...';\n\t}\n\n\treturn string;\n};\n\n/**\n * Сгенерировать строку текста для вывода количества в разном склонении\n * @param num\n * @param ending0 - родительный падеж, множ. число (10 модулей)\n * @param ending1 - именительный падеж, ед. число (1 модуль)\n * @param ending2 - винительный падеж, множ. число (3 модуля)\n */\nexport const numberEnding = (num: number, ending0: string, ending1: string, ending2: string): string => {\n\t// склонение по множественному числу\n\tif (useI18nLang().value === 'en') {\n\t\tif (num === 1) {\n\t\t\treturn ending1;\n\t\t} else {\n\t\t\treturn ending0;\n\t\t}\n\t}\n\n\tconst num100 = num % 100;\n\tconst num10 = num % 10;\n\n\tif (num100 >= 5 && num100 <= 20) {\n\t\treturn ending0;\n\t} else if (num10 === 0) {\n\t\treturn ending0;\n\t} else if (num10 === 1) {\n\t\treturn ending1;\n\t} else if (num10 >= 2 && num10 <= 4) {\n\t\treturn ending2;\n\t} else if (num10 >= 5 && num10 <= 9) {\n\t\treturn ending0;\n\t} else {\n\t\treturn ending2;\n\t}\n};\n\n/**\n * Перевести строку в родительный падеж\n */\nexport const toRoditPadej = (str: string): string => {\n\tif (useI18nLang().value != 'ru' || str == '') return str;\n\n\tconst str_array = str.split(' ');\n\n\t$.map(str_array, function (str, index) {\n\t\tstr = str + 'а';\n\t\tstr = str.replace('оа', 'о');\n\t\tstr = str.replace('аяа', 'ой');\n\t\tstr = str.replace('шийа', 'шого');\n\t\tstr = str.replace('ыйа', 'ого');\n\t\tstr = str.replace('йа', 'я');\n\t\tstr = str.replace('ьа', 'я');\n\t\tstr = str.replace('яа', 'и');\n\t\tstr = str.replace('оваа', 'овой');\n\t\tstr = str.replace('аа', 'ы');\n\t\tstr = str.replace('кия', 'кого');\n\t\tstr = str.replace('каи', 'кой');\n\n\t\tstr_array[index] = str;\n\t});\n\n\tstr = str_array.join(' ');\n\n\treturn str;\n};\n\n/**\n * Транслитерация текста\n */\nexport const rusToLatin = (str: string): string => {\n\tconst ru: { [index: string]: string } = {\n\t\t'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',\n\t\t'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',\n\t\t'й': 'i', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n',\n\t\t'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',\n\t\t'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch',\n\t\t'ш': 'sh', 'щ': 'shch', 'ъ': '', 'ы': 'y', 'ь': '',\n\t\t'э': 'e', 'ю': 'u', 'я': 'ya',\n\t};\n\n\tconst str_array = str.split(' ');\n\n\t$.map(str_array, function (str, index) {\n\t\tconst newStr: string[] = [];\n\t\tfor (let i = 0; i < str.length; ++i) {\n\t\t\tnewStr.push(\n\t\t\t\tru[str[i]] || ru[str[i].toLowerCase()] == undefined && str[i] || ru[str[i].toLowerCase()].replace(/^(.)/, function (match) {\n\t\t\t\t\treturn match.toUpperCase();\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tstr_array[index] = newStr.join('');\n\t});\n\n\tstr = str_array.join(' ');\n\n\treturn str;\n};\n\n/**\n * Замена html-символов (`&`, `<`, `>`, `\"`, `'`) на имена литер (`&` -> `&`)\n */\nexport const htmlspecialchars = (str: string): string => {\n\tif (typeof (str) == 'string') {\n\t\tstr = str\n\t\t\t.replace(/&/g, '&')\n\t\t\t.replace(/</g, '<')\n\t\t\t.replace(/>/g, '>')\n\t\t\t.replace(/\"/g, '"')\n\t\t\t.replace(/'/g, ''');\n\t}\n\treturn str;\n};\n\n/**\n * Выделить нужное в тексте желтым цветом\n * поиск происходит по строке fieldFilter.values[0]\n */\nexport const highlightHtml = (text: string, fieldFilter: { operator: 'CONTAINS' | 'REGEXP', values: string[] }): string => {\n\tlet regExp: RegExp | null = null;\n\n\tswitch (fieldFilter.operator) {\n\t\tcase 'CONTAINS':\n\t\tcase 'REGEXP':\n\t\t\ttry {\n\t\t\t\tlet regExpString = fieldFilter.values[0];\n\t\t\t\tif (fieldFilter.operator != 'REGEXP') regExpString = regExpString.replace(/([()\\[\\]])/g, '\\\\$1');\n\n\t\t\t\tregExp = new RegExp('(' + regExpString + ')', 'gi');\n\t\t\t} catch (exception) {\n\t\t\t\treturn text;\n\t\t\t}\n\n\t\t\tbreak;\n\t}\n\n\ttext = text.replace(regExp!, '<b class=\"found\">$1</b>');\n\n\treturn text;\n};\n\n/**\n * Пример: logHTTPCodesHundreds => log_http_codes_hundreds\n */\nexport const camelToSnakeCase = (str: string): string | undefined => {\n\treturn str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(token => token.toLowerCase()).join('_');\n};\n\n/**\n * Получить url изображения флага, по коду страны по стандарту ISO 3166-1 alpha-2\n *\n * @todo Опубликовать в CDN или брать c публичного CDN\n */\nexport const genFlagLinkByCountryCode = (countryCode: string) => {\n\tconst urlImage = '/cloud/common/flags/' + countryCode.toUpperCase() + '.svg';\n\treturn `/controller/file/?src=${urlImage}`;\n};\n\n/**\n * Обернуть все ссылки и email в тексте в html-тег `<a>`.\n *\n * Для email ставиться префикс `mailto:`\n */\nexport const addLinkTags = (text: string): string => {\n\tconst domainRegexp = getDomainRegexp();\n\tconst afterDomainRegexp = '(([\\\\/?\\\\w&=%+#;:-]*(\\\\.\\\\w+)?))*';\n\n\tconst regexpMailto = new RegExp(`(^|[\\\\s>(),])([a-z0-9а-яё_.]+@${domainRegexp}${afterDomainRegexp})`, 'gui');\n\ttext = text.replace(regexpMailto, `$1<a href=\"mailto:$2\" target=\"_blank\" rel=\"noopener\">↑[$2]↓</a>`);\n\n\tconst regexpLink = new RegExp(`(^|[\\\\s>(),])(https?:\\/\\/)?(${domainRegexp}${afterDomainRegexp})`, 'gui');\n\ttext = text.replace(regexpLink, `$1<a href=\"√$2$3\" target=\"_blank\" rel=\"nofollow noopener\">$2$3</a>`);\n\n\ttext = text.replaceAll('√http', 'http');\n\ttext = text.replaceAll('√', 'http://');\n\ttext = text.replaceAll(/(↑\\[|]↓)/g, '');\n\n\treturn text;\n};\n\n/**\n * Перевести первую букву строки в верхний регистр\n */\nexport const toCapitalize = (str: string): string => {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n};\n\n/**\n * Получить случайную строку\n */\nexport const getRandomHash = (length: number = 20): string => {\n\tconst l = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';\n\n\tlet result = '';\n\tfor (let i = 0; i < length; i++) {\n\t\tresult += l[Math.floor(Math.random() * l.length)];\n\t}\n\n\treturn result;\n};\n"],"names":["genIntHash","string","hash","i","isUrl","url","addCommasWhite","n","nStr","x1","x","x2","rgx","nl2br","str","numberWithWord","number","precision","dimension","suffix","numberStr","k","ellipsis","max_length","pos","string1","string2","numberEnding","num","ending0","ending1","ending2","forms","num100","num10","toRoditPadej","str2","str_array","index","rusToLatin","ru","match","htmlspecialchars","highlightHtml","text","fieldFilter","regExpString","regExp","camelToSnakeCase","genFlagLinkByCountryCode","countryCode","addLinkTags","domainRegexp","utils_check","regexpMailto","afterDomainRegexp","regexpLink","toCapitalize","getRandomHash","length","result"],"mappings":"2IAWa,MAAAA,EAAAC,GAAA,eAIZ,GAAA,CAAAA,EAAA,OAAA,OAAAC,EAEA,QAAAC,EAAA,EAAAA,EAAAF,EAAA,OAAAE,IAAA,sCAGCD,EAAAA,EAAAA,CAAc,CAGf,OAAAA,EAAA,IAAAA,GAAA,IAEAA,CACD,EAKaE,EAAAC,GACZ,0CAAA,KAAAA,CAAA,EAOYC,EAAAC,GAAA,CACZ,IAAAC,EAAAD,EAAA,2CAKAE,EAAAC,EAAA,CAAA,EACAC,EAAAD,EAAA,OAAA,EAAA,IAAAA,EAAA,CAAA,EAAA,GAEA,GAAAD,EAAA,QAAA,OAAA,EAAA,EAAA,QAAA,EAAA,OAAAD,yBAGA,KAAA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