@amirjalili1374/ui-kit 1.5.25 → 1.5.28

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
@@ -1,9 +1,8 @@
1
1
  var __defProp2 = Object.defineProperty;
2
2
  var __defNormalProp2 = (obj, key2, value2) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key2] = value2;
3
3
  var __publicField = (obj, key2, value2) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value2);
4
- import { warn, reactive, watchEffect, toRef, capitalize, shallowRef, Fragment, camelize, isVNode, Comment, unref, getCurrentInstance as getCurrentInstance$1, ref, computed, provide, inject, defineComponent as defineComponent$1, h, createElementVNode, normalizeStyle, normalizeClass, toValue, resolveDynamicComponent, nextTick, onScopeDispose, createVNode, mergeProps, toRefs, Text, isRef, TransitionGroup, Transition, watch, onBeforeMount, onBeforeUnmount, withDirectives, vShow, toDisplayString, effectScope, toRaw, readonly, openBlock, createBlock, withCtx, createCommentVNode, useId, onMounted, onUpdated, Teleport, createTextVNode, createElementBlock, renderSlot, onDeactivated, cloneVNode, renderList, createSlots, normalizeProps, guardReactiveProps, onActivated, onBeforeUpdate, withModifiers, vModelText, withKeys, onUnmounted, resolveComponent } from "vue";
4
+ import { warn, reactive, watchEffect, toRef, capitalize, shallowRef, Fragment, camelize, isVNode, Comment, unref, getCurrentInstance as getCurrentInstance$1, ref, computed, provide, inject, defineComponent as defineComponent$1, h, createElementVNode, normalizeStyle, normalizeClass, toValue, resolveDynamicComponent, nextTick, onScopeDispose, createVNode, mergeProps, toRefs, Text, isRef, TransitionGroup, Transition, watch, onBeforeMount, onBeforeUnmount, withDirectives, vShow, toDisplayString, effectScope, toRaw, readonly, openBlock, createBlock, withCtx, createCommentVNode, useId, onMounted, onUpdated, Teleport, createTextVNode, createElementBlock, renderSlot, onDeactivated, cloneVNode, renderList, createSlots, normalizeProps, guardReactiveProps, resolveComponent, onActivated, onBeforeUpdate, withModifiers, vModelText, withKeys, onUnmounted } from "vue";
5
5
  import { IconHome, IconArrowBadgeLeft, IconChevronDown, IconChevronRight, IconCheck, IconSquareX, IconMinus, IconPlus, IconRefresh, IconChevronLeft, IconDownload, IconPrinter, IconMaximize, IconMinimize, IconX, IconFileText, IconPencil, IconClock, IconMenu2, IconPalette } from "@tabler/icons-vue";
6
- import Vue3PersianDatetimePicker from "vue3-persian-datetime-picker";
7
6
  import axios from "axios";
8
7
  import { useDebounceFn } from "@vueuse/core";
9
8
  import { useRouter as useRouter$1 } from "vue-router";
@@ -13952,8 +13951,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
13952
13951
  __name: "ShamsiDatePicker",
13953
13952
  props: {
13954
13953
  modelValue: { default: "" },
13955
- label: { default: "Date" },
13956
- placeholder: { default: "Select date" },
13954
+ label: { default: "تاریخ" },
13955
+ placeholder: { default: "تاریخ را انتخاب کنید" },
13957
13956
  variant: { default: "outlined" },
13958
13957
  density: { default: "default" },
13959
13958
  color: { default: "primary" },
@@ -13965,60 +13964,16 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
13965
13964
  prependInnerIcon: { default: "" },
13966
13965
  appendInnerIcon: { default: "" },
13967
13966
  format: { default: "YYYY-MM-DD" },
13968
- displayFormat: { default: "" },
13969
- formatPreset: { default: "full" },
13970
- calendarType: { default: "gregorian" },
13967
+ displayFormat: { default: "jYYYY/jMM/jDD" },
13971
13968
  minDate: { default: "" },
13972
13969
  maxDate: { default: "" },
13973
13970
  mode: { default: "single" },
13974
- icon: { default: "" }
13971
+ icon: { default: "" },
13972
+ outputFormat: { default: "iso" }
13975
13973
  },
13976
13974
  emits: ["update:modelValue"],
