@amirjalili1374/ui-kit 1.5.79 → 1.5.81

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/ui-kit.es.js CHANGED
@@ -13952,102 +13952,98 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
13952
13952
  props: {
13953
13953
  modelValue: { default: "" },
13954
13954
  label: { default: "تاریخ" },
13955
- placeholder: { default: "تاریخ را انتخاب کنید" },
13956
- variant: { default: "outlined" },
13957
- density: { default: "compact" },
13955
+ placeholder: { default: "انتخاب کنید" },
13958
13956
  color: { default: "primary" },
13959
13957
  disabled: { type: Boolean, default: false },
13960
- readonly: { type: Boolean, default: false },
13961
13958
  clearable: { type: Boolean, default: true },
13962
- rules: { default: () => [] },
13963
- hideDetails: { type: [Boolean, String], default: "auto" },
13964
- prependInnerIcon: { default: "" },
13965
- appendInnerIcon: { default: "" },
13966
- format: { default: "YYYY-MM-DD" },
13967
- displayFormat: { default: "jYYYY/jMM/jDD" },
13968
- minDate: { default: "" },
13969
- maxDate: { default: "" },
13959
+ minDate: {},
13960
+ maxDate: {},
13970
13961
  mode: { default: "single" },
13971
- icon: { default: "" },
13972
- outputFormat: { default: "iso" }
13962
+ type: { default: "date" },
13963
+ outputFormat: { default: "iso" },
13964
+ format: {},
13965
+ displayFormat: {}
13973
13966
  },
13974
13967
  emits: ["update:modelValue"],
13975
13968
  setup(__props, { emit: __emit }) {
13976
13969
  const props = __props;
13977
13970
  const emit = __emit;
13971
+ const internalFormat = computed(() => {
13972
+ if (props.format) return props.format;
13973
+ return props.type === "datetime" || props.type === "time" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
13974
+ });
13975
+ const internalDisplayFormat = computed(() => {
13976
+ if (props.displayFormat) return props.displayFormat;
13977
+ switch (props.type) {
13978
+ case "datetime":
13979
+ return "jYYYY/jMM/jDD HH:mm";
13980
+ case "time":
13981
+ return "HH:mm";
13982
+ case "year":
13983
+ return "jYYYY";
13984
+ case "month":
13985
+ return "jMMMM jYYYY";
13986
+ default:
13987
+ return "jYYYY/jMM/jDD";
13988
+ }
13989
+ });
13978
13990
  const selectedDate = computed({
13979
13991
  get: () => {
13992
+ if (!props.modelValue) return "";
13980
13993
  if (props.mode === "range" && Array.isArray(props.modelValue)) {
13981
13994
  return props.modelValue;
13982
- } else if (typeof props.modelValue === "string" && props.modelValue) {
13983
- if (props.modelValue.includes("T")) {
13984
- const date = new Date(props.modelValue);
13985
- const localDate = date.getFullYear() + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0");
13986
- return localDate;
13995
+ }
13996
+ if (typeof props.modelValue === "string" && props.modelValue.includes("T")) {
13997
+ const date = new Date(props.modelValue);
13998
+ if (!isNaN(date.getTime())) {
13999
+ const pad = (n) => String(n).padStart(2, "0");
14000
+ const y = date.getFullYear();
14001
+ const m = pad(date.getMonth() + 1);
14002
+ const d = pad(date.getDate());
14003
+ const h2 = pad(date.getHours());
14004
+ const min = pad(date.getMinutes());
14005
+ const s = pad(date.getSeconds());
14006
+ if (props.type === "datetime" || props.type === "time") {
14007
+ return `${y}-${m}-${d} ${h2}:${min}:${s}`;
14008
+ }
14009
+ return `${y}-${m}-${d}`;
13987
14010
  }
13988
- return props.modelValue;
13989
14011
  }
13990
14012
  return props.modelValue;
13991
14013
  },
13992
14014
  set: (value2) => {
13993
- emit("update:modelValue", value2);
13994
14015
  }
13995
14016
  });
14017
+ const formatOutput = (date) => {
14018
+ if (!date) return "";
14019
+ let dateObj;
14020
+ if (date._isAMomentObject) dateObj = date.toDate();
14021
+ else if (typeof date === "string") dateObj = new Date(date);
14022
+ else if (date instanceof Date) dateObj = date;
14023
+ else return "";
14024
+ if (isNaN(dateObj.getTime())) return "";
14025
+ if (props.outputFormat === "date-only" && props.type === "date") {
14026
+ const y = dateObj.getFullYear();
14027
+ const m = String(dateObj.getMonth() + 1).padStart(2, "0");
14028
+ const d = String(dateObj.getDate()).padStart(2, "0");
14029
+ return `${y}-${m}-${d}`;
14030
+ }
14031
+ return dateObj.toISOString();
14032
+ };
13996
14033
  const onDateChange = (date) => {
13997
14034
  if (props.mode === "range") {
13998
14035
  if (Array.isArray(date) && date.length === 2) {
13999
- const [startDate, endDate] = date;
14000
- const gregorianStart = formatOutput(startDate);
14001
- const gregorianEnd = formatOutput(endDate);
14002
- emit("update:modelValue", [gregorianStart, gregorianEnd]);
14036
+ emit("update:modelValue", [formatOutput(date[0]), formatOutput(date[1])]);
14003
14037
  } else {
14004
14038
  emit("update:modelValue", null);
14005
14039
  }
14006
14040
  } else {
14007
- if (date) {
14008
- const formattedDate = formatOutput(date);
14009
- emit("update:modelValue", formattedDate);
14010
- } else {
14011
- emit("update:modelValue", "");
14012
- }
14013
- }
14014
- };
14015
- const formatOutput = (date) => {
14016
- if (!date) return "";
14017
- let dateObj;
14018
- if (date._isAMomentObject && date.isValid()) {
14019
- dateObj = date.toDate();
14020
- } else if (typeof date === "string") {
14021
- dateObj = new Date(date);
14022
- } else if (date instanceof Date) {
14023
- dateObj = date;
14024
- } else {
14025
- return "";
14026
- }
14027
- if (isNaN(dateObj.getTime())) return "";
14028
- const year = dateObj.getFullYear();
14029
- const month = dateObj.getMonth();
14030
- const day = dateObj.getDate();
14031
- if (props.outputFormat === "date-only") {
14032
- const m = String(month + 1).padStart(2, "0");
14033
- const d = String(day).padStart(2, "0");
14034
- return `${year}-${m}-${d}`;
14035
- } else {
14036
- const utcDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));
14037
- return utcDate.toISOString();
14041
+ emit("update:modelValue", date ? formatOutput(date) : "");
14038
14042
  }
14039
14043
  };
