@vtx/modals2 5.0.44 → 5.0.46

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.
@@ -1,15 +1,25 @@
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 = ["children"];
3
+ 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
+ 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
+ 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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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 _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; }
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; }
1
10
  import { Tooltip } from 'antd';
2
11
  import useSettings from "../../_hooks/useSettings";
3
12
  import "./style";
4
13
  import { jsx as _jsx } from "react/jsx-runtime";
5
14
  export default function VmFactor(props) {
15
+ var children = props.children,
16
+ rest = _objectWithoutProperties(props, _excluded);
6
17
  var _useSettings = useSettings(),
7
18
  isDark = _useSettings.isDark;
8
19
  return /*#__PURE__*/_jsx("div", {
9
20
  className: "vm-tooltip ".concat(isDark ? 'dark' : ''),
10
- children: /*#__PURE__*/_jsx(Tooltip, {
11
- title: item.name || '',
21
+ children: /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, rest), {}, {
12
22
  children: props.children
13
- })
23
+ }))
14
24
  });
15
25
  }
@@ -1,4 +1,11 @@
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; }
1
7
  import classNames from 'classnames';
8
+ import { useEffect, useRef, useState } from 'react';
2
9
  import { AccessIcon, AlarmIcon, AnalysisIcon, AnnouncementIcon, AnnualInspectionIcon, AppraisalIcon, AppraiseIcon, AssessmentIcon, AssetIcon, AttendanceIcon, CalendarIcon, CaseIcon, ChargingIcon, CollectionIcon, ContractIcon, DeviceIcon, DocumentIcon, EquipmentIcon, EvaluationIcon, FactoryIcon, HistoryIcon, IndexIcon, InspectionIcon, InsuranceIcon, InterviewIcon, LifeCycleIcon, LogIcon, MaintenanceIcon, MeasurementIcon, MeteringIcon, OilIcon, OperationIcon, PointIcon, ProcessIcon, ProductionUnitIcon, RmIcon, RouteIcon, SbzjIcon, SchedulingIcon, ScoreIcon, SparePartsIcon, SpeedCurveIcon, StatisticsIcon, SummaryIcon, SyInfoIcon, TfdIcon, TfrdIcon, ThrowIcon, TrashIcon, VideoIcon, ViolationIcon, WaterIcon, WgrgsIcon, WgxwIcon, WorkConditionIcon, WorkInfoIcon, WorkingConditionIcon, WorkOrderIcon } from "../../_util/iconSvgHtml";
3
10
  import "./index.less";
