@kashi-ui/elements 0.25.0 → 1.0.0
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.md +11 -1
- package/dist/appointment.d.ts +40 -0
- package/dist/appointment.js +175 -0
- package/dist/base.d.ts +408 -0
- package/dist/base.js +31 -0
- package/dist/basic.d.ts +43 -0
- package/dist/basic.js +222 -0
- package/dist/calendar.js +21 -20
- package/dist/cdn/appointment-CrIZi8Bp.js +1 -0
- package/dist/cdn/base-DTQ50VdG.js +1 -0
- package/dist/cdn/basic-CrEW2RKF.js +1 -0
- package/dist/cdn/calendar-CYRrdGIf.js +16 -0
- package/dist/cdn/charts-D6KM26Vp.js +1 -0
- package/dist/cdn/combobox-6EFI2qqN.js +1 -0
- package/dist/cdn/controls-BwebEIlf.js +1 -0
- package/dist/cdn/display-DFuMkcj5.js +1 -0
- package/dist/cdn/fields-DhLIhHQ8.js +1 -0
- package/dist/cdn/forms-BHivKDdC.js +1 -0
- package/dist/cdn/holidays-DgbIAdlt.js +1 -0
- package/dist/cdn/inputs-R7nEHfbV.js +1 -0
- package/dist/cdn/kashi-elements.js +1 -1
- package/dist/cdn/map-H3xiZd8Y.js +12 -0
- package/dist/cdn/{menu-DhrqyLgy.js → menu-BAUSubXk.js} +1 -1
- package/dist/cdn/nav-NK-v48B5.js +1 -0
- package/dist/cdn/overlay-CBv8grz3.js +1 -0
- package/dist/cdn/pickers-BHzNt_X8.js +1 -0
- package/dist/cdn/table-Bt9WVLoo.js +1 -0
- package/dist/cdn/text-D4a_hlwL.js +1 -0
- package/dist/cdn/time-DJ3p1wvd.js +1 -0
- package/dist/cdn/words-BdADG_9U.js +1 -0
- package/dist/cdn.d.ts +1 -0
- package/dist/cdn.js +4 -0
- package/dist/charts.js +27 -24
- package/dist/combobox.d.ts +6 -5
- package/dist/combobox.js +29 -20
- package/dist/controls.js +15 -15
- package/dist/display.js +17 -14
- package/dist/fields.js +3 -3
- package/dist/forms.d.ts +3 -3
- package/dist/forms.js +54 -47
- package/dist/index.d.ts +12 -2
- package/dist/index.js +7 -1
- package/dist/inputs.d.ts +3 -3
- package/dist/inputs.js +31 -30
- package/dist/map.js +16 -13
- package/dist/nav.js +18 -16
- package/dist/overlay.js +5 -5
- package/dist/pickers.d.ts +1 -1
- package/dist/pickers.js +39 -38
- package/dist/table.js +7 -7
- package/dist/toast.js +3 -3
- package/package.json +4 -4
- package/dist/cdn/base-Cmq7zeIG.js +0 -1
- package/dist/cdn/calendar-Dm3fq2bs.js +0 -16
- package/dist/cdn/charts-DNOWi4sJ.js +0 -1
- package/dist/cdn/combobox-ZGrZ5okg.js +0 -1
- package/dist/cdn/controls-K-OZcjg4.js +0 -1
- package/dist/cdn/digits-DE1YGT94.js +0 -1
- package/dist/cdn/display-C975tS7j.js +0 -1
- package/dist/cdn/fields-BUTaSN8m.js +0 -1
- package/dist/cdn/forms-C-effPKn.js +0 -1
- package/dist/cdn/inputs-BjOddAM7.js +0 -1
- package/dist/cdn/jalali-BiM5Kfep.js +0 -1
- package/dist/cdn/map-BHuusa4t.js +0 -12
- package/dist/cdn/nav-D_w5BV_K.js +0 -1
- package/dist/cdn/overlay-DX9un2xm.js +0 -1
- package/dist/cdn/pickers-BFLpUruK.js +0 -1
- package/dist/cdn/table-DPQfDMs-.js +0 -1
- package/dist/cdn/text-D1U32D6K.js +0 -1
- package/dist/cdn/words-9OdzG7y6.js +0 -1
package/README.md
CHANGED
|
@@ -26,11 +26,21 @@ import "@kashi-ui/css";
|
|
|
26
26
|
import "@kashi-ui/elements";
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## زبان انگلیسی
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { setLocale } from "@kashi-ui/elements";
|
|
33
|
+
setLocale("en"); // پیش از ساخته شدن عنصرها
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
راهنما: https://kashi.sepantapouya.com/docs/i18n/
|
|
37
|
+
|
|
29
38
|
## عنصرها
|
|
30
39
|
|
|
31
40
|
- **فیلدهای فارسی:** `kashi-national-id`، `kashi-legal-id`، `kashi-mobile`، `kashi-landline`، `kashi-card-number`، `kashi-iban`، `kashi-postal-code`، `kashi-price`
|
|
41
|
+
- **فیلد متنی و اطلاعیه:** `kashi-input` (پاک کردن، نمایش رمز، شمارنده)، `kashi-textarea`، `kashi-banner` (با دکمهٔ بستن)
|
|
32
42
|
- **فیلدهای دیگر:** `kashi-time-input`، `kashi-plate-input`، `kashi-persian-textarea`، `kashi-keyboard-fix`، `kashi-password-strength`، `kashi-inline-edit`
|
|
33
|
-
- **انتخاب:** `kashi-date-picker`، `kashi-calendar`، `kashi-date-range-picker`، `kashi-month-picker`، `kashi-otp`، `kashi-combobox`، `kashi-multi-select`، `kashi-province-select`، `kashi-city-select`، `kashi-tag-input`، `kashi-chip-group`، `kashi-number-input`، `kashi-slider`، `kashi-rating`، `kashi-color-picker`، `kashi-file-upload`
|
|
43
|
+
- **انتخاب:** `kashi-date-picker`، `kashi-calendar`، `kashi-date-range-picker`، `kashi-month-picker`، `kashi-appointment-picker`، `kashi-otp`، `kashi-combobox`، `kashi-multi-select`، `kashi-province-select`، `kashi-city-select`، `kashi-tag-input`، `kashi-chip-group`، `kashi-number-input`، `kashi-slider`، `kashi-rating`، `kashi-color-picker`، `kashi-file-upload`
|
|
34
44
|
- **نشانی و نقشه:** `kashi-address-form`، `kashi-iran-map`
|
|
35
45
|
- **داده و نمودار:** `kashi-data-table`، `kashi-pagination`، `kashi-bar-chart`، `kashi-line-chart`، `kashi-pie-chart`، `kashi-bar-list`، `kashi-proportion-bar`، `kashi-sparkline`، `kashi-activity-heatmap`
|
|
36
46
|
- **نمایش:** `kashi-money`، `kashi-date`، `kashi-relative-time`، `kashi-countdown`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HTMLBase } from "./base.js";
|
|
2
|
+
export interface AppointmentSlot {
|
|
3
|
+
time: string;
|
|
4
|
+
available?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* انتخاب نوبت: روزهای شمسی در یک ردیف (با تعداد نوبت خالی) و ساعتهای همان روز در گروههای صبح، بعدازظهر و عصر.
|
|
8
|
+
* ساعت کاری با from، to و step؛ نوبتهای پر با booked (JSON) یا همهٔ ساعتها با element.getSlots.
|
|
9
|
+
* با name دو فیلد name_date (YYYY-MM-DD) و name_time در فرم ارسال میشوند.
|
|
10
|
+
*/
|
|
11
|
+
export declare class KashiAppointmentPicker extends HTMLBase {
|
|
12
|
+
static observedAttributes: string[];
|
|
13
|
+
/** ساعتهای هر روز بهطور کامل: (date) => ["09:00", { time: "09:30", available: false }] */
|
|
14
|
+
getSlots?: (date: Date) => (string | AppointmentSlot)[];
|
|
15
|
+
/** روزهای تعطیل دلخواه؛ پیشفرض جمعهها و تعطیلات رسمی ثابت */
|
|
16
|
+
isClosed?: (date: Date) => boolean;
|
|
17
|
+
private selected;
|
|
18
|
+
private active;
|
|
19
|
+
private valueSet;
|
|
20
|
+
private rendered;
|
|
21
|
+
private timer;
|
|
22
|
+
private key;
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
attributeChangedCallback(name: string, old: string | null, next: string | null): void;
|
|
26
|
+
/** «2026-11-04 10:30» */
|
|
27
|
+
private parse;
|
|
28
|
+
/** نوبت انتخابشده: { date, time } */
|
|
29
|
+
get value(): {
|
|
30
|
+
date: Date;
|
|
31
|
+
time: string;
|
|
32
|
+
} | null;
|
|
33
|
+
set value(v: {
|
|
34
|
+
date: Date;
|
|
35
|
+
time: string;
|
|
36
|
+
} | null);
|
|
37
|
+
private list;
|
|
38
|
+
private render;
|
|
39
|
+
private roving;
|
|
40
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { formatJalali, formatTime, fromISODate, getIranHoliday, parseTime, toFaDigits, toISODate, toJalali } from "@kashi-ui/persian";
|
|
2
|
+
import { calendarNames, define, digitsOf, emit, esc, HTMLBase, lang, msg, uid } from "./base.js";
|
|
3
|
+
const PERIODS = [["morning", 12], ["afternoon", 17], ["evening", 24]];
|
|
4
|
+
const day = (d, add = 0) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + add);
|
|
5
|
+
const same = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
6
|
+
const minutes = (t) => {
|
|
7
|
+
const p = parseTime(t);
|
|
8
|
+
return p ? p.hours * 60 + p.minutes : 0;
|
|
9
|
+
};
|
|
10
|
+
const CLOCK = '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10" cy="10" r="7"/><path d="M10 6v4l2.5 2"/></svg>';
|
|
11
|
+
/**
|
|
12
|
+
* انتخاب نوبت: روزهای شمسی در یک ردیف (با تعداد نوبت خالی) و ساعتهای همان روز در گروههای صبح، بعدازظهر و عصر.
|
|
13
|
+
* ساعت کاری با from، to و step؛ نوبتهای پر با booked (JSON) یا همهٔ ساعتها با element.getSlots.
|
|
14
|
+
* با name دو فیلد name_date (YYYY-MM-DD) و name_time در فرم ارسال میشوند.
|
|
15
|
+
*/
|
|
16
|
+
export class KashiAppointmentPicker extends HTMLBase {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.selected = null;
|
|
20
|
+
this.active = -1;
|
|
21
|
+
this.valueSet = false;
|
|
22
|
+
this.rendered = false;
|
|
23
|
+
this.key = uid("kashi-appt");
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
if (!this.rendered && !this.valueSet)
|
|
27
|
+
this.selected = this.parse(this.getAttribute("value"));
|
|
28
|
+
this.render();
|
|
29
|
+
// ساعتهای گذشتهٔ امروز هر دقیقه پر میشوند
|
|
30
|
+
clearInterval(this.timer);
|
|
31
|
+
this.timer = setInterval(() => !this.contains(document.activeElement) && this.render(), 60000);
|
|
32
|
+
}
|
|
33
|
+
disconnectedCallback() {
|
|
34
|
+
clearInterval(this.timer);
|
|
35
|
+
}
|
|
36
|
+
attributeChangedCallback(name, old, next) {
|
|
37
|
+
if (!this.rendered || old === next)
|
|
38
|
+
return;
|
|
39
|
+
if (name === "value")
|
|
40
|
+
this.selected = this.parse(next);
|
|
41
|
+
this.render();
|
|
42
|
+
}
|
|
43
|
+
/** «2026-11-04 10:30» */
|
|
44
|
+
parse(v) {
|
|
45
|
+
const m = (v ?? "").trim().match(/^(\d{4}-\d{2}-\d{2})[ T](\d{1,2}:\d{2})$/);
|
|
46
|
+
const d = m ? fromISODate(m[1]) : null;
|
|
47
|
+
return d && m ? { date: d, time: formatTime(parseTime(m[2])) } : null;
|
|
48
|
+
}
|
|
49
|
+
/** نوبت انتخابشده: { date, time } */
|
|
50
|
+
get value() {
|
|
51
|
+
return this.selected ? { ...this.selected } : null;
|
|
52
|
+
}
|
|
53
|
+
set value(v) {
|
|
54
|
+
this.valueSet = true;
|
|
55
|
+
this.selected = v ? { date: day(v.date), time: v.time } : null;
|
|
56
|
+
if (this.rendered)
|
|
57
|
+
this.render();
|
|
58
|
+
}
|
|
59
|
+
list() {
|
|
60
|
+
const now = new Date();
|
|
61
|
+
const start = fromISODate(this.getAttribute("start") ?? "") ?? now;
|
|
62
|
+
const count = Math.max(1, Number(this.getAttribute("days")) || 7);
|
|
63
|
+
let booked = {};
|
|
64
|
+
try {
|
|
65
|
+
booked = JSON.parse(this.getAttribute("booked") ?? "{}");
|
|
66
|
+
}
|
|
67
|
+
catch { /* قالب نادرست نادیده گرفته میشود */ }
|
|
68
|
+
const from = this.getAttribute("from") ?? "09:00", to = this.getAttribute("to") ?? "17:00";
|
|
69
|
+
const step = Number(this.getAttribute("step")) || 30;
|
|
70
|
+
const closedAttr = this.getAttribute("closed") !== "false";
|
|
71
|
+
return Array.from({ length: count }, (_, i) => {
|
|
72
|
+
const d = day(start, i);
|
|
73
|
+
const closed = this.isClosed ? this.isClosed(d) : closedAttr && !!getIranHoliday(d, { locale: lang() });
|
|
74
|
+
let slots = [];
|
|
75
|
+
if (!closed) {
|
|
76
|
+
if (this.getSlots)
|
|
77
|
+
slots = this.getSlots(d).map((s) => (typeof s === "string" ? { time: s, available: true } : { time: s.time, available: s.available ?? true }));
|
|
78
|
+
else {
|
|
79
|
+
const taken = new Set(booked[toISODate(d)] ?? []);
|
|
80
|
+
for (let m = minutes(from); m + step <= minutes(to); m += step) {
|
|
81
|
+
const time = formatTime({ hours: Math.floor(m / 60), minutes: m % 60 });
|
|
82
|
+
slots.push({ time, available: !taken.has(time) });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (same(d, now)) {
|
|
86
|
+
const nm = now.getHours() * 60 + now.getMinutes();
|
|
87
|
+
slots = slots.map((s) => (minutes(s.time) <= nm ? { ...s, available: false } : s));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return { date: d, closed, slots, free: slots.filter((s) => s.available).length };
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
render(focus = null) {
|
|
94
|
+
const now = new Date();
|
|
95
|
+
const fa = digitsOf(this) === "fa";
|
|
96
|
+
const n = (v) => (fa ? toFaDigits(String(v)) : String(v));
|
|
97
|
+
const digits = fa ? "fa" : "latin";
|
|
98
|
+
const list = this.list();
|
|
99
|
+
if (this.active < 0 || this.active >= list.length) {
|
|
100
|
+
const i = this.selected ? list.findIndex((x) => same(x.date, this.selected.date)) : -1;
|
|
101
|
+
this.active = i >= 0 ? i : Math.max(0, list.findIndex((x) => x.free > 0));
|
|
102
|
+
}
|
|
103
|
+
const cur = list[this.active];
|
|
104
|
+
const M = msg(), A = M.appointment, { months, weekdays } = calendarNames(), locale = lang();
|
|
105
|
+
const label = this.getAttribute("label") ?? A.label;
|
|
106
|
+
const wd = (d) => (same(d, now) ? M.common.today : same(d, day(now, 1)) ? M.common.tomorrow : weekdays[(d.getDay() + 1) % 7]);
|
|
107
|
+
const daysHtml = list.map((x, i) => {
|
|
108
|
+
const { jm, jd } = toJalali(x.date);
|
|
109
|
+
const status = x.closed ? A.closed : x.free ? A.freeLong(n(x.free)) : A.none;
|
|
110
|
+
return `<button type="button" role="radio" data-i="${i}" class="k-appt__day" aria-checked="${i === this.active}" tabindex="${i === this.active ? 0 : -1}"${x.closed ? " disabled" : ""} aria-label="${esc(`${formatJalali(x.date, { style: "full", digits, locale })}${M.common.list}${status}`)}"><span class="k-appt__weekday" aria-hidden="true">${wd(x.date)}</span><span class="k-appt__date" aria-hidden="true">${n(jd)}</span><span class="k-appt__month" aria-hidden="true">${months[jm - 1]}</span><span class="k-appt__free" aria-hidden="true">${x.closed ? A.closed : x.free ? A.free(n(x.free)) : A.full}</span></button>`;
|
|
111
|
+
}).join("");
|
|
112
|
+
const selDay = !!this.selected && same(this.selected.date, cur.date);
|
|
113
|
+
const focusTime = selDay ? this.selected.time : cur.slots.find((s) => s.available)?.time;
|
|
114
|
+
const slotsHtml = cur.closed || !cur.free
|
|
115
|
+
? `<p class="k-appt__empty">${cur.closed ? A.closedDay : A.noSlots}</p>`
|
|
116
|
+
: PERIODS.map(([title, until], k) => {
|
|
117
|
+
const slots = cur.slots.filter((s) => minutes(s.time) / 60 < until && minutes(s.time) / 60 >= (k ? PERIODS[k - 1][1] : 0));
|
|
118
|
+
if (!slots.length)
|
|
119
|
+
return "";
|
|
120
|
+
const gid = `${this.key}-p${k}`;
|
|
121
|
+
return `<div class="k-appt__group"><p class="k-appt__period" id="${gid}">${A[title]}</p><div class="k-appt__times" role="radiogroup" aria-labelledby="${gid}">${slots.map((s) => `<button type="button" role="radio" class="k-appt__time" data-time="${s.time}" aria-checked="${selDay && this.selected.time === s.time}" tabindex="${s.time === focusTime ? 0 : -1}"${s.available ? "" : " disabled"} aria-label="${esc(A.time(n(s.time)))}${s.available ? "" : esc(A.booked)}">${n(s.time)}</button>`).join("")}</div></div>`;
|
|
122
|
+
}).join("");
|
|
123
|
+
const name = this.getAttribute("name");
|
|
124
|
+
const sel = this.selected;
|
|
125
|
+
this.innerHTML = `<div class="k-appt" role="group" aria-labelledby="${this.key}-label"><p class="k-label" id="${this.key}-label" style="margin: 0">${esc(label)}</p><div class="k-appt__days" role="radiogroup" aria-label="${esc(A.day)}">${daysHtml}</div><div class="k-appt__slots">${slotsHtml}</div><p class="k-appt__summary" aria-live="polite">${sel ? `${CLOCK}<span>${esc(A.yours)} <strong>${esc(A.at(formatJalali(sel.date, { style: "full", digits, locale }), n(sel.time)))}</strong></span>` : ""}</p>${name ? `<input type="hidden" name="${esc(`${name}_date`)}" value="${sel ? toISODate(sel.date) : ""}"><input type="hidden" name="${esc(`${name}_time`)}" value="${sel?.time ?? ""}">` : ""}</div>`;
|
|
126
|
+
this.rendered = true;
|
|
127
|
+
const days = this.querySelector(".k-appt__days");
|
|
128
|
+
const times = this.querySelector(".k-appt__slots");
|
|
129
|
+
days.addEventListener("click", (e) => {
|
|
130
|
+
const b = e.target.closest(".k-appt__day");
|
|
131
|
+
if (!b || b.disabled)
|
|
132
|
+
return;
|
|
133
|
+
this.active = Number(b.dataset.i);
|
|
134
|
+
this.render("day");
|
|
135
|
+
});
|
|
136
|
+
times.addEventListener("click", (e) => {
|
|
137
|
+
const b = e.target.closest(".k-appt__time");
|
|
138
|
+
if (!b || b.disabled)
|
|
139
|
+
return;
|
|
140
|
+
this.selected = { date: cur.date, time: b.dataset.time };
|
|
141
|
+
this.render("time");
|
|
142
|
+
emit(this, "kashi-change", { date: toISODate(cur.date), time: this.selected.time, value: this.value });
|
|
143
|
+
});
|
|
144
|
+
days.addEventListener("keydown", (e) => this.roving(e, days, (b) => {
|
|
145
|
+
this.active = Number(b.dataset.i);
|
|
146
|
+
this.render("day");
|
|
147
|
+
}));
|
|
148
|
+
times.addEventListener("keydown", (e) => this.roving(e, times));
|
|
149
|
+
if (focus === "day")
|
|
150
|
+
days.querySelector('[tabindex="0"]')?.focus();
|
|
151
|
+
if (focus === "time")
|
|
152
|
+
times.querySelector('[aria-checked="true"]')?.focus();
|
|
153
|
+
if (focus === "day")
|
|
154
|
+
days.querySelector('[tabindex="0"]')?.scrollIntoView?.({ block: "nearest", inline: "nearest" });
|
|
155
|
+
}
|
|
156
|
+
// فوکوس گردشی؛ در RTL فلش چپ یعنی بعدی
|
|
157
|
+
roving(e, box, onMove) {
|
|
158
|
+
const items = [...box.querySelectorAll('[role="radio"]:not(:disabled)')];
|
|
159
|
+
const i = items.indexOf(document.activeElement);
|
|
160
|
+
if (i < 0)
|
|
161
|
+
return;
|
|
162
|
+
const rtl = getComputedStyle(box).direction === "rtl";
|
|
163
|
+
const step = { ArrowLeft: rtl ? 1 : -1, ArrowRight: rtl ? -1 : 1, ArrowDown: 1, ArrowUp: -1 }[e.key];
|
|
164
|
+
const to = step ? (i + step + items.length) % items.length : e.key === "Home" ? 0 : e.key === "End" ? items.length - 1 : -1;
|
|
165
|
+
if (to < 0)
|
|
166
|
+
return;
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
if (onMove)
|
|
169
|
+
onMove(items[to]);
|
|
170
|
+
else
|
|
171
|
+
items[to].focus();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
KashiAppointmentPicker.observedAttributes = ["start", "days", "from", "to", "step", "booked", "closed", "label", "name", "digits", "value"];
|
|
175
|
+
define("kashi-appointment-picker", KashiAppointmentPicker, "block");
|
package/dist/base.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KashiLocale, type KashiMessagesInput } from "@kashi-ui/persian";
|
|
1
2
|
/** در Node.js (رندر سمت سرور) HTMLElement وجود ندارد؛ import کردن پکیج نباید خطا بدهد */
|
|
2
3
|
export declare const HTMLBase: typeof HTMLElement;
|
|
3
4
|
/** ثبت عنصر، فقط در مرورگر و فقط یک بار (اگر پکیج دو بار بارگذاری شود خطا نمیدهد) */
|
|
@@ -7,6 +8,412 @@ export declare function define(tag: string, ctor: CustomElementConstructor, disp
|
|
|
7
8
|
* اگر اسکریپت بدون type="module" در <head> باشد، عنصر پیش از فرزندانش به صفحه وصل میشود.
|
|
8
9
|
*/
|
|
9
10
|
export declare function afterParse(cb: () => void): void;
|
|
11
|
+
type Digits = "fa" | "latin";
|
|
12
|
+
/**
|
|
13
|
+
* زبان متنهای داخلی همهٔ عنصرها: setLocale("en") برچسب دکمهها، متن صفحهخوان، پیامهای خطا، نام ماهها و ارقام را انگلیسی میکند.
|
|
14
|
+
* پیش از ساخته شدن عنصرها صدا بزنید (بالای صفحه، بعد از import). با messages هر متنی را عوض کنید.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setLocale(locale: KashiLocale, { messages, digits }?: {
|
|
17
|
+
messages?: KashiMessagesInput;
|
|
18
|
+
digits?: Digits;
|
|
19
|
+
}): void;
|
|
20
|
+
/** ارقام پیشفرض زبان فعلی */
|
|
21
|
+
export declare const localeDigits: () => Digits;
|
|
22
|
+
/** فرهنگ متنهای فعلی */
|
|
23
|
+
export declare const msg: () => {
|
|
24
|
+
common: {
|
|
25
|
+
close: string;
|
|
26
|
+
loading: string;
|
|
27
|
+
optional: string;
|
|
28
|
+
remove: (item: string) => string;
|
|
29
|
+
removeShort: string;
|
|
30
|
+
clear: string;
|
|
31
|
+
clearAll: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
confirm: string;
|
|
34
|
+
save: string;
|
|
35
|
+
edit: string;
|
|
36
|
+
prev: string;
|
|
37
|
+
next: string;
|
|
38
|
+
today: string;
|
|
39
|
+
tomorrow: string;
|
|
40
|
+
noResults: string;
|
|
41
|
+
searching: string;
|
|
42
|
+
results: (n: string) => string;
|
|
43
|
+
added: (item: string) => string;
|
|
44
|
+
removed: (item: string) => string;
|
|
45
|
+
selected: (item: string) => string;
|
|
46
|
+
max: (n: string) => string;
|
|
47
|
+
total: string;
|
|
48
|
+
other: string;
|
|
49
|
+
of: (a: string, b: string) => string;
|
|
50
|
+
and: string;
|
|
51
|
+
list: string;
|
|
52
|
+
range: string;
|
|
53
|
+
percent: (n: string) => string;
|
|
54
|
+
decimal: string;
|
|
55
|
+
};
|
|
56
|
+
money: {
|
|
57
|
+
toman: string;
|
|
58
|
+
rial: string;
|
|
59
|
+
positive: string;
|
|
60
|
+
};
|
|
61
|
+
alert: {
|
|
62
|
+
close: string;
|
|
63
|
+
};
|
|
64
|
+
banner: {
|
|
65
|
+
label: string;
|
|
66
|
+
close: string;
|
|
67
|
+
};
|
|
68
|
+
avatar: {
|
|
69
|
+
online: string;
|
|
70
|
+
offline: string;
|
|
71
|
+
busy: string;
|
|
72
|
+
away: string;
|
|
73
|
+
more: (n: string) => string;
|
|
74
|
+
};
|
|
75
|
+
bankCard: {
|
|
76
|
+
card: string;
|
|
77
|
+
cardOf: (bank: string) => string;
|
|
78
|
+
bank: string;
|
|
79
|
+
endingIn: (last4: string) => string;
|
|
80
|
+
expiry: string;
|
|
81
|
+
};
|
|
82
|
+
breadcrumb: {
|
|
83
|
+
label: string;
|
|
84
|
+
expand: string;
|
|
85
|
+
};
|
|
86
|
+
calendar: {
|
|
87
|
+
label: string;
|
|
88
|
+
prevMonth: string;
|
|
89
|
+
nextMonth: string;
|
|
90
|
+
month: string;
|
|
91
|
+
year: string;
|
|
92
|
+
holiday: string;
|
|
93
|
+
};
|
|
94
|
+
carousel: {
|
|
95
|
+
slider: string;
|
|
96
|
+
slide: string;
|
|
97
|
+
slideOf: (n: string, total: string) => string;
|
|
98
|
+
slides: (label: string) => string;
|
|
99
|
+
};
|
|
100
|
+
chart: {
|
|
101
|
+
period: string;
|
|
102
|
+
value: string;
|
|
103
|
+
share: string;
|
|
104
|
+
count: string;
|
|
105
|
+
keyboard: (title: string) => string;
|
|
106
|
+
thousand: string;
|
|
107
|
+
million: string;
|
|
108
|
+
billion: string;
|
|
109
|
+
};
|
|
110
|
+
city: {
|
|
111
|
+
label: string;
|
|
112
|
+
outside: string;
|
|
113
|
+
custom: string;
|
|
114
|
+
search: string;
|
|
115
|
+
hint: string;
|
|
116
|
+
};
|
|
117
|
+
province: {
|
|
118
|
+
label: string;
|
|
119
|
+
search: string;
|
|
120
|
+
capital: (c: string) => string;
|
|
121
|
+
};
|
|
122
|
+
colorPicker: {
|
|
123
|
+
label: string;
|
|
124
|
+
custom: string;
|
|
125
|
+
area: string;
|
|
126
|
+
areaValue: (s: string, v: string) => string;
|
|
127
|
+
eyedropper: string;
|
|
128
|
+
hue: string;
|
|
129
|
+
degrees: (n: string) => string;
|
|
130
|
+
red: string;
|
|
131
|
+
green: string;
|
|
132
|
+
blue: string;
|
|
133
|
+
invalid: string;
|
|
134
|
+
swatches: string;
|
|
135
|
+
sample: string;
|
|
136
|
+
contrast: (ink: "white" | "black", ratio: string, pass: boolean) => string;
|
|
137
|
+
names: {
|
|
138
|
+
firoozeh: string;
|
|
139
|
+
lajvard: string;
|
|
140
|
+
violet: string;
|
|
141
|
+
anar: string;
|
|
142
|
+
zafaran: string;
|
|
143
|
+
peste: string;
|
|
144
|
+
shab: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
combobox: {
|
|
148
|
+
toggle: string;
|
|
149
|
+
more: (n: string) => string;
|
|
150
|
+
};
|
|
151
|
+
otp: {
|
|
152
|
+
label: string;
|
|
153
|
+
};
|
|
154
|
+
command: {
|
|
155
|
+
placeholder: string;
|
|
156
|
+
empty: string;
|
|
157
|
+
title: string;
|
|
158
|
+
navigate: string;
|
|
159
|
+
select: string;
|
|
160
|
+
};
|
|
161
|
+
contextMenu: {
|
|
162
|
+
label: string;
|
|
163
|
+
hint: string;
|
|
164
|
+
};
|
|
165
|
+
copy: {
|
|
166
|
+
copy: string;
|
|
167
|
+
copied: string;
|
|
168
|
+
failed: string;
|
|
169
|
+
};
|
|
170
|
+
countdown: {
|
|
171
|
+
days: string;
|
|
172
|
+
hours: string;
|
|
173
|
+
minutes: string;
|
|
174
|
+
seconds: string;
|
|
175
|
+
left: string;
|
|
176
|
+
};
|
|
177
|
+
table: {
|
|
178
|
+
selectAll: string;
|
|
179
|
+
selectRow: string;
|
|
180
|
+
selectNamed: (row: string) => string;
|
|
181
|
+
empty: string;
|
|
182
|
+
sort: (col: string) => string;
|
|
183
|
+
search: string;
|
|
184
|
+
rows: (n: string) => string;
|
|
185
|
+
};
|
|
186
|
+
datePicker: {
|
|
187
|
+
label: string;
|
|
188
|
+
invalid: string;
|
|
189
|
+
open: string;
|
|
190
|
+
};
|
|
191
|
+
dateRange: {
|
|
192
|
+
label: string;
|
|
193
|
+
placeholder: string;
|
|
194
|
+
presets: string;
|
|
195
|
+
pickEnd: string;
|
|
196
|
+
last7: (n: string) => string;
|
|
197
|
+
last30: (n: string) => string;
|
|
198
|
+
thisMonth: string;
|
|
199
|
+
lastMonth: string;
|
|
200
|
+
};
|
|
201
|
+
monthPicker: {
|
|
202
|
+
label: string;
|
|
203
|
+
prevYear: string;
|
|
204
|
+
nextYear: string;
|
|
205
|
+
};
|
|
206
|
+
fileUpload: {
|
|
207
|
+
units: string[];
|
|
208
|
+
browse: string;
|
|
209
|
+
drop: string;
|
|
210
|
+
tooBig: (max: string) => string;
|
|
211
|
+
wrongType: string;
|
|
212
|
+
tooMany: (n: string) => string;
|
|
213
|
+
done: string;
|
|
214
|
+
uploading: string;
|
|
215
|
+
uploadingFile: (name: string) => string;
|
|
216
|
+
error: string;
|
|
217
|
+
};
|
|
218
|
+
input: {
|
|
219
|
+
clear: string;
|
|
220
|
+
show: string;
|
|
221
|
+
hide: string;
|
|
222
|
+
checking: string;
|
|
223
|
+
};
|
|
224
|
+
invalid: {
|
|
225
|
+
card: string;
|
|
226
|
+
iban: string;
|
|
227
|
+
nationalId: string;
|
|
228
|
+
legalId: string;
|
|
229
|
+
mobile: string;
|
|
230
|
+
landline: string;
|
|
231
|
+
postal: string;
|
|
232
|
+
plate: string;
|
|
233
|
+
time: string;
|
|
234
|
+
timeRange: (a: string, b: string) => string;
|
|
235
|
+
priceMin: (n: string) => string;
|
|
236
|
+
priceMax: (n: string) => string;
|
|
237
|
+
priceRange: (a: string, b: string) => string;
|
|
238
|
+
};
|
|
239
|
+
inlineEdit: {
|
|
240
|
+
empty: string;
|
|
241
|
+
failed: string;
|
|
242
|
+
};
|
|
243
|
+
iranMap: {
|
|
244
|
+
label: string;
|
|
245
|
+
tableNote: string;
|
|
246
|
+
onMap: (label: string) => string;
|
|
247
|
+
};
|
|
248
|
+
keyboardFix: {
|
|
249
|
+
before: string;
|
|
250
|
+
after: string;
|
|
251
|
+
};
|
|
252
|
+
meter: {
|
|
253
|
+
ok: string;
|
|
254
|
+
warning: string;
|
|
255
|
+
critical: string;
|
|
256
|
+
};
|
|
257
|
+
multiSelect: {
|
|
258
|
+
label: string;
|
|
259
|
+
selected: (n: string) => string;
|
|
260
|
+
clearedAll: string;
|
|
261
|
+
};
|
|
262
|
+
numberInput: {
|
|
263
|
+
label: string;
|
|
264
|
+
increment: string;
|
|
265
|
+
decrement: string;
|
|
266
|
+
};
|
|
267
|
+
pagination: {
|
|
268
|
+
nav: string;
|
|
269
|
+
page: (n: string) => string;
|
|
270
|
+
perPage: string;
|
|
271
|
+
jump: string;
|
|
272
|
+
jumpRange: (jump: string, a: string, b: string) => string;
|
|
273
|
+
};
|
|
274
|
+
password: {
|
|
275
|
+
title: string;
|
|
276
|
+
strength: (level: string) => string;
|
|
277
|
+
levels: string[];
|
|
278
|
+
persian: string;
|
|
279
|
+
length: (n: string) => string;
|
|
280
|
+
cases: string;
|
|
281
|
+
digit: string;
|
|
282
|
+
symbol: string;
|
|
283
|
+
met: string;
|
|
284
|
+
unmet: string;
|
|
285
|
+
};
|
|
286
|
+
receipt: {
|
|
287
|
+
success: string;
|
|
288
|
+
failed: string;
|
|
289
|
+
pending: string;
|
|
290
|
+
merchant: string;
|
|
291
|
+
tracking: string;
|
|
292
|
+
copyTracking: string;
|
|
293
|
+
reference: string;
|
|
294
|
+
card: string;
|
|
295
|
+
date: string;
|
|
296
|
+
at: (time: string) => string;
|
|
297
|
+
};
|
|
298
|
+
persianInput: {
|
|
299
|
+
text: string;
|
|
300
|
+
"national-id": string;
|
|
301
|
+
"legal-id": string;
|
|
302
|
+
mobile: string;
|
|
303
|
+
landline: string;
|
|
304
|
+
card: string;
|
|
305
|
+
iban: string;
|
|
306
|
+
price: string;
|
|
307
|
+
postal: string;
|
|
308
|
+
time: string;
|
|
309
|
+
plate: string;
|
|
310
|
+
};
|
|
311
|
+
textFix: {
|
|
312
|
+
fix: string;
|
|
313
|
+
clean: string;
|
|
314
|
+
count: (n: string, summary: string) => string;
|
|
315
|
+
arabic: string;
|
|
316
|
+
zwnj: string;
|
|
317
|
+
punctuation: string;
|
|
318
|
+
digits: string;
|
|
319
|
+
spacing: string;
|
|
320
|
+
};
|
|
321
|
+
plate: {
|
|
322
|
+
label: string;
|
|
323
|
+
first: string;
|
|
324
|
+
letter: string;
|
|
325
|
+
middle: string;
|
|
326
|
+
region: string;
|
|
327
|
+
iran: string;
|
|
328
|
+
};
|
|
329
|
+
rating: {
|
|
330
|
+
label: string;
|
|
331
|
+
};
|
|
332
|
+
sideNav: {
|
|
333
|
+
label: string;
|
|
334
|
+
};
|
|
335
|
+
slider: {
|
|
336
|
+
from: string;
|
|
337
|
+
to: string;
|
|
338
|
+
};
|
|
339
|
+
splitter: {
|
|
340
|
+
label: string;
|
|
341
|
+
};
|
|
342
|
+
stat: {
|
|
343
|
+
up: string;
|
|
344
|
+
down: string;
|
|
345
|
+
flat: string;
|
|
346
|
+
};
|
|
347
|
+
stepper: {
|
|
348
|
+
label: string;
|
|
349
|
+
complete: string;
|
|
350
|
+
current: string;
|
|
351
|
+
};
|
|
352
|
+
tagInput: {
|
|
353
|
+
label: string;
|
|
354
|
+
duplicate: string;
|
|
355
|
+
};
|
|
356
|
+
toast: {
|
|
357
|
+
region: string;
|
|
358
|
+
close: string;
|
|
359
|
+
};
|
|
360
|
+
tour: {
|
|
361
|
+
done: string;
|
|
362
|
+
skip: string;
|
|
363
|
+
step: (n: string, total: string) => string;
|
|
364
|
+
};
|
|
365
|
+
heatmap: {
|
|
366
|
+
unit: string;
|
|
367
|
+
weekdays: string[];
|
|
368
|
+
inYear: (unit: string, year: string) => string;
|
|
369
|
+
total: (n: string, unit: string, year: string) => string;
|
|
370
|
+
less: string;
|
|
371
|
+
more: string;
|
|
372
|
+
byMonth: (name: string) => string;
|
|
373
|
+
};
|
|
374
|
+
appointment: {
|
|
375
|
+
label: string;
|
|
376
|
+
day: string;
|
|
377
|
+
morning: string;
|
|
378
|
+
afternoon: string;
|
|
379
|
+
evening: string;
|
|
380
|
+
closed: string;
|
|
381
|
+
full: string;
|
|
382
|
+
free: (n: string) => string;
|
|
383
|
+
freeLong: (n: string) => string;
|
|
384
|
+
none: string;
|
|
385
|
+
closedDay: string;
|
|
386
|
+
noSlots: string;
|
|
387
|
+
time: (t: string) => string;
|
|
388
|
+
booked: string;
|
|
389
|
+
yours: string;
|
|
390
|
+
at: (date: string, time: string) => string;
|
|
391
|
+
};
|
|
392
|
+
address: {
|
|
393
|
+
legend: string;
|
|
394
|
+
province: string;
|
|
395
|
+
city: string;
|
|
396
|
+
street: string;
|
|
397
|
+
plaque: string;
|
|
398
|
+
unit: string;
|
|
399
|
+
postalCode: string;
|
|
400
|
+
provinceSearch: string;
|
|
401
|
+
streetHint: string;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
/** زبان فعلی */
|
|
405
|
+
export declare const lang: () => KashiLocale;
|
|
406
|
+
/** ارقام عنصر: ویژگی digits، وگرنه پیشفرض زبان */
|
|
407
|
+
export declare const digitsOf: (el: Element) => Digits;
|
|
408
|
+
/** عدد با ارقام همان عنصر */
|
|
409
|
+
export declare const num: (el: Element, v: number | string) => string;
|
|
410
|
+
/** نام ماهها و روزهای شمسی به زبان فعلی */
|
|
411
|
+
export declare const calendarNames: () => {
|
|
412
|
+
months: readonly ["Farvardin", "Ordibehesht", "Khordad", "Tir", "Mordad", "Shahrivar", "Mehr", "Aban", "Azar", "Dey", "Bahman", "Esfand"] | readonly ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"];
|
|
413
|
+
weekdays: readonly ["Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] | readonly ["شنبه", "یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", "پنجشنبه", "جمعه"];
|
|
414
|
+
weekdaysShort: readonly ["Sa", "Su", "Mo", "Tu", "We", "Th", "Fr"] | readonly ["ش", "ی", "د", "س", "چ", "پ", "ج"];
|
|
415
|
+
friday: string;
|
|
416
|
+
};
|
|
10
417
|
/** شناسهٔ یکتا برای اتصال برچسب، راهنما و خطا */
|
|
11
418
|
export declare const uid: (prefix: string) => string;
|
|
12
419
|
/** متن امن برای قرار دادن در HTML */
|
|
@@ -45,3 +452,4 @@ export declare function fieldHTML({ id, label, required, optional, control }: Fi
|
|
|
45
452
|
export declare function setMessages(field: Element, control: HTMLElement, id: string, error: string | null, hint: string | null, extra?: string | null): void;
|
|
46
453
|
/** فیلد پنهان برای ارسال مقدار خام در فرم HTML معمولی */
|
|
47
454
|
export declare function syncHidden(host: Element, name: string | null, value: string): void;
|
|
455
|
+
export {};
|