@noah-libjs/utils 0.0.58 → 0.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es.js CHANGED
@@ -1570,22 +1570,36 @@ function end() {
1570
1570
  }
1571
1571
  function getMomentRange() {
1572
1572
  var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs;
1573
+ var which_quarter = dayjs_quarter(start(m))[1];
1574
+ var quarter_start = dayjs_quarter(start(m).startOf('month'), which_quarter)[0];
1575
+ var quarter_end = quarter_start.add(2, 'month').endOf('month');
1573
1576
  return {
1574
1577
  昨天: [start(m).add(-1, 'day'), end(m).add(-1, 'day')],
1575
1578
  今天: [start(m), end(m)],
1576
1579
  明天: [start(m).add(1, 'day'), end(m).add(1, 'day')],
1577
1580
  上周: [start(m).add(-1, 'week').startOf('week'), end(m).add(-1, 'week').endOf('week')],
1578
- // 这周: [start(m).startOf('week'), end(m).endOf('week')] as DT,
1581
+ 本周: [start(m).startOf('week'), end(m).endOf('week')],
1579
1582
  近一周: [start(m).add(-1, 'week').add(1, 'day'), end(m)],
1580
1583
  下周: [start(m).add(1, 'week').startOf('week'), end(m).add(1, 'week').endOf('week')],
1581
1584
  上月: [start(m).add(-1, 'month').startOf('month'), end(m).add(-1, 'month').endOf('month')],
1582
- // 这月: [start(m).startOf('month'), end(m).endOf('month')] as DT,
1585
+ 本月: [start(m).startOf('month'), end(m).endOf('month')],
1583
1586
  近一月: [start(m).add(-1, 'month').add(1, 'day'), end(m)],
1584
1587
  下月: [start(m).add(1, 'month').startOf('month'), end(m).add(1, 'month').endOf('month')],
1588
+ 本季: [quarter_start, quarter_end],
1589
+ 今年: [start(m).startOf('year'), end(m).endOf('year')],
1585
1590
  近一年: [start(m).add(-1, 'year').add(1, 'day'), end(m)],
1586
1591
  年初至今: [start(m).startOf('year'), end(m)]
1587
1592
  };
1588
1593
  }
