mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
fix: update yarn.lock
This commit is contained in:
commit
d7a7e1748a
@ -15,6 +15,7 @@ const headPkgs = [
|
|||||||
"fes-plugin-layout",
|
"fes-plugin-layout",
|
||||||
"fes-plugin-icon",
|
"fes-plugin-icon",
|
||||||
"fes-plugin-locale",
|
"fes-plugin-locale",
|
||||||
|
"fes-plugin-enums",
|
||||||
"create-fes-app"
|
"create-fes-app"
|
||||||
];
|
];
|
||||||
const tailPkgs = [];
|
const tailPkgs = [];
|
||||||
|
37
packages/create-fes-app/templates/app/h5/tsconfig.json
Normal file
37
packages/create-fes-app/templates/app/h5/tsconfig.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/dist",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strict": true,
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"],
|
||||||
|
"@@/*": ["./src/.fes/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"tests/**/*",
|
||||||
|
"test/**/*",
|
||||||
|
"__test__/**/*",
|
||||||
|
"typings/**/*",
|
||||||
|
"config/**/*",
|
||||||
|
".eslintrc.js",
|
||||||
|
".stylelintrc.js",
|
||||||
|
".prettierrc.js"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||||
|
}
|
37
packages/create-fes-app/templates/app/pc/tsconfig.json
Normal file
37
packages/create-fes-app/templates/app/pc/tsconfig.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/dist",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strict": true,
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"],
|
||||||
|
"@@/*": ["./src/.fes/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"tests/**/*",
|
||||||
|
"test/**/*",
|
||||||
|
"__test__/**/*",
|
||||||
|
"typings/**/*",
|
||||||
|
"config/**/*",
|
||||||
|
".eslintrc.js",
|
||||||
|
".stylelintrc.js",
|
||||||
|
".prettierrc.js"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||||
|
}
|
3
packages/fes-plugin-enums/.fatherrc.js
Normal file
3
packages/fes-plugin-enums/.fatherrc.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
disableTypeCheck: false,
|
||||||
|
};
|
21
packages/fes-plugin-enums/LICENSE
Normal file
21
packages/fes-plugin-enums/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020-present webank
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
2
packages/fes-plugin-enums/README.md
Normal file
2
packages/fes-plugin-enums/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
|
33
packages/fes-plugin-enums/package.json
Normal file
33
packages/fes-plugin-enums/package.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "@webank/fes-plugin-enums",
|
||||||
|
"version": "2.0.0-alpha.2",
|
||||||
|
"description": "@webank/fes-plugin-enums",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||||
|
"directory": "packages/fes-plugin-enums"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"fes"
|
||||||
|
],
|
||||||
|
"author": "aringlai",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/WeBankFinTech/fes.js/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@webank/fes": "^2.0.0-alpha.0",
|
||||||
|
"vue": "^3.0.4"
|
||||||
|
}
|
||||||
|
}
|
48
packages/fes-plugin-enums/src/index.js
Normal file
48
packages/fes-plugin-enums/src/index.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
|
const namespace = 'plugin-enums';
|
||||||
|
|
||||||
|
export default (api) => {
|
||||||
|
const {
|
||||||
|
utils: { Mustache }
|
||||||
|
} = api;
|
||||||
|
|
||||||
|
api.describe({
|
||||||
|
key: 'enums',
|
||||||
|
config: {
|
||||||
|
schema(joi) {
|
||||||
|
return joi.object();
|
||||||
|
},
|
||||||
|
onChange: api.ConfigChangeType.regenerateTmpFiles
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const absoluteFilePath = join(namespace, 'core.js');
|
||||||
|
api.onGenerateFiles(() => {
|
||||||
|
// 文件写出
|
||||||
|
const enums = api.config.enums || {};
|
||||||
|
api.writeTmpFile({
|
||||||
|
path: absoluteFilePath,
|
||||||
|
content: Mustache.render(
|
||||||
|
readFileSync(join(__dirname, 'runtime/core.tpl'), 'utf-8'),
|
||||||
|
{
|
||||||
|
REPLACE_ENUMS: JSON.stringify(enums)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
api.copyTmpFiles({
|
||||||
|
namespace,
|
||||||
|
path: join(__dirname, 'runtime'),
|
||||||
|
ignore: ['.tpl']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
api.addPluginExports(() => [
|
||||||
|
{
|
||||||
|
specifiers: ['enums'],
|
||||||
|
source: absoluteFilePath
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
};
|
176
packages/fes-plugin-enums/src/runtime/core.tpl
Normal file
176
packages/fes-plugin-enums/src/runtime/core.tpl
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
import { readonly } from "vue"
|
||||||
|
|
||||||
|
// [[key, value]],默认配置格式
|
||||||
|
const _ENUMS = {{{REPLACE_ENUMS}}}
|
||||||
|
const ENUMS = {}
|
||||||
|
Object.keys(_ENUMS).forEach(key => {
|
||||||
|
ENUMS[key] = convert(key, _ENUMS[key])
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取枚举键值,如不传key,则返回name的枚举数组
|
||||||
|
* @param {string} name 枚举名称
|
||||||
|
* @param {string} key 枚举键名称
|
||||||
|
* @param {{
|
||||||
|
* dir: string
|
||||||
|
* extend: Array<{
|
||||||
|
* key:string
|
||||||
|
* dir:string
|
||||||
|
* transfer: Function
|
||||||
|
* }>}} opt 配置项
|
||||||
|
*/
|
||||||
|
function get(name, key, opt = { dir: 'value', extend: []}) {
|
||||||
|
if (Object.prototype.toString.call(key) === '[object Object]') {
|
||||||
|
opt = key
|
||||||
|
key = ''
|
||||||
|
}
|
||||||
|
let list = ENUMS[name] || []
|
||||||
|
if (key) {
|
||||||
|
let res = list.filter(item => item.key === key)[0]
|
||||||
|
if (!res) return key
|
||||||
|
return readonly(parseValueDir(res.value, opt.dir) || key)
|
||||||
|
} else {
|
||||||
|
return readonly(format(list, opt.extend))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除枚举
|
||||||
|
* @param {string} name 枚举名称
|
||||||
|
*/
|
||||||
|
function remove(name) {
|
||||||
|
delete ENUMS[name]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加一个新的枚举,重复添加会覆盖
|
||||||
|
* @param {string} name 枚举名称
|
||||||
|
* @param {Array<Object|Array>} _enum 枚举数组,数组元素可以是数组或者对象
|
||||||
|
* @param {object} opt {keyName: 'key', valueName: ''} keyName: 指定枚举键名称取值属性 valueName 指定枚举键值取值属性
|
||||||
|
*/
|
||||||
|
function push(name, _enum, opt = { keyName: '', valueName: '' }) {
|
||||||
|
if (ENUMS[name]) {
|
||||||
|
console.warn(`enums warn: the ${name}'s enum already exists, cover!`)
|
||||||
|
}
|
||||||
|
ENUMS[name] = convert(name, _enum, opt)
|
||||||
|
return get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于现有的枚举,连接上新的枚举后返回新的枚举
|
||||||
|
* @param {string} name 枚举名称
|
||||||
|
* @param {Array<any|Array>} _enum 枚举数组,数组元素可以是数组或者对象
|
||||||
|
* @param {{
|
||||||
|
* keyName: string,
|
||||||
|
* valueName: string,
|
||||||
|
* before: boolean,
|
||||||
|
* extend: Array<{
|
||||||
|
* key: string
|
||||||
|
* dir: string
|
||||||
|
* transfer: Function
|
||||||
|
* }>
|
||||||
|
* }} opt 配置项,keyName: 指定枚举键名称取值属性 valueName 指定枚举键值取值属性 before: 是否添加在现有的之前
|
||||||
|
*/
|
||||||
|
function concat(name, _enum, opt = { keyName: '', valueName: '', before: false, extend: [] }) {
|
||||||
|
let list = ENUMS[name] || []
|
||||||
|
let partList = convert(name, _enum, opt) || []
|
||||||
|
if (opt.before) {
|
||||||
|
list = partList.concat(list)
|
||||||
|
} else {
|
||||||
|
list = list.concat(partList)
|
||||||
|
}
|
||||||
|
return readonly(format(list, extend))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化枚举
|
||||||
|
* @param {Array} _enum 枚举数组
|
||||||
|
* @param {Array<{key:string, dir:string, transfer: Function}>} extend 格式化规则
|
||||||
|
*/
|
||||||
|
function format(_enum = [], extend = []) {
|
||||||
|
if (!extend || extend.length <= 0) return _enum;
|
||||||
|
return _enum.map(item => {
|
||||||
|
let _item = {...item}
|
||||||
|
extend.forEach(fItem => {
|
||||||
|
if (!fItem.key) return
|
||||||
|
if (typeof fItem.transfer === 'function') {
|
||||||
|
_item[fItem.key] = fItem.transfer(item)
|
||||||
|
} else {
|
||||||
|
_item[fItem.key] = parseValueDir(item.value, fItem.dir)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return _item
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据dir解析value的属性值
|
||||||
|
* @param value
|
||||||
|
* @param dir
|
||||||
|
*/
|
||||||
|
function parseValueDir(value, dir='value') {
|
||||||
|
if (['object', 'function'].indexOf(typeof value) || !value || !dir) return value
|
||||||
|
if (dir.startsWith('[')) {
|
||||||
|
let key = dir.slice(1, dir.indexOf(']'))
|
||||||
|
return parseValueDir(value[key], dir.slice(dir.indexOf(']') + 1))
|
||||||
|
} else {
|
||||||
|
if (dir.startsWith('.')) {
|
||||||
|
dir = dir.slice(1)
|
||||||
|
}
|
||||||
|
let index = dir.indexOf('.')
|
||||||
|
let _index = dir.indexOf('[')
|
||||||
|
if (index === -1) index = dir.length
|
||||||
|
if (_index === -1) _index = dir.length
|
||||||
|
index = Math.min(index, _index)
|
||||||
|
let key = dir.slice(0, index)
|
||||||
|
return parseValueDir(value[key], dir.slice(index))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换传入的枚举数组
|
||||||
|
* @param {string} name 枚举名称
|
||||||
|
* @param {Array<Object|Array>} _enum 枚举数组,数组元素可以是数组或者对象
|
||||||
|
* @param {{keyName: 'key', valueName: string}} opt keyName: 指定枚举键名称取值属性 valueName 指定枚举键值取值属性
|
||||||
|
*/
|
||||||
|
function convert(name, _enum, opt = { keyName: '', valueName: '' }) {
|
||||||
|
if (!name) {
|
||||||
|
throw new Error(`enums error: name must not be empty!`)
|
||||||
|
}
|
||||||
|
if (!Array.isArray(_enum)) {
|
||||||
|
throw new Error(`enums error: the ${name}'s enum must be array!`)
|
||||||
|
}
|
||||||
|
let list = []
|
||||||
|
_enum.forEach((item, index) => {
|
||||||
|
let _item;
|
||||||
|
if (Array.isArray(item)) {
|
||||||
|
_item = {key: item[0], value: item[1]}
|
||||||
|
} else if(Object.prototype.toString.call(item) === '[object Object]') {
|
||||||
|
if (!opt.keyName) opt.keyName = 'key'
|
||||||
|
// key可能为空,有场景需要使用,比如全选
|
||||||
|
_item = {
|
||||||
|
key: item[opt.keyName],
|
||||||
|
value: opt.valueName ? item[opt.valueName] : item
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn(`enums warn: the key ${name} enum item[${index}] must be array or object!`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let res = list.filter(item => item.key === _item.key)[0]
|
||||||
|
if (res) { // 重复key覆盖提示
|
||||||
|
console.warn(`enums warn: the key ${res.key} enum item already exists, cover!`)
|
||||||
|
res.value = _item.value
|
||||||
|
} else {
|
||||||
|
list.push(_item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
export const enums = {
|
||||||
|
get,
|
||||||
|
push,
|
||||||
|
remove,
|
||||||
|
concat,
|
||||||
|
convert
|
||||||
|
}
|
@ -141,7 +141,7 @@ export const genModels = (imports, absSrcPath) => {
|
|||||||
const models = sort(raw);
|
const models = sort(raw);
|
||||||
|
|
||||||
if (checkDuplicates(contents.map(ele => ele.namespace))) {
|
if (checkDuplicates(contents.map(ele => ele.namespace))) {
|
||||||
throw Error('umi: models 中包含重复的 namespace!');
|
throw Error('plugin-model: models 中包含重复的 namespace!');
|
||||||
}
|
}
|
||||||
return raw.sort(
|
return raw.sort(
|
||||||
(a, b) => models.indexOf(a.namespace) - models.indexOf(b.namespace)
|
(a, b) => models.indexOf(a.namespace) - models.indexOf(b.namespace)
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
"html-webpack-tags-plugin": "2.0.17",
|
"html-webpack-tags-plugin": "2.0.17",
|
||||||
"vue-loader": "^16.1.2",
|
"vue-loader": "^16.1.2",
|
||||||
"webpack-bundle-analyzer": "4.3.0",
|
"webpack-bundle-analyzer": "4.3.0",
|
||||||
"babel-plugin-import": "1.13.3"
|
"babel-plugin-import": "1.13.3",
|
||||||
|
"hard-source-webpack-plugin": "0.13.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ export default function () {
|
|||||||
require.resolve('./plugins/features/targets'),
|
require.resolve('./plugins/features/targets'),
|
||||||
require.resolve('./plugins/features/terserOptions'),
|
require.resolve('./plugins/features/terserOptions'),
|
||||||
require.resolve('./plugins/features/vueLoader'),
|
require.resolve('./plugins/features/vueLoader'),
|
||||||
|
require.resolve('./plugins/features/hardSource'),
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
require.resolve('./plugins/misc/route'),
|
require.resolve('./plugins/misc/route'),
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
import {
|
||||||
|
winPath
|
||||||
|
} from '@umijs/utils';
|
||||||
|
import HardSourceWebpackPlugin from 'hard-source-webpack-plugin';
|
||||||
|
|
||||||
|
export default (api) => {
|
||||||
|
api.describe({
|
||||||
|
key: 'hardSource',
|
||||||
|
config: {
|
||||||
|
schema(joi) {
|
||||||
|
return joi.object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
api.chainWebpack((webpackConfig) => {
|
||||||
|
const cwd = api.cwd;
|
||||||
|
if (api.env === 'development') {
|
||||||
|
webpackConfig
|
||||||
|
.plugin('hardSource')
|
||||||
|
.use(HardSourceWebpackPlugin, [{
|
||||||
|
cacheDirectory: winPath(`${cwd}/.cache/hard-source/[confighash]`),
|
||||||
|
...api.config.hardSource || {}
|
||||||
|
}]);
|
||||||
|
webpackConfig
|
||||||
|
.plugin('hardSourceExclude')
|
||||||
|
.use(HardSourceWebpackPlugin.ExcludeModulePlugin, [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
// HardSource works with mini-css-extract-plugin but due to how
|
||||||
|
// mini-css emits assets, assets are not emitted on repeated builds with
|
||||||
|
// mini-css and hard-source together. Ignoring the mini-css loader
|
||||||
|
// modules, but not the other css loader modules, excludes the modules
|
||||||
|
// that mini-css needs rebuilt to output assets every time.
|
||||||
|
test: /mini-css-extract-plugin[\\/]dist[\\/]loader/
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return webpackConfig;
|
||||||
|
});
|
||||||
|
};
|
@ -16,9 +16,14 @@
|
|||||||
"files": [
|
"files": [
|
||||||
".eslintrc.js",
|
".eslintrc.js",
|
||||||
".gitignore",
|
".gitignore",
|
||||||
|
".fes.js",
|
||||||
|
".fes.prod.js",
|
||||||
|
"mock.js",
|
||||||
"package.json",
|
"package.json",
|
||||||
"README.md",
|
"README.md",
|
||||||
"/src"
|
"tsconfig.json",
|
||||||
|
"/src",
|
||||||
|
"/config"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<meta name="format-detection" content="email=no"/>
|
<meta name="format-detection" content="email=no"/>
|
||||||
<meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
|
<meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
|
||||||
</head>
|
</head>
|
||||||
<body ontouchstart="">
|
<body ontouchstart="">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
BIN
packages/fes-template-h5/public/logo.png
Normal file
BIN
packages/fes-template-h5/public/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
37
packages/fes-template-h5/tsconfig.json
Normal file
37
packages/fes-template-h5/tsconfig.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/dist",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strict": true,
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"],
|
||||||
|
"@@/*": ["./src/.fes/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"tests/**/*",
|
||||||
|
"test/**/*",
|
||||||
|
"__test__/**/*",
|
||||||
|
"typings/**/*",
|
||||||
|
"config/**/*",
|
||||||
|
".eslintrc.js",
|
||||||
|
".stylelintrc.js",
|
||||||
|
".prettierrc.js"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||||
|
}
|
@ -26,5 +26,8 @@ export default {
|
|||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 8080
|
port: 8080
|
||||||
|
},
|
||||||
|
enums: {
|
||||||
|
status: [['0', '无效的'], ['1', '有效的']]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -18,11 +18,14 @@
|
|||||||
"files": [
|
"files": [
|
||||||
".eslintrc.js",
|
".eslintrc.js",
|
||||||
".gitignore",
|
".gitignore",
|
||||||
"fes.config.js",
|
".fes.js",
|
||||||
|
".fes.prod.js",
|
||||||
"mock.js",
|
"mock.js",
|
||||||
"package.json",
|
"package.json",
|
||||||
"README.md",
|
"README.md",
|
||||||
"/src"
|
"tsconfig.json",
|
||||||
|
"/src",
|
||||||
|
"/config"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -48,6 +51,7 @@
|
|||||||
"@webank/fes-plugin-layout": "^2.0.0-alpha.0",
|
"@webank/fes-plugin-layout": "^2.0.0-alpha.0",
|
||||||
"@webank/fes-plugin-locale": "^2.0.0-alpha.0",
|
"@webank/fes-plugin-locale": "^2.0.0-alpha.0",
|
||||||
"@webank/fes-plugin-model": "^2.0.0-alpha.0",
|
"@webank/fes-plugin-model": "^2.0.0-alpha.0",
|
||||||
|
"@webank/fes-plugin-enums": "^2.0.0-alpha.0",
|
||||||
"ant-design-vue": "2.0.0-rc.3",
|
"ant-design-vue": "2.0.0-rc.3",
|
||||||
"vue": "3.0.4"
|
"vue": "3.0.4"
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>fes Vue3</title>
|
<title>fes.js</title>
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
BIN
packages/fes-template/public/logo.png
Normal file
BIN
packages/fes-template/public/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
@ -5,6 +5,10 @@
|
|||||||
<access :id="accessId"> accessOnepicess1 <input /> </access>
|
<access :id="accessId"> accessOnepicess1 <input /> </access>
|
||||||
<div v-access="accessId"> accessOnepicess2 <input /> </div>
|
<div v-access="accessId"> accessOnepicess2 <input /> </div>
|
||||||
<input />
|
<input />
|
||||||
|
<h4>数据字典</h4>
|
||||||
|
<div v-for="item in enumsGet('status')" :key="item.key">{{item.value}}:{{item.key}}</div>
|
||||||
|
<div v-for="item in roles" :key="item.key">{{item.name}}:{{item.disabled}}</div>
|
||||||
|
<div>{{enumsGet('roles', '2', { dir: 'eName' })}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<config>
|
<config>
|
||||||
@ -16,7 +20,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import {
|
import {
|
||||||
access, useAccess, useRouter, useI18n, locale
|
access, useAccess, useRouter, useI18n, locale, enums
|
||||||
} from '@webank/fes';
|
} from '@webank/fes';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -26,6 +30,39 @@ export default {
|
|||||||
const localI18n = useI18n();
|
const localI18n = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const accessId = ref('/onepiece1');
|
const accessId = ref('/onepiece1');
|
||||||
|
enums.push('roles', [
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
cName: '系统管理员',
|
||||||
|
eName: 'System',
|
||||||
|
perm: ['1', '2', '3']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
cName: '业务管理员',
|
||||||
|
eName: 'Business',
|
||||||
|
perm: ['1', '2']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
cName: '普通用户',
|
||||||
|
eName: 'User',
|
||||||
|
perm: ['1']
|
||||||
|
}
|
||||||
|
], { keyName: 'id' });
|
||||||
|
const roles = enums.get('roles', {
|
||||||
|
extend: [
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
dir: 'cName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'disabled',
|
||||||
|
transfer: item => item.value.perm.some(i => i >= 2)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
console.log(roles);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(router);
|
console.log(router);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -43,7 +80,9 @@ export default {
|
|||||||
accessId,
|
accessId,
|
||||||
fes,
|
fes,
|
||||||
accessOnepicess,
|
accessOnepicess,
|
||||||
t: localI18n.t
|
t: localI18n.t,
|
||||||
|
enumsGet: enums.get,
|
||||||
|
roles
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
10
packages/fes-template/src/pages/test.vue
Normal file
10
packages/fes-template/src/pages/test.vue
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<template>
|
||||||
|
<div>test</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { } from '@webank/fes';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
37
packages/fes-template/tsconfig.json
Normal file
37
packages/fes-template/tsconfig.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/dist",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strict": true,
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"],
|
||||||
|
"@@/*": ["./src/.fes/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"tests/**/*",
|
||||||
|
"test/**/*",
|
||||||
|
"__test__/**/*",
|
||||||
|
"typings/**/*",
|
||||||
|
"config/**/*",
|
||||||
|
".eslintrc.js",
|
||||||
|
".stylelintrc.js",
|
||||||
|
".prettierrc.js"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||||
|
}
|
@ -9,7 +9,8 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
"dist",
|
"dist",
|
||||||
"bin"
|
"bin",
|
||||||
|
"types.d.ts"
|
||||||
],
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"fes": "./bin/fes.js"
|
"fes": "./bin/fes.js"
|
||||||
@ -49,5 +50,6 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^10.12.0 || ^12.0.0 || >= 14.0.0"
|
"node": "^10.12.0 || ^12.0.0 || >= 14.0.0"
|
||||||
}
|
},
|
||||||
|
"types": "types.d.ts"
|
||||||
}
|
}
|
||||||
|
5
packages/fes/types.d.ts
vendored
Normal file
5
packages/fes/types.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
export * from '@@/core/coreExports';
|
||||||
|
// @ts-ignore
|
||||||
|
export * from '@@/core/pluginExports';
|
Loading…
x
Reference in New Issue
Block a user