@nokecy/qc-ui 1.0.66 → 1.0.67
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/dist/cjs/components/RegexEditor/core/RegexEditor.d.ts +34 -0
- package/dist/cjs/components/RegexEditor/core/RegexEditor.js +223 -0
- package/dist/cjs/components/RegexEditor/core/RegexEditor.less +119 -0
- package/dist/cjs/components/RegexEditor/core/extensions/errorMarker.d.ts +49 -0
- package/dist/cjs/components/RegexEditor/core/extensions/errorMarker.js +158 -0
- package/dist/cjs/components/RegexEditor/core/types.d.ts +79 -0
- package/dist/cjs/components/RegexEditor/core/types.js +5 -0
- package/dist/cjs/components/RegexEditor/hooks/index.d.ts +9 -0
- package/dist/cjs/components/RegexEditor/hooks/index.js +19 -0
- package/dist/cjs/components/RegexEditor/hooks/useRegexTester.d.ts +95 -0
- package/dist/cjs/components/RegexEditor/hooks/useRegexTester.js +234 -0
- package/dist/cjs/components/RegexEditor/hooks/useRegexValidation.d.ts +71 -0
- package/dist/cjs/components/RegexEditor/hooks/useRegexValidation.js +215 -0
- package/dist/cjs/components/RegexEditor/hooks/useTemplateManager.d.ts +64 -0
- package/dist/cjs/components/RegexEditor/hooks/useTemplateManager.js +438 -0
- package/dist/cjs/components/RegexEditor/index.d.ts +16 -0
- package/dist/cjs/components/RegexEditor/index.js +232 -0
- package/dist/cjs/components/RegexEditor/templates/TemplateSelector.d.ts +36 -0
- package/dist/cjs/components/RegexEditor/templates/TemplateSelector.js +322 -0
- package/dist/cjs/components/RegexEditor/templates/builtinTemplates.d.ts +36 -0
- package/dist/cjs/components/RegexEditor/templates/builtinTemplates.js +340 -0
- package/dist/cjs/components/RegexEditor/templates/index.d.ts +10 -0
- package/dist/cjs/components/RegexEditor/templates/index.js +184 -0
- package/dist/cjs/components/RegexEditor/templates/storage.d.ts +74 -0
- package/dist/cjs/components/RegexEditor/templates/storage.js +337 -0
- package/dist/cjs/components/RegexEditor/templates/templateManager.d.ts +67 -0
- package/dist/cjs/components/RegexEditor/templates/templateManager.js +277 -0
- package/dist/cjs/components/RegexEditor/templates/types.d.ts +111 -0
- package/dist/cjs/components/RegexEditor/templates/types.js +94 -0
- package/dist/cjs/components/RegexEditor/testing/types.d.ts +55 -0
- package/dist/cjs/components/RegexEditor/testing/types.js +5 -0
- package/dist/cjs/components/RegexEditor/validation/complexity.d.ts +22 -0
- package/dist/cjs/components/RegexEditor/validation/complexity.js +196 -0
- package/dist/cjs/components/RegexEditor/validation/parser.d.ts +53 -0
- package/dist/cjs/components/RegexEditor/validation/parser.js +129 -0
- package/dist/cjs/components/RegexEditor/validation/types.d.ts +146 -0
- package/dist/cjs/components/RegexEditor/validation/types.js +5 -0
- package/dist/cjs/components/RegexEditor/validation/validator.d.ts +60 -0
- package/dist/cjs/components/RegexEditor/validation/validator.js +218 -0
- package/dist/cjs/components/RegexEditor/visualizer/FlagsSelector.d.ts +20 -0
- package/dist/cjs/components/RegexEditor/visualizer/FlagsSelector.js +98 -0
- package/dist/cjs/components/RegexEditor/visualizer/MatchItem.d.ts +25 -0
- package/dist/cjs/components/RegexEditor/visualizer/MatchItem.js +201 -0
- package/dist/cjs/components/RegexEditor/visualizer/RegexRailroadDiagram.d.ts +32 -0
- package/dist/cjs/components/RegexEditor/visualizer/RegexRailroadDiagram.js +192 -0
- package/dist/cjs/components/RegexEditor/visualizer/RegexTester.d.ts +22 -0
- package/dist/cjs/components/RegexEditor/visualizer/RegexTester.js +255 -0
- package/dist/cjs/components/RegexEditor/visualizer/astToRailroad.d.ts +19 -0
- package/dist/cjs/components/RegexEditor/visualizer/astToRailroad.js +155 -0
- package/dist/cjs/components/RegexEditor/visualizer/index.d.ts +12 -0
- package/dist/cjs/components/RegexEditor/visualizer/index.js +76 -0
- package/dist/cjs/components/RegexEditor/visualizer/types.d.ts +131 -0
- package/dist/cjs/components/RegexEditor/visualizer/types.js +5 -0
- package/dist/cjs/components/RegexEditor/visualizer/utils.d.ts +106 -0
- package/dist/cjs/components/RegexEditor/visualizer/utils.js +268 -0
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +55 -0
- package/dist/cjs/standardFormDialog/useStandardFormSchema.d.ts +1 -1
- package/dist/cjs/standardFormDialog/withStandardForm.d.ts +2 -2
- package/dist/cjs/types/railroad-diagrams.d.ts +59 -0
- package/dist/cjs/types/regexp-tree.d.ts +175 -0
- package/dist/esm/components/RegexEditor/core/RegexEditor.d.ts +34 -0
- package/dist/esm/components/RegexEditor/core/RegexEditor.js +214 -0
- package/dist/esm/components/RegexEditor/core/RegexEditor.less +119 -0
- package/dist/esm/components/RegexEditor/core/extensions/errorMarker.d.ts +49 -0
- package/dist/esm/components/RegexEditor/core/extensions/errorMarker.js +154 -0
- package/dist/esm/components/RegexEditor/core/types.d.ts +79 -0
- package/dist/esm/components/RegexEditor/core/types.js +1 -0
- package/dist/esm/components/RegexEditor/hooks/index.d.ts +9 -0
- package/dist/esm/components/RegexEditor/hooks/index.js +8 -0
- package/dist/esm/components/RegexEditor/hooks/useRegexTester.d.ts +95 -0
- package/dist/esm/components/RegexEditor/hooks/useRegexTester.js +230 -0
- package/dist/esm/components/RegexEditor/hooks/useRegexValidation.d.ts +71 -0
- package/dist/esm/components/RegexEditor/hooks/useRegexValidation.js +211 -0
- package/dist/esm/components/RegexEditor/hooks/useTemplateManager.d.ts +64 -0
- package/dist/esm/components/RegexEditor/hooks/useTemplateManager.js +430 -0
- package/dist/esm/components/RegexEditor/index.d.ts +16 -0
- package/dist/esm/components/RegexEditor/index.js +27 -0
- package/dist/esm/components/RegexEditor/templates/TemplateSelector.d.ts +36 -0
- package/dist/esm/components/RegexEditor/templates/TemplateSelector.js +316 -0
- package/dist/esm/components/RegexEditor/templates/builtinTemplates.d.ts +36 -0
- package/dist/esm/components/RegexEditor/templates/builtinTemplates.js +335 -0
- package/dist/esm/components/RegexEditor/templates/index.d.ts +10 -0
- package/dist/esm/components/RegexEditor/templates/index.js +19 -0
- package/dist/esm/components/RegexEditor/templates/storage.d.ts +74 -0
- package/dist/esm/components/RegexEditor/templates/storage.js +335 -0
- package/dist/esm/components/RegexEditor/templates/templateManager.d.ts +67 -0
- package/dist/esm/components/RegexEditor/templates/templateManager.js +274 -0
- package/dist/esm/components/RegexEditor/templates/types.d.ts +111 -0
- package/dist/esm/components/RegexEditor/templates/types.js +90 -0
- package/dist/esm/components/RegexEditor/testing/types.d.ts +55 -0
- package/dist/esm/components/RegexEditor/testing/types.js +1 -0
- package/dist/esm/components/RegexEditor/validation/complexity.d.ts +22 -0
- package/dist/esm/components/RegexEditor/validation/complexity.js +190 -0
- package/dist/esm/components/RegexEditor/validation/parser.d.ts +53 -0
- package/dist/esm/components/RegexEditor/validation/parser.js +123 -0
- package/dist/esm/components/RegexEditor/validation/types.d.ts +145 -0
- package/dist/esm/components/RegexEditor/validation/types.js +1 -0
- package/dist/esm/components/RegexEditor/validation/validator.d.ts +60 -0
- package/dist/esm/components/RegexEditor/validation/validator.js +213 -0
- package/dist/esm/components/RegexEditor/visualizer/FlagsSelector.d.ts +20 -0
- package/dist/esm/components/RegexEditor/visualizer/FlagsSelector.js +93 -0
- package/dist/esm/components/RegexEditor/visualizer/MatchItem.d.ts +25 -0
- package/dist/esm/components/RegexEditor/visualizer/MatchItem.js +194 -0
- package/dist/esm/components/RegexEditor/visualizer/RegexRailroadDiagram.d.ts +32 -0
- package/dist/esm/components/RegexEditor/visualizer/RegexRailroadDiagram.js +186 -0
- package/dist/esm/components/RegexEditor/visualizer/RegexTester.d.ts +22 -0
- package/dist/esm/components/RegexEditor/visualizer/RegexTester.js +248 -0
- package/dist/esm/components/RegexEditor/visualizer/astToRailroad.d.ts +18 -0
- package/dist/esm/components/RegexEditor/visualizer/astToRailroad.js +150 -0
- package/dist/esm/components/RegexEditor/visualizer/index.d.ts +12 -0
- package/dist/esm/components/RegexEditor/visualizer/index.js +17 -0
- package/dist/esm/components/RegexEditor/visualizer/types.d.ts +131 -0
- package/dist/esm/components/RegexEditor/visualizer/types.js +1 -0
- package/dist/esm/components/RegexEditor/visualizer/utils.d.ts +106 -0
- package/dist/esm/components/RegexEditor/visualizer/utils.js +256 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/types/railroad-diagrams.d.ts +59 -0
- package/dist/esm/types/regexp-tree.d.ts +175 -0
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +23 -7
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.MatchItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _antd = require("antd");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
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."); }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
|
19
|
+
* MatchItem 组件
|
|
20
|
+
*
|
|
21
|
+
* @module RegexEditor/visualizer/MatchItem
|
|
22
|
+
* @description 匹配结果项组件
|
|
23
|
+
*/
|
|
24
|
+
var Text = _antd.Typography.Text,
|
|
25
|
+
Paragraph = _antd.Typography.Paragraph;
|
|
26
|
+
var Panel = _antd.Collapse.Panel;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 匹配项组件
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <MatchItem
|
|
34
|
+
* match={{
|
|
35
|
+
* index: 0,
|
|
36
|
+
* lastIndex: 3,
|
|
37
|
+
* fullMatch: 'abc',
|
|
38
|
+
* groups: ['abc', 'ab', 'c'],
|
|
39
|
+
* }}
|
|
40
|
+
* index={0}
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
var MatchItem = exports.MatchItem = function MatchItem(_ref) {
|
|
45
|
+
var match = _ref.match,
|
|
46
|
+
index = _ref.index,
|
|
47
|
+
_ref$highlighted = _ref.highlighted,
|
|
48
|
+
highlighted = _ref$highlighted === void 0 ? false : _ref$highlighted,
|
|
49
|
+
_onClick = _ref.onClick;
|
|
50
|
+
var _useState = (0, _react.useState)(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
isHovered = _useState2[0],
|
|
53
|
+
setIsHovered = _useState2[1];
|
|
54
|
+
var hasGroups = match.groups.length > 1;
|
|
55
|
+
var hasNamedGroups = match.namedGroups && Object.keys(match.namedGroups).length > 0;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Card, {
|
|
57
|
+
size: "small",
|
|
58
|
+
className: "regex-match-item ".concat(highlighted ? 'highlighted' : ''),
|
|
59
|
+
style: {
|
|
60
|
+
marginBottom: 8,
|
|
61
|
+
cursor: _onClick ? 'pointer' : 'default',
|
|
62
|
+
borderColor: isHovered ? '#1890ff' : undefined,
|
|
63
|
+
transition: 'border-color 0.3s'
|
|
64
|
+
},
|
|
65
|
+
onMouseEnter: function onMouseEnter() {
|
|
66
|
+
return setIsHovered(true);
|
|
67
|
+
},
|
|
68
|
+
onMouseLeave: function onMouseLeave() {
|
|
69
|
+
return setIsHovered(false);
|
|
70
|
+
},
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(match, index);
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
style: {
|
|
76
|
+
marginBottom: 8
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Space, null, /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
79
|
+
color: "blue"
|
|
80
|
+
}, "\u5339\u914D #", index + 1), /*#__PURE__*/_react.default.createElement(Text, {
|
|
81
|
+
type: "secondary",
|
|
82
|
+
style: {
|
|
83
|
+
fontSize: '12px'
|
|
84
|
+
}
|
|
85
|
+
}, "\u4F4D\u7F6E: ", (0, _utils.formatPosition)(match)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
style: {
|
|
87
|
+
marginBottom: hasGroups || hasNamedGroups ? 8 : 0
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(Text, {
|
|
90
|
+
strong: true,
|
|
91
|
+
style: {
|
|
92
|
+
fontSize: '12px',
|
|
93
|
+
color: '#666'
|
|
94
|
+
}
|
|
95
|
+
}, "\u5B8C\u6574\u5339\u914D:"), /*#__PURE__*/_react.default.createElement(Paragraph, {
|
|
96
|
+
code: true,
|
|
97
|
+
copyable: true,
|
|
98
|
+
style: {
|
|
99
|
+
margin: '4px 0 0 0',
|
|
100
|
+
backgroundColor: '#f6f6f6',
|
|
101
|
+
padding: '4px 8px',
|
|
102
|
+
borderRadius: '2px'
|
|
103
|
+
}
|
|
104
|
+
}, match.fullMatch)), hasGroups && /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
|
|
105
|
+
size: "small",
|
|
106
|
+
bordered: false,
|
|
107
|
+
ghost: true
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(Panel, {
|
|
109
|
+
header: /*#__PURE__*/_react.default.createElement(Text, {
|
|
110
|
+
strong: true,
|
|
111
|
+
style: {
|
|
112
|
+
fontSize: '12px',
|
|
113
|
+
color: '#666'
|
|
114
|
+
}
|
|
115
|
+
}, "\u6355\u83B7\u7EC4 (", match.groups.length - 1, ")"),
|
|
116
|
+
key: "groups"
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
+
style: {
|
|
119
|
+
paddingLeft: 8
|
|
120
|
+
}
|
|
121
|
+
}, match.groups.slice(1).map(function (group, i) {
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
key: i,
|
|
124
|
+
style: {
|
|
125
|
+
marginBottom: 8
|
|
126
|
+
}
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
style: {
|
|
129
|
+
marginBottom: 2
|
|
130
|
+
}
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
132
|
+
color: "geekblue",
|
|
133
|
+
style: {
|
|
134
|
+
fontSize: '11px'
|
|
135
|
+
}
|
|
136
|
+
}, "Group ", i + 1)), /*#__PURE__*/_react.default.createElement(Paragraph, {
|
|
137
|
+
code: true,
|
|
138
|
+
copyable: true,
|
|
139
|
+
style: {
|
|
140
|
+
margin: 0,
|
|
141
|
+
backgroundColor: '#f0f5ff',
|
|
142
|
+
padding: '2px 6px',
|
|
143
|
+
borderRadius: '2px',
|
|
144
|
+
fontSize: '12px'
|
|
145
|
+
}
|
|
146
|
+
}, group || /*#__PURE__*/_react.default.createElement(Text, {
|
|
147
|
+
type: "secondary"
|
|
148
|
+
}, "(empty)")));
|
|
149
|
+
})))), hasNamedGroups && /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
|
|
150
|
+
size: "small",
|
|
151
|
+
bordered: false,
|
|
152
|
+
ghost: true,
|
|
153
|
+
style: {
|
|
154
|
+
marginTop: hasGroups ? 8 : 0
|
|
155
|
+
}
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement(Panel, {
|
|
157
|
+
header: /*#__PURE__*/_react.default.createElement(Text, {
|
|
158
|
+
strong: true,
|
|
159
|
+
style: {
|
|
160
|
+
fontSize: '12px',
|
|
161
|
+
color: '#666'
|
|
162
|
+
}
|
|
163
|
+
}, "\u547D\u540D\u6355\u83B7\u7EC4 (", Object.keys(match.namedGroups).length, ")"),
|
|
164
|
+
key: "named-groups"
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
style: {
|
|
167
|
+
paddingLeft: 8
|
|
168
|
+
}
|
|
169
|
+
}, Object.entries(match.namedGroups).map(function (_ref2) {
|
|
170
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
171
|
+
name = _ref3[0],
|
|
172
|
+
value = _ref3[1];
|
|
173
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
174
|
+
key: name,
|
|
175
|
+
style: {
|
|
176
|
+
marginBottom: 8
|
|
177
|
+
}
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
style: {
|
|
180
|
+
marginBottom: 2
|
|
181
|
+
}
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
183
|
+
color: "purple",
|
|
184
|
+
style: {
|
|
185
|
+
fontSize: '11px'
|
|
186
|
+
}
|
|
187
|
+
}, name)), /*#__PURE__*/_react.default.createElement(Paragraph, {
|
|
188
|
+
code: true,
|
|
189
|
+
copyable: true,
|
|
190
|
+
style: {
|
|
191
|
+
margin: 0,
|
|
192
|
+
backgroundColor: '#f9f0ff',
|
|
193
|
+
padding: '2px 6px',
|
|
194
|
+
borderRadius: '2px',
|
|
195
|
+
fontSize: '12px'
|
|
196
|
+
}
|
|
197
|
+
}, value || /*#__PURE__*/_react.default.createElement(Text, {
|
|
198
|
+
type: "secondary"
|
|
199
|
+
}, "(empty)")));
|
|
200
|
+
})))));
|
|
201
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegexRailroadDiagram 组件
|
|
3
|
+
*
|
|
4
|
+
* @module RegexEditor/visualizer/RegexRailroadDiagram
|
|
5
|
+
* @description 使用 Railroad Diagram 可视化正则表达式结构
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import 'railroad-diagrams/railroad-diagrams.css';
|
|
9
|
+
export interface RegexRailroadDiagramProps {
|
|
10
|
+
/** 正则表达式模式 */
|
|
11
|
+
pattern: string;
|
|
12
|
+
/** 是否显示标题 */
|
|
13
|
+
showTitle?: boolean;
|
|
14
|
+
/** 卡片大小 */
|
|
15
|
+
size?: 'small' | 'default';
|
|
16
|
+
/** 自定义样式 */
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
/** 自定义类名 */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Railroad Diagram 可视化组件
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <RegexRailroadDiagram
|
|
27
|
+
* pattern="\d{3}-\d{4}"
|
|
28
|
+
* showTitle={true}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const RegexRailroadDiagram: React.FC<RegexRailroadDiagramProps>;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.RegexRailroadDiagram = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _antd = require("antd");
|
|
10
|
+
var _parser = require("../validation/parser");
|
|
11
|
+
var _astToRailroad = require("./astToRailroad");
|
|
12
|
+
require("railroad-diagrams/railroad-diagrams.css");
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
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; }
|
|
16
|
+
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); } }
|
|
17
|
+
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); }); }; }
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
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."); }
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
|
24
|
+
* RegexRailroadDiagram 组件
|
|
25
|
+
*
|
|
26
|
+
* @module RegexEditor/visualizer/RegexRailroadDiagram
|
|
27
|
+
* @description 使用 Railroad Diagram 可视化正则表达式结构
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Railroad Diagram 可视化组件
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <RegexRailroadDiagram
|
|
35
|
+
* pattern="\d{3}-\d{4}"
|
|
36
|
+
* showTitle={true}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
var RegexRailroadDiagram = exports.RegexRailroadDiagram = function RegexRailroadDiagram(_ref) {
|
|
41
|
+
var pattern = _ref.pattern,
|
|
42
|
+
_ref$showTitle = _ref.showTitle,
|
|
43
|
+
showTitle = _ref$showTitle === void 0 ? true : _ref$showTitle,
|
|
44
|
+
_ref$size = _ref.size,
|
|
45
|
+
size = _ref$size === void 0 ? 'default' : _ref$size,
|
|
46
|
+
style = _ref.style,
|
|
47
|
+
className = _ref.className;
|
|
48
|
+
var containerRef = (0, _react.useRef)(null);
|
|
49
|
+
var _useState = (0, _react.useState)(false),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
loading = _useState2[0],
|
|
52
|
+
setLoading = _useState2[1];
|
|
53
|
+
var _useState3 = (0, _react.useState)(null),
|
|
54
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
+
error = _useState4[0],
|
|
56
|
+
setError = _useState4[1];
|
|
57
|
+
(0, _react.useEffect)(function () {
|
|
58
|
+
// 立即清空容器和重置状态(解决错误后无法重新渲染的问题)
|
|
59
|
+
if (containerRef.current) {
|
|
60
|
+
containerRef.current.innerHTML = '';
|
|
61
|
+
}
|
|
62
|
+
setError(null);
|
|
63
|
+
|
|
64
|
+
// 空 pattern 时清空状态
|
|
65
|
+
if (!pattern) {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 容器未准备好时不处理
|
|
71
|
+
if (!containerRef.current) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
var isMounted = true;
|
|
75
|
+
var renderDiagram = /*#__PURE__*/function () {
|
|
76
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
77
|
+
var parseResult, diagram, svg;
|
|
78
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
79
|
+
while (1) switch (_context.prev = _context.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
if (isMounted) {
|
|
82
|
+
_context.next = 2;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return _context.abrupt("return");
|
|
86
|
+
case 2:
|
|
87
|
+
setLoading(true);
|
|
88
|
+
_context.prev = 3;
|
|
89
|
+
// 解析正则表达式
|
|
90
|
+
parseResult = (0, _parser.parseRegex)(pattern);
|
|
91
|
+
if (isMounted) {
|
|
92
|
+
_context.next = 7;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return _context.abrupt("return");
|
|
96
|
+
case 7:
|
|
97
|
+
if (parseResult.ast) {
|
|
98
|
+
_context.next = 10;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (isMounted) {
|
|
102
|
+
setError('无法解析正则表达式');
|
|
103
|
+
setLoading(false);
|
|
104
|
+
}
|
|
105
|
+
return _context.abrupt("return");
|
|
106
|
+
case 10:
|
|
107
|
+
// 创建 Railroad Diagram
|
|
108
|
+
diagram = (0, _astToRailroad.createRailroadDiagram)(parseResult.ast);
|
|
109
|
+
if (!(!isMounted || !containerRef.current)) {
|
|
110
|
+
_context.next = 13;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return _context.abrupt("return");
|
|
114
|
+
case 13:
|
|
115
|
+
// 渲染 SVG
|
|
116
|
+
svg = diagram.toSVG(); // 添加样式
|
|
117
|
+
svg.style.maxWidth = '100%';
|
|
118
|
+
svg.style.height = 'auto';
|
|
119
|
+
svg.style.display = 'block';
|
|
120
|
+
svg.style.margin = '0 auto';
|
|
121
|
+
|
|
122
|
+
// 添加到容器
|
|
123
|
+
containerRef.current.appendChild(svg);
|
|
124
|
+
if (isMounted) {
|
|
125
|
+
setLoading(false);
|
|
126
|
+
}
|
|
127
|
+
_context.next = 26;
|
|
128
|
+
break;
|
|
129
|
+
case 22:
|
|
130
|
+
_context.prev = 22;
|
|
131
|
+
_context.t0 = _context["catch"](3);
|
|
132
|
+
console.error('Railroad Diagram rendering error:', _context.t0);
|
|
133
|
+
if (isMounted) {
|
|
134
|
+
setError(_context.t0 instanceof Error ? _context.t0.message : '渲染失败');
|
|
135
|
+
setLoading(false);
|
|
136
|
+
}
|
|
137
|
+
case 26:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee, null, [[3, 22]]);
|
|
142
|
+
}));
|
|
143
|
+
return function renderDiagram() {
|
|
144
|
+
return _ref2.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
renderDiagram();
|
|
148
|
+
return function () {
|
|
149
|
+
isMounted = false;
|
|
150
|
+
};
|
|
151
|
+
}, [pattern]);
|
|
152
|
+
var renderContent = function renderContent() {
|
|
153
|
+
if (!pattern) {
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Empty, {
|
|
155
|
+
description: "\u8BF7\u8F93\u5165\u6B63\u5219\u8868\u8FBE\u5F0F"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (loading) {
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
style: {
|
|
161
|
+
textAlign: 'center',
|
|
162
|
+
padding: '40px 0'
|
|
163
|
+
}
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Spin, {
|
|
165
|
+
tip: "\u6B63\u5728\u751F\u6210\u56FE\u8868..."
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
if (error) {
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Alert, {
|
|
170
|
+
message: "\u6E32\u67D3\u9519\u8BEF",
|
|
171
|
+
description: error,
|
|
172
|
+
type: "error",
|
|
173
|
+
showIcon: true
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
ref: containerRef,
|
|
178
|
+
style: {
|
|
179
|
+
overflow: 'auto',
|
|
180
|
+
padding: '16px',
|
|
181
|
+
backgroundColor: '#fafafa',
|
|
182
|
+
borderRadius: '4px'
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Card, {
|
|
187
|
+
title: showTitle ? 'Railroad Diagram' : undefined,
|
|
188
|
+
size: size,
|
|
189
|
+
style: style,
|
|
190
|
+
className: className
|
|
191
|
+
}, renderContent());
|
|
192
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegexTester 组件
|
|
3
|
+
*
|
|
4
|
+
* @module RegexEditor/visualizer/RegexTester
|
|
5
|
+
* @description 正则表达式测试面板组件
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { RegexTesterProps } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* 正则测试器组件
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <RegexTester
|
|
15
|
+
* pattern="\d+"
|
|
16
|
+
* flags={{ global: true }}
|
|
17
|
+
* onMatchResults={(results) => console.log(results)}
|
|
18
|
+
* enableReplace={true}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const RegexTester: React.FC<RegexTesterProps>;
|