1594
+ function presets_range() {
1595
+ var rages = getMomentRange();
1596
+ return listify(rages, function (label, value) {
1597
+ return {
1598
+ label: label,
1599
+ value: value
1600
+ };
1601
+ });
1602
+ }
1589
1603
  function presets_date() {
1590
1604
  return [{
1591
1605
  label: '一月前',
@@ -2759,4 +2773,4 @@ function load_src(items, node) {
2759
2773
  var load_src_ = create_load_src();
2760
2774
  return load_src_(items, node);
2761
2775
  }
2762
- export { ARG_URS1_KEY, ARG_URS2_KEY, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, _isEqual as isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, object_to_formData, object_to_searchparams, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
2776
+ export { ARG_URS1_KEY, ARG_URS2_KEY, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, _isEqual as isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, object_to_formData, object_to_searchparams, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, presets_range, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
package/dist/lib.js CHANGED
@@ -1580,22 +1580,36 @@ function end() {
1580
1580
  }
1581
1581
  function getMomentRange() {
1582
1582
  var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__default["default"];
1583
+ var which_quarter = dayjs_quarter(start(m))[1];
1584
+ var quarter_start = dayjs_quarter(start(m).startOf('month'), which_quarter)[0];
1585
+ var quarter_end = quarter_start.add(2, 'month').endOf('month');
1583
1586
  return {
1584
1587
  昨天: [start(m).add(-1, 'day'), end(m).add(-1, 'day')],
1585
1588
  今天: [start(m), end(m)],
1586
1589
  明天: [start(m).add(1, 'day'), end(m).add(1, 'day')],
1587
1590
  上周: [start(m).add(-1, 'week').startOf('week'), end(m).add(-1, 'week').endOf('week')],
1588
- // 这周: [start(m).startOf('week'), end(m).endOf('week')] as DT,
1591
+ 本周: [start(m).startOf('week'), end(m).endOf('week')],
1589
1592
  近一周: [start(m).add(-1, 'week').add(1, 'day'), end(m)],
1590
1593
  下周: [start(m).add(1, 'week').startOf('week'), end(m).add(1, 'week').endOf('week')],
1591
1594
  上月: [start(m).add(-1, 'month').startOf('month'), end(m).add(-1, 'month').endOf('month')],
1592
- // 这月: [start(m).startOf('month'), end(m).endOf('month')] as DT,
1595
+ 本月: [start(m).startOf('month'), end(m).endOf('month')],
1593
1596
  近一月: [start(m).add(-1, 'month').add(1, 'day'), end(m)],
1594
1597
  下月: [start(m).add(1, 'month').startOf('month'), end(m).add(1, 'month').endOf('month')],
1598
+ 本季: [quarter_start, quarter_end],
1599
+ 今年: [start(m).startOf('year'), end(m).endOf('year')],
1595
1600
  近一年: [start(m).add(-1, 'year').add(1, 'day'), end(m)],
1596
1601
  年初至今: [start(m).startOf('year'), end(m)]
1597
1602
  };
1598
1603
  }
1604
+ function presets_range() {
1605
+ var rages = getMomentRange();
1606
+ return listify(rages, function (label, value) {
1607
+ return {
1608
+ label: label,
1609
+ value: value
1610
+ };
1611
+ });
1612
+ }
1599
1613
  function presets_date() {
1600
1614
  return [{
1601
1615
  label: '一月前',
@@ -2902,6 +2916,7 @@ exports.partob = partob;
2902
2916
  exports.pascal = pascal;
2903
2917
  exports.pick = pick;
2904
2918
  exports.presets_date = presets_date;
2919
+ exports.presets_range = presets_range;
2905
2920
  exports.proxied = proxied;
2906
2921
  exports.random = random;
2907
2922
  exports.randomHex = randomHex;
@@ -19,14 +19,22 @@ export declare function getMomentRange(m?: any): {
19
19
  今天: [dayjs.Dayjs, dayjs.Dayjs];
20
20
  明天: [dayjs.Dayjs, dayjs.Dayjs];
21
21
  上周: [dayjs.Dayjs, dayjs.Dayjs];
22
+ 本周: [dayjs.Dayjs, dayjs.Dayjs];
22
23
  近一周: [dayjs.Dayjs, dayjs.Dayjs];
23
24
  下周: [dayjs.Dayjs, dayjs.Dayjs];
24
25
  上月: [dayjs.Dayjs, dayjs.Dayjs];
26
+ 本月: [dayjs.Dayjs, dayjs.Dayjs];
25
27
  近一月: [dayjs.Dayjs, dayjs.Dayjs];
26
28
  下月: [dayjs.Dayjs, dayjs.Dayjs];
29
+ 本季: [dayjs.Dayjs, dayjs.Dayjs];
30
+ 今年: [dayjs.Dayjs, dayjs.Dayjs];
27
31
  近一年: [dayjs.Dayjs, dayjs.Dayjs];
28
32
  年初至今: [dayjs.Dayjs, dayjs.Dayjs];
29
33
  };
34
+ export declare function presets_range(): {
35
+ label: "昨天" | "今天" | "明天" | "上周" | "本周" | "近一周" | "下周" | "上月" | "本月" | "近一月" | "下月" | "本季" | "今年" | "近一年" | "年初至今";
36
+ value: [dayjs.Dayjs, dayjs.Dayjs];
37
+ }[];
30
38
  export declare function presets_date(): {
31
39
  label: string;
32
40
  value: any;
package/dist/typing.d.ts CHANGED
@@ -851,14 +851,22 @@ declare function getMomentRange(m?: any): {
851
851
  今天: [dayjs.Dayjs, dayjs.Dayjs];
852
852
  明天: [dayjs.Dayjs, dayjs.Dayjs];
853
853
  上周: [dayjs.Dayjs, dayjs.Dayjs];
854
+ 本周: [dayjs.Dayjs, dayjs.Dayjs];
854
855
  近一周: [dayjs.Dayjs, dayjs.Dayjs];
855
856
  下周: [dayjs.Dayjs, dayjs.Dayjs];
856
857
  上月: [dayjs.Dayjs, dayjs.Dayjs];
858
+ 本月: [dayjs.Dayjs, dayjs.Dayjs];
857
859
  近一月: [dayjs.Dayjs, dayjs.Dayjs];
858
860
  下月: [dayjs.Dayjs, dayjs.Dayjs];
861
+ 本季: [dayjs.Dayjs, dayjs.Dayjs];
862
+ 今年: [dayjs.Dayjs, dayjs.Dayjs];
859
863
  近一年: [dayjs.Dayjs, dayjs.Dayjs];
860
864
  年初至今: [dayjs.Dayjs, dayjs.Dayjs];
861
865
  };
866
+ declare function presets_range(): {
867
+ label: "昨天" | "今天" | "明天" | "上周" | "本周" | "近一周" | "下周" | "上月" | "本月" | "近一月" | "下月" | "本季" | "今年" | "近一年" | "年初至今";
868
+ value: [dayjs.Dayjs, dayjs.Dayjs];
869
+ }[];
862
870
  declare function presets_date(): {
863
871
  label: string;
864
872
  value: any;
@@ -944,5 +952,5 @@ declare function create_load_src(): (items: TMixOpt | TMixOpt[], node?: HTMLHead
944
952
  declare function load_src(items: TMixOpt, node?: HTMLHeadElement): Promise<Element>;
945
953
  declare function load_src(items: TMixOpt[], node?: HTMLHeadElement): Promise<Element[]>;
946
954
 
947
- export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, object_to_formData, object_to_searchparams, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
955
+ export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, object_to_formData, object_to_searchparams, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, presets_range, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
948
956
  export type { AnyObject, Dayjs, DayjsConfigType, ICommonOption, PartialAll, PartialSome, PropertyKey$1 as PropertyKey, TCommonFileType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noah-libjs/utils",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -34,5 +34,5 @@
34
34
  "keywords": [],
35
35
  "author": "",
36
36
  "license": "MIT",
37
- "gitHead": "53cc4a32579d7255f622cfb51a73678a45962f56"
37
+ "gitHead": "5793768e72d031d4d72a26265f5722daf8a84c03"
38
38
  }