Commit 71883822 authored by 秦文海's avatar 秦文海

fix: 修复发布main入口

parent 976ef1a4
......@@ -15,6 +15,7 @@
"lint:prettier": "npm run prettier && git diff && prettier --version && prettier --check \"packages/**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"release": "node ./scripts/release.js --skipBuild",
"release-skipBuild": "node ./scripts/release.js --skipBuild",
"size:build": "cross-env PRO_COMPONENTS_CI='CI' webpack",
"start": "dumi dev",
"site": "dumi build",
......
import { readdirSync } from 'fs';
import { join } from 'path';
export default {
cjs: { type: 'babel', lazy: true },
esm: {
type: 'babel',
importLibToEs: true,
},
extraBabelPlugins: [
['babel-plugin-import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
],
};
......@@ -5,8 +5,8 @@
"author": "qinwenhai <939637841@qq.com>",
"homepage": "",
"license": "ISC",
"main": "dist/TipTool.js",
"module": "dist/TipTool.js",
"main": "lib/index.js",
"module": "es/index.js",
"directories": {
"lib": "lib",
"test": "__tests__"
......@@ -23,7 +23,7 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1",
"build": "BUILD_TYPE=lib father-build && cross-env BUILD_TYPE=es father-build"
"build": "father-build"
},
"dependencies": {
"lodash": "^4.17.21"
......
console.log(123456);
import React, { useState, useContext } from 'react';
import classNames from 'classnames';
import { ConfigProvider } from 'antd';
import { Header } from './header';
import { LeftList } from './leftList';
import _ from 'lodash';
import './index.less';
const TipTool = (props) => {
const { style } = props;
const { leftSetting, headerSetting, events } = props.dataList;
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('panda-gis-tip');
const data = [
{
name: 'middle',
width: style.minWidth ?? '200px',
height: style.minHeight ?? '40px',
active: true,
},
{
name: 'large',
width: style.maxWidth ?? '200px',
height: style.maxHeight ?? '40px',
active: false,
},
];
const scale = {
name: 'small',
width: '200px',
height: '40px',
active: true,
};
const [styleState, setStyleState] = useState(data);
const [styleScale, setScaleState] = useState(scale);
const changeStyle = ({ name, flag }) => {
let data = styleState.slice();
data.map((item) => {
if (name == item.name) {
item.active = true;
} else {
item.active = false;
}
});
setStyleState(data);
};
const changeScale = (flag) => {
let obj = { ...styleScale };
obj.active = flag;
setScaleState(obj);
};
const computedStyle = () => {
if (!styleScale.active) {
return { width: styleScale.width, height: styleScale.height };
} else {
return styleState
.filter((item) => item.active)
.map(({ width, height }) => {
return { width, height };
})[0];
}
};
const displayComput = () => {
if (styleScale.active) {
return { display: 'inline-block' };
} else {
return { display: 'none' };
}
};
return (
<div className={classNames(`${prefixCls}-Tipwripconter`)} style={computedStyle()}>
<Header
headerSetting={headerSetting}
events={events}
changeStyle={changeStyle}
changeScale={changeScale}
/>
<div className={classNames(`${prefixCls}-TipAll`)} style={displayComput()}>
<div className={classNames(`${prefixCls}-Tipconter`)}>
<div className={classNames(`${prefixCls}-Tipleft`)}>
<LeftList leftSetting={leftSetting} />
</div>
</div>
<div className={classNames(`${prefixCls}-tipfooter`)}></div>
</div>
</div>
);
};
//分类可见与不可见属性的数组
export const getVisibleAttribues = function (attribuesArr, fields) {
var attrs = [];
fields.forEach(function (item, i, arr) {
attribuesArr.forEach(function (attr, index) {
if (i == 0) {
attrs[index] = {
show: {},
hide: {},
fields: [],
};
}
// 属性值
var attrValue = attr[item.name];
if (_.isUndefined(attrValue) || _.isNull(attrValue)) {
attrValue = '';
}
// 界面展示值-处理后的
var handleValue = attrValue;
if (handleValue == '') {
handleValue = '--';
}
if (item.visible) {
attrs[index]['show'][item.alias] = [attrValue, handleValue, item.name, item];
attrs[index]['fields'].push(item.alias);
} else {
attrs[index]['hide'][item.alias] = attrValue;
}
});
});
attrsFieldHandle(attrs);
return attrs;
};
//字段类型读取
function attrsFieldHandle(attrs) {
attrs.forEach((item) => {
var showFieldObj = item['show'];
for (var k in showFieldObj) {
var testField = showFieldObj[k][0];
if (typeof testField == 'number') {
if (Number.isInteger(testField)) showFieldObj[k][1] = testField;
else showFieldObj[k][1] = Number(testField.toFixed(3));
}
}
});
}
export default TipTool;
import React, { useState, useContext } from 'react';
import classNames from 'classnames';
import { ConfigProvider } from 'antd';
import { Header } from './header';
import { LeftList } from './leftList';
import _ from 'lodash';
import './index.less';
const TipTool = (props) => {
const { style } = props;
const { leftSetting, headerSetting, events } = props.dataList;
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('panda-gis-tip');
const data = [
{
name: 'middle',
width: style.minWidth ?? '200px',
height: style.minHeight ?? '40px',
active: true,
},
{
name: 'large',
width: style.maxWidth ?? '200px',
height: style.maxHeight ?? '40px',
active: false,
},
];
const scale = {
name: 'small',
width: '200px',
height: '40px',
active: true,
};
const [styleState, setStyleState] = useState(data);
const [styleScale, setScaleState] = useState(scale);
const changeStyle = ({ name, flag }) => {
let data = styleState.slice();
data.map((item) => {
if (name == item.name) {
item.active = true;
} else {
item.active = false;
}
});
setStyleState(data);
};
const changeScale = (flag) => {
let obj = { ...styleScale };
obj.active = flag;
setScaleState(obj);
};
const computedStyle = () => {
if (!styleScale.active) {
return { width: styleScale.width, height: styleScale.height };
} else {
return styleState
.filter((item) => item.active)
.map(({ width, height }) => {
return { width, height };
})[0];
}
};
const displayComput = () => {
if (styleScale.active) {
return { display: 'inline-block' };
} else {
return { display: 'none' };
}
};
return (
<div className={classNames(`${prefixCls}-Tipwripconter`)} style={computedStyle()}>
<Header
headerSetting={headerSetting}
events={events}
changeStyle={changeStyle}
changeScale={changeScale}
/>
<div className={classNames(`${prefixCls}-TipAll`)} style={displayComput()}>
<div className={classNames(`${prefixCls}-Tipconter`)}>
<div className={classNames(`${prefixCls}-Tipleft`)}>
<LeftList leftSetting={leftSetting} />
</div>
</div>
<div className={classNames(`${prefixCls}-tipfooter`)}></div>
</div>
</div>
);
};
//分类可见与不可见属性的数组
export const getVisibleAttribues = function (attribuesArr, fields) {
var attrs = [];
fields.forEach(function (item, i, arr) {
attribuesArr.forEach(function (attr, index) {
if (i == 0) {
attrs[index] = {
show: {},
hide: {},
fields: [],
};
}
// 属性值
var attrValue = attr[item.name];
if (_.isUndefined(attrValue) || _.isNull(attrValue)) {
attrValue = '';
}
// 界面展示值-处理后的
var handleValue = attrValue;
if (handleValue == '') {
handleValue = '--';
}
if (item.visible) {
attrs[index]['show'][item.alias] = [attrValue, handleValue, item.name, item];
attrs[index]['fields'].push(item.alias);
} else {
attrs[index]['hide'][item.alias] = attrValue;
}
});
});
attrsFieldHandle(attrs);
return attrs;
};
//字段类型读取
function attrsFieldHandle(attrs) {
attrs.forEach((item) => {
var showFieldObj = item['show'];
for (var k in showFieldObj) {
var testField = showFieldObj[k][0];
if (typeof testField == 'number') {
if (Number.isInteger(testField)) showFieldObj[k][1] = testField;
else showFieldObj[k][1] = Number(testField.toFixed(3));
}
}
});
}
export default TipTool;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment