xh-lab-rc 0.1.0 → 0.12.0

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.
@@ -20,8 +20,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  /*
21
21
  * @Author: xqy
22
22
  * @Date: 2024-04-23 13:43:55
23
- * @LastEditors: xqy
24
- * @LastEditTime: 2024-04-29 18:46:14
23
+ * @LastEditors: wusum
24
+ * @LastEditTime: 2024-05-11 13:51:03
25
25
  * @Description: 高拍仪
26
26
  */
27
27
  import { Iconfont } from "../components";
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './style.less';
3
3
  import type { IGtreeProps } from './typing';
4
- declare const LabGroupTree: ({ treeData, GBeforeIcon, showLine, showIcon, isShowNum, treeProperties, onExpand, onSelect, childTitleNode, ...restProps }: IGtreeProps) => React.JSX.Element;
4
+ declare const LabGroupTree: ({ treeData, GBeforeIcon, showLine, showIcon, isShowNum, treeProperties, onExpand, onSelect, childTitleNode, extraNodeProps, ...restProps }: IGtreeProps) => React.JSX.Element;
5
5
  export default LabGroupTree;
@@ -1,21 +1,32 @@
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 = ["treeData", "GBeforeIcon", "showLine", "showIcon", "isShowNum", "treeProperties", "onExpand", "onSelect", "childTitleNode"];
2
+ var _excluded = ["treeData", "GBeforeIcon", "showLine", "showIcon", "isShowNum", "treeProperties", "onExpand", "onSelect", "childTitleNode", "extraNodeProps"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ 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); }
4
9
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
11
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+ 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."); }
14
+ 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); }
15
+ 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; }
16
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
18
  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; }
8
19
  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; }
9
20
  /*
10
21
  * @Author: xqy
11
22
  * @Date: 2024-03-18 16:23:10
12
23
  * @LastEditors: xqy
13
- * @LastEditTime: 2024-04-10 10:09:12
24
+ * @LastEditTime: 2024-05-11 11:23:37
14
25
  * @Description:专业组树形
15
26
  */
16
27
  import { Iconfont } from "../components";
17
28
  import { Tree } from 'antd';
18
- import React from 'react';
29
+ import React, { useEffect, useState } from 'react';
19
30
  import "./style.less";
20
31
  var IconTypes = {
21
32
  '1': 'icon-jian',
@@ -51,7 +62,13 @@ var LabGroupTree = function LabGroupTree(_ref) {
51
62
  onExpand = _ref.onExpand,
52
63
  _onSelect = _ref.onSelect,
53
64
  childTitleNode = _ref.childTitleNode,
65
+ _ref$extraNodeProps = _ref.extraNodeProps,
66
+ extraNodeProps = _ref$extraNodeProps === void 0 ? [] : _ref$extraNodeProps,
54
67
  restProps = _objectWithoutProperties(_ref, _excluded);
68
+ var _useState = useState([]),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ treeList = _useState2[0],
71
+ setTreeList = _useState2[1];
55
72
  //构造标题的结构
56
73
  var customTitle = function customTitle(nodeData) {
57
74
  var NAME = nodeData.NAME,
@@ -120,9 +137,39 @@ var LabGroupTree = function LabGroupTree(_ref) {
120
137
  return _ref2.apply(this, arguments);
121
138
  };
122
139
  }();
140
+
141
+ //递归treeList往树节点添加额外参数
142
+ var recursTree = function recursTree(data, extraNodeProps) {
143
+ if (data && data.length) {
144
+ data.map(function (item) {
145
+ //查找匹配的节点
146
+ var matchingNode = extraNodeProps.find(function (i) {
147
+ return i.NODE_TYPE === item.NODE_TYPE;
148
+ });
149
+ if (matchingNode) {
150
+ return _objectSpread(_objectSpread(_objectSpread({}, item), matchingNode), {}, {
151
+ CHILDREN: recursTree(item.CHILDREN, extraNodeProps)
152
+ });
153
+ } else {
154
+ return _objectSpread(_objectSpread({}, item), {}, {
155
+ CHILDREN: recursTree(item.CHILDREN, extraNodeProps)
156
+ });
157
+ }
158
+ });
159
+ }
160
+ return data;
161
+ };
162
+ useEffect(function () {
163
+ //是否需要自定义
164
+ if (extraNodeProps && extraNodeProps.length) {
165
+ var newTreeData = recursTree(treeData, extraNodeProps);
166
+ setTreeList(newTreeData);
167
+ }
168
+ setTreeList(treeData);
169
+ }, [treeData, extraNodeProps]);
123
170
  return /*#__PURE__*/React.createElement(Tree, _extends({
124
171
  rootClassName: "lab-group-tree",
125
- treeData: treeData,
172
+ treeData: treeList,
126
173
  onSelect: function onSelect(keys, node) {
127
174
  _onSelect === null || _onSelect === void 0 || _onSelect(keys, node);
128
175
  },
@@ -29,4 +29,6 @@ export interface IGtreeProps {
29
29
  treeProperties?: TreeProps;
30
30
  /**是否显示科室/管理/检验专业组下的统计数量 */
31
31
  isShowNum?: boolean;
32
+ /**匹配NODE_TYPE层级,添加除原数据额外的树节点参数 */
33
+ extraNodeProps?: any;
32
34
  }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ListTitleProps {
3
+ titleName: string;
4
+ iconElement: React.ReactNode;
5
+ }
6
+ declare const ListTitle: (props: ListTitleProps) => React.JSX.Element;
7
+ export default ListTitle;
@@ -0,0 +1,13 @@
1
+ import { Button } from 'antd';
2
+ import React from 'react';
3
+ var ListTitle = function ListTitle(props) {
4
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
5
+ ghost: true,
6
+ type: "primary",
7
+ shape: "circle",
8
+ icon: props.iconElement
9
+ }), /*#__PURE__*/React.createElement("span", {
10
+ className: "title"
11
+ }, props.titleName));
12
+ };
13
+ export default ListTitle;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface PdfBookmarksProps {
3
+ Bookmarks: React.FC;
4
+ }
5
+ declare function PdfBookmarks(props: PdfBookmarksProps): React.JSX.Element;
6
+ export default PdfBookmarks;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @Author: wusum
4
+ * @Date: 2024-05-06 11:01:53
5
+ * @LastEditors: wusum
6
+ * @LastEditTime: 2024-05-07 14:06:49
7
+ */
8
+ import { BarsOutlined, TagsOutlined } from '@ant-design/icons';
9
+ import { Timeline } from 'antd';
10
+ import React from 'react';
11
+ import ListTitle from "./ListTitle";
12
+ function PdfBookmarks(props) {
13
+ var timelineItems = [{
14
+ children: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ListTitle, {
15
+ titleName: '目录',
16
+ iconElement: /*#__PURE__*/React.createElement(BarsOutlined, null)
17
+ }))
18
+ }, {
19
+ children: /*#__PURE__*/React.createElement("div", {
20
+ className: "content"
21
+ }, /*#__PURE__*/React.createElement(props.Bookmarks, null))
22
+ }, {
23
+ children: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ListTitle, {
24
+ titleName: '书签',
25
+ iconElement: /*#__PURE__*/React.createElement(TagsOutlined, null)
26
+ }))
27
+ }];
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ className: "book-marks"
30
+ }, /*#__PURE__*/React.createElement(Timeline, {
31
+ items: timelineItems
32
+ }));
33
+ }
34
+ export default PdfBookmarks;
@@ -0,0 +1,5 @@
1
+ export declare const enum SHOWMODE {
2
+ NormalMode = 0,// 预览模式
3
+ PrintMode = 1,// 打印模式
4
+ BookMarkMode = 2
5
+ }
@@ -0,0 +1,12 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @Author: wusum
4
+ * @Date: 2024-05-11 14:53:12
5
+ * @LastEditors: wusum
6
+ * @LastEditTime: 2024-05-11 15:05:50
7
+ */
8
+ export var SHOWMODE = {
9
+ NormalMode: 0,
10
+ PrintMode: 1,
11
+ BookMarkMode: 2
12
+ }; // 书签模式
@@ -1,8 +1,21 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
+ import { SHOWMODE } from './enum/index';
2
3
  import './style.less';
