@lemon-fe/components 0.1.130 → 0.1.131

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ waterMark: string;
4
+ }
5
+ export default function WaterMark(props: Props): JSX.Element;
6
+ export {};
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { useEffect, useRef } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ function createImgBase(options) {
5
+ var canvas = document.createElement('canvas');
6
+ var ratio = window.devicePixelRatio;
7
+ canvas.width = options.width * ratio;
8
+ canvas.height = options.height * ratio;
9
+ var ctx = canvas.getContext('2d');
10
+ if (ctx) {
11
+ ctx.font = "".concat(options.fontSize * ratio, "px ").concat(options.fontFamily);
12
+ ctx.fillStyle = options.color;
13
+ ctx.rotate(options.rotateDegree);
14
+ ctx.textAlign = 'center';
15
+ ctx.fillText(options.content, canvas.width / 2, canvas.height / 2);
16
+ }
17
+ return canvas.toDataURL('image/png');
18
+ }
19
+ function genWaterMark(_ref) {
20
+ var className = _ref.className,
21
+ _ref$width = _ref.width,
22
+ width = _ref$width === void 0 ? 225 : _ref$width,
23
+ _ref$height = _ref.height,
24
+ height = _ref$height === void 0 ? 225 : _ref$height,
25
+ _ref$content = _ref.content,
26
+ content = _ref$content === void 0 ? '水印' : _ref$content,
27
+ _ref$fontFamily = _ref.fontFamily,
28
+ fontFamily = _ref$fontFamily === void 0 ? '"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif' : _ref$fontFamily,
29
+ _ref$fontSize = _ref.fontSize,
30
+ fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize,
31
+ _ref$color = _ref.color,
32
+ color = _ref$color === void 0 ? 'rgba(156, 162, 169, 0.1)' : _ref$color,
33
+ _ref$rotate = _ref.rotate,
34
+ rotate = _ref$rotate === void 0 ? -24 : _ref$rotate;
35
+ var option = {
36
+ width: width,
37
+ height: height,
38
+ content: content,
39
+ fontSize: fontSize,
40
+ fontFamily: fontFamily,
41
+ color: color,
42
+ rotateDegree: rotate * Math.PI / 180
43
+ };
44
+ // 为了实现交错水印的效果,此处生成两张位置不同的水印 固定相对位置
45
+ var dataUri = createImgBase(option);
46
+ return ".".concat(className, " {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 10000;\n background-repeat: repeat;\n background-image: url(").concat(dataUri, "), url(").concat(dataUri, ");\n background-size: ").concat(option.width, "px ").concat(option.height, "px;\n background-position: ").concat(width / 2, "px ").concat(height / 2, "px, 0 0;\n pointer-events: none;\n }");
47
+ }
48
+ export default function WaterMark(props) {
49
+ var waterMark = props.waterMark;
50
+ var ref = useRef(null);
51
+ var name = 'EVudqS';
52
+ useEffect(function () {
53
+ if (waterMark && ref.current !== null) {
54
+ ref.current.innerHTML = genWaterMark({
55
+ className: name,
56
+ content: waterMark
57
+ });
58
+ }
59
+ }, [waterMark]);
60
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("style", {
61
+ ref: ref
62
+ }), document.head), /*#__PURE__*/React.createElement("div", {
63
+ className: name
64
+ }));
65
+ }
@@ -19,6 +19,7 @@ interface Props<T> {
19
19
  children?: ReactNode;
20
20
  className?: string;
21
21
  style?: CSSProperties;
22
+ waterMark?: string;
22
23
  }
