@kupola/kupola 1.2.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/CHANGELOG.md +130 -0
- package/INTEGRATION.md +440 -0
- package/PROJECT_SUMMARY.md +312 -0
- package/README.md +286 -0
- package/SKILL.md +572 -0
- package/css/accessibility.css +119 -0
- package/css/animations.css +224 -0
- package/css/brand-themes.css +300 -0
- package/css/colors_and_type.css +441 -0
- package/css/components-ext.css +4165 -0
- package/css/components.css +1483 -0
- package/css/kupola.css +12 -0
- package/css/responsive.css +697 -0
- package/css/scaffold.css +145 -0
- package/css/states.css +316 -0
- package/css/theme-dark.css +296 -0
- package/css/theme-light.css +296 -0
- package/css/utilities.css +171 -0
- package/dist/css/kupola.css +12 -0
- package/dist/icons/icons/activity.svg +3 -0
- package/dist/icons/icons/alert-circle.svg +1 -0
- package/dist/icons/icons/alert-triangle.svg +1 -0
- package/dist/icons/icons/alert.d27e24.svg +1 -0
- package/dist/icons/icons/alert.svg +1 -0
- package/dist/icons/icons/apple.svg +1 -0
- package/dist/icons/icons/arrow-down.svg +1 -0
- package/dist/icons/icons/arrow-expand.svg +1 -0
- package/dist/icons/icons/arrow-left.svg +1 -0
- package/dist/icons/icons/arrow-minimize.svg +1 -0
- package/dist/icons/icons/arrow-right-to-line.svg +1 -0
- package/dist/icons/icons/arrow-right.svg +1 -0
- package/dist/icons/icons/arrow-up-right.svg +1 -0
- package/dist/icons/icons/arrow-up.0c0c0d.svg +1 -0
- package/dist/icons/icons/arrow-up.svg +1 -0
- package/dist/icons/icons/at.svg +1 -0
- package/dist/icons/icons/atom.0c0c0d.svg +1 -0
- package/dist/icons/icons/atom.svg +1 -0
- package/dist/icons/icons/bar-chart-2.svg +1 -0
- package/dist/icons/icons/bar.svg +1 -0
- package/dist/icons/icons/bell.svg +1 -0
- package/dist/icons/icons/box.svg +1 -0
- package/dist/icons/icons/bug.svg +1 -0
- package/dist/icons/icons/button.svg +1 -0
- package/dist/icons/icons/calendar.svg +1 -0
- package/dist/icons/icons/check-circle.33c192.svg +1 -0
- package/dist/icons/icons/check-circle.svg +1 -0
- package/dist/icons/icons/check-square.svg +4 -0
- package/dist/icons/icons/check.d1d3db.svg +1 -0
- package/dist/icons/icons/check.svg +1 -0
- package/dist/icons/icons/chevron-down.svg +1 -0
- package/dist/icons/icons/chevron-left.svg +1 -0
- package/dist/icons/icons/chevron-right.svg +1 -0
- package/dist/icons/icons/chevron-up.svg +1 -0
- package/dist/icons/icons/circle.svg +1 -0
- package/dist/icons/icons/clock.svg +1 -0
- package/dist/icons/icons/cmd.svg +1 -0
- package/dist/icons/icons/code.svg +1 -0
- package/dist/icons/icons/columns.svg +1 -0
- package/dist/icons/icons/copy.svg +1 -0
- package/dist/icons/icons/cpu.svg +1 -0
- package/dist/icons/icons/dashboard.0c0c0d.svg +1 -0
- package/dist/icons/icons/dashboard.svg +1 -0
- package/dist/icons/icons/dollar.svg +1 -0
- package/dist/icons/icons/download.svg +1 -0
- package/dist/icons/icons/edit.svg +1 -0
- package/dist/icons/icons/extensions.svg +1 -0
- package/dist/icons/icons/external.svg +1 -0
- package/dist/icons/icons/eye.svg +1 -0
- package/dist/icons/icons/file-text.svg +1 -0
- package/dist/icons/icons/file.svg +1 -0
- package/dist/icons/icons/files.svg +1 -0
- package/dist/icons/icons/filter.svg +1 -0
- package/dist/icons/icons/folder-open.svg +4 -0
- package/dist/icons/icons/folder.svg +1 -0
- package/dist/icons/icons/gear.svg +1 -0
- package/dist/icons/icons/git.svg +1 -0
- package/dist/icons/icons/github.svg +1 -0
- package/dist/icons/icons/globe.svg +1 -0
- package/dist/icons/icons/grid-2x2.svg +1 -0
- package/dist/icons/icons/hash.svg +1 -0
- package/dist/icons/icons/heart.svg +1 -0
- package/dist/icons/icons/help-circle.svg +5 -0
- package/dist/icons/icons/help.svg +1 -0
- package/dist/icons/icons/home.svg +1 -0
- package/dist/icons/icons/icons.svg +153 -0
- package/dist/icons/icons/image.svg +1 -0
- package/dist/icons/icons/info-circle.svg +1 -0
- package/dist/icons/icons/info-square.svg +1 -0
- package/dist/icons/icons/info.387bff.svg +1 -0
- package/dist/icons/icons/info.svg +1 -0
- package/dist/icons/icons/input.svg +1 -0
- package/dist/icons/icons/key.svg +1 -0
- package/dist/icons/icons/layers.svg +1 -0
- package/dist/icons/icons/layout-grid.svg +6 -0
- package/dist/icons/icons/layout.svg +1 -0
- package/dist/icons/icons/link.svg +1 -0
- package/dist/icons/icons/list.svg +1 -0
- package/dist/icons/icons/lock.svg +1 -0
- package/dist/icons/icons/log-out.svg +1 -0
- package/dist/icons/icons/logo.svg +1 -0
- package/dist/icons/icons/mail.svg +1 -0
- package/dist/icons/icons/menu.svg +1 -0
- package/dist/icons/icons/message-circle.svg +1 -0
- package/dist/icons/icons/message-plus.svg +1 -0
- package/dist/icons/icons/message-square.svg +1 -0
- package/dist/icons/icons/mic.svg +1 -0
- package/dist/icons/icons/minus.svg +1 -0
- package/dist/icons/icons/moon.svg +1 -0
- package/dist/icons/icons/more-h.svg +1 -0
- package/dist/icons/icons/mouse.svg +1 -0
- package/dist/icons/icons/palette.svg +1 -0
- package/dist/icons/icons/panel-bottom.svg +1 -0
- package/dist/icons/icons/pause.svg +1 -0
- package/dist/icons/icons/play.svg +1 -0
- package/dist/icons/icons/plug.svg +1 -0
- package/dist/icons/icons/plus.0c0c0d.svg +1 -0
- package/dist/icons/icons/plus.svg +1 -0
- package/dist/icons/icons/refresh.svg +1 -0
- package/dist/icons/icons/ruler.svg +1 -0
- package/dist/icons/icons/scroll-text.svg +1 -0
- package/dist/icons/icons/search-menu.svg +1 -0
- package/dist/icons/icons/search.svg +1 -0
- package/dist/icons/icons/send.0c0c0d.svg +1 -0
- package/dist/icons/icons/send.svg +1 -0
- package/dist/icons/icons/settings.0c0c0d.svg +1 -0
- package/dist/icons/icons/settings.svg +1 -0
- package/dist/icons/icons/shield.svg +1 -0
- package/dist/icons/icons/sidebar-left.svg +1 -0
- package/dist/icons/icons/sidebar-right.svg +1 -0
- package/dist/icons/icons/sliders.svg +1 -0
- package/dist/icons/icons/sparkles.32f08c.svg +1 -0
- package/dist/icons/icons/sparkles.svg +1 -0
- package/dist/icons/icons/square.svg +1 -0
- package/dist/icons/icons/star.svg +1 -0
- package/dist/icons/icons/sun.svg +1 -0
- package/dist/icons/icons/table.svg +1 -0
- package/dist/icons/icons/terminal.svg +1 -0
- package/dist/icons/icons/trash.svg +1 -0
- package/dist/icons/icons/trending-down.svg +1 -0
- package/dist/icons/icons/trending-up.svg +1 -0
- package/dist/icons/icons/type.svg +1 -0
- package/dist/icons/icons/upload.svg +1 -0
- package/dist/icons/icons/user-circle.svg +1 -0
- package/dist/icons/icons/user-plus.svg +6 -0
- package/dist/icons/icons/user.svg +1 -0
- package/dist/icons/icons/users.svg +1 -0
- package/dist/icons/icons/warning.svg +1 -0
- package/dist/icons/icons/wrench.svg +1 -0
- package/dist/icons/icons/x-circle.svg +1 -0
- package/dist/icons/icons/x.svg +1 -0
- package/dist/icons/icons/zap.0c0c0d.svg +1 -0
- package/dist/icons/icons/zap.svg +1 -0
- package/dist/kupola.cjs.js +258 -0
- package/dist/kupola.cjs.js.map +1 -0
- package/dist/kupola.esm.js +7640 -0
- package/dist/kupola.esm.js.map +1 -0
- package/dist/kupola.umd.js +258 -0
- package/dist/kupola.umd.js.map +1 -0
- package/dist/types/kupola.d.ts +1359 -0
- package/dist/utils/utils/Kupola.cs +77 -0
- package/dist/utils/utils/Kupola.java +104 -0
- package/dist/utils/utils/kupola.go +120 -0
- package/dist/utils/utils/kupola.js +63 -0
- package/dist/utils/utils/kupola.py +1392 -0
- package/dist/utils/utils/kupola.rb +69 -0
- package/icons/activity.svg +3 -0
- package/icons/alert-circle.svg +1 -0
- package/icons/alert-triangle.svg +1 -0
- package/icons/alert.d27e24.svg +1 -0
- package/icons/alert.svg +1 -0
- package/icons/apple.svg +1 -0
- package/icons/arrow-down.svg +1 -0
- package/icons/arrow-expand.svg +1 -0
- package/icons/arrow-left.svg +1 -0
- package/icons/arrow-minimize.svg +1 -0
- package/icons/arrow-right-to-line.svg +1 -0
- package/icons/arrow-right.svg +1 -0
- package/icons/arrow-up-right.svg +1 -0
- package/icons/arrow-up.0c0c0d.svg +1 -0
- package/icons/arrow-up.svg +1 -0
- package/icons/at.svg +1 -0
- package/icons/atom.0c0c0d.svg +1 -0
- package/icons/atom.svg +1 -0
- package/icons/bar-chart-2.svg +1 -0
- package/icons/bar.svg +1 -0
- package/icons/bell.svg +1 -0
- package/icons/box.svg +1 -0
- package/icons/bug.svg +1 -0
- package/icons/button.svg +1 -0
- package/icons/calendar.svg +1 -0
- package/icons/check-circle.33c192.svg +1 -0
- package/icons/check-circle.svg +1 -0
- package/icons/check-square.svg +4 -0
- package/icons/check.d1d3db.svg +1 -0
- package/icons/check.svg +1 -0
- package/icons/chevron-down.svg +1 -0
- package/icons/chevron-left.svg +1 -0
- package/icons/chevron-right.svg +1 -0
- package/icons/chevron-up.svg +1 -0
- package/icons/circle.svg +1 -0
- package/icons/clock.svg +1 -0
- package/icons/cmd.svg +1 -0
- package/icons/code.svg +1 -0
- package/icons/columns.svg +1 -0
- package/icons/copy.svg +1 -0
- package/icons/cpu.svg +1 -0
- package/icons/dashboard.0c0c0d.svg +1 -0
- package/icons/dashboard.svg +1 -0
- package/icons/dollar.svg +1 -0
- package/icons/download.svg +1 -0
- package/icons/edit.svg +1 -0
- package/icons/extensions.svg +1 -0
- package/icons/external.svg +1 -0
- package/icons/eye.svg +1 -0
- package/icons/file-text.svg +1 -0
- package/icons/file.svg +1 -0
- package/icons/files.svg +1 -0
- package/icons/filter.svg +1 -0
- package/icons/folder-open.svg +4 -0
- package/icons/folder.svg +1 -0
- package/icons/gear.svg +1 -0
- package/icons/git.svg +1 -0
- package/icons/github.svg +1 -0
- package/icons/globe.svg +1 -0
- package/icons/grid-2x2.svg +1 -0
- package/icons/hash.svg +1 -0
- package/icons/heart.svg +1 -0
- package/icons/help-circle.svg +5 -0
- package/icons/help.svg +1 -0
- package/icons/home.svg +1 -0
- package/icons/icons.svg +153 -0
- package/icons/image.svg +1 -0
- package/icons/info-circle.svg +1 -0
- package/icons/info-square.svg +1 -0
- package/icons/info.387bff.svg +1 -0
- package/icons/info.svg +1 -0
- package/icons/input.svg +1 -0
- package/icons/key.svg +1 -0
- package/icons/layers.svg +1 -0
- package/icons/layout-grid.svg +6 -0
- package/icons/layout.svg +1 -0
- package/icons/link.svg +1 -0
- package/icons/list.svg +1 -0
- package/icons/lock.svg +1 -0
- package/icons/log-out.svg +1 -0
- package/icons/logo.svg +1 -0
- package/icons/mail.svg +1 -0
- package/icons/menu.svg +1 -0
- package/icons/message-circle.svg +1 -0
- package/icons/message-plus.svg +1 -0
- package/icons/message-square.svg +1 -0
- package/icons/mic.svg +1 -0
- package/icons/minus.svg +1 -0
- package/icons/moon.svg +1 -0
- package/icons/more-h.svg +1 -0
- package/icons/mouse.svg +1 -0
- package/icons/palette.svg +1 -0
- package/icons/panel-bottom.svg +1 -0
- package/icons/pause.svg +1 -0
- package/icons/play.svg +1 -0
- package/icons/plug.svg +1 -0
- package/icons/plus.0c0c0d.svg +1 -0
- package/icons/plus.svg +1 -0
- package/icons/refresh.svg +1 -0
- package/icons/ruler.svg +1 -0
- package/icons/scroll-text.svg +1 -0
- package/icons/search-menu.svg +1 -0
- package/icons/search.svg +1 -0
- package/icons/send.0c0c0d.svg +1 -0
- package/icons/send.svg +1 -0
- package/icons/settings.0c0c0d.svg +1 -0
- package/icons/settings.svg +1 -0
- package/icons/shield.svg +1 -0
- package/icons/sidebar-left.svg +1 -0
- package/icons/sidebar-right.svg +1 -0
- package/icons/sliders.svg +1 -0
- package/icons/sparkles.32f08c.svg +1 -0
- package/icons/sparkles.svg +1 -0
- package/icons/square.svg +1 -0
- package/icons/star.svg +1 -0
- package/icons/sun.svg +1 -0
- package/icons/table.svg +1 -0
- package/icons/terminal.svg +1 -0
- package/icons/trash.svg +1 -0
- package/icons/trending-down.svg +1 -0
- package/icons/trending-up.svg +1 -0
- package/icons/type.svg +1 -0
- package/icons/upload.svg +1 -0
- package/icons/user-circle.svg +1 -0
- package/icons/user-plus.svg +6 -0
- package/icons/user.svg +1 -0
- package/icons/users.svg +1 -0
- package/icons/warning.svg +1 -0
- package/icons/wrench.svg +1 -0
- package/icons/x-circle.svg +1 -0
- package/icons/x.svg +1 -0
- package/icons/zap.0c0c0d.svg +1 -0
- package/icons/zap.svg +1 -0
- package/js/calendar.js +184 -0
- package/js/carousel.js +173 -0
- package/js/collapse.js +127 -0
- package/js/color-picker.js +144 -0
- package/js/component.js +276 -0
- package/js/composition-api.js +458 -0
- package/js/countdown.js +144 -0
- package/js/data-bind.js +1286 -0
- package/js/datepicker.js +270 -0
- package/js/dialog.js +131 -0
- package/js/drawer.js +118 -0
- package/js/dropdown.js +122 -0
- package/js/dynamic-tags.js +156 -0
- package/js/error-handler.js +181 -0
- package/js/fileupload.js +392 -0
- package/js/form.js +291 -0
- package/js/global-events.js +203 -0
- package/js/heatmap.js +405 -0
- package/js/http.js +419 -0
- package/js/i18n.js +228 -0
- package/js/icons.js +165 -0
- package/js/image-preview.js +218 -0
- package/js/initializer.js +162 -0
- package/js/kupola-core.js +66 -0
- package/js/kupola-devtools.js +598 -0
- package/js/kupola-lifecycle.js +510 -0
- package/js/message.js +60 -0
- package/js/modal.js +191 -0
- package/js/notification.js +73 -0
- package/js/numberinput.js +146 -0
- package/js/performance.js +250 -0
- package/js/registry.js +205 -0
- package/js/router.js +396 -0
- package/js/security.js +189 -0
- package/js/select.js +143 -0
- package/js/slide-captcha.js +504 -0
- package/js/slider.js +94 -0
- package/js/statcard.js +219 -0
- package/js/tag.js +83 -0
- package/js/test-utils.js +251 -0
- package/js/theme.js +363 -0
- package/js/timepicker.js +238 -0
- package/js/tooltip.js +122 -0
- package/js/utils.js +1458 -0
- package/js/validation.js +553 -0
- package/js/virtual-list.js +593 -0
- package/package.json +105 -0
- package/templates/base.html +30 -0
- package/templates/base_dashboard.html +99 -0
- package/types/kupola.d.ts +1359 -0
- package/utils/Kupola.cs +77 -0
- package/utils/Kupola.java +104 -0
- package/utils/kupola.go +120 -0
- package/utils/kupola.js +63 -0
- package/utils/kupola.py +1392 -0
- package/utils/kupola.rb +69 -0
|
@@ -0,0 +1,1359 @@
|
|
|
1
|
+
type Primitive = string | number | boolean | null | undefined;
|
|
2
|
+
|
|
3
|
+
type Reactive<T> = T extends Primitive
|
|
4
|
+
? T
|
|
5
|
+
: T extends Array<infer U>
|
|
6
|
+
? Reactive<U>[]
|
|
7
|
+
: T extends object
|
|
8
|
+
? { [K in keyof T]: Reactive<T[K]> }
|
|
9
|
+
: T;
|
|
10
|
+
|
|
11
|
+
interface BrandOption {
|
|
12
|
+
id: BrandColor;
|
|
13
|
+
name: string;
|
|
14
|
+
color: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type BrandColor =
|
|
18
|
+
| 'zengqing'
|
|
19
|
+
| 'green'
|
|
20
|
+
| 'xionghuang'
|
|
21
|
+
| 'jianghuang'
|
|
22
|
+
| 'lanlv'
|
|
23
|
+
| 'kongquelan'
|
|
24
|
+
| 'meiguizi'
|
|
25
|
+
| 'shihong'
|
|
26
|
+
| 'shanchahong'
|
|
27
|
+
| 'quhong'
|
|
28
|
+
| 'roulan';
|
|
29
|
+
|
|
30
|
+
type ThemeType = 'dark' | 'light';
|
|
31
|
+
|
|
32
|
+
type BindingType =
|
|
33
|
+
| 'text'
|
|
34
|
+
| 'html'
|
|
35
|
+
| 'value'
|
|
36
|
+
| 'checked'
|
|
37
|
+
| 'disabled'
|
|
38
|
+
| 'hidden'
|
|
39
|
+
| 'class'
|
|
40
|
+
| 'style'
|
|
41
|
+
| 'attr'
|
|
42
|
+
| 'src'
|
|
43
|
+
| 'href'
|
|
44
|
+
| 'placeholder';
|
|
45
|
+
|
|
46
|
+
interface PersistOptions {
|
|
47
|
+
storage?: 'local' | 'session';
|
|
48
|
+
debounce?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface RouteConfig {
|
|
52
|
+
path: string;
|
|
53
|
+
component: string | (() => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>);
|
|
54
|
+
name?: string;
|
|
55
|
+
meta?: Record<string, unknown>;
|
|
56
|
+
children?: RouteConfig[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface RouterOptions {
|
|
60
|
+
mode?: 'hash' | 'history';
|
|
61
|
+
routes: RouteConfig[];
|
|
62
|
+
base?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface HttpRequestConfig {
|
|
66
|
+
url: string;
|
|
67
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
68
|
+
headers?: Record<string, string>;
|
|
69
|
+
params?: Record<string, string | number | boolean>;
|
|
70
|
+
data?: Record<string, unknown> | unknown[];
|
|
71
|
+
timeout?: number;
|
|
72
|
+
withCredentials?: boolean;
|
|
73
|
+
responseType?: 'json' | 'text' | 'blob' | 'formData';
|
|
74
|
+
cache?: boolean;
|
|
75
|
+
retry?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface HttpResponse<T = unknown> {
|
|
79
|
+
data: T;
|
|
80
|
+
status: number;
|
|
81
|
+
statusText: string;
|
|
82
|
+
headers: Record<string, string>;
|
|
83
|
+
config: HttpRequestConfig;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface HttpError {
|
|
87
|
+
message: string;
|
|
88
|
+
code?: number;
|
|
89
|
+
response?: HttpResponse;
|
|
90
|
+
config: HttpRequestConfig;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface HttpInterceptor {
|
|
94
|
+
request?: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
|
|
95
|
+
requestError?: (error: unknown) => Promise<never>;
|
|
96
|
+
response?: <T = unknown>(response: HttpResponse<T>) => HttpResponse<T> | Promise<HttpResponse<T>>;
|
|
97
|
+
responseError?: (error: HttpError) => Promise<never>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface HttpOptions {
|
|
101
|
+
baseURL?: string;
|
|
102
|
+
timeout?: number;
|
|
103
|
+
headers?: Record<string, string>;
|
|
104
|
+
interceptors?: HttpInterceptor;
|
|
105
|
+
cacheTTL?: number;
|
|
106
|
+
maxRetries?: number;
|
|
107
|
+
retryDelay?: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface UploadProgress {
|
|
111
|
+
progress: number;
|
|
112
|
+
uploaded: number;
|
|
113
|
+
total: number;
|
|
114
|
+
currentChunk: number;
|
|
115
|
+
totalChunks: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface UploadOptions {
|
|
119
|
+
chunkSize?: number;
|
|
120
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
121
|
+
headers?: Record<string, string>;
|
|
122
|
+
parallel?: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface StoreOptions<S extends object = Record<string, unknown>> {
|
|
126
|
+
state?: () => S;
|
|
127
|
+
getters?: Record<string, (state: S) => unknown>;
|
|
128
|
+
actions?: Record<string, (context: StoreContext<S>) => unknown | Promise<unknown>>;
|
|
129
|
+
mutations?: Record<string, (state: S, payload?: unknown) => void>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface StoreContext<S extends object = Record<string, unknown>> {
|
|
133
|
+
state: S;
|
|
134
|
+
commit: (type: string, payload?: unknown) => void;
|
|
135
|
+
dispatch: (type: string, payload?: unknown) => unknown | Promise<unknown>;
|
|
136
|
+
getters: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface ToastOptions {
|
|
140
|
+
message: string;
|
|
141
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
142
|
+
duration?: number;
|
|
143
|
+
position?: 'top' | 'bottom' | 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface ModalOptions {
|
|
147
|
+
title?: string;
|
|
148
|
+
content: string | HTMLElement;
|
|
149
|
+
width?: string | number;
|
|
150
|
+
confirmText?: string;
|
|
151
|
+
cancelText?: string;
|
|
152
|
+
showCancel?: boolean;
|
|
153
|
+
onConfirm?: () => void | Promise<void>;
|
|
154
|
+
onCancel?: () => void;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface NotificationOptions {
|
|
158
|
+
title: string;
|
|
159
|
+
message: string;
|
|
160
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
161
|
+
duration?: number;
|
|
162
|
+
onClick?: () => void;
|
|
163
|
+
onClose?: () => void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface DatepickerOptions {
|
|
167
|
+
format?: string;
|
|
168
|
+
minDate?: Date | string;
|
|
169
|
+
maxDate?: Date | string;
|
|
170
|
+
disabledDates?: (date: Date) => boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface TimepickerOptions {
|
|
174
|
+
format?: '12h' | '24h';
|
|
175
|
+
minTime?: string;
|
|
176
|
+
maxTime?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface NumberInputOptions {
|
|
180
|
+
min?: number;
|
|
181
|
+
max?: number;
|
|
182
|
+
step?: number;
|
|
183
|
+
precision?: number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface HeatmapCell {
|
|
187
|
+
date: string;
|
|
188
|
+
value: number;
|
|
189
|
+
level: number;
|
|
190
|
+
element: HTMLElement;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface HeatmapOptions {
|
|
194
|
+
data?: Array<{ date: string; value: number }>;
|
|
195
|
+
startDate?: Date;
|
|
196
|
+
endDate?: Date;
|
|
197
|
+
cellSize?: number;
|
|
198
|
+
color?: string;
|
|
199
|
+
onCellClick?: (cell: HeatmapCell) => void;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface VirtualListItem<T = unknown> {
|
|
203
|
+
data: T;
|
|
204
|
+
index: number;
|
|
205
|
+
element: HTMLElement;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface VirtualListOptions<T = unknown> {
|
|
209
|
+
data?: T[];
|
|
210
|
+
itemHeight?: number;
|
|
211
|
+
containerHeight?: number;
|
|
212
|
+
renderItem?: (item: T, index: number) => string;
|
|
213
|
+
onItemClick?: (item: VirtualListItem<T>) => void;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare class KupolaDataBind<T extends object = Record<string, unknown>> {
|
|
217
|
+
constructor();
|
|
218
|
+
|
|
219
|
+
data: Reactive<T>;
|
|
220
|
+
rawData: T;
|
|
221
|
+
|
|
222
|
+
set<K extends keyof T>(key: K, value: T[K], silent?: boolean): void;
|
|
223
|
+
set<V = unknown>(key: string, value: V, silent?: boolean): void;
|
|
224
|
+
set(data: Partial<T>, silent?: boolean): void;
|
|
225
|
+
|
|
226
|
+
get<K extends keyof T>(key: K): T[K];
|
|
227
|
+
get<V = unknown>(key: string): V;
|
|
228
|
+
|
|
229
|
+
observe<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
|
230
|
+
observe<V = unknown>(key: string, callback: (newValue: V, oldValue: V) => void): void;
|
|
231
|
+
observe(callback: (key: string, newValue: unknown, oldValue: unknown) => void): void;
|
|
232
|
+
|
|
233
|
+
unobserve<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
|
234
|
+
unobserve<V = unknown>(key: string, callback: (newValue: V, oldValue: V) => void): void;
|
|
235
|
+
|
|
236
|
+
computed<K extends string, R = unknown>(name: K, deps: (keyof T | string)[], callback: (...args: unknown[]) => R): void;
|
|
237
|
+
|
|
238
|
+
bind(): void;
|
|
239
|
+
load(data: Partial<T>): void;
|
|
240
|
+
reset(): void;
|
|
241
|
+
destroy(): void;
|
|
242
|
+
|
|
243
|
+
persist<K extends keyof T>(key: K, options?: PersistOptions): void;
|
|
244
|
+
persist(key: string, options?: PersistOptions): void;
|
|
245
|
+
unpersist<K extends keyof T>(key: K): void;
|
|
246
|
+
unpersist(key: string): void;
|
|
247
|
+
|
|
248
|
+
snapshot(): number;
|
|
249
|
+
rollback(index?: number): boolean;
|
|
250
|
+
getSnapshotCount(): number;
|
|
251
|
+
clearSnapshots(): void;
|
|
252
|
+
|
|
253
|
+
serializeForm(formElement: HTMLFormElement): Record<string, unknown>;
|
|
254
|
+
fillForm(formElement: HTMLFormElement, data: Record<string, unknown>): void;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare class KupolaEventBus {
|
|
258
|
+
constructor();
|
|
259
|
+
|
|
260
|
+
on<T = unknown>(eventName: string, callback: (data: T) => void): () => void;
|
|
261
|
+
on(callback: (eventName: string, data: unknown) => void): void;
|
|
262
|
+
|
|
263
|
+
off<T = unknown>(eventName: string, callback: (data: T) => void): void;
|
|
264
|
+
off(callback: (eventName: string, data: unknown) => void): void;
|
|
265
|
+
|
|
266
|
+
emit<T = unknown>(eventName: string, data: T): void;
|
|
267
|
+
|
|
268
|
+
once<T = unknown>(eventName: string, callback: (data: T) => void): () => void;
|
|
269
|
+
once(callback: (eventName: string, data: unknown) => void): void;
|
|
270
|
+
|
|
271
|
+
delegate(selector: string, eventName: string, callback: (event: Event) => void): () => void;
|
|
272
|
+
undelegate(selector: string, eventName: string): void;
|
|
273
|
+
|
|
274
|
+
destroy(): void;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare class KupolaStore<S extends object = Record<string, unknown>> {
|
|
278
|
+
constructor(name: string, options?: StoreOptions<S>);
|
|
279
|
+
|
|
280
|
+
readonly name: string;
|
|
281
|
+
readonly state: S;
|
|
282
|
+
|
|
283
|
+
commit(type: string, payload?: unknown): void;
|
|
284
|
+
dispatch(type: string, payload?: unknown): unknown | Promise<unknown>;
|
|
285
|
+
|
|
286
|
+
observe(callback: (newState: S, oldState: S) => void): () => void;
|
|
287
|
+
unobserve(callback: (newState: S, oldState: S) => void): void;
|
|
288
|
+
|
|
289
|
+
toJSON(): { name: string; state: S; getters: Record<string, unknown> };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare class KupolaStoreManager {
|
|
293
|
+
constructor();
|
|
294
|
+
|
|
295
|
+
createStore<S extends object = Record<string, unknown>>(name: string, options?: StoreOptions<S>): KupolaStore<S>;
|
|
296
|
+
getStore<S extends object = Record<string, unknown>>(name: string): KupolaStore<S> | undefined;
|
|
297
|
+
registerStore(store: KupolaStore): void;
|
|
298
|
+
dispose(): void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
interface DebounceOptions {
|
|
302
|
+
leading?: boolean;
|
|
303
|
+
trailing?: boolean;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface ThrottleOptions {
|
|
307
|
+
trailing?: boolean;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
declare class KupolaUtils {
|
|
311
|
+
string: {
|
|
312
|
+
trim(str: string): string;
|
|
313
|
+
trimLeft(str: string): string;
|
|
314
|
+
trimRight(str: string): string;
|
|
315
|
+
toUpperCase(str: string): string;
|
|
316
|
+
toLowerCase(str: string): string;
|
|
317
|
+
capitalize(str: string): string;
|
|
318
|
+
camelize(str: string): string;
|
|
319
|
+
hyphenate(str: string): string;
|
|
320
|
+
padStart(str: string | number, length: number, padChar?: string): string;
|
|
321
|
+
padEnd(str: string | number, length: number, padChar?: string): string;
|
|
322
|
+
truncate(str: string, maxLength: number, suffix?: string): string;
|
|
323
|
+
replaceAll(str: string, search: string, replacement: string): string;
|
|
324
|
+
format(template: string, data: Record<string, unknown>): string;
|
|
325
|
+
startsWith(str: string, prefix: string): boolean;
|
|
326
|
+
endsWith(str: string, suffix: string): boolean;
|
|
327
|
+
includes(str: string, search: string): boolean;
|
|
328
|
+
repeat(str: string, times: number): string;
|
|
329
|
+
reverse(str: string): string;
|
|
330
|
+
countOccurrences(str: string, search: string): number;
|
|
331
|
+
escapeHtml(str: string): string;
|
|
332
|
+
unescapeHtml(str: string): string;
|
|
333
|
+
generateRandom(length?: number): string;
|
|
334
|
+
generateUUID(): string;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
array: {
|
|
338
|
+
isArray(arr: unknown): boolean;
|
|
339
|
+
isEmpty(arr: unknown[]): boolean;
|
|
340
|
+
size(arr: unknown[]): number;
|
|
341
|
+
first<T>(arr: T[], defaultValue?: T): T | undefined;
|
|
342
|
+
last<T>(arr: T[], defaultValue?: T): T | undefined;
|
|
343
|
+
get<T>(arr: T[], index: number, defaultValue?: T): T | undefined;
|
|
344
|
+
slice<T>(arr: T[], start: number, end?: number): T[];
|
|
345
|
+
concat<T>(...args: T[][]): T[];
|
|
346
|
+
join(arr: unknown[], separator?: string): string;
|
|
347
|
+
indexOf<T>(arr: T[], item: T, fromIndex?: number): number;
|
|
348
|
+
lastIndexOf<T>(arr: T[], item: T, fromIndex?: number): number;
|
|
349
|
+
includes<T>(arr: T[], item: T): boolean;
|
|
350
|
+
push<T>(arr: T[], ...items: T[]): T[];
|
|
351
|
+
pop<T>(arr: T[]): T | undefined;
|
|
352
|
+
shift<T>(arr: T[]): T | undefined;
|
|
353
|
+
unshift<T>(arr: T[], ...items: T[]): T[];
|
|
354
|
+
remove<T>(arr: T[], item: T): T[];
|
|
355
|
+
removeAt<T>(arr: T[], index: number): T[];
|
|
356
|
+
insert<T>(arr: T[], index: number, item: T): T[];
|
|
357
|
+
reverse<T>(arr: T[]): T[];
|
|
358
|
+
sort<T>(arr: T[], compareFn?: (a: T, b: T) => number): T[];
|
|
359
|
+
sortBy<T>(arr: T[], key: string, order?: 'asc' | 'desc'): T[];
|
|
360
|
+
filter<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => boolean): T[];
|
|
361
|
+
map<T, U>(arr: T[], fn: (value: T, index: number, array: T[]) => U): U[];
|
|
362
|
+
reduce<T, U>(arr: T[], fn: (acc: U, val: T, index: number, array: T[]) => U, initialValue: U): U;
|
|
363
|
+
forEach<T>(arr: T[], fn: (value: T, index: number, array: T[]) => void): void;
|
|
364
|
+
every<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => boolean): boolean;
|
|
365
|
+
some<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => boolean): boolean;
|
|
366
|
+
find<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => boolean): T | undefined;
|
|
367
|
+
findIndex<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => boolean): number;
|
|
368
|
+
flat<T>(arr: T[][], depth?: number): T[];
|
|
369
|
+
flattenDeep<T>(arr: unknown[]): T[];
|
|
370
|
+
unique<T>(arr: T[]): T[];
|
|
371
|
+
uniqueBy<T>(arr: T[], key: string): T[];
|
|
372
|
+
chunk<T>(arr: T[], size: number): T[][];
|
|
373
|
+
shuffle<T>(arr: T[]): T[];
|
|
374
|
+
sum(arr: number[]): number;
|
|
375
|
+
average(arr: number[]): number;
|
|
376
|
+
max(arr: number[]): number;
|
|
377
|
+
min(arr: number[]): number;
|
|
378
|
+
intersection<T>(...args: T[][]): T[];
|
|
379
|
+
union<T>(...args: T[][]): T[];
|
|
380
|
+
difference<T>(arr1: T[], arr2: T[]): T[];
|
|
381
|
+
zip<T>(...args: T[][]): T[][];
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
object: {
|
|
385
|
+
isObject(obj: unknown): boolean;
|
|
386
|
+
isEmpty(obj: Record<string, unknown>): boolean;
|
|
387
|
+
keys(obj: Record<string, unknown>): string[];
|
|
388
|
+
values<T>(obj: Record<string, T>): T[];
|
|
389
|
+
entries<T>(obj: Record<string, T>): [string, T][];
|
|
390
|
+
has(obj: Record<string, unknown>, key: string): boolean;
|
|
391
|
+
get<T>(obj: Record<string, unknown>, path: string, defaultValue?: T): T | undefined;
|
|
392
|
+
set(obj: Record<string, unknown>, path: string, value: unknown): Record<string, unknown>;
|
|
393
|
+
pick<T>(obj: Record<string, unknown>, keys: string[]): Record<string, T>;
|
|
394
|
+
omit<T>(obj: Record<string, unknown>, keys: string[]): Record<string, T>;
|
|
395
|
+
merge(...args: Record<string, unknown>[]): Record<string, unknown>;
|
|
396
|
+
clone<T>(obj: T): T;
|
|
397
|
+
deepClone<T>(obj: T): T;
|
|
398
|
+
forEach<T>(obj: Record<string, T>, fn: (value: T, key: string, obj: Record<string, T>) => void): void;
|
|
399
|
+
map<T, U>(obj: Record<string, T>, fn: (value: T, key: string, obj: Record<string, T>) => U): Record<string, U>;
|
|
400
|
+
filter<T>(obj: Record<string, T>, fn: (value: T, key: string, obj: Record<string, T>) => boolean): Record<string, T>;
|
|
401
|
+
reduce<T, U>(obj: Record<string, T>, fn: (acc: U, value: T, key: string, obj: Record<string, T>) => U, initialValue: U): U;
|
|
402
|
+
toArray<T>(obj: Record<string, T>): { key: string; value: T }[];
|
|
403
|
+
fromArray<T>(arr: T[], keyField: string, valueField?: string): Record<string, T>;
|
|
404
|
+
size(obj: Record<string, unknown>): number;
|
|
405
|
+
invert<T>(obj: Record<string, T>): Record<T, string>;
|
|
406
|
+
isEqual(obj1: unknown, obj2: unknown): boolean;
|
|
407
|
+
freeze<T>(obj: T): T;
|
|
408
|
+
seal<T>(obj: T): T;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
number: {
|
|
412
|
+
isNumber(val: unknown): boolean;
|
|
413
|
+
isInteger(val: unknown): boolean;
|
|
414
|
+
isFloat(val: unknown): boolean;
|
|
415
|
+
isPositive(val: unknown): boolean;
|
|
416
|
+
isNegative(val: unknown): boolean;
|
|
417
|
+
isZero(val: unknown): boolean;
|
|
418
|
+
clamp(val: number, min: number, max: number): number;
|
|
419
|
+
round(val: number, precision?: number): number;
|
|
420
|
+
floor(val: number): number;
|
|
421
|
+
ceil(val: number): number;
|
|
422
|
+
abs(val: number): number;
|
|
423
|
+
min(...args: number[]): number | undefined;
|
|
424
|
+
max(...args: number[]): number | undefined;
|
|
425
|
+
sum(...args: number[][]): number;
|
|
426
|
+
average(...args: number[][]): number;
|
|
427
|
+
random(min?: number, max?: number): number;
|
|
428
|
+
randomInt(min: number, max: number): number;
|
|
429
|
+
format(val: number, decimals?: number): string;
|
|
430
|
+
formatCurrency(val: number, currency?: string, decimals?: number): string;
|
|
431
|
+
formatPercent(val: number, decimals?: number): string;
|
|
432
|
+
toFixed(val: number, decimals?: number): string;
|
|
433
|
+
toPrecision(val: number, precision?: number): string;
|
|
434
|
+
isNaN(val: unknown): boolean;
|
|
435
|
+
isFinite(val: unknown): boolean;
|
|
436
|
+
parseInt(val: string, radix?: number): number;
|
|
437
|
+
parseFloat(val: string): number;
|
|
438
|
+
toNumber(val: unknown, defaultValue?: number): number;
|
|
439
|
+
safeDivide(a: number, b: number, defaultValue?: number): number;
|
|
440
|
+
safeMultiply(...args: number[]): number;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
date: {
|
|
444
|
+
now(): number;
|
|
445
|
+
today(): Date;
|
|
446
|
+
tomorrow(): Date;
|
|
447
|
+
yesterday(): Date;
|
|
448
|
+
isDate(val: unknown): boolean;
|
|
449
|
+
isValid(date: Date): boolean;
|
|
450
|
+
parse(str: string): Date | null;
|
|
451
|
+
format(date: Date, formatStr?: string): string;
|
|
452
|
+
toISO(date: Date): string;
|
|
453
|
+
toUTC(date: Date): Date | null;
|
|
454
|
+
addDays(date: Date, days: number): Date;
|
|
455
|
+
addHours(date: Date, hours: number): Date;
|
|
456
|
+
addMinutes(date: Date, minutes: number): Date;
|
|
457
|
+
addSeconds(date: Date, seconds: number): Date;
|
|
458
|
+
diffDays(date1: Date, date2: Date): number;
|
|
459
|
+
diffHours(date1: Date, date2: Date): number;
|
|
460
|
+
diffMinutes(date1: Date, date2: Date): number;
|
|
461
|
+
diffSeconds(date1: Date, date2: Date): number;
|
|
462
|
+
isToday(date: Date): boolean;
|
|
463
|
+
isYesterday(date: Date): boolean;
|
|
464
|
+
isTomorrow(date: Date): boolean;
|
|
465
|
+
isFuture(date: Date): boolean;
|
|
466
|
+
isPast(date: Date): boolean;
|
|
467
|
+
isLeapYear(date: Date): boolean;
|
|
468
|
+
getDaysInMonth(date: Date): number;
|
|
469
|
+
getWeekOfYear(date: Date): number;
|
|
470
|
+
getQuarter(date: Date): number;
|
|
471
|
+
startOfDay(date: Date): Date;
|
|
472
|
+
endOfDay(date: Date): Date;
|
|
473
|
+
startOfMonth(date: Date): Date;
|
|
474
|
+
endOfMonth(date: Date): Date;
|
|
475
|
+
startOfWeek(date: Date, startDay?: number): Date;
|
|
476
|
+
endOfWeek(date: Date, startDay?: number): Date;
|
|
477
|
+
getAge(birthDate: Date): number;
|
|
478
|
+
fromNow(date: Date): string;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
debounce<T extends (...args: unknown[]) => void>(func: T, wait: number, options?: DebounceOptions): T;
|
|
482
|
+
throttle<T extends (...args: unknown[]) => void>(func: T, limit: number, options?: ThrottleOptions): T;
|
|
483
|
+
|
|
484
|
+
validator: {
|
|
485
|
+
isEmail(str: string): boolean;
|
|
486
|
+
isPhone(str: string): boolean;
|
|
487
|
+
isURL(str: string): boolean;
|
|
488
|
+
isIPv4(str: string): boolean;
|
|
489
|
+
isIPv6(str: string): boolean;
|
|
490
|
+
isIP(str: string): boolean;
|
|
491
|
+
isIDCard(str: string): boolean;
|
|
492
|
+
isPassport(str: string): boolean;
|
|
493
|
+
isCreditCard(str: string): boolean;
|
|
494
|
+
isHexColor(str: string): boolean;
|
|
495
|
+
isRGB(str: string): boolean;
|
|
496
|
+
isRGBA(str: string): boolean;
|
|
497
|
+
isColor(str: string): boolean;
|
|
498
|
+
isDate(str: string): boolean;
|
|
499
|
+
isJSON(str: string): boolean;
|
|
500
|
+
isEmpty(str: string): boolean;
|
|
501
|
+
isWhitespace(str: string): boolean;
|
|
502
|
+
isNumber(str: string): boolean;
|
|
503
|
+
isInteger(str: string): boolean;
|
|
504
|
+
isFloat(str: string): boolean;
|
|
505
|
+
isPositive(str: string): boolean;
|
|
506
|
+
isNegative(str: string): boolean;
|
|
507
|
+
isAlpha(str: string): boolean;
|
|
508
|
+
isAlphaNumeric(str: string): boolean;
|
|
509
|
+
isChinese(str: string): boolean;
|
|
510
|
+
isLength(str: string, min: number, max?: number): boolean;
|
|
511
|
+
minLength(str: string, min: number): boolean;
|
|
512
|
+
maxLength(str: string, max: number): boolean;
|
|
513
|
+
matches(str: string, regex: RegExp): boolean;
|
|
514
|
+
equals(str1: string, str2: string): boolean;
|
|
515
|
+
contains(str: string, substring: string): boolean;
|
|
516
|
+
notContains(str: string, substring: string): boolean;
|
|
517
|
+
isArray(arr: unknown): boolean;
|
|
518
|
+
arrayLength(arr: unknown[], min: number, max?: number): boolean;
|
|
519
|
+
arrayMinLength(arr: unknown[], min: number): boolean;
|
|
520
|
+
arrayMaxLength(arr: unknown[], max: number): boolean;
|
|
521
|
+
isObject(obj: unknown): boolean;
|
|
522
|
+
hasKeys(obj: Record<string, unknown>, keys: string[]): boolean;
|
|
523
|
+
validate(obj: Record<string, unknown>, rules: Record<string, (string | ((value: unknown, obj: Record<string, unknown>) => boolean | string)[])[]>): {
|
|
524
|
+
valid: boolean;
|
|
525
|
+
errors: Record<string, string[]>;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
crypto: {
|
|
530
|
+
md5(str: string): string;
|
|
531
|
+
sha256(str: string): string;
|
|
532
|
+
base64Encode(str: string): string;
|
|
533
|
+
base64Decode(str: string): string;
|
|
534
|
+
uuid(): string;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
preload: {
|
|
538
|
+
loadImage(url: string, options?: { crossOrigin?: string }): Promise<HTMLImageElement>;
|
|
539
|
+
loadImages(urls: string[], options?: { crossOrigin?: string; parallel?: boolean }): Promise<HTMLImageElement[]>;
|
|
540
|
+
loadScript(url: string, options?: { type?: string; async?: boolean; defer?: boolean }): Promise<HTMLScriptElement>;
|
|
541
|
+
loadStylesheet(url: string, options?: { media?: string }): Promise<HTMLLinkElement>;
|
|
542
|
+
loadFont(fontFamily: string, src: string, options?: { weight?: string; style?: string }): Promise<FontFace>;
|
|
543
|
+
preload(url: string, type?: 'image' | 'script' | 'stylesheet' | 'style'): Promise<HTMLImageElement | HTMLScriptElement | HTMLLinkElement>;
|
|
544
|
+
isLoaded(url: string): boolean;
|
|
545
|
+
clearCache(): void;
|
|
546
|
+
clearCacheByUrl(url: string): void;
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
declare const kupolaUtils: KupolaUtils;
|
|
551
|
+
|
|
552
|
+
declare interface FormState {
|
|
553
|
+
valid: boolean;
|
|
554
|
+
errors: Record<string, string>;
|
|
555
|
+
errorCount: number;
|
|
556
|
+
loading: boolean;
|
|
557
|
+
submitting: boolean;
|
|
558
|
+
disabled: boolean;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
declare class KupolaValidator {
|
|
562
|
+
constructor();
|
|
563
|
+
|
|
564
|
+
addValidator(name: string, callback: (value: unknown, params: unknown[]) => boolean): void;
|
|
565
|
+
addAsyncValidator(name: string, callback: (value: unknown, params: unknown[], input: HTMLElement) => Promise<boolean>): void;
|
|
566
|
+
|
|
567
|
+
validate(form: HTMLFormElement): boolean;
|
|
568
|
+
validateAsync(form: HTMLFormElement, options?: { group?: string }): Promise<boolean>;
|
|
569
|
+
validateInput(input: HTMLElement): boolean;
|
|
570
|
+
validateInputAsync(input: HTMLElement): Promise<boolean>;
|
|
571
|
+
validateGroup(form: HTMLFormElement, groupName: string): Promise<boolean>;
|
|
572
|
+
getGroups(form: HTMLFormElement): string[];
|
|
573
|
+
|
|
574
|
+
getFormState(form: HTMLFormElement): FormState;
|
|
575
|
+
updateFormState(form: HTMLFormElement): void;
|
|
576
|
+
setFormLoading(form: HTMLFormElement, loading: boolean): void;
|
|
577
|
+
setFormSubmitting(form: HTMLFormElement, submitting: boolean): void;
|
|
578
|
+
setFormDisabled(form: HTMLFormElement, disabled: boolean): void;
|
|
579
|
+
resetForm(form: HTMLFormElement): void;
|
|
580
|
+
|
|
581
|
+
showError(input: HTMLElement, message: string): void;
|
|
582
|
+
clearError(input: HTMLElement): void;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
declare const validator: KupolaValidator;
|
|
586
|
+
|
|
587
|
+
declare class KupolaRouter {
|
|
588
|
+
constructor(options: RouterOptions);
|
|
589
|
+
|
|
590
|
+
push(path: string): void;
|
|
591
|
+
replace(path: string): void;
|
|
592
|
+
go(delta: number): void;
|
|
593
|
+
back(): void;
|
|
594
|
+
forward(): void;
|
|
595
|
+
|
|
596
|
+
readonly currentRoute: RouteConfig | null;
|
|
597
|
+
readonly path: string;
|
|
598
|
+
readonly params: Record<string, string>;
|
|
599
|
+
readonly query: Record<string, string>;
|
|
600
|
+
|
|
601
|
+
beforeEach(callback: (to: RouteConfig, from: RouteConfig | null) => boolean | void | Promise<boolean>): void;
|
|
602
|
+
afterEach(callback: (to: RouteConfig) => void): void;
|
|
603
|
+
|
|
604
|
+
setAnimation(name: string): void;
|
|
605
|
+
|
|
606
|
+
destroy(): void;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
declare class KupolaHttp {
|
|
610
|
+
constructor(options?: HttpOptions);
|
|
611
|
+
|
|
612
|
+
get<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
613
|
+
post<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
614
|
+
put<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
615
|
+
delete<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
616
|
+
patch<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
617
|
+
|
|
618
|
+
uploadFile<T = unknown>(url: string, file: File, options?: UploadOptions): Promise<HttpResponse<T>>;
|
|
619
|
+
|
|
620
|
+
setHeader(name: string, value: string): void;
|
|
621
|
+
setToken(token: string, type?: string): void;
|
|
622
|
+
setCacheTTL(ttl: number): void;
|
|
623
|
+
setMaxRetries(retries: number): void;
|
|
624
|
+
|
|
625
|
+
cancelRequest(url: string, params?: Record<string, string | number | boolean>): boolean;
|
|
626
|
+
clearCache(): void;
|
|
627
|
+
clearCacheByUrl(url: string): void;
|
|
628
|
+
|
|
629
|
+
interceptors: HttpInterceptor;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
interface ComponentMixin {
|
|
633
|
+
[key: string]: unknown;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
declare class KupolaComponent {
|
|
637
|
+
constructor(element: HTMLElement);
|
|
638
|
+
|
|
639
|
+
readonly element: HTMLElement;
|
|
640
|
+
readonly isMounted: boolean;
|
|
641
|
+
readonly isDestroyed: boolean;
|
|
642
|
+
props: Record<string, unknown>;
|
|
643
|
+
state: Record<string, unknown>;
|
|
644
|
+
slots: Record<string, string>;
|
|
645
|
+
|
|
646
|
+
$slot(name?: string): string;
|
|
647
|
+
$emit<T = unknown>(eventName: string, data?: T): void;
|
|
648
|
+
$on<T = unknown>(eventName: string, handler: (data: T) => void): (data: T) => void;
|
|
649
|
+
$off<T = unknown>(eventName: string, handler: (data: T) => void): void;
|
|
650
|
+
|
|
651
|
+
setProps(newProps: Record<string, unknown>): void;
|
|
652
|
+
setState(newState: Record<string, unknown>): void;
|
|
653
|
+
|
|
654
|
+
mount(): Promise<void>;
|
|
655
|
+
unmount(): Promise<void>;
|
|
656
|
+
|
|
657
|
+
beforeMount(): void;
|
|
658
|
+
afterMount(): void;
|
|
659
|
+
beforeUnmount(): void;
|
|
660
|
+
afterUnmount(): void;
|
|
661
|
+
updated(): void;
|
|
662
|
+
render(): void;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare class KupolaComponentRegistry {
|
|
666
|
+
constructor();
|
|
667
|
+
|
|
668
|
+
register(name: string, componentClass: typeof KupolaComponent): void;
|
|
669
|
+
registerLazy(name: string, loader: () => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>): void;
|
|
670
|
+
unregister(name: string): void;
|
|
671
|
+
get(name: string): typeof KupolaComponent | undefined;
|
|
672
|
+
getAsync(name: string): Promise<typeof KupolaComponent>;
|
|
673
|
+
|
|
674
|
+
defineMixin(name: string, mixin: ComponentMixin): void;
|
|
675
|
+
useMixin(componentClass: typeof KupolaComponent, ...mixinNames: string[]): void;
|
|
676
|
+
|
|
677
|
+
bootstrap(root?: HTMLElement | Document): Promise<void>;
|
|
678
|
+
destroy(): void;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
declare class KupolaStatePersist {
|
|
682
|
+
constructor();
|
|
683
|
+
|
|
684
|
+
persist(key: string, options?: PersistOptions): void;
|
|
685
|
+
unpersist(key: string): void;
|
|
686
|
+
loadPersisted(): Record<string, unknown>;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
declare class Heatmap {
|
|
690
|
+
constructor(element: HTMLElement, options?: HeatmapOptions);
|
|
691
|
+
|
|
692
|
+
render(): void;
|
|
693
|
+
updateData(data: Array<{ date: string; value: number }>): void;
|
|
694
|
+
setColor(color: string): void;
|
|
695
|
+
destroy(): void;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
interface VirtualListOptions<T = unknown> {
|
|
699
|
+
data?: T[];
|
|
700
|
+
itemHeight?: number;
|
|
701
|
+
itemWidth?: number;
|
|
702
|
+
bufferSize?: number;
|
|
703
|
+
renderItem?: (item: T, index: number) => string;
|
|
704
|
+
onItemClick?: (info: { item: T; index: number; key: string | number }) => void;
|
|
705
|
+
onItemSelect?: (info: { item: T; index: number; key: string | number }) => void;
|
|
706
|
+
onScroll?: (info: { scrollOffset: number; isHorizontal: boolean; dataLength: number; startIndex: number; endIndex: number }) => void;
|
|
707
|
+
onScrollEnd?: (info: { scrollOffset: number; isHorizontal: boolean; dataLength: number; startIndex: number; endIndex: number }) => void;
|
|
708
|
+
selectedKey?: string | number;
|
|
709
|
+
keyField?: string;
|
|
710
|
+
useDynamicHeight?: boolean;
|
|
711
|
+
estimatedHeight?: number;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
declare class VirtualList<T = unknown> {
|
|
715
|
+
constructor(element: HTMLElement, options?: VirtualListOptions<T>);
|
|
716
|
+
|
|
717
|
+
render(): void;
|
|
718
|
+
update(): void;
|
|
719
|
+
setData(data: T[]): void;
|
|
720
|
+
addItem(item: T): void;
|
|
721
|
+
removeItem(index: number): void;
|
|
722
|
+
insertItem(index: number, item: T): void;
|
|
723
|
+
scrollTo(index: number, behavior?: 'smooth' | 'auto'): void;
|
|
724
|
+
scrollToKey(key: string | number, behavior?: 'smooth' | 'auto'): void;
|
|
725
|
+
scrollToTop(behavior?: 'smooth' | 'auto'): void;
|
|
726
|
+
scrollToBottom(behavior?: 'smooth' | 'auto'): void;
|
|
727
|
+
select(key: string | number): void;
|
|
728
|
+
getVisibleItems(): { item: T; index: number; key: string | number }[];
|
|
729
|
+
getItemIndex(key: string | number): number;
|
|
730
|
+
getItem(key: string | number): T | null;
|
|
731
|
+
refreshCache(): void;
|
|
732
|
+
destroy(): void;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
declare const kupolaData: KupolaDataBind<Record<string, unknown>>;
|
|
736
|
+
declare const kupolaEvents: KupolaEventBus;
|
|
737
|
+
|
|
738
|
+
declare function initTheme(): void;
|
|
739
|
+
declare function initTooltip(): void;
|
|
740
|
+
declare function initDatepickers(): void;
|
|
741
|
+
declare function initTimepickers(): void;
|
|
742
|
+
declare function initNumberInputs(): void;
|
|
743
|
+
declare function initFileUploads(): void;
|
|
744
|
+
declare function initValidation(): void;
|
|
745
|
+
|
|
746
|
+
declare function setTheme(theme: ThemeType): void;
|
|
747
|
+
declare function getTheme(): ThemeType;
|
|
748
|
+
declare function toggleTheme(): void;
|
|
749
|
+
|
|
750
|
+
declare function setBrand(brand: BrandColor): void;
|
|
751
|
+
declare function getBrand(): BrandColor;
|
|
752
|
+
declare const BRAND_OPTIONS: readonly BrandOption[];
|
|
753
|
+
|
|
754
|
+
declare function showToast(options: ToastOptions | string): void;
|
|
755
|
+
declare function showSuccess(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
756
|
+
declare function showError(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
757
|
+
declare function showWarning(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
758
|
+
declare function showInfo(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
759
|
+
|
|
760
|
+
declare function showModal(options: ModalOptions): Promise<void>;
|
|
761
|
+
declare function showConfirm(title: string, content: string): Promise<boolean>;
|
|
762
|
+
declare function showAlert(content: string, title?: string): Promise<void>;
|
|
763
|
+
|
|
764
|
+
declare function showNotification(options: NotificationOptions): void;
|
|
765
|
+
|
|
766
|
+
declare function createRouter(options: RouterOptions): KupolaRouter;
|
|
767
|
+
|
|
768
|
+
declare function createHttp(options?: HttpOptions): KupolaHttp;
|
|
769
|
+
|
|
770
|
+
declare function registerComponent(name: string, componentClass: typeof KupolaComponent): void;
|
|
771
|
+
|
|
772
|
+
declare function registerLazyComponent(name: string, loader: () => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>): void;
|
|
773
|
+
|
|
774
|
+
declare function bootstrapComponents(root?: HTMLElement | Document): Promise<void>;
|
|
775
|
+
|
|
776
|
+
declare function defineMixin(name: string, mixin: ComponentMixin): void;
|
|
777
|
+
|
|
778
|
+
declare function useMixin(componentClass: typeof KupolaComponent, ...mixinNames: string[]): void;
|
|
779
|
+
|
|
780
|
+
declare const kupolaRegistry: KupolaComponentRegistry;
|
|
781
|
+
|
|
782
|
+
declare const kupolaPersist: KupolaStatePersist;
|
|
783
|
+
|
|
784
|
+
declare const kupolaStoreManager: KupolaStoreManager;
|
|
785
|
+
|
|
786
|
+
declare class KupolaDevTools {
|
|
787
|
+
constructor(options?: { enabled?: boolean });
|
|
788
|
+
|
|
789
|
+
init(): void;
|
|
790
|
+
togglePanel(): void;
|
|
791
|
+
switchTab(tabName: 'storage' | 'network'): void;
|
|
792
|
+
renderStorageContent(): void;
|
|
793
|
+
renderNetworkContent(): void;
|
|
794
|
+
clearNetworkHistory(): void;
|
|
795
|
+
addRequest(entry: NetworkRequest): void;
|
|
796
|
+
updateRequest(entry: NetworkRequest): void;
|
|
797
|
+
destroy(): void;
|
|
798
|
+
|
|
799
|
+
enabled: boolean;
|
|
800
|
+
isOpen: boolean;
|
|
801
|
+
activeTab: 'storage' | 'network';
|
|
802
|
+
activeStorageType: 'cookies' | 'localStorage' | 'sessionStorage';
|
|
803
|
+
requestHistory: NetworkRequest[];
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
interface NetworkRequest {
|
|
807
|
+
id?: number;
|
|
808
|
+
method: string;
|
|
809
|
+
url: string;
|
|
810
|
+
params?: Record<string, string>;
|
|
811
|
+
requestBody?: string;
|
|
812
|
+
status: number;
|
|
813
|
+
response?: unknown;
|
|
814
|
+
duration?: number;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
declare const kupolaDevTools: KupolaDevTools;
|
|
818
|
+
|
|
819
|
+
declare function initDevTools(): void;
|
|
820
|
+
|
|
821
|
+
declare function createStore<S extends object = Record<string, unknown>>(name: string, options?: StoreOptions<S>): KupolaStore<S>;
|
|
822
|
+
|
|
823
|
+
declare function getStore<S extends object = Record<string, unknown>>(name: string): KupolaStore<S> | undefined;
|
|
824
|
+
|
|
825
|
+
declare module 'kupola' {
|
|
826
|
+
export type Primitive = string | number | boolean | null | undefined;
|
|
827
|
+
|
|
828
|
+
export type Reactive<T> = T extends Primitive
|
|
829
|
+
? T
|
|
830
|
+
: T extends Array<infer U>
|
|
831
|
+
? Reactive<U>[]
|
|
832
|
+
: T extends object
|
|
833
|
+
? { [K in keyof T]: Reactive<T[K]> }
|
|
834
|
+
: T;
|
|
835
|
+
|
|
836
|
+
export type ThemeType = 'dark' | 'light';
|
|
837
|
+
export type BrandColor =
|
|
838
|
+
| 'zengqing'
|
|
839
|
+
| 'green'
|
|
840
|
+
| 'xionghuang'
|
|
841
|
+
| 'jianghuang'
|
|
842
|
+
| 'lanlv'
|
|
843
|
+
| 'kongquelan'
|
|
844
|
+
| 'meiguizi'
|
|
845
|
+
| 'shihong'
|
|
846
|
+
| 'shanchahong'
|
|
847
|
+
| 'quhong'
|
|
848
|
+
| 'roulan';
|
|
849
|
+
export type BindingType =
|
|
850
|
+
| 'text'
|
|
851
|
+
| 'html'
|
|
852
|
+
| 'value'
|
|
853
|
+
| 'checked'
|
|
854
|
+
| 'disabled'
|
|
855
|
+
| 'hidden'
|
|
856
|
+
| 'class'
|
|
857
|
+
| 'style'
|
|
858
|
+
| 'attr'
|
|
859
|
+
| 'src'
|
|
860
|
+
| 'href'
|
|
861
|
+
| 'placeholder';
|
|
862
|
+
|
|
863
|
+
export interface BrandOption {
|
|
864
|
+
id: BrandColor;
|
|
865
|
+
name: string;
|
|
866
|
+
color: string;
|
|
867
|
+
}
|
|
868
|
+
export interface PersistOptions {
|
|
869
|
+
storage?: 'local' | 'session';
|
|
870
|
+
debounce?: number;
|
|
871
|
+
}
|
|
872
|
+
export interface RouteConfig {
|
|
873
|
+
path: string;
|
|
874
|
+
component: string | (() => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>);
|
|
875
|
+
name?: string;
|
|
876
|
+
meta?: Record<string, unknown>;
|
|
877
|
+
children?: RouteConfig[];
|
|
878
|
+
}
|
|
879
|
+
export interface RouterOptions {
|
|
880
|
+
mode?: 'hash' | 'history';
|
|
881
|
+
routes: RouteConfig[];
|
|
882
|
+
base?: string;
|
|
883
|
+
}
|
|
884
|
+
export interface HttpRequestConfig {
|
|
885
|
+
url: string;
|
|
886
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
887
|
+
headers?: Record<string, string>;
|
|
888
|
+
params?: Record<string, string | number | boolean>;
|
|
889
|
+
data?: Record<string, unknown> | unknown[];
|
|
890
|
+
timeout?: number;
|
|
891
|
+
withCredentials?: boolean;
|
|
892
|
+
responseType?: 'json' | 'text' | 'blob' | 'formData';
|
|
893
|
+
}
|
|
894
|
+
export interface HttpResponse<T = unknown> {
|
|
895
|
+
data: T;
|
|
896
|
+
status: number;
|
|
897
|
+
statusText: string;
|
|
898
|
+
headers: Record<string, string>;
|
|
899
|
+
config: HttpRequestConfig;
|
|
900
|
+
}
|
|
901
|
+
export interface HttpError {
|
|
902
|
+
message: string;
|
|
903
|
+
code?: number;
|
|
904
|
+
response?: HttpResponse;
|
|
905
|
+
config: HttpRequestConfig;
|
|
906
|
+
}
|
|
907
|
+
export interface HttpInterceptor {
|
|
908
|
+
request?: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
|
|
909
|
+
requestError?: (error: unknown) => Promise<never>;
|
|
910
|
+
response?: <T = unknown>(response: HttpResponse<T>) => HttpResponse<T> | Promise<HttpResponse<T>>;
|
|
911
|
+
responseError?: (error: HttpError) => Promise<never>;
|
|
912
|
+
}
|
|
913
|
+
export interface HttpOptions {
|
|
914
|
+
baseURL?: string;
|
|
915
|
+
timeout?: number;
|
|
916
|
+
headers?: Record<string, string>;
|
|
917
|
+
interceptors?: HttpInterceptor;
|
|
918
|
+
cacheTTL?: number;
|
|
919
|
+
maxRetries?: number;
|
|
920
|
+
retryDelay?: number;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
export interface UploadProgress {
|
|
924
|
+
progress: number;
|
|
925
|
+
uploaded: number;
|
|
926
|
+
total: number;
|
|
927
|
+
currentChunk: number;
|
|
928
|
+
totalChunks: number;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
export interface UploadOptions {
|
|
932
|
+
chunkSize?: number;
|
|
933
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
934
|
+
headers?: Record<string, string>;
|
|
935
|
+
abortController?: AbortController;
|
|
936
|
+
parallel?: boolean;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export interface FormState {
|
|
940
|
+
valid: boolean;
|
|
941
|
+
errors: Record<string, string>;
|
|
942
|
+
errorCount: number;
|
|
943
|
+
loading: boolean;
|
|
944
|
+
submitting: boolean;
|
|
945
|
+
disabled: boolean;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export interface HttpRequestConfig {
|
|
949
|
+
url: string;
|
|
950
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
951
|
+
headers?: Record<string, string>;
|
|
952
|
+
params?: Record<string, string | number | boolean>;
|
|
953
|
+
data?: Record<string, unknown> | unknown[];
|
|
954
|
+
timeout?: number;
|
|
955
|
+
withCredentials?: boolean;
|
|
956
|
+
responseType?: 'json' | 'text' | 'blob' | 'formData';
|
|
957
|
+
cache?: boolean;
|
|
958
|
+
retry?: boolean;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
export interface StoreOptions<S extends object = Record<string, unknown>> {
|
|
962
|
+
state?: () => S;
|
|
963
|
+
getters?: Record<string, (state: S) => unknown>;
|
|
964
|
+
actions?: Record<string, (context: StoreContext<S>) => unknown | Promise<unknown>>;
|
|
965
|
+
mutations?: Record<string, (state: S, payload?: unknown) => void>;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
export interface StoreContext<S extends object = Record<string, unknown>> {
|
|
969
|
+
state: S;
|
|
970
|
+
commit: (type: string, payload?: unknown) => void;
|
|
971
|
+
dispatch: (type: string, payload?: unknown) => unknown | Promise<unknown>;
|
|
972
|
+
getters: Record<string, unknown>;
|
|
973
|
+
}
|
|
974
|
+
export interface ToastOptions {
|
|
975
|
+
message: string;
|
|
976
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
977
|
+
duration?: number;
|
|
978
|
+
position?: 'top' | 'bottom' | 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
|
|
979
|
+
}
|
|
980
|
+
export interface ModalOptions {
|
|
981
|
+
title?: string;
|
|
982
|
+
content: string | HTMLElement;
|
|
983
|
+
width?: string | number;
|
|
984
|
+
confirmText?: string;
|
|
985
|
+
cancelText?: string;
|
|
986
|
+
showCancel?: boolean;
|
|
987
|
+
onConfirm?: () => void | Promise<void>;
|
|
988
|
+
onCancel?: () => void;
|
|
989
|
+
}
|
|
990
|
+
export interface NotificationOptions {
|
|
991
|
+
title: string;
|
|
992
|
+
message: string;
|
|
993
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
994
|
+
duration?: number;
|
|
995
|
+
onClick?: () => void;
|
|
996
|
+
onClose?: () => void;
|
|
997
|
+
}
|
|
998
|
+
export interface DatepickerOptions {
|
|
999
|
+
format?: string;
|
|
1000
|
+
minDate?: Date | string;
|
|
1001
|
+
maxDate?: Date | string;
|
|
1002
|
+
disabledDates?: (date: Date) => boolean;
|
|
1003
|
+
}
|
|
1004
|
+
export interface TimepickerOptions {
|
|
1005
|
+
format?: '12h' | '24h';
|
|
1006
|
+
minTime?: string;
|
|
1007
|
+
maxTime?: string;
|
|
1008
|
+
}
|
|
1009
|
+
export interface NumberInputOptions {
|
|
1010
|
+
min?: number;
|
|
1011
|
+
max?: number;
|
|
1012
|
+
step?: number;
|
|
1013
|
+
precision?: number;
|
|
1014
|
+
}
|
|
1015
|
+
export interface HeatmapCell {
|
|
1016
|
+
date: string;
|
|
1017
|
+
value: number;
|
|
1018
|
+
level: number;
|
|
1019
|
+
element: HTMLElement;
|
|
1020
|
+
}
|
|
1021
|
+
export interface HeatmapOptions {
|
|
1022
|
+
data?: Array<{ date: string; value: number }>;
|
|
1023
|
+
startDate?: Date;
|
|
1024
|
+
endDate?: Date;
|
|
1025
|
+
cellSize?: number;
|
|
1026
|
+
color?: string;
|
|
1027
|
+
onCellClick?: (cell: HeatmapCell) => void;
|
|
1028
|
+
}
|
|
1029
|
+
export interface VirtualListItem<T = unknown> {
|
|
1030
|
+
data: T;
|
|
1031
|
+
index: number;
|
|
1032
|
+
element: HTMLElement;
|
|
1033
|
+
}
|
|
1034
|
+
export interface VirtualListOptions<T = unknown> {
|
|
1035
|
+
data?: T[];
|
|
1036
|
+
itemHeight?: number;
|
|
1037
|
+
containerHeight?: number;
|
|
1038
|
+
renderItem?: (item: T, index: number) => string;
|
|
1039
|
+
onItemClick?: (item: VirtualListItem<T>) => void;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export class KupolaDataBind<T extends object = Record<string, unknown>> {
|
|
1043
|
+
constructor();
|
|
1044
|
+
|
|
1045
|
+
data: Reactive<T>;
|
|
1046
|
+
rawData: T;
|
|
1047
|
+
|
|
1048
|
+
set<K extends keyof T>(key: K, value: T[K], silent?: boolean): void;
|
|
1049
|
+
set<V = unknown>(key: string, value: V, silent?: boolean): void;
|
|
1050
|
+
set(data: Partial<T>, silent?: boolean): void;
|
|
1051
|
+
|
|
1052
|
+
get<K extends keyof T>(key: K): T[K];
|
|
1053
|
+
get<V = unknown>(key: string): V;
|
|
1054
|
+
|
|
1055
|
+
observe<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
|
1056
|
+
observe<V = unknown>(key: string, callback: (newValue: V, oldValue: V) => void): void;
|
|
1057
|
+
observe(callback: (key: string, newValue: unknown, oldValue: unknown) => void): void;
|
|
1058
|
+
|
|
1059
|
+
unobserve<K extends keyof T>(key: K, callback: (newValue: T[K], oldValue: T[K]) => void): void;
|
|
1060
|
+
unobserve<V = unknown>(key: string, callback: (newValue: V, oldValue: V) => void): void;
|
|
1061
|
+
|
|
1062
|
+
computed<K extends string, R = unknown>(name: K, deps: (keyof T | string)[], callback: (...args: unknown[]) => R): void;
|
|
1063
|
+
|
|
1064
|
+
bind(): void;
|
|
1065
|
+
load(data: Partial<T>): void;
|
|
1066
|
+
reset(): void;
|
|
1067
|
+
destroy(): void;
|
|
1068
|
+
|
|
1069
|
+
persist<K extends keyof T>(key: K, options?: PersistOptions): void;
|
|
1070
|
+
persist(key: string, options?: PersistOptions): void;
|
|
1071
|
+
unpersist<K extends keyof T>(key: K): void;
|
|
1072
|
+
unpersist(key: string): void;
|
|
1073
|
+
|
|
1074
|
+
snapshot(): number;
|
|
1075
|
+
rollback(index?: number): boolean;
|
|
1076
|
+
getSnapshotCount(): number;
|
|
1077
|
+
clearSnapshots(): void;
|
|
1078
|
+
|
|
1079
|
+
serializeForm(formElement: HTMLFormElement): Record<string, unknown>;
|
|
1080
|
+
fillForm(formElement: HTMLFormElement, data: Record<string, unknown>): void;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
export class KupolaEventBus {
|
|
1084
|
+
constructor();
|
|
1085
|
+
|
|
1086
|
+
on<T = unknown>(eventName: string, callback: (data: T) => void): () => void;
|
|
1087
|
+
on(callback: (eventName: string, data: unknown) => void): void;
|
|
1088
|
+
|
|
1089
|
+
off<T = unknown>(eventName: string, callback: (data: T) => void): void;
|
|
1090
|
+
off(callback: (eventName: string, data: unknown) => void): void;
|
|
1091
|
+
|
|
1092
|
+
emit<T = unknown>(eventName: string, data: T): void;
|
|
1093
|
+
|
|
1094
|
+
once<T = unknown>(eventName: string, callback: (data: T) => void): () => void;
|
|
1095
|
+
once(callback: (eventName: string, data: unknown) => void): void;
|
|
1096
|
+
|
|
1097
|
+
delegate(selector: string, eventName: string, callback: (event: Event) => void): () => void;
|
|
1098
|
+
undelegate(selector: string, eventName: string): void;
|
|
1099
|
+
|
|
1100
|
+
destroy(): void;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
export class KupolaStore<S extends object = Record<string, unknown>> {
|
|
1104
|
+
constructor(name: string, options?: StoreOptions<S>);
|
|
1105
|
+
|
|
1106
|
+
readonly name: string;
|
|
1107
|
+
readonly state: S;
|
|
1108
|
+
|
|
1109
|
+
commit(type: string, payload?: unknown): void;
|
|
1110
|
+
dispatch(type: string, payload?: unknown): unknown | Promise<unknown>;
|
|
1111
|
+
|
|
1112
|
+
observe(callback: (newState: S, oldState: S) => void): () => void;
|
|
1113
|
+
unobserve(callback: (newState: S, oldState: S) => void): void;
|
|
1114
|
+
|
|
1115
|
+
toJSON(): { name: string; state: S; getters: Record<string, unknown> };
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
export class KupolaStoreManager {
|
|
1119
|
+
constructor();
|
|
1120
|
+
|
|
1121
|
+
createStore<S extends object = Record<string, unknown>>(name: string, options?: StoreOptions<S>): KupolaStore<S>;
|
|
1122
|
+
getStore<S extends object = Record<string, unknown>>(name: string): KupolaStore<S> | undefined;
|
|
1123
|
+
registerStore(store: KupolaStore): void;
|
|
1124
|
+
dispose(): void;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
export class KupolaRouter {
|
|
1128
|
+
constructor(options: RouterOptions);
|
|
1129
|
+
|
|
1130
|
+
push(path: string): void;
|
|
1131
|
+
replace(path: string): void;
|
|
1132
|
+
go(delta: number): void;
|
|
1133
|
+
back(): void;
|
|
1134
|
+
forward(): void;
|
|
1135
|
+
|
|
1136
|
+
readonly currentRoute: RouteConfig | null;
|
|
1137
|
+
readonly path: string;
|
|
1138
|
+
readonly params: Record<string, string>;
|
|
1139
|
+
readonly query: Record<string, string>;
|
|
1140
|
+
|
|
1141
|
+
beforeEach(callback: (to: RouteConfig, from: RouteConfig | null) => boolean | void | Promise<boolean>): void;
|
|
1142
|
+
afterEach(callback: (to: RouteConfig) => void): void;
|
|
1143
|
+
|
|
1144
|
+
setAnimation(name: string): void;
|
|
1145
|
+
|
|
1146
|
+
destroy(): void;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
export class KupolaHttp {
|
|
1150
|
+
constructor(options?: HttpOptions);
|
|
1151
|
+
|
|
1152
|
+
get<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
1153
|
+
post<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
1154
|
+
put<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
1155
|
+
delete<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
1156
|
+
patch<T = unknown>(url: string, data?: HttpRequestConfig['data'], config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
1157
|
+
|
|
1158
|
+
uploadFile<T = unknown>(url: string, file: File, options?: UploadOptions): Promise<HttpResponse<T>>;
|
|
1159
|
+
|
|
1160
|
+
setHeader(name: string, value: string): void;
|
|
1161
|
+
setToken(token: string, type?: string): void;
|
|
1162
|
+
setCacheTTL(ttl: number): void;
|
|
1163
|
+
setMaxRetries(retries: number): void;
|
|
1164
|
+
|
|
1165
|
+
cancelRequest(url: string, params?: Record<string, string | number | boolean>): boolean;
|
|
1166
|
+
clearCache(): void;
|
|
1167
|
+
clearCacheByUrl(url: string): void;
|
|
1168
|
+
|
|
1169
|
+
interceptors: HttpInterceptor;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
export interface ComponentMixin {
|
|
1173
|
+
[key: string]: unknown;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
export class KupolaComponent {
|
|
1177
|
+
constructor(element: HTMLElement);
|
|
1178
|
+
|
|
1179
|
+
readonly element: HTMLElement;
|
|
1180
|
+
readonly isMounted: boolean;
|
|
1181
|
+
readonly isDestroyed: boolean;
|
|
1182
|
+
props: Record<string, unknown>;
|
|
1183
|
+
state: Record<string, unknown>;
|
|
1184
|
+
slots: Record<string, string>;
|
|
1185
|
+
|
|
1186
|
+
$slot(name?: string): string;
|
|
1187
|
+
$emit<T = unknown>(eventName: string, data?: T): void;
|
|
1188
|
+
$on<T = unknown>(eventName: string, handler: (data: T) => void): (data: T) => void;
|
|
1189
|
+
$off<T = unknown>(eventName: string, handler: (data: T) => void): void;
|
|
1190
|
+
|
|
1191
|
+
setProps(newProps: Record<string, unknown>): void;
|
|
1192
|
+
setState(newState: Record<string, unknown>): void;
|
|
1193
|
+
|
|
1194
|
+
mount(): void;
|
|
1195
|
+
unmount(): void;
|
|
1196
|
+
|
|
1197
|
+
beforeMount(): void;
|
|
1198
|
+
afterMount(): void;
|
|
1199
|
+
beforeUnmount(): void;
|
|
1200
|
+
afterUnmount(): void;
|
|
1201
|
+
updated(): void;
|
|
1202
|
+
render(): void;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
export class KupolaComponentRegistry {
|
|
1206
|
+
constructor();
|
|
1207
|
+
|
|
1208
|
+
register(name: string, componentClass: typeof KupolaComponent): void;
|
|
1209
|
+
registerLazy(name: string, loader: () => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>): void;
|
|
1210
|
+
unregister(name: string): void;
|
|
1211
|
+
get(name: string): typeof KupolaComponent | undefined;
|
|
1212
|
+
getAsync(name: string): Promise<typeof KupolaComponent>;
|
|
1213
|
+
|
|
1214
|
+
defineMixin(name: string, mixin: ComponentMixin): void;
|
|
1215
|
+
useMixin(componentClass: typeof KupolaComponent, ...mixinNames: string[]): void;
|
|
1216
|
+
|
|
1217
|
+
bootstrap(root?: HTMLElement | Document): Promise<void>;
|
|
1218
|
+
destroy(): void;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export interface NetworkRequest {
|
|
1222
|
+
id?: number;
|
|
1223
|
+
method: string;
|
|
1224
|
+
url: string;
|
|
1225
|
+
params?: Record<string, string>;
|
|
1226
|
+
requestBody?: string;
|
|
1227
|
+
status: number;
|
|
1228
|
+
response?: unknown;
|
|
1229
|
+
duration?: number;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
export class KupolaDevTools {
|
|
1233
|
+
constructor(options?: { enabled?: boolean });
|
|
1234
|
+
|
|
1235
|
+
init(): void;
|
|
1236
|
+
togglePanel(): void;
|
|
1237
|
+
switchTab(tabName: 'storage' | 'network'): void;
|
|
1238
|
+
renderStorageContent(): void;
|
|
1239
|
+
renderNetworkContent(): void;
|
|
1240
|
+
clearNetworkHistory(): void;
|
|
1241
|
+
addRequest(entry: NetworkRequest): void;
|
|
1242
|
+
updateRequest(entry: NetworkRequest): void;
|
|
1243
|
+
destroy(): void;
|
|
1244
|
+
|
|
1245
|
+
enabled: boolean;
|
|
1246
|
+
isOpen: boolean;
|
|
1247
|
+
activeTab: 'storage' | 'network';
|
|
1248
|
+
activeStorageType: 'cookies' | 'localStorage' | 'sessionStorage';
|
|
1249
|
+
requestHistory: NetworkRequest[];
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
export class KupolaStatePersist {
|
|
1253
|
+
constructor();
|
|
1254
|
+
|
|
1255
|
+
persist(key: string, options?: PersistOptions): void;
|
|
1256
|
+
unpersist(key: string): void;
|
|
1257
|
+
loadPersisted(): Record<string, unknown>;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export class Heatmap {
|
|
1261
|
+
constructor(element: HTMLElement, options?: HeatmapOptions);
|
|
1262
|
+
|
|
1263
|
+
render(): void;
|
|
1264
|
+
updateData(data: Array<{ date: string; value: number }>): void;
|
|
1265
|
+
setColor(color: string): void;
|
|
1266
|
+
destroy(): void;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
export class VirtualList<T = unknown> {
|
|
1270
|
+
constructor(element: HTMLElement, options?: VirtualListOptions<T>);
|
|
1271
|
+
|
|
1272
|
+
render(): void;
|
|
1273
|
+
updateData(data: T[]): void;
|
|
1274
|
+
scrollTo(index: number): void;
|
|
1275
|
+
destroy(): void;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
export const kupolaData: KupolaDataBind<Record<string, unknown>>;
|
|
1279
|
+
export const kupolaEvents: KupolaEventBus;
|
|
1280
|
+
export const kupolaRegistry: KupolaComponentRegistry;
|
|
1281
|
+
export const kupolaPersist: KupolaStatePersist;
|
|
1282
|
+
export const kupolaStoreManager: KupolaStoreManager;
|
|
1283
|
+
|
|
1284
|
+
export class KupolaValidator {
|
|
1285
|
+
constructor();
|
|
1286
|
+
|
|
1287
|
+
addValidator(name: string, callback: (value: unknown, params: unknown[]) => boolean): void;
|
|
1288
|
+
addAsyncValidator(name: string, callback: (value: unknown, params: unknown[], input: HTMLElement) => Promise<boolean>): void;
|
|
1289
|
+
|
|
1290
|
+
validate(form: HTMLFormElement): boolean;
|
|
1291
|
+
validateAsync(form: HTMLFormElement, options?: { group?: string }): Promise<boolean>;
|
|
1292
|
+
validateInput(input: HTMLElement): boolean;
|
|
1293
|
+
validateInputAsync(input: HTMLElement): Promise<boolean>;
|
|
1294
|
+
validateGroup(form: HTMLFormElement, groupName: string): Promise<boolean>;
|
|
1295
|
+
getGroups(form: HTMLFormElement): string[];
|
|
1296
|
+
|
|
1297
|
+
getFormState(form: HTMLFormElement): FormState;
|
|
1298
|
+
updateFormState(form: HTMLFormElement): void;
|
|
1299
|
+
setFormLoading(form: HTMLFormElement, loading: boolean): void;
|
|
1300
|
+
setFormSubmitting(form: HTMLFormElement, submitting: boolean): void;
|
|
1301
|
+
setFormDisabled(form: HTMLFormElement, disabled: boolean): void;
|
|
1302
|
+
resetForm(form: HTMLFormElement): void;
|
|
1303
|
+
|
|
1304
|
+
showError(input: HTMLElement, message: string): void;
|
|
1305
|
+
clearError(input: HTMLElement): void;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
export const validator: KupolaValidator;
|
|
1309
|
+
|
|
1310
|
+
export function initTheme(): void;
|
|
1311
|
+
export function initTooltip(): void;
|
|
1312
|
+
export function initDatepickers(): void;
|
|
1313
|
+
export function initTimepickers(): void;
|
|
1314
|
+
export function initNumberInputs(): void;
|
|
1315
|
+
export function initFileUploads(): void;
|
|
1316
|
+
export function initValidation(): void;
|
|
1317
|
+
|
|
1318
|
+
export function setTheme(theme: ThemeType): void;
|
|
1319
|
+
export function getTheme(): ThemeType;
|
|
1320
|
+
export function toggleTheme(): void;
|
|
1321
|
+
|
|
1322
|
+
export function setBrand(brand: BrandColor): void;
|
|
1323
|
+
export function getBrand(): BrandColor;
|
|
1324
|
+
export const BRAND_OPTIONS: readonly BrandOption[];
|
|
1325
|
+
|
|
1326
|
+
export function showToast(options: ToastOptions | string): void;
|
|
1327
|
+
export function showSuccess(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
1328
|
+
export function showError(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
1329
|
+
export function showWarning(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
1330
|
+
export function showInfo(message: string, options?: Omit<ToastOptions, 'message' | 'type'>): void;
|
|
1331
|
+
|
|
1332
|
+
export function showModal(options: ModalOptions): Promise<void>;
|
|
1333
|
+
export function showConfirm(title: string, content: string): Promise<boolean>;
|
|
1334
|
+
export function showAlert(content: string, title?: string): Promise<void>;
|
|
1335
|
+
|
|
1336
|
+
export function showNotification(options: NotificationOptions): void;
|
|
1337
|
+
|
|
1338
|
+
export function createRouter(options: RouterOptions): KupolaRouter;
|
|
1339
|
+
|
|
1340
|
+
export function createHttp(options?: HttpOptions): KupolaHttp;
|
|
1341
|
+
|
|
1342
|
+
export function registerComponent(name: string, componentClass: typeof KupolaComponent): void;
|
|
1343
|
+
|
|
1344
|
+
export function registerLazyComponent(name: string, loader: () => Promise<{ default: typeof KupolaComponent } | typeof KupolaComponent>): void;
|
|
1345
|
+
|
|
1346
|
+
export function bootstrapComponents(root?: HTMLElement | Document): Promise<void>;
|
|
1347
|
+
|
|
1348
|
+
export function defineMixin(name: string, mixin: ComponentMixin): void;
|
|
1349
|
+
|
|
1350
|
+
export function useMixin(componentClass: typeof KupolaComponent, ...mixinNames: string[]): void;
|
|
1351
|
+
|
|
1352
|
+
export function createStore<S extends object = Record<string, unknown>>(name: string, options?: StoreOptions<S>): KupolaStore<S>;
|
|
1353
|
+
|
|
1354
|
+
export function getStore<S extends object = Record<string, unknown>>(name: string): KupolaStore<S> | undefined;
|
|
1355
|
+
|
|
1356
|
+
export const kupolaDevTools: KupolaDevTools;
|
|
1357
|
+
|
|
1358
|
+
export function initDevTools(): void;
|
|
1359
|
+
}
|