inertia-bootstrap-forms 4.0.5 → 4.0.7
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/README.fa.md +548 -548
- package/README.md +554 -554
- package/dist/persian-date.cjs +1 -1
- package/dist/persian-date.js +80 -55
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/PersianDatePickerInput.vue +134 -80
- package/src/entries/persian-date.js +1 -1
- package/types/persian-date.d.ts +1 -1
package/dist/persian-date.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.create;var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var k=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of c(t))!g.call(e,o)&&o!==n&&u(e,o,{get:()=>t[o],enumerable:!(l=C(t,o))||l.enumerable});return e};var y=(e,t,n)=>(n=e!=null?f(h(e)):{},k(t||!e||!e.__esModule?u(n,"default",{value:e,enumerable:!0}):n,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),s=require("./chunks/_plugin-vue_export-helper-BHyUve4F.cjs"),v=a.defineAsyncComponent(()=>import("vue3-persian-datetime-picker"));function w(){var o;if(typeof document>"u")return"en";const e=document.documentElement,t=(e.getAttribute("lang")||"").toLowerCase(),n=(e.getAttribute("dir")||((o=document.body)==null?void 0:o.getAttribute("dir"))||"").toLowerCase();return t?t.startsWith("fa")||n==="rtl"&&!t?"fa":"en":n==="rtl"||(typeof navigator<"u"&&navigator.language||"").toLowerCase().startsWith("fa")?"fa":"en"}const b=a.defineComponent({name:"PersianDatePickerInput",components:{Vue3PersianDatetimePicker:v},emits:["update:modelValue","change","open","close"],props:{...s.fieldProps,calendar:{type:String,default:"date"},view:{type:String,default:"date"},min:{type:String,default:null},max:{type:String,default:null},range:{type:Boolean,default:!1},locale:{type:String,default:"auto"},format:{type:String,default:"jYYYY/jMM/jDD"},inputFormat:{type:String,default:null},editable:{type:Boolean,default:!1},simple:{type:Boolean,default:!1},placeholder:{type:String,default:null},inputClass:{type:String,default:"fanum"},pickerOptions:{type:Object,default:()=>({})}},setup(e,{emit:t,expose:n}){const l=s.useField(e,t),o=l.inputId,d=a.ref(!1),i=a.ref("en");a.onMounted(()=>{i.value=w(),d.value=!0});const r=a.computed(()=>e.locale==="auto"?i.value:e.locale);return a.watch(()=>l.model.value,(p,m)=>t("change",p,m)),n({clear:()=>l.model.value=null}),{...l,inputID:o,ready:d,resolvedLocale:r,showCalendar:V}}});let V=a.ref(!1);const M={class:"form-control form-adorn form-persian-datepicker form-adorn-end"},P=["id","name","placeholder","disabled"];function D(e,t,n,l,o,d){const i=a.resolveComponent("Vue3PersianDatetimePicker");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("label",M,[a.createElementVNode("span",{onClick:t[0]||(t[0]=r=>e.showCalendar=!0),class:"form-adorn-icon","aria-hidden":"true"},t[4]||(t[4]=[a.createStaticVNode('<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 22H10C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 17.7712 2 14V12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12V14C22 17.7712 22 19.6569 20.8284 20.8284C20.1752 21.4816 19.3001 21.7706 18 21.8985" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M7 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M17 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M21.5 9H16.625H10.75M2 9H5.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17Z" fill="#1C274C"></path><path d="M18 13C18 13.5523 17.5523 14 17 14C16.4477 14 16 13.5523 16 13C16 12.4477 16.4477 12 17 12C17.5523 12 18 12.4477 18 13Z" fill="#1C274C"></path><path d="M13 17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17C11 16.4477 11.4477 16 12 16C12.5523 16 13 16.4477 13 17Z" fill="#1C274C"></path><path d="M13 13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13C11 12.4477 11.4477 12 12 12C12.5523 12 13 12.4477 13 13Z" fill="#1C274C"></path><path d="M8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16C7.55228 16 8 16.4477 8 17Z" fill="#1C274C"></path><path d="M8 13C8 13.5523 7.55228 14 7 14C6.44772 14 6 13.5523 6 13C6 12.4477 6.44772 12 7 12C7.55228 12 8 12.4477 8 13Z" fill="#1C274C"></path></svg>',1)])),a.createElementVNode("input",{id:e.inputID,type:"text",autocomplete:"off",name:e.name,class:a.normalizeClass([e.inputClass,"form-ghost",{"is-invalid":e.isInvalid}]),placeholder:e.placeholder,disabled:e.isDisabled||e.readonly},null,10,P)]),e.ready?(a.openBlock(),a.createBlock(i,a.mergeProps({key:0,modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=r=>e.model=r),"custom-input":"#"+e.inputID,type:e.calendar,view:e.view,min:e.min,max:e.max,show:e.showCalendar,range:e.range,locale:e.resolvedLocale,format:e.format,"input-format":e.inputFormat||e.format,disabled:e.isDisabled||e.readonly,editable:e.editable,simple:e.simple,jumpminute:"15",roundminute:!0,"show-now-btn":!0,"auto-submit":!0},e.pickerOptions,{onOpen:t[2]||(t[2]=r=>e.$emit("open")),onClose:t[3]||(t[3]=()=>{e.showCalendar=!1,e.$emit("close")})}),null,16,["modelValue","custom-input","type","view","min","max","show","range","locale","format","input-format","disabled","editable","simple"])):a.createCommentVNode("",!0)])}const S=s._export_sfc(b,[["render",D]]);exports.PersianDatePickerInput=S;
|
package/dist/persian-date.js
CHANGED
|
@@ -1,73 +1,98 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as f, resolveComponent as C, createElementBlock as h, openBlock as p, createElementVNode as d, createBlock as c, createCommentVNode as g, createStaticVNode as w, normalizeClass as k, mergeProps as v, defineAsyncComponent as y, ref as s, onMounted as b, computed as M, watch as V } from "vue";
|
|
2
|
+
import { _ as D, f as P, u as S } from "./chunks/_plugin-vue_export-helper-13TPlHFF.js";
|
|
3
|
+
const $ = y(() => import("vue3-persian-datetime-picker"));
|
|
4
|
+
function B() {
|
|
5
|
+
var o;
|
|
6
|
+
if (typeof document > "u") return "en";
|
|
7
|
+
const e = document.documentElement, t = (e.getAttribute("lang") || "").toLowerCase(), n = (e.getAttribute("dir") || ((o = document.body) == null ? void 0 : o.getAttribute("dir")) || "").toLowerCase();
|
|
8
|
+
return t ? t.startsWith("fa") || n === "rtl" && !t ? "fa" : "en" : n === "rtl" || (typeof navigator < "u" && navigator.language || "").toLowerCase().startsWith("fa") ? "fa" : "en";
|
|
9
|
+
}
|
|
10
|
+
const I = f({
|
|
4
11
|
name: "PersianDatePickerInput",
|
|
5
|
-
components: { Vue3PersianDatetimePicker:
|
|
12
|
+
components: { Vue3PersianDatetimePicker: $ },
|
|
6
13
|
emits: ["update:modelValue", "change", "open", "close"],
|
|
7
14
|
props: {
|
|
8
|
-
...
|
|
9
|
-
/** date | datetime | time | year-month | month */
|
|
15
|
+
...P,
|
|
10
16
|
calendar: { type: String, default: "date" },
|
|
11
17
|
view: { type: String, default: "date" },
|
|
12
18
|
min: { type: String, default: null },
|
|
13
19
|
max: { type: String, default: null },
|
|
14
20
|
range: { type: Boolean, default: !1 },
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/** 'auto' | 'fa' | 'en' */
|
|
22
|
+
locale: { type: String, default: "auto" },
|
|
17
23
|
format: { type: String, default: "jYYYY/jMM/jDD" },
|
|
18
|
-
/** Format shown in the input (defaults to `format`). */
|
|
19
24
|
inputFormat: { type: String, default: null },
|
|
25
|
+
editable: { type: Boolean, default: !1 },
|
|
26
|
+
simple: { type: Boolean, default: !1 },
|
|
20
27
|
placeholder: { type: String, default: null },
|
|
21
|
-
inputClass: { type: String, default: "
|
|
22
|
-
/** Extra props forwarded to vue3-persian-datetime-picker. */
|
|
28
|
+
inputClass: { type: String, default: "fanum" },
|
|
23
29
|
pickerOptions: { type: Object, default: () => ({}) }
|
|
24
30
|
},
|
|
25
|
-
setup(e, { emit:
|
|
26
|
-
const a =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
31
|
+
setup(e, { emit: t, expose: n }) {
|
|
32
|
+
const a = S(e, t), o = a.inputId, i = s(!1), r = s("en");
|
|
33
|
+
b(() => {
|
|
34
|
+
r.value = B(), i.value = !0;
|
|
35
|
+
});
|
|
36
|
+
const l = M(() => e.locale === "auto" ? r.value : e.locale);
|
|
37
|
+
return V(
|
|
30
38
|
() => a.model.value,
|
|
31
|
-
(
|
|
32
|
-
),
|
|
39
|
+
(u, m) => t("change", u, m)
|
|
40
|
+
), n({ clear: () => a.model.value = null }), { ...a, inputID: o, ready: i, resolvedLocale: l, showCalendar: L };
|
|
33
41
|
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
});
|
|
43
|
+
let L = s(!1);
|
|
44
|
+
const Z = { class: "form-control form-adorn form-persian-datepicker form-adorn-end" }, j = ["id", "name", "placeholder", "disabled"];
|
|
45
|
+
function H(e, t, n, a, o, i) {
|
|
46
|
+
const r = C("Vue3PersianDatetimePicker");
|
|
47
|
+
return p(), h("div", null, [
|
|
48
|
+
d("label", Z, [
|
|
49
|
+
d("span", {
|
|
50
|
+
onClick: t[0] || (t[0] = (l) => e.showCalendar = !0),
|
|
51
|
+
class: "form-adorn-icon",
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
}, t[4] || (t[4] = [
|
|
54
|
+
w('<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 22H10C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 17.7712 2 14V12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12V14C22 17.7712 22 19.6569 20.8284 20.8284C20.1752 21.4816 19.3001 21.7706 18 21.8985" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M7 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M17 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M21.5 9H16.625H10.75M2 9H5.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"></path><path d="M18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17Z" fill="#1C274C"></path><path d="M18 13C18 13.5523 17.5523 14 17 14C16.4477 14 16 13.5523 16 13C16 12.4477 16.4477 12 17 12C17.5523 12 18 12.4477 18 13Z" fill="#1C274C"></path><path d="M13 17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17C11 16.4477 11.4477 16 12 16C12.5523 16 13 16.4477 13 17Z" fill="#1C274C"></path><path d="M13 13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13C11 12.4477 11.4477 12 12 12C12.5523 12 13 12.4477 13 13Z" fill="#1C274C"></path><path d="M8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16C7.55228 16 8 16.4477 8 17Z" fill="#1C274C"></path><path d="M8 13C8 13.5523 7.55228 14 7 14C6.44772 14 6 13.5523 6 13C6 12.4477 6.44772 12 7 12C7.55228 12 8 12.4477 8 13Z" fill="#1C274C"></path></svg>', 1)
|
|
55
|
+
])),
|
|
56
|
+
d("input", {
|
|
57
|
+
id: e.inputID,
|
|
58
|
+
type: "text",
|
|
59
|
+
autocomplete: "off",
|
|
60
|
+
name: e.name,
|
|
61
|
+
class: k([e.inputClass, "form-ghost", { "is-invalid": e.isInvalid }]),
|
|
62
|
+
placeholder: e.placeholder,
|
|
63
|
+
disabled: e.isDisabled || e.readonly
|
|
64
|
+
}, null, 10, j)
|
|
65
|
+
]),
|
|
66
|
+
e.ready ? (p(), c(r, v({
|
|
67
|
+
key: 0,
|
|
68
|
+
modelValue: e.model,
|
|
69
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => e.model = l),
|
|
70
|
+
"custom-input": "#" + e.inputID,
|
|
71
|
+
type: e.calendar,
|
|
72
|
+
view: e.view,
|
|
73
|
+
min: e.min,
|
|
74
|
+
max: e.max,
|
|
75
|
+
show: e.showCalendar,
|
|
76
|
+
range: e.range,
|
|
77
|
+
locale: e.resolvedLocale,
|
|
78
|
+
format: e.format,
|
|
79
|
+
"input-format": e.inputFormat || e.format,
|
|
80
|
+
disabled: e.isDisabled || e.readonly,
|
|
81
|
+
editable: e.editable,
|
|
82
|
+
simple: e.simple,
|
|
83
|
+
jumpminute: "15",
|
|
84
|
+
roundminute: !0,
|
|
85
|
+
"show-now-btn": !0,
|
|
86
|
+
"auto-submit": !0
|
|
87
|
+
}, e.pickerOptions, {
|
|
88
|
+
onOpen: t[2] || (t[2] = (l) => e.$emit("open")),
|
|
89
|
+
onClose: t[3] || (t[3] = () => {
|
|
90
|
+
e.showCalendar = !1, e.$emit("close");
|
|
91
|
+
})
|
|
92
|
+
}), null, 16, ["modelValue", "custom-input", "type", "view", "min", "max", "show", "range", "locale", "format", "input-format", "disabled", "editable", "simple"])) : g("", !0)
|
|
93
|
+
]);
|
|
69
94
|
}
|
|
70
|
-
const
|
|
95
|
+
const Y = /* @__PURE__ */ D(I, [["render", H]]);
|
|
71
96
|
export {
|
|
72
|
-
|
|
97
|
+
Y as PersianDatePickerInput
|
|
73
98
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-field.is-invalid{border-color:var(--danger-border)}.voice-recorder-box audio,.voice-recorder-results audio{vertical-align:middle}.voice-recorder-box{display:block;background-color:var(--bg-1);border-radius:var(--border-radius);border:2px dashed var(--border-color)}
|
|
1
|
+
.form-persian-datepicker .form-adorn-icon{pointer-events:auto!important;cursor:pointer!important}.form-field.is-invalid{border-color:var(--danger-border)}.voice-recorder-box audio,.voice-recorder-results audio{vertical-align:middle}.voice-recorder-box{display:block;background-color:var(--bg-1);border-radius:var(--border-radius);border:2px dashed var(--border-color)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inertia-bootstrap-forms",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "Bootstrap 6 form components for Vue 3 + Inertia.js (Laravel). Every field is bound to a single FormContainer v-model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -1,80 +1,134 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defineAsyncComponent, defineComponent, onMounted, ref, watch
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const Vue3PersianDatetimePicker = defineAsyncComponent(() => import('vue3-persian-datetime-picker'));
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import {computed, defineAsyncComponent, defineComponent, onMounted, ref, watch} from 'vue';
|
|
3
|
+
import {fieldProps, useField} from './composables/useField.js';
|
|
4
|
+
|
|
5
|
+
const Vue3PersianDatetimePicker = defineAsyncComponent(() => import('vue3-persian-datetime-picker'));
|
|
6
|
+
|
|
7
|
+
/** Detects Persian from the page (lang / dir) or the browser language. Client-only. */
|
|
8
|
+
function detectLocale() {
|
|
9
|
+
if (typeof document === 'undefined') return 'en';
|
|
10
|
+
|
|
11
|
+
const html = document.documentElement;
|
|
12
|
+
const lang = (html.getAttribute('lang') || '').toLowerCase();
|
|
13
|
+
const dir = (html.getAttribute('dir') || document.body?.getAttribute('dir') || '').toLowerCase();
|
|
14
|
+
if (lang) return lang.startsWith('fa') ? 'fa' : dir === 'rtl' && !lang ? 'fa' : 'en';
|
|
15
|
+
if (dir === 'rtl') return 'fa';
|
|
16
|
+
|
|
17
|
+
const nav = (typeof navigator !== 'undefined' && navigator.language) || '';
|
|
18
|
+
return nav.toLowerCase().startsWith('fa') ? 'fa' : 'en';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
name: 'PersianDatePickerInput',
|
|
23
|
+
components: {Vue3PersianDatetimePicker},
|
|
24
|
+
emits: ['update:modelValue', 'change', 'open', 'close'],
|
|
25
|
+
props: {
|
|
26
|
+
...fieldProps,
|
|
27
|
+
calendar: {type: String, default: 'date'},
|
|
28
|
+
view: {type: String, default: 'date'},
|
|
29
|
+
min: {type: String, default: null},
|
|
30
|
+
max: {type: String, default: null},
|
|
31
|
+
range: {type: Boolean, default: false},
|
|
32
|
+
/** 'auto' | 'fa' | 'en' */
|
|
33
|
+
locale: {type: String, default: 'auto'},
|
|
34
|
+
format: {type: String, default: 'jYYYY/jMM/jDD'},
|
|
35
|
+
inputFormat: {type: String, default: null},
|
|
36
|
+
editable: {type: Boolean, default: false},
|
|
37
|
+
simple: {type: Boolean, default: false},
|
|
38
|
+
placeholder: {type: String, default: null},
|
|
39
|
+
inputClass: {type: String, default: 'fanum'},
|
|
40
|
+
pickerOptions: {type: Object, default: () => ({})},
|
|
41
|
+
},
|
|
42
|
+
setup(props, {emit, expose}) {
|
|
43
|
+
const field = useField(props, emit);
|
|
44
|
+
const inputID = field.inputId;
|
|
45
|
+
const ready = ref(false);
|
|
46
|
+
const detected = ref('en'); // identical on server and client until mounted
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
detected.value = detectLocale();
|
|
50
|
+
ready.value = true; // the picker needs the DOM, so it is never rendered during SSR
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const resolvedLocale = computed(() => (props.locale === 'auto' ? detected.value : props.locale));
|
|
54
|
+
|
|
55
|
+
watch(
|
|
56
|
+
() => field.model.value,
|
|
57
|
+
(now, before) => emit('change', now, before)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expose({clear: () => (field.model.value = null)});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
return {...field, inputID, ready, resolvedLocale, showCalendar};
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
let showCalendar = ref(false);
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<div>
|
|
72
|
+
<label class="form-control form-adorn form-persian-datepicker form-adorn-end">
|
|
73
|
+
<span @click="showCalendar = true" class="form-adorn-icon" aria-hidden="true">
|
|
74
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
75
|
+
<path
|
|
76
|
+
d="M14 22H10C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 17.7712 2 14V12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12V14C22 17.7712 22 19.6569 20.8284 20.8284C20.1752 21.4816 19.3001 21.7706 18 21.8985"
|
|
77
|
+
stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
|
|
78
|
+
<path d="M7 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
|
|
79
|
+
<path d="M17 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
|
|
80
|
+
<path d="M21.5 9H16.625H10.75M2 9H5.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
|
|
81
|
+
<path d="M18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17Z" fill="#1C274C"/>
|
|
82
|
+
<path d="M18 13C18 13.5523 17.5523 14 17 14C16.4477 14 16 13.5523 16 13C16 12.4477 16.4477 12 17 12C17.5523 12 18 12.4477 18 13Z" fill="#1C274C"/>
|
|
83
|
+
<path d="M13 17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17C11 16.4477 11.4477 16 12 16C12.5523 16 13 16.4477 13 17Z" fill="#1C274C"/>
|
|
84
|
+
<path d="M13 13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13C11 12.4477 11.4477 12 12 12C12.5523 12 13 12.4477 13 13Z" fill="#1C274C"/>
|
|
85
|
+
<path d="M8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16C7.55228 16 8 16.4477 8 17Z" fill="#1C274C"/>
|
|
86
|
+
<path d="M8 13C8 13.5523 7.55228 14 7 14C6.44772 14 6 13.5523 6 13C6 12.4477 6.44772 12 7 12C7.55228 12 8 12.4477 8 13Z" fill="#1C274C"/>
|
|
87
|
+
</svg>
|
|
88
|
+
</span>
|
|
89
|
+
<input
|
|
90
|
+
:id="inputID"
|
|
91
|
+
type="text"
|
|
92
|
+
autocomplete="off"
|
|
93
|
+
:name="name"
|
|
94
|
+
:class="[inputClass, 'form-ghost', { 'is-invalid': isInvalid }]"
|
|
95
|
+
:placeholder="placeholder"
|
|
96
|
+
:disabled="isDisabled || readonly"
|
|
97
|
+
/>
|
|
98
|
+
</label>
|
|
99
|
+
<Vue3PersianDatetimePicker
|
|
100
|
+
v-if="ready"
|
|
101
|
+
v-model="model"
|
|
102
|
+
:custom-input="'#' + inputID"
|
|
103
|
+
:type="calendar"
|
|
104
|
+
:view="view"
|
|
105
|
+
:min="min"
|
|
106
|
+
:max="max"
|
|
107
|
+
:show="showCalendar"
|
|
108
|
+
:range="range"
|
|
109
|
+
:locale="resolvedLocale"
|
|
110
|
+
:format="format"
|
|
111
|
+
:input-format="inputFormat || format"
|
|
112
|
+
:disabled="isDisabled || readonly"
|
|
113
|
+
:editable="editable"
|
|
114
|
+
:simple="simple"
|
|
115
|
+
jumpminute="15"
|
|
116
|
+
:roundminute="true"
|
|
117
|
+
:show-now-btn="true"
|
|
118
|
+
:auto-submit="true"
|
|
119
|
+
v-bind="pickerOptions"
|
|
120
|
+
@open="$emit('open')"
|
|
121
|
+
@close="() => {
|
|
122
|
+
showCalendar = false
|
|
123
|
+
$emit('close')
|
|
124
|
+
}"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
<style>
|
|
129
|
+
.form-persian-datepicker .form-adorn-icon {
|
|
130
|
+
pointer-events: auto !important;
|
|
131
|
+
cursor: pointer !important;
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as PersianDatePickerInput } from '../PersianDatePickerInput.vue';
|
|
1
|
+
export { default as PersianDatePickerInput } from '../PersianDatePickerInput.vue';
|
package/types/persian-date.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FieldComponent, Locale } from '../index.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const DatePickerInput: FieldComponent<{ calendar?: string; view?: string; min?: string | null; max?: string | null; range?: boolean; locale?: string; format?: string; inputFormat?: string | null; placeholder?: string | null; inputClass?: string; pickerOptions?: object }>;
|