@vipl520/dk-ui 1.0.48 → 1.0.50
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +193 -92
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +4 -4
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +193 -92
- package/dist/web-types.json +1 -1
- package/es/style-box-input/index.d.ts +5 -5
- package/es/style-box-input/src/props.d.ts +2 -2
- package/es/style-box-input/src/props.mjs +2 -2
- package/es/style-box-input/src/props.mjs.map +1 -1
- package/es/style-box-input/src/style-box-input.vue.d.ts +5 -5
- package/es/style-box-input/src/style-box-input.vue2.mjs +85 -71
- package/es/style-box-input/src/style-box-input.vue2.mjs.map +1 -1
- package/es/style-input/index.d.ts +35 -0
- package/es/style-input/src/props.d.ts +16 -0
- package/es/style-input/src/props.mjs +18 -0
- package/es/style-input/src/props.mjs.map +1 -1
- package/es/style-input/src/style-input.vue.d.ts +35 -0
- package/es/style-input/src/style-input.vue2.mjs +73 -3
- package/es/style-input/src/style-input.vue2.mjs.map +1 -1
- package/lib/style-box-input/index.d.ts +5 -5
- package/lib/style-box-input/src/props.d.ts +2 -2
- package/lib/style-box-input/src/props.js +2 -2
- package/lib/style-box-input/src/props.js.map +1 -1
- package/lib/style-box-input/src/style-box-input.vue.d.ts +5 -5
- package/lib/style-box-input/src/style-box-input.vue2.js +84 -70
- package/lib/style-box-input/src/style-box-input.vue2.js.map +1 -1
- package/lib/style-input/index.d.ts +35 -0
- package/lib/style-input/src/props.d.ts +16 -0
- package/lib/style-input/src/props.js +18 -0
- package/lib/style-input/src/props.js.map +1 -1
- package/lib/style-input/src/style-input.vue.d.ts +35 -0
- package/lib/style-input/src/style-input.vue2.js +72 -2
- package/lib/style-input/src/style-input.vue2.js.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"style-box-input.vue2.js","sources":["../../../src/style-box-input/src/style-box-input.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkStyleBoxInput',\n});\n</script>\n<template>\n <div class=\"dk-style-box-input\">\n <div class=\"position-line\" :style=\"positionStyle\"></div>\n <div class=\"header\">\n <label class=\"items-center\">\n 内外边距 | 高宽\n <el-popover ref=\"popover\" placement=\"bottom\" title=\"说明\" :width=\"280\" trigger=\"hover\" :content=\"props.help\">\n <template #reference>\n <dk-icon icon=\"QuestionFilled\" class=\"m-l-5px vertical-text-top\"></dk-icon>\n </template>\n </el-popover>\n </label>\n <div class=\"float-right cursor-pointer\">\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置高宽\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-primary)\" @click=\"onRefresh('widthHeight')\"></dk-icon>\n </el-tooltip>\n </div>\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置内边距\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-success)\" @click=\"onRefresh('padding')\"></dk-icon>\n </el-tooltip>\n </div>\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置外边距\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-warning)\" @click=\"onRefresh('margin')\"></dk-icon>\n </el-tooltip>\n </div>\n </div>\n\n <div tabindex=\"0\" class=\"wrapper\" style=\"margin-top: 10px\" :style=\"{ height: props.height + 'px' }\">\n <div\n class=\"thumnail margin\"\n :class=\"moves.margin ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('margin', 'move', $event)\"\n @mouseleave=\"onMouseMove('margin', 'leave', $event)\"\n >\n <!--外边距 Margin-->\n <div>\n <div v-for=\"(item, key) in margins\" :key=\"key\">\n <span :title=\"item.title\" :class=\"`anchor-tip-${item.position} value-indicator`\">\n <span @mouseenter=\"onDblclick(item.value, key)\"> {{ getValue(styles[item.value]) }}</span>\n </span>\n <input\n ref=\"inputField\"\n v-model=\"styles[item.value]\"\n :class=\"'input-box anchor-tip-' + item.position + (showStyles[item.value] ? ' show' : '')\"\n @blur=\"onBlur(item.value)\"\n />\n <svg\n :width=\"item.svg.width\"\n :height=\"item.svg.height\"\n :viewBox=\"item.svg.viewBox\"\n preserveAspectRatio=\"none\"\n :data-link-anchor=\"item.value\"\n :style=\"item.svg.style\"\n class=\"esm-modal-svg\"\n v-html=\"item.svg.content\"\n ></svg>\n </div>\n </div>\n <div style=\"position: absolute; display: none; width: 100%; height: 100%\"></div>\n <div class=\"anchor-wrapper\">\n <div\n v-for=\"(item, key) in ['left', 'right', 'top', 'bottom']\"\n :key=\"key\"\n class=\"anchor\"\n :class=\"'anchor-' + item\"\n @mousemove=\"handleMouseMove\"\n @mousedown=\"handleMouseDown('margin', item, $event)\"\n @mouseup=\"handleMouseUp\"\n ></div>\n </div>\n <span class=\"title\"> 外边距 </span>\n <!--外边距 Margin END-->\n\n <!--内边距 Padding-->\n <div class=\"thumnail border\">\n <div\n class=\"thumnail padding\"\n :class=\"moves.padding ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('padding', 'move', $event)\"\n @mouseleave=\"onMouseMove('padding', 'leave', $event)\"\n >\n <div>\n <div v-for=\"(item, key) in paddings\" :key=\"key\">\n <span :title=\"item.title\" :class=\"`anchor-tip-${item.position} value-indicator`\">\n <span @mouseenter=\"onDblclick(item.value, key + 4)\"> {{ getValue(styles[item.value]) }}</span>\n </span>\n <input\n ref=\"inputField\"\n v-model=\"styles[item.value]\"\n :class=\"'input-box anchor-tip-' + item.position + (showStyles[item.value] ? ' show' : '')\"\n @blur=\"onBlur(item.value)\"\n />\n <svg\n :width=\"item.svg.width\"\n :height=\"item.svg.height\"\n :viewBox=\"item.svg.viewBox\"\n preserveAspectRatio=\"none\"\n :data-link-anchor=\"item.value\"\n :style=\"item.svg.style\"\n class=\"esm-modal-svg\"\n v-html=\"item.svg.content\"\n ></svg>\n </div>\n </div>\n <div class=\"anchor-wrapper\">\n <div\n v-for=\"(item, key) in ['left', 'right', 'top', 'bottom']\"\n :key=\"key\"\n class=\"anchor\"\n :class=\"'anchor-' + item\"\n @mousemove=\"handleMouseMove\"\n @mousedown=\"handleMouseDown('padding', item, $event)\"\n @mouseup=\"handleMouseUp\"\n ></div>\n </div>\n <span class=\"title\"> 内边距 </span>\n <!--内边距 END-->\n <div\n class=\"thumnail width-height\"\n :class=\"moves.widthHeight ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('widthHeight', 'move', $event)\"\n @mouseleave=\"onMouseMove('widthHeight', 'leave', $event)\"\n >\n <span class=\"title\">\n <span class=\"content-unit left-0\">\n <em @mouseenter=\"onDblclick('width', 9)\">{{ getValue(styles['width']) }}</em>\n </span>\n <input\n ref=\"inputWidth\"\n v-model=\"styles.width\"\n class=\"input-box absolute left-5% top-10px\"\n :class=\"showStyles['width'] ? ' show' : ''\"\n @blur=\"onBlur('width')\"\n />\n <span> x </span>\n <span class=\"content-unit right-0\">\n <em @mouseenter=\"onDblclick('height', 9)\">{{ getValue(styles['height']) }}</em>\n </span>\n <input\n ref=\"inputHeight\"\n v-model=\"styles.height\"\n class=\"input-box absolute right-5% top-10px\"\n :class=\"showStyles['height'] ? ' show' : ''\"\n @blur=\"onBlur('height')\"\n />\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { styleBoxInputProps } from './props'\nimport { nextTick, reactive, ref, watch } from 'vue'\nimport { margins, paddings } from './html'\nimport { upper } from '@vipl520/utils'\n\n\n\nconst props = defineProps(styleBoxInputProps)\n\nconst moves: any = reactive({\n margin: false,\n padding: false,\n widthHeight: false,\n})\n\nconst inputField = ref()\nconst inputWidth = ref()\nconst inputHeight = ref()\n\nconst styles: any = reactive({\n marginLeft: props.modelValue.marginLeft || '',\n marginRight: props.modelValue.marginRight || '',\n marginTop: props.modelValue.marginTop || '',\n marginBottom: props.modelValue.marginBottom || '',\n paddingLeft: props.modelValue.paddingLeft || '',\n paddingRight: props.modelValue.paddingRight || '',\n paddingTop: props.modelValue.paddingTop || '',\n paddingBottom: props.modelValue.paddingBottom || '',\n width: props.modelValue.width || '',\n height: props.modelValue.height || '',\n})\nconst emit = defineEmits(['update:modelValue', 'change'])\n\nconst height = ref(props.height)\n\nwatch(\n () => props.height,\n () => {\n console.log('height', props.height)\n }\n)\n\nwatch(\n () => props.modelValue,\n (newVal, oldVal) => {\n const propertiesToWatch = [\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'marginBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'paddingBottom',\n 'width',\n 'height',\n ]\n propertiesToWatch.forEach((property) => {\n if (newVal[property] !== oldVal[property]) {\n styles[property] = newVal[property] || ''\n }\n })\n },\n { deep: true }\n)\n\nwatch(styles, () => {\n // 过滤 styles 中值为''\n const _styles = Object.keys(styles).reduce((acc: any, key) => {\n if (styles[key] !== '') {\n acc[key] = styles[key]\n }\n return acc\n }, {})\n emit('update:modelValue', _styles)\n emit('change', _styles)\n})\n\nconst showStyles: any = reactive({\n marginLeft: false,\n marginRight: false,\n marginTop: false,\n marginBottom: false,\n paddingLeft: false,\n paddingRight: false,\n paddingTop: false,\n paddingBottom: false,\n width: false,\n height: false,\n})\n\nconst dragging = ref(false)\nconst startPosition: any = reactive({\n x: 0,\n y: 0,\n})\n\nconst trackMouseBound: any = ref(null)\nconst stopChangeBound: any = ref(null)\nconst dragPosition = reactive({\n type: '',\n position: '',\n})\nconst positionStyle: any = reactive({\n display: 'none',\n width: '0px',\n height: '0px',\n left: '0px',\n top: '0px',\n})\n// const handleMouseMove = (event: any) => {\n// // 处理鼠标移动事件\n// if (dragging.value) {\n// const p = dragPosition.position\n// const type = dragPosition.type\n// const value = type + upper(p)\n// if (p === 'left' || p === 'right') {\n// // 说明是左右移动\n// positionStyle.left = event.clientX + 'px'\n// // 根据移动的距离,增加或者减少margin/padding-left/right 的大小\n// let difference = event.clientX - startPosition.x\n// if (p === 'left') {\n// difference = -difference\n// }\n// styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n// startPosition.x = event.clientX\n// } else if (p === 'top' || p === 'bottom') {\n// positionStyle.top = event.clientY + 'px'\n// let difference = event.clientY - startPosition.y\n// if (p === 'top') {\n// difference = -difference\n// }\n// styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n// startPosition.y = event.clientY\n// }\n// }\n// }\n\nconst handleMouseMove = (event: any) => {\n // 处理鼠标移动事件\n if (!dragging.value) return\n\n const p = dragPosition.position\n const type = dragPosition.type\n const value = type + upper(p)\n\n const updateStyle = (axis: 'x' | 'y', position: 'top' | 'bottom' | 'left' | 'right') => {\n const clientAxis = axis === 'x' ? 'clientX' : 'clientY'\n positionStyle[position] = event[clientAxis] + 'px'\n\n let difference = event[clientAxis] - startPosition[axis]\n if (p === 'top' || p === 'left') {\n difference = -difference\n }\n styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n startPosition[axis] = event[clientAxis]\n }\n\n if (p === 'left' || p === 'right') {\n // 说明是左右移动\n updateStyle('x', 'left')\n } else if (p === 'top' || p === 'bottom') {\n updateStyle('y', 'top')\n }\n}\n\n// const handleMouseDown = (type: string, position: string, event: any) => {\n// // 处理鼠标按下事件\n// console.log('handleMouseDown', event)\n// dragPosition.position = position\n// dragPosition.type = type\n// trackMouseBound.value = handleMouseMove.bind(this)\n// document.addEventListener('mousemove', trackMouseBound.value)\n// stopChangeBound.value = handleMouseUp.bind(this)\n// document.addEventListener('mouseup', stopChangeBound.value)\n// dragging.value = true\n// const height = props.height\n// // 宽度 为.wrapper的宽度\n// const wrapperElement: any = document.querySelector('.wrapper')\n// const width = wrapperElement ? wrapperElement.offsetWidth : 0\n// const multiples: any = {\n// margin: 0.9,\n// padding: 0.9 * 0.7,\n// }\n// positionStyle.display = 'block'\n// startPosition.x = event.clientX\n// startPosition.y = event.clientY\n// if (position === 'left' || position === 'right') {\n// document.body.style.cursor = 'ew-resize'\n// positionStyle.left = event.clientX + 'px'\n// positionStyle.top = event.clientY - height * 0.5 * multiples[type] + 'px'\n// positionStyle.width = '0.1px'\n// positionStyle.height = height * multiples[type] + 'px'\n// } else {\n// document.body.style.cursor = 'ns-resize'\n// positionStyle.left = event.clientX - width * 0.5 * multiples[type] + 'px'\n// positionStyle.top = event.clientY + 'px'\n// positionStyle.width = width * multiples[type] + 'px'\n// positionStyle.height = '0.1px'\n// }\n// }\n\nconst handleMouseDown = (type: string, position: string, event: any) => {\n // 处理鼠标按下事件\n Object.assign(dragPosition, { position, type })\n trackMouseBound.value = handleMouseMove.bind(event)\n document.addEventListener('mousemove', trackMouseBound.value)\n stopChangeBound.value = handleMouseUp.bind(event)\n document.addEventListener('mouseup', stopChangeBound.value)\n dragging.value = true\n\n const height = props.height\n const wrapperElement: any = document.querySelector('.wrapper')\n const width = wrapperElement ? wrapperElement.offsetWidth : 0\n const multiples: any = {\n margin: 0.9,\n padding: 0.9 * 0.7,\n }\n\n const { clientX, clientY } = event\n\n const setCursorAndDimensions = (cursor: string, left: string, top: string, width: string, height: string) => {\n document.body.style.cursor = cursor\n Object.assign(positionStyle, { left, top, width, height, display: 'block' })\n }\n\n startPosition.x = clientX\n startPosition.y = clientY\n\n if (position === 'left' || position === 'right') {\n setCursorAndDimensions(\n 'ew-resize',\n clientX + 'px',\n clientY - height * 0.5 * multiples[type] + 'px',\n '0.1px',\n height * multiples[type] + 'px'\n )\n } else {\n setCursorAndDimensions(\n 'ns-resize',\n clientX - width * 0.5 * multiples[type] + 'px',\n clientY + 'px',\n width * multiples[type] + 'px',\n '0.1px'\n )\n }\n}\n\nconst handleMouseUp = () => {\n // 处理鼠标抬起事件\n document.removeEventListener('mousemove', trackMouseBound.value)\n document.removeEventListener('mouseup', stopChangeBound.value)\n dragging.value = false\n positionStyle.display = 'none'\n document.body.style.cursor = 'default'\n startPosition.x = null\n startPosition.y = null\n}\n\nconst onMouseMove = (value: string, type: string = 'move', event: any) => {\n if (!dragging.value) {\n event.stopPropagation()\n }\n if (type !== 'move') {\n moves[value] = false\n } else {\n // 其他的为false\n Object.keys(moves).forEach((key) => {\n if (key !== value) {\n moves[key] = false\n }\n })\n // 当前的为true\n moves[value] = true\n }\n}\n\nconst onDblclick = (value: any, key: number) => {\n showStyles[value] = true\n nextTick(() => {\n if (value === 'width') {\n inputWidth.value.focus()\n } else if (value === 'height') {\n inputHeight.value.focus()\n } else {\n inputField.value[key].focus()\n }\n })\n}\n\nconst getValue = (value: any) => {\n // 判断value结尾是否存在px、vh、%、rem等\n if (value === 'auto') {\n return value\n }\n if (value === '0' || value === 0) {\n return 0\n }\n if (value === '') {\n return '-'\n }\n return value\n}\n\nconst onBlur = (value: any) => {\n showStyles[value] = false\n // styles[value] 这是一个css的值,用户会自己填写,内容不确定,但是我希望是:数字+单位,单位为:px/rem/%/vh这些,如果不是的话,则默认为px\n if (styles[value] === '' || styles[value] === 'auto') {\n return\n }\n const validValueRegex = /^(\\d*\\.?\\d+)(px|rem|%|vh)$/\n // 检查value是否匹配有效单位,如果不匹配则默认为px\n if (!validValueRegex.test(styles[value])) {\n const number = parseInt(styles[value])\n if (isNaN(number)) {\n styles[value] = ''\n } else {\n styles[value] = number + 'px'\n }\n }\n}\n\nconst onRefresh = (type: string) => {\n if (type === 'widthHeight') {\n styles.width = ''\n styles.height = ''\n } else if (type === 'margin') {\n styles.marginLeft = ''\n styles.marginRight = ''\n styles.marginTop = ''\n styles.marginBottom = ''\n } else if (type === 'padding') {\n styles.paddingLeft = ''\n styles.paddingRight = ''\n styles.paddingTop = ''\n styles.paddingBottom = ''\n }\n}\n</script>\n"],"names":["__MACROS_defineComponent","reactive","ref","watch","upper","height","width","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,iBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"style-box-input.vue2.js","sources":["../../../src/style-box-input/src/style-box-input.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkStyleBoxInput',\n});\n</script>\n<template>\n <div class=\"dk-style-box-input\">\n <div class=\"position-line\" :style=\"positionStyle\"></div>\n <div class=\"header\">\n <label class=\"items-center\">\n 内外边距 | 高宽\n <el-popover ref=\"popover\" placement=\"bottom\" title=\"说明\" :width=\"280\" trigger=\"hover\" :content=\"props.help\">\n <template #reference>\n <dk-icon icon=\"QuestionFilled\" class=\"m-l-5px vertical-text-top\"></dk-icon>\n </template>\n </el-popover>\n </label>\n <div class=\"float-right cursor-pointer\">\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置高宽\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-primary)\" @click=\"onRefresh('widthHeight')\"></dk-icon>\n </el-tooltip>\n </div>\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置内边距\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-success)\" @click=\"onRefresh('padding')\"></dk-icon>\n </el-tooltip>\n </div>\n <div class=\"name-header-operations\">\n <el-tooltip class=\"box-item\" effect=\"dark\" content=\"重置外边距\" placement=\"top-start\">\n <dk-icon icon=\"Refresh\" color=\"var(--el-color-warning)\" @click=\"onRefresh('margin')\"></dk-icon>\n </el-tooltip>\n </div>\n </div>\n <div ref=\"box\" tabindex=\"0\" class=\"wrapper\" style=\"margin-top: 10px\" :style=\"{ height: height + 'px' }\">\n <div\n class=\"thumnail margin\"\n :class=\"moves.margin ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('margin', 'move', $event)\"\n @mouseleave=\"onMouseMove('margin', 'leave', $event)\"\n >\n <!--外边距 Margin-->\n <div>\n <div v-for=\"(item, key) in margins\" :key=\"key\">\n <span\n :title=\"item.title\"\n :class=\"`anchor-tip-${item.position} value-indicator`\"\n @click=\"onDblclick(item.value, key)\"\n >\n <span> {{ getValue(styles[item.value]) }}</span>\n </span>\n <input\n ref=\"inputField\"\n v-model=\"styles[item.value]\"\n :class=\"'input-box anchor-tip-' + item.position + (showStyles[item.value] ? ' show' : '')\"\n @blur=\"onBlur(item.value)\"\n />\n <svg\n :width=\"item.svg.width\"\n :height=\"item.svg.height\"\n :viewBox=\"item.svg.viewBox\"\n preserveAspectRatio=\"none\"\n :data-link-anchor=\"item.value\"\n :style=\"item.svg.style\"\n class=\"esm-modal-svg\"\n v-html=\"item.svg.content\"\n ></svg>\n </div>\n </div>\n <div style=\"position: absolute; display: none; width: 100%; height: 100%\"></div>\n <div class=\"anchor-wrapper\">\n <div\n v-for=\"(item, key) in ['left', 'right', 'top', 'bottom']\"\n :key=\"key\"\n class=\"anchor\"\n :class=\"'anchor-' + item\"\n @mousemove=\"handleMouseMove\"\n @mousedown=\"handleMouseDown('margin', item, $event)\"\n @mouseup=\"handleMouseUp\"\n ></div>\n </div>\n <span class=\"title\"> 外边距 </span>\n <!--外边距 Margin END-->\n\n <!--内边距 Padding-->\n <div class=\"thumnail border\">\n <div\n class=\"thumnail padding\"\n :class=\"moves.padding ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('padding', 'move', $event)\"\n @mouseleave=\"onMouseMove('padding', 'leave', $event)\"\n >\n <div>\n <div v-for=\"(item, key) in paddings\" :key=\"key\">\n <span\n :title=\"item.title\"\n :class=\"`anchor-tip-${item.position} value-indicator`\"\n @click=\"onDblclick(item.value, key + 4)\"\n >\n <span> {{ getValue(styles[item.value]) }}</span>\n </span>\n <input\n ref=\"inputField\"\n v-model=\"styles[item.value]\"\n :class=\"'input-box anchor-tip-' + item.position + (showStyles[item.value] ? ' show' : '')\"\n @blur=\"onBlur(item.value)\"\n />\n <svg\n :width=\"item.svg.width\"\n :height=\"item.svg.height\"\n :viewBox=\"item.svg.viewBox\"\n preserveAspectRatio=\"none\"\n :data-link-anchor=\"item.value\"\n :style=\"item.svg.style\"\n class=\"esm-modal-svg\"\n v-html=\"item.svg.content\"\n ></svg>\n </div>\n </div>\n <div class=\"anchor-wrapper\">\n <div\n v-for=\"(item, key) in ['left', 'right', 'top', 'bottom']\"\n :key=\"key\"\n class=\"anchor\"\n :class=\"'anchor-' + item\"\n @mousemove=\"handleMouseMove\"\n @mousedown=\"handleMouseDown('padding', item, $event)\"\n @mouseup=\"handleMouseUp\"\n ></div>\n </div>\n <span class=\"title\"> 内边距 </span>\n <!--内边距 END-->\n <div\n class=\"thumnail width-height\"\n :class=\"moves.widthHeight ? 'thumnail-heightlight' : ''\"\n @mousemove=\"onMouseMove('widthHeight', 'move', $event)\"\n @mouseleave=\"onMouseMove('widthHeight', 'leave', $event)\"\n >\n <span class=\"title\">\n <span class=\"content-unit left-0\" @click=\"onDblclick('width', 9)\">\n <em>{{ getValue(styles['width']) }}</em>\n </span>\n <input\n ref=\"inputWidth\"\n v-model=\"styles.width\"\n class=\"input-box absolute left-5% top-10px\"\n :class=\"showStyles['width'] ? ' show' : ''\"\n @blur=\"onBlur('width')\"\n />\n <span> x </span>\n <span class=\"content-unit right-0\" @click=\"onDblclick('height', 9)\">\n <em>{{ getValue(styles['height']) }}</em>\n </span>\n <input\n ref=\"inputHeight\"\n v-model=\"styles.height\"\n class=\"input-box absolute right-5% top-10px\"\n :class=\"showStyles['height'] ? ' show' : ''\"\n @blur=\"onBlur('height')\"\n />\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { styleBoxInputProps } from './props'\nimport { nextTick, reactive, ref, watch, computed } from 'vue'\nimport { margins, paddings } from './html'\nimport { upper } from '@vipl520/utils'\nimport { useElementSize } from '@vueuse/core'\n\n\n\nconst props = defineProps(styleBoxInputProps)\n\nconst moves: any = reactive({\n margin: false,\n padding: false,\n widthHeight: false,\n})\n\nconst inputField = ref()\nconst inputWidth = ref()\nconst inputHeight = ref()\n\nconst styles: any = reactive({\n marginLeft: props.modelValue.marginLeft || '',\n marginRight: props.modelValue.marginRight || '',\n marginTop: props.modelValue.marginTop || '',\n marginBottom: props.modelValue.marginBottom || '',\n paddingLeft: props.modelValue.paddingLeft || '',\n paddingRight: props.modelValue.paddingRight || '',\n paddingTop: props.modelValue.paddingTop || '',\n paddingBottom: props.modelValue.paddingBottom || '',\n width: props.modelValue.width || '',\n height: props.modelValue.height || '',\n})\nconst emit = defineEmits(['update:modelValue', 'change'])\n\nconst box: any = ref(null)\nconst { width } = useElementSize(box) // 当前组件宽度\n\nconst height: any = computed(() => {\n console.log('props.height', props.height)\n if (props.height === 'auto') {\n const h = width.value / 1.8\n return h > 300 ? 300 : h\n } else {\n return props.height\n }\n})\n\nwatch(\n () => props.modelValue,\n (newVal, oldVal) => {\n const propertiesToWatch = [\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'marginBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'paddingBottom',\n 'width',\n 'height',\n ]\n propertiesToWatch.forEach((property) => {\n if (newVal[property] !== oldVal[property]) {\n styles[property] = newVal[property] || ''\n }\n })\n },\n { deep: true }\n)\n\nwatch(styles, () => {\n // 过滤 styles 中值为''\n const _styles = Object.keys(styles).reduce((acc: any, key) => {\n if (styles[key] !== '') {\n acc[key] = styles[key]\n }\n return acc\n }, {})\n emit('update:modelValue', _styles)\n emit('change', _styles)\n})\n\nconst showStyles: any = reactive({\n marginLeft: false,\n marginRight: false,\n marginTop: false,\n marginBottom: false,\n paddingLeft: false,\n paddingRight: false,\n paddingTop: false,\n paddingBottom: false,\n width: false,\n height: false,\n})\n\nconst dragging = ref(false)\nconst startPosition: any = reactive({\n x: 0,\n y: 0,\n})\n\nconst trackMouseBound: any = ref(null)\nconst stopChangeBound: any = ref(null)\nconst dragPosition = reactive({\n type: '',\n position: '',\n})\nconst positionStyle: any = reactive({\n display: 'none',\n width: '0px',\n height: '0px',\n left: '0px',\n top: '0px',\n})\n// const handleMouseMove = (event: any) => {\n// // 处理鼠标移动事件\n// if (dragging.value) {\n// const p = dragPosition.position\n// const type = dragPosition.type\n// const value = type + upper(p)\n// if (p === 'left' || p === 'right') {\n// // 说明是左右移动\n// positionStyle.left = event.clientX + 'px'\n// // 根据移动的距离,增加或者减少margin/padding-left/right 的大小\n// let difference = event.clientX - startPosition.x\n// if (p === 'left') {\n// difference = -difference\n// }\n// styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n// startPosition.x = event.clientX\n// } else if (p === 'top' || p === 'bottom') {\n// positionStyle.top = event.clientY + 'px'\n// let difference = event.clientY - startPosition.y\n// if (p === 'top') {\n// difference = -difference\n// }\n// styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n// startPosition.y = event.clientY\n// }\n// }\n// }\n\nconst handleMouseMove = (event: any) => {\n // 处理鼠标移动事件\n if (!dragging.value) return\n\n const p = dragPosition.position\n const type = dragPosition.type\n const value = type + upper(p)\n\n const updateStyle = (axis: 'x' | 'y', position: 'top' | 'bottom' | 'left' | 'right') => {\n const clientAxis = axis === 'x' ? 'clientX' : 'clientY'\n positionStyle[position] = event[clientAxis] + 'px'\n\n let difference = event[clientAxis] - startPosition[axis]\n if (p === 'top' || p === 'left') {\n difference = -difference\n }\n styles[value] = (parseInt(styles[value]) || 0) + difference + 'px'\n startPosition[axis] = event[clientAxis]\n }\n\n if (p === 'left' || p === 'right') {\n // 说明是左右移动\n updateStyle('x', 'left')\n } else if (p === 'top' || p === 'bottom') {\n updateStyle('y', 'top')\n }\n}\n\n// const handleMouseDown = (type: string, position: string, event: any) => {\n// // 处理鼠标按下事件\n// console.log('handleMouseDown', event)\n// dragPosition.position = position\n// dragPosition.type = type\n// trackMouseBound.value = handleMouseMove.bind(this)\n// document.addEventListener('mousemove', trackMouseBound.value)\n// stopChangeBound.value = handleMouseUp.bind(this)\n// document.addEventListener('mouseup', stopChangeBound.value)\n// dragging.value = true\n// const height = props.height\n// // 宽度 为.wrapper的宽度\n// const wrapperElement: any = document.querySelector('.wrapper')\n// const width = wrapperElement ? wrapperElement.offsetWidth : 0\n// const multiples: any = {\n// margin: 0.9,\n// padding: 0.9 * 0.7,\n// }\n// positionStyle.display = 'block'\n// startPosition.x = event.clientX\n// startPosition.y = event.clientY\n// if (position === 'left' || position === 'right') {\n// document.body.style.cursor = 'ew-resize'\n// positionStyle.left = event.clientX + 'px'\n// positionStyle.top = event.clientY - height * 0.5 * multiples[type] + 'px'\n// positionStyle.width = '0.1px'\n// positionStyle.height = height * multiples[type] + 'px'\n// } else {\n// document.body.style.cursor = 'ns-resize'\n// positionStyle.left = event.clientX - width * 0.5 * multiples[type] + 'px'\n// positionStyle.top = event.clientY + 'px'\n// positionStyle.width = width * multiples[type] + 'px'\n// positionStyle.height = '0.1px'\n// }\n// }\n\nconst handleMouseDown = (type: string, position: string, event: any) => {\n // 处理鼠标按下事件\n Object.assign(dragPosition, { position, type })\n trackMouseBound.value = handleMouseMove.bind(event)\n document.addEventListener('mousemove', trackMouseBound.value)\n stopChangeBound.value = handleMouseUp.bind(event)\n document.addEventListener('mouseup', stopChangeBound.value)\n dragging.value = true\n\n // const height = props.height\n const wrapperElement: any = document.querySelector('.wrapper')\n const width = wrapperElement ? wrapperElement.offsetWidth : 0\n const multiples: any = {\n margin: 0.9,\n padding: 0.9 * 0.7,\n }\n\n const { clientX, clientY } = event\n\n const setCursorAndDimensions = (cursor: string, left: string, top: string, width: string, height: string) => {\n document.body.style.cursor = cursor\n Object.assign(positionStyle, { left, top, width, height, display: 'block' })\n }\n\n startPosition.x = clientX\n startPosition.y = clientY\n\n if (position === 'left' || position === 'right') {\n setCursorAndDimensions(\n 'ew-resize',\n clientX + 'px',\n clientY - height.value * 0.5 * multiples[type] + 'px',\n '0.1px',\n height.value * multiples[type] + 'px'\n )\n } else {\n setCursorAndDimensions(\n 'ns-resize',\n clientX - width * 0.5 * multiples[type] + 'px',\n clientY + 'px',\n width * multiples[type] + 'px',\n '0.1px'\n )\n }\n}\n\nconst handleMouseUp = () => {\n // 处理鼠标抬起事件\n document.removeEventListener('mousemove', trackMouseBound.value)\n document.removeEventListener('mouseup', stopChangeBound.value)\n dragging.value = false\n positionStyle.display = 'none'\n document.body.style.cursor = 'default'\n startPosition.x = null\n startPosition.y = null\n}\n\nconst onMouseMove = (value: string, type: string = 'move', event: any) => {\n if (!dragging.value) {\n event.stopPropagation()\n }\n if (type !== 'move') {\n moves[value] = false\n } else {\n // 其他的为false\n Object.keys(moves).forEach((key) => {\n if (key !== value) {\n moves[key] = false\n }\n })\n // 当前的为true\n moves[value] = true\n }\n}\n\nconst onDblclick = (value: any, key: number) => {\n showStyles[value] = true\n nextTick(() => {\n if (value === 'width') {\n inputWidth.value.focus()\n } else if (value === 'height') {\n inputHeight.value.focus()\n } else {\n inputField.value[key].focus()\n }\n })\n}\n\nconst getValue = (value: any) => {\n // 判断value结尾是否存在px、vh、%、rem等\n if (value === 'auto') {\n return value\n }\n if (value === '0' || value === 0) {\n return 0\n }\n if (value === '') {\n return '-'\n }\n return value\n}\n\nconst onBlur = (value: any) => {\n showStyles[value] = false\n // styles[value] 这是一个css的值,用户会自己填写,内容不确定,但是我希望是:数字+单位,单位为:px/rem/%/vh这些,如果不是的话,则默认为px\n if (styles[value] === '' || styles[value] === 'auto') {\n return\n }\n const validValueRegex = /^(\\d*\\.?\\d+)(px|rem|%|vh)$/\n // 检查value是否匹配有效单位,如果不匹配则默认为px\n if (!validValueRegex.test(styles[value])) {\n const number = parseInt(styles[value])\n if (isNaN(number)) {\n styles[value] = ''\n } else {\n styles[value] = number + 'px'\n }\n }\n}\n\nconst onRefresh = (type: string) => {\n if (type === 'widthHeight') {\n styles.width = ''\n styles.height = ''\n } else if (type === 'margin') {\n styles.marginLeft = ''\n styles.marginRight = ''\n styles.marginTop = ''\n styles.marginBottom = ''\n } else if (type === 'padding') {\n styles.paddingLeft = ''\n styles.paddingRight = ''\n styles.paddingTop = ''\n styles.paddingBottom = ''\n }\n}\n</script>\n"],"names":["__MACROS_defineComponent","reactive","ref","useElementSize","computed","watch","upper","width","height","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,iBAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAkLD,IAAA,MAAM,QAAaC,YAAS,CAAA;AAAA,MAC1B,MAAQ,EAAA,KAAA;AAAA,MACR,OAAS,EAAA,KAAA;AAAA,MACT,WAAa,EAAA,KAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAA,MAAM,aAAaC,OAAI,EAAA,CAAA;AACvB,IAAA,MAAM,aAAaA,OAAI,EAAA,CAAA;AACvB,IAAA,MAAM,cAAcA,OAAI,EAAA,CAAA;AAExB,IAAA,MAAM,SAAcD,YAAS,CAAA;AAAA,MAC3B,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,UAAc,IAAA,EAAA;AAAA,MAC3C,WAAA,EAAa,KAAM,CAAA,UAAA,CAAW,WAAe,IAAA,EAAA;AAAA,MAC7C,SAAA,EAAW,KAAM,CAAA,UAAA,CAAW,SAAa,IAAA,EAAA;AAAA,MACzC,YAAA,EAAc,KAAM,CAAA,UAAA,CAAW,YAAgB,IAAA,EAAA;AAAA,MAC/C,WAAA,EAAa,KAAM,CAAA,UAAA,CAAW,WAAe,IAAA,EAAA;AAAA,MAC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MAAA,SAAA,GAAY,CAAC,IAAiB,KAAA;AAClC,MAAA,IAAI,SAAS,aAAe,EAAA;AAC1B,QAAA,MAAA,CAAO,KAAQ,GAAA,EAAA,CAAA;AACf,QAAA,MAAA,CAAO,MAAS,GAAA,EAAA,CAAA;AAAA,OAClB,MAAA,IAAW,SAAS,QAAU,EAAA;AAC5B,QAAA,MAAA,CAAO,UAAa,GAAA,EAAA,CAAA;AACpB,QAAA,MAAA,CAAO,WAAc,GAAA,EAAA,CAAA;AACrB,QAAA,MAAA,CAAO,SAAY,GAAA,EAAA,CAAA;AACnB,QAAA,MAAA,CAAO,YAAe,GAAA,EAAA,CAAA;AAAA,OACxB,MAAA,IAAW,SAAS,SAAW,EAAA;AAC7B,QAAA,MAAA,CAAO,WAAc,GAAA,EAAA,CAAA;AACrB,QAAA,MAAA,CAAO,YAAe,GAAA,EAAA,CAAA;AACtB,QAAA,MAAA,CAAO,UAAa,GAAA,EAAA,CAAA;AACpB,QAAA,MAAA,CAAO,aAAgB,GAAA,EAAA,CAAA;AAAA,OACzB;AAAA,KACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -11,6 +11,22 @@ export declare const StyleInput: import("@vipl520/utils").WithInstall<import("vu
|
|
11
11
|
default: () => {};
|
12
12
|
type: ObjectConstructor;
|
13
13
|
};
|
14
|
+
isDrawer: {
|
15
|
+
default: boolean;
|
16
|
+
type: BooleanConstructor;
|
17
|
+
};
|
18
|
+
drawerProps: {
|
19
|
+
default: () => {
|
20
|
+
title: string;
|
21
|
+
direction: string;
|
22
|
+
size: string;
|
23
|
+
};
|
24
|
+
type: ObjectConstructor;
|
25
|
+
};
|
26
|
+
drawerText: {
|
27
|
+
default: string;
|
28
|
+
type: StringConstructor;
|
29
|
+
};
|
14
30
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
15
31
|
components: {
|
16
32
|
default: () => import("./src/default").StyleInputConfig;
|
@@ -24,12 +40,31 @@ export declare const StyleInput: import("@vipl520/utils").WithInstall<import("vu
|
|
24
40
|
default: () => {};
|
25
41
|
type: ObjectConstructor;
|
26
42
|
};
|
43
|
+
isDrawer: {
|
44
|
+
default: boolean;
|
45
|
+
type: BooleanConstructor;
|
46
|
+
};
|
47
|
+
drawerProps: {
|
48
|
+
default: () => {
|
49
|
+
title: string;
|
50
|
+
direction: string;
|
51
|
+
size: string;
|
52
|
+
};
|
53
|
+
type: ObjectConstructor;
|
54
|
+
};
|
55
|
+
drawerText: {
|
56
|
+
default: string;
|
57
|
+
type: StringConstructor;
|
58
|
+
};
|
27
59
|
}>> & {
|
28
60
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
29
61
|
}, {
|
30
62
|
modelValue: Record<string, any>;
|
31
63
|
components: import("./src/default").StyleInputConfig;
|
32
64
|
hideComponents: string[];
|
65
|
+
isDrawer: boolean;
|
66
|
+
drawerProps: Record<string, any>;
|
67
|
+
drawerText: string;
|
33
68
|
}, {}>>;
|
34
69
|
export default StyleInput;
|
35
70
|
export * from './src/props';
|
@@ -19,5 +19,21 @@ export declare const styleInputProps: {
|
|
19
19
|
default: () => {};
|
20
20
|
type: ObjectConstructor;
|
21
21
|
};
|
22
|
+
isDrawer: {
|
23
|
+
default: boolean;
|
24
|
+
type: BooleanConstructor;
|
25
|
+
};
|
26
|
+
drawerProps: {
|
27
|
+
default: () => {
|
28
|
+
title: string;
|
29
|
+
direction: string;
|
30
|
+
size: string;
|
31
|
+
};
|
32
|
+
type: ObjectConstructor;
|
33
|
+
};
|
34
|
+
drawerText: {
|
35
|
+
default: string;
|
36
|
+
type: StringConstructor;
|
37
|
+
};
|
22
38
|
};
|
23
39
|
export type StyleInputProps = ExtractPropTypes<typeof styleInputProps>;
|
@@ -26,6 +26,24 @@ const styleInputProps = {
|
|
26
26
|
return {};
|
27
27
|
},
|
28
28
|
type: Object
|
29
|
+
},
|
30
|
+
isDrawer: {
|
31
|
+
default: false,
|
32
|
+
type: Boolean
|
33
|
+
},
|
34
|
+
drawerProps: {
|
35
|
+
default: () => {
|
36
|
+
return {
|
37
|
+
title: "\u7F16\u8F91\u6837\u5F0F",
|
38
|
+
direction: "rtl",
|
39
|
+
size: "400px"
|
40
|
+
};
|
41
|
+
},
|
42
|
+
type: Object
|
43
|
+
},
|
44
|
+
drawerText: {
|
45
|
+
default: "\u7F16\u8F91\u6837\u5F0F",
|
46
|
+
type: String
|
29
47
|
}
|
30
48
|
};
|
31
49
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"props.js","sources":["../../../src/style-input/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport { defaultConfig, type StyleInputConfig } from './default'\n\nexport const styleInputProps = {\n /**\n * 引入组件\n */\n components: {\n default: () => {\n return defaultConfig\n },\n type: Array as () => StyleInputConfig,\n },\n /**\n * 需要隐藏组件\n */\n hideComponents: {\n default: () => {\n return []\n },\n type: Array as () => string[],\n },\n modelValue: {\n default: () => {\n return {}\n },\n type: Object,\n },\n}\n\nexport type StyleInputProps = ExtractPropTypes<typeof styleInputProps>\n"],"names":["defaultConfig"],"mappings":";;;;AAGO,MAAM,eAAkB,GAAA;AAAA;AAAA;AAAA;AAAA,EAI7B,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAO,OAAAA,sBAAA,CAAA;AAAA,KACT;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA;AAAA;AAAA;AAAA,EAIA,cAAgB,EAAA;AAAA,IACd,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AACF;;;;"}
|
1
|
+
{"version":3,"file":"props.js","sources":["../../../src/style-input/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport { defaultConfig, type StyleInputConfig } from './default'\n\nexport const styleInputProps = {\n /**\n * 引入组件\n */\n components: {\n default: () => {\n return defaultConfig\n },\n type: Array as () => StyleInputConfig,\n },\n /**\n * 需要隐藏组件\n */\n hideComponents: {\n default: () => {\n return []\n },\n type: Array as () => string[],\n },\n modelValue: {\n default: () => {\n return {}\n },\n type: Object,\n },\n isDrawer: {\n default: false,\n type: Boolean,\n },\n drawerProps: {\n default: () => {\n return {\n title: '编辑样式',\n direction: 'rtl',\n size: '400px',\n }\n },\n type: Object,\n },\n drawerText: {\n default: '编辑样式',\n type: String,\n },\n}\n\nexport type StyleInputProps = ExtractPropTypes<typeof styleInputProps>\n"],"names":["defaultConfig"],"mappings":";;;;AAGO,MAAM,eAAkB,GAAA;AAAA;AAAA;AAAA;AAAA,EAI7B,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAO,OAAAA,sBAAA,CAAA;AAAA,KACT;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA;AAAA;AAAA;AAAA,EAIA,cAAgB,EAAA;AAAA,IACd,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,KAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACR;AAAA,EACA,WAAa,EAAA;AAAA,IACX,SAAS,MAAM;AACb,MAAO,OAAA;AAAA,QACL,KAAO,EAAA,0BAAA;AAAA,QACP,SAAW,EAAA,KAAA;AAAA,QACX,IAAM,EAAA,OAAA;AAAA,OACR,CAAA;AAAA,KACF;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA,0BAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,GACR;AACF;;;;"}
|
@@ -11,6 +11,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
11
11
|
default: () => {};
|
12
12
|
type: ObjectConstructor;
|
13
13
|
};
|
14
|
+
isDrawer: {
|
15
|
+
default: boolean;
|
16
|
+
type: BooleanConstructor;
|
17
|
+
};
|
18
|
+
drawerProps: {
|
19
|
+
default: () => {
|
20
|
+
title: string;
|
21
|
+
direction: string;
|
22
|
+
size: string;
|
23
|
+
};
|
24
|
+
type: ObjectConstructor;
|
25
|
+
};
|
26
|
+
drawerText: {
|
27
|
+
default: string;
|
28
|
+
type: StringConstructor;
|
29
|
+
};
|
14
30
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
15
31
|
components: {
|
16
32
|
default: () => import("./default").StyleInputConfig;
|
@@ -24,11 +40,30 @@ declare const _default: import("vue").DefineComponent<{
|
|
24
40
|
default: () => {};
|
25
41
|
type: ObjectConstructor;
|
26
42
|
};
|
43
|
+
isDrawer: {
|
44
|
+
default: boolean;
|
45
|
+
type: BooleanConstructor;
|
46
|
+
};
|
47
|
+
drawerProps: {
|
48
|
+
default: () => {
|
49
|
+
title: string;
|
50
|
+
direction: string;
|
51
|
+
size: string;
|
52
|
+
};
|
53
|
+
type: ObjectConstructor;
|
54
|
+
};
|
55
|
+
drawerText: {
|
56
|
+
default: string;
|
57
|
+
type: StringConstructor;
|
58
|
+
};
|
27
59
|
}>> & {
|
28
60
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
29
61
|
}, {
|
30
62
|
modelValue: Record<string, any>;
|
31
63
|
components: import("./default").StyleInputConfig;
|
32
64
|
hideComponents: string[];
|
65
|
+
isDrawer: boolean;
|
66
|
+
drawerProps: Record<string, any>;
|
67
|
+
drawerText: string;
|
33
68
|
}, {}>;
|
34
69
|
export default _default;
|
@@ -10,6 +10,7 @@ const _hoisted_2 = {
|
|
10
10
|
key: 0,
|
11
11
|
class: "p-5px"
|
12
12
|
};
|
13
|
+
const _hoisted_3 = { key: 1 };
|
13
14
|
const __default__ = vue.defineComponent({
|
14
15
|
name: "DkStyleInput"
|
15
16
|
});
|
@@ -19,6 +20,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
19
20
|
emits: ["update:modelValue"],
|
20
21
|
setup(__props, { emit }) {
|
21
22
|
const props = __props;
|
23
|
+
const drawer = vue.ref(false);
|
22
24
|
const activeNames = vue.ref([0]);
|
23
25
|
const values = vue.ref({});
|
24
26
|
const loading = vue.ref(true);
|
@@ -67,9 +69,12 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
67
69
|
return (_ctx, _cache) => {
|
68
70
|
const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
|
69
71
|
const _component_el_collapse = vue.resolveComponent("el-collapse");
|
72
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
73
|
+
const _component_el_drawer = vue.resolveComponent("el-drawer");
|
70
74
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
71
75
|
!loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
72
|
-
vue.
|
76
|
+
!props.isDrawer ? (vue.openBlock(), vue.createBlock(_component_el_collapse, {
|
77
|
+
key: 0,
|
73
78
|
modelValue: activeNames.value,
|
74
79
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeNames.value = $event)
|
75
80
|
}, {
|
@@ -107,7 +112,72 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
107
112
|
]),
|
108
113
|
_: 1
|
109
114
|
/* STABLE */
|
110
|
-
}, 8, ["modelValue"])
|
115
|
+
}, 8, ["modelValue"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
|
116
|
+
vue.createVNode(_component_el_button, {
|
117
|
+
type: "primary",
|
118
|
+
plain: "",
|
119
|
+
style: { "width": "100%" },
|
120
|
+
onClick: _cache[1] || (_cache[1] = ($event) => drawer.value = true)
|
121
|
+
}, {
|
122
|
+
default: vue.withCtx(() => [
|
123
|
+
vue.createTextVNode(
|
124
|
+
vue.toDisplayString(props.drawerText),
|
125
|
+
1
|
126
|
+
/* TEXT */
|
127
|
+
)
|
128
|
+
]),
|
129
|
+
_: 1
|
130
|
+
/* STABLE */
|
131
|
+
}),
|
132
|
+
vue.createVNode(_component_el_drawer, vue.mergeProps({
|
133
|
+
modelValue: drawer.value,
|
134
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => drawer.value = $event)
|
135
|
+
}, props.drawerProps), {
|
136
|
+
default: vue.withCtx(() => [
|
137
|
+
vue.createVNode(_component_el_collapse, {
|
138
|
+
modelValue: activeNames.value,
|
139
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => activeNames.value = $event)
|
140
|
+
}, {
|
141
|
+
default: vue.withCtx(() => [
|
142
|
+
(vue.openBlock(true), vue.createElementBlock(
|
143
|
+
vue.Fragment,
|
144
|
+
null,
|
145
|
+
vue.renderList(_components.value, (item, key) => {
|
146
|
+
return vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
|
147
|
+
key,
|
148
|
+
title: "",
|
149
|
+
name: key
|
150
|
+
}, {
|
151
|
+
title: vue.withCtx(() => [
|
152
|
+
vue.createTextVNode(
|
153
|
+
vue.toDisplayString(item.title),
|
154
|
+
1
|
155
|
+
/* TEXT */
|
156
|
+
)
|
157
|
+
]),
|
158
|
+
default: vue.withCtx(() => [
|
159
|
+
activeNames.value.includes(key) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.name), vue.mergeProps({
|
160
|
+
key: 0,
|
161
|
+
modelValue: values.value[item.name],
|
162
|
+
"onUpdate:modelValue": ($event) => values.value[item.name] = $event
|
163
|
+
}, item.props, { onChange }), null, 16, ["modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true)
|
164
|
+
]),
|
165
|
+
_: 2
|
166
|
+
/* DYNAMIC */
|
167
|
+
}, 1032, ["name"]);
|
168
|
+
}),
|
169
|
+
128
|
170
|
+
/* KEYED_FRAGMENT */
|
171
|
+
))
|
172
|
+
]),
|
173
|
+
_: 1
|
174
|
+
/* STABLE */
|
175
|
+
}, 8, ["modelValue"])
|
176
|
+
]),
|
177
|
+
_: 1
|
178
|
+
/* STABLE */
|
179
|
+
}, 16, ["modelValue"])
|
180
|
+
]))
|
111
181
|
])) : vue.createCommentVNode("v-if", true)
|
112
182
|
]);
|
113
183
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"style-input.vue2.js","sources":["../../../src/style-input/src/style-input.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkStyleInput',\n});\n</script>\n<template>\n <div class=\"dk-style-input\">\n <div v-if=\"!loading\" class=\"p-5px\">\n <el-collapse v-model=\"activeNames\">\n <el-collapse-item v-for=\"(item, key) in _components\" :key=\"key\" title=\"\" :name=\"key\">\n <template #title>\n {{ item.title }}\n </template>\n <component\n :is=\"item.name\"\n v-if=\"activeNames.includes(key)\"\n v-model=\"values[item.name]\"\n v-bind=\"item.props\"\n @change=\"onChange\"\n />\n </el-collapse-item>\n </el-collapse>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { styleInputProps } from './props'\nimport { onMounted, ref, watch } from 'vue'\n\n\nconst props = defineProps(styleInputProps)\nconst activeNames = ref([0])\nconst values: any = ref({})\nconst loading = ref(true)\n\nconst emit = defineEmits(['update:modelValue'])\nconst onChange = () => {\n const obj: any = {}\n Object.keys(values.value).forEach((key) => {\n Object.keys(values.value[key]).forEach((k) => {\n obj[k] = values.value[key][k]\n })\n })\n emit('update:modelValue', obj)\n}\n\nconst _components: any = ref([])\nconst init = () => {\n _components.value = props.components.filter((item: any) => {\n console.log('item.name', item.name)\n return !props.hideComponents.includes(item.name)\n })\n const obj: any = {}\n _components.value.forEach((item: any) => {\n const params = item.params\n const paramsObj: any = {}\n Object.keys(params).forEach((key) => {\n const param = params[key]\n if (props.modelValue[param]) {\n paramsObj[param] = props.modelValue[param]\n }\n })\n obj[item.name] = paramsObj\n })\n values.value = obj\n loading.value = false\n}\n\nwatch(\n () => props.modelValue,\n () => {\n init()\n },\n {\n deep: true,\n }\n)\n\nonMounted(() => {\n init()\n})\n</script>\n"],"names":["__MACROS_defineComponent","ref","watch","onMounted"],"mappings":"
|
1
|
+
{"version":3,"file":"style-input.vue2.js","sources":["../../../src/style-input/src/style-input.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkStyleInput',\n});\n</script>\n<template>\n <div class=\"dk-style-input\">\n <div v-if=\"!loading\" class=\"p-5px\">\n <el-collapse v-if=\"!props.isDrawer\" v-model=\"activeNames\">\n <el-collapse-item v-for=\"(item, key) in _components\" :key=\"key\" title=\"\" :name=\"key\">\n <template #title>\n {{ item.title }}\n </template>\n <component\n :is=\"item.name\"\n v-if=\"activeNames.includes(key)\"\n v-model=\"values[item.name]\"\n v-bind=\"item.props\"\n @change=\"onChange\"\n />\n </el-collapse-item>\n </el-collapse>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"drawer = true\">{{ props.drawerText }}</el-button>\n <el-drawer v-model=\"drawer\" v-bind=\"props.drawerProps\">\n <el-collapse v-model=\"activeNames\">\n <el-collapse-item v-for=\"(item, key) in _components\" :key=\"key\" title=\"\" :name=\"key\">\n <template #title>\n {{ item.title }}\n </template>\n <component\n :is=\"item.name\"\n v-if=\"activeNames.includes(key)\"\n v-model=\"values[item.name]\"\n v-bind=\"item.props\"\n @change=\"onChange\"\n />\n </el-collapse-item>\n </el-collapse>\n </el-drawer>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { styleInputProps } from './props'\nimport { onMounted, ref, watch } from 'vue'\n\n\nconst props = defineProps(styleInputProps)\nconst drawer = ref(false)\nconst activeNames = ref([0])\nconst values: any = ref({})\nconst loading = ref(true)\n\nconst emit = defineEmits(['update:modelValue'])\nconst onChange = () => {\n const obj: any = {}\n Object.keys(values.value).forEach((key) => {\n Object.keys(values.value[key]).forEach((k) => {\n obj[k] = values.value[key][k]\n })\n })\n emit('update:modelValue', obj)\n}\n\nconst _components: any = ref([])\nconst init = () => {\n _components.value = props.components.filter((item: any) => {\n console.log('item.name', item.name)\n return !props.hideComponents.includes(item.name)\n })\n const obj: any = {}\n _components.value.forEach((item: any) => {\n const params = item.params\n const paramsObj: any = {}\n Object.keys(params).forEach((key) => {\n const param = params[key]\n if (props.modelValue[param]) {\n paramsObj[param] = props.modelValue[param]\n }\n })\n obj[item.name] = paramsObj\n })\n values.value = obj\n loading.value = false\n}\n\nwatch(\n () => props.modelValue,\n () => {\n init()\n },\n {\n deep: true,\n }\n)\n\nonMounted(() => {\n init()\n})\n</script>\n"],"names":["__MACROS_define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