14040
- const inputClass = computed(() => {
14041
- const classes = ["v-text-field", "v-input", "v-input--density-comfortable"];
14042
- if (props.variant === "outlined") {
14043
- classes.push("v-text-field--variant-outlined");
14044
- }
14045
- return classes.join(" ");
14046
- });
14047
- const wrapperClass = computed(() => {
14048
- return "v-field v-field--variant-outlined v-field--density-comfortable";
14049
- });
14050
14044
  const isRangeMode = computed(() => props.mode === "range");
14045
+ const inputClass = computed(() => "v-text-field v-input v-input--density-comfortable v-text-field--variant-outlined");
14046
+ const wrapperClass = computed(() => "v-field v-field--variant-outlined v-field--density-comfortable");
14051
14047
  return (_ctx, _cache) => {
14052
14048
  const _component_Vue3PersianDatetimePicker = resolveComponent("Vue3PersianDatetimePicker");
14053
14049
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
@@ -14055,8 +14051,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
14055
14051
  label: __props.label,
14056
14052
  modelValue: selectedDate.value,
14057
14053
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedDate.value = $event),
14058
- format: __props.format,
14059
- "display-format": __props.displayFormat,
14054
+ type: __props.type,
14055
+ format: internalFormat.value,
14056
+ "display-format": internalDisplayFormat.value,
14060
14057
  editable: false,
14061
14058
  clearable: __props.clearable,
14062
14059
  disabled: __props.disabled,
@@ -14068,12 +14065,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
14068
14065
  range: isRangeMode.value,
14069
14066
  color: __props.color,
14070
14067
  onChange: onDateChange
14071
- }, null, 8, ["label", "modelValue", "format", "display-format", "clearable", "disabled", "min", "max", "placeholder", "input-class", "wrapper-class", "range", "color"])
14068
+ }, null, 8, ["label", "modelValue", "type", "format", "display-format", "clearable", "disabled", "min", "max", "placeholder", "input-class", "wrapper-class", "range", "color"])
14072
14069
  ]);
14073
14070
  };
14074
14071
  }
14075
14072
  });
14076
- const ShamsiDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-faabccc1"]]);
14073
+ const ShamsiDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-d9d904b6"]]);
14077
14074
  const _hoisted_1$a = { class: "mb-6" };
14078
14075
  const _hoisted_2$6 = { class: "text-subtitle-1 font-weight-medium mb-3" };
14079
14076
  const _hoisted_3$4 = { class: "theme-toggle-container" };
@@ -21989,7 +21986,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent$1({
21989
21986
  };
21990
21987
  }
21991
21988
  });
21992
- const AppStepper = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-17da761e"]]);
21989
+ const AppStepper = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-5e0dd5c8"]]);
21993
21990
  var lottie = { exports: {} };
21994
21991
  (function(module, exports$1) {
21995
21992
  typeof navigator !== "undefined" && function(global2, factory) {