3
- interface IndexProps {
4
+ interface PdfViewerProps {
4
5
  src: string;
5
- waterMark?: string;
6
+ fileId?: string;
7
+ showMode: SHOWMODE;
8
+ isShowCheck?: boolean;
9
+ checkedKey?: any[];
10
+ selectBookMask?: any;
11
+ selectedNode?: string[];
12
+ timeout?: number;
13
+ printSpacingTime?: number;
14
+ onIdsChange?: (string: any, Array: any) => void;
15
+ onChangeBookmarkDatas?: (any: any) => void;
16
+ onTimeoutCallback?: () => void;
17
+ onBeforePrintCallback?: () => void;
18
+ onAfterPrintCallback?: () => void;
6
19
  }
7
- declare const LabPdfView: React.FC<IndexProps>;
20
+ declare const LabPdfView: ({ src, onIdsChange, isShowCheck, checkedKey, selectBookMask, fileId, onChangeBookmarkDatas, onBeforePrintCallback, onAfterPrintCallback, onTimeoutCallback, showMode, timeout, printSpacingTime, }: PdfViewerProps) => React.JSX.Element;
8
21
  export default LabPdfView;
@@ -1,12 +1,317 @@
1
- import React from 'react';
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ /*
8
+ * @Descripttion:
9
+ * @Author: wusum
10
+ * @Date: 2024-04-11 16:50:48
11
+ * @LastEditors: wusum
12
+ * @LastEditTime: 2024-05-22 17:06:51
13
+ */
14
+ import { UnorderedListOutlined } from '@ant-design/icons';
15
+ import { Button, Empty, Tree } from 'antd';
16
+ import * as React from 'react';
17
+ import { useEffect, useRef, useState } from 'react';
18
+ import { SHOWMODE } from "./enum/index";
2
19
  import "./style.less";
3
20
  var LabPdfView = function LabPdfView(_ref) {
4
21
  var src = _ref.src,
5
- _ref$waterMark = _ref.waterMark,
6
- waterMark = _ref$waterMark === void 0 ? '' : _ref$waterMark;
7
- return /*#__PURE__*/React.createElement("iframe", {
8
- className: "pdf-iframe",
9
- src: "/statics/pdfjs/web/viewer.html?file=".concat(src).concat(waterMark ? '&watermark=' + waterMark : '')
10
- });
22
+ onIdsChange = _ref.onIdsChange,
23
+ _ref$isShowCheck = _ref.isShowCheck,
24
+ isShowCheck = _ref$isShowCheck === void 0 ? true : _ref$isShowCheck,
25
+ _ref$checkedKey = _ref.checkedKey,
26
+ checkedKey = _ref$checkedKey === void 0 ? [] : _ref$checkedKey,
27
+ selectBookMask = _ref.selectBookMask,
28
+ fileId = _ref.fileId,
29
+ onChangeBookmarkDatas = _ref.onChangeBookmarkDatas,
30
+ onBeforePrintCallback = _ref.onBeforePrintCallback,
31
+ onAfterPrintCallback = _ref.onAfterPrintCallback,
32
+ onTimeoutCallback = _ref.onTimeoutCallback,
33
+ _ref$showMode = _ref.showMode,
34
+ showMode = _ref$showMode === void 0 ? SHOWMODE.NormalMode : _ref$showMode,
35
+ _ref$timeout = _ref.timeout,
36
+ timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout,
37
+ _ref$printSpacingTime = _ref.printSpacingTime,
38
+ printSpacingTime = _ref$printSpacingTime === void 0 ? 500 : _ref$printSpacingTime;
39
+ var pdfIframe = useRef();
40
+ var ids = [];
41
+ var isTimeout = false;
42
+ var isWork = false;
43
+ var _useState = useState([]),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ bookMarks = _useState2[0],
46
+ setBookmarks = _useState2[1];
47
+
48
+ // 选择书签
49
+ function handleOnSelect(selectedKeys, info) {
50
+ var iframeWindow = pdfIframe.current.contentWindow;
51
+ if (info.node.dest) {
52
+ iframeWindow.PDFViewerApplication.pdfLinkService.goToDestination(info.node.dest);
53
+ }
54
+ }
55
+
56
+ // 勾选书签
57
+ function handleOnCheck(checkedKeys, event) {
58
+ ids = [];
59
+ event.checkedNodesPositions.forEach(function (v) {
60
+ ids.push({
61
+ dirLabelName: v.node.title,
62
+ dirLabelId: v.pos
63
+ });
64
+ });
65
+ if (onIdsChange) {
66
+ onIdsChange(fileId, ids);
67
+ }
68
+ }
69
+
70
+ // 加上书签id,和tree一致
71
+ function addItemId(t, j) {
72
+ t.forEach(function (e, i) {
73
+ e.id = j + '-' + i;
74
+ if (e.items.length > 0) {
75
+ addItemId(e.items, e.id);
76
+ }
77
+ });
78
+ }
79
+
80
+ // find 书签
81
+ function find(t, id) {
82
+ var item = {};
83
+ function findItem(t, id) {
84
+ for (var index = 0; index < t.length; index++) {
85
+ if (t[index].id === id) {
86
+ item = t[index];
87
+ return;
88
+ }
89
+ if (t[index].items.length > 0) {
90
+ findItem(t[index].items, id);
91
+ }
92
+ }
93
+ }
94
+ findItem(t, id);
95
+ return item;
96
+ }
97
+
98
+ // 加载完成后,已经可以操作iframeWindow
99
+ // 需要确保pdfjs已经基本完成初始化
100
+ // 采用定时轮询
101
+ var interval, interval1, interval2;
102
+ var loadSuccessPrint = function loadSuccessPrint() {
103
+ if (isTimeout) return;
104
+ setTimeout(function () {
105
+ if (isTimeout) return;
106
+ isWork = true;
107
+ console.log(pdfIframe.current.contentWindow.PDFViewerApplication);
108
+ pdfIframe.current.contentWindow.PDFViewerApplication.triggerPrinting();
109
+ }, printSpacingTime);
110
+ };
111
+ var loadSuccessBookMask = function loadSuccessBookMask(bookMarksList) {
112
+ if (isTimeout) return;
113
+ if (bookMarksList) {
114
+ addItemId(bookMarksList, '0-0');
115
+ setBookmarks([{
116
+ isLeaf: false,
117
+ title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
118
+ type: "primary",
119
+ shape: "circle",
120
+ icon: /*#__PURE__*/React.createElement(UnorderedListOutlined, null)
121
+ }), /*#__PURE__*/React.createElement("span", {
122
+ style: {
123
+ color: '#1677ff',
124
+ marginLeft: '15px'
125
+ }
126
+ }, "\u4E66\u7B7E")),
127
+ checkable: false,
128
+ icon: /*#__PURE__*/React.createElement(Button, {
129
+ type: "primary",
130
+ icon: /*#__PURE__*/React.createElement(UnorderedListOutlined, null)
131
+ }),
132
+ id: '0',
133
+ items: bookMarksList
134
+ }]);
135
+ onChangeBookmarkDatas === null || onChangeBookmarkDatas === void 0 || onChangeBookmarkDatas(bookMarksList);
136
+ if (selectBookMask) {
137
+ var iframeWindow = pdfIframe.current.contentWindow;
138
+ var info = find(bookMarks, selectBookMask['dirLabelId']);
139
+ if (info.dest) {
140
+ iframeWindow.PDFViewerApplication.pdfLinkService.goToDestination(info.dest);
141
+ }
142
+ }
143
+ }
144
+ };
145
+ var loadMarksList = function loadMarksList(iframeWindow) {
146
+ var outline = iframeWindow.PDFViewerApplication.pdfOutlineViewer._outline;
147
+ if (outline === null) {
148
+ // 还在null时
149
+ // 书签组件在 iframeWindow-》PDFViewerApplication-》pdfOutlineViewer-》_outline
150
+ // 通过劫持_outline,得到书签读取完成的回调;
151
+ Object.defineProperty(iframeWindow.PDFViewerApplication.pdfOutlineViewer, '_outline', {
152
+ set: function set(newvalue) {
153
+ console.log('Loading bookMarksList Success_!');
154
+ setTimeout(function () {
155
+ loadSuccessBookMask(newvalue);
156
+ }, 250);
157
+ clearInterval(interval1);
158
+ }
159
+ });
160
+ } else {
161
+ console.log('Loading bookMarksList Success!');
162
+ clearInterval(interval1);
163
+ setTimeout(function () {
164
+ loadSuccessBookMask(outline);
165
+ }, 250);
166
+ }
167
+ };
168
+ var loadPdfDocument = function loadPdfDocument(iframeWindow) {
169
+ if (iframeWindow.PDFViewerApplication.pdfDocument === null) {
170
+ console.info('Loading pdfDocument...');
171
+ } else {
172
+ console.info('Loading pdfDocument Success!');
173
+ clearInterval(interval2);
174
+ loadSuccessPrint();
175
+ }
176
+ };
177
+ var loadPDFOutlineViewer = function loadPDFOutlineViewer(iframeWindow) {
178
+ if (isTimeout) return;
179
+ if (iframeWindow.PDFViewerApplication.pdfOutlineViewer === null) {
180
+ console.info('Loading pdfOutlineViewer...');
181
+ } else {
182
+ console.info('Loading pdfOutlineViewer Success!');
183
+ clearInterval(interval1);
184
+ loadMarksList(iframeWindow);
185
+ }
186
+ };
187
+ var loadPDFViewerApplication = function loadPDFViewerApplication(iframeWindow) {
188
+ if (isTimeout) return;
189
+ if (iframeWindow.PDFViewerApplication === null) {
190
+ console.info('Loading PDFViewerApplication...');
191
+ } else {
192
+ console.info('Loading PDFViewerApplication Success!');
193
+ clearInterval(interval);
194
+ if (showMode === SHOWMODE.BookMarkMode || showMode === SHOWMODE.NormalMode) {
195
+ interval1 = setInterval(function () {
196
+ loadPDFOutlineViewer(iframeWindow);
197
+ }, 100);
198
+ }
199
+ if (showMode === SHOWMODE.PrintMode) {
200
+ interval2 = setInterval(function () {
201
+ loadPdfDocument(iframeWindow);
202
+ }, 100);
203
+ }
204
+ }
205
+ };
206
+ useEffect(function () {
207
+ // SHOWMODE.BookMarkMode
208
+ if (showMode === SHOWMODE.BookMarkMode && pdfIframe.current) {
209
+ var iframeWindow = pdfIframe.current.contentWindow;
210
+ if (iframeWindow) {
211
+ // 监听iframe中的load事件
212
+ // 注:组件重绘不会引起执行第二次
213
+ iframeWindow.addEventListener('load', function () {
214
+ interval = setInterval(function () {
215
+ loadPDFViewerApplication(iframeWindow);
216
+ }, 100);
217
+ });
218
+ }
219
+ }
220
+
221
+ // SHOWMODE.NormalMode
222
+ if (showMode === SHOWMODE.NormalMode) {
223
+ var _iframeWindow = pdfIframe.current.contentWindow;
224
+ if (_iframeWindow) {
225
+ // 监听iframe中的load事件
226
+ // 注:组件重绘不会引起执行第二次
227
+ _iframeWindow.addEventListener('load', function () {
228
+ interval = setInterval(function () {
229
+ loadPDFViewerApplication(_iframeWindow);
230
+ }, 100);
231
+ });
232
+ }
233
+ }
234
+ // SHOWMODE.PrintMode
235
+ if (showMode === SHOWMODE.PrintMode && pdfIframe.current) {
236
+ var _iframeWindow2 = pdfIframe.current.contentWindow;
237
+ if (_iframeWindow2) {
238
+ // 监听iframe中的事件
239
+ _iframeWindow2.addEventListener('load', function () {
240
+ interval = setInterval(function () {
241
+ loadPDFViewerApplication(_iframeWindow2);
242
+ }, 100);
243
+ });
244
+ _iframeWindow2.onbeforeprint = function () {
245
+ onBeforePrintCallback === null || onBeforePrintCallback === void 0 || onBeforePrintCallback();
246
+ };
247
+ _iframeWindow2.onafterprint = function () {
248
+ onAfterPrintCallback === null || onAfterPrintCallback === void 0 || onAfterPrintCallback();
249
+ };
250
+ //超时
251
+ setTimeout(function () {
252
+ clearInterval(interval);
253
+ clearInterval(interval1);
254
+ clearInterval(interval2);
255
+ isTimeout = true;
256
+ if (isWork) return;
257
+ onTimeoutCallback === null || onTimeoutCallback === void 0 || onTimeoutCallback();
258
+ }, timeout);
259
+ }
260
+ }
261
+ return function () {
262
+ clearInterval(interval);
263
+ clearInterval(interval1);
264
+ clearInterval(interval2);
265
+ };
266
+ }, []);
267
+ var pfdStyle = function pfdStyle() {
268
+ var s = {};
269
+ switch (showMode) {
270
+ case SHOWMODE.BookMarkMode:
271
+ s.width = 'calc(100% - 200px)';
272
+ break;
273
+ case SHOWMODE.NormalMode:
274
+ s.width = '100%';
275
+ break;
276
+ case SHOWMODE.PrintMode:
277
+ s.width = '0px';
278
+ s.height = '0px';
279
+ break;
280
+ }
281
+ return s;
282
+ };
283
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
284
+ className: "lab-pdf-view"
285
+ }, /*#__PURE__*/React.createElement("div", {
286
+ className: "view-box",
287
+ style: pfdStyle()
288
+ }, /*#__PURE__*/React.createElement("iframe", {
289
+ ref: pdfIframe,
290
+ style: {
291
+ width: '100%',
292
+ height: '100%'
293
+ },
294
+ src: "/statics/pdfjs/web/viewer.html?file=".concat(src)
295
+ })), showMode === SHOWMODE.BookMarkMode ? /*#__PURE__*/React.createElement("div", {
296
+ className: "bookmarks-box"
297
+ }, bookMarks.length <= 0 ? /*#__PURE__*/React.createElement(Empty, {
298
+ description: "\u6682\u65E0\u4E66\u7B7E"
299
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tree, {
300
+ selectedKeys: [selectBookMask === null || selectBookMask === void 0 ? void 0 : selectBookMask.dirLabelId],
301
+ checkable: isShowCheck,
302
+ showLine: true,
303
+ defaultExpandAll: true,
304
+ defaultCheckedKeys: checkedKey && checkedKey.map(function (v) {
305
+ return v.dirLabelId;
306
+ }),
307
+ onSelect: handleOnSelect,
308
+ onCheck: handleOnCheck,
309
+ treeData: bookMarks,
310
+ fieldNames: {
311
+ title: 'title',
312
+ key: 'id',
313
+ children: 'items'
314
+ }
315
+ }))) : ''));
11
316
  };
