@pisell/materials 3.0.12 → 3.0.13
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +20 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +20 -20
- package/es/components/page/index.js +1 -0
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -3
- package/es/locales/en-US.d.ts +0 -2
- package/es/locales/en-US.js +1 -3
- package/es/locales/zh-CN.d.ts +0 -2
- package/es/locales/zh-CN.js +1 -3
- package/es/locales/zh-TW.d.ts +0 -2
- package/es/locales/zh-TW.js +1 -3
- package/lib/components/page/index.js +1 -0
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -9
- package/lib/locales/en-US.d.ts +0 -2
- package/lib/locales/en-US.js +1 -3
- package/lib/locales/zh-CN.d.ts +0 -2
- package/lib/locales/zh-CN.js +1 -3
- package/lib/locales/zh-TW.d.ts +0 -2
- package/lib/locales/zh-TW.js +1 -3
- package/package.json +2 -2
- package/dist/umd/materials.min.css +0 -1
- package/dist/umd/materials.min.js +0 -1
- package/dist/umd/static/DotsSix.57d66266.svg +0 -1
- package/dist/umd/static/arrow-left.e542294f.svg +0 -1
- package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
- package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
- package/dist/umd/static/help-circle.31c9be40.svg +0 -1
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
- package/es/components/select-time/RightPanel/index.d.ts +0 -9
- package/es/components/select-time/RightPanel/index.js +0 -45
- package/es/components/select-time/RightPanel/index.less +0 -22
- package/es/components/select-time/index.d.ts +0 -14
- package/es/components/select-time/index.js +0 -115
- package/es/components/select-time/index.less +0 -16
- package/es/components/select-time/utils.d.ts +0 -9
- package/es/components/select-time/utils.js +0 -42
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +0 -18
- package/es/components/virtual-keyboard/Keyboard/index.js +0 -51
- package/es/components/virtual-keyboard/Keyboard/index.less +0 -32
- package/es/components/virtual-keyboard/Time/index.d.ts +0 -13
- package/es/components/virtual-keyboard/Time/index.js +0 -124
- package/es/components/virtual-keyboard/Time/index.less +0 -0
- package/es/components/virtual-keyboard/Time/utils.d.ts +0 -10
- package/es/components/virtual-keyboard/Time/utils.js +0 -153
- package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -9
- package/es/components/virtual-keyboard/VirtualKeyInput/index.js +0 -76
- package/es/components/virtual-keyboard/VirtualKeyInput/index.less +0 -52
- package/es/components/virtual-keyboard/index.d.ts +0 -14
- package/es/components/virtual-keyboard/index.js +0 -85
- package/es/components/virtual-keyboard/index.less +0 -17
- package/lib/components/select-time/RightPanel/index.d.ts +0 -9
- package/lib/components/select-time/RightPanel/index.js +0 -78
- package/lib/components/select-time/RightPanel/index.less +0 -22
- package/lib/components/select-time/index.d.ts +0 -14
- package/lib/components/select-time/index.js +0 -145
- package/lib/components/select-time/index.less +0 -16
- package/lib/components/select-time/utils.d.ts +0 -9
- package/lib/components/select-time/utils.js +0 -71
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +0 -18
- package/lib/components/virtual-keyboard/Keyboard/index.js +0 -81
- package/lib/components/virtual-keyboard/Keyboard/index.less +0 -32
- package/lib/components/virtual-keyboard/Time/index.d.ts +0 -13
- package/lib/components/virtual-keyboard/Time/index.js +0 -166
- package/lib/components/virtual-keyboard/Time/index.less +0 -0
- package/lib/components/virtual-keyboard/Time/utils.d.ts +0 -10
- package/lib/components/virtual-keyboard/Time/utils.js +0 -162
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -9
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +0 -90
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.less +0 -52
- package/lib/components/virtual-keyboard/index.d.ts +0 -14
- package/lib/components/virtual-keyboard/index.js +0 -131
- package/lib/components/virtual-keyboard/index.less +0 -17
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.707 4.293a1 1 0 0 1 0 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L16.586 13H5a1 1 0 1 1 0-2h11.586l-5.293-5.293a1 1 0 0 1 0-1.414Z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6a1 1 0 0 1 1-1h18a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H9a1 1 0 0 1-1-1Z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18ZM1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11.258-3.976a2 2 0 0 0-2.225 1.308 1 1 0 1 1-1.886-.664 4 4 0 0 1 7.773 1.333c0 1.53-1.135 2.54-1.945 3.081a8.044 8.044 0 0 1-1.686.848l-.035.013-.011.003-.004.002h-.002L11.92 13l.316.949a1 1 0 0 1-.633-1.897l.016-.006.074-.027a6.051 6.051 0 0 0 1.172-.6c.69-.46 1.055-.95 1.055-1.419v-.001a2 2 0 0 0-1.662-1.975ZM11 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.293 3.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L8 6.414V20a1 1 0 1 1-2 0V6.414L3.707 8.707a1 1 0 0 1-1.414-1.414l4-4ZM16 17.586V4a1 1 0 1 1 2 0v13.586l2.293-2.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L16 17.586Z"/></svg>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useEffect } from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
import { sliceDayIntoFiveMinutes, findNextSlice } from "../utils";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
var RightPanel = function RightPanel(props) {
|
|
6
|
-
var value = props.value,
|
|
7
|
-
onChange = props.onChange,
|
|
8
|
-
_props$slice = props.slice,
|
|
9
|
-
slice = _props$slice === void 0 ? 5 : _props$slice;
|
|
10
|
-
var list = useMemo(function () {
|
|
11
|
-
return sliceDayIntoFiveMinutes(slice);
|
|
12
|
-
}, [slice]);
|
|
13
|
-
useEffect(function () {
|
|
14
|
-
console.log(findNextSlice({
|
|
15
|
-
timeSlices: list,
|
|
16
|
-
date: value
|
|
17
|
-
}));
|
|
18
|
-
var nextTime = findNextSlice({
|
|
19
|
-
timeSlices: list,
|
|
20
|
-
date: value
|
|
21
|
-
});
|
|
22
|
-
var scrollDom = document.querySelector(".select-time-right-panel-list");
|
|
23
|
-
var timeDom = document.querySelector("#time".concat(nextTime.replace(":", "")));
|
|
24
|
-
if (scrollDom && timeDom) {
|
|
25
|
-
scrollDom.scrollTop = timeDom.offsetTop;
|
|
26
|
-
}
|
|
27
|
-
}, [value]);
|
|
28
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: "select-time-right-panel"
|
|
30
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
31
|
-
className: "select-time-right-panel-list"
|
|
32
|
-
}, list.map(function (d) {
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: classNames("select-time-right-panel-item", {
|
|
35
|
-
"select-time-right-panel-item-active": d.value === value
|
|
36
|
-
}),
|
|
37
|
-
key: d.value,
|
|
38
|
-
id: "time" + d.value.replace(":", ""),
|
|
39
|
-
onClick: function onClick() {
|
|
40
|
-
onChange(d.value);
|
|
41
|
-
}
|
|
42
|
-
}, d.label);
|
|
43
|
-
})));
|
|
44
|
-
};
|
|
45
|
-
export default RightPanel;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.select-time-right-panel {}
|
|
2
|
-
|
|
3
|
-
.select-time-right-panel-list {
|
|
4
|
-
width: 184px;
|
|
5
|
-
max-height: 511px;
|
|
6
|
-
overflow: auto;
|
|
7
|
-
|
|
8
|
-
.select-time-right-panel-item {
|
|
9
|
-
padding: 16px 8px;
|
|
10
|
-
border-radius: 8px;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
color: var(--Text-Text_1, #1B1B1B);
|
|
13
|
-
font-size: 24px;
|
|
14
|
-
font-style: normal;
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
|
|
17
|
-
&.select-time-right-panel-item-active,
|
|
18
|
-
&:hover {
|
|
19
|
-
background: var(--Gray-100, #F2F4F7);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { VirtualKeyboardTimeProps } from "../virtual-keyboard/Time";
|
|
3
|
-
import { PopoverProps, TimePickerProps } from "antd";
|
|
4
|
-
import "./index.less";
|
|
5
|
-
interface SelectTimeProps {
|
|
6
|
-
value: any;
|
|
7
|
-
onChange: (e: string) => void;
|
|
8
|
-
popoverProps: PopoverProps;
|
|
9
|
-
timePickerProps: TimePickerProps;
|
|
10
|
-
timeProps: VirtualKeyboardTimeProps;
|
|
11
|
-
slice: number;
|
|
12
|
-
}
|
|
13
|
-
declare const SelectTime: (props: SelectTimeProps) => React.JSX.Element;
|
|
14
|
-
export default SelectTime;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
-
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."); }
|
|
4
|
-
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); }
|
|
5
|
-
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; }
|
|
6
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
import React, { useState, useMemo, useEffect } from "react";
|
|
9
|
-
import Time from "../virtual-keyboard/Time";
|
|
10
|
-
import { TimePicker, Popover } from "antd";
|
|
11
|
-
import RightPanel from "./RightPanel";
|
|
12
|
-
import dayjs from "dayjs";
|
|
13
|
-
import "./index.less";
|
|
14
|
-
var SelectTime = function SelectTime(props) {
|
|
15
|
-
var onChange = props.onChange,
|
|
16
|
-
value = props.value,
|
|
17
|
-
popoverProps = props.popoverProps,
|
|
18
|
-
timePickerProps = props.timePickerProps,
|
|
19
|
-
timeProps = props.timeProps,
|
|
20
|
-
slice = props.slice;
|
|
21
|
-
var _useState = useState(false),
|
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
-
open = _useState2[0],
|
|
24
|
-
setOpen = _useState2[1];
|
|
25
|
-
var _useState3 = useState(""),
|
|
26
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
-
_value = _useState4[0],
|
|
28
|
-
set_value = _useState4[1];
|
|
29
|
-
useEffect(function () {
|
|
30
|
-
set_value(value);
|
|
31
|
-
}, [value]);
|
|
32
|
-
var valueString = useMemo(function () {
|
|
33
|
-
if (!_value) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
if (typeof _value === "string") {
|
|
37
|
-
return _value;
|
|
38
|
-
}
|
|
39
|
-
return _value === null || _value === void 0 ? void 0 : _value.valueString;
|
|
40
|
-
}, [_value]);
|
|
41
|
-
var previewValueString = useMemo(function () {
|
|
42
|
-
if (!_value) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
if (typeof _value === "string") {
|
|
46
|
-
return _value;
|
|
47
|
-
}
|
|
48
|
-
return _value === null || _value === void 0 ? void 0 : _value.previewValueString;
|
|
49
|
-
}, [_value]);
|
|
50
|
-
var timePickerValue = useMemo(function () {
|
|
51
|
-
if (!previewValueString) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
return dayjs(dayjs().format("YYYY-MM-DD") + " " + previewValueString);
|
|
55
|
-
}, [previewValueString]);
|
|
56
|
-
var _onChange = function _onChange(e) {
|
|
57
|
-
if (!open) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
set_value(e);
|
|
61
|
-
};
|
|
62
|
-
var _onEnter = function onEnter(e) {
|
|
63
|
-
_onChange(e);
|
|
64
|
-
onOpenChange(false, (e === null || e === void 0 ? void 0 : e.previewValueString) || e);
|
|
65
|
-
};
|
|
66
|
-
var onOpenChange = function onOpenChange(e) {
|
|
67
|
-
var _val = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : previewValueString;
|
|
68
|
-
setOpen(e);
|
|
69
|
-
if (e) {} else {
|
|
70
|
-
if (_val === value) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_val);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// 防止页面过小时出现滚动条 造成页面滚动
|
|
78
|
-
useEffect(function () {
|
|
79
|
-
if (open) {
|
|
80
|
-
document.body.classList.add("hide-scroll");
|
|
81
|
-
} else {
|
|
82
|
-
setTimeout(function () {
|
|
83
|
-
document.body.classList.remove("hide-scroll");
|
|
84
|
-
}, 150);
|
|
85
|
-
}
|
|
86
|
-
}, [open]);
|
|
87
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popover, _extends({
|
|
88
|
-
destroyTooltipOnHide: true,
|
|
89
|
-
content: /*#__PURE__*/React.createElement(Time, _extends({
|
|
90
|
-
onChange: _onChange,
|
|
91
|
-
value: valueString,
|
|
92
|
-
onEnter: function onEnter(e) {
|
|
93
|
-
_onEnter(e);
|
|
94
|
-
},
|
|
95
|
-
rightPanel: /*#__PURE__*/React.createElement(RightPanel, {
|
|
96
|
-
value: previewValueString,
|
|
97
|
-
onChange: _onEnter,
|
|
98
|
-
slice: slice
|
|
99
|
-
})
|
|
100
|
-
}, timeProps)),
|
|
101
|
-
open: open,
|
|
102
|
-
placement: "bottom",
|
|
103
|
-
arrow: false,
|
|
104
|
-
onOpenChange: onOpenChange,
|
|
105
|
-
trigger: ["click"]
|
|
106
|
-
}, popoverProps), /*#__PURE__*/React.createElement(TimePicker, _extends({
|
|
107
|
-
format: "HH:mm",
|
|
108
|
-
size: "large",
|
|
109
|
-
inputReadOnly: true,
|
|
110
|
-
allowClear: false,
|
|
111
|
-
open: false,
|
|
112
|
-
value: timePickerValue
|
|
113
|
-
}, timePickerProps))));
|
|
114
|
-
};
|
|
115
|
-
export default SelectTime;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const sliceDayIntoFiveMinutes: (slice: number) => {
|
|
2
|
-
label: string;
|
|
3
|
-
value: string;
|
|
4
|
-
}[];
|
|
5
|
-
export declare const findNextSlice: ({ timeSlices, index, date }: {
|
|
6
|
-
timeSlices: any[];
|
|
7
|
-
index?: number | undefined;
|
|
8
|
-
date?: string | undefined;
|
|
9
|
-
}) => any;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
export var sliceDayIntoFiveMinutes = function sliceDayIntoFiveMinutes(slice) {
|
|
3
|
-
var startTime = dayjs().startOf("day");
|
|
4
|
-
var endTime = dayjs().endOf("day");
|
|
5
|
-
var timeSlice = slice || 5; // 切片时间间隔(分钟)
|
|
6
|
-
|
|
7
|
-
var timeSlices = [];
|
|
8
|
-
var currentTime = startTime;
|
|
9
|
-
while (currentTime.isBefore(endTime)) {
|
|
10
|
-
var timeLabel = currentTime.format("HH:mm");
|
|
11
|
-
var timeValue = currentTime.format("HH:mm");
|
|
12
|
-
timeSlices.push({
|
|
13
|
-
label: timeLabel,
|
|
14
|
-
value: timeValue
|
|
15
|
-
});
|
|
16
|
-
var nextTime = currentTime.add(timeSlice, "minute");
|
|
17
|
-
currentTime = nextTime;
|
|
18
|
-
}
|
|
19
|
-
return timeSlices;
|
|
20
|
-
};
|
|
21
|
-
export var findNextSlice = function findNextSlice(_ref) {
|
|
22
|
-
var _ref$timeSlices = _ref.timeSlices,
|
|
23
|
-
timeSlices = _ref$timeSlices === void 0 ? [] : _ref$timeSlices,
|
|
24
|
-
_ref$index = _ref.index,
|
|
25
|
-
index = _ref$index === void 0 ? 0 : _ref$index,
|
|
26
|
-
_ref$date = _ref.date,
|
|
27
|
-
date = _ref$date === void 0 ? '' : _ref$date;
|
|
28
|
-
var currentTimeValue = date || dayjs().format('HH:mm');
|
|
29
|
-
|
|
30
|
-
// 遍历时间切片数组,找到最接近的下一个切片时间
|
|
31
|
-
for (var i = 0; i < timeSlices.length; i++) {
|
|
32
|
-
// 排除掉当前时间
|
|
33
|
-
if (timeSlices[i].value !== 'now') {
|
|
34
|
-
if (timeSlices[i].value >= currentTimeValue) {
|
|
35
|
-
return timeSlices[i].value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 如果没有找到比当前时间大的切片时间,则返回第一个切片时间作为下一个切片时间
|
|
41
|
-
return timeSlices[index].value;
|
|
42
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
export declare type ItemValue = string | number;
|
|
4
|
-
export interface Item {
|
|
5
|
-
value: ItemValue;
|
|
6
|
-
label: string;
|
|
7
|
-
disabled: boolean;
|
|
8
|
-
type: "text" | "primary";
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
}
|
|
11
|
-
export interface KeyboardProps {
|
|
12
|
-
className?: string;
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
onChange?: (value?: ItemValue) => void;
|
|
15
|
-
items?: Item[];
|
|
16
|
-
}
|
|
17
|
-
declare const Keyboard: (props: KeyboardProps) => React.JSX.Element;
|
|
18
|
-
export default Keyboard;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Button } from "antd";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
import { useEventListener } from "ahooks";
|
|
6
|
-
var list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ok"];
|
|
7
|
-
var Keyboard = function Keyboard(props) {
|
|
8
|
-
var _props$items = props.items,
|
|
9
|
-
items = _props$items === void 0 ? [] : _props$items,
|
|
10
|
-
className = props.className,
|
|
11
|
-
style = props.style,
|
|
12
|
-
onChange = props.onChange;
|
|
13
|
-
useEventListener("keydown", function (ev) {
|
|
14
|
-
console.log("ev", ev);
|
|
15
|
-
var key = ev.key;
|
|
16
|
-
if (key === "Enter") {
|
|
17
|
-
key = "ok";
|
|
18
|
-
}
|
|
19
|
-
if (list.includes(key)) {
|
|
20
|
-
// let dom = document.querySelector(`#virtual-keyboard-${ev.key}`);
|
|
21
|
-
// if (dom) {
|
|
22
|
-
// dom.click();
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(key);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: classNames("virtual-keyboard-wrap", className),
|
|
30
|
-
style: style
|
|
31
|
-
}, items.map(function (item) {
|
|
32
|
-
var _item$style;
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: "virtual-keyboard-item",
|
|
35
|
-
style: item.style
|
|
36
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
37
|
-
id: "virtual-keyboard-".concat(item.value),
|
|
38
|
-
key: item.value,
|
|
39
|
-
type: item.type,
|
|
40
|
-
className: "virtual-keyboard-item-button",
|
|
41
|
-
style: {
|
|
42
|
-
color: item.type === "primary" ? "#fff" : ((_item$style = item.style) === null || _item$style === void 0 ? void 0 : _item$style.color) || undefined
|
|
43
|
-
},
|
|
44
|
-
disabled: item.disabled,
|
|
45
|
-
onClick: function onClick(e) {
|
|
46
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(item.value);
|
|
47
|
-
}
|
|
48
|
-
}, item.label));
|
|
49
|
-
}));
|
|
50
|
-
};
|
|
51
|
-
export default Keyboard;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.virtual-keyboard-wrap {
|
|
2
|
-
width: 100%;
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-wrap: wrap;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: flex-end;
|
|
7
|
-
gap: 7px;
|
|
8
|
-
|
|
9
|
-
.virtual-keyboard-item {
|
|
10
|
-
border-radius: 5px;
|
|
11
|
-
background: var(--Base-White, #FFF);
|
|
12
|
-
box-shadow: 0px 1px 0px 0px #898A8D;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
width: calc((100% - 14px) / 3 * 1);
|
|
15
|
-
padding-top: 25%;
|
|
16
|
-
position: relative;
|
|
17
|
-
|
|
18
|
-
.virtual-keyboard-item-button {
|
|
19
|
-
position: absolute;
|
|
20
|
-
left: 0;
|
|
21
|
-
top: 0;
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
border-radius: 5px;
|
|
25
|
-
color: var(--Base-Black, #000);
|
|
26
|
-
font-size: 25px;
|
|
27
|
-
font-style: normal;
|
|
28
|
-
font-weight: 400;
|
|
29
|
-
box-shadow: none;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Item } from "../Keyboard";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
export interface VirtualKeyboardTimeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
onChange?: (value?: any) => void;
|
|
7
|
-
value?: any;
|
|
8
|
-
items?: Item[];
|
|
9
|
-
onEnter?: (value: any) => void;
|
|
10
|
-
rightPanel?: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
declare const VirtualKeyboardTime: (props: VirtualKeyboardTimeProps) => React.JSX.Element;
|
|
13
|
-
export default VirtualKeyboardTime;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useEffect } from "react";
|
|
2
|
-
import VirtualKeyboard from "../index";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
import { formatStringToTime } from "./utils.tsx";
|
|
5
|
-
import { getText } from "../../../locales";
|
|
6
|
-
import dayjs from "dayjs";
|
|
7
|
-
var items = [{
|
|
8
|
-
value: 1,
|
|
9
|
-
label: "1",
|
|
10
|
-
disabled: false,
|
|
11
|
-
type: "text"
|
|
12
|
-
}, {
|
|
13
|
-
value: 2,
|
|
14
|
-
label: "2",
|
|
15
|
-
disabled: false,
|
|
16
|
-
type: "text"
|
|
17
|
-
}, {
|
|
18
|
-
value: 3,
|
|
19
|
-
label: "3",
|
|
20
|
-
disabled: false,
|
|
21
|
-
type: "text"
|
|
22
|
-
}, {
|
|
23
|
-
value: 4,
|
|
24
|
-
label: "4",
|
|
25
|
-
disabled: false,
|
|
26
|
-
type: "text"
|
|
27
|
-
}, {
|
|
28
|
-
value: 5,
|
|
29
|
-
label: "5",
|
|
30
|
-
disabled: false,
|
|
31
|
-
type: "text"
|
|
32
|
-
}, {
|
|
33
|
-
value: 6,
|
|
34
|
-
label: "6",
|
|
35
|
-
disabled: false,
|
|
36
|
-
type: "text"
|
|
37
|
-
}, {
|
|
38
|
-
value: 7,
|
|
39
|
-
label: "7",
|
|
40
|
-
disabled: false,
|
|
41
|
-
type: "text"
|
|
42
|
-
}, {
|
|
43
|
-
value: 8,
|
|
44
|
-
label: "8",
|
|
45
|
-
disabled: false,
|
|
46
|
-
type: "text"
|
|
47
|
-
}, {
|
|
48
|
-
value: 9,
|
|
49
|
-
label: "9",
|
|
50
|
-
disabled: false,
|
|
51
|
-
type: "text"
|
|
52
|
-
}, {
|
|
53
|
-
value: "now",
|
|
54
|
-
label: getText("virtual-keyboard-time-now"),
|
|
55
|
-
disabled: false,
|
|
56
|
-
type: "text",
|
|
57
|
-
style: {
|
|
58
|
-
color: "#7f56d9"
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
value: "0",
|
|
62
|
-
label: "0",
|
|
63
|
-
disabled: false,
|
|
64
|
-
type: "text"
|
|
65
|
-
}, {
|
|
66
|
-
value: "ok",
|
|
67
|
-
label: getText("virtual-keyboard-time-ok"),
|
|
68
|
-
disabled: false,
|
|
69
|
-
type: "primary"
|
|
70
|
-
}];
|
|
71
|
-
var VirtualKeyboardTime = function VirtualKeyboardTime(props) {
|
|
72
|
-
var _onChange2 = props.onChange,
|
|
73
|
-
onEnter = props.onEnter,
|
|
74
|
-
style = props.style,
|
|
75
|
-
className = props.className,
|
|
76
|
-
_props$value = props.value,
|
|
77
|
-
value = _props$value === void 0 ? "" : _props$value,
|
|
78
|
-
rightPanel = props.rightPanel;
|
|
79
|
-
useEffect(function () {
|
|
80
|
-
document.body.id = "body";
|
|
81
|
-
}, []);
|
|
82
|
-
var res = useMemo(function () {
|
|
83
|
-
return formatStringToTime(value);
|
|
84
|
-
}, [value]);
|
|
85
|
-
var _onChange = function _onChange(current) {
|
|
86
|
-
if (current === "ok") {
|
|
87
|
-
onEnter === null || onEnter === void 0 ? void 0 : onEnter(formatStringToTime(value));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (current === "now") {
|
|
91
|
-
onEnter === null || onEnter === void 0 ? void 0 : onEnter(dayjs().format("HH:mm"));
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
var _val = res.valueString + current;
|
|
95
|
-
if (res.valueString.length === 4) {
|
|
96
|
-
_val = current + "";
|
|
97
|
-
}
|
|
98
|
-
if (document.querySelector(".virtual-keyboard-input-select")) {
|
|
99
|
-
_val = current + "";
|
|
100
|
-
}
|
|
101
|
-
_onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(formatStringToTime(_val));
|
|
102
|
-
};
|
|
103
|
-
return /*#__PURE__*/React.createElement(VirtualKeyboard, {
|
|
104
|
-
className: className,
|
|
105
|
-
style: style,
|
|
106
|
-
keyboardProps: {
|
|
107
|
-
items: items,
|
|
108
|
-
onChange: function onChange(current) {
|
|
109
|
-
_onChange(current);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
virtualKeyInputProps: {
|
|
113
|
-
value: value,
|
|
114
|
-
onChange: function onChange(e) {
|
|
115
|
-
_onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(formatStringToTime(e.target.value));
|
|
116
|
-
},
|
|
117
|
-
renderInput: function renderInput() {
|
|
118
|
-
return res === null || res === void 0 ? void 0 : res.previewValueArrayDom;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
rightPanel: rightPanel
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
export default VirtualKeyboardTime;
|
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const formatStringToTime: (value: string) => {
|
|
3
|
-
valueArray: string[];
|
|
4
|
-
valueString: string;
|
|
5
|
-
previewValueArray: string[];
|
|
6
|
-
previewValueArrayDom: import("react").JSX.Element[];
|
|
7
|
-
previewValueString: string;
|
|
8
|
-
disabled: never[];
|
|
9
|
-
};
|
|
10
|
-
export declare const fn: () => void;
|