23
24
  export default function MainFramework<TabType extends {
24
25
  title: string;
@@ -4,6 +4,7 @@ import TabBar from './components/TabBar';
4
4
  import Menu from './components/Menu';
5
5
  import { PREFIX_CLS as prefixCls } from '../constants';
6
6
  import RefreshButton from './components/RefreshButton';
7
+ import WaterMark from './components/WaterMark';
7
8
  export default function MainFramework(props) {
8
9
  var className = props.className,
9
10
  tabs = props.tabs,
@@ -23,7 +24,8 @@ export default function MainFramework(props) {
23
24
  favorites = props.favorites,
24
25
  onFavoritesChange = props.onFavoritesChange,
25
26
  renderMenu = props.renderMenu,
26
- style = props.style;
27
+ style = props.style,
28
+ waterMark = props.waterMark;
27
29
  return /*#__PURE__*/React.createElement("div", {
28
30
  className: classNames("".concat(prefixCls, "-main"), className),
29
31
  style: style
@@ -46,7 +48,9 @@ export default function MainFramework(props) {
46
48
  d: "M3.403 10.313c.194-.163.393-.324.6-.481 1.47-1.123 2.592-2.339 3.333-3.622a7.805 7.805 0 0 0 1.101-4.036L8.427.966C8.159.657 7.906.335 7.67 0c-.26.384-.544.752-.849 1.103a15.52 15.52 0 0 1-2.336 2.165C2.853 4.514 1.67 5.858.938 7.28c.563 1.06 1.391 2.073 2.461 3.027M3.602 12.008a17.318 17.318 0 0 1-.835-.711C1.782 10.4.99 9.44.402 8.437a8.004 8.004 0 0 0 .362 5.91c.677 1.448 1.812 2.814 3.375 4.053.502.398.981.828 1.434 1.288v-.264a8.913 8.913 0 0 1 .99-4.146c-.687-1.157-1.683-2.256-2.96-3.276M11.025 12.036c-1.482 1.092-2.611 2.27-3.355 3.51a7.355 7.355 0 0 0-1.107 3.91l.008 1.173c.272.298.528.61.764.933.263-.372.549-.73.856-1.07a15.398 15.398 0 0 1 2.346-2.098c2.984-2.196 4.486-4.693 4.463-7.42a7.134 7.134 0 0 0-.489-2.537c-.802 1.278-1.971 2.484-3.486 3.597M11.353 9.828c.186.156.371.317.553.485.945-.983 1.668-2.02 2.156-3.096-.675-1.429-1.765-2.778-3.239-4.01-.496-.411-.968-.856-1.414-1.332v.268a9.617 9.617 0 0 1-.972 4.298c.68 1.201 1.661 2.34 2.917 3.387"
47
49
  })))), /*#__PURE__*/React.createElement("div", {
48
50
  className: "".concat(prefixCls, "-nav-title")
49
- }, title)), /*#__PURE__*/React.createElement(TabBar, {
51
+ }, title, waterMark && /*#__PURE__*/React.createElement(WaterMark, {
52
+ waterMark: waterMark
53
+ }))), /*#__PURE__*/React.createElement(TabBar, {
50
54
  tabs: tabs,
51
55
  active: active,
52
56
  onClick: onTabClick,
package/es/Popup/index.js CHANGED
@@ -14,7 +14,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
  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; }
16
16
  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; }
17
- import React, { useState, cloneElement, useRef, isValidElement } from 'react';
17
+ import React, { useState, cloneElement, useRef, isValidElement, useEffect } from 'react';
18
18
  import { Modal, Input, message } from 'antd';
19
19
  import { CloseCircleFilled } from '@ant-design/icons';
20
20
  import { PREFIX_CLS } from '../constants';
@@ -153,6 +153,11 @@ function Popup(props) {
153
153
  }), /*#__PURE__*/React.createElement(SearchIcon, null))
154
154
  });
155
155
  }
156
+ useEffect(function () {
157
+ if (value !== valueProp && valueProp) {
158
+ setValue(valueProp);
159
+ }
160
+ }, [valueProp]);
156
161
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
157
162
  className: "".concat(prefixCls, "-wrapper"),
158
163
  onClick: handleOpen
@@ -8,6 +8,15 @@
8
8
  box-sizing: border-box;
9
9
  height: 100%;
10
10
  padding: @space-v 0;
11
+
12
+ .@{prefixCls}-tree-list-scrollbar{
13
+ display: block !important;
14
+ right: -16px !important;
15
+ }
16
+ .@{prefixCls}-tree-list-scrollbar-thumb{
17
+ background: #DDD !important;
18
+ }
19
+
11
20
  }
12
21
 
13
22
  &-menu-popover {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.130",
3
+ "version": "0.1.131",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -39,5 +39,5 @@
39
39
  "react": "^17.0.2",
40
40
  "react-dom": "^17.0.2"
41
41
  },
42
- "gitHead": "aa14d0c951acdc5db1bd2246dfb4bf6200bf845d"
42
+ "gitHead": "0343d2bace250b1ff4a7dda4c9d240b6c5b14b5e"
43
43
  }