@pisell/materials 3.0.13 → 3.0.14
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/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/page/index.js +12 -9
- package/es/components/select-time/RightPanel/index.d.ts +9 -0
- package/es/components/select-time/RightPanel/index.js +45 -0
- package/es/components/select-time/RightPanel/index.less +22 -0
- package/es/components/select-time/index.d.ts +14 -0
- package/es/components/select-time/index.js +115 -0
- package/es/components/select-time/index.less +16 -0
- package/es/components/select-time/utils.d.ts +9 -0
- package/es/components/select-time/utils.js +42 -0
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +18 -0
- package/es/components/virtual-keyboard/Keyboard/index.js +51 -0
- package/es/components/virtual-keyboard/Keyboard/index.less +32 -0
- package/es/components/virtual-keyboard/Time/index.d.ts +13 -0
- package/es/components/virtual-keyboard/Time/index.js +124 -0
- package/es/components/virtual-keyboard/Time/index.less +0 -0
- package/es/components/virtual-keyboard/Time/utils.d.ts +10 -0
- package/es/components/virtual-keyboard/Time/utils.js +153 -0
- package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +9 -0
- package/es/components/virtual-keyboard/VirtualKeyInput/index.js +76 -0
- package/es/components/virtual-keyboard/VirtualKeyInput/index.less +52 -0
- package/es/components/virtual-keyboard/index.d.ts +14 -0
- package/es/components/virtual-keyboard/index.js +85 -0
- package/es/components/virtual-keyboard/index.less +17 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/locales/en-US.d.ts +2 -0
- package/es/locales/en-US.js +3 -1
- package/es/locales/zh-CN.d.ts +2 -0
- package/es/locales/zh-CN.js +3 -1
- package/es/locales/zh-TW.d.ts +2 -0
- package/es/locales/zh-TW.js +3 -1
- package/lib/components/page/index.js +6 -7
- package/lib/components/select-time/RightPanel/index.d.ts +9 -0
- package/lib/components/select-time/RightPanel/index.js +78 -0
- package/lib/components/select-time/RightPanel/index.less +22 -0
- package/lib/components/select-time/index.d.ts +14 -0
- package/lib/components/select-time/index.js +145 -0
- package/lib/components/select-time/index.less +16 -0
- package/lib/components/select-time/utils.d.ts +9 -0
- package/lib/components/select-time/utils.js +71 -0
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +18 -0
- package/lib/components/virtual-keyboard/Keyboard/index.js +81 -0
- package/lib/components/virtual-keyboard/Keyboard/index.less +32 -0
- package/lib/components/virtual-keyboard/Time/index.d.ts +13 -0
- package/lib/components/virtual-keyboard/Time/index.js +166 -0
- package/lib/components/virtual-keyboard/Time/index.less +0 -0
- package/lib/components/virtual-keyboard/Time/utils.d.ts +10 -0
- package/lib/components/virtual-keyboard/Time/utils.js +162 -0
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +9 -0
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +90 -0
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.less +52 -0
- package/lib/components/virtual-keyboard/index.d.ts +14 -0
- package/lib/components/virtual-keyboard/index.js +131 -0
- package/lib/components/virtual-keyboard/index.less +17 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +9 -0
- package/lib/locales/en-US.d.ts +2 -0
- package/lib/locales/en-US.js +3 -1
- package/lib/locales/zh-CN.d.ts +2 -0
- package/lib/locales/zh-CN.js +3 -1
- package/lib/locales/zh-TW.d.ts +2 -0
- package/lib/locales/zh-TW.js +3 -1
- package/lowcode/select-time/meta.ts +8 -8
- package/package.json +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/select-time/index.tsx
|
|
30
|
+
var select_time_exports = {};
|
|
31
|
+
__export(select_time_exports, {
|
|
32
|
+
default: () => select_time_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(select_time_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_Time = __toESM(require("../virtual-keyboard/Time"));
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_RightPanel = __toESM(require("./RightPanel"));
|
|
39
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
40
|
+
var import_index = require("./index.less");
|
|
41
|
+
var SelectTime = (props) => {
|
|
42
|
+
const { onChange, value, popoverProps, timePickerProps, timeProps, slice } = props;
|
|
43
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
44
|
+
const [_value, set_value] = (0, import_react.useState)("");
|
|
45
|
+
(0, import_react.useEffect)(() => {
|
|
46
|
+
set_value(value);
|
|
47
|
+
}, [value]);
|
|
48
|
+
const valueString = (0, import_react.useMemo)(() => {
|
|
49
|
+
if (!_value) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
if (typeof _value === "string") {
|
|
53
|
+
return _value;
|
|
54
|
+
}
|
|
55
|
+
return _value == null ? void 0 : _value.valueString;
|
|
56
|
+
}, [_value]);
|
|
57
|
+
const previewValueString = (0, import_react.useMemo)(() => {
|
|
58
|
+
if (!_value) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (typeof _value === "string") {
|
|
62
|
+
return _value;
|
|
63
|
+
}
|
|
64
|
+
return _value == null ? void 0 : _value.previewValueString;
|
|
65
|
+
}, [_value]);
|
|
66
|
+
const timePickerValue = (0, import_react.useMemo)(() => {
|
|
67
|
+
if (!previewValueString) {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
return (0, import_dayjs.default)((0, import_dayjs.default)().format("YYYY-MM-DD") + " " + previewValueString);
|
|
71
|
+
}, [previewValueString]);
|
|
72
|
+
const _onChange = (e) => {
|
|
73
|
+
if (!open) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
set_value(e);
|
|
77
|
+
};
|
|
78
|
+
const onEnter = (e) => {
|
|
79
|
+
_onChange(e);
|
|
80
|
+
onOpenChange(false, (e == null ? void 0 : e.previewValueString) || e);
|
|
81
|
+
};
|
|
82
|
+
const onOpenChange = (e, _val = previewValueString) => {
|
|
83
|
+
setOpen(e);
|
|
84
|
+
if (e) {
|
|
85
|
+
} else {
|
|
86
|
+
if (_val === value) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
onChange == null ? void 0 : onChange(_val);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
(0, import_react.useEffect)(() => {
|
|
93
|
+
if (open) {
|
|
94
|
+
document.body.classList.add("hide-scroll");
|
|
95
|
+
} else {
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
document.body.classList.remove("hide-scroll");
|
|
98
|
+
}, 150);
|
|
99
|
+
}
|
|
100
|
+
}, [open]);
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
102
|
+
import_antd.Popover,
|
|
103
|
+
{
|
|
104
|
+
destroyTooltipOnHide: true,
|
|
105
|
+
content: /* @__PURE__ */ import_react.default.createElement(
|
|
106
|
+
import_Time.default,
|
|
107
|
+
{
|
|
108
|
+
onChange: _onChange,
|
|
109
|
+
value: valueString,
|
|
110
|
+
onEnter: (e) => {
|
|
111
|
+
onEnter(e);
|
|
112
|
+
},
|
|
113
|
+
rightPanel: /* @__PURE__ */ import_react.default.createElement(
|
|
114
|
+
import_RightPanel.default,
|
|
115
|
+
{
|
|
116
|
+
value: previewValueString,
|
|
117
|
+
onChange: onEnter,
|
|
118
|
+
slice
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
...timeProps
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
open,
|
|
125
|
+
placement: "bottom",
|
|
126
|
+
arrow: false,
|
|
127
|
+
onOpenChange,
|
|
128
|
+
trigger: ["click"],
|
|
129
|
+
...popoverProps
|
|
130
|
+
},
|
|
131
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
132
|
+
import_antd.TimePicker,
|
|
133
|
+
{
|
|
134
|
+
format: "HH:mm",
|
|
135
|
+
size: "large",
|
|
136
|
+
inputReadOnly: true,
|
|
137
|
+
allowClear: false,
|
|
138
|
+
open: false,
|
|
139
|
+
value: timePickerValue,
|
|
140
|
+
...timePickerProps
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
));
|
|
144
|
+
};
|
|
145
|
+
var select_time_default = SelectTime;
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/select-time/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
findNextSlice: () => findNextSlice,
|
|
33
|
+
sliceDayIntoFiveMinutes: () => sliceDayIntoFiveMinutes
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(utils_exports);
|
|
36
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var sliceDayIntoFiveMinutes = (slice) => {
|
|
38
|
+
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
39
|
+
const endTime = (0, import_dayjs.default)().endOf("day");
|
|
40
|
+
const timeSlice = slice || 5;
|
|
41
|
+
let timeSlices = [];
|
|
42
|
+
let currentTime = startTime;
|
|
43
|
+
while (currentTime.isBefore(endTime)) {
|
|
44
|
+
const timeLabel = currentTime.format("HH:mm");
|
|
45
|
+
const timeValue = currentTime.format("HH:mm");
|
|
46
|
+
timeSlices.push({ label: timeLabel, value: timeValue });
|
|
47
|
+
const nextTime = currentTime.add(timeSlice, "minute");
|
|
48
|
+
currentTime = nextTime;
|
|
49
|
+
}
|
|
50
|
+
return timeSlices;
|
|
51
|
+
};
|
|
52
|
+
var findNextSlice = ({
|
|
53
|
+
timeSlices = [],
|
|
54
|
+
index = 0,
|
|
55
|
+
date = ""
|
|
56
|
+
}) => {
|
|
57
|
+
const currentTimeValue = date || (0, import_dayjs.default)().format("HH:mm");
|
|
58
|
+
for (let i = 0; i < timeSlices.length; i++) {
|
|
59
|
+
if (timeSlices[i].value !== "now") {
|
|
60
|
+
if (timeSlices[i].value >= currentTimeValue) {
|
|
61
|
+
return timeSlices[i].value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return timeSlices[index].value;
|
|
66
|
+
};
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
findNextSlice,
|
|
70
|
+
sliceDayIntoFiveMinutes
|
|
71
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/virtual-keyboard/Keyboard/index.tsx
|
|
30
|
+
var Keyboard_exports = {};
|
|
31
|
+
__export(Keyboard_exports, {
|
|
32
|
+
default: () => Keyboard_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Keyboard_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_index = require("./index.less");
|
|
38
|
+
var import_classnames = __toESM(require("classnames"));
|
|
39
|
+
var import_ahooks = require("ahooks");
|
|
40
|
+
var list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ok"];
|
|
41
|
+
var Keyboard = (props) => {
|
|
42
|
+
const { items = [], className, style, onChange } = props;
|
|
43
|
+
(0, import_ahooks.useEventListener)("keydown", (ev) => {
|
|
44
|
+
console.log("ev", ev);
|
|
45
|
+
let key = ev.key;
|
|
46
|
+
if (key === "Enter") {
|
|
47
|
+
key = "ok";
|
|
48
|
+
}
|
|
49
|
+
if (list.includes(key)) {
|
|
50
|
+
onChange == null ? void 0 : onChange(key);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: (0, import_classnames.default)("virtual-keyboard-wrap", className),
|
|
57
|
+
style
|
|
58
|
+
},
|
|
59
|
+
items.map((item) => {
|
|
60
|
+
var _a;
|
|
61
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "virtual-keyboard-item", style: item.style }, /* @__PURE__ */ import_react.default.createElement(
|
|
62
|
+
import_antd.Button,
|
|
63
|
+
{
|
|
64
|
+
id: `virtual-keyboard-${item.value}`,
|
|
65
|
+
key: item.value,
|
|
66
|
+
type: item.type,
|
|
67
|
+
className: "virtual-keyboard-item-button",
|
|
68
|
+
style: {
|
|
69
|
+
color: item.type === "primary" ? "#fff" : ((_a = item.style) == null ? void 0 : _a.color) || void 0
|
|
70
|
+
},
|
|
71
|
+
disabled: item.disabled,
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
onChange == null ? void 0 : onChange(item.value);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
item.label
|
|
77
|
+
));
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
var Keyboard_default = Keyboard;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/virtual-keyboard/Time/index.tsx
|
|
30
|
+
var Time_exports = {};
|
|
31
|
+
__export(Time_exports, {
|
|
32
|
+
default: () => Time_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Time_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import__ = __toESM(require("../index"));
|
|
37
|
+
var import_index = require("./index.less");
|
|
38
|
+
var import_utils = require("./utils.tsx");
|
|
39
|
+
var import_locales = require("../../../locales");
|
|
40
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
+
var items = [
|
|
42
|
+
{
|
|
43
|
+
value: 1,
|
|
44
|
+
label: "1",
|
|
45
|
+
disabled: false,
|
|
46
|
+
type: "text"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: 2,
|
|
50
|
+
label: "2",
|
|
51
|
+
disabled: false,
|
|
52
|
+
type: "text"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: 3,
|
|
56
|
+
label: "3",
|
|
57
|
+
disabled: false,
|
|
58
|
+
type: "text"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: 4,
|
|
62
|
+
label: "4",
|
|
63
|
+
disabled: false,
|
|
64
|
+
type: "text"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: 5,
|
|
68
|
+
label: "5",
|
|
69
|
+
disabled: false,
|
|
70
|
+
type: "text"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: 6,
|
|
74
|
+
label: "6",
|
|
75
|
+
disabled: false,
|
|
76
|
+
type: "text"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: 7,
|
|
80
|
+
label: "7",
|
|
81
|
+
disabled: false,
|
|
82
|
+
type: "text"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: 8,
|
|
86
|
+
label: "8",
|
|
87
|
+
disabled: false,
|
|
88
|
+
type: "text"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: 9,
|
|
92
|
+
label: "9",
|
|
93
|
+
disabled: false,
|
|
94
|
+
type: "text"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
value: "now",
|
|
98
|
+
label: (0, import_locales.getText)("virtual-keyboard-time-now"),
|
|
99
|
+
disabled: false,
|
|
100
|
+
type: "text",
|
|
101
|
+
style: { color: "#7f56d9" }
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
value: "0",
|
|
105
|
+
label: "0",
|
|
106
|
+
disabled: false,
|
|
107
|
+
type: "text"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: "ok",
|
|
111
|
+
label: (0, import_locales.getText)("virtual-keyboard-time-ok"),
|
|
112
|
+
disabled: false,
|
|
113
|
+
type: "primary"
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
var VirtualKeyboardTime = (props) => {
|
|
117
|
+
const { onChange, onEnter, style, className, value = "", rightPanel } = props;
|
|
118
|
+
(0, import_react.useEffect)(() => {
|
|
119
|
+
document.body.id = "body";
|
|
120
|
+
}, []);
|
|
121
|
+
const res = (0, import_react.useMemo)(() => {
|
|
122
|
+
return (0, import_utils.formatStringToTime)(value);
|
|
123
|
+
}, [value]);
|
|
124
|
+
const _onChange = (current) => {
|
|
125
|
+
if (current === "ok") {
|
|
126
|
+
onEnter == null ? void 0 : onEnter((0, import_utils.formatStringToTime)(value));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (current === "now") {
|
|
130
|
+
onEnter == null ? void 0 : onEnter((0, import_dayjs.default)().format("HH:mm"));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
let _val = res.valueString + current;
|
|
134
|
+
if (res.valueString.length === 4) {
|
|
135
|
+
_val = current + "";
|
|
136
|
+
}
|
|
137
|
+
if (document.querySelector(".virtual-keyboard-input-select")) {
|
|
138
|
+
_val = current + "";
|
|
139
|
+
}
|
|
140
|
+
onChange == null ? void 0 : onChange((0, import_utils.formatStringToTime)(_val));
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
143
|
+
import__.default,
|
|
144
|
+
{
|
|
145
|
+
className,
|
|
146
|
+
style,
|
|
147
|
+
keyboardProps: {
|
|
148
|
+
items,
|
|
149
|
+
onChange: (current) => {
|
|
150
|
+
_onChange(current);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
virtualKeyInputProps: {
|
|
154
|
+
value,
|
|
155
|
+
onChange: (e) => {
|
|
156
|
+
onChange == null ? void 0 : onChange((0, import_utils.formatStringToTime)(e.target.value));
|
|
157
|
+
},
|
|
158
|
+
renderInput: () => {
|
|
159
|
+
return res == null ? void 0 : res.previewValueArrayDom;
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
rightPanel
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
var Time_default = VirtualKeyboardTime;
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|