gxxc-ui 1.0.8 → 1.0.10
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/dist/IconUI/index.d.ts +29 -0
- package/dist/IconUI/index.js +13 -5
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IconUIProps {
|
|
3
|
+
/** 图标名称 */
|
|
4
|
+
name: string;
|
|
5
|
+
/** 图标大小 */
|
|
6
|
+
size?: string | number;
|
|
7
|
+
/** 图标填充颜色 */
|
|
8
|
+
fill?: string;
|
|
9
|
+
/** 图标描边宽度 */
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
/** 图标主题 */
|
|
12
|
+
theme?: 'outline' | 'filled' | 'two-tone' | 'multi-color';
|
|
13
|
+
/** 图标宽度 */
|
|
14
|
+
width?: string | number;
|
|
15
|
+
/** 图标高度 */
|
|
16
|
+
height?: string | number;
|
|
17
|
+
/** 自定义类名 */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** 自定义样式 */
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/** 点击事件 */
|
|
22
|
+
onClick?: (e: React.MouseEvent<SVGSVGElement>) => void;
|
|
23
|
+
/** 是否禁用 */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** 其他属性 */
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
declare const IconUI: React.FC<IconUIProps>;
|
|
29
|
+
export default IconUI;
|
package/dist/IconUI/index.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["name"];
|
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
10
8
|
import { iconMap } from "./material/rally";
|
|
11
9
|
var IconUI = function IconUI(props) {
|
|
12
|
-
var name = props.name
|
|
13
|
-
|
|
10
|
+
var name = props.name;
|
|
11
|
+
var otherProps = Object.assign({}, (_objectDestructuringEmpty(props), props));
|
|
12
|
+
|
|
13
|
+
/// 拦截点击事添加 disabled 使其禁止点击
|
|
14
|
+
if (otherProps.onClick) {
|
|
15
|
+
var onClick = otherProps.onClick;
|
|
16
|
+
otherProps.onClick = function (e) {
|
|
17
|
+
if (!props.disabled) {
|
|
18
|
+
onClick(e);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
14
22
|
|
|
15
23
|
// 直接从 iconMap 获取图标,避免每次都遍历数组
|
|
16
24
|
var current = iconMap[name];
|