1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports["default"] = void 0;
|
7 |
|
8 | var _vue = require("vue");
|
9 |
|
10 | var _IconBase = _interopRequireDefault(require("./IconBase"));
|
11 |
|
12 | var _twoTonePrimaryColor = require("./twoTonePrimaryColor");
|
13 |
|
14 | var _utils = require("../utils");
|
15 |
|
16 | var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
|
17 |
|
18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
19 |
|
20 | function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
21 |
|
22 | function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
23 |
|
24 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
25 |
|
26 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
27 |
|
28 | function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
29 |
|
30 | function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
31 |
|
32 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
33 |
|
34 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
35 |
|
36 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
37 |
|
38 | 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; }
|
39 |
|
40 |
|
41 | (0, _twoTonePrimaryColor.setTwoToneColor)('#1890ff');
|
42 |
|
43 | var Icon = function Icon(props, context) {
|
44 | var _classObj;
|
45 |
|
46 | var _props$context$attrs = _objectSpread({}, props, context.attrs),
|
47 | cls = _props$context$attrs["class"],
|
48 | icon = _props$context$attrs.icon,
|
49 | spin = _props$context$attrs.spin,
|
50 | rotate = _props$context$attrs.rotate,
|
51 | tabindex = _props$context$attrs.tabindex,
|
52 | twoToneColor = _props$context$attrs.twoToneColor,
|
53 | onClick = _props$context$attrs.onClick,
|
54 | restProps = _objectWithoutProperties(_props$context$attrs, _excluded);
|
55 |
|
56 | var classObj = (_classObj = {
|
57 | anticon: true
|
58 | }, _defineProperty(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty(_classObj, cls, cls), _classObj);
|
59 | var svgClassString = spin === '' || !!spin || icon.name === 'loading' ? 'anticon-spin' : '';
|
60 | var iconTabIndex = tabindex;
|
61 |
|
62 | if (iconTabIndex === undefined && onClick) {
|
63 | iconTabIndex = -1;
|
64 | restProps.tabindex = iconTabIndex;
|
65 | }
|
66 |
|
67 | var svgStyle = rotate ? {
|
68 | msTransform: "rotate(".concat(rotate, "deg)"),
|
69 | transform: "rotate(".concat(rotate, "deg)")
|
70 | } : undefined;
|
71 |
|
72 | var _normalizeTwoToneColo = (0, _utils.normalizeTwoToneColors)(twoToneColor),
|
73 | _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
74 | primaryColor = _normalizeTwoToneColo2[0],
|
75 | secondaryColor = _normalizeTwoToneColo2[1];
|
76 |
|
77 | return (0, _vue.createVNode)("span", _objectSpread({
|
78 | "role": "img",
|
79 | "aria-label": icon.name
|
80 | }, restProps, {
|
81 | "onClick": onClick,
|
82 | "class": classObj
|
83 | }), [(0, _vue.createVNode)(_IconBase["default"], {
|
84 | "class": svgClassString,
|
85 | "icon": icon,
|
86 | "primaryColor": primaryColor,
|
87 | "secondaryColor": secondaryColor,
|
88 | "style": svgStyle
|
89 | }, null)]);
|
90 | };
|
91 |
|
92 | Icon.props = {
|
93 | spin: Boolean,
|
94 | rotate: Number,
|
95 | icon: Object,
|
96 | twoToneColor: String
|
97 | };
|
98 | Icon.displayName = 'AntdIcon';
|
99 | Icon.inheritAttrs = false;
|
100 | Icon.getTwoToneColor = _twoTonePrimaryColor.getTwoToneColor;
|
101 | Icon.setTwoToneColor = _twoTonePrimaryColor.setTwoToneColor;
|
102 | var _default = Icon;
|
103 | exports["default"] = _default; |
\ | No newline at end of file |