@robot-admin/naive-ui-components 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +257 -0
- package/dist/C_ActionBar-DWN-woTc.css.map +1 -0
- package/dist/C_ActionBar.cjs +5 -0
- package/dist/C_ActionBar.d.cts +2 -0
- package/dist/C_ActionBar.d.ts +2 -0
- package/dist/C_ActionBar.js +4 -0
- package/dist/C_ActionBar2.js +196 -0
- package/dist/C_ActionBar2.js.map +1 -0
- package/dist/C_AntV-AFKyK6hH.css.map +1 -0
- package/dist/C_AntV.cjs +8 -0
- package/dist/C_AntV.d.cts +2 -0
- package/dist/C_AntV.d.ts +2 -0
- package/dist/C_AntV.js +4 -0
- package/dist/C_AntV2.js +3150 -0
- package/dist/C_AntV2.js.map +1 -0
- package/dist/C_Barcode-P_EFj8dC.css.map +1 -0
- package/dist/C_Barcode.cjs +4 -0
- package/dist/C_Barcode.d.cts +2 -0
- package/dist/C_Barcode.d.ts +2 -0
- package/dist/C_Barcode.js +3 -0
- package/dist/C_Barcode2.js +68 -0
- package/dist/C_Barcode2.js.map +1 -0
- package/dist/C_Captcha-C-ef41xw.css.map +1 -0
- package/dist/C_Captcha.cjs +4 -0
- package/dist/C_Captcha.d.cts +2 -0
- package/dist/C_Captcha.d.ts +2 -0
- package/dist/C_Captcha.js +3 -0
- package/dist/C_Captcha2.js +155 -0
- package/dist/C_Captcha2.js.map +1 -0
- package/dist/C_Cascade-D9kNsjsV.css.map +1 -0
- package/dist/C_Cascade.cjs +4 -0
- package/dist/C_Cascade.d.cts +2 -0
- package/dist/C_Cascade.d.ts +2 -0
- package/dist/C_Cascade.js +3 -0
- package/dist/C_Cascade2.js +103 -0
- package/dist/C_Cascade2.js.map +1 -0
- package/dist/C_City-BCQ4ipiK.css.map +1 -0
- package/dist/C_City.cjs +4 -0
- package/dist/C_City.d.cts +2 -0
- package/dist/C_City.d.ts +2 -0
- package/dist/C_City.js +3 -0
- package/dist/C_City2.js +841 -0
- package/dist/C_City2.js.map +1 -0
- package/dist/C_Code-C9kvvEmO.css.map +1 -0
- package/dist/C_Code.cjs +5 -0
- package/dist/C_Code.d.cts +2 -0
- package/dist/C_Code.d.ts +2 -0
- package/dist/C_Code.js +4 -0
- package/dist/C_Code2.js +346 -0
- package/dist/C_Code2.js.map +1 -0
- package/dist/C_CollapsePanel-BUJHuYcU.css.map +1 -0
- package/dist/C_CollapsePanel.cjs +6 -0
- package/dist/C_CollapsePanel.d.cts +2 -0
- package/dist/C_CollapsePanel.d.ts +2 -0
- package/dist/C_CollapsePanel.js +4 -0
- package/dist/C_CollapsePanel2.js +319 -0
- package/dist/C_CollapsePanel2.js.map +1 -0
- package/dist/C_Cron-yx2Ob4Jl.css.map +1 -0
- package/dist/C_Cron.cjs +15 -0
- package/dist/C_Cron.d.cts +2 -0
- package/dist/C_Cron.d.ts +2 -0
- package/dist/C_Cron.js +4 -0
- package/dist/C_Cron2.js +1209 -0
- package/dist/C_Cron2.js.map +1 -0
- package/dist/C_Date.cjs +4 -0
- package/dist/C_Date.d.cts +2 -0
- package/dist/C_Date.d.ts +2 -0
- package/dist/C_Date.js +3 -0
- package/dist/C_Date2.js +219 -0
- package/dist/C_Date2.js.map +1 -0
- package/dist/C_Draggable-C483syRC.css.map +1 -0
- package/dist/C_Draggable.cjs +5 -0
- package/dist/C_Draggable.d.cts +2 -0
- package/dist/C_Draggable.d.ts +2 -0
- package/dist/C_Draggable.js +3 -0
- package/dist/C_Draggable2.js +295 -0
- package/dist/C_Draggable2.js.map +1 -0
- package/dist/C_Editor-Bp0SyIEw.css.map +1 -0
- package/dist/C_Editor.cjs +4 -0
- package/dist/C_Editor.d.cts +2 -0
- package/dist/C_Editor.d.ts +2 -0
- package/dist/C_Editor.js +3 -0
- package/dist/C_Editor2.js +160 -0
- package/dist/C_Editor2.js.map +1 -0
- package/dist/C_FilePreview-CPqvhoCy.css.map +1 -0
- package/dist/C_FilePreview.cjs +6 -0
- package/dist/C_FilePreview.d.cts +2 -0
- package/dist/C_FilePreview.d.ts +2 -0
- package/dist/C_FilePreview.js +3 -0
- package/dist/C_FilePreview2.js +1031 -0
- package/dist/C_FilePreview2.js.map +1 -0
- package/dist/C_Form-Jx7PY3sT.css.map +1 -0
- package/dist/C_Form.cjs +15 -0
- package/dist/C_Form.d.cts +2 -0
- package/dist/C_Form.d.ts +2 -0
- package/dist/C_Form.js +4 -0
- package/dist/C_Form2.js +2510 -0
- package/dist/C_Form2.js.map +1 -0
- package/dist/C_FormSearch-DvRgxlRn.css.map +1 -0
- package/dist/C_FormSearch.cjs +6 -0
- package/dist/C_FormSearch.d.cts +2 -0
- package/dist/C_FormSearch.d.ts +2 -0
- package/dist/C_FormSearch.js +3 -0
- package/dist/C_FormSearch2.js +356 -0
- package/dist/C_FormSearch2.js.map +1 -0
- package/dist/C_FormulaEditor-DtGkt4T_.css.map +1 -0
- package/dist/C_FormulaEditor.cjs +13 -0
- package/dist/C_FormulaEditor.d.cts +2 -0
- package/dist/C_FormulaEditor.d.ts +2 -0
- package/dist/C_FormulaEditor.js +4 -0
- package/dist/C_FormulaEditor2.js +1433 -0
- package/dist/C_FormulaEditor2.js.map +1 -0
- package/dist/C_FullCalendar-BF7H0YIx.css.map +1 -0
- package/dist/C_FullCalendar.cjs +9 -0
- package/dist/C_FullCalendar.d.cts +2 -0
- package/dist/C_FullCalendar.d.ts +2 -0
- package/dist/C_FullCalendar.js +3 -0
- package/dist/C_FullCalendar2.js +377 -0
- package/dist/C_FullCalendar2.js.map +1 -0
- package/dist/C_Guide.cjs +4 -0
- package/dist/C_Guide.d.cts +2 -0
- package/dist/C_Guide.d.ts +2 -0
- package/dist/C_Guide.js +3 -0
- package/dist/C_Guide2.js +58 -0
- package/dist/C_Guide2.js.map +1 -0
- package/dist/C_Icon.cjs +4 -0
- package/dist/C_Icon.d.cts +2 -0
- package/dist/C_Icon.d.ts +2 -0
- package/dist/C_Icon.js +3 -0
- package/dist/C_Icon2.js +286 -0
- package/dist/C_Icon2.js.map +1 -0
- package/dist/C_ImageCropper-BVJfUufl.css.map +1 -0
- package/dist/C_ImageCropper.cjs +6 -0
- package/dist/C_ImageCropper.d.cts +2 -0
- package/dist/C_ImageCropper.d.ts +2 -0
- package/dist/C_ImageCropper.js +4 -0
- package/dist/C_ImageCropper2.js +723 -0
- package/dist/C_ImageCropper2.js.map +1 -0
- package/dist/C_Language.cjs +4 -0
- package/dist/C_Language.d.cts +2 -0
- package/dist/C_Language.d.ts +2 -0
- package/dist/C_Language.js +3 -0
- package/dist/C_Language2.js +72 -0
- package/dist/C_Language2.js.map +1 -0
- package/dist/C_Map-DpzeuWdX.css.map +1 -0
- package/dist/C_Map.cjs +7 -0
- package/dist/C_Map.d.cts +2 -0
- package/dist/C_Map.d.ts +2 -0
- package/dist/C_Map.js +3 -0
- package/dist/C_Map2.js +199 -0
- package/dist/C_Map2.js.map +1 -0
- package/dist/C_Markdown-BEjxknqd.css.map +1 -0
- package/dist/C_Markdown.cjs +4 -0
- package/dist/C_Markdown.d.cts +2 -0
- package/dist/C_Markdown.d.ts +2 -0
- package/dist/C_Markdown.js +3 -0
- package/dist/C_Markdown2.js +186 -0
- package/dist/C_Markdown2.js.map +1 -0
- package/dist/C_NotificationCenter-0l3TY2Gn.css.map +1 -0
- package/dist/C_NotificationCenter.cjs +20 -0
- package/dist/C_NotificationCenter.d.cts +2 -0
- package/dist/C_NotificationCenter.d.ts +2 -0
- package/dist/C_NotificationCenter.js +4 -0
- package/dist/C_NotificationCenter2.js +1383 -0
- package/dist/C_NotificationCenter2.js.map +1 -0
- package/dist/C_Progress.cjs +4 -0
- package/dist/C_Progress.d.cts +2 -0
- package/dist/C_Progress.d.ts +2 -0
- package/dist/C_Progress.js +3 -0
- package/dist/C_Progress2.js +103 -0
- package/dist/C_Progress2.js.map +1 -0
- package/dist/C_QRCode-DbdiAIPg.css.map +1 -0
- package/dist/C_QRCode.cjs +5 -0
- package/dist/C_QRCode.d.cts +2 -0
- package/dist/C_QRCode.d.ts +2 -0
- package/dist/C_QRCode.js +3 -0
- package/dist/C_QRCode2.js +218 -0
- package/dist/C_QRCode2.js.map +1 -0
- package/dist/C_Signature-zhHCbra9.css.map +1 -0
- package/dist/C_Signature.cjs +8 -0
- package/dist/C_Signature.d.cts +2 -0
- package/dist/C_Signature.d.ts +2 -0
- package/dist/C_Signature.js +4 -0
- package/dist/C_Signature2.js +618 -0
- package/dist/C_Signature2.js.map +1 -0
- package/dist/C_SplitPane-C6sBsfKY.css.map +1 -0
- package/dist/C_SplitPane.cjs +6 -0
- package/dist/C_SplitPane.d.cts +2 -0
- package/dist/C_SplitPane.d.ts +2 -0
- package/dist/C_SplitPane.js +4 -0
- package/dist/C_SplitPane2.js +356 -0
- package/dist/C_SplitPane2.js.map +1 -0
- package/dist/C_Steps-CODHN5Hs.css.map +1 -0
- package/dist/C_Steps.cjs +4 -0
- package/dist/C_Steps.d.cts +2 -0
- package/dist/C_Steps.d.ts +2 -0
- package/dist/C_Steps.js +3 -0
- package/dist/C_Steps2.js +82 -0
- package/dist/C_Steps2.js.map +1 -0
- package/dist/C_Table-DSNsntmT.css.map +1 -0
- package/dist/C_Table.cjs +19 -0
- package/dist/C_Table.d.cts +2 -0
- package/dist/C_Table.d.ts +2 -0
- package/dist/C_Table.js +5 -0
- package/dist/C_Table2.js +3009 -0
- package/dist/C_Table2.js.map +1 -0
- package/dist/C_Theme.cjs +4 -0
- package/dist/C_Theme.d.cts +2 -0
- package/dist/C_Theme.d.ts +2 -0
- package/dist/C_Theme.js +3 -0
- package/dist/C_Theme2.js +60 -0
- package/dist/C_Theme2.js.map +1 -0
- package/dist/C_Time-BvZLYraL.css.map +1 -0
- package/dist/C_Time.cjs +5 -0
- package/dist/C_Time.d.cts +2 -0
- package/dist/C_Time.d.ts +2 -0
- package/dist/C_Time.js +3 -0
- package/dist/C_Time2.js +199 -0
- package/dist/C_Time2.js.map +1 -0
- package/dist/C_Tree-0GDv--jX.css.map +1 -0
- package/dist/C_Tree.cjs +7 -0
- package/dist/C_Tree.d.cts +2 -0
- package/dist/C_Tree.d.ts +2 -0
- package/dist/C_Tree.js +4 -0
- package/dist/C_Tree2.js +441 -0
- package/dist/C_Tree2.js.map +1 -0
- package/dist/C_Upload-BXd3YYLx.css.map +1 -0
- package/dist/C_Upload.cjs +12 -0
- package/dist/C_Upload.d.cts +2 -0
- package/dist/C_Upload.d.ts +2 -0
- package/dist/C_Upload.js +4 -0
- package/dist/C_Upload2.js +1388 -0
- package/dist/C_Upload2.js.map +1 -0
- package/dist/C_VideoPlayer-DYG3RL0Q.css.map +1 -0
- package/dist/C_VideoPlayer.cjs +23 -0
- package/dist/C_VideoPlayer.d.cts +2 -0
- package/dist/C_VideoPlayer.d.ts +2 -0
- package/dist/C_VideoPlayer.js +3 -0
- package/dist/C_VideoPlayer2.js +1932 -0
- package/dist/C_VideoPlayer2.js.map +1 -0
- package/dist/C_VtableGantt-fhItIiHE.css.map +1 -0
- package/dist/C_VtableGantt.cjs +6 -0
- package/dist/C_VtableGantt.d.cts +2 -0
- package/dist/C_VtableGantt.d.ts +2 -0
- package/dist/C_VtableGantt.js +4 -0
- package/dist/C_VtableGantt2.js +873 -0
- package/dist/C_VtableGantt2.js.map +1 -0
- package/dist/C_WaterFall-8sQDFXKg.css.map +1 -0
- package/dist/C_WaterFall.cjs +13 -0
- package/dist/C_WaterFall.d.cts +2 -0
- package/dist/C_WaterFall.d.ts +2 -0
- package/dist/C_WaterFall.js +3 -0
- package/dist/C_WaterFall2.js +365 -0
- package/dist/C_WaterFall2.js.map +1 -0
- package/dist/C_WorkFlow-J-dyIuh9.css.map +1 -0
- package/dist/C_WorkFlow.cjs +8 -0
- package/dist/C_WorkFlow.d.cts +2 -0
- package/dist/C_WorkFlow.d.ts +2 -0
- package/dist/C_WorkFlow.js +4 -0
- package/dist/C_WorkFlow2.js +1984 -0
- package/dist/C_WorkFlow2.js.map +1 -0
- package/dist/chunk.js +22 -0
- package/dist/city.js +4817 -0
- package/dist/city.js.map +1 -0
- package/dist/constants.d.ts +273 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants2.d.ts +178 -0
- package/dist/constants2.d.ts.map +1 -0
- package/dist/constants3.d.ts +475 -0
- package/dist/constants3.d.ts.map +1 -0
- package/dist/constants4.d.ts +430 -0
- package/dist/constants4.d.ts.map +1 -0
- package/dist/constants5.d.ts +4283 -0
- package/dist/constants5.d.ts.map +1 -0
- package/dist/data.d.ts +67 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/export-helper.js +9 -0
- package/dist/index.cjs +409 -0
- package/dist/index.d.cts +96 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/index.vue.d.ts +80 -0
- package/dist/index.vue.d.ts.map +1 -0
- package/dist/index10.vue.d.ts +72 -0
- package/dist/index10.vue.d.ts.map +1 -0
- package/dist/index11.vue.d.ts +26 -0
- package/dist/index11.vue.d.ts.map +1 -0
- package/dist/index12.vue.d.ts +81 -0
- package/dist/index12.vue.d.ts.map +1 -0
- package/dist/index13.vue.d.ts +55 -0
- package/dist/index13.vue.d.ts.map +1 -0
- package/dist/index14.vue.d.ts +33 -0
- package/dist/index14.vue.d.ts.map +1 -0
- package/dist/index15.vue.d.ts +18 -0
- package/dist/index15.vue.d.ts.map +1 -0
- package/dist/index16.vue.d.ts +662 -0
- package/dist/index16.vue.d.ts.map +1 -0
- package/dist/index2.vue.d.ts +38 -0
- package/dist/index2.vue.d.ts.map +1 -0
- package/dist/index3.vue.d.ts +45 -0
- package/dist/index3.vue.d.ts.map +1 -0
- package/dist/index4.vue.d.ts +31 -0
- package/dist/index4.vue.d.ts.map +1 -0
- package/dist/index5.vue.d.ts +35 -0
- package/dist/index5.vue.d.ts.map +1 -0
- package/dist/index6.vue.d.ts +48 -0
- package/dist/index6.vue.d.ts.map +1 -0
- package/dist/index7.vue.d.ts +56 -0
- package/dist/index7.vue.d.ts.map +1 -0
- package/dist/index8.vue.d.ts +41 -0
- package/dist/index8.vue.d.ts.map +1 -0
- package/dist/index9.vue.d.ts +30 -0
- package/dist/index9.vue.d.ts.map +1 -0
- package/dist/storage.js +31 -0
- package/dist/storage.js.map +1 -0
- package/dist/style.css +7725 -0
- package/dist/useCalendarEvents.d.ts +148 -0
- package/dist/useCalendarEvents.d.ts.map +1 -0
- package/dist/useCollapsePanel.d.ts +132 -0
- package/dist/useCollapsePanel.d.ts.map +1 -0
- package/dist/useCropperCore.d.ts +102 -0
- package/dist/useCropperCore.d.ts.map +1 -0
- package/dist/useDraggableLayout.d.ts +194 -0
- package/dist/useDraggableLayout.d.ts.map +1 -0
- package/dist/useDynamicFormState.d.ts +4248 -0
- package/dist/useDynamicFormState.d.ts.map +1 -0
- package/dist/useEdgeInteraction.d.ts +7614 -0
- package/dist/useEdgeInteraction.d.ts.map +1 -0
- package/dist/useFullscreen.d.ts +166 -0
- package/dist/useFullscreen.d.ts.map +1 -0
- package/dist/useInfiniteScroll.d.ts +169 -0
- package/dist/useInfiniteScroll.d.ts.map +1 -0
- package/dist/useModalEdit.d.ts +960 -0
- package/dist/useModalEdit.d.ts.map +1 -0
- package/dist/useQRCode.d.ts +87 -0
- package/dist/useQRCode.d.ts.map +1 -0
- package/dist/useSearchState.d.ts +180 -0
- package/dist/useSearchState.d.ts.map +1 -0
- package/dist/useSignatureHistory.d.ts +189 -0
- package/dist/useSignatureHistory.d.ts.map +1 -0
- package/dist/useSplitResize.d.ts +158 -0
- package/dist/useSplitResize.d.ts.map +1 -0
- package/dist/useTimeSelection.d.ts +105 -0
- package/dist/useTimeSelection.d.ts.map +1 -0
- package/dist/useTreeOperations.d.ts +183 -0
- package/dist/useTreeOperations.d.ts.map +1 -0
- package/dist/useWorkflowValidation.d.ts +1052 -0
- package/dist/useWorkflowValidation.d.ts.map +1 -0
- package/package.json +342 -0
package/dist/C_Cron2.js
ADDED
|
@@ -0,0 +1,1209 @@
|
|
|
1
|
+
import { t as C_Icon_default } from "./C_Icon2.js";
|
|
2
|
+
import { t as export_helper_default } from "./export-helper.js";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, vShow, watch, withCtx, withDirectives, withKeys } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/components/C_Cron/constants.ts
|
|
6
|
+
const CRON_FIELD_META = [
|
|
7
|
+
{
|
|
8
|
+
type: "second",
|
|
9
|
+
label: "秒",
|
|
10
|
+
min: 0,
|
|
11
|
+
max: 59
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: "minute",
|
|
15
|
+
label: "分",
|
|
16
|
+
min: 0,
|
|
17
|
+
max: 59
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "hour",
|
|
21
|
+
label: "时",
|
|
22
|
+
min: 0,
|
|
23
|
+
max: 23
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "day",
|
|
27
|
+
label: "日",
|
|
28
|
+
min: 1,
|
|
29
|
+
max: 31
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "month",
|
|
33
|
+
label: "月",
|
|
34
|
+
min: 1,
|
|
35
|
+
max: 12
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "week",
|
|
39
|
+
label: "周",
|
|
40
|
+
min: 1,
|
|
41
|
+
max: 7,
|
|
42
|
+
valueLabels: {
|
|
43
|
+
1: "周日",
|
|
44
|
+
2: "周一",
|
|
45
|
+
3: "周二",
|
|
46
|
+
4: "周三",
|
|
47
|
+
5: "周四",
|
|
48
|
+
6: "周五",
|
|
49
|
+
7: "周六"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
const DEFAULT_FIELD_VALUE = {
|
|
54
|
+
mode: "every",
|
|
55
|
+
rangeStart: 0,
|
|
56
|
+
rangeEnd: 0,
|
|
57
|
+
stepStart: 0,
|
|
58
|
+
stepInterval: 1,
|
|
59
|
+
specificValues: []
|
|
60
|
+
};
|
|
61
|
+
const DEFAULT_CRON_VALUE = {
|
|
62
|
+
second: {
|
|
63
|
+
...DEFAULT_FIELD_VALUE,
|
|
64
|
+
rangeEnd: 59
|
|
65
|
+
},
|
|
66
|
+
minute: {
|
|
67
|
+
...DEFAULT_FIELD_VALUE,
|
|
68
|
+
rangeEnd: 59
|
|
69
|
+
},
|
|
70
|
+
hour: {
|
|
71
|
+
...DEFAULT_FIELD_VALUE,
|
|
72
|
+
rangeEnd: 23
|
|
73
|
+
},
|
|
74
|
+
day: {
|
|
75
|
+
...DEFAULT_FIELD_VALUE,
|
|
76
|
+
rangeStart: 1,
|
|
77
|
+
rangeEnd: 31
|
|
78
|
+
},
|
|
79
|
+
month: {
|
|
80
|
+
...DEFAULT_FIELD_VALUE,
|
|
81
|
+
rangeStart: 1,
|
|
82
|
+
rangeEnd: 12
|
|
83
|
+
},
|
|
84
|
+
week: {
|
|
85
|
+
...DEFAULT_FIELD_VALUE,
|
|
86
|
+
mode: "none",
|
|
87
|
+
rangeStart: 1,
|
|
88
|
+
rangeEnd: 7
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const DEFAULT_CRON_EXPRESSION = "0 0 0 * * ?";
|
|
92
|
+
const CRON_TEMPLATES = [
|
|
93
|
+
{
|
|
94
|
+
label: "每秒执行",
|
|
95
|
+
value: "* * * * * ?",
|
|
96
|
+
description: "每秒执行一次",
|
|
97
|
+
icon: "mdi:timer-sand"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "每分钟执行",
|
|
101
|
+
value: "0 * * * * ?",
|
|
102
|
+
description: "每分钟第 0 秒执行",
|
|
103
|
+
icon: "mdi:clock-outline"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: "每小时执行",
|
|
107
|
+
value: "0 0 * * * ?",
|
|
108
|
+
description: "每小时整点执行",
|
|
109
|
+
icon: "mdi:clock-time-twelve-outline"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "每天 0 点",
|
|
113
|
+
value: "0 0 0 * * ?",
|
|
114
|
+
description: "每天凌晨 00:00 执行",
|
|
115
|
+
icon: "mdi:weather-night"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "每天 8:30",
|
|
119
|
+
value: "0 30 8 * * ?",
|
|
120
|
+
description: "每天早上 08:30 执行",
|
|
121
|
+
icon: "mdi:weather-sunny"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "每天 12:00",
|
|
125
|
+
value: "0 0 12 * * ?",
|
|
126
|
+
description: "每天中午 12:00 执行",
|
|
127
|
+
icon: "mdi:food"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "工作日 9:00",
|
|
131
|
+
value: "0 0 9 ? * 2-6",
|
|
132
|
+
description: "周一至周五 09:00 执行",
|
|
133
|
+
icon: "mdi:briefcase-outline"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "每周一 0 点",
|
|
137
|
+
value: "0 0 0 ? * 2",
|
|
138
|
+
description: "每周一凌晨 00:00 执行",
|
|
139
|
+
icon: "mdi:calendar-week"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
label: "每月 1 号 0 点",
|
|
143
|
+
value: "0 0 0 1 * ?",
|
|
144
|
+
description: "每月 1 号凌晨 00:00 执行",
|
|
145
|
+
icon: "mdi:calendar-month"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: "每 5 分钟",
|
|
149
|
+
value: "0 0/5 * * * ?",
|
|
150
|
+
description: "每隔 5 分钟执行一次",
|
|
151
|
+
icon: "mdi:timer-5"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: "每 30 分钟",
|
|
155
|
+
value: "0 0/30 * * * ?",
|
|
156
|
+
description: "每隔 30 分钟执行一次",
|
|
157
|
+
icon: "mdi:timer-30"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: "每 2 小时",
|
|
161
|
+
value: "0 0 0/2 * * ?",
|
|
162
|
+
description: "每隔 2 小时执行一次",
|
|
163
|
+
icon: "mdi:timer-2"
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
const MONTH_LABELS = {
|
|
167
|
+
1: "一月",
|
|
168
|
+
2: "二月",
|
|
169
|
+
3: "三月",
|
|
170
|
+
4: "四月",
|
|
171
|
+
5: "五月",
|
|
172
|
+
6: "六月",
|
|
173
|
+
7: "七月",
|
|
174
|
+
8: "八月",
|
|
175
|
+
9: "九月",
|
|
176
|
+
10: "十月",
|
|
177
|
+
11: "十一月",
|
|
178
|
+
12: "十二月"
|
|
179
|
+
};
|
|
180
|
+
const WEEK_LABELS = {
|
|
181
|
+
1: "周日",
|
|
182
|
+
2: "周一",
|
|
183
|
+
3: "周二",
|
|
184
|
+
4: "周三",
|
|
185
|
+
5: "周四",
|
|
186
|
+
6: "周五",
|
|
187
|
+
7: "周六"
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/C_Cron/composables/useCronParser.ts
|
|
192
|
+
const FIELD_ORDER = [
|
|
193
|
+
"second",
|
|
194
|
+
"minute",
|
|
195
|
+
"hour",
|
|
196
|
+
"day",
|
|
197
|
+
"month",
|
|
198
|
+
"week"
|
|
199
|
+
];
|
|
200
|
+
/**
|
|
201
|
+
* Cron 解析 & 生成引擎
|
|
202
|
+
*/
|
|
203
|
+
function useCronParser() {
|
|
204
|
+
/** 当前 Cron 对象 */
|
|
205
|
+
const cronValue = ref(structuredClone(DEFAULT_CRON_VALUE));
|
|
206
|
+
/** 将单个字段值转为 Cron 表达式片段 */
|
|
207
|
+
function fieldToExpression(field) {
|
|
208
|
+
switch (field.mode) {
|
|
209
|
+
case "every": return "*";
|
|
210
|
+
case "range": return `${field.rangeStart}-${field.rangeEnd}`;
|
|
211
|
+
case "step": return `${field.stepStart}/${field.stepInterval}`;
|
|
212
|
+
case "specific": return field.specificValues.length > 0 ? field.specificValues.sort((a, b) => a - b).join(",") : "*";
|
|
213
|
+
case "none": return "?";
|
|
214
|
+
default: return "*";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/** 创建默认字段值 */
|
|
218
|
+
function createFieldValue(meta, mode, overrides = {}) {
|
|
219
|
+
return {
|
|
220
|
+
mode,
|
|
221
|
+
rangeStart: meta.min,
|
|
222
|
+
rangeEnd: meta.max,
|
|
223
|
+
stepStart: meta.min,
|
|
224
|
+
stepInterval: 1,
|
|
225
|
+
specificValues: [],
|
|
226
|
+
...overrides
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** 解析步进表达式为字段值 */
|
|
230
|
+
function parseStepExpr(expr, meta) {
|
|
231
|
+
const [start, interval] = expr.split("/").map(Number);
|
|
232
|
+
return createFieldValue(meta, "step", {
|
|
233
|
+
stepStart: isNaN(start) ? meta.min : start,
|
|
234
|
+
stepInterval: isNaN(interval) ? 1 : interval
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/** 解析范围表达式为字段值 */
|
|
238
|
+
function parseRangeExpr(expr, meta) {
|
|
239
|
+
const [start, end] = expr.split("-").map(Number);
|
|
240
|
+
return createFieldValue(meta, "range", {
|
|
241
|
+
rangeStart: isNaN(start) ? meta.min : start,
|
|
242
|
+
rangeEnd: isNaN(end) ? meta.max : end
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/** 将 Cron 表达式片段解析为字段值对象 */
|
|
246
|
+
function expressionToField(expr, type) {
|
|
247
|
+
const meta = CRON_FIELD_META.find((m) => m.type === type);
|
|
248
|
+
if (expr === "?") return createFieldValue(meta, "none");
|
|
249
|
+
if (expr === "*") return createFieldValue(meta, "every");
|
|
250
|
+
if (expr.includes("/")) return parseStepExpr(expr, meta);
|
|
251
|
+
if (expr.includes("-") && !expr.includes(",")) return parseRangeExpr(expr, meta);
|
|
252
|
+
const values = expr.split(",").map(Number).filter((n) => !isNaN(n));
|
|
253
|
+
if (values.length > 0) return createFieldValue(meta, "specific", { specificValues: values });
|
|
254
|
+
return createFieldValue(meta, "every");
|
|
255
|
+
}
|
|
256
|
+
/** 由 CronValue 生成完整 Cron 表达式 */
|
|
257
|
+
function generate() {
|
|
258
|
+
return FIELD_ORDER.map((type) => fieldToExpression(cronValue.value[type])).join(" ");
|
|
259
|
+
}
|
|
260
|
+
/** 解析 Cron 表达式字符串为 CronValue */
|
|
261
|
+
function parse(expression) {
|
|
262
|
+
const parts = expression.trim().split(/\s+/);
|
|
263
|
+
if (parts.length < 6) return;
|
|
264
|
+
FIELD_ORDER.forEach((type, index) => {
|
|
265
|
+
cronValue.value[type] = expressionToField(parts[index], type);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
/** 日/周互斥:修改一方时另一方自动设为 ? */
|
|
269
|
+
function handleDayWeekExclusion(changedField) {
|
|
270
|
+
if (changedField === "day") {
|
|
271
|
+
if (cronValue.value.day.mode !== "none") cronValue.value.week = {
|
|
272
|
+
...cronValue.value.week,
|
|
273
|
+
mode: "none"
|
|
274
|
+
};
|
|
275
|
+
} else if (cronValue.value.week.mode !== "none") cronValue.value.day = {
|
|
276
|
+
...cronValue.value.day,
|
|
277
|
+
mode: "none"
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/** 校验 Cron 表达式合法性 */
|
|
281
|
+
function validate(expression) {
|
|
282
|
+
const parts = (expression ?? generate()).trim().split(/\s+/);
|
|
283
|
+
if (parts.length !== 6) return {
|
|
284
|
+
valid: false,
|
|
285
|
+
message: `表达式应包含 6 个字段,当前为 ${parts.length} 个`
|
|
286
|
+
};
|
|
287
|
+
const dayPart = parts[3];
|
|
288
|
+
const weekPart = parts[5];
|
|
289
|
+
if (dayPart !== "?" && weekPart !== "?") return {
|
|
290
|
+
valid: false,
|
|
291
|
+
message: "日和周不能同时指定,其中一个必须为 ?",
|
|
292
|
+
field: "day"
|
|
293
|
+
};
|
|
294
|
+
if (dayPart === "?" && weekPart === "?") return {
|
|
295
|
+
valid: false,
|
|
296
|
+
message: "日和周不能同时为 ?,至少指定一个",
|
|
297
|
+
field: "day"
|
|
298
|
+
};
|
|
299
|
+
for (let i = 0; i < FIELD_ORDER.length; i++) {
|
|
300
|
+
const type = FIELD_ORDER[i];
|
|
301
|
+
const part = parts[i];
|
|
302
|
+
const result = validateField(part, CRON_FIELD_META.find((m) => m.type === type));
|
|
303
|
+
if (!result.valid) return {
|
|
304
|
+
...result,
|
|
305
|
+
field: type
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
valid: true,
|
|
310
|
+
message: "表达式合法"
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/** 校验步进表达式 */
|
|
314
|
+
function validateStep(part, meta) {
|
|
315
|
+
const [s, i] = part.split("/");
|
|
316
|
+
const start = s === "*" ? meta.min : Number(s);
|
|
317
|
+
const interval = Number(i);
|
|
318
|
+
if (isNaN(start) || isNaN(interval)) return {
|
|
319
|
+
valid: false,
|
|
320
|
+
message: `${meta.label}字段步进格式错误`
|
|
321
|
+
};
|
|
322
|
+
if (start < meta.min || start > meta.max) return {
|
|
323
|
+
valid: false,
|
|
324
|
+
message: `${meta.label}字段步进起始值超出范围 (${meta.min}-${meta.max})`
|
|
325
|
+
};
|
|
326
|
+
if (interval < 1) return {
|
|
327
|
+
valid: false,
|
|
328
|
+
message: `${meta.label}字段步进间隔必须大于 0`
|
|
329
|
+
};
|
|
330
|
+
return {
|
|
331
|
+
valid: true,
|
|
332
|
+
message: ""
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
/** 校验范围表达式 */
|
|
336
|
+
function validateRange(part, meta) {
|
|
337
|
+
const [s, e] = part.split("-").map(Number);
|
|
338
|
+
if (isNaN(s) || isNaN(e)) return {
|
|
339
|
+
valid: false,
|
|
340
|
+
message: `${meta.label}字段范围格式错误`
|
|
341
|
+
};
|
|
342
|
+
if (s < meta.min || e > meta.max) return {
|
|
343
|
+
valid: false,
|
|
344
|
+
message: `${meta.label}字段范围超出 (${meta.min}-${meta.max})`
|
|
345
|
+
};
|
|
346
|
+
if (s > e) return {
|
|
347
|
+
valid: false,
|
|
348
|
+
message: `${meta.label}字段范围起始不能大于结束`
|
|
349
|
+
};
|
|
350
|
+
return {
|
|
351
|
+
valid: true,
|
|
352
|
+
message: ""
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/** 校验指定值表达式 */
|
|
356
|
+
function validateSpecific(part, meta) {
|
|
357
|
+
const values = part.split(",").map(Number);
|
|
358
|
+
if (values.some(isNaN)) return {
|
|
359
|
+
valid: false,
|
|
360
|
+
message: `${meta.label}字段包含非数字字符`
|
|
361
|
+
};
|
|
362
|
+
if (values.some((v) => v < meta.min || v > meta.max)) return {
|
|
363
|
+
valid: false,
|
|
364
|
+
message: `${meta.label}字段值超出范围 (${meta.min}-${meta.max})`
|
|
365
|
+
};
|
|
366
|
+
return {
|
|
367
|
+
valid: true,
|
|
368
|
+
message: ""
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
/** 校验单个字段表达式 */
|
|
372
|
+
function validateField(part, meta) {
|
|
373
|
+
if (part === "*" || part === "?") return {
|
|
374
|
+
valid: true,
|
|
375
|
+
message: ""
|
|
376
|
+
};
|
|
377
|
+
if (part.includes("/")) return validateStep(part, meta);
|
|
378
|
+
if (part.includes("-") && !part.includes(",")) return validateRange(part, meta);
|
|
379
|
+
return validateSpecific(part, meta);
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
cronValue,
|
|
383
|
+
expression: computed(() => generate()),
|
|
384
|
+
validation: computed(() => validate()),
|
|
385
|
+
parse,
|
|
386
|
+
generate,
|
|
387
|
+
validate,
|
|
388
|
+
handleDayWeekExclusion
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/components/C_Cron/composables/useCronPreview.ts
|
|
394
|
+
/**
|
|
395
|
+
* 解析 Cron 表达式,预测未来 N 次执行时间
|
|
396
|
+
* 纯逻辑实现,不依赖外部库
|
|
397
|
+
*/
|
|
398
|
+
function useCronPreview(expression, validation, count) {
|
|
399
|
+
/** 预测的执行时间列表 */
|
|
400
|
+
const nextExecutions = ref([]);
|
|
401
|
+
/** 是否正在计算 */
|
|
402
|
+
const computing = ref(false);
|
|
403
|
+
/** 检查单个值是否匹配 Cron 字段片段 */
|
|
404
|
+
function matchesPart(value, part) {
|
|
405
|
+
if (part === "*" || part === "?") return true;
|
|
406
|
+
if (part.includes("/")) {
|
|
407
|
+
const [s, i] = part.split("/");
|
|
408
|
+
const start = s === "*" ? 0 : Number(s);
|
|
409
|
+
const interval = Number(i);
|
|
410
|
+
return value - start >= 0 && (value - start) % interval === 0;
|
|
411
|
+
}
|
|
412
|
+
if (part.includes("-") && !part.includes(",")) {
|
|
413
|
+
const [start, end] = part.split("-").map(Number);
|
|
414
|
+
return value >= start && value <= end;
|
|
415
|
+
}
|
|
416
|
+
return part.split(",").map(Number).includes(value);
|
|
417
|
+
}
|
|
418
|
+
/** 检查日期是否匹配 Cron 表达式 */
|
|
419
|
+
function matchesCron(date, parts) {
|
|
420
|
+
if (parts.length !== 6) return false;
|
|
421
|
+
const [secPart, minPart, hourPart, dayPart, monthPart, weekPart] = parts;
|
|
422
|
+
if (!matchesPart(date.getMonth() + 1, monthPart)) return false;
|
|
423
|
+
if (dayPart !== "?") {
|
|
424
|
+
if (!matchesPart(date.getDate(), dayPart)) return false;
|
|
425
|
+
}
|
|
426
|
+
if (weekPart !== "?") {
|
|
427
|
+
if (!matchesPart(date.getDay() + 1, weekPart)) return false;
|
|
428
|
+
}
|
|
429
|
+
if (!matchesPart(date.getHours(), hourPart)) return false;
|
|
430
|
+
if (!matchesPart(date.getMinutes(), minPart)) return false;
|
|
431
|
+
if (!matchesPart(date.getSeconds(), secPart)) return false;
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
/** 计算未来 N 次执行时间 */
|
|
435
|
+
function computeNextExecutions() {
|
|
436
|
+
const expr = expression.value;
|
|
437
|
+
if (!expr || !validation.value.valid) return [];
|
|
438
|
+
const parts = expr.trim().split(/\s+/);
|
|
439
|
+
if (parts.length !== 6) return [];
|
|
440
|
+
const results = [];
|
|
441
|
+
const now = /* @__PURE__ */ new Date();
|
|
442
|
+
const cursor = new Date(now.getTime() + 1e3);
|
|
443
|
+
cursor.setMilliseconds(0);
|
|
444
|
+
const hasSecond = parts[0] !== "0";
|
|
445
|
+
const stepMs = hasSecond ? 1e3 : 6e4;
|
|
446
|
+
if (!hasSecond) {
|
|
447
|
+
cursor.setSeconds(0);
|
|
448
|
+
if (cursor.getTime() <= now.getTime()) cursor.setTime(cursor.getTime() + 6e4);
|
|
449
|
+
}
|
|
450
|
+
const maxIterations = 525600;
|
|
451
|
+
const target = count.value;
|
|
452
|
+
for (let i = 0; i < maxIterations && results.length < target; i++) {
|
|
453
|
+
if (matchesCron(cursor, parts)) results.push(new Date(cursor));
|
|
454
|
+
cursor.setTime(cursor.getTime() + stepMs);
|
|
455
|
+
}
|
|
456
|
+
return results;
|
|
457
|
+
}
|
|
458
|
+
watch([expression, count], () => {
|
|
459
|
+
if (!validation.value.valid) {
|
|
460
|
+
nextExecutions.value = [];
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
computing.value = true;
|
|
464
|
+
setTimeout(() => {
|
|
465
|
+
nextExecutions.value = computeNextExecutions();
|
|
466
|
+
computing.value = false;
|
|
467
|
+
}, 0);
|
|
468
|
+
}, { immediate: true });
|
|
469
|
+
/** 格式化日期为字符串 */
|
|
470
|
+
function formatDate(date) {
|
|
471
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
472
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
473
|
+
}
|
|
474
|
+
/** 获取日期的中文星期名称 */
|
|
475
|
+
function formatWeekDay(date) {
|
|
476
|
+
return [
|
|
477
|
+
"周日",
|
|
478
|
+
"周一",
|
|
479
|
+
"周二",
|
|
480
|
+
"周三",
|
|
481
|
+
"周四",
|
|
482
|
+
"周五",
|
|
483
|
+
"周六"
|
|
484
|
+
][date.getDay()];
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
nextExecutions,
|
|
488
|
+
computing,
|
|
489
|
+
formatDate,
|
|
490
|
+
formatWeekDay
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region src/components/C_Cron/composables/useCronDescription.ts
|
|
496
|
+
/** 获取周名称 */
|
|
497
|
+
function weekLabel(n) {
|
|
498
|
+
return WEEK_LABELS[Number(n)] || `周${n}`;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* 将 Cron 表达式自动转换为中文可读描述
|
|
502
|
+
*/
|
|
503
|
+
function useCronDescription(expression, validation) {
|
|
504
|
+
/** 中文描述 */
|
|
505
|
+
const description = computed(() => {
|
|
506
|
+
if (!validation.value.valid) return "表达式不合法";
|
|
507
|
+
return generateDescription(expression.value);
|
|
508
|
+
});
|
|
509
|
+
/** 将完整 Cron 表达式转为中文描述 */
|
|
510
|
+
function generateDescription(expr) {
|
|
511
|
+
const parts = expr.trim().split(/\s+/);
|
|
512
|
+
if (parts.length !== 6) return "表达式格式错误";
|
|
513
|
+
const [sec, min, hour, day, month, week] = parts;
|
|
514
|
+
const fragments = [];
|
|
515
|
+
fragments.push(describeMonth(month));
|
|
516
|
+
if (week !== "?") fragments.push(describeWeek(week));
|
|
517
|
+
else fragments.push(describeDay(day));
|
|
518
|
+
fragments.push(describeHour(hour));
|
|
519
|
+
fragments.push(describeMinute(min));
|
|
520
|
+
fragments.push(describeSecond(sec));
|
|
521
|
+
return fragments.filter(Boolean).join(" ") + " 执行";
|
|
522
|
+
}
|
|
523
|
+
/** 描述秒字段 */
|
|
524
|
+
function describeSecond(part) {
|
|
525
|
+
if (part === "0") return "";
|
|
526
|
+
if (part === "*") return "每秒";
|
|
527
|
+
return describeFieldGeneric(part, "秒");
|
|
528
|
+
}
|
|
529
|
+
/** 描述分字段 */
|
|
530
|
+
function describeMinute(part) {
|
|
531
|
+
if (part === "*") return "每分钟";
|
|
532
|
+
if (part === "0") return "";
|
|
533
|
+
return describeFieldGeneric(part, "分");
|
|
534
|
+
}
|
|
535
|
+
/** 描述时字段 */
|
|
536
|
+
function describeHour(part) {
|
|
537
|
+
if (part === "*") return "每小时";
|
|
538
|
+
if (/^\d+$/.test(part)) return `${part.padStart(2, "0")}:`;
|
|
539
|
+
return describeFieldGeneric(part, "时");
|
|
540
|
+
}
|
|
541
|
+
/** 描述日字段 */
|
|
542
|
+
function describeDay(part) {
|
|
543
|
+
if (part === "*" || part === "?") return "每天";
|
|
544
|
+
if (/^\d+$/.test(part)) return `每月 ${part} 号`;
|
|
545
|
+
if (part.includes("/")) {
|
|
546
|
+
const [s, i] = part.split("/");
|
|
547
|
+
return `从 ${s} 号开始每 ${i} 天`;
|
|
548
|
+
}
|
|
549
|
+
if (part.includes("-")) {
|
|
550
|
+
const [s, e] = part.split("-");
|
|
551
|
+
return `${s} 号到 ${e} 号`;
|
|
552
|
+
}
|
|
553
|
+
if (part.includes(",")) return `每月 ${part} 号`;
|
|
554
|
+
return "";
|
|
555
|
+
}
|
|
556
|
+
/** 描述月字段 */
|
|
557
|
+
function describeMonth(part) {
|
|
558
|
+
if (part === "*") return "";
|
|
559
|
+
if (/^\d+$/.test(part)) {
|
|
560
|
+
const n = Number(part);
|
|
561
|
+
return MONTH_LABELS[n] ? `${MONTH_LABELS[n]}` : `${n} 月`;
|
|
562
|
+
}
|
|
563
|
+
if (part.includes("/")) {
|
|
564
|
+
const [s, i] = part.split("/");
|
|
565
|
+
return `从 ${s} 月开始每 ${i} 个月`;
|
|
566
|
+
}
|
|
567
|
+
if (part.includes("-")) {
|
|
568
|
+
const [s, e] = part.split("-");
|
|
569
|
+
return `${s} 月到 ${e} 月`;
|
|
570
|
+
}
|
|
571
|
+
if (part.includes(",")) return part.split(",").map((n) => MONTH_LABELS[Number(n)] || `${n}月`).join("、");
|
|
572
|
+
return "";
|
|
573
|
+
}
|
|
574
|
+
/** 描述周字段 */
|
|
575
|
+
function describeWeek(part) {
|
|
576
|
+
if (part === "*" || part === "?") return "";
|
|
577
|
+
if (/^\d+$/.test(part)) return `每${weekLabel(part)}`;
|
|
578
|
+
if (part.includes("/")) return `从${weekLabel(part.split("/")[0])}开始每 ${part.split("/")[1]} 天`;
|
|
579
|
+
if (part.includes("-")) return `${weekLabel(part.split("-")[0])}到${weekLabel(part.split("-")[1])}`;
|
|
580
|
+
if (part.includes(",")) return `每${part.split(",").map(weekLabel).join("、")}`;
|
|
581
|
+
return "";
|
|
582
|
+
}
|
|
583
|
+
/** 通用字段描述 */
|
|
584
|
+
function describeFieldGeneric(part, unit) {
|
|
585
|
+
if (part.includes("/")) {
|
|
586
|
+
const [s, i] = part.split("/");
|
|
587
|
+
return `${s === "*" || s === "0" ? "" : `从第 ${s} ${unit}开始`}每 ${i} ${unit}`;
|
|
588
|
+
}
|
|
589
|
+
if (part.includes("-")) {
|
|
590
|
+
const [s, e] = part.split("-");
|
|
591
|
+
return `${s} ${unit}到 ${e} ${unit}`;
|
|
592
|
+
}
|
|
593
|
+
if (part.includes(",")) return `第 ${part} ${unit}`;
|
|
594
|
+
if (/^\d+$/.test(part)) return `${part.padStart(2, "0")}`;
|
|
595
|
+
return "";
|
|
596
|
+
}
|
|
597
|
+
return { description };
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/components/C_Cron/components/CronFieldEditor.vue?vue&type=script&setup=true&lang.ts
|
|
602
|
+
const _hoisted_1$3 = { class: "cron-field-editor" };
|
|
603
|
+
const _hoisted_2$3 = ["onClick"];
|
|
604
|
+
var CronFieldEditor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
605
|
+
__name: "CronFieldEditor",
|
|
606
|
+
props: {
|
|
607
|
+
modelValue: {},
|
|
608
|
+
meta: {}
|
|
609
|
+
},
|
|
610
|
+
emits: ["update:modelValue"],
|
|
611
|
+
setup(__props, { emit: __emit }) {
|
|
612
|
+
const props = __props;
|
|
613
|
+
const emit = __emit;
|
|
614
|
+
/** 网格列数 */
|
|
615
|
+
const gridColumns = computed(() => {
|
|
616
|
+
switch (props.meta.type) {
|
|
617
|
+
case "second":
|
|
618
|
+
case "minute": return 10;
|
|
619
|
+
case "hour": return 12;
|
|
620
|
+
case "day": return 7;
|
|
621
|
+
case "month": return 6;
|
|
622
|
+
case "week": return 7;
|
|
623
|
+
default: return 10;
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
/** 可选值列表 */
|
|
627
|
+
const valueOptions = computed(() => {
|
|
628
|
+
const items = [];
|
|
629
|
+
for (let i = props.meta.min; i <= props.meta.max; i++) items.push({
|
|
630
|
+
value: i,
|
|
631
|
+
label: props.meta.valueLabels?.[i] ?? String(i)
|
|
632
|
+
});
|
|
633
|
+
return items;
|
|
634
|
+
});
|
|
635
|
+
/** 根据当前模式计算高亮值集合 */
|
|
636
|
+
const highlightedValues = computed(() => {
|
|
637
|
+
const { modelValue: f, meta } = props;
|
|
638
|
+
const set = /* @__PURE__ */ new Set();
|
|
639
|
+
switch (f.mode) {
|
|
640
|
+
case "every":
|
|
641
|
+
for (let i = meta.min; i <= meta.max; i++) set.add(i);
|
|
642
|
+
break;
|
|
643
|
+
case "none": break;
|
|
644
|
+
case "range":
|
|
645
|
+
for (let i = f.rangeStart; i <= f.rangeEnd; i++) set.add(i);
|
|
646
|
+
break;
|
|
647
|
+
case "step":
|
|
648
|
+
for (let i = f.stepStart; i <= meta.max; i += f.stepInterval) set.add(i);
|
|
649
|
+
break;
|
|
650
|
+
case "specific":
|
|
651
|
+
f.specificValues.forEach((v) => set.add(v));
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
return set;
|
|
655
|
+
});
|
|
656
|
+
/** 点击单元格(仅 specific 模式生效) */
|
|
657
|
+
function handleCellClick(value) {
|
|
658
|
+
if (props.modelValue.mode !== "specific") return;
|
|
659
|
+
const current = [...props.modelValue.specificValues];
|
|
660
|
+
const idx = current.indexOf(value);
|
|
661
|
+
if (idx >= 0) current.splice(idx, 1);
|
|
662
|
+
else current.push(value);
|
|
663
|
+
emit("update:modelValue", {
|
|
664
|
+
...props.modelValue,
|
|
665
|
+
specificValues: current
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
return (_ctx, _cache) => {
|
|
669
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("div", {
|
|
670
|
+
class: "cron-field-editor__grid",
|
|
671
|
+
style: normalizeStyle({ "--cols": gridColumns.value })
|
|
672
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(valueOptions.value, (item) => {
|
|
673
|
+
return openBlock(), createElementBlock("div", {
|
|
674
|
+
key: item.value,
|
|
675
|
+
class: normalizeClass(["cron-field-editor__cell", {
|
|
676
|
+
"cron-field-editor__cell--on": highlightedValues.value.has(item.value),
|
|
677
|
+
"cron-field-editor__cell--pick": _ctx.modelValue.mode === "specific"
|
|
678
|
+
}]),
|
|
679
|
+
onClick: ($event) => handleCellClick(item.value)
|
|
680
|
+
}, toDisplayString(item.label), 11, _hoisted_2$3);
|
|
681
|
+
}), 128))], 4)]);
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/components/C_Cron/components/CronFieldEditor.vue
|
|
688
|
+
var CronFieldEditor_default = /* @__PURE__ */ export_helper_default(CronFieldEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e6fa8e5b"]]);
|
|
689
|
+
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/components/C_Cron/components/CronPreview.vue?vue&type=script&setup=true&lang.ts
|
|
692
|
+
const _hoisted_1$2 = { class: "cron-preview" };
|
|
693
|
+
const _hoisted_2$2 = { class: "cron-preview__header" };
|
|
694
|
+
const _hoisted_3$2 = {
|
|
695
|
+
key: 0,
|
|
696
|
+
class: "cron-preview__list"
|
|
697
|
+
};
|
|
698
|
+
const _hoisted_4$2 = { class: "cron-preview__idx" };
|
|
699
|
+
const _hoisted_5$2 = { class: "cron-preview__date" };
|
|
700
|
+
const _hoisted_6$2 = { class: "cron-preview__week" };
|
|
701
|
+
var CronPreview_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
702
|
+
__name: "CronPreview",
|
|
703
|
+
props: {
|
|
704
|
+
nextExecutions: {},
|
|
705
|
+
computing: { type: Boolean },
|
|
706
|
+
count: {},
|
|
707
|
+
formatDate: { type: Function },
|
|
708
|
+
formatWeekDay: { type: Function }
|
|
709
|
+
},
|
|
710
|
+
setup(__props) {
|
|
711
|
+
return (_ctx, _cache) => {
|
|
712
|
+
const _component_NSpin = resolveComponent("NSpin");
|
|
713
|
+
const _component_NEmpty = resolveComponent("NEmpty");
|
|
714
|
+
const _component_NScrollbar = resolveComponent("NScrollbar");
|
|
715
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("div", _hoisted_2$2, [
|
|
716
|
+
createVNode(C_Icon_default, {
|
|
717
|
+
name: "mdi:calendar-clock",
|
|
718
|
+
size: 15
|
|
719
|
+
}),
|
|
720
|
+
_cache[0] || (_cache[0] = createElementVNode("span", null, "未来执行", -1)),
|
|
721
|
+
_ctx.computing ? (openBlock(), createBlock(_component_NSpin, {
|
|
722
|
+
key: 0,
|
|
723
|
+
size: 14
|
|
724
|
+
})) : createCommentVNode("v-if", true)
|
|
725
|
+
]), createVNode(_component_NScrollbar, { style: { "max-height": "220px" } }, {
|
|
726
|
+
default: withCtx(() => [_ctx.nextExecutions.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nextExecutions, (date, index) => {
|
|
727
|
+
return openBlock(), createElementBlock("div", {
|
|
728
|
+
key: index,
|
|
729
|
+
class: "cron-preview__item"
|
|
730
|
+
}, [
|
|
731
|
+
createElementVNode("span", _hoisted_4$2, toDisplayString(index + 1), 1),
|
|
732
|
+
createElementVNode("span", _hoisted_5$2, toDisplayString(_ctx.formatDate(date)), 1),
|
|
733
|
+
createElementVNode("span", _hoisted_6$2, toDisplayString(_ctx.formatWeekDay(date)), 1)
|
|
734
|
+
]);
|
|
735
|
+
}), 128))])) : (openBlock(), createBlock(_component_NEmpty, {
|
|
736
|
+
key: 1,
|
|
737
|
+
size: "small",
|
|
738
|
+
description: "暂无匹配"
|
|
739
|
+
}))]),
|
|
740
|
+
_: 1
|
|
741
|
+
})]);
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
//#endregion
|
|
747
|
+
//#region src/components/C_Cron/components/CronPreview.vue
|
|
748
|
+
var CronPreview_default = /* @__PURE__ */ export_helper_default(CronPreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-a695bb32"]]);
|
|
749
|
+
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/components/C_Cron/components/CronTemplates.vue?vue&type=script&setup=true&lang.ts
|
|
752
|
+
const _hoisted_1$1 = { class: "cron-templates" };
|
|
753
|
+
const _hoisted_2$1 = { class: "cron-templates__header" };
|
|
754
|
+
const _hoisted_3$1 = { class: "cron-templates__cards" };
|
|
755
|
+
const _hoisted_4$1 = ["onClick"];
|
|
756
|
+
const _hoisted_5$1 = { class: "cron-templates__card-name" };
|
|
757
|
+
const _hoisted_6$1 = { class: "cron-templates__card-expr" };
|
|
758
|
+
var CronTemplates_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
759
|
+
__name: "CronTemplates",
|
|
760
|
+
props: {
|
|
761
|
+
templates: {},
|
|
762
|
+
currentValue: {}
|
|
763
|
+
},
|
|
764
|
+
emits: ["select"],
|
|
765
|
+
setup(__props) {
|
|
766
|
+
return (_ctx, _cache) => {
|
|
767
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [createVNode(C_Icon_default, {
|
|
768
|
+
name: "mdi:lightning-bolt",
|
|
769
|
+
size: 15
|
|
770
|
+
}), _cache[0] || (_cache[0] = createElementVNode("span", null, "常用模板", -1))]), createElementVNode("div", _hoisted_3$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templates, (template) => {
|
|
771
|
+
return openBlock(), createElementBlock("div", {
|
|
772
|
+
key: template.value,
|
|
773
|
+
class: normalizeClass(["cron-templates__card", { "cron-templates__card--active": template.value === _ctx.currentValue }]),
|
|
774
|
+
onClick: ($event) => _ctx.$emit("select", template.value)
|
|
775
|
+
}, [createElementVNode("div", _hoisted_5$1, toDisplayString(template.label), 1), createElementVNode("div", _hoisted_6$1, toDisplayString(template.value), 1)], 10, _hoisted_4$1);
|
|
776
|
+
}), 128))])]);
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/components/C_Cron/components/CronTemplates.vue
|
|
783
|
+
var CronTemplates_default = /* @__PURE__ */ export_helper_default(CronTemplates_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-fe320f38"]]);
|
|
784
|
+
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/components/C_Cron/index.vue?vue&type=script&setup=true&lang.ts
|
|
787
|
+
const _hoisted_1 = { class: "c-cron__header" };
|
|
788
|
+
const _hoisted_2 = { class: "c-cron__title-row" };
|
|
789
|
+
const _hoisted_3 = { class: "c-cron__title" };
|
|
790
|
+
const _hoisted_4 = { class: "c-cron__segments" };
|
|
791
|
+
const _hoisted_5 = ["onClick"];
|
|
792
|
+
const _hoisted_6 = { class: "c-cron__segment-value" };
|
|
793
|
+
const _hoisted_7 = { class: "c-cron__segment-label" };
|
|
794
|
+
const _hoisted_8 = { class: "c-cron__expr-row" };
|
|
795
|
+
const _hoisted_9 = { class: "c-cron__expr-desc" };
|
|
796
|
+
const _hoisted_10 = {
|
|
797
|
+
key: 0,
|
|
798
|
+
class: "c-cron__description"
|
|
799
|
+
};
|
|
800
|
+
const _hoisted_11 = {
|
|
801
|
+
key: 1,
|
|
802
|
+
class: "c-cron__error"
|
|
803
|
+
};
|
|
804
|
+
const _hoisted_12 = { class: "c-cron__body" };
|
|
805
|
+
const _hoisted_13 = { class: "c-cron__main" };
|
|
806
|
+
const _hoisted_14 = { class: "c-cron__panel" };
|
|
807
|
+
const _hoisted_15 = {
|
|
808
|
+
key: 0,
|
|
809
|
+
class: "c-cron__config"
|
|
810
|
+
};
|
|
811
|
+
const _hoisted_16 = { class: "c-cron__config-row" };
|
|
812
|
+
const _hoisted_17 = {
|
|
813
|
+
key: 1,
|
|
814
|
+
class: "c-cron__config"
|
|
815
|
+
};
|
|
816
|
+
const _hoisted_18 = { class: "c-cron__config-row" };
|
|
817
|
+
const _hoisted_19 = {
|
|
818
|
+
key: 2,
|
|
819
|
+
class: "c-cron__quick"
|
|
820
|
+
};
|
|
821
|
+
const _hoisted_20 = {
|
|
822
|
+
key: 0,
|
|
823
|
+
class: "c-cron__quick-count"
|
|
824
|
+
};
|
|
825
|
+
const _hoisted_21 = {
|
|
826
|
+
key: 0,
|
|
827
|
+
class: "c-cron__footer"
|
|
828
|
+
};
|
|
829
|
+
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
830
|
+
name: "C_Cron",
|
|
831
|
+
__name: "index",
|
|
832
|
+
props: {
|
|
833
|
+
modelValue: { default: DEFAULT_CRON_EXPRESSION },
|
|
834
|
+
disabled: {
|
|
835
|
+
type: Boolean,
|
|
836
|
+
default: false
|
|
837
|
+
},
|
|
838
|
+
previewCount: { default: 10 },
|
|
839
|
+
showTemplates: {
|
|
840
|
+
type: Boolean,
|
|
841
|
+
default: true
|
|
842
|
+
},
|
|
843
|
+
showPreview: {
|
|
844
|
+
type: Boolean,
|
|
845
|
+
default: true
|
|
846
|
+
},
|
|
847
|
+
showSecond: {
|
|
848
|
+
type: Boolean,
|
|
849
|
+
default: true
|
|
850
|
+
},
|
|
851
|
+
height: { default: "auto" }
|
|
852
|
+
},
|
|
853
|
+
emits: [
|
|
854
|
+
"update:modelValue",
|
|
855
|
+
"change",
|
|
856
|
+
"validation-change"
|
|
857
|
+
],
|
|
858
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
859
|
+
const props = __props;
|
|
860
|
+
const emit = __emit;
|
|
861
|
+
const { cronValue, expression, validation, parse, validate, handleDayWeekExclusion } = useCronParser();
|
|
862
|
+
const { nextExecutions, computing, formatDate, formatWeekDay } = useCronPreview(expression, validation, computed(() => props.previewCount ?? 10));
|
|
863
|
+
const { description } = useCronDescription(expression, validation);
|
|
864
|
+
/** 手动输入框值(与 expression 解耦,输入完成后同步) */
|
|
865
|
+
const manualInput = ref(props.modelValue || DEFAULT_CRON_EXPRESSION);
|
|
866
|
+
/** 当前激活的字段 Tab */
|
|
867
|
+
const activeField = ref(props.showSecond ? "second" : "minute");
|
|
868
|
+
const containerHeight = computed(() => {
|
|
869
|
+
if (typeof props.height === "number") return `${props.height}px`;
|
|
870
|
+
return props.height;
|
|
871
|
+
});
|
|
872
|
+
const visibleFields = computed(() => {
|
|
873
|
+
return props.showSecond ? CRON_FIELD_META : CRON_FIELD_META.filter((m) => m.type !== "second");
|
|
874
|
+
});
|
|
875
|
+
/** 当前激活字段元数据 */
|
|
876
|
+
const activeFieldMeta = computed(() => CRON_FIELD_META.find((m) => m.type === activeField.value));
|
|
877
|
+
/** 当前激活字段值 */
|
|
878
|
+
const activeFieldValue = computed(() => cronValue.value[activeField.value]);
|
|
879
|
+
/** 计算单字段表达式文本 */
|
|
880
|
+
function computeFieldExpr(f) {
|
|
881
|
+
switch (f.mode) {
|
|
882
|
+
case "every": return "*";
|
|
883
|
+
case "none": return "?";
|
|
884
|
+
case "range": return `${f.rangeStart}-${f.rangeEnd}`;
|
|
885
|
+
case "step": return `${f.stepStart}/${f.stepInterval}`;
|
|
886
|
+
case "specific": return f.specificValues.length > 0 ? [...f.specificValues].sort((a, b) => a - b).join(",") : "*";
|
|
887
|
+
default: return "*";
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
/** 各字段表达式映射 */
|
|
891
|
+
const fieldExpressions = computed(() => {
|
|
892
|
+
const map = {};
|
|
893
|
+
for (const meta of CRON_FIELD_META) map[meta.type] = computeFieldExpr(cronValue.value[meta.type]);
|
|
894
|
+
return map;
|
|
895
|
+
});
|
|
896
|
+
onMounted(() => {
|
|
897
|
+
const initial = props.modelValue || DEFAULT_CRON_EXPRESSION;
|
|
898
|
+
parse(initial);
|
|
899
|
+
manualInput.value = initial;
|
|
900
|
+
});
|
|
901
|
+
watch(() => props.modelValue, (newVal) => {
|
|
902
|
+
if (newVal && newVal !== expression.value) {
|
|
903
|
+
parse(newVal);
|
|
904
|
+
manualInput.value = newVal;
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
watch(() => props.showSecond, (show) => {
|
|
908
|
+
if (!show && activeField.value === "second") activeField.value = "minute";
|
|
909
|
+
});
|
|
910
|
+
watch(expression, (newExpr) => {
|
|
911
|
+
manualInput.value = newExpr;
|
|
912
|
+
emit("update:modelValue", newExpr);
|
|
913
|
+
emit("change", newExpr);
|
|
914
|
+
});
|
|
915
|
+
watch(validation, (v) => {
|
|
916
|
+
emit("validation-change", v);
|
|
917
|
+
});
|
|
918
|
+
/** 字段编辑变更处理 */
|
|
919
|
+
function handleFieldChange(type, value) {
|
|
920
|
+
cronValue.value[type] = value;
|
|
921
|
+
if (type === "day" || type === "week") handleDayWeekExclusion(type);
|
|
922
|
+
}
|
|
923
|
+
/** 切换当前字段模式 */
|
|
924
|
+
function handleActiveFieldModeChange(mode) {
|
|
925
|
+
handleFieldChange(activeField.value, {
|
|
926
|
+
...activeFieldValue.value,
|
|
927
|
+
mode
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
/** 更新当前字段属性 */
|
|
931
|
+
function handleActiveFieldUpdate(partial) {
|
|
932
|
+
handleFieldChange(activeField.value, {
|
|
933
|
+
...activeFieldValue.value,
|
|
934
|
+
...partial
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
/** 全选当前字段所有值 */
|
|
938
|
+
function handleSelectAll() {
|
|
939
|
+
const { min, max } = activeFieldMeta.value;
|
|
940
|
+
const allValues = Array.from({ length: max - min + 1 }, (_, i) => min + i);
|
|
941
|
+
handleFieldChange(activeField.value, {
|
|
942
|
+
...activeFieldValue.value,
|
|
943
|
+
specificValues: allValues
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
/** 清空当前字段所有选中值 */
|
|
947
|
+
function handleClearAll() {
|
|
948
|
+
handleFieldChange(activeField.value, {
|
|
949
|
+
...activeFieldValue.value,
|
|
950
|
+
specificValues: []
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
/** 手动输入更新 */
|
|
954
|
+
function handleManualInput(value) {
|
|
955
|
+
manualInput.value = value;
|
|
956
|
+
}
|
|
957
|
+
/** 输入框失焦时同步 */
|
|
958
|
+
function handleManualBlur() {
|
|
959
|
+
const trimmed = manualInput.value.trim();
|
|
960
|
+
if (trimmed && trimmed !== expression.value) parse(trimmed);
|
|
961
|
+
}
|
|
962
|
+
/** 选择常用模板 */
|
|
963
|
+
function handleTemplateSelect(expr) {
|
|
964
|
+
parse(expr);
|
|
965
|
+
manualInput.value = expr;
|
|
966
|
+
}
|
|
967
|
+
/** 重置为初始值 */
|
|
968
|
+
function handleReset() {
|
|
969
|
+
const initial = props.modelValue || DEFAULT_CRON_EXPRESSION;
|
|
970
|
+
parse(initial);
|
|
971
|
+
manualInput.value = initial;
|
|
972
|
+
}
|
|
973
|
+
__expose({
|
|
974
|
+
getValue: () => expression.value,
|
|
975
|
+
setValue: (expr) => {
|
|
976
|
+
parse(expr);
|
|
977
|
+
manualInput.value = expr;
|
|
978
|
+
},
|
|
979
|
+
reset: handleReset,
|
|
980
|
+
validate: () => validate()
|
|
981
|
+
});
|
|
982
|
+
return (_ctx, _cache) => {
|
|
983
|
+
const _component_NTag = resolveComponent("NTag");
|
|
984
|
+
const _component_NInput = resolveComponent("NInput");
|
|
985
|
+
const _component_NButton = resolveComponent("NButton");
|
|
986
|
+
const _component_NRadioButton = resolveComponent("NRadioButton");
|
|
987
|
+
const _component_NRadioGroup = resolveComponent("NRadioGroup");
|
|
988
|
+
const _component_NInputNumber = resolveComponent("NInputNumber");
|
|
989
|
+
return openBlock(), createElementBlock("div", {
|
|
990
|
+
class: "c-cron",
|
|
991
|
+
style: normalizeStyle({ height: containerHeight.value })
|
|
992
|
+
}, [
|
|
993
|
+
createCommentVNode(" ═══════ 顶部 ═══════ "),
|
|
994
|
+
createElementVNode("div", _hoisted_1, [
|
|
995
|
+
createCommentVNode(" 标题行 "),
|
|
996
|
+
createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createVNode(C_Icon_default, {
|
|
997
|
+
name: "mdi:clock-edit-outline",
|
|
998
|
+
size: 18
|
|
999
|
+
}), _cache[4] || (_cache[4] = createElementVNode("span", null, "Cron 表达式", -1))]), createVNode(_component_NTag, {
|
|
1000
|
+
type: unref(validation).valid ? "success" : "error",
|
|
1001
|
+
size: "small",
|
|
1002
|
+
round: ""
|
|
1003
|
+
}, {
|
|
1004
|
+
icon: withCtx(() => [createVNode(C_Icon_default, { name: unref(validation).valid ? "mdi:check-circle" : "mdi:alert-circle" }, null, 8, ["name"])]),
|
|
1005
|
+
default: withCtx(() => [createTextVNode(" " + toDisplayString(unref(validation).valid ? "合法" : "错误"), 1)]),
|
|
1006
|
+
_: 1
|
|
1007
|
+
}, 8, ["type"])]),
|
|
1008
|
+
createCommentVNode(" 分段式字段选择器 "),
|
|
1009
|
+
createElementVNode("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFields.value, (meta) => {
|
|
1010
|
+
return openBlock(), createElementBlock("div", {
|
|
1011
|
+
key: meta.type,
|
|
1012
|
+
class: normalizeClass(["c-cron__segment", {
|
|
1013
|
+
"c-cron__segment--active": activeField.value === meta.type,
|
|
1014
|
+
"c-cron__segment--wildcard": fieldExpressions.value[meta.type] === "*" || fieldExpressions.value[meta.type] === "?"
|
|
1015
|
+
}]),
|
|
1016
|
+
onClick: ($event) => activeField.value = meta.type
|
|
1017
|
+
}, [createElementVNode("div", _hoisted_6, toDisplayString(fieldExpressions.value[meta.type]), 1), createElementVNode("div", _hoisted_7, toDisplayString(meta.label), 1)], 10, _hoisted_5);
|
|
1018
|
+
}), 128))]),
|
|
1019
|
+
createCommentVNode(" 表达式行:输入 + 重置 + 描述 "),
|
|
1020
|
+
createElementVNode("div", _hoisted_8, [
|
|
1021
|
+
createVNode(_component_NInput, {
|
|
1022
|
+
value: manualInput.value,
|
|
1023
|
+
status: unref(validation).valid ? void 0 : "error",
|
|
1024
|
+
placeholder: "秒 分 时 日 月 周",
|
|
1025
|
+
disabled: props.disabled,
|
|
1026
|
+
font: "mono",
|
|
1027
|
+
size: "small",
|
|
1028
|
+
clearable: "",
|
|
1029
|
+
class: "c-cron__expr-input",
|
|
1030
|
+
"onUpdate:value": handleManualInput,
|
|
1031
|
+
onBlur: handleManualBlur,
|
|
1032
|
+
onKeydown: withKeys(handleManualBlur, ["enter"])
|
|
1033
|
+
}, {
|
|
1034
|
+
prefix: withCtx(() => [createVNode(C_Icon_default, {
|
|
1035
|
+
name: "mdi:console",
|
|
1036
|
+
size: 14,
|
|
1037
|
+
style: { "opacity": "0.4" }
|
|
1038
|
+
})]),
|
|
1039
|
+
_: 1
|
|
1040
|
+
}, 8, [
|
|
1041
|
+
"value",
|
|
1042
|
+
"status",
|
|
1043
|
+
"disabled"
|
|
1044
|
+
]),
|
|
1045
|
+
createVNode(_component_NButton, {
|
|
1046
|
+
size: "small",
|
|
1047
|
+
quaternary: "",
|
|
1048
|
+
disabled: props.disabled,
|
|
1049
|
+
onClick: handleReset
|
|
1050
|
+
}, {
|
|
1051
|
+
icon: withCtx(() => [createVNode(C_Icon_default, { name: "mdi:refresh" })]),
|
|
1052
|
+
_: 1
|
|
1053
|
+
}, 8, ["disabled"]),
|
|
1054
|
+
createElementVNode("div", _hoisted_9, [unref(validation).valid ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(unref(description)), 1)) : (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(unref(validation).message), 1))])
|
|
1055
|
+
])
|
|
1056
|
+
]),
|
|
1057
|
+
createCommentVNode(" ═══════ 主内容 ═══════ "),
|
|
1058
|
+
createElementVNode("div", _hoisted_12, [
|
|
1059
|
+
createCommentVNode(" 左侧:值网格 "),
|
|
1060
|
+
createElementVNode("div", _hoisted_13, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFields.value, (meta) => {
|
|
1061
|
+
return withDirectives((openBlock(), createBlock(CronFieldEditor_default, {
|
|
1062
|
+
key: meta.type,
|
|
1063
|
+
"model-value": unref(cronValue)[meta.type],
|
|
1064
|
+
meta,
|
|
1065
|
+
"onUpdate:modelValue": (v) => handleFieldChange(meta.type, v)
|
|
1066
|
+
}, null, 8, [
|
|
1067
|
+
"model-value",
|
|
1068
|
+
"meta",
|
|
1069
|
+
"onUpdate:modelValue"
|
|
1070
|
+
])), [[vShow, activeField.value === meta.type]]);
|
|
1071
|
+
}), 128))]),
|
|
1072
|
+
createCommentVNode(" 右侧:控制面板 "),
|
|
1073
|
+
createElementVNode("div", _hoisted_14, [
|
|
1074
|
+
createVNode(_component_NRadioGroup, {
|
|
1075
|
+
value: activeFieldValue.value.mode,
|
|
1076
|
+
size: "small",
|
|
1077
|
+
"onUpdate:value": handleActiveFieldModeChange
|
|
1078
|
+
}, {
|
|
1079
|
+
default: withCtx(() => [
|
|
1080
|
+
createVNode(_component_NRadioButton, { value: "every" }, {
|
|
1081
|
+
default: withCtx(() => [createTextVNode(" 每" + toDisplayString(activeFieldMeta.value.label), 1)]),
|
|
1082
|
+
_: 1
|
|
1083
|
+
}),
|
|
1084
|
+
activeField.value === "day" || activeField.value === "week" ? (openBlock(), createBlock(_component_NRadioButton, {
|
|
1085
|
+
key: 0,
|
|
1086
|
+
value: "none"
|
|
1087
|
+
}, {
|
|
1088
|
+
default: withCtx(() => _cache[5] || (_cache[5] = [createTextVNode(" 不指定 ", -1)])),
|
|
1089
|
+
_: 1,
|
|
1090
|
+
__: [5]
|
|
1091
|
+
})) : createCommentVNode("v-if", true),
|
|
1092
|
+
createVNode(_component_NRadioButton, { value: "range" }, {
|
|
1093
|
+
default: withCtx(() => _cache[6] || (_cache[6] = [createTextVNode("范围", -1)])),
|
|
1094
|
+
_: 1,
|
|
1095
|
+
__: [6]
|
|
1096
|
+
}),
|
|
1097
|
+
createVNode(_component_NRadioButton, { value: "step" }, {
|
|
1098
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [createTextVNode("步进", -1)])),
|
|
1099
|
+
_: 1,
|
|
1100
|
+
__: [7]
|
|
1101
|
+
}),
|
|
1102
|
+
createVNode(_component_NRadioButton, { value: "specific" }, {
|
|
1103
|
+
default: withCtx(() => _cache[8] || (_cache[8] = [createTextVNode("指定", -1)])),
|
|
1104
|
+
_: 1,
|
|
1105
|
+
__: [8]
|
|
1106
|
+
})
|
|
1107
|
+
]),
|
|
1108
|
+
_: 1
|
|
1109
|
+
}, 8, ["value"]),
|
|
1110
|
+
createCommentVNode(" 范围配置 "),
|
|
1111
|
+
activeFieldValue.value.mode === "range" ? (openBlock(), createElementBlock("div", _hoisted_15, [createElementVNode("div", _hoisted_16, [
|
|
1112
|
+
_cache[9] || (_cache[9] = createElementVNode("span", null, "从", -1)),
|
|
1113
|
+
createVNode(_component_NInputNumber, {
|
|
1114
|
+
value: activeFieldValue.value.rangeStart,
|
|
1115
|
+
min: activeFieldMeta.value.min,
|
|
1116
|
+
max: activeFieldMeta.value.max,
|
|
1117
|
+
size: "small",
|
|
1118
|
+
"show-button": false,
|
|
1119
|
+
class: "c-cron__config-num",
|
|
1120
|
+
"onUpdate:value": _cache[0] || (_cache[0] = (v) => handleActiveFieldUpdate({ rangeStart: v ?? activeFieldMeta.value.min }))
|
|
1121
|
+
}, null, 8, [
|
|
1122
|
+
"value",
|
|
1123
|
+
"min",
|
|
1124
|
+
"max"
|
|
1125
|
+
]),
|
|
1126
|
+
_cache[10] || (_cache[10] = createElementVNode("span", null, "到", -1)),
|
|
1127
|
+
createVNode(_component_NInputNumber, {
|
|
1128
|
+
value: activeFieldValue.value.rangeEnd,
|
|
1129
|
+
min: activeFieldMeta.value.min,
|
|
1130
|
+
max: activeFieldMeta.value.max,
|
|
1131
|
+
size: "small",
|
|
1132
|
+
"show-button": false,
|
|
1133
|
+
class: "c-cron__config-num",
|
|
1134
|
+
"onUpdate:value": _cache[1] || (_cache[1] = (v) => handleActiveFieldUpdate({ rangeEnd: v ?? activeFieldMeta.value.max }))
|
|
1135
|
+
}, null, 8, [
|
|
1136
|
+
"value",
|
|
1137
|
+
"min",
|
|
1138
|
+
"max"
|
|
1139
|
+
])
|
|
1140
|
+
])])) : createCommentVNode("v-if", true),
|
|
1141
|
+
createCommentVNode(" 步进配置 "),
|
|
1142
|
+
activeFieldValue.value.mode === "step" ? (openBlock(), createElementBlock("div", _hoisted_17, [createElementVNode("div", _hoisted_18, [
|
|
1143
|
+
_cache[11] || (_cache[11] = createElementVNode("span", null, "从第", -1)),
|
|
1144
|
+
createVNode(_component_NInputNumber, {
|
|
1145
|
+
value: activeFieldValue.value.stepStart,
|
|
1146
|
+
min: activeFieldMeta.value.min,
|
|
1147
|
+
max: activeFieldMeta.value.max,
|
|
1148
|
+
size: "small",
|
|
1149
|
+
"show-button": false,
|
|
1150
|
+
class: "c-cron__config-num",
|
|
1151
|
+
"onUpdate:value": _cache[2] || (_cache[2] = (v) => handleActiveFieldUpdate({ stepStart: v ?? activeFieldMeta.value.min }))
|
|
1152
|
+
}, null, 8, [
|
|
1153
|
+
"value",
|
|
1154
|
+
"min",
|
|
1155
|
+
"max"
|
|
1156
|
+
]),
|
|
1157
|
+
createElementVNode("span", null, toDisplayString(activeFieldMeta.value.label) + "起,每", 1),
|
|
1158
|
+
createVNode(_component_NInputNumber, {
|
|
1159
|
+
value: activeFieldValue.value.stepInterval,
|
|
1160
|
+
min: 1,
|
|
1161
|
+
max: activeFieldMeta.value.max - activeFieldMeta.value.min + 1,
|
|
1162
|
+
size: "small",
|
|
1163
|
+
"show-button": false,
|
|
1164
|
+
class: "c-cron__config-num",
|
|
1165
|
+
"onUpdate:value": _cache[3] || (_cache[3] = (v) => handleActiveFieldUpdate({ stepInterval: v ?? 1 }))
|
|
1166
|
+
}, null, 8, ["value", "max"]),
|
|
1167
|
+
createElementVNode("span", null, toDisplayString(activeFieldMeta.value.label) + "执行", 1)
|
|
1168
|
+
])])) : createCommentVNode("v-if", true),
|
|
1169
|
+
createCommentVNode(" 指定快捷操作 "),
|
|
1170
|
+
activeFieldValue.value.mode === "specific" ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
1171
|
+
createElementVNode("a", { onClick: handleSelectAll }, "全选"),
|
|
1172
|
+
_cache[12] || (_cache[12] = createElementVNode("span", { class: "c-cron__quick-sep" }, "·", -1)),
|
|
1173
|
+
createElementVNode("a", { onClick: handleClearAll }, "清空"),
|
|
1174
|
+
activeFieldValue.value.specificValues.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_20, " 已选 " + toDisplayString(activeFieldValue.value.specificValues.length), 1)) : createCommentVNode("v-if", true)
|
|
1175
|
+
])) : createCommentVNode("v-if", true),
|
|
1176
|
+
createCommentVNode(" 执行预览 "),
|
|
1177
|
+
props.showPreview ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [_cache[13] || (_cache[13] = createElementVNode("div", { class: "c-cron__panel-line" }, null, -1)), createVNode(CronPreview_default, {
|
|
1178
|
+
"next-executions": unref(nextExecutions),
|
|
1179
|
+
computing: unref(computing),
|
|
1180
|
+
count: props.previewCount ?? 5,
|
|
1181
|
+
"format-date": unref(formatDate),
|
|
1182
|
+
"format-week-day": unref(formatWeekDay)
|
|
1183
|
+
}, null, 8, [
|
|
1184
|
+
"next-executions",
|
|
1185
|
+
"computing",
|
|
1186
|
+
"count",
|
|
1187
|
+
"format-date",
|
|
1188
|
+
"format-week-day"
|
|
1189
|
+
])], 64)) : createCommentVNode("v-if", true)
|
|
1190
|
+
])
|
|
1191
|
+
]),
|
|
1192
|
+
createCommentVNode(" ═══════ 底部模板 ═══════ "),
|
|
1193
|
+
props.showTemplates ? (openBlock(), createElementBlock("div", _hoisted_21, [createVNode(CronTemplates_default, {
|
|
1194
|
+
templates: unref(CRON_TEMPLATES),
|
|
1195
|
+
"current-value": unref(expression),
|
|
1196
|
+
onSelect: handleTemplateSelect
|
|
1197
|
+
}, null, 8, ["templates", "current-value"])])) : createCommentVNode("v-if", true)
|
|
1198
|
+
], 4);
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
//#endregion
|
|
1204
|
+
//#region src/components/C_Cron/index.vue
|
|
1205
|
+
var C_Cron_default = /* @__PURE__ */ export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-43228b05"]]);
|
|
1206
|
+
|
|
1207
|
+
//#endregion
|
|
1208
|
+
export { CRON_FIELD_META as a, DEFAULT_CRON_VALUE as c, WEEK_LABELS as d, useCronParser as i, DEFAULT_FIELD_VALUE as l, useCronDescription as n, CRON_TEMPLATES as o, useCronPreview as r, DEFAULT_CRON_EXPRESSION as s, C_Cron_default as t, MONTH_LABELS as u };
|
|
1209
|
+
//# sourceMappingURL=C_Cron2.js.map
|