@kashi-ui/elements 2.22.0 → 2.23.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 +6 -1
- package/dist/base.js +4 -0
- package/dist/buttons.d.ts +82 -0
- package/dist/buttons.js +487 -0
- package/dist/cards.d.ts +30 -0
- package/dist/cards.js +183 -0
- package/dist/cdn/{appointment-wMGBoHw9.js → appointment-DOXBUwIU.js} +1 -1
- package/dist/cdn/{base-Dg1Mb8Jk.js → base-D4tCOysh.js} +1 -1
- package/dist/cdn/{basic-B5ZxgagA.js → basic-DuY4RslZ.js} +1 -1
- package/dist/cdn/buttons-zhSdiaXr.js +1 -0
- package/dist/cdn/calendar-BulPeVAJ.js +16 -0
- package/dist/cdn/card-BKiwJF34.js +1 -0
- package/dist/cdn/cards-DKarXHsC.js +1 -0
- package/dist/cdn/charts-ETYOAJyB.js +1 -0
- package/dist/cdn/chat-D5ZIMnNp.js +4 -0
- package/dist/cdn/choice-DBvC2Puo.js +1 -0
- package/dist/cdn/{combobox-CBT7yp94.js → combobox-BGuPAAt3.js} +1 -1
- package/dist/cdn/{commerce-CsyixnVK.js → commerce-SzWdpWJG.js} +1 -1
- package/dist/cdn/content-BgfBfy8j.js +1 -0
- package/dist/cdn/controls--OMZkJYe.js +1 -0
- package/dist/cdn/display-BfYWAjNu.js +1 -0
- package/dist/cdn/{fields-Cx84-qz1.js → fields-B-jTUQiI.js} +1 -1
- package/dist/cdn/forms-DgRiYmdV.js +1 -0
- package/dist/cdn/{holidays-DO82gXhM.js → holidays-Cu6IfbTL.js} +1 -1
- package/dist/cdn/hours-CeiVqPKD.js +1 -0
- package/dist/cdn/inputs-BkJ70Xkc.js +1 -0
- package/dist/cdn/kashi-elements.js +1 -1
- package/dist/cdn/legal-id-Mt8FX0fV.js +1 -0
- package/dist/cdn/{map-DlpA916P.js → map-TfSt3CjL.js} +2 -2
- package/dist/cdn/media-BRBINvzU.js +1 -0
- package/dist/cdn/{menu-CqTvk8Ok.js → menu-DTNVFXrb.js} +1 -1
- package/dist/cdn/money-CjGI2VIQ.js +1 -0
- package/dist/cdn/{nav-BHv7H1Fy.js → nav-CT5RVOzy.js} +1 -1
- package/dist/cdn/{overlay-BIEEJ4Sh.js → overlay-DC5-I6hM.js} +1 -1
- package/dist/cdn/parts-5fVaWtRe.js +1 -0
- package/dist/cdn/pickers-BwDRsDRo.js +1 -0
- package/dist/cdn/relative-OC1fV3Xh.js +1 -0
- package/dist/cdn/rich-text-CS6xEim6.js +1 -0
- package/dist/cdn/sheets-eVMx4d-5.js +1 -0
- package/dist/cdn/{table-B5XwDDS9.js → table-tgB4iwcM.js} +1 -1
- package/dist/cdn/{text-Bml-pVjo.js → text-C6fzEBBh.js} +1 -1
- package/dist/cdn/{time-DrXgFeQy.js → time-CkqqUKJv.js} +1 -1
- package/dist/cdn/{time-BQsTSvql.js → time-CwOYrtK-.js} +1 -1
- package/dist/cdn/validate-Dr2f6i6s.js +1 -0
- package/dist/cdn/work-DoNAKgVU.js +1 -0
- package/dist/cdn.js +11 -0
- package/dist/chat.d.ts +127 -0
- package/dist/chat.js +734 -0
- package/dist/choice.d.ts +98 -0
- package/dist/choice.js +597 -0
- package/dist/content.d.ts +164 -0
- package/dist/content.js +726 -0
- package/dist/hours.d.ts +29 -0
- package/dist/hours.js +179 -0
- package/dist/index.d.ts +64 -2
- package/dist/index.js +22 -1
- package/dist/manifest.json +843 -1
- package/dist/media.d.ts +51 -0
- package/dist/media.js +363 -0
- package/dist/parts.d.ts +31 -0
- package/dist/parts.js +114 -0
- package/dist/qr.d.ts +7 -0
- package/dist/qr.js +271 -0
- package/dist/rich-text.d.ts +40 -0
- package/dist/rich-text.js +375 -0
- package/dist/sheets.d.ts +128 -0
- package/dist/sheets.js +661 -0
- package/dist/validate.d.ts +40 -0
- package/dist/validate.js +224 -0
- package/dist/work.d.ts +117 -0
- package/dist/work.js +895 -0
- package/package.json +4 -4
- package/dist/cdn/calendar-Cjp5Rqer.js +0 -16
- package/dist/cdn/charts-DvQ4OwdS.js +0 -1
- package/dist/cdn/controls-B-s4IF_4.js +0 -1
- package/dist/cdn/display-MorJMDEF.js +0 -1
- package/dist/cdn/forms-CQeP9iiW.js +0 -1
- package/dist/cdn/inputs-Bqcs9Xy7.js +0 -1
- package/dist/cdn/pickers-BT9VPT4o.js +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HTMLBase } from "./base.js";
|
|
2
|
+
type Values = Record<string, unknown>;
|
|
3
|
+
/** قاعده: مقدار و همهٔ مقدارها را میگیرد و اگر درست نبود پیام خطا برمیگرداند */
|
|
4
|
+
export type FormRule = (value: unknown, values: Values, arg?: string) => string | null;
|
|
5
|
+
/** قاعدههای آماده؛ با data-rules="required nationalId minLength:3 match:password" روی هر فیلد */
|
|
6
|
+
export declare const RULES: Record<string, FormRule>;
|
|
7
|
+
/**
|
|
8
|
+
* اعتبارسنجی فرم با پیامهای فارسی (و انگلیسی با setLocale): یک <form> داخلش بگذارید و روی هر فیلد data-rules بنویسید،
|
|
9
|
+
* مثل data-rules="required nationalId" یا "required minLength:8" یا "match:password"؛ data-message پیام دلخواه است.
|
|
10
|
+
* هنگام ارسال، خلاصهٔ خطاها بالای فرم میآید و اولین فیلد نادرست فوکوس میگیرد؛ خطاها مستقیم در ویژگی error فیلدهای کاشی مینشینند.
|
|
11
|
+
* فرم درست kashi-submit (قابل لغو، detail.values) میفرستد و بعد مثل همیشه ارسال میشود.
|
|
12
|
+
*/
|
|
13
|
+
export declare class KashiForm extends HTMLBase {
|
|
14
|
+
static observedAttributes: string[];
|
|
15
|
+
private form;
|
|
16
|
+
private errors;
|
|
17
|
+
private submitted;
|
|
18
|
+
private extra;
|
|
19
|
+
private descriptions;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
/** قاعدهٔ دلخواه: form.addRule("username", (v) => v === "admin" ? "این نام گرفته شده" : null) */
|
|
22
|
+
addRule(name: string, rule: FormRule): void;
|
|
23
|
+
/** مقدار همهٔ فیلدهای دارای name */
|
|
24
|
+
get values(): Values;
|
|
25
|
+
/** همهٔ فیلدها را بررسی میکند؛ true یعنی بدون خطا */
|
|
26
|
+
validate(): boolean;
|
|
27
|
+
/** خطای دلخواه، مثلاً از سرور؛ undefined پاکش میکند */
|
|
28
|
+
setError(name: string, message?: string): void;
|
|
29
|
+
/** پاک کردن خطاها و خلاصه */
|
|
30
|
+
clear(): void;
|
|
31
|
+
private get fields();
|
|
32
|
+
private fieldOf;
|
|
33
|
+
private valueOf;
|
|
34
|
+
private run;
|
|
35
|
+
private check;
|
|
36
|
+
private show;
|
|
37
|
+
private paintSummary;
|
|
38
|
+
private onSubmit;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
package/dist/validate.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// اعتبارسنجی فرم با پیامهای فارسی؛ همتای useForm در React برای HTML ساده.
|
|
2
|
+
import { isValidCardNumber, isValidIban, isValidLandline, isValidLegalId, isValidMobile, isValidNationalId, isValidPostalCode, toEnDigits, } from "@kashi-ui/persian";
|
|
3
|
+
import { afterParse, define, esc, HTMLBase, ICONS, msg, num } from "./base.js";
|
|
4
|
+
const isEmpty = (v) => v === undefined || v === null || v === "" || v === false || (Array.isArray(v) && v.length === 0);
|
|
5
|
+
const str = (v) => toEnDigits(String(v ?? "")).trim();
|
|
6
|
+
const len = (v) => [...String(v ?? "")].length;
|
|
7
|
+
const check = (ok, message) => (v, values, arg) => (isEmpty(v) || ok(v, values, arg) ? null : message(arg));
|
|
8
|
+
const n = (a) => num(document.documentElement, Number(a) || 0);
|
|
9
|
+
/** قاعدههای آماده؛ با data-rules="required nationalId minLength:3 match:password" روی هر فیلد */
|
|
10
|
+
export const RULES = {
|
|
11
|
+
required: (v) => (isEmpty(typeof v === "string" ? v.trim() : v) ? msg().form.required : null),
|
|
12
|
+
minLength: check((v, _, a) => len(v) >= Number(a), (a) => msg().form.minLength(n(a))),
|
|
13
|
+
maxLength: check((v, _, a) => len(v) <= Number(a), (a) => msg().form.maxLength(n(a))),
|
|
14
|
+
min: check((v, _, a) => Number(str(v)) >= Number(a), (a) => msg().form.min(n(a))),
|
|
15
|
+
max: check((v, _, a) => Number(str(v)) <= Number(a), (a) => msg().form.max(n(a))),
|
|
16
|
+
pattern: check((v, _, a) => new RegExp(`^(?:${a})$`).test(String(v)), () => msg().form.pattern),
|
|
17
|
+
email: check((v) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(str(v)), () => msg().form.email),
|
|
18
|
+
nationalId: check((v) => isValidNationalId(str(v)), () => msg().invalid.nationalId),
|
|
19
|
+
legalId: check((v) => isValidLegalId(str(v)), () => msg().invalid.legalId),
|
|
20
|
+
mobile: check((v) => isValidMobile(str(v)), () => msg().invalid.mobile),
|
|
21
|
+
landline: check((v) => isValidLandline(str(v)), () => msg().invalid.landline),
|
|
22
|
+
card: check((v) => isValidCardNumber(str(v)), () => msg().invalid.card),
|
|
23
|
+
iban: check((v) => isValidIban(str(v)), () => msg().invalid.iban),
|
|
24
|
+
postalCode: check((v) => isValidPostalCode(str(v)), () => msg().invalid.postal),
|
|
25
|
+
match: check((v, values, a) => v === values[a ?? ""], () => msg().form.match),
|
|
26
|
+
};
|
|
27
|
+
/** کنترلهایی که ویژگی error دارند */
|
|
28
|
+
const HAS_ERROR = /^KASHI-(?!CHECKBOX$|SWITCH$)/;
|
|
29
|
+
const isCheck = (el) => el.tagName === "KASHI-CHECKBOX" || el.tagName === "KASHI-SWITCH" || (el instanceof HTMLInputElement && (el.type === "checkbox" || el.type === "radio"));
|
|
30
|
+
/**
|
|
31
|
+
* اعتبارسنجی فرم با پیامهای فارسی (و انگلیسی با setLocale): یک <form> داخلش بگذارید و روی هر فیلد data-rules بنویسید،
|
|
32
|
+
* مثل data-rules="required nationalId" یا "required minLength:8" یا "match:password"؛ data-message پیام دلخواه است.
|
|
33
|
+
* هنگام ارسال، خلاصهٔ خطاها بالای فرم میآید و اولین فیلد نادرست فوکوس میگیرد؛ خطاها مستقیم در ویژگی error فیلدهای کاشی مینشینند.
|
|
34
|
+
* فرم درست kashi-submit (قابل لغو، detail.values) میفرستد و بعد مثل همیشه ارسال میشود.
|
|
35
|
+
*/
|
|
36
|
+
export class KashiForm extends HTMLBase {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.form = null;
|
|
40
|
+
this.errors = new Map();
|
|
41
|
+
this.submitted = 0;
|
|
42
|
+
this.extra = {};
|
|
43
|
+
this.descriptions = new WeakMap();
|
|
44
|
+
this.onSubmit = (e) => {
|
|
45
|
+
this.submitted++;
|
|
46
|
+
if (!this.validate()) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopImmediatePropagation();
|
|
49
|
+
const first = this.fields.find((f) => this.errors.has(f));
|
|
50
|
+
first?.focus();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const ev = new CustomEvent("kashi-submit", { bubbles: true, cancelable: true, detail: { values: this.values, form: this.form } });
|
|
54
|
+
if (!this.dispatchEvent(ev))
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
connectedCallback() {
|
|
59
|
+
afterParse(() => {
|
|
60
|
+
if (!this.isConnected || this.form)
|
|
61
|
+
return;
|
|
62
|
+
this.form = this.querySelector("form");
|
|
63
|
+
if (!this.form) {
|
|
64
|
+
this.form = document.createElement("form");
|
|
65
|
+
this.form.append(...this.childNodes);
|
|
66
|
+
this.append(this.form);
|
|
67
|
+
}
|
|
68
|
+
this.form.noValidate = true;
|
|
69
|
+
this.form.addEventListener("submit", this.onSubmit);
|
|
70
|
+
this.form.addEventListener("reset", () => setTimeout(() => this.clear(), 0));
|
|
71
|
+
this.form.addEventListener("focusout", (e) => {
|
|
72
|
+
const f = this.fieldOf(e.target);
|
|
73
|
+
if (!f || f.contains(e.relatedTarget))
|
|
74
|
+
return;
|
|
75
|
+
if ((this.getAttribute("validate-on") ?? "blur") === "blur")
|
|
76
|
+
this.check(f);
|
|
77
|
+
});
|
|
78
|
+
const onChange = (e) => {
|
|
79
|
+
const f = this.fieldOf(e.target);
|
|
80
|
+
if (!f)
|
|
81
|
+
return;
|
|
82
|
+
const mode = this.getAttribute("validate-on") ?? "blur";
|
|
83
|
+
if (mode === "change" || this.errors.has(f) || (this.submitted > 0 && mode !== "submit"))
|
|
84
|
+
this.check(f);
|
|
85
|
+
};
|
|
86
|
+
this.form.addEventListener("input", onChange);
|
|
87
|
+
this.form.addEventListener("change", onChange);
|
|
88
|
+
this.form.addEventListener("kashi-change", onChange);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** قاعدهٔ دلخواه: form.addRule("username", (v) => v === "admin" ? "این نام گرفته شده" : null) */
|
|
92
|
+
addRule(name, rule) {
|
|
93
|
+
this.extra[name] = rule;
|
|
94
|
+
}
|
|
95
|
+
/** مقدار همهٔ فیلدهای دارای name */
|
|
96
|
+
get values() {
|
|
97
|
+
const out = {};
|
|
98
|
+
if (!this.form)
|
|
99
|
+
return out;
|
|
100
|
+
for (const [k, v] of new FormData(this.form))
|
|
101
|
+
out[k] = out[k] === undefined ? v : [].concat(out[k], v);
|
|
102
|
+
for (const f of this.fields) {
|
|
103
|
+
const name = f.getAttribute("name");
|
|
104
|
+
if (name)
|
|
105
|
+
out[name] = this.valueOf(f);
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
/** همهٔ فیلدها را بررسی میکند؛ true یعنی بدون خطا */
|
|
110
|
+
validate() {
|
|
111
|
+
for (const f of this.fields)
|
|
112
|
+
this.check(f);
|
|
113
|
+
this.paintSummary();
|
|
114
|
+
return this.errors.size === 0;
|
|
115
|
+
}
|
|
116
|
+
/** خطای دلخواه، مثلاً از سرور؛ undefined پاکش میکند */
|
|
117
|
+
setError(name, message) {
|
|
118
|
+
const f = this.fields.find((x) => x.getAttribute("name") === name);
|
|
119
|
+
if (f)
|
|
120
|
+
this.show(f, message ?? null);
|
|
121
|
+
this.paintSummary();
|
|
122
|
+
}
|
|
123
|
+
/** پاک کردن خطاها و خلاصه */
|
|
124
|
+
clear() {
|
|
125
|
+
for (const f of [...this.errors.keys()])
|
|
126
|
+
this.show(f, null);
|
|
127
|
+
this.submitted = 0;
|
|
128
|
+
this.paintSummary();
|
|
129
|
+
}
|
|
130
|
+
get fields() {
|
|
131
|
+
return this.form ? [...this.form.querySelectorAll("[data-rules]")] : [];
|
|
132
|
+
}
|
|
133
|
+
fieldOf(el) {
|
|
134
|
+
return el?.closest("[data-rules]") ?? null;
|
|
135
|
+
}
|
|
136
|
+
valueOf(f) {
|
|
137
|
+
if (isCheck(f))
|
|
138
|
+
return f.checked;
|
|
139
|
+
const v = f.value;
|
|
140
|
+
if (v !== undefined)
|
|
141
|
+
return v;
|
|
142
|
+
return f.querySelector("input, select, textarea")?.value ?? "";
|
|
143
|
+
}
|
|
144
|
+
run(f, values) {
|
|
145
|
+
const name = f.getAttribute("name") ?? "";
|
|
146
|
+
for (const token of (f.dataset.rules ?? "").split(/\s+/).filter(Boolean)) {
|
|
147
|
+
const i = token.indexOf(":");
|
|
148
|
+
const key = i < 0 ? token : token.slice(0, i);
|
|
149
|
+
const arg = i < 0 ? undefined : token.slice(i + 1);
|
|
150
|
+
const rule = RULES[key];
|
|
151
|
+
const m = rule ? rule(this.valueOf(f), values, arg) : null;
|
|
152
|
+
if (m)
|
|
153
|
+
return f.dataset.message ?? m;
|
|
154
|
+
}
|
|
155
|
+
return this.extra[name]?.(this.valueOf(f), values) ?? null;
|
|
156
|
+
}
|
|
157
|
+
check(f) {
|
|
158
|
+
this.show(f, this.run(f, this.values));
|
|
159
|
+
if (this.submitted)
|
|
160
|
+
this.paintSummary();
|
|
161
|
+
}
|
|
162
|
+
show(f, error) {
|
|
163
|
+
if (error)
|
|
164
|
+
this.errors.set(f, error);
|
|
165
|
+
else
|
|
166
|
+
this.errors.delete(f);
|
|
167
|
+
if (HAS_ERROR.test(f.tagName)) {
|
|
168
|
+
if (error)
|
|
169
|
+
f.setAttribute("error", error);
|
|
170
|
+
else
|
|
171
|
+
f.removeAttribute("error");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (f.tagName === "KASHI-CHECKBOX" || f.tagName === "KASHI-SWITCH") {
|
|
175
|
+
// چکباکس ویژگی error ندارد: حالت invalid و متن خطا در description، مثل React
|
|
176
|
+
if (!this.descriptions.has(f))
|
|
177
|
+
this.descriptions.set(f, f.getAttribute("description"));
|
|
178
|
+
f.toggleAttribute("invalid", !!error);
|
|
179
|
+
const orig = this.descriptions.get(f);
|
|
180
|
+
if (error)
|
|
181
|
+
f.setAttribute("description", error);
|
|
182
|
+
else if (orig)
|
|
183
|
+
f.setAttribute("description", orig);
|
|
184
|
+
else
|
|
185
|
+
f.removeAttribute("description");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// input بومی: aria-invalid و یک خط خطا بعد از فیلد
|
|
189
|
+
const id = `${f.id || (f.id = `kashi-f-${Math.random().toString(36).slice(2, 8)}`)}-error`;
|
|
190
|
+
const next = f.nextElementSibling;
|
|
191
|
+
const hint = next?.id === id ? next : null;
|
|
192
|
+
if (error) {
|
|
193
|
+
f.setAttribute("aria-invalid", "true");
|
|
194
|
+
f.setAttribute("aria-describedby", id);
|
|
195
|
+
if (hint)
|
|
196
|
+
hint.textContent = error;
|
|
197
|
+
else
|
|
198
|
+
f.insertAdjacentHTML("afterend", `<p class="k-hint k-hint--error" id="${id}">${esc(error)}</p>`);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
f.removeAttribute("aria-invalid");
|
|
202
|
+
if (f.getAttribute("aria-describedby") === id)
|
|
203
|
+
f.removeAttribute("aria-describedby");
|
|
204
|
+
hint?.remove();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
paintSummary() {
|
|
208
|
+
if (!this.form)
|
|
209
|
+
return;
|
|
210
|
+
let box = this.form.querySelector(":scope > [data-kashi-summary]");
|
|
211
|
+
const count = this.errors.size;
|
|
212
|
+
if (this.getAttribute("summary") === "false" || !this.submitted || !count) {
|
|
213
|
+
box?.remove();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (!box) {
|
|
217
|
+
this.form.insertAdjacentHTML("afterbegin", `<div class="k-alert k-alert--error" role="alert" data-tone="error" data-kashi-summary><span class="k-alert__icon" aria-hidden="true">${ICONS.error}</span><div class="k-alert__content"><p class="k-alert__title"></p></div></div>`);
|
|
218
|
+
box = this.form.querySelector(":scope > [data-kashi-summary]");
|
|
219
|
+
}
|
|
220
|
+
box.querySelector(".k-alert__title").textContent = msg().form.summary(num(this, count));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
KashiForm.observedAttributes = ["validate-on", "summary"];
|
|
224
|
+
define("kashi-form", KashiForm, "block");
|
package/dist/work.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { HTMLBase } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* فهرست کشیدنی: هر فرزند یک مورد است (data-id شناسه، data-label نام برای صفحهخوان). با ماوس و لمس از دستگیره بکشید،
|
|
4
|
+
* یا با کیبورد: فاصله برداشتن، کلیدهای جهت و Home/End حرکت، فاصلهٔ دوباره رها کردن و Escape لغو.
|
|
5
|
+
* پس از رها کردن kashi-change با detail.value (شناسهها به ترتیب تازه).
|
|
6
|
+
*/
|
|
7
|
+
export declare class KashiSortable extends HTMLBase {
|
|
8
|
+
static observedAttributes: string[];
|
|
9
|
+
private list;
|
|
10
|
+
private live;
|
|
11
|
+
private active;
|
|
12
|
+
private mode;
|
|
13
|
+
private saved;
|
|
14
|
+
private drag;
|
|
15
|
+
private pending;
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
attributeChangedCallback(): void;
|
|
18
|
+
private get items();
|
|
19
|
+
/** شناسهها به ترتیب فعلی */
|
|
20
|
+
get value(): string[];
|
|
21
|
+
set value(ids: string[]);
|
|
22
|
+
private label;
|
|
23
|
+
private build;
|
|
24
|
+
private update;
|
|
25
|
+
private say;
|
|
26
|
+
private start;
|
|
27
|
+
private finish;
|
|
28
|
+
private moveTo;
|
|
29
|
+
private onKey;
|
|
30
|
+
private onDown;
|
|
31
|
+
private onMove;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* تابلوی کانبان: هر فرزند <section data-column="شناسه" data-title="عنوان"> یک ستون است (data-limit سقف کارت، data-color رنگ نشانگر)
|
|
35
|
+
* و فرزندان آن کارتها (data-id، data-label). کارتها را بین ستونها بکشید یا با کیبورد: فاصله برداشتن، بالا و پایین در ستون،
|
|
36
|
+
* چپ و راست بین ستونها، فاصله رها کردن و Escape لغو. kashi-change با detail.value ({ ستون: [شناسهها] }). addable دکمهٔ افزودن (kashi-add).
|
|
37
|
+
*/
|
|
38
|
+
export declare class KashiKanban extends HTMLBase {
|
|
39
|
+
static observedAttributes: string[];
|
|
40
|
+
private root;
|
|
41
|
+
private live;
|
|
42
|
+
private active;
|
|
43
|
+
private mode;
|
|
44
|
+
private saved;
|
|
45
|
+
private drag;
|
|
46
|
+
private refocusing;
|
|
47
|
+
private key;
|
|
48
|
+
connectedCallback(): void;
|
|
49
|
+
disconnectedCallback(): void;
|
|
50
|
+
attributeChangedCallback(): void;
|
|
51
|
+
private get cols();
|
|
52
|
+
private cards;
|
|
53
|
+
/** { شناسهٔ ستون: [شناسهٔ کارتها] } */
|
|
54
|
+
get value(): Record<string, string[]>;
|
|
55
|
+
set value(v: Record<string, string[]>);
|
|
56
|
+
private label;
|
|
57
|
+
private colName;
|
|
58
|
+
private build;
|
|
59
|
+
private update;
|
|
60
|
+
private all;
|
|
61
|
+
private start;
|
|
62
|
+
private finish;
|
|
63
|
+
/** کارت را به ستون col و جای index میبرد */
|
|
64
|
+
private place;
|
|
65
|
+
private onKey;
|
|
66
|
+
private onDown;
|
|
67
|
+
private stopWindow;
|
|
68
|
+
private onWinMove;
|
|
69
|
+
private onWinUp;
|
|
70
|
+
private onWinCancel;
|
|
71
|
+
private endPointer;
|
|
72
|
+
}
|
|
73
|
+
export interface SchedulerEvent {
|
|
74
|
+
id: string;
|
|
75
|
+
title: string;
|
|
76
|
+
/** شروع و پایان، ISO */
|
|
77
|
+
start: string | Date;
|
|
78
|
+
end: string | Date;
|
|
79
|
+
color?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* برنامهٔ هفتگی و روزانه با تقویم شمسی و شروع هفته از شنبه: events (JSON یا JavaScript)، date، view (week یا day)،
|
|
84
|
+
* start-hour، end-hour، step و holidays. رویدادهای همپوشان کنار هم و خط «اکنون».
|
|
85
|
+
* خانهٔ خالی با کلیک یا Enter رویداد kashi-slot (detail.start) میفرستد و کلید جهت بین خانهها میرود؛ کلیک روی رویداد kashi-event.
|
|
86
|
+
*/
|
|
87
|
+
export declare class KashiScheduler extends HTMLBase {
|
|
88
|
+
static observedAttributes: string[];
|
|
89
|
+
private data;
|
|
90
|
+
private anchor;
|
|
91
|
+
private mode;
|
|
92
|
+
private focus_;
|
|
93
|
+
private root;
|
|
94
|
+
private timer;
|
|
95
|
+
private key;
|
|
96
|
+
connectedCallback(): void;
|
|
97
|
+
disconnectedCallback(): void;
|
|
98
|
+
attributeChangedCallback(n: string, old: string | null, next: string | null): void;
|
|
99
|
+
get events(): SchedulerEvent[];
|
|
100
|
+
set events(v: SchedulerEvent[]);
|
|
101
|
+
/** روزی که نما دور آن است */
|
|
102
|
+
get date(): Date;
|
|
103
|
+
set date(d: Date);
|
|
104
|
+
get view(): "week" | "day";
|
|
105
|
+
set view(v: "week" | "day");
|
|
106
|
+
private setDate;
|
|
107
|
+
private setMode;
|
|
108
|
+
private build;
|
|
109
|
+
private get days();
|
|
110
|
+
private get hours();
|
|
111
|
+
private get step();
|
|
112
|
+
private slotDate;
|
|
113
|
+
private list;
|
|
114
|
+
private t;
|
|
115
|
+
private onKey;
|
|
116
|
+
private render;
|
|
117
|
+
}
|