kfb-view 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/kfb-view.js +1 -1
- package/lib/kfb-view.js.LICENSE.txt +3 -3
- package/package.json +3 -2
- package/src/components/area/index.js +38 -48
- package/src/components/board/index.js +1 -1
- package/src/components/common/common.js +0 -67
- package/src/components/grid/index.js +8 -3
- package/src/plugin/openseadragon/openseadragon.js +667 -126
- package/src/util/calculate.js +79 -35
- package/src/util/imageData.js +0 -5
- package/src/view.js +7 -6
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/git_toolbox_prj.xml +0 -20
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/inspectionProfiles/profiles_settings.xml +0 -5
- package/.idea/kfb-view.iml +0 -12
- package/.idea/misc.xml +0 -86
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/workspace.xml +0 -870
- package/config/utils.js +0 -77
- package/config/webpack.base.conf.js +0 -95
- package/config/webpack.dev.conf.js +0 -80
- package/config/webpack.lib.conf.js +0 -92
- package/config/webpack.prod.conf.js +0 -102
- package/config/webpack.test.conf.js +0 -0
- package/example/index.js +0 -546
- package/example/label/check.svg +0 -8
- package/example/label/check_empty.svg +0 -9
- package/example/label/cross.svg +0 -6
- package/example/label/cross_empty.svg +0 -6
- package/example/label/delete.svg +0 -8
- package/example/label/delete_empty.svg +0 -8
- package/example/label/hasAudit.svg +0 -26
- package/example/style/index.css +0 -153
- package/example/worker/canvas.worker.js +0 -28
- package/test.html +0 -246
- package/yarn.lock +0 -7508
package/config/utils.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
|
-
const ROOT = path.resolve(__dirname, '..');
|
|
4
|
-
const root = path.join.bind(path, ROOT);
|
|
5
|
-
|
|
6
|
-
exports.root = root;
|
|
7
|
-
|
|
8
|
-
exports.cssLoaders = function(options = {}) {
|
|
9
|
-
const cssLoader = {
|
|
10
|
-
loader: 'css-loader',
|
|
11
|
-
options: {
|
|
12
|
-
minimize: process.env.NODE_ENV === 'production',
|
|
13
|
-
sourceMap: options.sourceMap,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* 加载webpack中的loader
|
|
18
|
-
* @param {Array} loader
|
|
19
|
-
* @param {Object} loaderOptions
|
|
20
|
-
* @return {Array}
|
|
21
|
-
*/
|
|
22
|
-
function generateLoaders(loader, loaderOptions) {
|
|
23
|
-
let loaders = [cssLoader];
|
|
24
|
-
loaders.push({
|
|
25
|
-
loader: 'postcss-loader',
|
|
26
|
-
options: {
|
|
27
|
-
ident: 'postcss',
|
|
28
|
-
plugins: (loader) => [
|
|
29
|
-
require('postcss-import')({root: loader.resourcePath}),
|
|
30
|
-
require('autoprefixer')(),
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
if (loader) {
|
|
35
|
-
loaders.push({
|
|
36
|
-
loader: loader + '-loader',
|
|
37
|
-
options: Object.assign({}, loaderOptions, {
|
|
38
|
-
sourceMap: options.sourceMap,
|
|
39
|
-
}),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Extract CSS when that option is specified
|
|
44
|
-
// (which is the case during production build)
|
|
45
|
-
if (options.extract) {
|
|
46
|
-
return [MiniCssExtractPlugin.loader].concat(loaders);
|
|
47
|
-
} else {
|
|
48
|
-
return ['style-loader'].concat(loaders);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
|
53
|
-
return {
|
|
54
|
-
css: generateLoaders(),
|
|
55
|
-
// less: generateLoaders('less'),
|
|
56
|
-
sass: generateLoaders('sass', {indentedSyntax: true}),
|
|
57
|
-
scss: generateLoaders('sass'),
|
|
58
|
-
/* tylus: generateLoaders('stylus'),
|
|
59
|
-
styl: generateLoaders('stylus') */
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Generate loaders for standalone style files (outside of .vue)
|
|
64
|
-
exports.styleLoaders = function(options) {
|
|
65
|
-
let output = [];
|
|
66
|
-
const loaders = exports.cssLoaders(options);
|
|
67
|
-
for (let extension in loaders) {
|
|
68
|
-
if (Object.prototype.hasOwnProperty.call(loaders, extension)) {
|
|
69
|
-
let loader = loaders[extension];
|
|
70
|
-
output.push({
|
|
71
|
-
test: new RegExp('\\.' + extension + '$'),
|
|
72
|
-
use: loader,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return output;
|
|
77
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
const utils = require('./utils');
|
|
2
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
-
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
const METADATA = {
|
|
6
|
-
title: '阅片',
|
|
7
|
-
baseUrl: '/',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
module.exports = function() {
|
|
11
|
-
return {
|
|
12
|
-
entry: {
|
|
13
|
-
// polyfill: 'babel-polyfill',
|
|
14
|
-
app: './example/index.js',
|
|
15
|
-
},
|
|
16
|
-
resolve: {
|
|
17
|
-
extensions: ['.js', '.json'],
|
|
18
|
-
alias: {
|
|
19
|
-
'@': utils.root('example'),
|
|
20
|
-
},
|
|
21
|
-
symlinks: false,
|
|
22
|
-
},
|
|
23
|
-
module: {
|
|
24
|
-
rules: [
|
|
25
|
-
{
|
|
26
|
-
test: /\.worker\.js$/,
|
|
27
|
-
use: [
|
|
28
|
-
{
|
|
29
|
-
loader: 'worker-loader',
|
|
30
|
-
options: {inline: true},
|
|
31
|
-
},
|
|
32
|
-
{loader: 'babel-loader'},
|
|
33
|
-
],
|
|
34
|
-
include: [utils.root('example/worker')],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
test: /\.html$/,
|
|
38
|
-
use: [
|
|
39
|
-
{
|
|
40
|
-
loader: 'html-loader',
|
|
41
|
-
options: {
|
|
42
|
-
minimize: true,
|
|
43
|
-
removeComments: false,
|
|
44
|
-
collapseWhitespace: false,
|
|
45
|
-
},
|
|
46
|
-
}],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
test: /\.js$/,
|
|
50
|
-
loader: 'babel-loader',
|
|
51
|
-
include: [utils.root('example'), utils.root('src')],
|
|
52
|
-
exclude: [utils.root('src/plugin')],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
56
|
-
loader: 'url-loader',
|
|
57
|
-
options: {
|
|
58
|
-
limit: 10000,
|
|
59
|
-
/* name: '[name].[hash:7].[ext]', */
|
|
60
|
-
outputPath: 'assets/img',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
65
|
-
loader: 'url-loader',
|
|
66
|
-
options: {
|
|
67
|
-
limit: 10000,
|
|
68
|
-
/* name: '[name].[hash:7].[ext]', */
|
|
69
|
-
outputPath: 'assets/fonts',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
plugins: [
|
|
75
|
-
new HtmlWebpackPlugin({
|
|
76
|
-
template: 'example/index.html',
|
|
77
|
-
title: METADATA.title,
|
|
78
|
-
chunksSortMode: 'manual',
|
|
79
|
-
chunks: ['polyfill', 'vendors', 'app'],
|
|
80
|
-
metadata: METADATA,
|
|
81
|
-
inject: 'body',
|
|
82
|
-
}),
|
|
83
|
-
new ScriptExtHtmlWebpackPlugin({
|
|
84
|
-
sync: /polyfill|vendors/,
|
|
85
|
-
defaultAttribute: 'async',
|
|
86
|
-
preload: [/polyfill|vendors|app/],
|
|
87
|
-
prefetch: [/chunk/],
|
|
88
|
-
}),
|
|
89
|
-
|
|
90
|
-
],
|
|
91
|
-
node: {
|
|
92
|
-
fs: 'empty',
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const utils = require('./utils');
|
|
2
|
-
const webpackMerge = require('webpack-merge');
|
|
3
|
-
const baseWebpackConfig = require('./webpack.base.conf');
|
|
4
|
-
const METADATA = webpackMerge(baseWebpackConfig().metadata, {
|
|
5
|
-
host: '0.0.0.0',
|
|
6
|
-
port: 3001,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
process.env.NODE_ENV = process.env.NODE_ENV ?
|
|
10
|
-
process.env.NODE_ENV : 'development';
|
|
11
|
-
|
|
12
|
-
module.exports = function() {
|
|
13
|
-
return webpackMerge(baseWebpackConfig(), {
|
|
14
|
-
mode: 'development',
|
|
15
|
-
devtool: 'cheap-module-source-map',
|
|
16
|
-
output: {
|
|
17
|
-
path: utils.root('dist'),
|
|
18
|
-
filename: '[name].bundle.js',
|
|
19
|
-
sourceMapFilename: '[file].map',
|
|
20
|
-
chunkFilename: '[id].chunk.js',
|
|
21
|
-
globalObject: 'this',
|
|
22
|
-
publicPath: '/',
|
|
23
|
-
},
|
|
24
|
-
module: {
|
|
25
|
-
rules: utils.styleLoaders({sourceMap: false}),
|
|
26
|
-
/* rules: [
|
|
27
|
-
{
|
|
28
|
-
test: /\.css$/,
|
|
29
|
-
use: ['vue-style-loader', 'css-loader', {
|
|
30
|
-
loader: 'postcss-loader', options: {
|
|
31
|
-
ident: 'postcss',
|
|
32
|
-
plugins: (loader) => [
|
|
33
|
-
require('postcss-import')({root: loader.resourcePath}),
|
|
34
|
-
require('autoprefixer')(),
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
}],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
test: /\.less/,
|
|
41
|
-
use: ['vue-style-loader', 'css-loader', 'less-loader'],
|
|
42
|
-
},
|
|
43
|
-
], */
|
|
44
|
-
},
|
|
45
|
-
devServer: {
|
|
46
|
-
contentBase: utils.root('src'),
|
|
47
|
-
host: METADATA.host,
|
|
48
|
-
port: METADATA.port,
|
|
49
|
-
inline: true,
|
|
50
|
-
historyApiFallback: true,
|
|
51
|
-
watchOptions: {
|
|
52
|
-
// if you're using Docker you may need this
|
|
53
|
-
// aggregateTimeout: 300,
|
|
54
|
-
// poll: 1000,
|
|
55
|
-
ignored: /node_modules/,
|
|
56
|
-
},
|
|
57
|
-
/* https: true, */
|
|
58
|
-
/* https: {
|
|
59
|
-
key: fs.readFileSync("cert/server.key"),
|
|
60
|
-
cert: fs.readFileSync("cert/server.crt"),
|
|
61
|
-
ca: fs.readFileSync("cert/ca.pem"),
|
|
62
|
-
}, */
|
|
63
|
-
proxy: [
|
|
64
|
-
{
|
|
65
|
-
context: ['/api', '/image.php', '/process.php'],
|
|
66
|
-
// target: 'http://gastric.label.hzztai.com/',
|
|
67
|
-
// target: 'http://192.168.1.91:7007',
|
|
68
|
-
// target: 'http://192.168.1.91',
|
|
69
|
-
// target: 'http://192.168.1.16',
|
|
70
|
-
// target: 'https://tct.hzztai.com',
|
|
71
|
-
// target: 'https://pis-ningbo.hzztai.com',
|
|
72
|
-
// target: 'https://pis-test.hzztai.com',
|
|
73
|
-
target: 'https://telepathology.adicon.com.cn',
|
|
74
|
-
secure: false,
|
|
75
|
-
changeOrigin: true,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const utils = require('./utils');
|
|
2
|
-
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
|
-
const EsmWebpackPlugin = require('@purtuga/esm-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
// entry: './src/output/index.js',
|
|
7
|
-
entry: './src/index.js',
|
|
8
|
-
output: {
|
|
9
|
-
path: utils.root('lib'),
|
|
10
|
-
filename: 'kfb-view.js',
|
|
11
|
-
library: 'KfbView',
|
|
12
|
-
libraryTarget: 'var',
|
|
13
|
-
},
|
|
14
|
-
resolve: {
|
|
15
|
-
extensions: ['.js', '.json'],
|
|
16
|
-
},
|
|
17
|
-
module: {
|
|
18
|
-
rules: [
|
|
19
|
-
{
|
|
20
|
-
test: /\.html$/,
|
|
21
|
-
use: [
|
|
22
|
-
{
|
|
23
|
-
loader: 'html-loader',
|
|
24
|
-
options: {
|
|
25
|
-
minimize: true,
|
|
26
|
-
removeComments: false,
|
|
27
|
-
collapseWhitespace: false,
|
|
28
|
-
},
|
|
29
|
-
}],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
test: /\.js$/,
|
|
33
|
-
loader: 'babel-loader',
|
|
34
|
-
include: [utils.root('src')],
|
|
35
|
-
exclude: [utils.root('src/plugin/openseadragon')],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
39
|
-
loader: 'url-loader',
|
|
40
|
-
options: {
|
|
41
|
-
limit: 10000,
|
|
42
|
-
/* name: '[name].[hash:7].[ext]', */
|
|
43
|
-
outputPath: 'assets/img',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
48
|
-
loader: 'url-loader',
|
|
49
|
-
options: {
|
|
50
|
-
limit: 10000,
|
|
51
|
-
/* name: '[name].[hash:7].[ext]', */
|
|
52
|
-
outputPath: 'assets/fonts',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
].concat(utils.styleLoaders({sourceMap: false, extract: false})),
|
|
56
|
-
},
|
|
57
|
-
plugins: [
|
|
58
|
-
new EsmWebpackPlugin(),
|
|
59
|
-
],
|
|
60
|
-
optimization: {
|
|
61
|
-
// production模式下自动开启
|
|
62
|
-
minimize: true,
|
|
63
|
-
minimizer: [
|
|
64
|
-
new TerserPlugin({
|
|
65
|
-
test: /\.js($|\?)/i,
|
|
66
|
-
// 是否启用缓存
|
|
67
|
-
cache: true,
|
|
68
|
-
// 启用并行化
|
|
69
|
-
parallel: true,
|
|
70
|
-
terserOptions: {
|
|
71
|
-
// 支持ie8
|
|
72
|
-
ie8: false,
|
|
73
|
-
// enable work around safari 10/11 bugs in loop scoping and await,
|
|
74
|
-
// 在循环作用域内能绕过safari 10/11 bugs并等待
|
|
75
|
-
safari10: true,
|
|
76
|
-
// ecma版本
|
|
77
|
-
warnings: true,
|
|
78
|
-
parse: {},
|
|
79
|
-
compress: {
|
|
80
|
-
drop_console: true,
|
|
81
|
-
},
|
|
82
|
-
output: {
|
|
83
|
-
comments: false,
|
|
84
|
-
beautify: false,
|
|
85
|
-
},
|
|
86
|
-
mangle: {},
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
// devtool: 'source-map',
|
|
92
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const utils = require('./utils');
|
|
2
|
-
// const webpack = require('webpack');
|
|
3
|
-
const webpackMerge = require('webpack-merge');
|
|
4
|
-
const baseWebpackConfig = require('./webpack.base.conf');
|
|
5
|
-
const TerserPlugin = require('terser-webpack-plugin');
|
|
6
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
7
|
-
|
|
8
|
-
process.env.NODE_ENV = process.env.NODE_ENV ?
|
|
9
|
-
process.env.NODE_ENV : 'production';
|
|
10
|
-
|
|
11
|
-
module.exports = function() {
|
|
12
|
-
return webpackMerge(baseWebpackConfig(), {
|
|
13
|
-
mode: 'production',
|
|
14
|
-
devtool: 'source-map',
|
|
15
|
-
output: {
|
|
16
|
-
path: utils.root('dist'),
|
|
17
|
-
filename: '[name].[chunkhash].bundle.js',
|
|
18
|
-
sourceMapFilename: '[file].map',
|
|
19
|
-
chunkFilename: '[id].[chunkhash].chunk.js',
|
|
20
|
-
},
|
|
21
|
-
module: {
|
|
22
|
-
rules: utils.styleLoaders({sourceMap: false, extract: true}),
|
|
23
|
-
},
|
|
24
|
-
plugins: [
|
|
25
|
-
new MiniCssExtractPlugin({
|
|
26
|
-
filename: '[name].[contenthash].css',
|
|
27
|
-
chunkFilename: '[id].[contenthash].css',
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
optimization: {
|
|
31
|
-
// production模式下自动开启
|
|
32
|
-
minimize: true,
|
|
33
|
-
minimizer: [
|
|
34
|
-
new TerserPlugin({
|
|
35
|
-
test: /\.js($|\?)/i,
|
|
36
|
-
// 是否启用缓存
|
|
37
|
-
cache: true,
|
|
38
|
-
// 启用并行化
|
|
39
|
-
parallel: true,
|
|
40
|
-
terserOptions: {
|
|
41
|
-
// 支持ie8
|
|
42
|
-
ie8: false,
|
|
43
|
-
// enable work around safari 10/11 bugs in loop scoping and await,
|
|
44
|
-
// 在循环作用域内能绕过safari 10/11 bugs并等待
|
|
45
|
-
safari10: true,
|
|
46
|
-
// ecma版本
|
|
47
|
-
ecma: 5,
|
|
48
|
-
warnings: true,
|
|
49
|
-
parse: {},
|
|
50
|
-
compress: true,
|
|
51
|
-
output: {
|
|
52
|
-
comments: false,
|
|
53
|
-
beautify: false,
|
|
54
|
-
},
|
|
55
|
-
mangle: {},
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
],
|
|
59
|
-
runtimeChunk: {
|
|
60
|
-
// 返回运行时的chunk名称,可用来修改最后输出的chunk块的name
|
|
61
|
-
name: entrypoint => `${entrypoint.name}`,
|
|
62
|
-
},
|
|
63
|
-
// 注意如果设置chunkFilename,splitChunks中设置的name无效,
|
|
64
|
-
// 会被chunkFilename取代,除非在splitChunks中设置filename
|
|
65
|
-
/**
|
|
66
|
-
* @example
|
|
67
|
-
* chunkFilename: 'chunk.js',
|
|
68
|
-
* splitChunks:{
|
|
69
|
-
* name:'vendors',
|
|
70
|
-
* cacheGroups: {
|
|
71
|
-
* vendors: {
|
|
72
|
-
* test: /[\\/]node_modules[\\/]/,
|
|
73
|
-
* priority: -10,
|
|
74
|
-
* name:'vendors',
|
|
75
|
-
* },
|
|
76
|
-
* },
|
|
77
|
-
* }
|
|
78
|
-
*
|
|
79
|
-
* 结果不会产生vendors.js,
|
|
80
|
-
* 最后输出的值是chunk.js,
|
|
81
|
-
*/
|
|
82
|
-
splitChunks: {
|
|
83
|
-
chunks: 'all',
|
|
84
|
-
minSize: 30000,
|
|
85
|
-
minChunks: 2,
|
|
86
|
-
maxAsyncRequests: 5,
|
|
87
|
-
maxInitialRequests: 3,
|
|
88
|
-
cacheGroups: {
|
|
89
|
-
vendors: {
|
|
90
|
-
chunks: 'initial',
|
|
91
|
-
// 设置split chunk的文件名称,只适用于chunks: "initial",其他情况报错
|
|
92
|
-
filename: '[name].[chunkhash].bundle.js',
|
|
93
|
-
test: /[\\/]node_modules[\\/]/,
|
|
94
|
-
priority: -10,
|
|
95
|
-
name: 'vendors',
|
|
96
|
-
minChunks: 1,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
};
|
|
File without changes
|