优化类型

This commit is contained in:
gary.fu
2024-01-10 10:33:08 +08:00
parent e58982688c
commit f297c76abd
11 changed files with 611 additions and 105 deletions

View File

@@ -6,12 +6,16 @@ module.exports = {
'eslint:recommended',
'plugin:vue/vue3-recommended',
'eslint:recommended',
'@vue/eslint-config-standard'
'@vue/eslint-config-standard',
'plugin:@typescript-eslint/recommended'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
'vue/multi-word-component-names': 'off'
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-explicit-any': 'off'
}
}

465
package-lock.json generated
View File

@@ -24,10 +24,13 @@
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.6.1",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-vue": "^4.5.2",
"@vue/eslint-config-standard": "^8.0.1",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.19.2",
"typescript": "^5.3.3",
"vite": "^5.0.10"
}
},
@@ -304,6 +307,12 @@
"integrity": "sha512-UY+FGM/2jjMkzQLn8pxcHGMaVLh9aEitG3zY2CiY7XHdLiz3bZOwa6oDxNqEMv7zZkV+cj5DOdz0cQ1BP5Hjgw==",
"dev": true
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true
},
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -334,11 +343,276 @@
"undici-types": "~5.26.4"
}
},
"node_modules/@types/semver": {
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz",
"integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==",
"dev": true
},
"node_modules/@types/web-bluetooth": {
"version": "0.0.20",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz",
"integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow=="
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz",
"integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.18.1",
"@typescript-eslint/type-utils": "6.18.1",
"@typescript-eslint/utils": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
"natural-compare": "^1.4.0",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha",
"eslint": "^7.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/parser": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz",
"integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.18.1",
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/typescript-estree": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz",
"integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz",
"integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "6.18.1",
"@typescript-eslint/utils": "6.18.1",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/types": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz",
"integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/visitor-keys": "6.18.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "9.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/utils": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz",
"integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.18.1",
"@typescript-eslint/types": "6.18.1",
"@typescript-eslint/typescript-estree": "6.18.1",
"semver": "^7.5.4"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0"
}
},
"node_modules/@typescript-eslint/utils/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "6.18.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.18.1",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@ungap/structured-clone": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
@@ -670,6 +944,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/array.prototype.findlastindex": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz",
@@ -800,6 +1083,18 @@
"concat-map": "0.0.1"
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/builtins": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz",
@@ -996,6 +1291,18 @@
"node": ">=0.4.0"
}
},
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"dev": true,
"dependencies": {
"path-type": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -1720,6 +2027,34 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
"node_modules/fast-glob": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
"integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
"dev": true,
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.4"
},
"engines": {
"node": ">=8.6.0"
}
},
"node_modules/fast-glob/node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -1753,6 +2088,18 @@
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@@ -1979,6 +2326,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/gopd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
@@ -2256,6 +2623,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-number-object": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
@@ -2510,6 +2886,28 @@
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz",
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="
},
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/micromatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
"dev": true,
"dependencies": {
"braces": "^3.0.2",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -2784,11 +3182,32 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"node_modules/path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/pinia": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz",
@@ -3167,6 +3586,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
@@ -3283,6 +3711,30 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/ts-api-utils": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz",
"integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==",
"dev": true,
"engines": {
"node": ">=16.13.0"
},
"peerDependencies": {
"typescript": ">=4.2.0"
}
},
"node_modules/tsconfig-paths": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
@@ -3384,6 +3836,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"devOptional": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",

View File

@@ -25,10 +25,13 @@
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.6.1",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-vue": "^4.5.2",
"@vue/eslint-config-standard": "^8.0.1",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.19.2",
"typescript": "^5.3.3",
"vite": "^5.0.10"
}
}

View File

