@topvisor/ui 1.0.26-2 → 1.0.26-4
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-DZR64Wm8.es.js +181 -0
- package/.chunks/dialog_selectorRegions-DZR64Wm8.es.js.map +1 -0
- package/.chunks/dialog_selectorRegions-D_HXNjOX.amd.js +2 -0
- package/.chunks/dialog_selectorRegions-D_HXNjOX.amd.js.map +1 -0
- package/components/formsExt/selector2/selector2.d.ts +4 -0
- package/components/formsExt/selector2/selector2.vue.d.ts +1 -0
- package/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue.d.ts +3 -1
- package/components/project/selectorRegion/utils/utils.d.ts +3 -1
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/core/app.js +24 -24
- package/core/app.js.map +1 -1
- package/core/utils/searchers.d.ts +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +129 -123
- package/formsExt/formsExt.js.map +1 -1
- package/package.json +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.js +1 -1
- package/utils/searchers.amd.js.map +1 -1
- package/utils/searchers.js.map +1 -1
- package/.chunks/dialog_selectorRegions-BOPta9cH.amd.js +0 -2
- package/.chunks/dialog_selectorRegions-BOPta9cH.amd.js.map +0 -1
- package/.chunks/dialog_selectorRegions-Dy0AlECS.es.js +0 -140
- package/.chunks/dialog_selectorRegions-Dy0AlECS.es.js.map +0 -1
- package/components/extra/rive/composables.d.ts +0 -4
- package/components/extra/rive/types/competitor.d.ts +0 -0
package/formsExt/formsExt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formsExt.js","sources":["../../src/components/formsExt/editArea/editArea.vue","../../src/components/formsExt/editInput/editInput.vue","../../src/components/formsExt/radioGroup/radioGroup.vue","../../src/components/formsExt/selector2/api.ts","../../src/components/formsExt/selector2/selector2.vue","../../src/components/formsExt/formsExt.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport Button from '@/components/forms/button/button.vue';\nimport type { Emits, Props } from './editArea';\nimport Textarea from '@/components/forms/textarea/textarea.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tdefaultValue: '',\n\tcancelText: 'Cancel',\n\tsubmitText: 'Send',\n\tcloseText: 'Close',\n\texpandable: true,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst localValue = ref(props.defaultValue);\n\nconst isFocused = ref(props.isFocused);\n\nconst isChanged = computed(() => localValue.value !== props.defaultValue);\n\nconst submit = (value: string) => {\n\temit('submit', value);\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst cancel = () => {\n\tif (props.forceShowCloseBtn && !isChanged.value) {\n\t\temit('close');\n\n\t\treturn;\n\t}\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst clickOnTitle = () => {\n\tif (props.attachToKeyboard) emit('clickOnTitle');\n};\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-editArea': true,\n\t\t\t'top-editArea-attachedToKeyboard': attachToKeyboard,\n\t\t}\"\n\t>\n\t\t<div\n\t\t\tv-if=\"title\"\n\t\t\tclass=\"top-editArea_title\"\n\t\t\t@click=\"clickOnTitle()\"\n\t\t>\n\t\t\t{{ title }}\n\t\t</div>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-editArea_form': true,\n\t\t\t\t'top-error': isError,\n\t\t\t\t'top-focus': isFocused,\n\t\t\t}\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tv-model=\"localValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:minHeight=\"minHeight\"\n\t\t\t\t:expandable=\"expandable\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:isError=\"isError\"\n\t\t\t\t:hint=\"hint\"\n\t\t\t\tclass=\"top-editArea_element\"\n\t\t\t\t@focus=\"() => isFocused = true\"\n\t\t\t\t@blur=\"() => isFocused = false\"\n\t\t\t\t@keyup.esc=\"cancel\"\n\t\t\t\t@keyup.ctrl.enter=\"submit(localValue)\"\n\t\t\t/>\n\n\t\t\t<div class=\"top-editArea_footer\">\n\t\t\t\t<Button\n\t\t\t\t\tv-if=\"isChanged || forceShowCloseBtn\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\tstyling=\"soft\"\n\t\t\t\t\t@click=\"cancel\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ cancelText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tv-if=\"isChanged\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\t@click=\"submit(localValue)\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ submitText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n.top-editArea {\n\t--top-editArea-bottom: env(keyboard-inset-height, 0px);\n\t--top-editArea-offset-bottom: 0px;\n\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.top-editArea_title {\n\tfont-size: 12px;\n}\n\n.top-editArea_form {\n\tflex-direction: column;\n\toutline: none;\n}\n\n.top-editArea_form:not(.top-error):hover,\n.top-editArea_form:not(.top-error).top-focus {\n\tborder-color: var(--top-forms-border-color-hover);\n}\n\n/* textarea в EditArea */\n.top-textarea {\n\twidth: 100%;\n}\n\n.top-editArea_element.top-textarea_textarea {\n\t--top-forms-border-width: 0px;\n\n\toutline: none;\n\tanimation: none;\n}\n\n/* footer */\n.top-editArea_footer {\n\tpadding: var(--top-forms-padding);\n\tdisplay: flex;\n\tmin-height: 32px;\n\talign-self: flex-end;\n\tjustify-content: flex-end;\n\tgap: var(--top-forms-padding);\n}\n\n/* attachedToKeyboard */\n.top-editArea-attachedToKeyboard {\n\tbackground: var(--top-forms-background-color);\n\tposition: fixed;\n\tbottom: calc(var(--top-editArea-offset-bottom) + var(--top-editArea-bottom));\n\tright: 0;\n\tleft: 0;\n\tz-index: 2;\n\tgap: 0;\n\ttransition: bottom var(--transition-fast);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_form {\n\tborder-radius: 0;\n\tborder: none;\n\tborder-top: 1px solid var(--top-forms-border-color);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_title {\n\tcursor: pointer;\n\tborder-top: 1px solid var(--color-line-2-opacity);\n\tpadding: var(--top-forms-padding);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_footer > [data-top-icon] {\n\tborder-radius: 100%;\n}\n\n@media screen and (max-width: 900px) {\n\t.top-editArea_form{\n\t\tflex-direction: row;\n\t}\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, toRef, watch } from 'vue';\nimport type { Emits, Props } from './editInput';\nimport TopInput from '@/components/forms/input/input.vue';\nimport TopButton from '@/components/forms/button/button.vue';\n\nconst props = defineProps<Props>();\n\nconst intermediateValue = ref(props.modelValue);\n\nwatch(toRef(props.modelValue), () => {\n\tintermediateValue.value = props.modelValue;\n});\n\nconst emit = defineEmits<Emits>();\n\nconst submit = () => {\n\temit('update:modelValue', intermediateValue.value);\n};\n</script>\n\n<template>\n\t<div class=\"top-editInput\">\n\t\t<TopInput\n\t\t\t:=\"input\"\n\t\t\t@keydown.esc.capture.stop=\"intermediateValue = modelValue\"\n\t\t\t@keydown.enter.stop=\"submit\"\n\t\t\tv-model=\"intermediateValue\"\n\t\t/>\n\n\t\t<TopButton\n\t\t\tv-if=\"intermediateValue !== modelValue\"\n\t\t\ticon=\"\"\n\t\t\tstyling=\"soft\"\n\t\t\t:=\"button\"\n\t\t\t@click=\"submit\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-editInput {\n\twidth: 220px;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: flex-end;\n\tgap: var(--top-gap-1);\n}\n\n.top-editInput .top-input {\n\twidth: unset;\n\tflex-grow: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Ref } from '@vue/reactivity';\nimport { ref, watch } from 'vue';\nimport type { Props, Emits } from './radioGroup';\n\nconst model = defineModel<string>({\n\trequired: true,\n});\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: 's',\n});\n\nconst emit = defineEmits<Emits>();\n\nconst elRef: Ref<HTMLElement | null> = ref(null);\n\nwatch(model, () => {\n\tif (!props.radiosProps?.some(item => item.value === model.value)) {\n\t\tmodel.value = props.radiosProps?.[0]?.value ?? '';\n\t}\n\n\telRef.value?.querySelector('.radioGroup_item-selected')?.scrollIntoView();\n}, { immediate: true });\n\nconst uid = 'radioGroup-' + Math.random();\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t['top-radioGroup']: true,\n\t\t\t['top-scrollBarXHidding']: true,\n\t\t\t['top-size_' + size]: !!size,\n\t\t\t['top-error']: isError,\n\t\t}\"\n\t>\n\t\t<label\n\t\t\tv-for=\"item of radiosProps\"\n\t\t\t:class=\"{\n\t\t\t\t['top-radioGroup_item-selected']: item.value === model,\n\t\t\t\t['top-radioGroup_item']: true,\n\t\t\t\t['top-forms-focusable']: true,\n\t\t\t\t['top-disabled']: item.disabled,\n\t\t\t}\"\n\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t@click=\"model = item.value\"\n\t\t>\n\t\t\t{{ item.title }}\n\n\t\t\t<span\n\t\t\t\tv-if=\"showIndicator\"\n\t\t\t\tclass=\"top-radioGroup_circle\"\n\t\t\t></span>\n\n\t\t\t<!-- Для нативной навигации -->\n\t\t\t<input\n\t\t\t\tv-model=\"model\"\n\t\t\t\t:name=\"uid\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t['top-unvisible']: true,\n\t\t\t\t}\"\n\t\t\t\t:value=\"item.value\"\n\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t/>\n\t\t</label>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/top-scrollBar.css\";\n\n.top-radioGroup {\n\tuser-select: none;\n\tbox-sizing: border-box;\n\tborder-radius: 8px;\n\tbackground-color: var(--color-layout-middle);\n\theight: var(--top-forms-base-height);\n\tpadding: 2px;\n\tgap: 2px;\n\tdisplay: flex;\n\talign-items: flex-start;\n}\n\n.top-radioGroup_item {\n\tcolor: var(--color-text-2);\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\tborder-radius: 6px;\n\theight: calc(var(--top-forms-base-height) - 4px);\n\tpadding: 0 16px;\n\tfont-weight: 400;\n\twhite-space: nowrap;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-grow: 1;\n\tgap: 4px;\n}\n\n.top-radioGroup_item:hover {\n\tbackground-color: var(--color-layout-front-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* selected */\n.top-radioGroup_item-selected {\n\tcolor: var(--color-text-1);\n\tpointer-events: none;\n\tbackground-color: var(--color-bg-lightning-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* circle */\n.top-radioGroup_circle {\n\tcontent: \"\";\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-line-3-opacity);\n\tborder-radius: 50%;\n\tpadding: 3px;\n\tmargin-left: auto;\n\twidth: calc(var(--top-forms-option-height) - 3px * 2);\n\theight: calc(var(--top-forms-option-height) - 3px * 2);\n}\n\n.top-radioGroup_item:hover .top-radioGroup_circle:before {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* circle selected */\n.top-radioGroup_item-selected .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n\tborder-width: 5px;\n}\n\n.top-radioGroup_item-selected:hover .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* top-error */\n.top-radioGroup.top-error .top-radioGroup_item:not(.top-disabled) .top-radioGroup_circle {\n\tborder-color: var(--color-line-negative-1);\n}\n</style>\n","import type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport type { Item, Props } from './selector2';\n\nexport const useAPI = (apiRequest: Props['apiRequest'], minLength: number, useCache: Props['useCache']) => {\n\t/**\n\t * Список, полученный через API\n\t */\n\tconst items: Ref<Array<Item>> = ref([]);\n\n\t/**\n\t * Флаг - идет загрузка\n\t */\n\tconst isLoading = ref(false);\n\n\tlet _searchText = '';\n\tlet _nextOffset: number | undefined;\n\n\tif (apiRequest && !apiRequest.params.limit) {\n\t\tapiRequest.params.limit = 100;\n\t}\n\n\t/**\n\t * Выполнить обращение к API\n\t *\n\t * При ошибке вернет undefined\n\t */\n\tconst callAPIRequest = async (): Promise<{ nextOffset?: number, result: Array<Item> } | undefined> => {\n\t\tif (!apiRequest) return;\n\n\t\tlet res;\n\t\tlet cacheKey;\n\n\t\tif (useCache) {\n\t\t\t// кэш для полученных ответов через apiRequest\n\t\t\t// общий для всех компонентов, использующих apiRequest\n\t\t\tapiRequest.cache ??= new Map();\n\n\t\t\tcacheKey = JSON.stringify(apiRequest.params);\n\t\t\tres = apiRequest.cache.get(cacheKey);\n\n\t\t\tif (res) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\n\t\tisLoading.value = true;\n\t\tres = await apiRequest.call();\n\t\tisLoading.value = false;\n\n\t\tif (res.errors) return;\n\n\t\tif (!Array.isArray(res.result)) {\n\t\t\tconsole.warn(`В result ожидался массив`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst indexWithError = (res.result as Array<Item | any>).findIndex(item => item.id === undefined || item.name === undefined);\n\t\tif (indexWithError !== -1) {\n\t\t\tconsole.warn(`В result[${indexWithError}] нет id или name`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (useCache) {\n\t\t\tapiRequest.cache.set(cacheKey as string, res);\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Загрузить items\n\t */\n\tconst load = async () => {\n\t\tif (!apiRequest) return;\n\n\t\tapiRequest.params.offset = 0;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = res.result;\n\t};\n\n\t/**\n\t * Загрузить следующую страницу items\n\t */\n\tconst loadAppend = async () => {\n\t\tif (!apiRequest) return;\n\n\t\t// данных о следующих страницах не обнаружено\n\t\tif (!_nextOffset) return;\n\n\t\t// дозагружать нельзя, если не завершена предыдущшая загрузка\n\t\tif (isLoading.value) return;\n\n\t\tapiRequest.params.offset = _nextOffset;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = items.value.concat(res.result);\n\t};\n\n\tconst loadDebounce = debounce(() => load(), 200);\n\n\t/**\n\t * Выполнить поиск по указанному тексту\n\t *\n\t * Если длина текста меньше minLength, поиск не будет проивзеден\n\t *\n\t * Если текст не изменился, поиск не будет проивзеден\n\t * @param searchText - текст поиска\n\t * @param useDebounce - отложенное выполнение поиска\n\t */\n\tconst setSearchTextAndLoad = (searchText: string, useDebounce = true) => {\n\t\tif (!apiRequest) return;\n\n\t\tif (searchText.length < minLength) return;\n\n\t\t// условия поиска не поменялись, данные загружены\n\t\tif (searchText === _searchText && items.value.length) return;\n\n\t\t_searchText = searchText;\n\n\t\tif (useDebounce) {\n\t\t\tloadDebounce();\n\t\t} else {\n\t\t\tvoid load();\n\t\t}\n\t};\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\tloadAppend,\n\t\tsetSearchTextAndLoad,\n\t};\n};\n","<script setup lang=\"ts\">\nimport type { ComputedRef, ModelRef, ComponentInstance } from 'vue';\nimport { computed, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { invertKeyboardLayout } from '@/core/utils/keyboard';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { TopPopup, TopPopupListItem, TopPopupWidgetInput } from '@/components/popup/popup';\nimport type PopupClass from '@/components/popup/lib/popup';\nimport type { Item, Props, Slots } from './selector2';\nimport { useAPI } from './api';\nimport Selector2ItemMulti from './itemMulti.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\titems: () => [] as Array<Item>,\n\tsize: 's',\n\tminLength: 0,\n\tshowSelectedInInput: true,\n});\n\nconst model = defineModel<Props['modelValue']>() as ModelRef<Props['modelValue']>;\n\ndefineSlots<Slots>();\n\n/**\n * Текст поиска по результатам\n */\nconst searchText = ref('');\n\n/**\n * Сброс поиска\n */\nconst resetSearch = () => {\n\tsearchText.value = '';\n\tAPI.items.value = [];\n};\n\n\nconst itemAll = {\n\tid: 0,\n\tname: useI18n().Common.All!,\n};\n\n/**\n * Экземпляр компонента Popup\n */\nconst popupRef = ref<ComponentInstance<typeof TopPopup> | null>(null);\n\n/**\n * Основной элемент селектора\n */\nconst elRef = ref<HTMLElement | null>(null);\n\n/**\n * Получить доступ к объекту popup\n */\nconst getPopup = (): PopupClass | undefined => {\n\treturn popupRef.value?.popup;\n};\n\n// для storybook\nif ((window as any).__STORYBOOK_PREVIEW__ && !props.modelValue) {\n\twatch(\n\t\t() => props.multiselect,\n\t\t() => {\n\t\t\tmodel.value = props.multiselect ? [] : { id: null, name: '' };\n\t\t},\n\t\t{ immediate: true },\n\t);\n}\n\nconst API = useAPI(props.apiRequest, props.minLength, props.useCache);\n\n/**\n * Варианты выбора: props.items + \"Выбрать все\"\n */\nconst localItems: ComputedRef<Array<Item>> = computed(() => {\n\tconst items: Array<Item> = [];\n\n\tif (!props.multiselect && props.appendAllValue) {\n\t\titems.push(itemAll);\n\t}\n\n\tprops.items.forEach(item => items.push({ ...item }));\n\n\treturn items;\n});\n\n/**\n * Проверить, что элемент выбран\n */\nconst isSelected = (item: Item, checkNameForNullId = true) => {\n\tif (checkNameForNullId && item.id === null) {\n\t\tif (Array.isArray(model.value)) {\n\t\t\treturn model.value.some(itemSelected => itemSelected.id === item.id && itemSelected.name === item.name);\n\t\t} else {\n\t\t\treturn item.name === model.value.name;\n\t\t}\n\t}\n\n\tif (Array.isArray(model.value)) {\n\t\treturn model.value.some(itemSelected => itemSelected.id === item.id);\n\t} else {\n\t\treturn item.id === model.value.id;\n\t}\n};\n\n/**\n * Варианты выбора, которые выводятся\n */\nconst itemsForShow = computed(() => {\n\tconst searchString = searchText.value.toLowerCase();\n\tconst searchStringInvertKeyboard = invertKeyboardLayout(searchString);\n\n\tlet items: typeof localItems.value = [];\n\n\tlocalItems.value.forEach((item) => {\n\t\tconst itemName = item.name.toLowerCase();\n\n\t\tif (\n\t\t\titem.id === Number(searchString) ||\n\t\t\titemName.includes(searchString) ||\n\t\t\titemName.includes(searchStringInvertKeyboard)\n\t\t) {\n\t\t\tif (itemName === searchString || itemName === searchStringInvertKeyboard) {\n\t\t\t\titems.unshift(item);\n\t\t\t} else {\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t}\n\t});\n\n\titems.push(...API.items.value);\n\n\tif (\n\t\tprops.appendSearchToResult &&\n\t\t!!searchText.value &&\n\t\t(!items.length || items[0].name.toLowerCase() !== searchString)\n\t) {\n\t\titems.push({\n\t\t\tid: null,\n\t\t\tname: searchText.value,\n\t\t});\n\t}\n\n\tif (props.multiselect) {\n\t\titems = items.filter(item => !isSelected(item));\n\t}\n\n\treturn items;\n});\n\n/**\n * Флаг - идет загрузка\n *\n * Скрывает вывод заглушки \"Нет результатов\" - для загрузки данных через API (multiselect = true) - (см. selectItem)\n */\nconst isLoading = ref(API.isLoading.value);\n\nwatch(API.isLoading, () => {\n\tisLoading.value = API.isLoading.value;\n});\n\n/**\n * Выбрать значение\n *\n * Управляет закрытием окна\n */\nconst selectItem = async (item: Item) => {\n\tif (props.multiselect) {\n\t\tif (!Array.isArray(model.value)) return;\n\n\t\tif (isSelected(item)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (props.apiRequest && searchText.value) {\n\t\t\tisLoading.value = true;\n\t\t}\n\n\t\tconst newModel = [...model.value];\n\t\tnewModel.push({ ...item });\n\t\tmodel.value = newModel;\n\n\t\tif (Core.state.isMobile) {\n\t\t\tgetPopup()?.close();\n\t\t} else {\n\t\t\tsetTimeout(() => {\n\t\t\t\tgetPopup()?.recalcPosition();\n\t\t\t\tgetPopup()?.elPopupWidget?.querySelector('input')?.focus();\n\n\t\t\t\tif (searchText.value) resetSearch();\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif (JSON.stringify(item) !== JSON.stringify(model.value)) {\n\t\t\tmodel.value = { ...item };\n\t\t}\n\n\t\tgetPopup()?.close();\n\t}\n};\n\n/**\n * Выбрать следующее значение\n */\nconst selectNextItem = () => {\n\tif (!Array.isArray(model.value)) {\n\t\tconst currentIndex = localItems.value.findIndex(item => item.id === (model.value as Item).id);\n\t\tconst nextIndex = (currentIndex + 1) % localItems.value.length;\n\t\tmodel.value = { ...localItems.value[nextIndex] };\n\t}\n};\n\n/**\n * Удалить выбранное значение по id\n * @param id\n */\nconst deleteItemById = async (id: Item['id']) => {\n\tif (Array.isArray(model.value)) {\n\t\tmodel.value = model.value.filter(item => item.id !== id);\n\n\t\tsetTimeout(() => {\n\t\t\tgetPopup()?.recalcPosition();\n\t\t});\n\t}\n};\n\nconst isOpened = ref(false); // флаг попап открыт\n\nif (props.apiRequest) {\n\twatch(isOpened, () => {\n\t\tif (isOpened.value) {\n\t\t\t// при открытии сразу выполнить поиск\n\t\t\tAPI.setSearchTextAndLoad(searchText.value, false);\n\t\t}\n\t});\n\n\t// отложенный поиск при вводе текста\n\twatch(searchText, () => API.setSearchTextAndLoad(searchText.value));\n}\n\nconst onScrollContentList = (e: Event) => {\n\tconst el = e.target as HTMLElement;\n\n\tif (el.scrollTop / (el.scrollHeight - el.offsetHeight) > 0.8) {\n\t\tAPI.loadAppend();\n\t}\n};\n\nconst onClose = () => {\n\tisOpened.value = false;\n\n\telRef.value?.focus();\n\n\tif (searchText.value) resetSearch();\n};\n</script>\n\n<template>\n\t<TopPopup\n\t\tref=\"popupRef\"\n\t\t@open=\"isOpened = true\"\n\t\t@close=\"onClose()\"\n\t\t@scrollContentList=\"apiRequest ? onScrollContentList($event) : undefined\"\n\t\t:notch=\"false\"\n\t\t:transitionDuration=\"0\"\n\t>\n\t\t<template #opener>\n\t\t\t<div\n\t\t\t\tref=\"elRef\"\n\t\t\t\tv-top-focus.onupdate=\"isError\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-selector2' : true,\n\t\t\t\t\t'top-selector2-multiselect': multiselect,\n\t\t\t\t\t['top-size_' + size]: true,\n\t\t\t\t\t['top-disabled']: disabled,\n\t\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t\t['top-error']: isError,\n\t\t\t\t}\"\n\t\t\t\t@keydown.up.down.enter.space.stop.prevent=\"($event.currentTarget as HTMLElement).click()\"\n\t\t\t\t@keydown.delete=\"model = []\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t>\n\t\t\t\t<template v-if=\"multiselect\">\n\t\t\t\t\t<div class=\"top-selector2_activeItems\">\n\t\t\t\t\t\t<Selector2ItemMulti\n\t\t\t\t\t\t\tv-for=\"item of model as Array<Item>\"\n\t\t\t\t\t\t\t:id=\"item.id\"\n\t\t\t\t\t\t\t:name=\"item.name\"\n\t\t\t\t\t\t\t@delete=\"deleteItemById\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\n\t\t\t\t<span v-if=\"!multiselect\" class=\"top-selector2_activeName top-ellipsis\">\n\t\t\t\t\t{{ !Array.isArray(model) ? model.name : '' }}\n\t\t\t\t</span>\n\n\t\t\t\t<span\n\t\t\t\t\tv-if=\"addChanger && !multiselect && localItems.length > 1 && !disabled\"\n\t\t\t\t\tclass=\"top-changer top-changer-selector\"\n\t\t\t\t\t@click.stop=\"selectNextItem\"\n\t\t\t\t></span>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<template #widget>\n\t\t\t<TopPopupWidgetInput\n\t\t\t\ttitle=\"Поиск\"\n\t\t\t\ticon=\"\"\n\t\t\t\tv-model=\"searchText\"\n\t\t\t\t:isLoading=\"isLoading\"\n\t\t\t\t:placeholder=\"!Array.isArray(model) && !multiselect && showSelectedInInput ? model.name : placeholder\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopPopupListItem\n\t\t\t\tv-for=\"item of itemsForShow\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-active': !Array.isArray(model) && !multiselect && model.name === item.name\n\t\t\t\t}\"\n\t\t\t\t:key=\"item.id ?? undefined\"\n\t\t\t\t@click.stop=\"selectItem(item)\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\tv-if=\"$slots.item\"\n\t\t\t\t\tname=\"item\"\n\t\t\t\t\t:item=\"item\"\n\t\t\t\t></slot>\n\n\t\t\t\t<template\n\t\t\t\t\tv-else\n\t\t\t\t>\n\t\t\t\t\t{{ item.name }}\n\t\t\t\t</template>\n\t\t\t</TopPopupListItem>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"!isLoading && !itemsForShow.length\"\n\t\t\t\ttype=\"regular\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.No_results }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-selector2 {\n\twidth: 180px;\n\tmin-height: var(--top-forms-base-height);\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: flex;\n\toverflow: hidden;\n\tpadding: var(--top-padding-1) var(--top-forms-padding);\n\tcolor: var(--top-forms-placeholder-color);\n\n\tborder-radius: var(--top-radius-2);\n\tborder: 1px solid var(--top-forms-border-color);\n\tbackground: var(--top-forms-background-color);\n}\n\n.top-selector2-multiselect {\n\twidth: unset;\n\tmin-width: 180px;\n\tpadding: var(--top-padding-1);\n}\n\n.top-selector2.top-active {\n\t--top-forms-border-color: var(--top-forms-border-color-hover);\n}\n\n.top-selector2_activeItems {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: var(--top-padding-1);\n\tmax-width: 100%;\n}\n\n.top-selector2_activeName {\n\twhite-space: nowrap;\n}\n\n.top-changer-selector {\n\ttransform: translateX(-16px);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport EditArea from './editArea/editArea.vue';\nimport EditInput from './editInput/editInput.vue';\nimport RadioGroup from './radioGroup/radioGroup.vue';\nimport Selector2 from './selector2/selector2.vue';\nimport Menu from './menu/menu.vue';\nimport Info from './info/info.vue';\n\nexport const TopEditArea = EditArea as typeof EditArea & ComponentCustomProps;\nexport const TopEditInput = EditInput as typeof EditInput & ComponentCustomProps;\nexport const TopRadioGroup = RadioGroup as typeof RadioGroup & ComponentCustomProps;\nexport const TopSelector2 = Selector2 as typeof Selector2 & ComponentCustomProps;\nexport const TopMenu = Menu as typeof Menu & ComponentCustomProps;\nexport const TopInfo = Info as typeof Info & ComponentCustomProps;\n"],"names":["props","__props","emit","__emit","localValue","ref","isFocused","isChanged","computed","submit","value","cancel","clickOnTitle","intermediateValue","watch","toRef","model","useModel","elRef","_a","item","_c","_b","_e","_d","uid","useAPI","apiRequest","minLength","useCache","items","isLoading","_searchText","_nextOffset","callAPIRequest","res","cacheKey","indexWithError","load","loadAppend","loadDebounce","debounce","searchText","useDebounce","resetSearch","API","itemAll","useI18n","popupRef","getPopup","localItems","isSelected","checkNameForNullId","itemSelected","itemsForShow","searchString","searchStringInvertKeyboard","invertKeyboardLayout","itemName","selectItem","newModel","Core","selectNextItem","nextIndex","deleteItemById","id","isOpened","onScrollContentList","e","el","onClose","TopEditArea","_sfc_main$5","TopEditInput","_sfc_main$4","TopRadioGroup","_sfc_main$3","TopSelector2","_sfc_main$1","TopMenu","_sfc_main$9","TopInfo","_sfc_main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,UAAAA,IAAAC,GAQAC,IAAAC,GAEAC,IAAAC,EAAAL,EAAA,YAAA,GAEAM,IAAAD,EAAAL,EAAA,SAAA,GAEAO,IAAAC,EAAA,MAAAJ,EAAA,UAAAJ,EAAA,YAAA,GAEAS,IAAA,CAAAC,MAAA;AACC,MAAAR,EAAA,UAAAQ,CAAA,GAEAN,EAAA,QAAAJ,EAAA;AAAA,IAAyB,GAG1BW,IAAA,MAAA;AACC,UAAAX,EAAA,qBAAA,CAAAO,EAAA,OAAA;AACC,QAAAL,EAAA,OAAA;AAEA;AAAA,MAAA;AAGD,MAAAE,EAAA,QAAAJ,EAAA;AAAA,IAAyB,GAG1BY,IAAA,MAAA;AACC,MAAAZ,EAAA,oBAAAE,EAAA,cAAA;AAAA,IAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjChD,UAAAF,IAAAC,GAEAY,IAAAR,EAAAL,EAAA,UAAA;AAEA,IAAAc,EAAAC,GAAAf,EAAA,UAAA,GAAA,MAAA;AACC,MAAAa,EAAA,QAAAb,EAAA;AAAA,IAAgC,CAAA;AAGjC,UAAAE,IAAAC,GAEAM,IAAA,MAAA;AACC,MAAAP,EAAA,qBAAAW,EAAA,KAAA;AAAA,IAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACZlD,UAAAG,IAAAC,EAAAhB,GAAA,YAAA,GAIAD,IAAAC,GAMAiB,IAAAb,EAAA,I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KAAAC,IACAC,KAAAC,IACAC,KAAAC,IACAC,KAAAC;"}
|
|
1
|
+
{"version":3,"file":"formsExt.js","sources":["../../src/components/formsExt/editArea/editArea.vue","../../src/components/formsExt/editInput/editInput.vue","../../src/components/formsExt/radioGroup/radioGroup.vue","../../src/components/formsExt/selector2/api.ts","../../src/components/formsExt/selector2/selector2.vue","../../src/components/formsExt/formsExt.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport Button from '@/components/forms/button/button.vue';\nimport type { Emits, Props } from './editArea';\nimport Textarea from '@/components/forms/textarea/textarea.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tdefaultValue: '',\n\tcancelText: 'Cancel',\n\tsubmitText: 'Send',\n\tcloseText: 'Close',\n\texpandable: true,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst localValue = ref(props.defaultValue);\n\nconst isFocused = ref(props.isFocused);\n\nconst isChanged = computed(() => localValue.value !== props.defaultValue);\n\nconst submit = (value: string) => {\n\temit('submit', value);\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst cancel = () => {\n\tif (props.forceShowCloseBtn && !isChanged.value) {\n\t\temit('close');\n\n\t\treturn;\n\t}\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst clickOnTitle = () => {\n\tif (props.attachToKeyboard) emit('clickOnTitle');\n};\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-editArea': true,\n\t\t\t'top-editArea-attachedToKeyboard': attachToKeyboard,\n\t\t}\"\n\t>\n\t\t<div\n\t\t\tv-if=\"title\"\n\t\t\tclass=\"top-editArea_title\"\n\t\t\t@click=\"clickOnTitle()\"\n\t\t>\n\t\t\t{{ title }}\n\t\t</div>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-editArea_form': true,\n\t\t\t\t'top-error': isError,\n\t\t\t\t'top-focus': isFocused,\n\t\t\t}\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tv-model=\"localValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:minHeight=\"minHeight\"\n\t\t\t\t:expandable=\"expandable\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:isError=\"isError\"\n\t\t\t\t:hint=\"hint\"\n\t\t\t\tclass=\"top-editArea_element\"\n\t\t\t\t@focus=\"() => isFocused = true\"\n\t\t\t\t@blur=\"() => isFocused = false\"\n\t\t\t\t@keyup.esc=\"cancel\"\n\t\t\t\t@keyup.ctrl.enter=\"submit(localValue)\"\n\t\t\t/>\n\n\t\t\t<div class=\"top-editArea_footer\">\n\t\t\t\t<Button\n\t\t\t\t\tv-if=\"isChanged || forceShowCloseBtn\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\tstyling=\"soft\"\n\t\t\t\t\t@click=\"cancel\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ cancelText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tv-if=\"isChanged\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\t@click=\"submit(localValue)\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ submitText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n.top-editArea {\n\t--top-editArea-bottom: env(keyboard-inset-height, 0px);\n\t--top-editArea-offset-bottom: 0px;\n\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.top-editArea_title {\n\tfont-size: 12px;\n}\n\n.top-editArea_form {\n\tflex-direction: column;\n\toutline: none;\n}\n\n.top-editArea_form:not(.top-error):hover,\n.top-editArea_form:not(.top-error).top-focus {\n\tborder-color: var(--top-forms-border-color-hover);\n}\n\n/* textarea в EditArea */\n.top-textarea {\n\twidth: 100%;\n}\n\n.top-editArea_element.top-textarea_textarea {\n\t--top-forms-border-width: 0px;\n\n\toutline: none;\n\tanimation: none;\n}\n\n/* footer */\n.top-editArea_footer {\n\tpadding: var(--top-forms-padding);\n\tdisplay: flex;\n\tmin-height: 32px;\n\talign-self: flex-end;\n\tjustify-content: flex-end;\n\tgap: var(--top-forms-padding);\n}\n\n/* attachedToKeyboard */\n.top-editArea-attachedToKeyboard {\n\tbackground: var(--top-forms-background-color);\n\tposition: fixed;\n\tbottom: calc(var(--top-editArea-offset-bottom) + var(--top-editArea-bottom));\n\tright: 0;\n\tleft: 0;\n\tz-index: 2;\n\tgap: 0;\n\ttransition: bottom var(--transition-fast);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_form {\n\tborder-radius: 0;\n\tborder: none;\n\tborder-top: 1px solid var(--top-forms-border-color);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_title {\n\tcursor: pointer;\n\tborder-top: 1px solid var(--color-line-2-opacity);\n\tpadding: var(--top-forms-padding);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_footer > [data-top-icon] {\n\tborder-radius: 100%;\n}\n\n@media screen and (max-width: 900px) {\n\t.top-editArea_form{\n\t\tflex-direction: row;\n\t}\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, toRef, watch } from 'vue';\nimport type { Emits, Props } from './editInput';\nimport TopInput from '@/components/forms/input/input.vue';\nimport TopButton from '@/components/forms/button/button.vue';\n\nconst props = defineProps<Props>();\n\nconst intermediateValue = ref(props.modelValue);\n\nwatch(toRef(props.modelValue), () => {\n\tintermediateValue.value = props.modelValue;\n});\n\nconst emit = defineEmits<Emits>();\n\nconst submit = () => {\n\temit('update:modelValue', intermediateValue.value);\n};\n</script>\n\n<template>\n\t<div class=\"top-editInput\">\n\t\t<TopInput\n\t\t\t:=\"input\"\n\t\t\t@keydown.esc.capture.stop=\"intermediateValue = modelValue\"\n\t\t\t@keydown.enter.stop=\"submit\"\n\t\t\tv-model=\"intermediateValue\"\n\t\t/>\n\n\t\t<TopButton\n\t\t\tv-if=\"intermediateValue !== modelValue\"\n\t\t\ticon=\"\"\n\t\t\tstyling=\"soft\"\n\t\t\t:=\"button\"\n\t\t\t@click=\"submit\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-editInput {\n\twidth: 220px;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: flex-end;\n\tgap: var(--top-gap-1);\n}\n\n.top-editInput .top-input {\n\twidth: unset;\n\tflex-grow: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Ref } from '@vue/reactivity';\nimport { ref, watch } from 'vue';\nimport type { Props, Emits } from './radioGroup';\n\nconst model = defineModel<string>({\n\trequired: true,\n});\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: 's',\n});\n\nconst emit = defineEmits<Emits>();\n\nconst elRef: Ref<HTMLElement | null> = ref(null);\n\nwatch(model, () => {\n\tif (!props.radiosProps?.some(item => item.value === model.value)) {\n\t\tmodel.value = props.radiosProps?.[0]?.value ?? '';\n\t}\n\n\telRef.value?.querySelector('.radioGroup_item-selected')?.scrollIntoView();\n}, { immediate: true });\n\nconst uid = 'radioGroup-' + Math.random();\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t['top-radioGroup']: true,\n\t\t\t['top-scrollBarXHidding']: true,\n\t\t\t['top-size_' + size]: !!size,\n\t\t\t['top-error']: isError,\n\t\t}\"\n\t>\n\t\t<label\n\t\t\tv-for=\"item of radiosProps\"\n\t\t\t:class=\"{\n\t\t\t\t['top-radioGroup_item-selected']: item.value === model,\n\t\t\t\t['top-radioGroup_item']: true,\n\t\t\t\t['top-forms-focusable']: true,\n\t\t\t\t['top-disabled']: item.disabled,\n\t\t\t}\"\n\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t@click=\"model = item.value\"\n\t\t>\n\t\t\t{{ item.title }}\n\n\t\t\t<span\n\t\t\t\tv-if=\"showIndicator\"\n\t\t\t\tclass=\"top-radioGroup_circle\"\n\t\t\t></span>\n\n\t\t\t<!-- Для нативной навигации -->\n\t\t\t<input\n\t\t\t\tv-model=\"model\"\n\t\t\t\t:name=\"uid\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t['top-unvisible']: true,\n\t\t\t\t}\"\n\t\t\t\t:value=\"item.value\"\n\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t/>\n\t\t</label>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/top-scrollBar.css\";\n\n.top-radioGroup {\n\tuser-select: none;\n\tbox-sizing: border-box;\n\tborder-radius: 8px;\n\tbackground-color: var(--color-layout-middle);\n\theight: var(--top-forms-base-height);\n\tpadding: 2px;\n\tgap: 2px;\n\tdisplay: flex;\n\talign-items: flex-start;\n}\n\n.top-radioGroup_item {\n\tcolor: var(--color-text-2);\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\tborder-radius: 6px;\n\theight: calc(var(--top-forms-base-height) - 4px);\n\tpadding: 0 16px;\n\tfont-weight: 400;\n\twhite-space: nowrap;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-grow: 1;\n\tgap: 4px;\n}\n\n.top-radioGroup_item:hover {\n\tbackground-color: var(--color-layout-front-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* selected */\n.top-radioGroup_item-selected {\n\tcolor: var(--color-text-1);\n\tpointer-events: none;\n\tbackground-color: var(--color-bg-lightning-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* circle */\n.top-radioGroup_circle {\n\tcontent: \"\";\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-line-3-opacity);\n\tborder-radius: 50%;\n\tpadding: 3px;\n\tmargin-left: auto;\n\twidth: calc(var(--top-forms-option-height) - 3px * 2);\n\theight: calc(var(--top-forms-option-height) - 3px * 2);\n}\n\n.top-radioGroup_item:hover .top-radioGroup_circle:before {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* circle selected */\n.top-radioGroup_item-selected .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n\tborder-width: 5px;\n}\n\n.top-radioGroup_item-selected:hover .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* top-error */\n.top-radioGroup.top-error .top-radioGroup_item:not(.top-disabled) .top-radioGroup_circle {\n\tborder-color: var(--color-line-negative-1);\n}\n</style>\n","import type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport type { Item, Props } from './selector2';\n\nexport const useAPI = (apiRequest: Props['apiRequest'], minLength: number, useCache: Props['useCache']) => {\n\t/**\n\t * Список, полученный через API\n\t */\n\tconst items: Ref<Array<Item>> = ref([]);\n\n\t/**\n\t * Флаг - идет загрузка\n\t */\n\tconst isLoading = ref(false);\n\n\tlet _searchText = '';\n\tlet _nextOffset: number | undefined;\n\n\tif (apiRequest && !apiRequest.params.limit) {\n\t\tapiRequest.params.limit = 100;\n\t}\n\n\t/**\n\t * Выполнить обращение к API\n\t *\n\t * При ошибке вернет undefined\n\t */\n\tconst callAPIRequest = async (): Promise<{ nextOffset?: number, result: Array<Item> } | undefined> => {\n\t\tif (!apiRequest) return;\n\n\t\tlet res;\n\t\tlet cacheKey;\n\n\t\tif (useCache) {\n\t\t\t// кэш для полученных ответов через apiRequest\n\t\t\t// общий для всех компонентов, использующих apiRequest\n\t\t\tapiRequest.cache ??= new Map();\n\n\t\t\tcacheKey = JSON.stringify(apiRequest.params);\n\t\t\tres = apiRequest.cache.get(cacheKey);\n\n\t\t\tif (res) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\n\t\tisLoading.value = true;\n\t\tres = await apiRequest.call();\n\t\tisLoading.value = false;\n\n\t\tif (res.errors) return;\n\n\t\tif (!Array.isArray(res.result)) {\n\t\t\tconsole.warn(`В result ожидался массив`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst indexWithError = (res.result as Array<Item | any>).findIndex(item => item.id === undefined || item.name === undefined);\n\t\tif (indexWithError !== -1) {\n\t\t\tconsole.warn(`В result[${indexWithError}] нет id или name`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (useCache) {\n\t\t\tapiRequest.cache.set(cacheKey as string, res);\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Загрузить items\n\t */\n\tconst load = async () => {\n\t\tif (!apiRequest) return;\n\n\t\tapiRequest.params.offset = 0;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = res.result;\n\t};\n\n\t/**\n\t * Загрузить следующую страницу items\n\t */\n\tconst loadAppend = async () => {\n\t\tif (!apiRequest) return;\n\n\t\t// данных о следующих страницах не обнаружено\n\t\tif (!_nextOffset) return;\n\n\t\t// дозагружать нельзя, если не завершена предыдущшая загрузка\n\t\tif (isLoading.value) return;\n\n\t\tapiRequest.params.offset = _nextOffset;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = items.value.concat(res.result);\n\t};\n\n\tconst loadDebounce = debounce(() => load(), 200);\n\n\t/**\n\t * Выполнить поиск по указанному тексту\n\t *\n\t * Если длина текста меньше minLength, поиск не будет проивзеден\n\t *\n\t * Если текст не изменился, поиск не будет проивзеден\n\t * @param searchText - текст поиска\n\t * @param useDebounce - отложенное выполнение поиска\n\t */\n\tconst setSearchTextAndLoad = (searchText: string, useDebounce = true) => {\n\t\tif (!apiRequest) return;\n\n\t\tif (searchText.length < minLength) return;\n\n\t\t// условия поиска не поменялись, данные загружены\n\t\tif (searchText === _searchText && items.value.length) return;\n\n\t\t_searchText = searchText;\n\n\t\tif (useDebounce) {\n\t\t\tloadDebounce();\n\t\t} else {\n\t\t\tvoid load();\n\t\t}\n\t};\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\tloadAppend,\n\t\tsetSearchTextAndLoad,\n\t};\n};\n","<script setup lang=\"ts\">\nimport type { ComputedRef, ModelRef, ComponentInstance } from 'vue';\nimport { computed, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { invertKeyboardLayout } from '@/core/utils/keyboard';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { TopPopup, TopPopupListItem, TopPopupWidgetInput } from '@/components/popup/popup';\nimport type PopupClass from '@/components/popup/lib/popup';\nimport type { Item, Props, Slots } from './selector2';\nimport { useAPI } from './api';\nimport Selector2ItemMulti from './itemMulti.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\titems: () => [] as Array<Item>,\n\tsize: 's',\n\tminLength: 0,\n\tshowSelectedInInput: true,\n\tshowSearch: true,\n});\n\nconst model = defineModel<Props['modelValue']>() as ModelRef<Props['modelValue']>;\n\ndefineSlots<Slots>();\n\n/**\n * Текст поиска по результатам\n */\nconst searchText = ref('');\n\n/**\n * Сброс поиска\n */\nconst resetSearch = () => {\n\tsearchText.value = '';\n\tAPI.items.value = [];\n};\n\n\nconst itemAll = {\n\tid: 0,\n\tname: useI18n().Common.All!,\n};\n\n/**\n * Экземпляр компонента Popup\n */\nconst popupRef = ref<ComponentInstance<typeof TopPopup> | null>(null);\n\n/**\n * Основной элемент селектора\n */\nconst elRef = ref<HTMLElement | null>(null);\n\n/**\n * Получить доступ к объекту popup\n */\nconst getPopup = (): PopupClass | undefined => {\n\treturn popupRef.value?.popup;\n};\n\n// для storybook\nif ((window as any).__STORYBOOK_PREVIEW__ && !props.modelValue) {\n\twatch(\n\t\t() => props.multiselect,\n\t\t() => {\n\t\t\tmodel.value = props.multiselect ? [] : { id: null, name: '' };\n\t\t},\n\t\t{ immediate: true },\n\t);\n}\n\nconst API = useAPI(props.apiRequest, props.minLength, props.useCache);\n\n/**\n * Варианты выбора: props.items + \"Выбрать все\"\n */\nconst localItems: ComputedRef<Array<Item>> = computed(() => {\n\tconst items: Array<Item> = [];\n\n\tif (!props.multiselect && props.appendAllValue) {\n\t\titems.push(itemAll);\n\t}\n\n\tprops.items.forEach(item => items.push({ ...item }));\n\n\treturn items;\n});\n\n/**\n * Проверить, что элемент выбран\n */\nconst isSelected = (item: Item, checkNameForNullId = true) => {\n\tif (checkNameForNullId && item.id === null) {\n\t\tif (Array.isArray(model.value)) {\n\t\t\treturn model.value.some(itemSelected => itemSelected.id === item.id && itemSelected.name === item.name);\n\t\t} else {\n\t\t\treturn item.name === model.value.name;\n\t\t}\n\t}\n\n\tif (Array.isArray(model.value)) {\n\t\treturn model.value.some(itemSelected => itemSelected.id === item.id);\n\t} else {\n\t\treturn item.id === model.value.id;\n\t}\n};\n\n/**\n * Варианты выбора, которые выводятся\n */\nconst itemsForShow = computed(() => {\n\tconst searchString = searchText.value.toLowerCase();\n\tconst searchStringInvertKeyboard = invertKeyboardLayout(searchString);\n\n\tlet items: typeof localItems.value = [];\n\n\tlocalItems.value.forEach((item) => {\n\t\tconst itemName = item.name.toLowerCase();\n\n\t\tif (\n\t\t\titem.id === Number(searchString) ||\n\t\t\titemName.includes(searchString) ||\n\t\t\titemName.includes(searchStringInvertKeyboard)\n\t\t) {\n\t\t\tif (itemName === searchString || itemName === searchStringInvertKeyboard) {\n\t\t\t\titems.unshift(item);\n\t\t\t} else {\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t}\n\t});\n\n\titems.push(...API.items.value);\n\n\tif (\n\t\tprops.appendSearchToResult &&\n\t\t!!searchText.value &&\n\t\t(!items.length || items[0].name.toLowerCase() !== searchString)\n\t) {\n\t\titems.push({\n\t\t\tid: null,\n\t\t\tname: searchText.value,\n\t\t});\n\t}\n\n\tif (props.multiselect) {\n\t\titems = items.filter(item => !isSelected(item));\n\t}\n\n\treturn items;\n});\n\n/**\n * Флаг - идет загрузка\n *\n * Скрывает вывод заглушки \"Нет результатов\" - для загрузки данных через API (multiselect = true) - (см. selectItem)\n */\nconst isLoading = ref(API.isLoading.value);\n\nwatch(API.isLoading, () => {\n\tisLoading.value = API.isLoading.value;\n});\n\n/**\n * Выбрать значение\n *\n * Управляет закрытием окна\n */\nconst selectItem = async (item: Item) => {\n\tif (props.multiselect) {\n\t\tif (!Array.isArray(model.value)) return;\n\n\t\tif (isSelected(item)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (props.apiRequest && searchText.value) {\n\t\t\tisLoading.value = true;\n\t\t}\n\n\t\tconst newModel = [...model.value];\n\t\tnewModel.push({ ...item });\n\t\tmodel.value = newModel;\n\n\t\tif (Core.state.isMobile) {\n\t\t\tgetPopup()?.close();\n\t\t} else {\n\t\t\tsetTimeout(() => {\n\t\t\t\tgetPopup()?.recalcPosition();\n\t\t\t\tgetPopup()?.elPopupWidget?.querySelector('input')?.focus();\n\n\t\t\t\tif (searchText.value) resetSearch();\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif (JSON.stringify(item) !== JSON.stringify(model.value)) {\n\t\t\tmodel.value = { ...item };\n\t\t}\n\n\t\tgetPopup()?.close();\n\t}\n};\n\n/**\n * Выбрать следующее значение\n */\nconst selectNextItem = () => {\n\tif (!Array.isArray(model.value)) {\n\t\tconst currentIndex = localItems.value.findIndex(item => item.id === (model.value as Item).id);\n\t\tconst nextIndex = (currentIndex + 1) % localItems.value.length;\n\t\tmodel.value = { ...localItems.value[nextIndex] };\n\t}\n};\n\n/**\n * Удалить выбранное значение по id\n * @param id\n */\nconst deleteItemById = async (id: Item['id']) => {\n\tif (Array.isArray(model.value)) {\n\t\tmodel.value = model.value.filter(item => item.id !== id);\n\n\t\tsetTimeout(() => {\n\t\t\tgetPopup()?.recalcPosition();\n\t\t});\n\t}\n};\n\nconst isOpened = ref(false); // флаг попап открыт\n\nif (props.apiRequest) {\n\twatch(isOpened, () => {\n\t\tif (isOpened.value) {\n\t\t\t// при открытии сразу выполнить поиск\n\t\t\tAPI.setSearchTextAndLoad(searchText.value, false);\n\t\t}\n\t});\n\n\t// отложенный поиск при вводе текста\n\twatch(searchText, () => API.setSearchTextAndLoad(searchText.value));\n}\n\nconst onScrollContentList = (e: Event) => {\n\tconst el = e.target as HTMLElement;\n\n\tif (el.scrollTop / (el.scrollHeight - el.offsetHeight) > 0.8) {\n\t\tAPI.loadAppend();\n\t}\n};\n\nconst onClose = () => {\n\tisOpened.value = false;\n\n\telRef.value?.focus();\n\n\tif (searchText.value) resetSearch();\n};\n</script>\n\n<template>\n\t<TopPopup\n\t\tref=\"popupRef\"\n\t\t@open=\"isOpened = true\"\n\t\t@close=\"onClose()\"\n\t\t@scrollContentList=\"apiRequest ? onScrollContentList($event) : undefined\"\n\t\t:notch=\"false\"\n\t\t:transitionDuration=\"0\"\n\t>\n\t\t<template #opener>\n\t\t\t<div\n\t\t\t\tref=\"elRef\"\n\t\t\t\tv-top-focus.onupdate=\"isError\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-selector2' : true,\n\t\t\t\t\t'top-selector2-multiselect': multiselect,\n\t\t\t\t\t['top-size_' + size]: true,\n\t\t\t\t\t['top-disabled']: disabled,\n\t\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t\t['top-error']: isError,\n\t\t\t\t}\"\n\t\t\t\t@keydown.up.down.enter.space.stop.prevent=\"($event.currentTarget as HTMLElement).click()\"\n\t\t\t\t@keydown.delete=\"model = []\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t>\n\t\t\t\t<template v-if=\"multiselect\">\n\t\t\t\t\t<div class=\"top-selector2_activeItems\">\n\t\t\t\t\t\t<Selector2ItemMulti\n\t\t\t\t\t\t\tv-for=\"item of model as Array<Item>\"\n\t\t\t\t\t\t\t:id=\"item.id\"\n\t\t\t\t\t\t\t:name=\"item.name\"\n\t\t\t\t\t\t\t@delete=\"deleteItemById\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\n\t\t\t\t<span v-if=\"!multiselect\" class=\"top-selector2_activeName top-ellipsis\">\n\t\t\t\t\t{{ !Array.isArray(model) ? model.name : '' }}\n\t\t\t\t</span>\n\n\t\t\t\t<span\n\t\t\t\t\tv-if=\"addChanger && !multiselect && localItems.length > 1 && !disabled\"\n\t\t\t\t\tclass=\"top-changer top-changer-selector\"\n\t\t\t\t\t@click.stop=\"selectNextItem\"\n\t\t\t\t></span>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<template #widget v-if=\"showSearch\">\n\t\t\t<TopPopupWidgetInput\n\t\t\t\ttitle=\"Поиск\"\n\t\t\t\ticon=\"\"\n\t\t\t\tv-model=\"searchText\"\n\t\t\t\t:isLoading=\"isLoading\"\n\t\t\t\t:placeholder=\"!Array.isArray(model) && !multiselect && showSelectedInInput ? model.name : placeholder\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopPopupListItem\n\t\t\t\tv-for=\"item of itemsForShow\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-active': !Array.isArray(model) && !multiselect && model.name === item.name\n\t\t\t\t}\"\n\t\t\t\t:key=\"item.id ?? undefined\"\n\t\t\t\t@click.stop=\"selectItem(item)\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\tv-if=\"$slots.item\"\n\t\t\t\t\tname=\"item\"\n\t\t\t\t\t:item=\"item\"\n\t\t\t\t></slot>\n\n\t\t\t\t<template\n\t\t\t\t\tv-else\n\t\t\t\t>\n\t\t\t\t\t{{ item.name }}\n\t\t\t\t</template>\n\t\t\t</TopPopupListItem>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"!isLoading && !itemsForShow.length\"\n\t\t\t\ttype=\"regular\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.No_results }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-selector2 {\n\twidth: 180px;\n\tmin-height: var(--top-forms-base-height);\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: flex;\n\toverflow: hidden;\n\tpadding: var(--top-padding-1) var(--top-forms-padding);\n\tcolor: var(--top-forms-placeholder-color);\n\n\tborder-radius: var(--top-radius-2);\n\tborder: 1px solid var(--top-forms-border-color);\n\tbackground: var(--top-forms-background-color);\n}\n\n.top-selector2-multiselect {\n\twidth: unset;\n\tmin-width: 180px;\n\tpadding: var(--top-padding-1);\n}\n\n.top-selector2.top-active {\n\t--top-forms-border-color: var(--top-forms-border-color-hover);\n}\n\n.top-selector2_activeItems {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: var(--top-padding-1);\n\tmax-width: 100%;\n}\n\n.top-selector2_activeName {\n\twhite-space: nowrap;\n}\n\n.top-changer-selector {\n\ttransform: translateX(-16px);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport EditArea from './editArea/editArea.vue';\nimport EditInput from './editInput/editInput.vue';\nimport RadioGroup from './radioGroup/radioGroup.vue';\nimport Selector2 from './selector2/selector2.vue';\nimport Menu from './menu/menu.vue';\nimport Info from './info/info.vue';\n\nexport const TopEditArea = EditArea as typeof EditArea & ComponentCustomProps;\nexport const TopEditInput = EditInput as typeof EditInput & ComponentCustomProps;\nexport const TopRadioGroup = RadioGroup as typeof RadioGroup & ComponentCustomProps;\nexport const TopSelector2 = Selector2 as typeof Selector2 & ComponentCustomProps;\nexport const TopMenu = Menu as typeof Menu & ComponentCustomProps;\nexport const TopInfo = Info as typeof Info & ComponentCustomProps;\n"],"names":["props","__props","emit","__emit","localValue","ref","isFocused","isChanged","computed","submit","value","cancel","clickOnTitle","intermediateValue","watch","toRef","model","useModel","elRef","_a","item","_c","_b","_e","_d","uid","useAPI","apiRequest","minLength","useCache","items","isLoading","_searchText","_nextOffset","callAPIRequest","res","cacheKey","indexWithError","load","loadAppend","loadDebounce","debounce","searchText","useDebounce","resetSearch","API","itemAll","useI18n","popupRef","getPopup","localItems","isSelected","checkNameForNullId","itemSelected","itemsForShow","searchString","searchStringInvertKeyboard","invertKeyboardLayout","itemName","selectItem","newModel","Core","selectNextItem","nextIndex","deleteItemById","id","isOpened","onScrollContentList","e","el","onClose","TopEditArea","_sfc_main$5","TopEditInput","_sfc_main$4","TopRadioGroup","_sfc_main$3","TopSelector2","_sfc_main$1","TopMenu","_sfc_main$9","TopInfo","_sfc_main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,UAAAA,IAAAC,GAQAC,IAAAC,GAEAC,IAAAC,EAAAL,EAAA,YAAA,GAEAM,IAAAD,EAAAL,EAAA,SAAA,GAEAO,IAAAC,EAAA,MAAAJ,EAAA,UAAAJ,EAAA,YAAA,GAEAS,IAAA,CAAAC,MAAA;AACC,MAAAR,EAAA,UAAAQ,CAAA,GAEAN,EAAA,QAAAJ,EAAA;AAAA,IAAyB,GAG1BW,IAAA,MAAA;AACC,UAAAX,EAAA,qBAAA,CAAAO,EAAA,OAAA;AACC,QAAAL,EAAA,OAAA;AAEA;AAAA,MAAA;AAGD,MAAAE,EAAA,QAAAJ,EAAA;AAAA,IAAyB,GAG1BY,IAAA,MAAA;AACC,MAAAZ,EAAA,oBAAAE,EAAA,cAAA;AAAA,IAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjChD,UAAAF,IAAAC,GAEAY,IAAAR,EAAAL,EAAA,UAAA;AAEA,IAAAc,EAAAC,GAAAf,EAAA,UAAA,GAAA,MAAA;AACC,MAAAa,EAAA,QAAAb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AA,QAAAC,EAAA,SAEAuB,EAAA,SAAAE,EAAA;AAAA,IAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICtP5B2B,KAAAC,IACAC,KAAAC,IACAC,KAAAC,IACAC,KAAAC,IACAC,KAAAC,IACAC,KAAAC;"}
|
package/package.json
CHANGED
package/project/project.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-B3bJpLOo.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd","../.chunks/utils-CTjq0RlC.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(s=>{var f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,y=-2,L=-1,ue={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},se=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(se(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(y,ce()),t.size||t.set(y,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(s=>{if(l&&!s.enabled)return;const f={...s};a.regionByIndex.set(f.index,f)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:ue[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-BOPta9cH.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let s={value:a.key,title:a.name};n.addSearcherIcon&&(s.icon=P.getSearcherGIcon(a.key)),o.set(a.key,s)}),n.addCompare&&!o.has(y)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const s={value:w,title:r.Common.Compare};o.set(s.value,s)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,s;const r=x.useI18n(),t=e.ref(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};f.has(S.key)||f.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of f.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(s=>r.value.has(s))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},ye=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,v,u;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const s=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:s(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=s();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=f();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:s,searcherByKey:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:s.regionsIndexes.value,"@update:regionsIndexes":I=>s.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,s.regionsIndexes],()=>{if(o.searcherKey.value===w&&s.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(s.regionsIndexes.value))return;t.value=[...s.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(s.regionsIndexes.value)){t.value=[...s.regionsIndexes.value];return}}else{let v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}else o.searcherKey.value=w,s.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(s).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{id:"1",name:"Without Tag",color_id:"1"},{id:"2",name:"Red",color_id:"2"},{id:"3",name:"Orange",color_id:"3"},{id:"4",name:"Yellow",color_id:"4"},{id:"5",name:"Blue",color_id:"5"},{id:"6",name:"Purple",color_id:"6"},{id:"7",name:"Green",color_id:"7"},{id:"8",name:"Magenta",color_id:"8"},{id:"9",name:"Dark blue",color_id:"9"},{id:"10",name:"Turquoise",color_id:"10"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tagSelector_tagIcon":!0,"top-tagSelector-active":!!l.state,"top-tagSelector-excluded":l.state==="excluded"}),"data-tag_id":l.id,"data-tag_color_id":l.colorId,title:l.name},null,10,ke))}}),Ie=["contenteditable","onKeydown"],Z=e.defineComponent({__name:"tagPopupListItem",props:e.mergeModels({editable:{type:Boolean},disabled:{type:Boolean},canExclude:{type:Boolean},id:{},colorId:{},name:{},state:{}},{name:{required:!0},nameModifiers:{}}),emits:e.mergeModels(["update:name","unselect","exclude","select"],["update:name"]),setup(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:s.value,onpaste:m=>m.preventDefault()}:{}),s=e.ref(!1),f=async()=>{var m;s.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),s.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),s.value=!1},i=m=>{if(s.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":s.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:s.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[s.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:f}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=e.defineComponent({inheritAttrs:!1,__name:"popupOpener",props:e.mergeModels({modelValue:{},id:{},tags:{},mode:{},targetId:{},filters:{},useTopButton:{type:Boolean},payload:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,s)=>{const f=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:""},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class"])),[[f,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=e.defineComponent({__name:"tagSelector",props:e.mergeModels({modelValue:{},tags:{},tagsEditable:{type:Boolean},tagsMax:{default:10},id:{},singleMode:{type:Boolean},requiredForSetter:{type:Boolean,default:!0},maxTagsForSetter:{},emitDelay:{default:500}},{modelValue:{required:!0},modelModifiers:{},tags:{default:e.reactive(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,s=x.debounce((u,g)=>{a(u,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+u}),g.set("replace",{value:"replace",title:r.Common.Replace+u}),g.set("delete",{value:"delete",title:r.Common.Delete+u}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{s("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=u=>{if(u!=="all"){if(i.value.model.value.includes(u))return"selected";if(i.value.model.value.includes(X(u)))return"excluded"}return u==="all"&&!i.value.model.value.length?"selected":""},I=(u,g)=>{const p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&s("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let u="top-tagSelector_popup";return i.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),C=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:u,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=u=>{var g;if(i.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(p,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),s("tagsChanged",o.value)}})},v=u=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-select_arrow",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.name=k,e.unref(s)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&o.value.length<u.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=p=>h.value=p),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=p=>e.unref(s)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var s,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-B3bJpLOo.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd","../.chunks/utils-CTjq0RlC.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(s=>{var f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,y=-2,L=-1,ue={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},se=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(se(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(y,ce()),t.size||t.set(y,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(s=>{if(l&&!s.enabled)return;const f={...s};a.regionByIndex.set(f.index,f)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:ue[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-D_HXNjOX.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let s={value:a.key,title:a.name};n.addSearcherIcon&&(s.icon=P.getSearcherGIcon(a.key)),o.set(a.key,s)}),n.addCompare&&!o.has(y)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const s={value:w,title:r.Common.Compare};o.set(s.value,s)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,s;const r=x.useI18n(),t=e.ref(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};f.has(S.key)||f.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of f.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(s=>r.value.has(s))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},ye=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,v,u;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const s=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:s(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=s();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=f();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:s,searcherByKey:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:s.regionsIndexes.value,"@update:regionsIndexes":I=>s.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,s.regionsIndexes],()=>{if(o.searcherKey.value===w&&s.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(s.regionsIndexes.value))return;t.value=[...s.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(s.regionsIndexes.value)){t.value=[...s.regionsIndexes.value];return}}else{let v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}else o.searcherKey.value=w,s.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(s).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{id:"1",name:"Without Tag",color_id:"1"},{id:"2",name:"Red",color_id:"2"},{id:"3",name:"Orange",color_id:"3"},{id:"4",name:"Yellow",color_id:"4"},{id:"5",name:"Blue",color_id:"5"},{id:"6",name:"Purple",color_id:"6"},{id:"7",name:"Green",color_id:"7"},{id:"8",name:"Magenta",color_id:"8"},{id:"9",name:"Dark blue",color_id:"9"},{id:"10",name:"Turquoise",color_id:"10"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tagSelector_tagIcon":!0,"top-tagSelector-active":!!l.state,"top-tagSelector-excluded":l.state==="excluded"}),"data-tag_id":l.id,"data-tag_color_id":l.colorId,title:l.name},null,10,ke))}}),Ie=["contenteditable","onKeydown"],Z=e.defineComponent({__name:"tagPopupListItem",props:e.mergeModels({editable:{type:Boolean},disabled:{type:Boolean},canExclude:{type:Boolean},id:{},colorId:{},name:{},state:{}},{name:{required:!0},nameModifiers:{}}),emits:e.mergeModels(["update:name","unselect","exclude","select"],["update:name"]),setup(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:s.value,onpaste:m=>m.preventDefault()}:{}),s=e.ref(!1),f=async()=>{var m;s.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),s.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),s.value=!1},i=m=>{if(s.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":s.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:s.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[s.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:f}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=e.defineComponent({inheritAttrs:!1,__name:"popupOpener",props:e.mergeModels({modelValue:{},id:{},tags:{},mode:{},targetId:{},filters:{},useTopButton:{type:Boolean},payload:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,s)=>{const f=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:""},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class"])),[[f,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=e.defineComponent({__name:"tagSelector",props:e.mergeModels({modelValue:{},tags:{},tagsEditable:{type:Boolean},tagsMax:{default:10},id:{},singleMode:{type:Boolean},requiredForSetter:{type:Boolean,default:!0},maxTagsForSetter:{},emitDelay:{default:500}},{modelValue:{required:!0},modelModifiers:{},tags:{default:e.reactive(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,s=x.debounce((u,g)=>{a(u,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+u}),g.set("replace",{value:"replace",title:r.Common.Replace+u}),g.set("delete",{value:"delete",title:r.Common.Delete+u}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{s("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=u=>{if(u!=="all"){if(i.value.model.value.includes(u))return"selected";if(i.value.model.value.includes(X(u)))return"excluded"}return u==="all"&&!i.value.model.value.length?"selected":""},I=(u,g)=>{const p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&s("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let u="top-tagSelector_popup";return i.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),C=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:u,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=u=>{var g;if(i.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(p,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),s("tagsChanged",o.value)}})},v=u=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-select_arrow",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.name=k,e.unref(s)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&o.value.length<u.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=p=>h.value=p),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=p=>e.unref(s)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var s,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=project.amd.js.map
|
package/project/project.js
CHANGED
|
@@ -165,7 +165,7 @@ const je = { class: "top-selectorCompetitors" }, ze = { class: "top-ellipsis1" }
|
|
|
165
165
|
}), i))
|
|
166
166
|
return !1;
|
|
167
167
|
}), i;
|
|
168
|
-
}, Ze = De(() => import("../.chunks/dialog_selectorRegions-
|
|
168
|
+
}, Ze = De(() => import("../.chunks/dialog_selectorRegions-DZR64Wm8.es.js")), et = (t, l) => {
|
|
169
169
|
const o = R(), e = F(l.value.keys().next().value ?? p), i = E(() => {
|
|
170
170
|
const a = /* @__PURE__ */ new Map();
|
|
171
171
|
if (l.value.forEach((n) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchers.amd.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string |
|
|
1
|
+
{"version":3,"file":"searchers.amd.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | undefined): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":"4OAKO,MAAAA,EAAA,8IAWD,IAAA,SAEN,EAMaC,EAAAC,GAAA,UAKZ,yCAAAA,EAAA,CAAqB,IAAA,eAInB,IAAA,IACI,IAAA,gBAIJ,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,KAAA,gBAIA,CAGF,OAAAC,CACD,EAKaC,EAAAC,GAAA,yDAKS,IAAA,eAInB,IAAA,eAIA,IAAA,cAIA,CAGF,OAAAF,CACD,EAKaG,EAAA,CAAAJ,EAAAK,IAAA,+CAGa,IAAA,GACnB,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GAEJ,OAAAA,CAAO,CAGT,MAAA,EACD,EAKOC,EAAA,CAAAC,EAAAP,EAAAQ,IAAA,aACmB,IAAA,eAGC,IAAA,oBAItB,IAAA,qBAIA,IAAA,sBAIA,IAAA,sBAIA,OAEF,IAAA,mBAKA,CAGF,OAAAD,CACD,EAKaE,EAAA,CAAAT,EAAAQ,IAAA,CAIZ,OAFAA,IAAA,OAAAA,EAAA,GAEAR,EAAA,CAAqB,IAAA,aAInB,IAAA,aAIA,IAAA,GAEAQ,EAAA,IAAAA,EAAA,+CAIwD,CAG1D,OAAAA,CACD"}
|
package/utils/searchers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchers.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string |
|
|
1
|
+
{"version":3,"file":"searchers.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | undefined): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":";;;;AAKO,MAAMA,IAAiB;AAAA,EAC7B,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACN,GAMaC,IAAmB,CAACC,MAAqD;AACrF,MAAIC,IAAO;AAIX,UAFI,OAAOD,KAAgB,aAAUA,IAAc,OAAOA,CAAW,IAE7DA,GAAa;AAAA,IACpB,KAAK;AACG,MAAAC,IAAA;AAEP;AAAA,IACD,KAAK;AAAA,IACL,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAA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A;AACR,GAKaE,IAAoB,CAACT,GAAqBQ,MAA+B;AAIrF,UAFIA,MAAe,SAAmBA,IAAA,IAE9BR,GAAa;AAAA,IACpB,KAAK;AACS,MAAAQ,IAAA;AAEb;AAAA,IACD,KAAK;AACS,MAAAA,IAAA;AAEb;AAAA,IACD,KAAK;AACA,MAAAA,IAAa,MAAgBA,IAAA;AAEjC;AAAA,IACD;AACK,MAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,EAAE,SAASA,CAAU,MAAgBA,IAAA;AAAA,EAAA;AAGnD,SAAAA;AACR;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
define(["require","exports","vue","./page.vue_vue_type_script_setup_true_lang-BI9HWAyQ.amd","./utils-CTjq0RlC.amd","../utils/string.amd","../utils/searchers.amd","../require/css.amd!../assets/dialog_selectorRegions.css"],function(w,p,e,v,f,k,r){"use strict";if(typeof e>"u")var e=window.Vue;const h={class:"dialog_selectorRegions_header"},y=["data-top-icon"],C=["src","alt"],V={class:"dialog_selectorRegions_regionAreaName top-ellipsis"},x={key:1},B=["data-top-icon"],N=e.defineComponent({id:"selectorRegions",__name:"dialog_selectorRegions",props:{regions:{},regionsIndexes:{},"@update:regionsIndexes":{type:Function}},setup(R){const c=R,g=f.useTopDialogSelf(),i=e.ref(!1),l=e.ref([]),d=e.reactive({searcher_key:-1,key:-1,name:-1}),u=n=>{d[n]=-d[n],l.value.sort((t,a)=>!t[n]||!a[n]?-1:t[n]>=a[n]?d[n]:-d[n])},I=()=>{var t;if(!l.value.some(a=>a.selected))return;const n=l.value.filter(a=>a.selected).map(a=>a.index);(t=c["@update:regionsIndexes"])==null||t.call(c,n),g.close()};return e.watch(i,()=>{l.value=l.value.map(n=>({...n,selected:i.value}))}),e.watch([()=>c.regions,()=>c.regionsIndexes],()=>{l.value=[];let n=!0;c.regions.forEach(t=>{let a=t.name;t.areaName&&(a+=` (${t.areaName})`);const s=c.regionsIndexes.indexOf(+t.index)!==-1,o=r.getSearcherGIcon(t.searcher_key),m=t.lang!==void 0?r.getLangLabel(t.searcher_key,t.lang):void 0,S=t.device!==void 0?r.getDeviceGIcon(t.device):void 0,b=t.countryCode!==void 0?k.genFlagLinkByCountryCode(t.countryCode):void 0,_={...t,selected:s,title:a,searcherIcon:o,langLabel:m,deviceIcon:S,flagLink:b};l.value.push(_),_.selected||(n=!1)}),i.value=n}),(n,t)=>{const a=e.resolveComponent("TopCheckbox"),s=e.resolveComponent("TopButton");return e.openBlock(),e.createBlock(e.unref(v._sfc_main),{id:e.unref(g).id,pageActive:"selectorRegions",class:"dialog_selectorRegions",height:"600px",width:"600px"},{default:e.withCtx(()=>[e.createVNode(e.unref(v._sfc_main$1),{name:"selectorRegions",order:0},{header:e.withCtx(()=>[e.createElementVNode("div",h,[e.createVNode(a,{modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=o=>i.value=o)},null,8,["modelValue"]),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[1]||(t[1]=o=>u("searcher_key"))}),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[2]||(t[2]=o=>u("key"))}),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[3]||(t[3]=o=>u("name"))})])]),body:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,o=>(e.openBlock(),e.createBlock(a,{key:o.index,modelValue:o.selected,"onUpdate:modelValue":m=>o.selected=m,class:"dialog_selectorRegions_region"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"dialog_selectorRegions_regionSearcherIcon","data-top-icon":o.searcherIcon},null,8,y),o.flagLink?(e.openBlock(),e.createElementBlock("img",{key:0,class:"top-flag",src:"//topvisor.dev"+o.flagLink,alt:o.countryCode},null,8,C)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.name)+" ",1),e.createElementVNode("div",V,e.toDisplayString(o.areaName),1),o.langLabel?(e.openBlock(),e.createElementBlock("div",x," ["+e.toDisplayString(o.langLabel)+"] ",1)):e.createCommentVNode("",!0),o.deviceIcon?(e.openBlock(),e.createElementBlock("div",{key:2,"data-top-icon":o.deviceIcon},null,8,B)):e.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))]),footer:e.withCtx(()=>[e.createVNode(s,{onClick:I},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.$i18n.Common.Apply),1)]),_:1})]),_:1})]),_:1},8,["id"])}}});p.default=N,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
-
//# sourceMappingURL=dialog_selectorRegions-BOPta9cH.amd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog_selectorRegions-BOPta9cH.amd.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value.filter((region) => region.selected).map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tlet isAllSelectedLocal = true;\n\n\tprops.regions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = (props.regionsIndexes.indexOf(+region.index) !== -1);\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<TopCheckbox\n\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<img\n\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t>\n\n\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t></div>\n\t\t\t\t</TopCheckbox>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["dialog","utils","isAllSelected","vue","regionsRich","sortedVectorByField","sort","sortedField","regionA","regionB","region","_a","props","regionsIndexes","title","selected","deviceIcon","utils_searchers","flagLink","utils_string","searcherIcon","langLabel","regionRich","isAllSelectedLocal"],"mappings":"+nBAWAA,EAAAC,EAAA,iBAAA,EAKAC,EAAAC,EAAA,IAAA,EAAA,EAKAC,EAAAD,EAAA,IAAA,CAAA,CAAA,EAKAE,EAAAF,EAAA,SAAA,wBAEM,KAAA,EACC,CAAA,EAOPG,EAAAC,GAAA,gCAIE,CAAAC,EAAAD,CAAA,GAAA,CAAAE,EAAAF,CAAA,EAAA,wBAEyH,gBAU1H,GAAA,CAAAH,EAAA,MAAA,KAAAM,GAAAA,EAAA,QAAA,EAAA,8DAIAC,EAAAC,EAAA,4BAAA,MAAAD,EAAA,KAAAC,EAAAC,cAMD,OAAAV,EAAA,MAAAD,EAAA,IAAA,kDACqG,CAAA,EAIrGC,EAAA,MAAA,mCAEa,EAAA,IAAA,CAEZC,EAAA,MAAA,CAAA,iCAKC,IAAAU,EAAAJ,EAAA,KACAA,EAAA,WAAAI,GAAA,KAAAJ,EAAA,QAAA,KAEA,MAAAK,EAAAH,EAAA,eAAA,QAAA,CAAAF,EAAA,KAAA,IAAA,uGAGAM,EAAAN,EAAA,SAAA,OAAAO,EAAA,eAAAP,EAAA,MAAA,EAAA,OACAQ,EAAAR,EAAA,cAAA,OAAAS,EAAA,yBAAAT,EAAA,WAAA,EAAA,UAEmB,GAAAA,EACf,SAAAK,EACH,MAAAD,EACA,aAAAM,EACA,UAAAC,EACA,WAAAL,cAKDZ,EAAA,MAAA,KAAAkB,CAAA,EAEAA,EAAA,gBAEA,CAAA,EAGDpB,EAAA,MAAAqB,CAAsB,CAAA"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Core as N } from "../core/app.js";
|
|
2
|
-
import { defineComponent as $, ref as x, reactive as A, watch as R, resolveComponent as I, createBlock as L, openBlock as c, unref as f, withCtx as i, createVNode as r, createTextVNode as V, toDisplayString as m, createElementBlock as p, Fragment as w, renderList as D, createElementVNode as k, createCommentVNode as h } from "vue";
|
|
3
|
-
import { _ as E, a as U } from "./page.vue_vue_type_script_setup_true_lang-CCE8pKg7.es.js";
|
|
4
|
-
import { b as G } from "./utils-DIly8mml.es.js";
|
|
5
|
-
import { genFlagLinkByCountryCode as O } from "../utils/string.js";
|
|
6
|
-
import { getSearcherGIcon as P, getLangLabel as j, getDeviceGIcon as q } from "../utils/searchers.js";
|
|
7
|
-
const T = ["../assets/dialog_selectorRegions.css"].map((_) => import.meta.resolve(_));
|
|
8
|
-
N.insertCSSLinkToPage(T, !0);
|
|
9
|
-
const z = { class: "dialog_selectorRegions_header" }, H = ["data-top-icon"], J = ["src", "alt"], K = { class: "dialog_selectorRegions_regionAreaName top-ellipsis" }, M = { key: 1 }, Q = ["data-top-icon"], oe = /* @__PURE__ */ $({
|
|
10
|
-
id: "selectorRegions",
|
|
11
|
-
__name: "dialog_selectorRegions",
|
|
12
|
-
props: {
|
|
13
|
-
regions: {},
|
|
14
|
-
regionsIndexes: {},
|
|
15
|
-
"@update:regionsIndexes": { type: Function }
|
|
16
|
-
},
|
|
17
|
-
setup(_) {
|
|
18
|
-
const l = _, y = G(), d = x(!1), a = x([]), u = A({
|
|
19
|
-
searcher_key: -1,
|
|
20
|
-
key: -1,
|
|
21
|
-
name: -1
|
|
22
|
-
}), v = (t) => {
|
|
23
|
-
u[t] = -u[t], a.value.sort((e, s) => !e[t] || !s[t] ? -1 : e[t] >= s[t] ? u[t] : -u[t]);
|
|
24
|
-
}, S = () => {
|
|
25
|
-
var e;
|
|
26
|
-
if (!a.value.some((s) => s.selected)) return;
|
|
27
|
-
const t = a.value.filter((s) => s.selected).map((s) => s.index);
|
|
28
|
-
(e = l["@update:regionsIndexes"]) == null || e.call(l, t), y.close();
|
|
29
|
-
};
|
|
30
|
-
return R(d, () => {
|
|
31
|
-
a.value = a.value.map((t) => ({ ...t, selected: d.value }));
|
|
32
|
-
}), R([
|
|
33
|
-
() => l.regions,
|
|
34
|
-
() => l.regionsIndexes
|
|
35
|
-
], () => {
|
|
36
|
-
a.value = [];
|
|
37
|
-
let t = !0;
|
|
38
|
-
l.regions.forEach((e) => {
|
|
39
|
-
let s = e.name;
|
|
40
|
-
e.areaName && (s += ` (${e.areaName})`);
|
|
41
|
-
const n = l.regionsIndexes.indexOf(+e.index) !== -1, o = P(e.searcher_key), g = e.lang !== void 0 ? j(e.searcher_key, e.lang) : void 0, b = e.device !== void 0 ? q(e.device) : void 0, B = e.countryCode !== void 0 ? O(e.countryCode) : void 0, C = {
|
|
42
|
-
...e,
|
|
43
|
-
selected: n,
|
|
44
|
-
title: s,
|
|
45
|
-
searcherIcon: o,
|
|
46
|
-
langLabel: g,
|
|
47
|
-
deviceIcon: b,
|
|
48
|
-
flagLink: B
|
|
49
|
-
};
|
|
50
|
-
a.value.push(C), C.selected || (t = !1);
|
|
51
|
-
}), d.value = t;
|
|
52
|
-
}), (t, e) => {
|
|
53
|
-
const s = I("TopCheckbox"), n = I("TopButton");
|
|
54
|
-
return c(), L(f(E), {
|
|
55
|
-
id: f(y).id,
|
|
56
|
-
pageActive: "selectorRegions",
|
|
57
|
-
class: "dialog_selectorRegions",
|
|
58
|
-
height: "600px",
|
|
59
|
-
width: "600px"
|
|
60
|
-
}, {
|
|
61
|
-
default: i(() => [
|
|
62
|
-
r(f(U), {
|
|
63
|
-
name: "selectorRegions",
|
|
64
|
-
order: 0
|
|
65
|
-
}, {
|
|
66
|
-
header: i(() => [
|
|
67
|
-
k("div", z, [
|
|
68
|
-
r(s, {
|
|
69
|
-
modelValue: d.value,
|
|
70
|
-
"onUpdate:modelValue": e[0] || (e[0] = (o) => d.value = o)
|
|
71
|
-
}, null, 8, ["modelValue"]),
|
|
72
|
-
r(n, {
|
|
73
|
-
class: "dialog_selectorRegions_sortButton",
|
|
74
|
-
color: "theme",
|
|
75
|
-
"data-top-icon": "",
|
|
76
|
-
onClick: e[1] || (e[1] = (o) => v("searcher_key"))
|
|
77
|
-
}),
|
|
78
|
-
r(n, {
|
|
79
|
-
class: "dialog_selectorRegions_sortButton",
|
|
80
|
-
color: "theme",
|
|
81
|
-
"data-top-icon": "",
|
|
82
|
-
onClick: e[2] || (e[2] = (o) => v("key"))
|
|
83
|
-
}),
|
|
84
|
-
r(n, {
|
|
85
|
-
class: "dialog_selectorRegions_sortButton",
|
|
86
|
-
color: "theme",
|
|
87
|
-
"data-top-icon": "",
|
|
88
|
-
onClick: e[3] || (e[3] = (o) => v("name"))
|
|
89
|
-
})
|
|
90
|
-
])
|
|
91
|
-
]),
|
|
92
|
-
body: i(() => [
|
|
93
|
-
(c(!0), p(w, null, D(a.value, (o) => (c(), L(s, {
|
|
94
|
-
key: o.index,
|
|
95
|
-
modelValue: o.selected,
|
|
96
|
-
"onUpdate:modelValue": (g) => o.selected = g,
|
|
97
|
-
class: "dialog_selectorRegions_region"
|
|
98
|
-
}, {
|
|
99
|
-
default: i(() => [
|
|
100
|
-
k("div", {
|
|
101
|
-
class: "dialog_selectorRegions_regionSearcherIcon",
|
|
102
|
-
"data-top-icon": o.searcherIcon
|
|
103
|
-
}, null, 8, H),
|
|
104
|
-
o.flagLink ? (c(), p("img", {
|
|
105
|
-
key: 0,
|
|
106
|
-
class: "top-flag",
|
|
107
|
-
src: "//topvisor.dev" + o.flagLink,
|
|
108
|
-
alt: o.countryCode
|
|
109
|
-
}, null, 8, J)) : h("", !0),
|
|
110
|
-
V(" " + m(o.name) + " ", 1),
|
|
111
|
-
k("div", K, m(o.areaName), 1),
|
|
112
|
-
o.langLabel ? (c(), p("div", M, " [" + m(o.langLabel) + "] ", 1)) : h("", !0),
|
|
113
|
-
o.deviceIcon ? (c(), p("div", {
|
|
114
|
-
key: 2,
|
|
115
|
-
"data-top-icon": o.deviceIcon
|
|
116
|
-
}, null, 8, Q)) : h("", !0)
|
|
117
|
-
]),
|
|
118
|
-
_: 2
|
|
119
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
120
|
-
]),
|
|
121
|
-
footer: i(() => [
|
|
122
|
-
r(n, { onClick: S }, {
|
|
123
|
-
default: i(() => [
|
|
124
|
-
V(m(t.$i18n.Common.Apply), 1)
|
|
125
|
-
]),
|
|
126
|
-
_: 1
|
|
127
|
-
})
|
|
128
|
-
]),
|
|
129
|
-
_: 1
|
|
130
|
-
})
|
|
131
|
-
]),
|
|
132
|
-
_: 1
|
|
133
|
-
}, 8, ["id"]);
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
export {
|
|
138
|
-
oe as default
|
|
139
|
-
};
|
|
140
|
-
//# sourceMappingURL=dialog_selectorRegions-Dy0AlECS.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog_selectorRegions-Dy0AlECS.es.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value.filter((region) => region.selected).map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tlet isAllSelectedLocal = true;\n\n\tprops.regions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = (props.regionsIndexes.indexOf(+region.index) !== -1);\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<TopCheckbox\n\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<img\n\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t>\n\n\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t></div>\n\t\t\t\t</TopCheckbox>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["props","__props","dialog","useTopDialogSelf","isAllSelected","ref","regionsRich","sortedVectorByField","reactive","sort","sortedField","regionA","regionB","onSubmit","region","regionsIndexes","_a","watch","isAllSelectedLocal","title","selected","searcherIcon","getSearcherGIcon","langLabel","getLangLabel","deviceIcon","getDeviceGIcon","flagLink","genFlagLinkByCountryCode","regionRich"],"mappings":";;;;;;;;;;;;;;;;;AASA,UAAAA,IAAAC,GAEAC,IAAAC,EAAA,GAKAC,IAAAC,EAAA,EAAA,GAKAC,IAAAD,EAAA,CAAA,CAAA,GAKAE,IAAAC,EAAA;AAAA,MAAqC,cAAA;AAAA,MACtB,KAAA;AAAA,MACT,MAAA;AAAA,IACC,CAAA,GAOPC,IAAA,CAAAC,MAAA;AACC,MAAAH,EAAAG,CAAA,IAAA,CAAAH,EAAAG,CAAA,GAEAJ,EAAA,MAAA,KAAA,CAAAK,GAAAC,MACC,CAAAD,EAAAD,CAAA,KAAA,CAAAE,EAAAF,CAAA,IAAA,KAEAC,EAAAD,CAAA,KAAAE,EAAAF,CAAA,IAAAH,EAAAG,CAAA,IAAA,CAAAH,EAAAG,CAAA,CAAyH;AAAA,IACzH,GAQFG,IAAA,MAAA;;AACC,UAAA,CAAAP,EAAA,MAAA,KAAA,CAAAQ,MAAAA,EAAA,QAAA,EAAA;AAEA,YAAAC,IAAAT,EAAA,MAAA,OAAA,CAAAQ,MAAAA,EAAA,QAAA,EAAA,IAAA,CAAAA,MAAAA,EAAA,KAAA;AAEA,OAAAE,IAAAhB,EAAA,8BAAA,QAAAgB,EAAA,KAAAhB,GAAAe,IAEAb,EAAA,MAAA;AAAA,IAAa;AAId,WAAAe,EAAAb,GAAA,MAAA;AACC,MAAAE,EAAA,QAAAA,EAAA,MAAA,IAAA,CAAAQ,OAAA,EAAA,GAAAA,GAAA,UAAAV,EAAA,MAAA,EAAA;AAAA,IAAoG,CAAA,GAIrGa,EAAA;AAAA,MAAM,MAAAjB,EAAA;AAAA,MACO,MAAAA,EAAA;AAAA,IACA,GAAA,MAAA;AAEZ,MAAAM,EAAA,QAAA,CAAA;AAEA,UAAAY,IAAA;AAEA,MAAAlB,EAAA,QAAA,QAAA,CAAAc,MAAA;AACC,YAAAK,IAAAL,EAAA;AACA,QAAAA,EAAA,aAAAK,KAAA,KAAAL,EAAA,QAAA;AAEA,cAAAM,IAAApB,EAAA,eAAA,QAAA,CAAAc,EAAA,KAAA,MAAA,IACAO,IAAAC,EAAAR,EAAA,YAAA,GACAS,IAAAT,EAAA,SAAA,SAAAU,EAAAV,EAAA,cAAAA,EAAA,IAAA,IAAA,QACAW,IAAAX,EAAA,WAAA,SAAAY,EAAAZ,EAAA,MAAA,IAAA,QACAa,IAAAb,EAAA,gBAAA,SAAAc,EAAAd,EAAA,WAAA,IAAA,QAEAe,IAAA;AAAA,UAAmB,GAAAf;AAAA,UACf,UAAAM;AAAA,UACH,OAAAD;AAAA,UACA,cAAAE;AAAA,UACA,WAAAE;AAAA,UACA,YAAAE;AAAA,UACA,UAAAE;AAAA,QACA;AAGD,QAAArB,EAAA,MAAA,KAAAuB,CAAA,GAEAA,EAAA,aACCX,IAAA;AAAA,MACD,CAAA,GAGDd,EAAA,QAAAc;AAAA,IAAsB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
2
|
-
import { Item } from '../../project/selectorCompetitors/selectorCompetitors';
|
|
3
|
-
import { Competitor } from '../../project/selectorCompetitors/types/competitor';
|
|
4
|
-
export declare const useItemsFromCompetitors: (competitors: MaybeRefOrGetter<Competitor[]>, projectId: MaybeRefOrGetter<number>) => ComputedRef<Item[]>;
|
|
File without changes
|