12
317
  export default LabPdfView;
@@ -1,18 +1,18 @@
1
- .img-wrap {
2
- width: 100%;
3
- height: 100%;
4
- margin: 0;
5
- overflow: hidden;
6
- background: #fff;
1
+ // .img-wrap {
2
+ // width: 100%;
3
+ // height: 100%;
4
+ // margin: 0;
5
+ // overflow: hidden;
6
+ // background: #fff;
7
7
 
8
- img {
9
- display: block;
10
- width: auto;
11
- max-width: 94%;
12
- height: auto;
13
- max-height: 94%;
14
- }
15
- }
8
+ // img {
9
+ // display: block;
10
+ // width: auto;
11
+ // max-width: 94%;
12
+ // height: auto;
13
+ // max-height: 94%;
14
+ // }
15
+ // }
16
16
 
17
17
  .pdf-iframe {
18
18
  width: 100%;
@@ -20,3 +20,25 @@
20
20
  border: none;
21
21
  outline: none;
22
22
  }
23
+
24
+ .lab-pdf-view {
25
+ display: flex;
26
+ width: 100%;
27
+ height: 100%;
28
+
29
+ .view-box {
30
+ width: calc(100% - 200px);
31
+ height: 100%;
32
+ overflow: hidden;
33
+ }
34
+
35
+ .bookmarks-box {
36
+ width: 200px;
37
+ padding: 10px;
38
+ font-size: 18px;
39
+
40
+ .bookmasks-ol {
41
+ list-style-type: none;
42
+ }
43
+ }
44
+ }
@@ -11,8 +11,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  /*
12
12
  * @Author: xqy
13
13
  * @Date: 2024-04-10 11:04:12
14
- * @LastEditors: xqy
15
- * @LastEditTime: 2024-04-17 10:37:14
14
+ * @LastEditors: wusum
15
+ * @LastEditTime: 2024-05-11 16:47:26
16
16
  * @Description:图片轮播切换组件(支持pdf切换预览)
17
17
  */
