@flatbiz/antd
Version:
62 lines (58 loc) • 1.83 kB
JavaScript
/*! @flatjs/forge MIT @flatbiz/antd */
import { _ as _objectWithoutProperties, b as _objectSpread2 } from './_rollupPluginBabelHelpers-BYm17lo8.js';
import { classNames } from '@dimjs/utils/class-names/class-names';
import { useMemo } from 'react';
import { isHttpUri } from '@flatbiz/utils';
import { jsx } from 'react/jsx-runtime';
var _excluded = ["color", "svgPath", "className", "height", "width", "style", "onClick"];
/**
* http svg地址解析,可自定义颜色
* ```
* 1. 内置ionic、lucide组图标基础路径
* 2. 可传自定义http绝对路径svg数据
* 3.
* ```
*/
var SvgHttpView = function SvgHttpView(props) {
var color = props.color,
svgPath = props.svgPath,
className = props.className,
height = props.height,
width = props.width,
style = props.style,
onClick = props.onClick,
otherProps = _objectWithoutProperties(props, _excluded);
var colorNew = color || '#555';
var srcLink = isHttpUri(svgPath) ? svgPath : "https://file.40017.cn/tcsk/alicon/".concat(svgPath, ".svg");
var size = useMemo(function () {
if (width || height) {
return {
width: width,
height: height
};
}
return {
width: 20,
height: 20
};
}, [height, width]);
return /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({}, otherProps), {}, {
onClick: onClick,
className: classNames('http-svg-view', className),
style: _objectSpread2({
width: size.width,
height: size.height
}, style),
children: /*#__PURE__*/jsx("div", {
className: "hsv-content",
style: {
filter: "drop-shadow(".concat(colorNew, " 200px 0)")
},
children: /*#__PURE__*/jsx("img", {
src: srcLink
})
})
}));
};
export { SvgHttpView as S };
//# sourceMappingURL=svg-DXIM5sfc.js.map