zartui 3.0.4 → 3.0.5

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/lib/zartui.cjs.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const use = require("@zartui/use");
4
4
  const vue = require("vue");
5
+ const dateUtils = require("@zartui/date-utils");
5
6
  const popperjs = require("@zartui/popperjs");
6
7
  const isDef = (val) => val !== void 0 && val !== null;
7
8
  const isFunction = (val) => typeof val === "function";
@@ -10624,73 +10625,6 @@ const parseDecimal = (obj, defaultValue) => {
10624
10625
  }
10625
10626
  return result;
10626
10627
  };
10627
- var __formatNumber__ = function(number) {
10628
- if (number < 10) {
10629
- return "0" + number;
10630
- }
10631
- return number + "";
10632
- };
10633
- var DATE_FORMAT = {
10634
- FORMAT_HM: "HH:mm",
10635
- FORMAT_MDHM: "MM-dd HH:mm",
10636
- FORMAT_MD_CN: "MM\u6708dd\u65E5",
10637
- FORMAT_MD: "MM-dd",
10638
- FORMAT_YMD: "yyyy-MM-dd",
10639
- FORMAT_YMD_SLASH: "yyyy/MM/dd",
10640
- FORMAT_YM: "yyyy-MM",
10641
- FORMAT_YMDHM: "yyyy-MM-dd HH:mm",
10642
- FORMAT_YMDHMS: "yyyy-MM-dd HH:mm:ss",
10643
- FORMAT_YMDHMSMS: "yyyy-MM-dd HH:mm:ss msms",
10644
- FORMAT_YM_CN: "yyyy\u5E74MM\u6708",
10645
- FORMAT_YMD_CN: "yyyy\u5E74MM\u6708dd\u65E5",
10646
- FORMAT_YMDH_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6",
10647
- FORMAT_MDH_CN: "MM\u6708dd\u65E5 HH\u65F6",
10648
- FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10649
- FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10650
- };
10651
- function createDate(dateObj) {
10652
- if (typeof dateObj === "number") {
10653
- return new Date(dateObj);
10654
- }
10655
- if (typeof dateObj === "string") {
10656
- dateObj = dateObj.replace(/-/g, "/");
10657
- if (dateObj.length === 7) {
10658
- dateObj += "/01";
10659
- }
10660
- return new Date(dateObj);
10661
- }
10662
- return dateObj;
10663
- }
10664
- function formatDate(dateObj, formatType = DATE_FORMAT.FORMAT_YMDHMS) {
10665
- const date = createDate(dateObj);
10666
- let formatResult = formatType.replace(
10667
- "yyyy",
10668
- __formatNumber__(date.getFullYear())
10669
- );
10670
- formatResult = formatResult.replace(
10671
- "yy",
10672
- String(date.getFullYear()).substring(2)
10673
- );
10674
- formatResult = formatResult.replace(
10675
- "MM",
10676
- __formatNumber__(date.getMonth() + 1)
10677
- );
10678
- formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10679
- formatResult = formatResult.replace("HH", __formatNumber__(date.getHours()));
10680
- formatResult = formatResult.replace(
10681
- "mm",
10682
- __formatNumber__(date.getMinutes())
10683
- );
10684
- formatResult = formatResult.replace(
10685
- "ss",
10686
- __formatNumber__(date.getSeconds())
10687
- );
10688
- formatResult = formatResult.replace(
10689
- "msms",
10690
- __formatNumber__(date.getMilliseconds())
10691
- );
10692
- return formatResult;
10693
- }
10694
10628
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10695
10629
  const subString = (str, startIndex, length) => {
10696
10630
  if (!isDef(length)) {
@@ -10915,22 +10849,22 @@ function buildContent(contentConfigString, watermarkContext) {
10915
10849
  const regexResult = scanner.next(dateRegex);
10916
10850
  if (regexResult) {
10917
10851
  const matchResults = regexResult;
10918
- let format = DATE_FORMAT.FORMAT_YMD;
10852
+ let format = dateUtils.DATE_FORMAT.FORMAT_YMD;
10919
10853
  if (matchResults && matchResults.length >= 2) {
10920
10854
  if (isValidString(matchResults[1])) {
10921
10855
  format = matchResults[1];
10922
10856
  }
10923
10857
  }
10924
10858
  if (watermarkContext) {
10925
- content += formatDate(watermarkContext.watermarkTime, format);
10859
+ content += dateUtils.formatDate(watermarkContext.watermarkTime, format);
10926
10860
  }
10927
10861
  scanner.skip(matchResults.input);
10928
10862
  }
10929
10863
  } else if (scanner.hasNext("time")) {
10930
10864
  if (watermarkContext) {
10931
- const value = formatDate(
10865
+ const value = dateUtils.formatDate(
10932
10866
  watermarkContext.watermarkTime,
10933
- DATE_FORMAT.FORMAT_HM
10867
+ dateUtils.DATE_FORMAT.FORMAT_HM
10934
10868
  );
10935
10869
  content += value;
10936
10870
  }
@@ -16240,7 +16174,7 @@ const Lazyload = {
16240
16174
  });
16241
16175
  }
16242
16176
  };
16243
- const version = "3.0.4";
16177
+ const version = "3.0.5";
16244
16178
  function install(app) {
16245
16179
  const components = [
16246
16180
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { useWindowSize, useRect, onMountedOrActivated, getScrollParent, useEventListener, useToggle, raf, useScrollParent, useChildren, usePageVisibility, doubleRaf, useParent, useCustomFieldValue, useClickAway, CUSTOM_FIELD_INJECTION_KEY, inBrowser as inBrowser$1 } from "@zartui/use";
2
2
  import { unref, ref, reactive, defineComponent, computed, createVNode, watch, onActivated, onDeactivated, onBeforeUnmount, provide, inject, mergeProps, getCurrentInstance, Transition, withDirectives, vShow, nextTick, onMounted, Teleport, Fragment, resolveDirective, onBeforeUpdate, onUnmounted, createApp, createTextVNode, watchEffect, withKeys, onUpdated, h } from "vue";
3
+ import { DATE_FORMAT, formatDate } from "@zartui/date-utils";
3
4
  import { offsetModifier, createPopper } from "@zartui/popperjs";
4
5
  const isDef = (val) => val !== void 0 && val !== null;
5
6
  const isFunction = (val) => typeof val === "function";
@@ -10622,73 +10623,6 @@ const parseDecimal = (obj, defaultValue) => {
10622
10623
  }
10623
10624
  return result;
10624
10625
  };
10625
- var __formatNumber__ = function(number) {
10626
- if (number < 10) {
10627
- return "0" + number;
10628
- }
10629
- return number + "";
10630
- };
10631
- var DATE_FORMAT = {
10632
- FORMAT_HM: "HH:mm",
10633
- FORMAT_MDHM: "MM-dd HH:mm",
10634
- FORMAT_MD_CN: "MM\u6708dd\u65E5",
10635
- FORMAT_MD: "MM-dd",
10636
- FORMAT_YMD: "yyyy-MM-dd",
10637
- FORMAT_YMD_SLASH: "yyyy/MM/dd",
10638
- FORMAT_YM: "yyyy-MM",
10639
- FORMAT_YMDHM: "yyyy-MM-dd HH:mm",
10640
- FORMAT_YMDHMS: "yyyy-MM-dd HH:mm:ss",
10641
- FORMAT_YMDHMSMS: "yyyy-MM-dd HH:mm:ss msms",
10642
- FORMAT_YM_CN: "yyyy\u5E74MM\u6708",
10643
- FORMAT_YMD_CN: "yyyy\u5E74MM\u6708dd\u65E5",
10644
- FORMAT_YMDH_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6",
10645
- FORMAT_MDH_CN: "MM\u6708dd\u65E5 HH\u65F6",
10646
- FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10647
- FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10648
- };
10649
- function createDate(dateObj) {
10650
- if (typeof dateObj === "number") {
10651
- return new Date(dateObj);
10652
- }
10653
- if (typeof dateObj === "string") {
10654
- dateObj = dateObj.replace(/-/g, "/");
10655
- if (dateObj.length === 7) {
10656
- dateObj += "/01";
10657
- }
10658
- return new Date(dateObj);
10659
- }
10660
- return dateObj;
10661
- }
10662
- function formatDate(dateObj, formatType = DATE_FORMAT.FORMAT_YMDHMS) {
10663
- const date = createDate(dateObj);
10664
- let formatResult = formatType.replace(
10665
- "yyyy",
10666
- __formatNumber__(date.getFullYear())
10667
- );
10668
- formatResult = formatResult.replace(
10669
- "yy",
10670
- String(date.getFullYear()).substring(2)
10671
- );
10672
- formatResult = formatResult.replace(
10673
- "MM",
10674
- __formatNumber__(date.getMonth() + 1)
10675
- );
10676
- formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10677
- formatResult = formatResult.replace("HH", __formatNumber__(date.getHours()));
10678
- formatResult = formatResult.replace(
10679
- "mm",
10680
- __formatNumber__(date.getMinutes())
10681
- );
10682
- formatResult = formatResult.replace(
10683
- "ss",
10684
- __formatNumber__(date.getSeconds())
10685
- );
10686
- formatResult = formatResult.replace(
10687
- "msms",
10688
- __formatNumber__(date.getMilliseconds())
10689
- );
10690
- return formatResult;
10691
- }
10692
10626
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10693
10627
  const subString = (str, startIndex, length) => {
10694
10628
  if (!isDef(length)) {
@@ -16238,7 +16172,7 @@ const Lazyload = {
16238
16172
  });
16239
16173
  }
16240
16174
  };
16241
- const version = "3.0.4";
16175
+ const version = "3.0.5";
16242
16176
  function install(app) {
16243
16177
  const components = [
16244
16178
  ActionSheet,
package/lib/zartui.js CHANGED
@@ -17353,7 +17353,7 @@
17353
17353
  });
17354
17354
  }
17355
17355
  };
17356
- const version = "3.0.4";
17356
+ const version = "3.0.5";
17357
17357
  function install(app) {
17358
17358
  const components = [
17359
17359
  ActionSheet,