vap1 0.4.5 → 0.5.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/base.json +30 -0
- package/basetype.d.ts +4 -1
- package/cems/admin/AsyncSelect.d.ts +45 -0
- package/cems/admin/AsyncSelect.js +2 -0
- package/cems/admin/CardTable.d.ts +207 -0
- package/cems/admin/CardTable.js +2 -0
- package/cems/admin/EasyuiTree.d.ts +131 -0
- package/cems/admin/EasyuiTree.js +2 -0
- package/cems/admin/utils.d.ts +5 -0
- package/cems/admin/utils.js +3 -0
- package/cems/admin/validator.d.ts +137 -0
- package/cems/admin/validator.js +2 -0
- package/cems/assets/CUpload.d.ts +23 -0
- package/cems/assets/CUpload.js +2 -0
- package/cems/assets/Charts.d.ts +37 -0
- package/cems/assets/Charts.js +2 -0
- package/cems/assets/DInfo.d.ts +38 -0
- package/cems/assets/DInfo.js +2 -0
- package/cems/assets/DModal.d.ts +84 -0
- package/cems/assets/DModal.js +2 -0
- package/cems/assets/DTable.d.ts +128 -0
- package/cems/assets/DTable.js +2 -0
- package/cems/assets/DivWidth.d.ts +14 -0
- package/cems/assets/DivWidth.js +2 -0
- package/cems/assets/Patch.d.ts +9 -0
- package/cems/assets/Patch.js +2 -0
- package/cems/assets/Sensitive.d.ts +33 -0
- package/cems/assets/Sensitive.js +2 -0
- package/cems/assets/types.d.ts +200 -0
- package/cems/assets/types.js +2 -0
- package/cems/assets/utils.d.ts +61 -0
- package/cems/assets/utils.js +2 -0
- package/cems/define.d.ts +9 -0
- package/cems/define.js +18 -0
- package/cems/index.d.ts +228 -0
- package/cems/index.js +81 -0
- package/cems/policy/CForm.d.ts +133 -0
- package/cems/policy/CForm.js +2 -0
- package/cems/policy/DApiTable.d.ts +78 -0
- package/cems/policy/DApiTable.js +2 -0
- package/cems/policy/DButton.d.ts +17 -0
- package/cems/policy/DButton.js +2 -0
- package/cems/policy/DCheckbox.d.ts +50 -0
- package/cems/policy/DCheckbox.js +2 -0
- package/cems/policy/DCheckboxGroup.d.ts +34 -0
- package/cems/policy/DCheckboxGroup.js +2 -0
- package/cems/policy/DCol.d.ts +33 -0
- package/cems/policy/DCol.js +2 -0
- package/cems/policy/DColorPicker.d.ts +9 -0
- package/cems/policy/DColorPicker.js +2 -0
- package/cems/policy/DDatePicker.d.ts +41 -0
- package/cems/policy/DDatePicker.js +2 -0
- package/cems/policy/DDiv.d.ts +65 -0
- package/cems/policy/DDiv.js +2 -0
- package/cems/policy/DDrawer.d.ts +6 -0
- package/cems/policy/DDrawer.js +2 -0
- package/cems/policy/DDynamicSelect.d.ts +50 -0
- package/cems/policy/DDynamicSelect.js +2 -0
- package/cems/policy/DDynamicTreeSelect.d.ts +45 -0
- package/cems/policy/DDynamicTreeSelect.js +2 -0
- package/cems/policy/DForm.d.ts +248 -0
- package/cems/policy/DForm.js +2 -0
- package/cems/policy/DIcon.d.ts +33 -0
- package/cems/policy/DIcon.js +2 -0
- package/cems/policy/DInput.d.ts +41 -0
- package/cems/policy/DInput.js +2 -0
- package/cems/policy/DLabel.d.ts +17 -0
- package/cems/policy/DLabel.js +2 -0
- package/cems/policy/DPTable.d.ts +86 -0
- package/cems/policy/DPTable.js +2 -0
- package/cems/policy/DRadio.d.ts +34 -0
- package/cems/policy/DRadio.js +2 -0
- package/cems/policy/DSCTable.d.ts +33 -0
- package/cems/policy/DSCTable.js +2 -0
- package/cems/policy/DSelect.d.ts +42 -0
- package/cems/policy/DSelect.js +2 -0
- package/cems/policy/DSlider.d.ts +21 -0
- package/cems/policy/DSlider.js +2 -0
- package/cems/policy/DSwitch.d.ts +21 -0
- package/cems/policy/DSwitch.js +2 -0
- package/cems/policy/DTab.d.ts +30 -0
- package/cems/policy/DTab.js +2 -0
- package/cems/policy/DTimePicker.d.ts +37 -0
- package/cems/policy/DTimePicker.js +2 -0
- package/cems/policy/DTree.d.ts +98 -0
- package/cems/policy/DTree.js +2 -0
- package/cems/policy/DUpload.d.ts +33 -0
- package/cems/policy/DUpload.js +2 -0
- package/cems/policy/types.d.ts +200 -0
- package/cems/policy/types.js +2 -0
- package/cems/policy/utils.d.ts +13 -0
- package/cems/policy/utils.js +2 -0
- package/components/Box/Box.d.ts +43 -7
- package/components/Box/Box.js +67 -17
- package/components/Box/SelectBar.d.ts +1 -1
- package/components/Box/SelectBar.js +19 -9
- package/components/Lists/BaseList.d.ts +5 -0
- package/components/Lists/BaseList.js +111 -0
- package/components/Lists/Fields/IconRender.d.ts +53 -0
- package/components/Lists/Fields/IconRender.js +174 -0
- package/components/Lists/Fields/ItemRender.d.ts +2 -0
- package/components/Lists/Fields/ItemRender.js +127 -0
- package/components/Lists/Fields/_utils.d.ts +3 -0
- package/components/Lists/Fields/_utils.js +80 -0
- package/components/Lists/Fields/index.d.ts +3 -0
- package/components/Lists/Fields/index.js +47 -0
- package/components/Lists/Grid/grid.d.ts +7 -0
- package/components/Lists/Grid/grid.js +18 -0
- package/components/Lists/Grid/index.d.ts +3 -0
- package/components/Lists/Grid/index.js +50 -0
- package/components/Lists/Row/index.d.ts +3 -0
- package/components/Lists/Row/index.js +14 -0
- package/components/Lists/SList.js +17 -7
- package/components/Lists/Timeline/index.d.ts +3 -0
- package/components/Lists/Timeline/index.js +117 -0
- package/components/Lists/VList.d.ts +3 -0
- package/components/Lists/VList.js +92 -0
- package/components/Lists/components/LayoutSwitcher.d.ts +13 -0
- package/components/Lists/components/LayoutSwitcher.js +121 -0
- package/components/Lists/components/SearchTool.d.ts +13 -0
- package/components/Lists/components/SearchTool.js +34 -0
- package/components/Lists/index.d.ts +129 -0
- package/components/Lists/index.js +2 -0
- package/components/SearchTool/SearchBand/BandInput.d.ts +3 -0
- package/components/SearchTool/SearchBand/BandInput.js +54 -0
- package/components/SearchTool/SearchBand/BandTag.d.ts +7 -0
- package/components/SearchTool/SearchBand/BandTag.js +82 -0
- package/components/SearchTool/SearchBand/_SearchBandAction.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandAction.js +23 -0
- package/components/SearchTool/SearchBand/_SearchBandFix.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandFix.js +72 -0
- package/components/SearchTool/SearchBand/_SearchBandTag.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandTag.js +75 -0
- package/components/SearchTool/SearchBand/_register.d.ts +47 -0
- package/components/SearchTool/SearchBand/_register.js +15 -0
- package/components/SearchTool/SearchBand/hooks.d.ts +12 -0
- package/components/SearchTool/SearchBand/hooks.js +181 -0
- package/components/SearchTool/SearchBand/index.d.ts +3 -0
- package/components/SearchTool/SearchBand/index.js +66 -0
- package/components/SearchTool/SearchBand/type.d.ts +71 -0
- package/components/SearchTool/SearchBand/type.js +3 -0
- package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.d.ts +2 -2
- package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.js +22 -12
- package/components/{SearchBar → SearchTool/SearchBar}/ByField.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/ByField.js +21 -11
- package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.js +20 -10
- package/components/{SearchBar → SearchTool/SearchBar}/SearchField.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.js +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.js +3 -3
- package/components/SearchTool/SearchBar/index.d.ts +7 -0
- package/components/{SearchBar → SearchTool/SearchBar}/index.js +1 -1
- package/components/{SearchBar/index.d.ts → SearchTool/SearchBar/type.d.ts} +68 -67
- package/components/SearchTool/SearchBar/type.js +35 -0
- package/components/SearchTool/index.d.ts +5 -0
- package/components/SearchTool/index.js +7 -0
- package/components/Tables/ApiTable.d.ts +5 -7
- package/components/Tables/ApiTable.js +17 -7
- package/components/Tables/ApiTableModal.d.ts +5 -7
- package/components/Tables/ApiTableModal.js +17 -7
- package/components/Tables/Components/ActionBar.d.ts +8 -11
- package/components/Tables/Components/ActionBar.js +74 -41
- package/components/Tables/Components/Actions.d.ts +3 -1
- package/components/Tables/Components/Actions.js +40 -3
- package/components/Tables/Components/index.d.ts +3 -1
- package/components/Tables/Components/useTableContext.d.ts +16 -0
- package/components/Tables/Components/useTableContext.js +116 -0
- package/components/Tables/STable.js +17 -7
- package/components/Tables/TopTable.js +17 -7
- package/components/Tables/Util.d.ts +2 -2
- package/components/Tables/Util.js +0 -1
- package/components/Tables/VTable.d.ts +9 -9
- package/components/Tables/VTable.js +119 -172
- package/components/Tables/VTableBack.d.ts +0 -0
- package/components/Tables/VTableBack.js +269 -0
- package/components/Tables/index.d.ts +11 -22
- package/components/TreeSelect/BaseTreeSelect.js +17 -7
- package/components/TreeSelect/DTreeSelect.js +19 -9
- package/components/TreeSelect/FTreeSelect.js +2 -2
- package/components/TreeSelect/STreeSelect.js +1 -1
- package/components/Trees/ActionTree.d.ts +3 -5
- package/components/Trees/ActionTree.js +19 -9
- package/components/Trees/BaseTree.js +17 -7
- package/components/Trees/COTree/COButton.js +17 -7
- package/components/Trees/COTree/COSelect.js +17 -7
- package/components/Trees/COTree/COTree.js +19 -9
- package/components/Trees/DTree.d.ts +0 -7
- package/components/Trees/DTree.js +19 -9
- package/components/Trees/FTree.js +19 -9
- package/components/Trees/STree.js +17 -7
- package/components/UForm/FormWrapper.js +17 -7
- package/components/UForm/UDescriptions.d.ts +2 -3
- package/components/UForm/UDescriptions.js +17 -7
- package/components/UForm/UForm.d.ts +1 -1
- package/components/UForm/UForm.js +24 -11
- package/components/UForm/UFormModal.js +19 -9
- package/components/UForm/_FieldType.d.ts +1 -1
- package/components/UForm/_FieldType.js +4 -0
- package/components/UForm/_input.d.ts +5 -1
- package/components/UForm/_input.js +25 -8
- package/components/Upload/UploadImage.js +17 -7
- package/components/Upload/UploadModal.js +19 -9
- package/components/Upload/useUpload.js +2 -2
- package/components/_adapt/Alert.js +17 -7
- package/components/_adapt/Col.d.ts +1 -1
- package/components/_adapt/ColorPicker.js +17 -7
- package/components/_adapt/Drawer.js +17 -7
- package/components/_adapt/Dropdown.js +17 -7
- package/components/_adapt/FloatButton.js +17 -7
- package/components/_adapt/Input.js +17 -7
- package/components/_adapt/InputNumber.js +17 -7
- package/components/_adapt/Layout.js +17 -7
- package/components/_adapt/Menu.js +17 -7
- package/components/_adapt/Modal.js +17 -7
- package/components/_adapt/Popconfirm.js +17 -7
- package/components/_adapt/Popover.js +17 -7
- package/components/_adapt/Progress.js +17 -7
- package/components/_adapt/Select.js +17 -7
- package/components/_adapt/Table.js +17 -7
- package/components/_adapt/Tabs.js +17 -7
- package/components/_adapt/Tag.js +17 -7
- package/components/_adapt/TreeSelect.js +17 -7
- package/components/_adapt/todo/Image.d.ts +0 -1
- package/components/_adapt/todo/Segmented.d.ts +0 -1
- package/components/_common/AutoComplete.js +35 -12
- package/components/_common/CountUp.js +17 -7
- package/components/_common/DateRange.d.ts +5 -2
- package/components/_common/DateRange.js +43 -40
- package/components/_common/HighLight.d.ts +1 -1
- package/components/_common/HighLight.js +26 -24
- package/components/_common/Loading.js +17 -7
- package/components/_common/MonthRange.js +17 -7
- package/components/_common/PromiseLabel.js +2 -2
- package/components/_common/UTitle.d.ts +1 -1
- package/components/_common/UTitle.js +18 -8
- package/components/_common/Upagination.d.ts +1 -0
- package/components/_common/Upagination.js +5 -1
- package/components/_i18n.d.ts +1 -102
- package/components/index.d.ts +2 -2
- package/components/index.js +5 -1
- package/deps/JsonView.js +17 -7
- package/deps/app-audit/LookUp.js +19 -9
- package/deps/app-data/Const.d.ts +68 -3
- package/deps/app-data/Const.js +47 -3
- package/deps/app-data/TimeConst.d.ts +0 -0
- package/deps/app-data/TimeConst.js +58 -0
- package/deps/app-data/useSource.d.ts +22 -0
- package/deps/app-data/useSource.js +253 -162
- package/deps/echarts.d.ts +3 -0
- package/deps/echarts.js +20 -10
- package/deps/editor/Article.js +17 -7
- package/deps/editor/Editor.js +17 -7
- package/deps/editor/EditorModal.js +17 -7
- package/deps/editor/support/buttons/ImageButton.js +17 -7
- package/deps/editor/tools/Button.js +0 -2
- package/deps/editor/tools/_TxtButton.js +17 -7
- package/deps/vapc/_basic.d.ts +1 -0
- package/deps/vapc/_basic.js +15 -0
- package/deps/vapc/index.d.ts +10 -0
- package/deps/vapc/index.js +70 -0
- package/hooks/useAjaxAction.js +2 -2
- package/hooks/useAjaxQuery.js +2 -2
- package/hooks/useApiBase.js +2 -2
- package/hooks/useApiGlobal.js +1 -1
- package/hooks/useArray.js +2 -2
- package/hooks/useDefault.d.ts +0 -1
- package/hooks/useDoLoad.d.ts +1 -1
- package/hooks/useError.d.ts +1 -1
- package/hooks/useMemoPromise.js +2 -2
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/login/Base65.d.ts +7 -1
- package/login/Base65.js +49 -22
- package/login/Password.d.ts +8 -5
- package/login/Password.js +68 -102
- package/package.json +1 -1
- package/screen/Page.js +17 -7
- package/screen/vapc-schema/dark.d.ts +1 -0
- package/screen/vapc-schema/dark.js +50 -0
- package/screen/vapc-schema/insight.d.ts +1 -0
- package/screen/vapc-schema/insight.js +49 -0
- package/uform/FormEditor.js +17 -7
- package/uform/FormViewer.js +17 -7
- package/uform/hooks/useEditor.d.ts +0 -1
- package/uform/hooks/useForm.d.ts +0 -1
- package/uform/inputs/index.d.ts +0 -1
- package/uform/panel/Editor/_GroupDefault.js +17 -7
- package/uform/panel/Editor/_GroupStep.js +17 -7
- package/uform/panel/Editor/_GroupTab.js +17 -7
- package/uform/panel/Editor/index.js +17 -7
- package/uform/panel/Items/Fields.js +17 -7
- package/uform/panel/Items/InputSelector.js +17 -7
- package/uform/panel/Items/Inputs.js +17 -7
- package/uform/panel/Items/index.d.ts +1 -1
- package/uform/panel/Propreties/CanvasProperties.js +17 -7
- package/uform/panel/Propreties/Component/FieldPlugin.js +17 -7
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/Links.js +17 -7
- package/uform/panel/Propreties/Component/OptionTable.js +17 -7
- package/uform/panel/Propreties/Component/RegexpModal.js +17 -7
- package/uform/panel/Propreties/Component/Validate.js +17 -7
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +17 -7
- package/uform/panel/Propreties/FieldOptions.js +17 -7
- package/uform/panel/Propreties/FieldProperties.js +17 -7
- package/uform/panel/Propreties/_ItemAdvance.js +17 -7
- package/uform/panel/Propreties/_ItemBase.js +17 -7
- package/uform/panel/Propreties/_ItemLink.js +17 -7
- package/uform/panel/Propreties/_ItemValidate.js +17 -7
- package/uform/schema.d.ts +1 -1
- package/uform/utils/Convert.js +2 -2
- package/utils/Ajax.d.ts +3 -0
- package/utils/Ajax.js +22 -16
- package/utils/CacheUtil.d.ts +1 -1
- package/utils/Const.js +17 -7
- package/utils/Format.d.ts +138 -14
- package/utils/Format.js +132 -23
- package/utils/Global.d.ts +46 -2
- package/utils/Global.js +24 -2
- package/utils/PageUtil.d.ts +111 -23
- package/utils/PageUtil.js +163 -28
- package/utils/Renders/ApiGetRender.js +25 -12
- package/utils/Renders/ApiPostRender.js +3 -3
- package/utils/Renders/CondictionRender.js +17 -7
- package/utils/Renders/DateRender.js +20 -2
- package/utils/Renders/ListRender.js +1 -1
- package/utils/Renders/NumberRender.js +24 -5
- package/utils/Renders/StringRender.js +81 -11
- package/utils/Renders/_define.d.ts +8 -7
- package/utils/Renders/_define.js +76 -17
- package/utils/StringUtil.d.ts +292 -62
- package/utils/StringUtil.js +310 -63
- package/utils/TreeUtil.js +14 -12
- package/utils/VAP.d.ts +26 -1
- package/utils/VAP.js +57 -1
- package/utils/_AjaxUtil.d.ts +1 -0
- package/utils/_AjaxUtil.js +70 -3
- package/utils/_Support.d.ts +2 -2
- package/utils/_Support.js +4 -2
- package/utils/crontab/_en.d.ts +2 -0
- package/utils/crontab/_en.js +178 -0
- package/utils/crontab/_global.d.ts +11 -0
- package/utils/crontab/_global.js +23 -0
- package/utils/crontab/_zh_CN.d.ts +2 -0
- package/utils/crontab/_zh_CN.js +180 -0
- package/utils/crontab/_zh_TW.d.ts +2 -0
- package/utils/crontab/_zh_TW.js +170 -0
- package/utils/crontab/crontabParser.d.ts +1 -0
- package/utils/crontab/crontabParser.js +251 -0
- package/utils/crontab/crontabRender.d.ts +23 -0
- package/utils/crontab/crontabRender.js +502 -0
- package/utils/crontab/index.d.ts +3 -0
- package/utils/crontab/index.js +9 -0
- package/utils/crontab/type.d.ts +79 -0
- package/utils/crontab/type.js +2 -0
- package/utils/crontab/utils.d.ts +20 -0
- package/utils/crontab/utils.js +122 -0
- package/utils/i18n.d.ts +13 -2
- package/utils/i18n.js +13 -2
- package/utils/index.d.ts +4 -0
- package/utils/index.js +19 -9
- package/utils/py.js +2 -0
- package/components/SearchBar/_FieldType.d.ts +0 -8
- package/components/SearchBar/_FieldType.js +0 -51
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchField.js +0 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.d.ts +0 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExpressionDescriptor = exports.crontabRender = void 0;
|
|
7
|
+
var utils_1 = require("./utils");
|
|
8
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
var crontabParser_1 = require("./crontabParser");
|
|
10
|
+
var _global_1 = require("./_global");
|
|
11
|
+
var crontabRender = function (expression, options) {
|
|
12
|
+
var option = lodash_1.default.assign({}, _global_1.DEFAULT_OPTION, options);
|
|
13
|
+
var descripter = new ExpressionDescriptor(expression, option);
|
|
14
|
+
return descripter.getFullDescription();
|
|
15
|
+
};
|
|
16
|
+
exports.crontabRender = crontabRender;
|
|
17
|
+
var ExpressionDescriptor = /** @class */ (function () {
|
|
18
|
+
function ExpressionDescriptor(expression, options) {
|
|
19
|
+
this.expression = expression;
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.expressionParts = new Array(5);
|
|
22
|
+
if (options.use24HourTimeFormat === undefined) {
|
|
23
|
+
// if use24HourTimeFormat not specified, set based on locale default
|
|
24
|
+
options.use24HourTimeFormat = _global_1.i18n.use24HourTimeFormatByDefault();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
ExpressionDescriptor.prototype.getFullDescription = function () {
|
|
28
|
+
var description = "";
|
|
29
|
+
try {
|
|
30
|
+
this.expressionParts = (0, crontabParser_1.crontabParser)(this.expression);
|
|
31
|
+
var timeSegment = this.getTimeOfDayDescription();
|
|
32
|
+
var dayOfMonthDesc = this.getDayOfMonthDescription();
|
|
33
|
+
var monthDesc = this.getMonthDescription();
|
|
34
|
+
var dayOfWeekDesc = this.getDayOfWeekDescription();
|
|
35
|
+
var yearDesc = this.getYearDescription();
|
|
36
|
+
description += timeSegment + dayOfMonthDesc + dayOfWeekDesc + monthDesc + yearDesc;
|
|
37
|
+
description = this.transformVerbosity(description, !!this.options.verbose);
|
|
38
|
+
// uppercase first character
|
|
39
|
+
description = description.charAt(0).toLocaleUpperCase() + description.substr(1);
|
|
40
|
+
}
|
|
41
|
+
catch (ex) {
|
|
42
|
+
if (!this.options.throwExceptionOnParseError) {
|
|
43
|
+
description = _global_1.i18n.anErrorOccuredWhenGeneratingTheExpressionD();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw "".concat(ex);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return description;
|
|
50
|
+
};
|
|
51
|
+
ExpressionDescriptor.prototype.getTimeOfDayDescription = function () {
|
|
52
|
+
var secondsExpression = this.expressionParts[0];
|
|
53
|
+
var minuteExpression = this.expressionParts[1];
|
|
54
|
+
var hourExpression = this.expressionParts[2];
|
|
55
|
+
var description = "";
|
|
56
|
+
if (!(0, utils_1.containsAny)(minuteExpression, _global_1.specialCharacters) &&
|
|
57
|
+
!(0, utils_1.containsAny)(hourExpression, _global_1.specialCharacters) &&
|
|
58
|
+
!(0, utils_1.containsAny)(secondsExpression, _global_1.specialCharacters)) {
|
|
59
|
+
// specific time of day (i.e. 10 14)
|
|
60
|
+
description += _global_1.i18n.atSpace() + this.formatTime(hourExpression, minuteExpression, secondsExpression);
|
|
61
|
+
}
|
|
62
|
+
else if (!secondsExpression &&
|
|
63
|
+
minuteExpression.indexOf("-") > -1 &&
|
|
64
|
+
!(minuteExpression.indexOf(",") > -1) &&
|
|
65
|
+
!(minuteExpression.indexOf("/") > -1) &&
|
|
66
|
+
!(0, utils_1.containsAny)(hourExpression, _global_1.specialCharacters)) {
|
|
67
|
+
// minute range in single hour (i.e. 0-10 11)
|
|
68
|
+
var minuteParts = minuteExpression.split("-");
|
|
69
|
+
description += (0, utils_1.format)(_global_1.i18n.everyMinuteBetweenX0AndX1(), this.formatTime(hourExpression, minuteParts[0], ""), this.formatTime(hourExpression, minuteParts[1], ""));
|
|
70
|
+
}
|
|
71
|
+
else if (!secondsExpression &&
|
|
72
|
+
hourExpression.indexOf(",") > -1 &&
|
|
73
|
+
hourExpression.indexOf("-") == -1 &&
|
|
74
|
+
hourExpression.indexOf("/") == -1 &&
|
|
75
|
+
!(0, utils_1.containsAny)(minuteExpression, _global_1.specialCharacters)) {
|
|
76
|
+
// hours list with single minute (i.e. 30 6,14,16)
|
|
77
|
+
var hourParts = hourExpression.split(",");
|
|
78
|
+
description += _global_1.i18n.at();
|
|
79
|
+
for (var i = 0; i < hourParts.length; i++) {
|
|
80
|
+
description += " ";
|
|
81
|
+
description += this.formatTime(hourParts[i], minuteExpression, "");
|
|
82
|
+
if (i < hourParts.length - 2) {
|
|
83
|
+
description += ",";
|
|
84
|
+
}
|
|
85
|
+
if (i == hourParts.length - 2) {
|
|
86
|
+
description += _global_1.i18n.spaceAnd();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// default time description
|
|
92
|
+
var secondsDescription = this.getSecondsDescription();
|
|
93
|
+
var minutesDescription = this.getMinutesDescription();
|
|
94
|
+
var hoursDescription = this.getHoursDescription();
|
|
95
|
+
description += secondsDescription;
|
|
96
|
+
if (description && minutesDescription) {
|
|
97
|
+
description += ", ";
|
|
98
|
+
}
|
|
99
|
+
description += minutesDescription;
|
|
100
|
+
if (minutesDescription === hoursDescription) {
|
|
101
|
+
return description;
|
|
102
|
+
}
|
|
103
|
+
if (description && hoursDescription) {
|
|
104
|
+
description += ", ";
|
|
105
|
+
}
|
|
106
|
+
description += hoursDescription;
|
|
107
|
+
}
|
|
108
|
+
return description;
|
|
109
|
+
};
|
|
110
|
+
ExpressionDescriptor.prototype.getSecondsDescription = function () {
|
|
111
|
+
var description = this.getSegmentDescription(this.expressionParts[0], _global_1.i18n.everySecond(), function (s) {
|
|
112
|
+
return s;
|
|
113
|
+
}, function (s) {
|
|
114
|
+
return (0, utils_1.format)(_global_1.i18n.everyX0Seconds(s), s);
|
|
115
|
+
}, function (s) {
|
|
116
|
+
return _global_1.i18n.secondsX0ThroughX1PastTheMinute();
|
|
117
|
+
}, function (s) {
|
|
118
|
+
return s == "0"
|
|
119
|
+
? ""
|
|
120
|
+
: parseInt(s) < 20
|
|
121
|
+
? _global_1.i18n.atX0SecondsPastTheMinute(s)
|
|
122
|
+
: _global_1.i18n.atX0SecondsPastTheMinuteGt20() || _global_1.i18n.atX0SecondsPastTheMinute(s);
|
|
123
|
+
});
|
|
124
|
+
return description;
|
|
125
|
+
};
|
|
126
|
+
ExpressionDescriptor.prototype.getMinutesDescription = function () {
|
|
127
|
+
var secondsExpression = this.expressionParts[0];
|
|
128
|
+
var hourExpression = this.expressionParts[2];
|
|
129
|
+
var description = this.getSegmentDescription(this.expressionParts[1], _global_1.i18n.everyMinute(), function (s) {
|
|
130
|
+
return s;
|
|
131
|
+
}, function (s) {
|
|
132
|
+
return (0, utils_1.format)(_global_1.i18n.everyX0Minutes(s), s);
|
|
133
|
+
}, function (s) {
|
|
134
|
+
return _global_1.i18n.minutesX0ThroughX1PastTheHour();
|
|
135
|
+
}, function (s) {
|
|
136
|
+
try {
|
|
137
|
+
return s == "0" && hourExpression.indexOf("/") == -1 && secondsExpression == ""
|
|
138
|
+
? _global_1.i18n.everyHour()
|
|
139
|
+
: parseInt(s) < 20
|
|
140
|
+
? _global_1.i18n.atX0MinutesPastTheHour(s)
|
|
141
|
+
: _global_1.i18n.atX0MinutesPastTheHourGt20() || _global_1.i18n.atX0MinutesPastTheHour(s);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return _global_1.i18n.atX0MinutesPastTheHour(s);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return description;
|
|
148
|
+
};
|
|
149
|
+
ExpressionDescriptor.prototype.getHoursDescription = function () {
|
|
150
|
+
var _this = this;
|
|
151
|
+
var expression = this.expressionParts[2];
|
|
152
|
+
var description = this.getSegmentDescription(expression, _global_1.i18n.everyHour(), function (s) {
|
|
153
|
+
return _this.formatTime(s, "0", "");
|
|
154
|
+
}, function (s) {
|
|
155
|
+
return (0, utils_1.format)(_global_1.i18n.everyX0Hours(s), s);
|
|
156
|
+
}, function (s) {
|
|
157
|
+
return _global_1.i18n.betweenX0AndX1();
|
|
158
|
+
}, function (s) {
|
|
159
|
+
return _global_1.i18n.atX0();
|
|
160
|
+
});
|
|
161
|
+
// If this is an hour range and minute segment is not "on the hour" (0), we'll change the second hour part from :00 to :59
|
|
162
|
+
if (description && expression.includes("-") && this.expressionParts[1] != "0") {
|
|
163
|
+
var atTheHourMatches = Array.from(description.matchAll(/:00/g));
|
|
164
|
+
if (atTheHourMatches.length > 1) {
|
|
165
|
+
var lastAtTheHourMatchIndex = atTheHourMatches[atTheHourMatches.length - 1].index;
|
|
166
|
+
description =
|
|
167
|
+
description.substring(0, lastAtTheHourMatchIndex) +
|
|
168
|
+
":59" +
|
|
169
|
+
description.substring(lastAtTheHourMatchIndex + 3);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return description;
|
|
173
|
+
};
|
|
174
|
+
ExpressionDescriptor.prototype.getDayOfWeekDescription = function () {
|
|
175
|
+
var _this = this;
|
|
176
|
+
var daysOfWeekNames = _global_1.i18n.daysOfTheWeek();
|
|
177
|
+
var description = null;
|
|
178
|
+
if (this.expressionParts[5] == "*") {
|
|
179
|
+
// DOW is specified as * so we will not generate a description and defer to DOM part.
|
|
180
|
+
// Otherwise, we could get a contradiction like "on day 1 of the month, every day"
|
|
181
|
+
// or a dupe description like "every day, every day".
|
|
182
|
+
description = "";
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
description = this.getSegmentDescription(this.expressionParts[5], _global_1.i18n.commaEveryDay(), function (s, form) {
|
|
186
|
+
var exp = s;
|
|
187
|
+
if (s.indexOf("#") > -1) {
|
|
188
|
+
exp = s.substring(0, s.indexOf("#"));
|
|
189
|
+
}
|
|
190
|
+
else if (s.indexOf("L") > -1) {
|
|
191
|
+
exp = exp.replace("L", "");
|
|
192
|
+
}
|
|
193
|
+
var parsedExp = parseInt(exp);
|
|
194
|
+
if (_this.options.tzOffset) {
|
|
195
|
+
var hourExpression = _this.expressionParts[2];
|
|
196
|
+
var hour = parseInt(hourExpression) + (_this.options.tzOffset ? _this.options.tzOffset : 0);
|
|
197
|
+
if (hour >= 24) {
|
|
198
|
+
parsedExp++;
|
|
199
|
+
}
|
|
200
|
+
else if (hour < 0) {
|
|
201
|
+
parsedExp--;
|
|
202
|
+
}
|
|
203
|
+
if (parsedExp > 6) {
|
|
204
|
+
parsedExp = 0;
|
|
205
|
+
}
|
|
206
|
+
else if (parsedExp < 0) {
|
|
207
|
+
parsedExp = 6;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var description = _global_1.i18n.daysOfTheWeekInCase
|
|
211
|
+
? _global_1.i18n.daysOfTheWeekInCase(form)[parsedExp]
|
|
212
|
+
: daysOfWeekNames[parsedExp];
|
|
213
|
+
if (s.indexOf("#") > -1) {
|
|
214
|
+
var dayOfWeekOfMonthDescription = null;
|
|
215
|
+
var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
|
|
216
|
+
var dayOfWeekNumber = s.substring(0, s.indexOf("#"));
|
|
217
|
+
switch (dayOfWeekOfMonthNumber) {
|
|
218
|
+
case "1":
|
|
219
|
+
dayOfWeekOfMonthDescription = _global_1.i18n.first(dayOfWeekNumber);
|
|
220
|
+
break;
|
|
221
|
+
case "2":
|
|
222
|
+
dayOfWeekOfMonthDescription = _global_1.i18n.second(dayOfWeekNumber);
|
|
223
|
+
break;
|
|
224
|
+
case "3":
|
|
225
|
+
dayOfWeekOfMonthDescription = _global_1.i18n.third(dayOfWeekNumber);
|
|
226
|
+
break;
|
|
227
|
+
case "4":
|
|
228
|
+
dayOfWeekOfMonthDescription = _global_1.i18n.fourth(dayOfWeekNumber);
|
|
229
|
+
break;
|
|
230
|
+
case "5":
|
|
231
|
+
dayOfWeekOfMonthDescription = _global_1.i18n.fifth(dayOfWeekNumber);
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
description = dayOfWeekOfMonthDescription + " " + description;
|
|
235
|
+
}
|
|
236
|
+
return description;
|
|
237
|
+
}, function (s) {
|
|
238
|
+
if (parseInt(s) == 1) {
|
|
239
|
+
// rather than "every 1 days" just return empty string
|
|
240
|
+
return "";
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return (0, utils_1.format)(_global_1.i18n.commaEveryX0DaysOfTheWeek(s), s);
|
|
244
|
+
}
|
|
245
|
+
}, function (s) {
|
|
246
|
+
// If both DOM and DOW are specified, the cron will execute at either time.
|
|
247
|
+
var beginFrom = s.substring(0, s.indexOf("-"));
|
|
248
|
+
var domSpecified = _this.expressionParts[3] != "*";
|
|
249
|
+
return domSpecified ? _global_1.i18n.commaAndX0ThroughX1(beginFrom) : _global_1.i18n.commaX0ThroughX1(beginFrom);
|
|
250
|
+
}, function (s) {
|
|
251
|
+
var format = null;
|
|
252
|
+
if (s.indexOf("#") > -1) {
|
|
253
|
+
var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
|
|
254
|
+
format = _global_1.i18n.commaOnThe(dayOfWeekOfMonthNumber).trim() + _global_1.i18n.spaceX0OfTheMonth();
|
|
255
|
+
}
|
|
256
|
+
else if (s.indexOf("L") > -1) {
|
|
257
|
+
format = _global_1.i18n.commaOnTheLastX0OfTheMonth(s.replace("L", ""));
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// If both DOM and DOW are specified, the cron will execute at either time.
|
|
261
|
+
var domSpecified = _this.expressionParts[3] != "*";
|
|
262
|
+
format = domSpecified ? _global_1.i18n.commaAndOnX0() : _global_1.i18n.commaOnlyOnX0(s);
|
|
263
|
+
}
|
|
264
|
+
return format;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return description;
|
|
268
|
+
};
|
|
269
|
+
ExpressionDescriptor.prototype.getMonthDescription = function () {
|
|
270
|
+
var monthNames = _global_1.i18n.monthsOfTheYear();
|
|
271
|
+
var description = this.getSegmentDescription(this.expressionParts[4], "", function (s, form) {
|
|
272
|
+
return form && _global_1.i18n.monthsOfTheYearInCase
|
|
273
|
+
? _global_1.i18n.monthsOfTheYearInCase(form)[parseInt(s) - 1]
|
|
274
|
+
: monthNames[parseInt(s) - 1];
|
|
275
|
+
}, function (s) {
|
|
276
|
+
//
|
|
277
|
+
if (parseInt(s) == 1) {
|
|
278
|
+
// rather than "every 1 months" just return empty string
|
|
279
|
+
return "";
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
return (0, utils_1.format)(_global_1.i18n.commaEveryX0Months(s), s);
|
|
283
|
+
}
|
|
284
|
+
}, function (s) {
|
|
285
|
+
return _global_1.i18n.commaMonthX0ThroughMonthX1() || _global_1.i18n.commaX0ThroughX1();
|
|
286
|
+
}, function (s) {
|
|
287
|
+
return _global_1.i18n.commaOnlyInMonthX0 ? _global_1.i18n.commaOnlyInMonthX0() : _global_1.i18n.commaOnlyInX0();
|
|
288
|
+
});
|
|
289
|
+
return description;
|
|
290
|
+
};
|
|
291
|
+
ExpressionDescriptor.prototype.getDayOfMonthDescription = function () {
|
|
292
|
+
var description = null;
|
|
293
|
+
var expression = this.expressionParts[3];
|
|
294
|
+
switch (expression) {
|
|
295
|
+
case "L":
|
|
296
|
+
description = _global_1.i18n.commaOnTheLastDayOfTheMonth();
|
|
297
|
+
break;
|
|
298
|
+
case "WL":
|
|
299
|
+
case "LW":
|
|
300
|
+
description = _global_1.i18n.commaOnTheLastWeekdayOfTheMonth();
|
|
301
|
+
break;
|
|
302
|
+
default: // i.e. 3W or W2
|
|
303
|
+
var weekDayNumberMatches = expression.match(/(\d{1,2}W)|(W\d{1,2})/);
|
|
304
|
+
if (weekDayNumberMatches) {
|
|
305
|
+
var dayNumber = parseInt(weekDayNumberMatches[0].replace("W", ""));
|
|
306
|
+
var dayString = dayNumber == 1
|
|
307
|
+
? _global_1.i18n.firstWeekday()
|
|
308
|
+
: (0, utils_1.format)(_global_1.i18n.weekdayNearestDayX0(), dayNumber.toString());
|
|
309
|
+
description = (0, utils_1.format)(_global_1.i18n.commaOnTheX0OfTheMonth(), dayString);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// Handle "last day offset" (i.e. L-5: "5 days before the last day of the month")
|
|
314
|
+
var lastDayOffSetMatches = expression.match(/L-(\d{1,2})/);
|
|
315
|
+
if (lastDayOffSetMatches) {
|
|
316
|
+
var offSetDays = lastDayOffSetMatches[1];
|
|
317
|
+
description = (0, utils_1.format)(_global_1.i18n.commaDaysBeforeTheLastDayOfTheMonth(offSetDays), offSetDays);
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
else if (expression == "*" && this.expressionParts[5] != "*") {
|
|
321
|
+
// * dayOfMonth and dayOfWeek specified so use dayOfWeek verbiage instead
|
|
322
|
+
return "";
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
description = this.getSegmentDescription(expression, _global_1.i18n.commaEveryDay(), function (s) {
|
|
326
|
+
return s == "L"
|
|
327
|
+
? _global_1.i18n.lastDay()
|
|
328
|
+
: _global_1.i18n.dayX0
|
|
329
|
+
? (0, utils_1.format)(_global_1.i18n.dayX0(), s)
|
|
330
|
+
: s;
|
|
331
|
+
}, function (s) {
|
|
332
|
+
return s == "1" ? _global_1.i18n.commaEveryDay() : _global_1.i18n.commaEveryX0Days(s);
|
|
333
|
+
}, function (s) {
|
|
334
|
+
return _global_1.i18n.commaBetweenDayX0AndX1OfTheMonth(s);
|
|
335
|
+
}, function (s) {
|
|
336
|
+
return _global_1.i18n.commaOnDayX0OfTheMonth(s);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return description;
|
|
343
|
+
};
|
|
344
|
+
ExpressionDescriptor.prototype.getYearDescription = function () {
|
|
345
|
+
var description = this.getSegmentDescription(this.expressionParts[6], "", function (s) {
|
|
346
|
+
return /^\d+$/.test(s) ? new Date(parseInt(s), 1).getFullYear().toString() : s;
|
|
347
|
+
}, function (s) {
|
|
348
|
+
return (0, utils_1.format)(_global_1.i18n.commaEveryX0Years(s), s);
|
|
349
|
+
}, function (s) {
|
|
350
|
+
return _global_1.i18n.commaYearX0ThroughYearX1() || _global_1.i18n.commaX0ThroughX1();
|
|
351
|
+
}, function (s) {
|
|
352
|
+
return _global_1.i18n.commaOnlyInYearX0 ? _global_1.i18n.commaOnlyInYearX0() : _global_1.i18n.commaOnlyInX0();
|
|
353
|
+
});
|
|
354
|
+
return description;
|
|
355
|
+
};
|
|
356
|
+
ExpressionDescriptor.prototype.getSegmentDescription = function (expression, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat) {
|
|
357
|
+
var description = null;
|
|
358
|
+
var doesExpressionContainIncrement = expression.indexOf("/") > -1;
|
|
359
|
+
var doesExpressionContainRange = expression.indexOf("-") > -1;
|
|
360
|
+
var doesExpressionContainMultipleValues = expression.indexOf(",") > -1;
|
|
361
|
+
if (!expression) {
|
|
362
|
+
// Empty
|
|
363
|
+
description = "";
|
|
364
|
+
}
|
|
365
|
+
else if (expression === "*") {
|
|
366
|
+
// * (All)
|
|
367
|
+
description = allDescription;
|
|
368
|
+
}
|
|
369
|
+
else if (!doesExpressionContainIncrement && !doesExpressionContainRange && !doesExpressionContainMultipleValues) {
|
|
370
|
+
// Simple
|
|
371
|
+
description = (0, utils_1.format)(getDescriptionFormat(expression), getSingleItemDescription(expression));
|
|
372
|
+
}
|
|
373
|
+
else if (doesExpressionContainMultipleValues) {
|
|
374
|
+
// Multiple Values
|
|
375
|
+
var segments = expression.split(",");
|
|
376
|
+
var descriptionContent = "";
|
|
377
|
+
for (var i = 0; i < segments.length; i++) {
|
|
378
|
+
if (i > 0 && segments.length > 2) {
|
|
379
|
+
descriptionContent += ",";
|
|
380
|
+
if (i < segments.length - 1) {
|
|
381
|
+
descriptionContent += " ";
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (i > 0 && segments.length > 1 && (i == segments.length - 1 || segments.length == 2)) {
|
|
385
|
+
descriptionContent += "".concat(_global_1.i18n.spaceAnd(), " ");
|
|
386
|
+
}
|
|
387
|
+
if (segments[i].indexOf("/") > -1 || segments[i].indexOf("-") > -1) {
|
|
388
|
+
// Multiple Values with Increment or Range
|
|
389
|
+
var isSegmentRangeWithoutIncrement = segments[i].indexOf("-") > -1 && segments[i].indexOf("/") == -1;
|
|
390
|
+
var currentDescriptionContent = this.getSegmentDescription(segments[i], allDescription, getSingleItemDescription, getIncrementDescriptionFormat, isSegmentRangeWithoutIncrement ? _global_1.i18n.commaX0ThroughX1 : getRangeDescriptionFormat, getDescriptionFormat);
|
|
391
|
+
if (isSegmentRangeWithoutIncrement) {
|
|
392
|
+
currentDescriptionContent = currentDescriptionContent.replace(", ", "");
|
|
393
|
+
}
|
|
394
|
+
descriptionContent += currentDescriptionContent;
|
|
395
|
+
}
|
|
396
|
+
else if (!doesExpressionContainIncrement) {
|
|
397
|
+
descriptionContent += getSingleItemDescription(segments[i]);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
descriptionContent += this.getSegmentDescription(segments[i], allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (!doesExpressionContainIncrement) {
|
|
404
|
+
description = (0, utils_1.format)(getDescriptionFormat(expression), descriptionContent);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
description = descriptionContent;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else if (doesExpressionContainIncrement) {
|
|
411
|
+
// Increment
|
|
412
|
+
var segments = expression.split("/");
|
|
413
|
+
description = (0, utils_1.format)(getIncrementDescriptionFormat(segments[1]), segments[1]);
|
|
414
|
+
if (segments[0].indexOf("-") > -1) {
|
|
415
|
+
// Range with Increment (ex: 2-59/3 )
|
|
416
|
+
var rangeSegmentDescription = this.generateRangeSegmentDescription(segments[0], getRangeDescriptionFormat, getSingleItemDescription);
|
|
417
|
+
if (rangeSegmentDescription.indexOf(", ") != 0) {
|
|
418
|
+
description += ", ";
|
|
419
|
+
}
|
|
420
|
+
description += rangeSegmentDescription;
|
|
421
|
+
}
|
|
422
|
+
else if (segments[0].indexOf("*") == -1) {
|
|
423
|
+
var rangeItemDescription = (0, utils_1.format)(getDescriptionFormat(segments[0]), getSingleItemDescription(segments[0]));
|
|
424
|
+
// remove any leading comma
|
|
425
|
+
rangeItemDescription = rangeItemDescription.replace(", ", "");
|
|
426
|
+
description += (0, utils_1.format)(_global_1.i18n.commaStartingX0(), rangeItemDescription);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
else if (doesExpressionContainRange) {
|
|
430
|
+
// Range
|
|
431
|
+
description = this.generateRangeSegmentDescription(expression, getRangeDescriptionFormat, getSingleItemDescription);
|
|
432
|
+
}
|
|
433
|
+
return description;
|
|
434
|
+
};
|
|
435
|
+
ExpressionDescriptor.prototype.generateRangeSegmentDescription = function (rangeExpression, getRangeDescriptionFormat, getSingleItemDescription) {
|
|
436
|
+
var description = "";
|
|
437
|
+
var rangeSegments = rangeExpression.split("-");
|
|
438
|
+
var rangeSegment1Description = getSingleItemDescription(rangeSegments[0], 1);
|
|
439
|
+
var rangeSegment2Description = getSingleItemDescription(rangeSegments[1], 2);
|
|
440
|
+
var rangeDescriptionFormat = getRangeDescriptionFormat(rangeExpression);
|
|
441
|
+
description += (0, utils_1.format)(rangeDescriptionFormat, rangeSegment1Description, rangeSegment2Description);
|
|
442
|
+
return description;
|
|
443
|
+
};
|
|
444
|
+
ExpressionDescriptor.prototype.formatTime = function (hourExpression, minuteExpression, secondExpression) {
|
|
445
|
+
var hourOffset = 0;
|
|
446
|
+
var minuteOffset = 0;
|
|
447
|
+
if (this.options.tzOffset) {
|
|
448
|
+
hourOffset = this.options.tzOffset > 0 ? Math.floor(this.options.tzOffset) : Math.ceil(this.options.tzOffset);
|
|
449
|
+
minuteOffset = (parseFloat((this.options.tzOffset % 1).toFixed(2)));
|
|
450
|
+
if (minuteOffset != 0) {
|
|
451
|
+
minuteOffset *= 60;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
var hour = parseInt(hourExpression) + (hourOffset);
|
|
455
|
+
var minute = parseInt(minuteExpression) + (minuteOffset);
|
|
456
|
+
if (minute >= 60) {
|
|
457
|
+
minute -= 60;
|
|
458
|
+
hour += 1;
|
|
459
|
+
}
|
|
460
|
+
else if (minute < 0) {
|
|
461
|
+
minute += 60;
|
|
462
|
+
hour -= 1;
|
|
463
|
+
}
|
|
464
|
+
if (hour >= 24) {
|
|
465
|
+
hour = hour - 24;
|
|
466
|
+
}
|
|
467
|
+
else if (hour < 0) {
|
|
468
|
+
hour = 24 + hour;
|
|
469
|
+
}
|
|
470
|
+
var period = "";
|
|
471
|
+
var setPeriodBeforeTime = false;
|
|
472
|
+
if (!this.options.use24HourTimeFormat) {
|
|
473
|
+
setPeriodBeforeTime = !!(_global_1.i18n.setPeriodBeforeTime && _global_1.i18n.setPeriodBeforeTime());
|
|
474
|
+
period = setPeriodBeforeTime ? "".concat(this.getPeriod(hour), " ") : " ".concat(this.getPeriod(hour));
|
|
475
|
+
if (hour > 12) {
|
|
476
|
+
hour -= 12;
|
|
477
|
+
}
|
|
478
|
+
if (hour === 0) {
|
|
479
|
+
hour = 12;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
var second = "";
|
|
483
|
+
if (secondExpression) {
|
|
484
|
+
second = ":".concat(("00" + secondExpression).substring(secondExpression.length));
|
|
485
|
+
}
|
|
486
|
+
return "".concat(setPeriodBeforeTime ? period : "").concat(("00" + hour.toString()).substring(hour.toString().length), ":").concat(("00" + minute.toString()).substring(minute.toString().length)).concat(second).concat(!setPeriodBeforeTime ? period : "");
|
|
487
|
+
};
|
|
488
|
+
ExpressionDescriptor.prototype.transformVerbosity = function (description, useVerboseFormat) {
|
|
489
|
+
if (!useVerboseFormat) {
|
|
490
|
+
description = description.replace(new RegExp(", ".concat(_global_1.i18n.everyMinute()), "g"), "");
|
|
491
|
+
description = description.replace(new RegExp(", ".concat(_global_1.i18n.everyHour()), "g"), "");
|
|
492
|
+
description = description.replace(new RegExp(_global_1.i18n.commaEveryDay(), "g"), "");
|
|
493
|
+
description = description.replace(/\, ?$/, "");
|
|
494
|
+
}
|
|
495
|
+
return description;
|
|
496
|
+
};
|
|
497
|
+
ExpressionDescriptor.prototype.getPeriod = function (hour) {
|
|
498
|
+
return hour >= 12 ? (_global_1.i18n.pm && _global_1.i18n.pm()) || "PM" : (_global_1.i18n.am && _global_1.i18n.am()) || "AM";
|
|
499
|
+
};
|
|
500
|
+
return ExpressionDescriptor;
|
|
501
|
+
}());
|
|
502
|
+
exports.ExpressionDescriptor = ExpressionDescriptor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLocal = exports.crontabRender = exports.crontabParser = void 0;
|
|
4
|
+
var crontabParser_1 = require("./crontabParser");
|
|
5
|
+
Object.defineProperty(exports, "crontabParser", { enumerable: true, get: function () { return crontabParser_1.crontabParser; } });
|
|
6
|
+
var crontabRender_1 = require("./crontabRender");
|
|
7
|
+
Object.defineProperty(exports, "crontabRender", { enumerable: true, get: function () { return crontabRender_1.crontabRender; } });
|
|
8
|
+
var _global_1 = require("./_global");
|
|
9
|
+
Object.defineProperty(exports, "setLocal", { enumerable: true, get: function () { return _global_1.setLocal; } });
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface Locale {
|
|
2
|
+
setPeriodBeforeTime?(): boolean;
|
|
3
|
+
pm?(): string;
|
|
4
|
+
am?(): string;
|
|
5
|
+
use24HourTimeFormatByDefault(): boolean;
|
|
6
|
+
anErrorOccuredWhenGeneratingTheExpressionD(): string;
|
|
7
|
+
everyMinute(): string;
|
|
8
|
+
everyHour(): string;
|
|
9
|
+
atSpace(): string;
|
|
10
|
+
everyMinuteBetweenX0AndX1(): string;
|
|
11
|
+
at(): string;
|
|
12
|
+
spaceAnd(): string;
|
|
13
|
+
everySecond(): string;
|
|
14
|
+
everyX0Seconds(s?: string): string;
|
|
15
|
+
secondsX0ThroughX1PastTheMinute(): string;
|
|
16
|
+
atX0SecondsPastTheMinute(s?: string): string;
|
|
17
|
+
atX0SecondsPastTheMinuteGt20(): string | null;
|
|
18
|
+
everyX0Minutes(s?: string): string;
|
|
19
|
+
minutesX0ThroughX1PastTheHour(): string;
|
|
20
|
+
atX0MinutesPastTheHour(s?: string): string;
|
|
21
|
+
atX0MinutesPastTheHourGt20(): string | null;
|
|
22
|
+
everyX0Hours(s?: string): string;
|
|
23
|
+
betweenX0AndX1(): string;
|
|
24
|
+
atX0(): string;
|
|
25
|
+
commaEveryDay(): string;
|
|
26
|
+
commaEveryX0DaysOfTheWeek(s?: string): string;
|
|
27
|
+
commaX0ThroughX1(s?: string): string;
|
|
28
|
+
commaAndX0ThroughX1(s?: string): string;
|
|
29
|
+
commaMonthX0ThroughMonthX1(): string | null;
|
|
30
|
+
commaYearX0ThroughYearX1(): string | null;
|
|
31
|
+
first(s?: string): string;
|
|
32
|
+
second(s?: string): string;
|
|
33
|
+
third(s?: string): string;
|
|
34
|
+
fourth(s?: string): string;
|
|
35
|
+
fifth(s?: string): string;
|
|
36
|
+
commaOnThe(s?: string): string;
|
|
37
|
+
spaceX0OfTheMonth(): string;
|
|
38
|
+
lastDay(): string;
|
|
39
|
+
commaOnTheLastX0OfTheMonth(s?: string): string;
|
|
40
|
+
commaOnlyOnX0(s?: string): string;
|
|
41
|
+
commaAndOnX0(): string;
|
|
42
|
+
commaEveryX0Months(s?: string): string;
|
|
43
|
+
commaOnlyInX0(): string;
|
|
44
|
+
commaOnlyInMonthX0?(): string;
|
|
45
|
+
commaOnlyInYearX0?(): string;
|
|
46
|
+
commaOnTheLastDayOfTheMonth(): string;
|
|
47
|
+
commaOnTheLastWeekdayOfTheMonth(): string;
|
|
48
|
+
commaDaysBeforeTheLastDayOfTheMonth(s?: string): string;
|
|
49
|
+
firstWeekday(): string;
|
|
50
|
+
weekdayNearestDayX0(): string;
|
|
51
|
+
commaOnTheX0OfTheMonth(): string;
|
|
52
|
+
commaEveryX0Days(s?: string): string;
|
|
53
|
+
commaBetweenDayX0AndX1OfTheMonth(s?: string): string;
|
|
54
|
+
commaOnDayX0OfTheMonth(s?: string): string;
|
|
55
|
+
commaEveryX0Years(s?: string): string;
|
|
56
|
+
commaStartingX0(): string;
|
|
57
|
+
dayX0?(): string;
|
|
58
|
+
daysOfTheWeek(): string[];
|
|
59
|
+
/** If multiple forms are needed in "%s through %s"
|
|
60
|
+
* @param f 1 for "from", 2 for "through"
|
|
61
|
+
* @return {string[]} days of week
|
|
62
|
+
*/
|
|
63
|
+
daysOfTheWeekInCase?(f?: number): string[];
|
|
64
|
+
monthsOfTheYear(): string[];
|
|
65
|
+
/** If multiple forms are needed in "%s through %s"
|
|
66
|
+
* @param f 1 for "from", 2 for "through"
|
|
67
|
+
* @return {string[]} months of year
|
|
68
|
+
*/
|
|
69
|
+
monthsOfTheYearInCase?(f?: number): string[];
|
|
70
|
+
}
|
|
71
|
+
export interface Options {
|
|
72
|
+
throwExceptionOnParseError?: boolean;
|
|
73
|
+
verbose?: boolean;
|
|
74
|
+
dayOfWeekStartIndexZero?: boolean;
|
|
75
|
+
monthStartIndexZero?: boolean;
|
|
76
|
+
use24HourTimeFormat?: boolean;
|
|
77
|
+
locale?: string | null;
|
|
78
|
+
tzOffset?: number;
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const validate: (parsed: string[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Takes a string with '%s' placeholders and replaces them with provided values.
|
|
4
|
+
* Works like sprintf in C or string.Format in C#.
|
|
5
|
+
* @static
|
|
6
|
+
* @param {string} template - The string template with enclosed %s replacements
|
|
7
|
+
* @param {...string[]} values - The ordered replacement text
|
|
8
|
+
* @returns {string}
|
|
9
|
+
*/
|
|
10
|
+
export declare const format: (template: string, ...values: string[]) => string;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* Given a string and an array of search strings, determines if the string
|
|
14
|
+
* contains any value from the array.
|
|
15
|
+
* @static
|
|
16
|
+
* @param {string} text - The string to search
|
|
17
|
+
* @param {string[]} searchStrings - The array of values to search for
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
export declare const containsAny: (text: string, searchStrings: string[]) => boolean;
|