UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

1 lines 4.49 kB
{"version":3,"file":"index.vue2.mjs","sources":["../../../../packages/components/region-selector/index.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({ name: \"UiRegionSelector\" });\n</script>\n<template>\r\n <div class=\"ui-region-selector\" ref=\"container\" v-bind=\"binds.container\">\r\n <div class=\"ui-form-control\" @click=\"show()\">\r\n <!-- * 主体 -->\r\n <input type=\"text\" autocomplete=\"off\" :disabled=\"disabled\" readonly />\r\n\r\n <!-- * 内容 -->\r\n <div class=\"ui-region-selector-content\">\r\n <template v-for=\"(value, key) in regions\">\r\n <span class=\"ui-region-selector-context\" :class=\"{ 'ui-active': value.children }\" @click.stop=\"show(value.name)\">\r\n <template v-if=\"key != 0\"> -</template>\r\n {{ value.name }}\r\n </span>\r\n </template>\r\n </div>\r\n </div>\r\n\r\n <!-- * 箭头 -->\r\n <UiIcon name=\"arrow\" class=\"ui-region-selector-arrow\" @click=\"show()\" />\r\n\r\n <!-- * 候选项 -->\r\n <Transition v-on=\"ons.animation\">\r\n <div class=\"ui-form-candidates\" ref=\"body\" v-if=\"visible\" v-bind=\"binds.body\">\r\n <div class=\"ui-form-candidate-container\">\r\n <div class=\"ui-form-candidate-content\" v-bind=\"binds.candidates\">\r\n <template v-for=\"value in data\">\r\n <div class=\"ui-form-candidate\" :class=\"{ 'ui-active': modelValue.includes(value.name) }\" @click=\"methods.select(value)\">\r\n <slot name=\"candidate\" :data=\"value\">{{ value.name }}</slot>\r\n </div>\r\n </template>\r\n </div>\r\n </div>\r\n </div>\r\n </Transition>\r\n\r\n <!-- * 遮罩层 -->\r\n <Transition>\r\n <div class=\"ui-mask ui-loading\" v-if=\"loading\">\r\n <UiIcon class=\"ui-mask-icon\" name=\"loading\" />\r\n </div>\r\n </Transition>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\n//* 按需移入的插件\r\nimport { onBeforeUnmount } from \"vue\";\r\n//* 组件引入\r\nimport UiIcon from \"@various/components/icon\";\r\n//* 组件属性\r\nimport { UiRegionSelectorPropsOption, UiRegionSelectorEmits } from \"./src\";\r\nimport { useComposable } from \"./src/composable\";\r\n//* 公共函数\r\nimport { node } from \"@various/utils\";\r\n\r\n//* 组件属性注册\r\nconst emits = defineEmits(UiRegionSelectorEmits);\r\nconst define = defineProps(UiRegionSelectorPropsOption);\r\n\r\n//* 组合函数\r\nconst { ons, vars, refs, nodes, binds, methods, computeds } = useComposable(define, emits);\r\nconst { regions, disabled } = computeds;\r\nconst { show, hidden } = methods;\r\nconst { container, body } = nodes;\r\nconst { visible, data } = refs;\r\n\r\n//* 销毁事件\r\nonBeforeUnmount(() => {\r\n //* 将内容从视图容器中移除\r\n body.value && node.remove(document.body, body.value);\r\n //* 注销观察者\r\n vars.observer?.disconnect();\r\n});\r\n\r\n//* 注册组件配置\r\n;\r\ndefineExpose({ show, hidden });\r\n</script>\r\n"],"names":["__MACROS_defineComponent","node.remove"],"mappings":";;;;;;;;;;;;;;;;AAEA,MAA6B,WAAA,GAAAA,eAAA,CAAyB,EAAE,IAAA,EAAM,oBAAoB,CAAA,CAAA;;;;;;AA0DlF,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAA,MAAM,MAAS,GAAA,OAAA,CAAA;AAGf,IAAM,MAAA,EAAE,GAAK,EAAA,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,KAAO,EAAA,OAAA,EAAS,SAAU,EAAA,GAAI,aAAc,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AACzF,IAAM,MAAA,EAAE,OAAS,EAAA,QAAA,EAAa,GAAA,SAAA,CAAA;AAC9B,IAAM,MAAA,EAAE,IAAM,EAAA,MAAA,EAAW,GAAA,OAAA,CAAA;AACzB,IAAM,MAAA,EAAE,SAAW,EAAA,IAAA,EAAS,GAAA,KAAA,CAAA;AAC5B,IAAM,MAA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