4
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -9,6 +16,33 @@ var Tabs = function Tabs(props) {
9
16
  active = props.active,
10
17
  _props$theme = props.theme,
11
18
  theme = _props$theme === void 0 ? 'light' : _props$theme;
19
+ var wrapRef = useRef(null);
20
+ var _useState = useState(false),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ isScrollable = _useState2[0],
23
+ setIsScrollable = _useState2[1];
24
+ useEffect(function () {
25
+ var wrapDom = wrapRef.current;
26
+ if (!wrapDom) return undefined;
27
+ var checkScrollable = function checkScrollable() {
28
+ setIsScrollable(wrapDom.scrollWidth > wrapDom.clientWidth + 1);
29
+ };
30
+ checkScrollable();
31
+ var resizeObserver;
32
+ if (typeof ResizeObserver !== 'undefined') {
33
+ resizeObserver = new ResizeObserver(checkScrollable);
34
+ resizeObserver.observe(wrapDom);
35
+ } else {
36
+ window.addEventListener('resize', checkScrollable);
37
+ }
38
+ return function () {
39
+ if (resizeObserver) {
40
+ resizeObserver.disconnect();
41
+ } else {
42
+ window.removeEventListener('resize', checkScrollable);
43
+ }
44
+ };
45
+ }, [tabs]);
12
46
  var iconRender = {
13
47
  'default-base': SummaryIcon,
14
48
  base: SummaryIcon,
@@ -82,28 +116,34 @@ var Tabs = function Tabs(props) {
82
116
  };
83
117
  return tabs.length ? /*#__PURE__*/_jsx("div", {
84
118
  className: 'vm-modal-tabs',
85
- children: tabs.map(function (tab, index) {
86
- var width = 26,
87
- height = 26;
88
- var ComponentIcon = iconRender[tab.key] || SummaryIcon;
89
- return /*#__PURE__*/_jsxs("div", {
90
- onClick: function onClick() {
91
- onChange(tab.key);
92
- },
93
- className: classNames('vm-modal-tabs-item', active === tab.key ? 'vm-modal-tabs-item-active' : 'vm-modal-tabs-item-normal', {
94
- 'vm-modal-tabs-item-dark': theme !== 'light'
95
- }),
96
- children: [ComponentIcon && /*#__PURE__*/_jsx(ComponentIcon, {
97
- width: width,
98
- height: height,
99
- fill: theme === 'light' ? active === tab.key ? '#fff' : '#1F1F1F' : '#fff',
100
- style: {
101
- transform: 'scale(0.55)'
102
- }
103
- }), /*#__PURE__*/_jsx("span", {
104
- children: tab.title
105
- })]
106
- }, index);
119
+ children: /*#__PURE__*/_jsx("div", {
120
+ ref: wrapRef,
121
+ className: classNames('vm-modal-tabs-wrap', {
122
+ 'vm-modal-tabs-wrap-scrollable': isScrollable
123
+ }),
124
+ children: tabs.map(function (tab, index) {
125
+ var width = 26,
126
+ height = 26;
127
+ var ComponentIcon = iconRender[tab.key] || SummaryIcon;
128
+ return /*#__PURE__*/_jsxs("div", {
129
+ onClick: function onClick() {
130
+ onChange(tab.key);
131
+ },
132
+ className: classNames('vm-modal-tabs-item', active === tab.key ? 'vm-modal-tabs-item-active' : 'vm-modal-tabs-item-normal', {
133
+ 'vm-modal-tabs-item-dark': theme !== 'light'
134
+ }),
135
+ children: [ComponentIcon && /*#__PURE__*/_jsx(ComponentIcon, {
136
+ width: width,
137
+ height: height,
138
+ fill: theme === 'light' ? active === tab.key ? '#fff' : '#1F1F1F' : '#fff',
139
+ style: {
140
+ transform: 'scale(0.55)'
141
+ }
142
+ }), /*#__PURE__*/_jsx("span", {
143
+ children: tab.title
144
+ })]
145
+ }, index);
146
+ })
107
147
  })
108
148
  }) : null;
109
149
  };
@@ -4,11 +4,25 @@
4
4
  background: var(--vm-tabs-bg);
5
5
  border-radius: 8px 8px 0 0;
6
6
  border: none;
7
- // border: 2px solid var(--vm-tab-border-color);
8
- display: flex;
9
- justify-content: center;
10
- gap: 16px;
11
- align-items: center;
7
+ .vm-modal-tabs-wrap {
8
+ height: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ gap: 16px;
12
+ align-items: center;
13
+ overflow-x: auto;
14
+ box-sizing: border-box;
15
+ padding: 0 16px;
16
+ &.vm-modal-tabs-wrap-scrollable {
17
+ justify-content: flex-start;
18
+ }
19
+ &::-webkit-scrollbar {
20
+ height: 2px !important;
21
+ }
22
+ &::-webkit-scrollbar-thumb {
23
+ background-color: #d3d7db !important;
24
+ }
25
+ }
12
26
 
13
27
  &-item {
14
28
  display: flex;
@@ -20,7 +34,7 @@
20
34
  cursor: pointer;
21
35
  align-items: center;
22
36
  justify-content: center;
23
-
37
+ flex-shrink: 0;
24
38
  &-active {
25
39
  background: var(--vm-tab-item-active-bg-color);
26
40
  border-radius: 26px;
@@ -10,7 +10,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { ChartIcon, ListIcon } from "../../../_util/iconSvgHtml";
12
12
  import { useSetState } from 'ahooks';
13
- import { Col, Row, Space, Spin } from 'antd';
13
+ import { Col, Row, Space, Spin, message } from 'antd';
14
14
  import classnames from 'classnames';
15
15
  import dayjs from 'dayjs';
16
16
  import * as echarts from 'echarts';
@@ -434,6 +434,13 @@ var MonitorAnalysis = function MonitorAnalysis(_ref) {
434
434
  },
435
435
  filterType: 'rangePicker',
436
436
  filterChange: function filterChange(date) {
437
+ if (!(date !== null && date !== void 0 && date[0]) || !(date !== null && date !== void 0 && date[1])) {
438
+ return;
439
+ }
440
+ if (date[1].diff(date[0], 'd') > 7) {
441
+ message.warning('时间跨度不能超过7天');
442
+ return;
443
+ }
437
444
  setState({
438
445
  startDate: date[0],
439
446
  endDate: date[1]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/modals2",
3
- "version": "5.0.44",
3
+ "version": "5.0.46",
4
4
  "description": "弹窗组件",
5
5
  "license": "MIT",
6
6
  "module": "lib/index.js",