diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..ea6e20f5b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..e164e43af --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +public +dist +*.d.ts diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..1ff81cb28 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,45 @@ +module.exports = { + root: true, + env: { + node: true + }, + extends: [ + "plugin:vue/vue3-essential", + "eslint:recommended", + "@vue/typescript/recommended", + "@vue/prettier", + "@vue/prettier/@typescript-eslint" + ], + parser: "vue-eslint-parser", + parserOptions: { + parser: "@typescript-eslint/parser", + ecmaVersion: 2020, + sourceType: "module", + jsxPragma: "React", + ecmaFeatures: { + jsx: true + } + }, + rules: { + "@typescript-eslint/no-explicit-any": "off", // any + "@typescript-eslint/explicit-module-boundary-types": "off", // setup() + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_" + } + ], + "no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_" + } + ] + } +}; diff --git a/.gitignore b/.gitignore index 0ca39c007..268cf179f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,18 @@ node_modules -dist .DS_Store +dist +dist-ssr +*.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* +tests/**/coverage/ + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..a90291367 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + bracketSpacing: true, + jsxBracketSameLine: true, + singleQuote: false, + arrowParens: 'avoid', + trailingComma: 'none' +}; diff --git a/build/utils.ts b/build/utils.ts index f8f9266f3..8161d1a1d 100644 --- a/build/utils.ts +++ b/build/utils.ts @@ -1,4 +1,4 @@ -import dotenv from 'dotenv'; +import * as dotenv from 'dotenv'; export interface ViteEnv { VITE_PORT: number; @@ -35,4 +35,4 @@ export function loadEnv(): ViteEnv { process.env[envName] = realName; } return ret; -} \ No newline at end of file +} diff --git a/index.html b/index.html index 9b222f29b..f82c48b20 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ ")}catch(e){console&&console.log(e)}}function m(){o||(o=!0,l())}t=function(){var e,t,c,l;(l=document.createElement("div")).innerHTML=a,a=null,(c=l.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",e=c,(t=document.body).firstChild?(l=e,(c=t.firstChild).parentNode.insertBefore(l,c)):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),t()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(l=t,n=e.document,o=!1,(i=function(){try{n.documentElement.doScroll("left")}catch(e){return void setTimeout(i,50)}m()})(),n.onreadystatechange=function(){"complete"==n.readyState&&(n.onreadystatechange=null,m())})}(window); \ No newline at end of file +!(function (e) { + var t, + c, + l, + n, + o, + i, + a = + '', + d = (d = document.getElementsByTagName("script"))[ + d.length - 1 + ].getAttribute("data-injectcss"); + if (d && !e.__iconfont__svg__cssinject__) { + e.__iconfont__svg__cssinject__ = !0; + try { + document.write( + "" + ); + } catch (e) { + console && console.log(e); + } + } + function m() { + o || ((o = !0), l()); + } + (t = function () { + var e, t, c, l; + ((l = document.createElement("div")).innerHTML = a), + (a = null), + (c = l.getElementsByTagName("svg")[0]) && + (c.setAttribute("aria-hidden", "true"), + (c.style.position = "absolute"), + (c.style.width = 0), + (c.style.height = 0), + (c.style.overflow = "hidden"), + (e = c), + (t = document.body).firstChild + ? ((l = e), (c = t.firstChild).parentNode.insertBefore(l, c)) + : t.appendChild(e)); + }), + document.addEventListener + ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) + ? setTimeout(t, 0) + : ((c = function () { + document.removeEventListener("DOMContentLoaded", c, !1), t(); + }), + document.addEventListener("DOMContentLoaded", c, !1)) + : document.attachEvent && + ((l = t), + (n = e.document), + (o = !1), + (i = function () { + try { + n.documentElement.doScroll("left"); + } catch (e) { + return void setTimeout(i, 50); + } + m(); + })(), + (n.onreadystatechange = function () { + "complete" == n.readyState && ((n.onreadystatechange = null), m()); + })); +})(window); diff --git a/src/components/ReBreadCrumb/index.ts b/src/components/ReBreadCrumb/index.ts index de28e7d53..f039bc424 100644 --- a/src/components/ReBreadCrumb/index.ts +++ b/src/components/ReBreadCrumb/index.ts @@ -4,7 +4,7 @@ import reBreadCrumb from "./src/index.vue"; export const ReBreadCrumb = Object.assign(reBreadCrumb, { install(app: App) { app.component(reBreadCrumb.name, reBreadCrumb); - }, + } }); export default ReBreadCrumb; diff --git a/src/components/ReBreadCrumb/src/index.vue b/src/components/ReBreadCrumb/src/index.vue index cf05a4c13..1c570ba36 100644 --- a/src/components/ReBreadCrumb/src/index.vue +++ b/src/components/ReBreadCrumb/src/index.vue @@ -5,11 +5,10 @@ {{ $t(item.meta.title) }} + >{{ $t(item.meta.title) }} - {{ - $t(item.meta.title) - }} + {{ $t(item.meta.title) }} @@ -17,7 +16,6 @@ - \ No newline at end of file + diff --git a/src/components/ReFlowChart/src/DataDialog.vue b/src/components/ReFlowChart/src/DataDialog.vue index 0d6d4570e..8dad05710 100644 --- a/src/components/ReFlowChart/src/DataDialog.vue +++ b/src/components/ReFlowChart/src/DataDialog.vue @@ -1,8 +1,13 @@ - \ No newline at end of file + diff --git a/src/components/ReFlowChart/src/NodePanel.vue b/src/components/ReFlowChart/src/NodePanel.vue index d16064f2a..6aad69459 100644 --- a/src/components/ReFlowChart/src/NodePanel.vue +++ b/src/components/ReFlowChart/src/NodePanel.vue @@ -8,14 +8,17 @@ @mousedown="nodeDragNode(item)" >
-
+
- {{item.text}} + {{ item.text }} - - ")}catch(c){console&&console.log(c)}}function h(){n||(n=!0,o())}t=function(){var c,t,e,o;(o=document.createElement("div")).innerHTML=i,i=null,(e=o.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",c=e,(t=document.body).firstChild?(o=c,(e=t.firstChild).parentNode.insertBefore(o,e)):t.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(e=function(){document.removeEventListener("DOMContentLoaded",e,!1),t()},document.addEventListener("DOMContentLoaded",e,!1)):document.attachEvent&&(o=t,a=c.document,n=!1,(l=function(){try{a.documentElement.doScroll("left")}catch(c){return void setTimeout(l,50)}h()})(),a.onreadystatechange=function(){"complete"==a.readyState&&(a.onreadystatechange=null,h())})}(window); \ No newline at end of file +!(function (c) { + var t, + e, + o, + a, + n, + l, + i = + '', + s = (s = document.getElementsByTagName("script"))[ + s.length - 1 + ].getAttribute("data-injectcss"); + if (s && !c.__iconfont__svg__cssinject__) { + c.__iconfont__svg__cssinject__ = !0; + try { + document.write( + "" + ); + } catch (c) { + console && console.log(c); + } + } + function h() { + n || ((n = !0), o()); + } + (t = function () { + var c, t, e, o; + ((o = document.createElement("div")).innerHTML = i), + (i = null), + (e = o.getElementsByTagName("svg")[0]) && + (e.setAttribute("aria-hidden", "true"), + (e.style.position = "absolute"), + (e.style.width = 0), + (e.style.height = 0), + (e.style.overflow = "hidden"), + (c = e), + (t = document.body).firstChild + ? ((o = c), (e = t.firstChild).parentNode.insertBefore(o, e)) + : t.appendChild(c)); + }), + document.addEventListener + ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) + ? setTimeout(t, 0) + : ((e = function () { + document.removeEventListener("DOMContentLoaded", e, !1), t(); + }), + document.addEventListener("DOMContentLoaded", e, !1)) + : document.attachEvent && + ((o = t), + (a = c.document), + (n = !1), + (l = function () { + try { + a.documentElement.doScroll("left"); + } catch (c) { + return void setTimeout(l, 50); + } + h(); + })(), + (a.onreadystatechange = function () { + "complete" == a.readyState && ((a.onreadystatechange = null), h()); + })); +})(window); diff --git a/src/components/ReFlowChart/src/config.ts b/src/components/ReFlowChart/src/config.ts index 970be6ebf..810431a4d 100644 --- a/src/components/ReFlowChart/src/config.ts +++ b/src/components/ReFlowChart/src/config.ts @@ -1,55 +1,55 @@ export const nodeList = [ { - text: '开始', - type: 'start', - class: 'node-start' + text: "开始", + type: "start", + class: "node-start" }, { - text: '矩形', - type: 'rect', - class: 'node-rect' + text: "矩形", + type: "rect", + class: "node-rect" }, { - type: 'user', - text: '用户', - class: 'node-user' + type: "user", + text: "用户", + class: "node-user" }, { - type: 'push', - text: '推送', - class: 'node-push' + type: "push", + text: "推送", + class: "node-push" }, { - type: 'download', - text: '位置', - class: 'node-download' + type: "download", + text: "位置", + class: "node-download" }, { - type: 'end', - text: '结束', - class: 'node-end' - }, -] + type: "end", + text: "结束", + class: "node-end" + } +]; export const BpmnNode = [ { - type: 'bpmn:startEvent', - text: '开始', - class: 'bpmn-start' + type: "bpmn:startEvent", + text: "开始", + class: "bpmn-start" }, { - type: 'bpmn:endEvent', - text: '结束', - class: 'bpmn-end' + type: "bpmn:endEvent", + text: "结束", + class: "bpmn-end" }, { - type: 'bpmn:exclusiveGateway', - text: '网关', - class: 'bpmn-exclusiveGateway' + type: "bpmn:exclusiveGateway", + text: "网关", + class: "bpmn-exclusiveGateway" }, { - type: 'bpmn:userTask', - text: '用户', - class: 'bpmn-user' - }, -] + type: "bpmn:userTask", + text: "用户", + class: "bpmn-user" + } +]; diff --git a/src/components/ReHamBurger/index.ts b/src/components/ReHamBurger/index.ts index 658354af5..1acccc190 100644 --- a/src/components/ReHamBurger/index.ts +++ b/src/components/ReHamBurger/index.ts @@ -4,7 +4,7 @@ import reHamBurger from "./src/index.vue"; export const ReHamBurger = Object.assign(reHamBurger, { install(app: App) { app.component(reHamBurger.name, reHamBurger); - }, + } }); export default ReHamBurger; diff --git a/src/components/ReHamBurger/src/index.vue b/src/components/ReHamBurger/src/index.vue index 4b5d21e36..9ab554182 100644 --- a/src/components/ReHamBurger/src/index.vue +++ b/src/components/ReHamBurger/src/index.vue @@ -16,23 +16,23 @@ diff --git a/src/components/ReInfo/index.vue b/src/components/ReInfo/index.vue index 999559507..ab4e3185c 100644 --- a/src/components/ReInfo/index.vue +++ b/src/components/ReInfo/index.vue @@ -1,10 +1,10 @@ - - + diff --git a/src/components/ReSeamlessScroll/index.ts b/src/components/ReSeamlessScroll/index.ts index 748397f46..3895ffee3 100644 --- a/src/components/ReSeamlessScroll/index.ts +++ b/src/components/ReSeamlessScroll/index.ts @@ -4,7 +4,7 @@ import reSeamlessScroll from "./src/index.vue"; export const ReSeamlessScroll = Object.assign(reSeamlessScroll, { install(app: App) { app.component(reSeamlessScroll.name, reSeamlessScroll); - }, + } }); export default ReSeamlessScroll; diff --git a/src/components/ReSeamlessScroll/src/index.vue b/src/components/ReSeamlessScroll/src/index.vue index a105cc262..a8ec26eb6 100644 --- a/src/components/ReSeamlessScroll/src/index.vue +++ b/src/components/ReSeamlessScroll/src/index.vue @@ -1,13 +1,23 @@ - \ No newline at end of file + diff --git a/src/components/ReSeamlessScroll/src/utils.ts b/src/components/ReSeamlessScroll/src/utils.ts index 6d640566d..52178c73c 100644 --- a/src/components/ReSeamlessScroll/src/utils.ts +++ b/src/components/ReSeamlessScroll/src/utils.ts @@ -3,16 +3,18 @@ */ export const animationFrame = () => { window.cancelAnimationFrame = (function () { - return window.cancelAnimationFrame || + return ( + window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || function (id) { - return window.clearTimeout(id) + return window.clearTimeout(id); } - })() - window.requestAnimationFrame = function () { + ); + })(); + window.requestAnimationFrame = (function () { return ( window.requestAnimationFrame || window.webkitRequestAnimationFrame || @@ -20,25 +22,26 @@ export const animationFrame = () => { window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { - return window.setTimeout(callback, 1000 / 60) + return window.setTimeout(callback, 1000 / 60); } - ) - }() -} + ); + })(); +}; /** * @desc 判断数组是否相等 - * @param {arr1,arr2} * @return {Boolean} + * @param arr1 + * @param arr2 */ export const arrayEqual = (arr1: Array, arr2: Array) => { - if (arr1 === arr2) return true - if (arr1.length !== arr2.length) return false + if (arr1 === arr2) return true; + if (arr1.length !== arr2.length) return false; for (let i = 0; i < arr1.length; ++i) { - if (arr1[i] !== arr2[i]) return false + if (arr1[i] !== arr2[i]) return false; } - return true -} + return true; +}; /** * @desc 深浅合并拷贝 @@ -47,62 +50,68 @@ export function copyObj() { if (!Array.isArray) { // @ts-expect-error Array.isArray = function (arg) { - return Object.prototype.toString.call(arg) === '[object Array]' - } + return Object.prototype.toString.call(arg) === "[object Array]"; + }; } - let name, options, src, copy, copyIsArray, clone, + let name, + options, + src, + copy, + copyIsArray, + clone, i = 1, + // eslint-disable-next-line prefer-rest-params target = arguments[0] || {}, // 使用||运算符,排除隐式强制类型转换为false的数据类型 deep = false, - len = arguments.length - if (typeof target === 'boolean') { - deep = target - target = arguments[1] || {} - i++ + // eslint-disable-next-line prefer-const + len = arguments.length; + if (typeof target === "boolean") { + deep = target; + // eslint-disable-next-line prefer-rest-params + target = arguments[1] || {}; + i++; } - if (typeof target !== 'object' && typeof target !== 'function') { - target = {} + if (typeof target !== "object" && typeof target !== "function") { + target = {}; } // 如果arguments.length === 1 或typeof arguments[0] === 'boolean',且存在arguments[1],则直接返回target对象 if (i === len) { - return target + return target; } for (; i < len; i++) { //所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环,接着循环下一个源对象 + // eslint-disable-next-line prefer-rest-params if ((options = arguments[i]) != null) { // 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过,不执行for in循环// src用于判断target对象是否存在name属性 for (name in options) { // src用于判断target对象是否存在name属性 - src = target[name] + src = target[name]; // 需要复制的属性当前源对象的name属性 - copy = options[name] + copy = options[name]; // 判断copy是否是数组 - copyIsArray = Array.isArray(copy) + copyIsArray = Array.isArray(copy); // 如果是深复制且copy是一个对象或数组则需要递归直到copy成为一个基本数据类型为止 - if (deep && copy && (typeof copy === 'object' || copyIsArray)) { + if (deep && copy && (typeof copy === "object" || copyIsArray)) { if (copyIsArray) { - copyIsArray = false + copyIsArray = false; // 如果目标对象存在name属性且是一个数组 // 则使用目标对象的name属性,否则重新创建一个数组,用于复制 - clone = src && Array.isArray(src) ? src : [] + clone = src && Array.isArray(src) ? src : []; } else { // 如果目标对象存在name属性且是一个对象则使用目标对象的name属性,否则重新创建一个对象,用于复制 - clone = src && typeof src === 'object' ? src : {} + clone = src && typeof src === "object" ? src : {}; } // 深复制,所以递归调用copyObject函数 // 返回值为target对象,即clone对象 // copy是一个源对象 // @ts-expect-error - target[name] = copyObj(deep, clone, copy) + target[name] = copyObj(deep, clone, copy); } else if (copy !== undefined) { // 浅复制,直接复制到target对象上 - target[name] = copy + target[name] = copy; } } } } - return target + return target; } - - - diff --git a/src/components/ReSelector/index.ts b/src/components/ReSelector/index.ts index ae3a0a4a4..7cb4a4915 100644 --- a/src/components/ReSelector/index.ts +++ b/src/components/ReSelector/index.ts @@ -4,7 +4,7 @@ import reSelector from "./src"; export const ReSelector = Object.assign(reSelector, { install(app: App) { app.component(reSelector.name, reSelector); - }, + } }); export default ReSelector; diff --git a/src/components/ReSelector/src/index.tsx b/src/components/ReSelector/src/index.tsx index 80693dbaf..b9f6de97a 100644 --- a/src/components/ReSelector/src/index.tsx +++ b/src/components/ReSelector/src/index.tsx @@ -4,17 +4,17 @@ import { nextTick, onBeforeMount, getCurrentInstance, - unref, + unref } from "vue"; import { addClass, removeClass, toggleClass } from "/@/utils/operate"; import "./index.css"; -let stayClass = "stay"; //鼠标点击 -let activeClass = "hs-on"; //鼠标移动上去 -let voidClass = "hs-off"; //鼠标移开 -let inRange = "hs-range"; //当前选中的两个元素之间的背景 -let bothLeftSides = "both-left-sides"; -let bothRightSides = "both-right-sides"; +const stayClass = "stay"; //鼠标点击 +const activeClass = "hs-on"; //鼠标移动上去 +const voidClass = "hs-off"; //鼠标移开 +const inRange = "hs-range"; //当前选中的两个元素之间的背景 +const bothLeftSides = "both-left-sides"; +const bothRightSides = "both-right-sides"; let selectedDirection = "right"; //默认从左往右,索引变大 let overList = []; @@ -26,37 +26,42 @@ export default defineComponent({ props: { HsKey: { type: Number || String, - default: 0, + default: 0 }, disabled: { type: Boolean, - default: false, + default: false }, value: { type: Number, - default: 0, + default: 0 }, max: { type: Array, - default: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + default() { + return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + } }, // 回显数据的索引,长度必须是2 echo: { type: Array, - default: [], - }, + default() { + return []; + } + } }, emits: ["selectedVal"], setup(props, { emit }) { let vm: any; - let currentValue = props.value; + // eslint-disable-next-line vue/no-setup-props-destructure + const currentValue = props.value; - let rateDisabled = computed(() => { + const rateDisabled = computed(() => { return props.disabled; }); - let classes = computed(() => { - let result = []; + const classes = computed(() => { + const result = []; let i = 0; let threshold = currentValue; if (currentValue !== Math.floor(currentValue)) { @@ -72,7 +77,7 @@ export default defineComponent({ }); // 鼠标移入 - const setCurrentValue = (index) => { + const setCurrentValue = index => { if (props.disabled) return; // 当选中一个元素后,开始添加背景色 if (selectedList.length === 1) { @@ -118,7 +123,7 @@ export default defineComponent({ }; // 鼠标离开 - const resetCurrentValue = (index) => { + const resetCurrentValue = index => { if (props.disabled) return; // 移除先检查是否选中 选中则返回false 不移除 const currentHsDom = document.querySelector("." + voidClass + index); @@ -130,7 +135,7 @@ export default defineComponent({ // 当选中一个元素后,开始移除背景色 if (selectedList.length === 1) { - let firstIndex = overList[0].index; + const firstIndex = overList[0].index; if (index >= firstIndex) { for (let i = 0; i <= index; i++) { removeClass( @@ -153,7 +158,7 @@ export default defineComponent({ // 鼠标点击 const selectValue = (index, item) => { if (props.disabled) return; - let len = selectedList.length; + const len = selectedList.length; if (len < 2) { selectedList.push({ item, index }); @@ -188,19 +193,19 @@ export default defineComponent({ emit("selectedVal", { left: selectedList[0].item, right: selectedList[1].item, - whole: selectedList, + whole: selectedList }); } else { emit("selectedVal", { left: selectedList[1].item, right: selectedList[0].item, - whole: selectedList, + whole: selectedList }); } } } else { nextTick(() => { - selectedList.forEach((v) => { + selectedList.forEach(v => { removeClass( document.querySelector("." + voidClass + v.index), activeClass, @@ -217,7 +222,7 @@ export default defineComponent({ selectedList = []; overList = []; for (let i = 0; i <= props.max.length; i++) { - let currentDom = document.querySelector(".hs-select__item" + i); + const currentDom = document.querySelector(".hs-select__item" + i); if (currentDom) { removeClass(currentDom, inRange); } @@ -235,7 +240,7 @@ export default defineComponent({ }; // 回显数据 - const echoView = (item) => { + const echoView = item => { if (item.length === 0) return; if (item.length > 2 || item.length === 1) { @@ -291,14 +296,12 @@ export default defineComponent({ onClick={() => selectValue(key, item)} style={{ cursor: unref(rateDisabled) ? "auto" : "pointer", - textAlign: "center", + textAlign: "center" }} - key={key} - > + key={key}>
+ class={`hs-item ${[unref(classes)[key] + key]}`}> {item}
@@ -309,5 +312,5 @@ export default defineComponent({ ); - }, + } }); diff --git a/src/components/ReSplitPane/index.tsx b/src/components/ReSplitPane/index.tsx index cf8c3f4e1..ac9317196 100644 --- a/src/components/ReSplitPane/index.tsx +++ b/src/components/ReSplitPane/index.tsx @@ -14,25 +14,25 @@ export default defineComponent({ props: { splitSet: { type: Object as PropType, - require: true, - }, + require: true + } }, emits: ["resize"], setup(props, ctx) { - let active = ref(false); - let hasMoved = ref(false); - let percent = ref(props.splitSet?.defaultPercent); - let type = props.splitSet?.split === "vertical" ? "width" : "height"; - let resizeType = props.splitSet?.split === "vertical" ? "left" : "top"; + const active = ref(false); + const hasMoved = ref(false); + const percent = ref(props.splitSet?.defaultPercent); + const type = props.splitSet?.split === "vertical" ? "width" : "height"; + const resizeType = props.splitSet?.split === "vertical" ? "left" : "top"; - let leftClass = ref([ + const leftClass = ref([ "splitter-pane splitter-paneL", - props.splitSet?.split, + props.splitSet?.split ]); - let rightClass = ref([ + const rightClass = ref([ "splitter-pane splitter-paneR", - props.splitSet?.split, + props.splitSet?.split ]); const userSelect = computed(() => { @@ -111,29 +111,25 @@ export default defineComponent({ class="vue-splitter-container clearfix" style={(unref(cursor), unref(userSelect))} onMouseup={() => onMouseUp()} - onMousemove={() => onMouseMove(event)} - > + onMousemove={() => onMouseMove(event)}>
+ style={{ [unref(type)]: unref(percent) + "%" }}> {ctx.slots.paneL()}
onMouseDown()} - onClick={() => onClick()} - > + onClick={() => onClick()}>
+ style={{ [unref(type)]: 100 - unref(percent) + "%" }}> {ctx.slots.paneR()}
); - }, + } }); diff --git a/src/components/ReSplitPane/resizer.tsx b/src/components/ReSplitPane/resizer.tsx index 6e6c413c4..7f6bf8c76 100644 --- a/src/components/ReSplitPane/resizer.tsx +++ b/src/components/ReSplitPane/resizer.tsx @@ -6,18 +6,18 @@ export default defineComponent({ props: { split: { type: String, - required: true, + required: true }, className: { type: String, - default: "", - }, + default: "" + } }, setup(props) { - let classes = computed(() => { + const classes = computed(() => { return ["splitter-pane-resizer", props.split, props.className].join(" "); }); return () =>
; - }, + } }); diff --git a/src/config/index.ts b/src/config/index.ts index bfe0f1683..6072b5bd0 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,25 +1,25 @@ -let config: object = {} +let config: object = {}; const setConfig = (cfg?: any) => { - config = Object.assign(config, cfg) -} + config = Object.assign(config, cfg); +}; const getConfig = (key?: string) => { if (typeof key === "string") { - const arr = key.split(".") + const arr = key.split("."); if (arr && arr.length) { - let data = config + let data = config; arr.forEach(v => { if (data && typeof data[v] !== "undefined") { - data = data[v] + data = data[v]; } else { - data = null + data = null; } - }) - return data + }); + return data; } } - return config -} + return config; +}; -export { getConfig, setConfig } +export { getConfig, setConfig }; diff --git a/src/directives/permission/index.ts b/src/directives/permission/index.ts index 82b9930f3..664ca9368 100644 --- a/src/directives/permission/index.ts +++ b/src/directives/permission/index.ts @@ -13,5 +13,5 @@ export const auth: Directive = { } else { throw new Error("need roles! Like v-auth=\"['admin','test']\""); } - }, + } }; diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index d0924217a..79f1fa7b7 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -20,7 +20,11 @@ > - + @@ -29,10 +33,9 @@ @@ -47,7 +50,6 @@ import Hamburger from "/@/components/ReHamBurger"; import screenfull from "../components/screenfull/index.vue"; import { useRouter, useRoute } from "vue-router"; import { useAppStoreHook } from "/@/store/modules/app"; -import { mapGetters } from "pinia"; import { storageSession } from "/@/utils/storage"; import ch from "/@/assets/ch.png"; import en from "/@/assets/en.png"; @@ -92,7 +94,7 @@ export default defineComponent({ watch( () => langs.value, - val => { + () => { //@ts-ignore document.title = t(unref(route.meta.title)); // 动态title } diff --git a/src/layout/components/index.ts b/src/layout/components/index.ts index bb95497f3..9acd04de7 100644 --- a/src/layout/components/index.ts +++ b/src/layout/components/index.ts @@ -1,5 +1,5 @@ -export { default as Navbar } from './Navbar.vue' -export { default as Sidebar } from './sidebar/index.vue' -export { default as AppMain } from './AppMain.vue' -export { default as setting } from './setting/index.vue' -export { default as tag } from './tag/index.vue' +export { default as Navbar } from "./Navbar.vue"; +export { default as Sidebar } from "./sidebar/index.vue"; +export { default as AppMain } from "./AppMain.vue"; +export { default as setting } from "./setting/index.vue"; +export { default as tag } from "./tag/index.vue"; diff --git a/src/layout/components/panel/index.vue b/src/layout/components/panel/index.vue index 60d062683..2019be68c 100644 --- a/src/layout/components/panel/index.vue +++ b/src/layout/components/panel/index.vue @@ -7,16 +7,15 @@

项目配置

-
+
- @@ -41,4 +43,4 @@ export default defineComponent({ background: #f0f0f0; } } - \ No newline at end of file + diff --git a/src/layout/components/setting/index.vue b/src/layout/components/setting/index.vue index a20c9465e..8116458bd 100644 --- a/src/layout/components/setting/index.vue +++ b/src/layout/components/setting/index.vue @@ -2,15 +2,33 @@ 主题风格
    - -
  • + +
  • - -
  • + +
  • @@ -21,15 +39,30 @@
    • 灰色模式 - +
    • 色弱模式 - +
    • 隐藏标签页 - +
    • 侧边栏Logo @@ -55,7 +88,7 @@ - diff --git a/src/layout/components/sidebar/Logo.vue b/src/layout/components/sidebar/Logo.vue index 160e38bc1..d3ab09289 100644 --- a/src/layout/components/sidebar/Logo.vue +++ b/src/layout/components/sidebar/Logo.vue @@ -1,5 +1,5 @@ - +