18
18
  import { CloseOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons';
@@ -44,7 +44,7 @@ var LabPictureCarousel = function LabPictureCarousel(props) {
44
44
  var _useState5 = useState(1),
45
45
  _useState6 = _slicedToArray(_useState5, 2),
46
46
  scale = _useState6[0],
47
- setScale = _useState6[1];
47
+ setScale = _useState6[1]; //初始缩放比例
48
48
  var _useState7 = useState([]),
49
49
  _useState8 = _slicedToArray(_useState7, 2),
50
50
  list = _useState8[0],
@@ -54,11 +54,9 @@ var LabPictureCarousel = function LabPictureCarousel(props) {
54
54
  var handleWheel = function handleWheel(event) {
55
55
  // event.preventDefault() //阻止默认的滚动行为,防止浏览器默认进行页面滚动
56
56
  var scaleChange = event.deltaY > 0 ? -0.1 : 0.1;
57
- var newScale = scale + scaleChange; // 计算新的缩放比例
58
- // 限制缩放比例在一定范围内(0.5到2之间)限制放大和缩小的范围
59
- if (newScale >= 0.2 && newScale <= 3) {
60
- setScale(newScale);
61
- }
57
+ //计算缩放比例,限制缩放比例在(0.5到4之间),防止过大或过小
58
+ var newScale = Math.min(Math.max(0.2, scale + scaleChange), 3);
59
+ setScale(newScale);
62
60
  };
63
61
 
64
62
  //点击切换事件
@@ -90,6 +88,14 @@ var LabPictureCarousel = function LabPictureCarousel(props) {
90
88
  close === null || close === void 0 || close();
91
89
  setScale(1); //恢复到初始图片的尺寸状态
92
90
  };
91
+
92
+ //监听esc事件
93
+ var handleKeyDown = function handleKeyDown(event) {
94
+ if (event !== null && event !== void 0 && event.key && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
95
+ // esc键盘被按下
96
+ closeCarousel();
97
+ }
98
+ };
93
99
  useEffect(function () {
94
100
  if (Array.isArray(imgList) && imgList.length) {
95
101
  var _document$getElements, _document;
@@ -116,9 +122,14 @@ var LabPictureCarousel = function LabPictureCarousel(props) {
116
122
  return item;
117
123
  });
118
124
  }
125
+ //监听按键事件
126
+ document.addEventListener('keydown', handleKeyDown);
119
127
  }
120
128
  setIsShow(visible);
121
129
  setCurIndex(curImgIndex !== null && curImgIndex !== void 0 ? curImgIndex : 0);
130
+ return function () {
131
+ document.addEventListener('keydown', handleKeyDown);
132
+ };
122
133
  }, [visible]);
123
134
  return isShow && /*#__PURE__*/React.createElement("div", {
124
135
  className: cn('about-wrap')
@@ -147,13 +158,16 @@ var LabPictureCarousel = function LabPictureCarousel(props) {
147
158
  }, /*#__PURE__*/React.createElement("div", {
148
159
  className: cn('imgContainer', list[curIndex].fileType === 'pdf' && 'pdfStyle')
149
160
  }, list[curIndex].fileType === 'pdf' ? /*#__PURE__*/React.createElement(LabPdfView, {
161
+ showMode: 1,
150
162
  src: list[curIndex].filePath
151
163
  }) : /*#__PURE__*/React.createElement("img", {
152
164
  style: {
153
165
  maxWidth: '100%',
154
166
  maxHeight: '100%',
155
- transform: "scale(".concat(scale, ")"),
156
- transition: 'transform 0.25s ease' // 添加平滑的缩放过渡效果
167
+ transform: "scale3d(".concat(scale, ", ").concat(scale, ", 1)"),
168
+ transition: 'transform 0.25s ease',
169
+ // 添加平滑的缩放过渡效果
170
+ cursor: 'grab'
157
171
  },
158
172
  src: list[curIndex].filePath,
159
173
  onWheel: handleWheel
package/package.json CHANGED
@@ -1,78 +1,74 @@
1
- {
2
- "name": "xh-lab-rc",
3
- "version": "0.1.0",
4
- "description": " A react library for xinhelab",
5
- "license": "MIT",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "father build",
13
- "build:watch": "father dev",
14
- "dev": "dumi dev",
15
- "docs:build": "dumi build",
16
- "doctor": "father doctor",
17
- "lint": "npm run lint:es && npm run lint:css",
18
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
19
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
20
- "prepare": "husky install && dumi setup",
21
- "prepublishOnly": "father doctor && npm run build",
22
- "start": "npm run dev"
23
- },
24
- "commitlint": {
25
- "extends": [
26
- "@commitlint/config-conventional"
27
- ]
28
- },
29
- "lint-staged": {
30
- "*.{md,json}": [
31
- "prettier --write --no-error-on-unmatched-pattern"
32
- ],
33
- "*.{css,less}": [
34
- "stylelint --fix",
35
- "prettier --write"
36
- ],
37
- "*.{js,jsx}": [
38
- "eslint --fix",
39
- "prettier --write"
40
- ],
41
- "*.{ts,tsx}": [
42
- "eslint --fix",
43
- "prettier --parser=typescript --write"
44
- ]
45
- },
46
- "dependencies": {
47
- "@ant-design/icons": "^5.3.5",
48
- "antd": "^5.15.3",
49
- "classnames": "^2.5.1",
50
- "dayjs": "^1.11.10"
51
- },
52
- "devDependencies": {
53
- "@commitlint/cli": "^17.1.2",
54
- "@commitlint/config-conventional": "^17.1.0",
55
- "@types/react": "^18.0.0",
56
- "@types/react-dom": "^18.0.0",
57
- "@umijs/lint": "^4.0.0",
58
- "dumi": "^2.2.13",
59
- "eslint": "^8.23.0",
60
- "father": "^4.1.0",
61
- "husky": "^8.0.1",
62
- "lint-staged": "^13.0.3",
63
- "prettier": "^2.7.1",
64
- "prettier-plugin-organize-imports": "^3.0.0",
65
- "prettier-plugin-packagejson": "^2.2.18",
66
- "react": "^18.0.0",
67
- "react-dom": "^18.0.0",
68
- "stylelint": "^14.9.1"
69
- },
70
- "peerDependencies": {
71
- "react": ">=16.9.0",
72
- "react-dom": ">=16.9.0"
73
- },
74
- "publishConfig": {
75
- "access": "public"
76
- },
77
- "authors": []
78
- }
1
+ {
2
+ "name": "xh-lab-rc",
3
+ "version": "0.12.0",
4
+ "description": " A react library for xinhelab",
5
+ "license": "MIT",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "father build",
13
+ "build:watch": "father dev",
14
+ "dev": "dumi dev",
15
+ "docs:build": "dumi build",
16
+ "doctor": "father doctor",
17
+ "lint": "npm run lint:es && npm run lint:css",
18
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
19
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
20
+ "prepare": "husky install && dumi setup",
21
+ "prepublishOnly": "father doctor && npm run build",
22
+ "start": "npm run dev"
23
+ },
24
+ "commitlint": {
25
+ "extends": [
26
+ "@commitlint/config-conventional"
27
+ ]
28
+ },
29
+ "lint-staged": {
30
+ "*.{md,json}": [
31
+ "prettier --write --no-error-on-unmatched-pattern"
32
+ ],
33
+ "*.{css,less}": [
34
+ "stylelint --fix",
35
+ "prettier --write"
36
+ ],
37
+ "*.{js,jsx}": [
38
+ "eslint --fix",
39
+ "prettier --write"
40
+ ],
41
+ "*.{ts,tsx}": [
42
+ "eslint --fix",
43
+ "prettier --parser=typescript --write"
44
+ ]
45
+ },
46
+ "dependencies": {
47
+ "@ant-design/icons": "^5.3.5",
48
+ "antd": "^5.15.3",
49
+ "classnames": "^2.5.1",
50
+ "dayjs": "^1.11.10"
51
+ },
52
+ "devDependencies": {
53
+ "@commitlint/cli": "^17.1.2",
54
+ "@commitlint/config-conventional": "^17.1.0",
55
+ "@types/react": "^18.0.0",
56
+ "@types/react-dom": "^18.0.0",
57
+ "@umijs/lint": "^4.0.0",
58
+ "dumi": "^2.2.13",
59
+ "eslint": "^8.23.0",
60
+ "father": "^4.1.0",
61
+ "husky": "^8.0.1",
62
+ "lint-staged": "^13.0.3",
63
+ "prettier": "^2.7.1",
64
+ "prettier-plugin-organize-imports": "^3.0.0",
65
+ "prettier-plugin-packagejson": "^2.2.18",
66
+ "react": "^18.0.0",
67
+ "react-dom": "^18.0.0",
68
+ "stylelint": "^14.9.1"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "authors": []
74
+ }