@@ -1,5 +1,37 @@
import {CommonPage} from "../public";
import {CommonTableColumn} from "../common-table/public";
import { CommonPage } from '../public'
import { CommonTableColumn } from '../common-table/public'
import { InputProps } from 'element-plus'
/**
* 搜索参数
*/
export interface CommonSearchParam {
/** 搜索关键字 */
query: string;
/** 分页信息 */
page: CommonPage;
}
export interface CommonSelectPageOption {
tabs: Array<{ id: string, label: string }>;
/** 搜索方法 */
searchMethod: (tabId: string, callback: (items: Array<any>) => void) => Promise<any>;
}
export interface CommonAutocompleteOption {
/** 自动完成表格列配置 */
columns: Array<CommonTableColumn>;
/** 空数据提示信息 */
emptyMessage?: string;
/** 搜索方法 */
searchMethod: (param: CommonSearchParam,
callback: (result: {
/** 返回分分页 */
page: CommonPage,
/** 返回的数据 */
items: Array<any>
}) => void) => Promise<any>;
}
export interface CommonAutocompleteProps {
// 自动完成配置
@@ -41,38 +73,7 @@ export interface CommonAutocompleteProps {
// 最低高度
minHeight?: string;
// input自定义属性
inputAttrs?: any;
inputAttrs?: InputProps;
// 验证事件
validateEvent?: boolean;
}
export interface CommonSelectPageOption {
tabs: Array<{ id: string, label: string }>;
/**搜索方法*/
searchMethod: (tabId: string, callback: (items: Array<any>) => void) => Promise<any>;
}
export interface CommonAutocompleteOption {
/**自动完成表格列配置*/
columns: Array<CommonTableColumn>;
/**空数据提示信息*/
emptyMessage?: string;
/**搜索方法*/
searchMethod: (param: CommonSearchParam,
callback: (result: {
/**返回分分页*/
page: CommonPage,
/**返回的数据*/
items: Array<any>
}) => void) => Promise<any>;
}
/**
* 搜索参数
*/
export interface CommonSearchParam {
/** 搜索关键字 */
query: string;
/**分页信息*/
page: CommonPage;
}

View File

@@ -23,7 +23,7 @@ const props = defineProps({
const inputType = computed(() => useInputType(props.option))
const modelAttrs = computed(() => {
if (['el-input', 'el-select', 'common-autocomplete', 'el-autocomplete', 'el-cascader'].includes(inputType.value)) {
if (['el-input', 'el-select', 'common-autocomplete', 'el-autocomplete', 'el-cascader', 'el-tree-select'].includes(inputType.value)) {
return Object.assign({ clearable: true }, props.option.attrs || {})
}
return props.option.attrs
@@ -74,9 +74,30 @@ const children = computed(() => {
<template>
<el-form-item
:label="label"
:prop="option.prop"
>
<template #label>
<span>{{ label }}</span>
<el-tooltip
v-if="option.tooltip||option.tooltipFunc"
class="box-item"
effect="dark"
:disabled="!option.tooltip"
:content="option.tooltip"
placement="top-start"
>
<span>
<el-link
:underline="false"
@click="option.tooltipFunc"
>&nbsp;
<common-icon
icon="QuestionFilled"
/>
</el-link>
</span>
</el-tooltip>
</template>
<component
:is="inputType"
v-model="modelValue"

View File

@@ -132,7 +132,7 @@ defineExpose({
/>
<slot
:form="form"
name="before-buttons"
name="default"
/>
<el-form-item v-if="showButtons">
<el-button
@@ -161,6 +161,7 @@ defineExpose({
</el-form-item>
<slot
:form="form"
name="after-buttons"
/>
</el-form>
</template>

View File

@@ -1,67 +1,71 @@
import {RuleItem} from "async-validator/dist-types/interface";
import {FormInstance, FormProps} from "element-plus";
export interface CommonFormProps extends FormProps {
/**配置选项*/
options: Array<CommonFormOption>;
/**label宽度*/
labelWidth: string;
/**model对象*/
model: any;
/**是否在rule改变时执行验证*/
validateOnRuleChange: boolean;
/**提交按钮的label*/
submitLabel: string;
/**重置按钮label*/
resetLabel: string;
/**返回按钮label*/
backLabel: string;
/**是否显示按钮区域*/
showButtons: boolean;
/**是否显示提交按钮*/
showSubmit: boolean;
/**是否显示重置按钮*/
showReset: boolean;
/**提交逻辑*/
submitForm: (form: FormInstance) => void;
/**返回地址*/
backUrl: string;
}
import { RuleItem } from 'async-validator/dist-types/interface'
import { FormInstance, FormProps } from 'element-plus'
export interface CommonFormOption {
/**表单类型*/
/** 表单类型 */
type: 'input' | 'input-number' | 'cascader' | 'radio'
| 'radio-group' | 'radio-button' | 'checkbox' | 'checkbox-group' | 'checkbox-button' | 'date-picker'
| 'time-picker' | 'switch' | 'select' | 'option' | 'slider' | 'transfer' | 'upload' | 'common-icon-select' | 'common-autocomplete' | 'tree-select';
/**数据值*/
/** 数据值 */
value?: any;
/**属性名*/
/** 属性名 */
prop: string | string[];
/**表单标签*/
/** 表单标签 */
label?: string;
/**用于国际化的label*/
/** 用于国际化的label */
labelKey?: string;
/**是否必填,后面解析成为rules的一部分*/
/** 是否必填,后面解析成为rules的一部分 */
required?: boolean;
/**正则表达式验证解析成为rules的一部分*/
/** 正则表达式验证解析成为rules的一部分 */
pattern?: string | RegExp;
/**正则表达式验证消息*/
/** 正则表达式验证消息 */
patternMsg?: string;
/**是否禁用*/
/** 是否禁用 */
disabled?: boolean;
/**是否只读*/
/** 是否只读 */
readonly?: boolean;
/**占位提示符*/
/** 占位提示符 */
placeholder?: string;
/**其他可用属性*/
/** 其他可用属性 */
attrs?: {
showPassword: boolean,
[key: string]: any
};
/**有些控件柚子节点*/
/** 有些控件柚子节点 */
children?: Array<CommonFormOption>;
/**async-validator验证器*/
/** async-validator验证器 */
rules: Array<RuleItem>;
/**change事件*/
change: (val: any) => void
/** change事件 */
change: (val: any) => void;
/** 提示信息 */
tooltip: string;
/** 提示函数 */
tooltipFunc: () => void;
}
export interface CommonFormProps extends FormProps {
/** 配置选项 */
options: Array<CommonFormOption>;
/** label宽度 */
labelWidth: string;
/** model对象 */
model: any;
/** 是否在rule改变时执行验证 */
validateOnRuleChange: boolean;
/** 提交按钮的label */
submitLabel: string;
/** 重置按钮label */
resetLabel: string;
/** 返回按钮label */
backLabel: string;
/** 是否显示按钮区域 */
showButtons: boolean;
/** 是否显示提交按钮 */
showSubmit: boolean;
/** 是否显示重置按钮 */
showReset: boolean;
/** 提交逻辑 */
submitForm: (form: FormInstance) => void;
/** 返回地址 */
backUrl: string;
}

View File

@@ -39,6 +39,10 @@ const props = defineProps({
type: String,
default: ''
},
clearable: {
type: Boolean,
default: true
},
validateEvent: {
type: Boolean,
default: true
@@ -93,7 +97,7 @@ const selectIcon = icon => {
</el-button>
</label>
<el-button
v-if="vModel"
v-if="clearable&&vModel"
type="danger"
:disabled="disabled||readonly"
size="small"

View File

@@ -1,23 +1,16 @@
import {RouteRecordRaw} from "vue-router";
export interface CommonMenuItemProps {
/**menu配置*/
menuItem: CommonMenuItem;
/**index序号*/
index: number | string;
}
import { RouteRecordRaw } from 'vue-router'
/**
* 菜单对象
*/
export interface CommonMenuItem {
/**是否是下拉Dropdown样式*/
/** 是否是下拉Dropdown样式 */
isDropdown?: boolean;
/**是否是分割元素*/
/** 是否是分割元素 */
isSplit?: boolean;
/**自定义样式*/
/** 自定义样式 */
menuCls?: string;
/**路由地址*/
/** 路由地址 */
index?: string;
/** 路由 */
route?: RouteRecordRaw;
@@ -33,10 +26,17 @@ export interface CommonMenuItem {
iconIf?: () => string;
/** click事件 */
click?: () => string;
/**子菜单*/
/** 子菜单 */
children?: Array<CommonMenuItem>;
/**自定义属性*/
/** 自定义属性 */
attrs: {
[key: string]: any
}
}
export interface CommonMenuItemProps {
/** menu配置 */
menuItem: CommonMenuItem;
/** index序号 */
index: number | string;
}

View File

@@ -1,6 +1,5 @@
import {ButtonProps, TableProps} from "element-plus";
import {CommonPage} from "../public";
import {PaginationProps} from "element-plus/es/components/pagination/src/pagination";
import { ButtonProps, LinkProps, TableProps, PaginationProps } from 'element-plus'
import { CommonPage } from '../public'
/**
* 表格列定义
@@ -25,7 +24,7 @@ export interface CommonTableColumn {
// 可选属性
attrs: any;
// 链接可选属性
linkAttrs: any;
linkAttrs: LinkProps;
// 点击事件
click: (data: any) => any;
// 格式化函数
@@ -62,9 +61,9 @@ export interface CommonTableProps extends TableProps<any> {
pageAlign?: 'left' | 'center' | 'right';
/** 其他分页配置项 */
pageAttrs?: PaginationProps;
/**loading状态*/
/** loading状态 */
loading?: boolean;
/**loading显示消息*/
/** loading显示消息 */
loadingText?: string;
}

View File

@@ -16,8 +16,12 @@ export interface CommonPage {
* element树结构
*/
export interface CommonTreeNode {
/** 树值 */
value: string;
/** 展示标签 */
label: string;
/** 子节点 */
children?: Array<CommonTreeNode>;
/** 是否是叶子节点 */
isLeaf?: boolean;
}