13977
13975
  setup(__props, { emit: __emit }) {
13978
13976
  const props = __props;
13979
- const jalaliPresets = {
13980
- full: "jYYYY/jMM/jDD",
13981
- short: "jYY/jM/jD",
13982
- medium: "jD jMMMM jYYYY",
13983
- numeric: "jYYYYjMMjDD",
13984
- iso: "jYYYY-jMM-jDDTHH:mm:ss.SSS[Z]",
13985
- "iso-local": "jYYYY-jMM-jDDTHH:mm:ss.SSSZ",
13986
- custom: props.displayFormat || "jYYYY/jMM/jDD"
13987
- };
13988
- const gregorianPresets = {
13989
- full: "YYYY/MM/DD",
13990
- short: "YY/M/D",
13991
- medium: "D MMMM YYYY",
13992
- numeric: "YYYYMMDD",
13993
- iso: "YYYY-MM-DDTHH:mm:ss.SSS[Z]",
13994
- "iso-local": "YYYY-MM-DDTHH:mm:ss.SSSZ",
13995
- custom: props.displayFormat || "YYYY/MM/DD"
13996
- };
13997
- const computedDisplayFormat = computed(() => {
13998
- if (props.displayFormat) {
13999
- return props.displayFormat;
14000
- }
14001
- const presets = props.calendarType === "jalali" ? jalaliPresets : gregorianPresets;
14002
- return presets[props.formatPreset];
14003
- });
14004
- const pickerType = computed(() => {
14005
- return props.calendarType === "jalali" ? "date" : "datetime";
14006
- });
14007
- const localeConfig = computed(() => {
14008
- if (props.mode === "range") {
14009
- return {
14010
- fa: {
14011
- from: "از تاریخ",
14012
- to: "تا تاریخ"
14013
- },
14014
- en: {
14015
- from: "From",
14016
- to: "To"
14017
- }
14018
- };
14019
- }
14020
- return void 0;
14021
- });
14022
13977
  const emit = __emit;
14023
13978
  const selectedDate = computed({
14024
13979
  get: () => {
@@ -14038,93 +13993,84 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent$1({
14038
13993
  emit("update:modelValue", value2);
14039
13994
  }
14040
13995
  });
14041
- const displayValue = computed(() => {
14042
- if (props.mode === "range" && Array.isArray(props.modelValue)) {
14043
- if (props.modelValue[0] && props.modelValue[1]) {
14044
- return `${formatDate(props.modelValue[0])} ~ ${formatDate(props.modelValue[1])}`;
14045
- }
14046
- return "";
14047
- }
14048
- return props.modelValue ? formatDate(props.modelValue) : "";
14049
- });
14050
- const formatDate = (dateString) => {
14051
- if (!dateString) return "";
14052
- try {
14053
- const date = new Date(dateString);
14054
- if (isNaN(date.getTime())) return dateString;
14055
- if (props.calendarType === "gregorian") {
14056
- return date.toLocaleDateString("en-US", {
14057
- year: "numeric",
14058
- month: "2-digit",
14059
- day: "2-digit"
14060
- });
14061
- }
14062
- return dateString;
14063
- } catch {
14064
- return dateString;
14065
- }
14066
- };
14067
13996
  const onDateChange = (date) => {
14068
13997
  if (props.mode === "range") {
14069
13998
  if (Array.isArray(date) && date.length === 2) {
14070
13999
  const [startDate, endDate] = date;
14071
- const gregorianStart = startDate && startDate._isAMomentObject ? startDate.toISOString() : startDate;
14072
- const gregorianEnd = endDate && endDate._isAMomentObject ? endDate.toISOString() : endDate;
14000
+ const gregorianStart = formatOutput(startDate);
14001
+ const gregorianEnd = formatOutput(endDate);
14073
14002
  emit("update:modelValue", [gregorianStart, gregorianEnd]);
14003
+ } else {
14004
+ emit("update:modelValue", null);
14074
14005
  }
14075
14006
  } else {
14076
- const gregorianDate = date && date._isAMomentObject ? date.toISOString() : date;
14077
- emit("update:modelValue", gregorianDate);
14007
+ if (date) {
14008
+ const formattedDate = formatOutput(date);
14009
+ emit("update:modelValue", formattedDate);
14010
+ } else {
14011
+ emit("update:modelValue", "");
14012
+ }
14078
14013
  }
14079
14014
  };
14080
- const onClear = () => {
14081
- emit("update:modelValue", props.mode === "range" ? ["", ""] : null);
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
+ if (props.outputFormat === "date-only") {
14029
+ const year = dateObj.getFullYear();
14030
+ const month = String(dateObj.getMonth() + 1).padStart(2, "0");
14031
+ const day = String(dateObj.getDate()).padStart(2, "0");
14032
+ return `${year}-${month}-${day}`;
14033
+ } else {
14034
+ return dateObj.toISOString();
14035
+ }
14082
14036
  };
14037
+ const inputClass = computed(() => {
14038
+ const classes = ["v-text-field", "v-input", "v-input--density-comfortable"];
14039
+ if (props.variant === "outlined") {
14040
+ classes.push("v-text-field--variant-outlined");
14041
+ }
14042
+ return classes.join(" ");
14043
+ });
14044
+ const wrapperClass = computed(() => {
14045
+ return "v-field v-field--variant-outlined v-field--density-comfortable";
14046
+ });
14047
+ const isRangeMode = computed(() => props.mode === "range");
14083
14048
  return (_ctx, _cache) => {
14049
+ const _component_Vue3PersianDatetimePicker = resolveComponent("Vue3PersianDatetimePicker");
14084
14050
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
14085
- createVNode(unref(Vue3PersianDatetimePicker), {
14051
+ createVNode(_component_Vue3PersianDatetimePicker, {
14052
+ label: __props.label,
14086
14053
  modelValue: selectedDate.value,
14087
14054
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedDate.value = $event),
14088
- type: pickerType.value,
14089
- format: props.format,
14090
- "display-format": computedDisplayFormat.value,
14091
- color: props.color,
14092
- disabled: props.disabled,
14093
- clearable: props.clearable,
14094
- min: props.minDate,
14095
- max: props.maxDate,
14096
- "auto-submit": props.mode === "single",
14097
- range: props.mode === "range",
14098
- locale: props.calendarType === "jalali" ? "fa" : "en",
14099
- "locale-config": localeConfig.value,
14100
- placeholder: props.placeholder,
14055
+ format: __props.format,
14056
+ "display-format": __props.displayFormat,
14057
+ editable: false,
14058
+ clearable: __props.clearable,
14059
+ disabled: __props.disabled,
14060
+ min: __props.minDate,
14061
+ max: __props.maxDate,
14062
+ placeholder: __props.placeholder,
14063
+ "input-class": inputClass.value,
14064
+ "wrapper-class": wrapperClass.value,
14065
+ range: isRangeMode.value,
14066
+ color: __props.color,
14101
14067
  onChange: onDateChange
14102
- }, {
14103
- input: withCtx(() => [
14104
- createVNode(VTextField, {
14105
- "model-value": displayValue.value,
14106
- label: props.label,
14107
- placeholder: props.placeholder,
14108
- variant: props.variant,
14109
- density: props.density,
14110
- color: props.color,
14111
- disabled: props.disabled,
14112
- readonly: true,
14113
- clearable: props.clearable,
14114
- rules: props.rules,
14115
- "hide-details": props.hideDetails,
14116
- "prepend-inner-icon": props.prependInnerIcon || props.icon,
14117
- "append-inner-icon": props.appendInnerIcon,
14118
- "onClick:clear": onClear
14119
- }, null, 8, ["model-value", "label", "placeholder", "variant", "density", "color", "disabled", "clearable", "rules", "hide-details", "prepend-inner-icon", "append-inner-icon"])
14120
- ]),
14121
- _: 1
14122
- }, 8, ["modelValue", "type", "format", "display-format", "color", "disabled", "clearable", "min", "max", "auto-submit", "range", "locale", "locale-config", "placeholder"])
14068
+ }, null, 8, ["label", "modelValue", "format", "display-format", "clearable", "disabled", "min", "max", "placeholder", "input-class", "wrapper-class", "range", "color"])
14123
14069
  ]);
14124
14070
  };
14125
14071
  }
14126
14072
  });
14127
- const ShamsiDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-2054c11e"]]);
14073
+ const ShamsiDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-90d4df89"]]);
14128
14074
  const _hoisted_1$a = { class: "mb-6" };
14129
14075
  const _hoisted_2$6 = { class: "text-subtitle-1 font-weight-medium mb-3" };
14130
14076
  const _hoisted_3$4 = { class: "theme-toggle-container" };