diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75d4317..0d108f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
# Changelog
-## [1.0.13] - 2026-06-08
+## [1.0.14] - 2026-06-08
### Fixed
- **State Integration**: Bumped `@apigo.cc/state` to `1.0.18` to restore the globally injected `$`/`$$` helpers from the original UMD era, fixing `TagsInput` element targeting.
- **AutoForm Layout**: Fixed `horizontal` grid layout breakage caused by missing `AUTOFORM_STYLE` registration.
diff --git a/README.md b/README.md
index f7b329f..22e416e 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,33 @@
# @apigo.cc/base - AI 逻辑操作说明书 (示例驱动)
-本库是基于 `@apigo.cc/state` 增强的 UI 原子库,提供遵循 Bootstrap 5.3 规范的高阶业务组件。
+本库是基于 `@apigo.cc/state` 增强的 UI 原子库,提供遵循 Bootstrap 5.3 规范的高阶业务组件。本包采用完全的全局注入模式。
+
+---
+
+## 全局变量与核心 API 清单
+引入 `base.js` 后,以下对象将直接挂载到 `window` / `globalThis` 上,可随时随地调用:
+
+| 全局变量名 | 用途说明 |
+| :--- | :--- |
+| **`HTTP`** | 异步请求工具 (`HTTP.get`, `HTTP.post`, `HTTP.request` 等)。 |
+| **`UI`** | 交互组件触发器 (`UI.toast`, `UI.alert`, `UI.confirm`, `UI.showDialog`)。 |
+| **`AutoForm`** | 表单组件扩展注册器 (`AutoForm.register`) 和自定义控件库 (`AutoForm.customTypes`)。 |
+| **`MouseMover`** | 拖拽辅助工具 (`MouseMover.start`)。 |
+| **`VirtualScroll`** / **`List`** | 虚拟滚动列表核心算法类。 |
+
+*(注意:底层状态库 `@apigo.cc/state` 暴露的 `NewState`, `Hash`, `LocalStorage`, `State`, `$`, `$$`, `Component` 以及危险的高级 API `_unsafeRefreshState` 也在全局可用。严禁随意调用 `_unsafeRefreshState`。)*
---
## 1. 快速集成 (Quick Start)
-### 同步 UMD 集成 (推荐:消灭异步时序风险,实现“秒开”渲染)
将脚本放置在 `
` 中,确保地基在 DOM 解析前就绪:
```html
-
+
```
-### ESM 模块引入 (Legacy)
-```javascript
-const { HTTP, UI, AutoForm, State } = window.ApigoBase
-```
-
---
## 2. 组件超能力示例 (Mega Examples)
diff --git a/dist/base.js b/dist/base.js
index 54a45d9..6d27aaf 100644
--- a/dist/base.js
+++ b/dist/base.js
@@ -1,6 +1,4 @@
-(function(global, factory) {
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@apigo.cc/state"), require("@apigo.cc/bootstrap")) : typeof define === "function" && define.amd ? define(["exports", "@apigo.cc/state", "@apigo.cc/bootstrap"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.ApigoBase = {}, global.ApigoState));
-})(this, function(exports2, state) {
+(function(bootstrap$1, state) {
"use strict";
const HTTP = {
get: ({ url, ...opt }) => HTTP.request({ url, method: "GET", ...opt }),
@@ -51,7 +49,7 @@
return response;
}
};
- const APIComponent = state.Component.register("API", (container) => {
+ state.Component.register("API", (container) => {
container.request = state.NewState({ url: "", method: "GET", headers: {}, data: null, timeout: 1e4, responseType: "" });
container.response = state.NewState({ loading: false, ok: null, status: null, error: null, headers: {}, responseType: "", result: null });
container.result = state.NewState();
@@ -393,162 +391,66 @@
``
));
AutoForm.register("TagsInput");
- state.Component.register("DatePicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ start: "", end: "" });
+ let _mouseMoverMoving = false;
+ let _mouseMoverPos = {};
+ let _mouseMoverEvents = {};
+ const MouseMover = {
+ start: (event, { onmousemove, onmouseup }) => {
+ _mouseMoverPos = { x: event.clientX, y: event.clientY, w: 0, h: 0 };
+ _mouseMoverEvents = { onmousemove, onmouseup };
+ _mouseMoverMoving = true;
+ }
+ };
+ if (typeof document !== "undefined") {
+ document.addEventListener("mouseup", (event) => {
+ var _a;
+ if (!_mouseMoverMoving) return;
+ _mouseMoverMoving = false;
+ (_a = _mouseMoverEvents.onmouseup) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
+ });
+ document.addEventListener("mousemove", (event) => {
+ var _a;
+ if (!_mouseMoverMoving) return;
+ _mouseMoverPos.w = event.clientX - _mouseMoverPos.x;
+ _mouseMoverPos.h = event.clientY - _mouseMoverPos.y;
+ (_a = _mouseMoverEvents.onmousemove) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
+ });
+ }
+ state.Component.register("Resizer", (container) => {
+ container.isVertical = container.hasAttribute("vertical");
+ const min = parseInt(container.getAttribute("min")) || 10;
+ const max = parseInt(container.getAttribute("max")) || 1e3;
+ const target = container.target || container.previousElementSibling;
container.addEventListener("bind", (e) => {
- var _a, _b, _c;
- container.state.start = e.detail || "";
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
- if (form && rangeEnd) {
- container.state.end = form.data[rangeEnd] || "";
+ if (e.detail !== void 0 && e.detail !== null) {
+ target.style[container.isVertical ? "height" : "width"] = e.detail + "px";
}
});
- Object.defineProperty(container, "isRange", {
- get: () => {
- var _a, _b, _c;
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- return !!(((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd);
- }
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.start,
- set: (v) => {
- container.state.start = v || "";
- }
- });
- container.updateStart = (val) => {
- container.state.start = val;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
- };
- container.updateEnd = (val) => {
- var _a, _b, _c;
- container.state.end = val;
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
- if (form && rangeEnd) {
- form.data[rangeEnd] = val;
- }
+ const getSize = (startSize, w, h) => {
+ const newSize = startSize + (container.isVertical ? h : w);
+ return newSize < min ? min : newSize > max ? max : newSize;
};
+ container.addEventListener("mousedown", (event) => {
+ const startSize = container.isVertical ? target.offsetHeight : target.offsetWidth;
+ MouseMover.start(event, {
+ onmousemove: ({ w, h }) => {
+ const newSize = getSize(startSize, w, h);
+ target.style[container.isVertical ? "height" : "width"] = newSize + "px";
+ container.dispatchEvent(new CustomEvent("resizing", { detail: { oldSize: startSize, newSize }, bubbles: false }));
+ },
+ onmouseup: ({ w, h }) => {
+ const newSize = getSize(startSize, w, h);
+ container.dispatchEvent(new CustomEvent("resize", { detail: { oldSize: startSize, newSize }, bubbles: false }));
+ container.dispatchEvent(new CustomEvent("change", { detail: newSize, bubbles: false }));
+ }
+ });
+ });
}, state.Util.makeDom(
/*html*/
`
-
-
-
- -
-
-
-
+
`
));
- state.Component.register("ColorPicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ value: "#000000" });
- container.addEventListener("bind", (e) => {
- container.state.value = e.detail || "#000000";
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.value,
- set: (v) => {
- container.state.value = v || "#000000";
- }
- });
- container.updateValue = (val) => {
- container.state.value = val;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
- };
- }, state.Util.makeDom(
- /*html*/
- `
-
-
-
-
-`
- ));
- const BOOTSTRAP_ICONS = ["alarm", "archive", "arrow-left", "arrow-right", "bag", "bank", "basket", "bell", "bookmark", "box", "briefcase", "calendar", "camera", "cart", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "clock", "cloud", "code", "collection", "command", "cpu", "credit-card", "cup", "dash", "database", "display", "door-closed", "download", "droplet", "earbuds", "edit", "egg", "eject", "envelope", "eraser", "eye", "file", "filter", "flag", "folder", "gear", "gem", "gift", "graph-up", "grid", "hammer", "hand-thumbs-up", "heart", "house", "image", "inbox", "info-circle", "journal", "key", "laptop", "layers", "layout-text-sidebar-reverse", "lightbulb", "link", "list", "lock", "map", "mic", "moon", "mouse", "music-note", "newspaper", "palette", "paperclip", "pause", "pencil", "person", "phone", "pie-chart", "play", "plus", "printer", "puzzle", "question-circle", "reception-4", "record", "reply", "rss", "save", "search", "send", "server", "share", "shield", "shop", "shuffle", "skip-end", "skip-start", "slash", "sliders", "smartphone", "speaker", "speedometer", "spellcheck", "square", "star", "stickies", "stop", "stopwatch", "suit-heart", "sun", "table", "tag", "tags", "telephone", "terminal", "text-paragraph", "thermometer", "three-dots", "ticket", "tools", "trash", "trophy", "truck", "tv", "umbrella", "unlock", "upload", "vector-pen", "wallet", "watch", "wifi", "window", "wrench", "x", "zoom-in", "zoom-out", "activity", "at", "award", "backspace", "badge-3d", "badge-4k", "badge-8k", "badge-ad", "badge-ar", "badge-cc", "badge-hd", "badge-tm", "badge-vo", "badge-vr", "badge-wc", "bar-chart", "battery", "bicycle", "binoculars", "blockquote-left", "blockquote-right", "book", "bookshelf", "bootstrap", "border-all", "border-bottom", "border-center", "border-inner", "border-left", "border-middle", "border-outer", "border-right", "border-style", "border-top", "border-width", "bounding-box", "box-arrow-down", "box-arrow-in-down", "box-arrow-in-left", "box-arrow-in-right", "box-arrow-in-up", "box-arrow-left", "box-arrow-right", "box-arrow-up", "box-seam", "brightness-alt-high", "brightness-alt-low", "brightness-high", "brightness-low", "broadcast", "brush", "bucket", "bug", "building", "bullseye", "calculator", "calendar-check", "calendar-date", "calendar-day", "calendar-event", "calendar-minus", "calendar-month", "calendar-plus", "calendar-range", "calendar-week", "calendar-x", "calendar2", "calendar3", "calendar4", "camera-reels", "camera-video", "capslock", "card-checklist", "card-heading", "card-image", "card-list", "card-text", "caret-down", "caret-left", "caret-right", "caret-up", "cart-check", "cart-dash", "cart-plus", "cart-x", "cash", "cash-stack", "cast", "chat-dots", "chat-left", "chat-quote", "chat-right", "chat-square", "chat-text", "check-all", "check-circle", "check-square", "circle", "clipboard", "cloud-arrow-down", "cloud-arrow-up", "cloud-check", "cloud-download", "cloud-fog", "cloud-hail", "cloud-lightning", "cloud-minus", "cloud-moon", "cloud-plus", "cloud-rain", "cloud-slash", "cloud-snow", "cloud-sun", "cloud-upload", "clouds", "cloudy", "code-slash", "code-square", "collection-play", "columns", "columns-gap", "compass", "cone", "cone-striped", "controller", "credit-card-2-back", "credit-card-2-front", "crop", "cup-straw", "cursor", "dash-circle", "dash-square", "diagram-2", "diagram-3", "diamond", "dice-1", "dice-2", "dice-3", "dice-4", "dice-5", "dice-6", "disc", "discord", "distribute-horizontal", "distribute-vertical", "door-open", "dot", "droplet-half", "easel", "egg-fried", "emoji-angry", "emoji-dizzy", "emoji-expressionless", "emoji-frown", "emoji-heart-eyes", "emoji-laughing", "emoji-neutral", "emoji-smile", "emoji-sunglasses", "emoji-wink", "envelope-open", "exclamation", "exclamation-circle", "exclamation-diamond", "exclamation-octagon", "exclamation-square", "exclamation-triangle", "eye-slash", "eyedropper", "facebook", "file-arrow-down", "file-arrow-up", "file-binary", "file-break", "file-check", "file-code", "file-diff", "file-earmark", "file-excel", "file-image", "file-lock", "file-medical", "file-minus", "file-music", "file-pdf", "file-person", "file-play", "file-plus", "file-post", "file-ppt", "file-richtext", "file-slides", "file-spreadsheet", "file-text", "file-word", "file-zip", "files", "film", "filter-circle", "filter-left", "filter-right", "filter-square", "fingerprint", "flower1", "flower2", "flower3", "folder-check", "folder-minus", "folder-plus", "folder-symlink", "folder-x", "folder2-open", "fonts", "forward", "front", "fullscreen", "fullscreen-exit", "funnel", "gear-wide", "gender-female", "gender-male", "gender-trans", "geo", "geo-alt", "github", "globe", "google", "graph-down", "grid-1x2", "grid-3x2", "grid-3x3", "grip-horizontal", "grip-vertical", "hand-index", "hand-thumbs-down", "handbag", "hash", "headphones", "headset", "heart-half", "heptagon", "hourglass", "hourglass-bottom", "hourglass-split", "hourglass-top", "house-door", "hr", "hurricane", "image-alt", "images", "infinity", "input-cursor", "instagram", "intersect", "journal-album", "journal-arrow-down", "journal-arrow-up", "journal-bookmark", "journal-check", "journal-code", "journal-medical", "journal-minus", "journal-plus", "journal-richtext", "journal-text", "journal-x", "journals", "justify", "kanban", "keyboard", "ladder", "lamp", "layers-half", "layout-sidebar", "layout-split", "layout-three-columns", "life-preserver", "lightbulb-off", "lightning", "lightning-charge", "link-45deg", "linkedin", "list-check", "list-nested", "list-ol", "list-stars", "list-task", "list-ul", "mailbox", "markdown", "mask", "mastodon", "megaphone", "menu-app", "menu-button", "messenger", "mic-mute", "minecart", "minecart-loaded", "moisture", "mouse2", "mouse3", "music-note-beamed", "music-note-list", "music-player", "node-minus", "node-plus", "nut", "octagon", "option", "outlet", "paint-bucket", "patch-check", "patch-exclamation", "patch-minus", "patch-plus", "patch-question", "pause-btn", "pause-circle", "peace", "pen", "pencil-square", "pentagon", "person-badge", "person-bounding-box", "person-circle", "person-lines-fill", "phone-landscape", "phone-vibrate", "pie-chart-fill", "pin", "pin-angle", "pin-fill", "pin-map", "pip", "play-btn", "play-circle", "plug", "plus-circle", "plus-square", "power", "question", "question-diamond", "question-square", "rainbow", "receipt", "receipt-cutoff", "reception-0", "reception-1", "reception-2", "reception-3", "record-btn", "record-circle", "record2", "recycle", "reddit", "reply-all", "router", "rulers", "safe", "save2", "sd-card", "segmented-nav", "shield-check", "shield-exclamation", "shield-lock", "shield-shaded", "shield-slash", "shift", "signpost", "signpost-2", "signpost-split", "sim", "skip-backward", "skip-forward", "slack", "slash-circle", "slash-square", "smartwatch", "snow", "snow2", "snow3", "sort-alpha-down", "sort-alpha-up", "sort-numeric-down", "sort-numeric-up", "soundwave", "speedometer2", "square-half", "stack", "star-half", "stars", "stop-btn", "stop-circle", "suit-club", "suit-diamond", "suit-spade", "sunglasses", "sunrise", "sunset", "symmetry-horizontal", "symmetry-vertical", "tablet", "tablet-landscape", "telegram", "telephone-forward", "telephone-inbound", "telephone-outbound", "telephone-plus", "telephone-x", "text-center", "text-indent-left", "text-indent-right", "text-left", "text-right", "thermometer-half", "thermometer-high", "thermometer-low", "thermometer-snow", "thermometer-sun", "three-dots-vertical", "toggle-off", "toggle-on", "toggle2-off", "toggle2-on", "tornado", "translate", "trash2", "tree", "truck-flatbed", "tsunami", "type", "type-bold", "type-h1", "type-h2", "type-h3", "type-italic", "type-strikethrough", "type-underline", "ui-checks", "ui-checks-grid", "ui-radios", "ui-radios-grid", "union", "upc", "upc-scan", "view-list", "view-stacked", "vinyl", "voicemail", "volume-down", "volume-mute", "volume-off", "volume-up", "vr", "wallet2", "water", "whatsapp", "wifi-1", "wifi-2", "wifi-off", "wind", "window-dock", "window-sidebar", "x-circle", "x-diamond", "x-octagon", "x-square", "youtube"];
- state.Component.register("IconPicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ value: "", search: "", open: false });
- container.addEventListener("bind", (e) => {
- container.state.value = e.detail || "";
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.value,
- set: (v) => {
- container.state.value = v || "";
- }
- });
- Object.defineProperty(container, "filteredIcons", {
- get: () => {
- var _a;
- const s = ((_a = container.state.search) == null ? void 0 : _a.toLowerCase()) || "";
- return BOOTSTRAP_ICONS.filter((i) => i.includes(s));
- }
- });
- container.selectIcon = (icon) => {
- container.state.value = icon;
- container.state.open = false;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: icon }));
- };
- container.toggle = () => {
- container.state.open = !container.state.open;
- if (container.state.open) {
- setTimeout(() => {
- var _a;
- (_a = state.$(container, "input")) == null ? void 0 : _a.focus();
- }, 10);
- }
- };
- const onGlobalClick = (e) => {
- if (!container.contains(e.target)) {
- container.state.open = false;
- }
- };
- window.addEventListener("click", onGlobalClick);
- container.addEventListener("remove", () => window.removeEventListener("click", onGlobalClick));
- }, state.Util.makeDom(
- /*html*/
- `
-
-
-
-
-
-
-
-
-
No icons found
-
-
-
-`
- ), state.Util.makeDom(
- /*html*/
- ``
- ));
- AutoForm.register("DatePicker");
- AutoForm.register("ColorPicker");
- AutoForm.register("IconPicker");
const VirtualScroll = (options = {}) => {
const itemHeights = /* @__PURE__ */ new Map();
const groupHeights = /* @__PURE__ */ new Map();
@@ -850,101 +752,166 @@
`
));
- let _mouseMoverMoving = false;
- let _mouseMoverPos = {};
- let _mouseMoverEvents = {};
- const MouseMover = {
- start: (event, { onmousemove, onmouseup }) => {
- _mouseMoverPos = { x: event.clientX, y: event.clientY, w: 0, h: 0 };
- _mouseMoverEvents = { onmousemove, onmouseup };
- _mouseMoverMoving = true;
- }
- };
- if (typeof document !== "undefined") {
- document.addEventListener("mouseup", (event) => {
- var _a;
- if (!_mouseMoverMoving) return;
- _mouseMoverMoving = false;
- (_a = _mouseMoverEvents.onmouseup) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
- });
- document.addEventListener("mousemove", (event) => {
- var _a;
- if (!_mouseMoverMoving) return;
- _mouseMoverPos.w = event.clientX - _mouseMoverPos.x;
- _mouseMoverPos.h = event.clientY - _mouseMoverPos.y;
- (_a = _mouseMoverEvents.onmousemove) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
- });
- }
- state.Component.register("Resizer", (container) => {
- container.isVertical = container.hasAttribute("vertical");
- const min = parseInt(container.getAttribute("min")) || 10;
- const max = parseInt(container.getAttribute("max")) || 1e3;
- const target = container.target || container.previousElementSibling;
+ state.Component.register("DatePicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ start: "", end: "" });
container.addEventListener("bind", (e) => {
- if (e.detail !== void 0 && e.detail !== null) {
- target.style[container.isVertical ? "height" : "width"] = e.detail + "px";
+ var _a, _b, _c;
+ container.state.start = e.detail || "";
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
+ if (form && rangeEnd) {
+ container.state.end = form.data[rangeEnd] || "";
}
});
- const getSize = (startSize, w, h) => {
- const newSize = startSize + (container.isVertical ? h : w);
- return newSize < min ? min : newSize > max ? max : newSize;
- };
- container.addEventListener("mousedown", (event) => {
- const startSize = container.isVertical ? target.offsetHeight : target.offsetWidth;
- MouseMover.start(event, {
- onmousemove: ({ w, h }) => {
- const newSize = getSize(startSize, w, h);
- target.style[container.isVertical ? "height" : "width"] = newSize + "px";
- container.dispatchEvent(new CustomEvent("resizing", { detail: { oldSize: startSize, newSize }, bubbles: false }));
- },
- onmouseup: ({ w, h }) => {
- const newSize = getSize(startSize, w, h);
- container.dispatchEvent(new CustomEvent("resize", { detail: { oldSize: startSize, newSize }, bubbles: false }));
- container.dispatchEvent(new CustomEvent("change", { detail: newSize, bubbles: false }));
- }
- });
+ Object.defineProperty(container, "isRange", {
+ get: () => {
+ var _a, _b, _c;
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ return !!(((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd);
+ }
});
+ Object.defineProperty(container, "value", {
+ get: () => container.state.start,
+ set: (v) => {
+ container.state.start = v || "";
+ }
+ });
+ container.updateStart = (val) => {
+ container.state.start = val;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
+ };
+ container.updateEnd = (val) => {
+ var _a, _b, _c;
+ container.state.end = val;
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
+ if (form && rangeEnd) {
+ form.data[rangeEnd] = val;
+ }
+ };
}, state.Util.makeDom(
/*html*/
`
-
+
+
+
+ -
+
+
+
`
));
- if (typeof window !== "undefined") {
- window.addEventListener("beforeunload", (event) => {
- if (state.State.exitBlocks > 0) event.preventDefault();
+ state.Component.register("ColorPicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ value: "#000000" });
+ container.addEventListener("bind", (e) => {
+ container.state.value = e.detail || "#000000";
});
- }
- const htmlNode = document.documentElement;
- if (!htmlNode.hasAttribute("$data-bs-theme") && !htmlNode.hasAttribute("data-bs-theme")) {
- htmlNode.setAttribute("$data-bs-theme", "LocalStorage.darkMode?'dark':'light'");
- }
+ Object.defineProperty(container, "value", {
+ get: () => container.state.value,
+ set: (v) => {
+ container.state.value = v || "#000000";
+ }
+ });
+ container.updateValue = (val) => {
+ container.state.value = val;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
+ };
+ }, state.Util.makeDom(
+ /*html*/
+ `
+
+
+
+
+`
+ ));
+ const BOOTSTRAP_ICONS = ["alarm", "archive", "arrow-left", "arrow-right", "bag", "bank", "basket", "bell", "bookmark", "box", "briefcase", "calendar", "camera", "cart", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "clock", "cloud", "code", "collection", "command", "cpu", "credit-card", "cup", "dash", "database", "display", "door-closed", "download", "droplet", "earbuds", "edit", "egg", "eject", "envelope", "eraser", "eye", "file", "filter", "flag", "folder", "gear", "gem", "gift", "graph-up", "grid", "hammer", "hand-thumbs-up", "heart", "house", "image", "inbox", "info-circle", "journal", "key", "laptop", "layers", "layout-text-sidebar-reverse", "lightbulb", "link", "list", "lock", "map", "mic", "moon", "mouse", "music-note", "newspaper", "palette", "paperclip", "pause", "pencil", "person", "phone", "pie-chart", "play", "plus", "printer", "puzzle", "question-circle", "reception-4", "record", "reply", "rss", "save", "search", "send", "server", "share", "shield", "shop", "shuffle", "skip-end", "skip-start", "slash", "sliders", "smartphone", "speaker", "speedometer", "spellcheck", "square", "star", "stickies", "stop", "stopwatch", "suit-heart", "sun", "table", "tag", "tags", "telephone", "terminal", "text-paragraph", "thermometer", "three-dots", "ticket", "tools", "trash", "trophy", "truck", "tv", "umbrella", "unlock", "upload", "vector-pen", "wallet", "watch", "wifi", "window", "wrench", "x", "zoom-in", "zoom-out", "activity", "at", "award", "backspace", "badge-3d", "badge-4k", "badge-8k", "badge-ad", "badge-ar", "badge-cc", "badge-hd", "badge-tm", "badge-vo", "badge-vr", "badge-wc", "bar-chart", "battery", "bicycle", "binoculars", "blockquote-left", "blockquote-right", "book", "bookshelf", "bootstrap", "border-all", "border-bottom", "border-center", "border-inner", "border-left", "border-middle", "border-outer", "border-right", "border-style", "border-top", "border-width", "bounding-box", "box-arrow-down", "box-arrow-in-down", "box-arrow-in-left", "box-arrow-in-right", "box-arrow-in-up", "box-arrow-left", "box-arrow-right", "box-arrow-up", "box-seam", "brightness-alt-high", "brightness-alt-low", "brightness-high", "brightness-low", "broadcast", "brush", "bucket", "bug", "building", "bullseye", "calculator", "calendar-check", "calendar-date", "calendar-day", "calendar-event", "calendar-minus", "calendar-month", "calendar-plus", "calendar-range", "calendar-week", "calendar-x", "calendar2", "calendar3", "calendar4", "camera-reels", "camera-video", "capslock", "card-checklist", "card-heading", "card-image", "card-list", "card-text", "caret-down", "caret-left", "caret-right", "caret-up", "cart-check", "cart-dash", "cart-plus", "cart-x", "cash", "cash-stack", "cast", "chat-dots", "chat-left", "chat-quote", "chat-right", "chat-square", "chat-text", "check-all", "check-circle", "check-square", "circle", "clipboard", "cloud-arrow-down", "cloud-arrow-up", "cloud-check", "cloud-download", "cloud-fog", "cloud-hail", "cloud-lightning", "cloud-minus", "cloud-moon", "cloud-plus", "cloud-rain", "cloud-slash", "cloud-snow", "cloud-sun", "cloud-upload", "clouds", "cloudy", "code-slash", "code-square", "collection-play", "columns", "columns-gap", "compass", "cone", "cone-striped", "controller", "credit-card-2-back", "credit-card-2-front", "crop", "cup-straw", "cursor", "dash-circle", "dash-square", "diagram-2", "diagram-3", "diamond", "dice-1", "dice-2", "dice-3", "dice-4", "dice-5", "dice-6", "disc", "discord", "distribute-horizontal", "distribute-vertical", "door-open", "dot", "droplet-half", "easel", "egg-fried", "emoji-angry", "emoji-dizzy", "emoji-expressionless", "emoji-frown", "emoji-heart-eyes", "emoji-laughing", "emoji-neutral", "emoji-smile", "emoji-sunglasses", "emoji-wink", "envelope-open", "exclamation", "exclamation-circle", "exclamation-diamond", "exclamation-octagon", "exclamation-square", "exclamation-triangle", "eye-slash", "eyedropper", "facebook", "file-arrow-down", "file-arrow-up", "file-binary", "file-break", "file-check", "file-code", "file-diff", "file-earmark", "file-excel", "file-image", "file-lock", "file-medical", "file-minus", "file-music", "file-pdf", "file-person", "file-play", "file-plus", "file-post", "file-ppt", "file-richtext", "file-slides", "file-spreadsheet", "file-text", "file-word", "file-zip", "files", "film", "filter-circle", "filter-left", "filter-right", "filter-square", "fingerprint", "flower1", "flower2", "flower3", "folder-check", "folder-minus", "folder-plus", "folder-symlink", "folder-x", "folder2-open", "fonts", "forward", "front", "fullscreen", "fullscreen-exit", "funnel", "gear-wide", "gender-female", "gender-male", "gender-trans", "geo", "geo-alt", "github", "globe", "google", "graph-down", "grid-1x2", "grid-3x2", "grid-3x3", "grip-horizontal", "grip-vertical", "hand-index", "hand-thumbs-down", "handbag", "hash", "headphones", "headset", "heart-half", "heptagon", "hourglass", "hourglass-bottom", "hourglass-split", "hourglass-top", "house-door", "hr", "hurricane", "image-alt", "images", "infinity", "input-cursor", "instagram", "intersect", "journal-album", "journal-arrow-down", "journal-arrow-up", "journal-bookmark", "journal-check", "journal-code", "journal-medical", "journal-minus", "journal-plus", "journal-richtext", "journal-text", "journal-x", "journals", "justify", "kanban", "keyboard", "ladder", "lamp", "layers-half", "layout-sidebar", "layout-split", "layout-three-columns", "life-preserver", "lightbulb-off", "lightning", "lightning-charge", "link-45deg", "linkedin", "list-check", "list-nested", "list-ol", "list-stars", "list-task", "list-ul", "mailbox", "markdown", "mask", "mastodon", "megaphone", "menu-app", "menu-button", "messenger", "mic-mute", "minecart", "minecart-loaded", "moisture", "mouse2", "mouse3", "music-note-beamed", "music-note-list", "music-player", "node-minus", "node-plus", "nut", "octagon", "option", "outlet", "paint-bucket", "patch-check", "patch-exclamation", "patch-minus", "patch-plus", "patch-question", "pause-btn", "pause-circle", "peace", "pen", "pencil-square", "pentagon", "person-badge", "person-bounding-box", "person-circle", "person-lines-fill", "phone-landscape", "phone-vibrate", "pie-chart-fill", "pin", "pin-angle", "pin-fill", "pin-map", "pip", "play-btn", "play-circle", "plug", "plus-circle", "plus-square", "power", "question", "question-diamond", "question-square", "rainbow", "receipt", "receipt-cutoff", "reception-0", "reception-1", "reception-2", "reception-3", "record-btn", "record-circle", "record2", "recycle", "reddit", "reply-all", "router", "rulers", "safe", "save2", "sd-card", "segmented-nav", "shield-check", "shield-exclamation", "shield-lock", "shield-shaded", "shield-slash", "shift", "signpost", "signpost-2", "signpost-split", "sim", "skip-backward", "skip-forward", "slack", "slash-circle", "slash-square", "smartwatch", "snow", "snow2", "snow3", "sort-alpha-down", "sort-alpha-up", "sort-numeric-down", "sort-numeric-up", "soundwave", "speedometer2", "square-half", "stack", "star-half", "stars", "stop-btn", "stop-circle", "suit-club", "suit-diamond", "suit-spade", "sunglasses", "sunrise", "sunset", "symmetry-horizontal", "symmetry-vertical", "tablet", "tablet-landscape", "telegram", "telephone-forward", "telephone-inbound", "telephone-outbound", "telephone-plus", "telephone-x", "text-center", "text-indent-left", "text-indent-right", "text-left", "text-right", "thermometer-half", "thermometer-high", "thermometer-low", "thermometer-snow", "thermometer-sun", "three-dots-vertical", "toggle-off", "toggle-on", "toggle2-off", "toggle2-on", "tornado", "translate", "trash2", "tree", "truck-flatbed", "tsunami", "type", "type-bold", "type-h1", "type-h2", "type-h3", "type-italic", "type-strikethrough", "type-underline", "ui-checks", "ui-checks-grid", "ui-radios", "ui-radios-grid", "union", "upc", "upc-scan", "view-list", "view-stacked", "vinyl", "voicemail", "volume-down", "volume-mute", "volume-off", "volume-up", "vr", "wallet2", "water", "whatsapp", "wifi-1", "wifi-2", "wifi-off", "wind", "window-dock", "window-sidebar", "x-circle", "x-diamond", "x-octagon", "x-square", "youtube"];
+ state.Component.register("IconPicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ value: "", search: "", open: false });
+ container.addEventListener("bind", (e) => {
+ container.state.value = e.detail || "";
+ });
+ Object.defineProperty(container, "value", {
+ get: () => container.state.value,
+ set: (v) => {
+ container.state.value = v || "";
+ }
+ });
+ Object.defineProperty(container, "filteredIcons", {
+ get: () => {
+ var _a;
+ const s = ((_a = container.state.search) == null ? void 0 : _a.toLowerCase()) || "";
+ return BOOTSTRAP_ICONS.filter((i) => i.includes(s));
+ }
+ });
+ container.selectIcon = (icon) => {
+ container.state.value = icon;
+ container.state.open = false;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: icon }));
+ };
+ container.toggle = () => {
+ container.state.open = !container.state.open;
+ if (container.state.open) {
+ setTimeout(() => {
+ var _a;
+ (_a = state.$(container, "input")) == null ? void 0 : _a.focus();
+ }, 10);
+ }
+ };
+ const onGlobalClick = (e) => {
+ if (!container.contains(e.target)) {
+ container.state.open = false;
+ }
+ };
+ window.addEventListener("click", onGlobalClick);
+ container.addEventListener("remove", () => window.removeEventListener("click", onGlobalClick));
+ }, state.Util.makeDom(
+ /*html*/
+ `
+
+
+
+
+
+
+
+
+
No icons found
+
+
+
+`
+ ), state.Util.makeDom(
+ /*html*/
+ ``
+ ));
+ AutoForm.register("DatePicker");
+ AutoForm.register("ColorPicker");
+ AutoForm.register("IconPicker");
globalThis.HTTP = HTTP;
globalThis.UI = UI$1;
globalThis.AutoForm = AutoForm;
globalThis.MouseMover = MouseMover;
globalThis.VirtualScroll = VirtualScroll;
- const ApigoBase = {
- HTTP,
- UI: UI$1,
- AutoForm,
- MouseMover,
- VirtualScroll,
- State: state.State,
- List: VirtualScroll
- };
- if (typeof document !== "undefined") {
- globalThis.ApigoBase = ApigoBase;
- }
- Object.defineProperty(exports2, "State", {
- enumerable: true,
- get: () => state.State
- });
- exports2.APIComponent = APIComponent;
- exports2.AutoForm = AutoForm;
- exports2.HTTP = HTTP;
- exports2.MouseMover = MouseMover;
- exports2.UI = UI$1;
- exports2.VirtualScroll = VirtualScroll;
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
-});
+ globalThis.List = VirtualScroll;
+})(bootstrap, ApigoState);
diff --git a/dist/base.min.js b/dist/base.min.js
index 4cf9dd4..e8c74e3 100644
--- a/dist/base.min.js
+++ b/dist/base.min.js
@@ -1 +1 @@
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@apigo.cc/state"),require("@apigo.cc/bootstrap")):"function"==typeof define&&define.amd?define(["exports","@apigo.cc/state","@apigo.cc/bootstrap"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApigoBase={},t.ApigoState)}(this,function(t,e){"use strict";const i={get:({url:t,...e})=>i.request({url:t,method:"GET",...e}),post:({url:t,data:e,...a})=>i.request({url:t,method:"POST",data:e,...a}),put:({url:t,data:e,...a})=>i.request({url:t,method:"PUT",data:e,...a}),delete:({url:t,...e})=>i.request({url:t,method:"DELETE",...e}),head:({url:t,...e})=>i.request({url:t,method:"HEAD",...e}),request:async({url:t,method:e="POST",data:i,headers:a={},responseType:n,timeout:s=1e4})=>{var o;const l={method:e=e.toUpperCase(),signal:null==(o=AbortSignal.timeout)?void 0:o.call(AbortSignal,s)};if(void 0!==i&&"GET"!==e&&"HEAD"!==e){if(i instanceof HTMLFormElement&&(i=new FormData(i)),i&&"object"==typeof i&&!(i instanceof FormData)&&!(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&Object.values(i).some(t=>t instanceof File||t instanceof Blob||t instanceof FileList||Array.isArray(t)&&t.some(t=>t instanceof File||t instanceof Blob))){const t=new FormData;for(const[e,a]of Object.entries(i))a instanceof FileList||Array.isArray(a)?Array.from(a).forEach(i=>t.append(e,i)):null!=a&&t.append(e,a);i=t}i instanceof FormData?delete a["Content-Type"]:"string"==typeof i||i instanceof ArrayBuffer||ArrayBuffer.isView(i)||(i=JSON.stringify(i),a["Content-Type"]||(a["Content-Type"]="application/json")),l.body=i}Object.keys(a).length&&(l.headers=a);const r={error:null,ok:null,status:0,headers:{},responseType:"",result:null};try{const e=await fetch(t,l);if(Object.assign(r,{ok:e.ok,status:e.status,headers:Object.fromEntries(e.headers.entries())}),!n){const t=e.headers.get("Content-Type")||"";n=t.includes("application/json")?"json":/image|video|audio|pdf|zip|octet-stream/.test(t)?"binary":"text",r.responseType=n}!1===r.ok&&(r.error=(r.statusText||"HTTP "+r.status+" error")+" for "+t),r.result="json"===n?await e.json():"binary"===n?await e.arrayBuffer():await e.text()}catch(t){Object.assign(r,{error:t.message||String(t),ok:!1})}return r}},a=e.Component.register("API",t=>{t.request=e.NewState({url:"",method:"GET",headers:{},data:null,timeout:1e4,responseType:""}),t.response=e.NewState({loading:!1,ok:null,status:null,error:null,headers:{},responseType:"",result:null}),t.result=e.NewState(),t.do=(e={})=>new Promise((a,n)=>{const s={...t.request,...e};if(!s.url)throw new Error(".url is required");s.headers={...t.request.headers,...e.headers},t.response.loading=!0,i.request(s).then(e=>{if(Object.keys(e).forEach(i=>{"result"!==i&&(t.response[i]=e[i])}),e.result&&"object"==typeof e.result&&t.result&&"object"==typeof t.result?Object.assign(t.result,e.result):t.result=e.result,t.response.loading=!1,!1===e.ok)throw new Error(e.error);if("object"==typeof e.result&&e.result.error)throw new Error(e.result.error);t.dispatchEvent(new CustomEvent("response",{detail:e,bubbles:!1})),a(e)}).catch(i=>{var a;!e.noui&&(null==(a=globalThis.UI)?void 0:a.toast)&&UI.toast(i.message,{type:"danger"}),t.dispatchEvent(new CustomEvent("error",{detail:i,bubbles:!0})),n(i)})});let a=null;t.request.__watch(null,()=>{t.hasAttribute("auto")&&t.request.url&&(a||(a=Promise.resolve().then(()=>{t.do(),a=null})))})}),n={};e.Component.register("Modal",t=>{t.modal=new bootstrap.Modal(t),t.addEventListener("bind",e=>{e.detail?t.modal.show():t.modal.hide()}),t.addEventListener("hide.bs.modal",()=>{var e;null==(e=document.activeElement)||e.blur(),t.dispatchEvent(new CustomEvent("change",{bubbles:!1,detail:!1}))}),e.Util.copyFunction(t,t.modal,"show","hide")},e.Util.makeDom('\n\n')),e.Component.register("Dialog",e.Component.getSetupFunction("Modal"),e.Util.makeDom('\n\n'));let s=0;n.showDialog=function({title:t="",message:e="",buttons:i=["{#Close#}"],type:a="body"}){const n=document.body.appendChild(document.createElement("Dialog"));return n.style.zIndex=2e3+ ++s,Promise.resolve().then(()=>{Object.assign(n.state,{message:e,title:t,type:a,buttons:i}),n.show()}),new Promise(t=>{n.addEventListener("change",e=>{s--,t(n.result||0),n.remove()})})},n.alert=function(t,e={}){return n.showDialog({message:t,...e})},n.confirm=function(t,e={}){return new Promise(i=>n.showDialog({message:t,buttons:["{#Cancel#}","{#Confirm#}"],...e}).then(t=>i(t>=2)).catch(()=>i(!1)))},e.Component.register("Toast",t=>{t.toast=new bootstrap.Toast(t,{autohide:t.state.delay>0}),e.Util.copyFunction(t,t.toast,"show","hide"),t.addEventListener("show.bs.toast",()=>{if(t.state.delay>0){let e;const i=()=>{t.state.left=t.state.delay/1e3,e=setInterval(()=>{(!t.isConnected||--t.state.left<=0)&&clearInterval(e)},1e3)};i(),t.addEventListener("mouseenter",()=>{clearInterval(e),t.state.left=void 0}),t.addEventListener("mouseleave",i)}})},e.Util.makeDom('\n\n'),e.Util.makeDom('')),n.toast=function(t,i={}){const a=i.delay??5e3,n=document.createElement("Toast");n.state={delay:a,left:a?a/1e3:void 0,type:i.type||"primary",message:t,buttons:i.buttons||[]},e.$(`[toast-container="${i.container||"default"}"]`).appendChild(n),Promise.resolve().then(()=>n.show())},n.toastConfirm=function(t,e={}){return new Promise(i=>n.toast(t,{buttons:["{#Confirm#}"],...e}).then(t=>i(1===t)).catch(()=>i(!1)))};const o=e.Util.makeDom('\n\n'),l=e.Util.makeDom("");e.Component.register("AutoForm",t=>{t.state.schema||(t.state.schema=[]);const a=t=>t&&"object"==typeof t&&!t.__isProxy?e.NewState(t):t;t.state.__watch("data",e=>t.data=a(e)),t.data=a(t.state.data||{}),t.vertical=t.hasAttribute("vertical"),t.horizontal=t.hasAttribute("horizontal"),t.inline=t.hasAttribute("inline"),t.nobutton=t.hasAttribute("nobutton"),t.request={method:"POST"},t.response={},t.result=null,t.form=e.$(t,"form"),t.submit=(e={})=>{var a,n;if(!t.form.reportValidity())return null==(n=null==(a=globalThis.UI)?void 0:a.toast)?void 0:n.call(a,"{#verify failed#}",{type:"danger"});if(!t.dispatchEvent(new CustomEvent("submit",{detail:t.data,cancelable:!0,bubbles:!1})))return;const s={...t.request,data:t.data,noui:!0,...e};let o=null;if(t.api)o=t.api.do(s);else{if(!t.request.url)return console.warn("{#please config .api or .request.url to auto submit#}");o=i.request(s)}o.then(e=>{if(t.response=e,t.result=e.result,"object"==typeof e.result&&e.result.error)throw new Error(e.result.error);t.dispatchEvent(new CustomEvent("response",{detail:e,bubbles:!1}))}).catch(e=>{var i;(null==(i=globalThis.UI)?void 0:i.toast)&&UI.toast(e.message,{type:"danger"}),t.dispatchEvent(new CustomEvent("error",{detail:e,bubbles:!0}))})},t.checkIf=e=>{if(!e.if)return!0;try{return new Function("Hash","LocalStorage","State","item","data","return "+e.if).call(t,globalThis.Hash,globalThis.LocalStorage,globalThis.State,e,t.data)}catch(t){return!1}}},o,l);const r=t=>{let e=t.querySelector("[control-wrapper]");if(e)return e;for(const i of t.querySelectorAll("template"))if(e=r(i.content),e)return e;return null},d={customTypes:[],register:(t,e)=>{const i=e||t;d.customTypes.find(e=>e.name===t)||(d.customTypes.push({name:t,typeName:i}),d._addAutoFormComponent(t,i))},_addAutoFormComponent:(t,i)=>{const a=r(o);if(a){const n=e.Util.makeDom(`<${t} $if="item.type?.toLowerCase() === '${i.toLowerCase()}'" $name="item.name" $.="item.setting || {}" $bind="this.data[item.name]" class="w-100">${t}>`);a.appendChild(n)}}};e.Component.register("TagsInput",t=>{t._thisObj=t,t.addEventListener("bind",e=>{t.state.tags=Array.isArray(e.detail)?e.detail:[]})},e.Util.makeDom(`\n\n \n \n \n \n
\n`),e.Util.makeDom("")),d.register("TagsInput"),e.Component.register("DatePicker",t=>{t._thisObj=t,t.state=e.NewState({start:"",end:""}),t.addEventListener("bind",e=>{var i,a,n;t.state.start=e.detail||"";const s=t.closest("AutoForm"),o=t.getAttribute("name"),l=null==(a=null==(i=null==s?void 0:s.state)?void 0:i.schema)?void 0:a.find(t=>t.name===o),r=(null==(n=null==l?void 0:l.setting)?void 0:n.rangeEnd)||t.rangeEnd;s&&r&&(t.state.end=s.data[r]||"")}),Object.defineProperty(t,"isRange",{get:()=>{var e,i,a;const n=t.closest("AutoForm"),s=t.getAttribute("name"),o=null==(i=null==(e=null==n?void 0:n.state)?void 0:e.schema)?void 0:i.find(t=>t.name===s);return!(!(null==(a=null==o?void 0:o.setting)?void 0:a.rangeEnd)&&!t.rangeEnd)}}),Object.defineProperty(t,"value",{get:()=>t.state.start,set:e=>{t.state.start=e||""}}),t.updateStart=e=>{t.state.start=e,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))},t.updateEnd=e=>{var i,a,n;t.state.end=e;const s=t.closest("AutoForm"),o=t.getAttribute("name"),l=null==(a=null==(i=null==s?void 0:s.state)?void 0:i.schema)?void 0:a.find(t=>t.name===o),r=(null==(n=null==l?void 0:l.setting)?void 0:n.rangeEnd)||t.rangeEnd;s&&r&&(s.data[r]=e)}},e.Util.makeDom('\n\n \n \n -\n \n \n
\n')),e.Component.register("ColorPicker",t=>{t._thisObj=t,t.state=e.NewState({value:"#000000"}),t.addEventListener("bind",e=>{t.state.value=e.detail||"#000000"}),Object.defineProperty(t,"value",{get:()=>t.state.value,set:e=>{t.state.value=e||"#000000"}}),t.updateValue=e=>{t.state.value=e,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))}},e.Util.makeDom('\n\n \n \n
\n'));const c=["alarm","archive","arrow-left","arrow-right","bag","bank","basket","bell","bookmark","box","briefcase","calendar","camera","cart","chat","check","chevron-down","chevron-left","chevron-right","chevron-up","clock","cloud","code","collection","command","cpu","credit-card","cup","dash","database","display","door-closed","download","droplet","earbuds","edit","egg","eject","envelope","eraser","eye","file","filter","flag","folder","gear","gem","gift","graph-up","grid","hammer","hand-thumbs-up","heart","house","image","inbox","info-circle","journal","key","laptop","layers","layout-text-sidebar-reverse","lightbulb","link","list","lock","map","mic","moon","mouse","music-note","newspaper","palette","paperclip","pause","pencil","person","phone","pie-chart","play","plus","printer","puzzle","question-circle","reception-4","record","reply","rss","save","search","send","server","share","shield","shop","shuffle","skip-end","skip-start","slash","sliders","smartphone","speaker","speedometer","spellcheck","square","star","stickies","stop","stopwatch","suit-heart","sun","table","tag","tags","telephone","terminal","text-paragraph","thermometer","three-dots","ticket","tools","trash","trophy","truck","tv","umbrella","unlock","upload","vector-pen","wallet","watch","wifi","window","wrench","x","zoom-in","zoom-out","activity","at","award","backspace","badge-3d","badge-4k","badge-8k","badge-ad","badge-ar","badge-cc","badge-hd","badge-tm","badge-vo","badge-vr","badge-wc","bar-chart","battery","bicycle","binoculars","blockquote-left","blockquote-right","book","bookshelf","bootstrap","border-all","border-bottom","border-center","border-inner","border-left","border-middle","border-outer","border-right","border-style","border-top","border-width","bounding-box","box-arrow-down","box-arrow-in-down","box-arrow-in-left","box-arrow-in-right","box-arrow-in-up","box-arrow-left","box-arrow-right","box-arrow-up","box-seam","brightness-alt-high","brightness-alt-low","brightness-high","brightness-low","broadcast","brush","bucket","bug","building","bullseye","calculator","calendar-check","calendar-date","calendar-day","calendar-event","calendar-minus","calendar-month","calendar-plus","calendar-range","calendar-week","calendar-x","calendar2","calendar3","calendar4","camera-reels","camera-video","capslock","card-checklist","card-heading","card-image","card-list","card-text","caret-down","caret-left","caret-right","caret-up","cart-check","cart-dash","cart-plus","cart-x","cash","cash-stack","cast","chat-dots","chat-left","chat-quote","chat-right","chat-square","chat-text","check-all","check-circle","check-square","circle","clipboard","cloud-arrow-down","cloud-arrow-up","cloud-check","cloud-download","cloud-fog","cloud-hail","cloud-lightning","cloud-minus","cloud-moon","cloud-plus","cloud-rain","cloud-slash","cloud-snow","cloud-sun","cloud-upload","clouds","cloudy","code-slash","code-square","collection-play","columns","columns-gap","compass","cone","cone-striped","controller","credit-card-2-back","credit-card-2-front","crop","cup-straw","cursor","dash-circle","dash-square","diagram-2","diagram-3","diamond","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc","discord","distribute-horizontal","distribute-vertical","door-open","dot","droplet-half","easel","egg-fried","emoji-angry","emoji-dizzy","emoji-expressionless","emoji-frown","emoji-heart-eyes","emoji-laughing","emoji-neutral","emoji-smile","emoji-sunglasses","emoji-wink","envelope-open","exclamation","exclamation-circle","exclamation-diamond","exclamation-octagon","exclamation-square","exclamation-triangle","eye-slash","eyedropper","facebook","file-arrow-down","file-arrow-up","file-binary","file-break","file-check","file-code","file-diff","file-earmark","file-excel","file-image","file-lock","file-medical","file-minus","file-music","file-pdf","file-person","file-play","file-plus","file-post","file-ppt","file-richtext","file-slides","file-spreadsheet","file-text","file-word","file-zip","files","film","filter-circle","filter-left","filter-right","filter-square","fingerprint","flower1","flower2","flower3","folder-check","folder-minus","folder-plus","folder-symlink","folder-x","folder2-open","fonts","forward","front","fullscreen","fullscreen-exit","funnel","gear-wide","gender-female","gender-male","gender-trans","geo","geo-alt","github","globe","google","graph-down","grid-1x2","grid-3x2","grid-3x3","grip-horizontal","grip-vertical","hand-index","hand-thumbs-down","handbag","hash","headphones","headset","heart-half","heptagon","hourglass","hourglass-bottom","hourglass-split","hourglass-top","house-door","hr","hurricane","image-alt","images","infinity","input-cursor","instagram","intersect","journal-album","journal-arrow-down","journal-arrow-up","journal-bookmark","journal-check","journal-code","journal-medical","journal-minus","journal-plus","journal-richtext","journal-text","journal-x","journals","justify","kanban","keyboard","ladder","lamp","layers-half","layout-sidebar","layout-split","layout-three-columns","life-preserver","lightbulb-off","lightning","lightning-charge","link-45deg","linkedin","list-check","list-nested","list-ol","list-stars","list-task","list-ul","mailbox","markdown","mask","mastodon","megaphone","menu-app","menu-button","messenger","mic-mute","minecart","minecart-loaded","moisture","mouse2","mouse3","music-note-beamed","music-note-list","music-player","node-minus","node-plus","nut","octagon","option","outlet","paint-bucket","patch-check","patch-exclamation","patch-minus","patch-plus","patch-question","pause-btn","pause-circle","peace","pen","pencil-square","pentagon","person-badge","person-bounding-box","person-circle","person-lines-fill","phone-landscape","phone-vibrate","pie-chart-fill","pin","pin-angle","pin-fill","pin-map","pip","play-btn","play-circle","plug","plus-circle","plus-square","power","question","question-diamond","question-square","rainbow","receipt","receipt-cutoff","reception-0","reception-1","reception-2","reception-3","record-btn","record-circle","record2","recycle","reddit","reply-all","router","rulers","safe","save2","sd-card","segmented-nav","shield-check","shield-exclamation","shield-lock","shield-shaded","shield-slash","shift","signpost","signpost-2","signpost-split","sim","skip-backward","skip-forward","slack","slash-circle","slash-square","smartwatch","snow","snow2","snow3","sort-alpha-down","sort-alpha-up","sort-numeric-down","sort-numeric-up","soundwave","speedometer2","square-half","stack","star-half","stars","stop-btn","stop-circle","suit-club","suit-diamond","suit-spade","sunglasses","sunrise","sunset","symmetry-horizontal","symmetry-vertical","tablet","tablet-landscape","telegram","telephone-forward","telephone-inbound","telephone-outbound","telephone-plus","telephone-x","text-center","text-indent-left","text-indent-right","text-left","text-right","thermometer-half","thermometer-high","thermometer-low","thermometer-snow","thermometer-sun","three-dots-vertical","toggle-off","toggle-on","toggle2-off","toggle2-on","tornado","translate","trash2","tree","truck-flatbed","tsunami","type","type-bold","type-h1","type-h2","type-h3","type-italic","type-strikethrough","type-underline","ui-checks","ui-checks-grid","ui-radios","ui-radios-grid","union","upc","upc-scan","view-list","view-stacked","vinyl","voicemail","volume-down","volume-mute","volume-off","volume-up","vr","wallet2","water","whatsapp","wifi-1","wifi-2","wifi-off","wind","window-dock","window-sidebar","x-circle","x-diamond","x-octagon","x-square","youtube"];e.Component.register("IconPicker",t=>{t._thisObj=t,t.state=e.NewState({value:"",search:"",open:!1}),t.addEventListener("bind",e=>{t.state.value=e.detail||""}),Object.defineProperty(t,"value",{get:()=>t.state.value,set:e=>{t.state.value=e||""}}),Object.defineProperty(t,"filteredIcons",{get:()=>{var e;const i=(null==(e=t.state.search)?void 0:e.toLowerCase())||"";return c.filter(t=>t.includes(i))}}),t.selectIcon=e=>{t.state.value=e,t.state.open=!1,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))},t.toggle=()=>{t.state.open=!t.state.open,t.state.open&&setTimeout(()=>{var i;null==(i=e.$(t,"input"))||i.focus()},10)};const i=e=>{t.contains(e.target)||(t.state.open=!1)};window.addEventListener("click",i),t.addEventListener("remove",()=>window.removeEventListener("click",i))},e.Util.makeDom('\n\n
\n
\n
\n
\n
\n \n \n
No icons found
\n
\n
\n
\n'),e.Util.makeDom("")),d.register("DatePicker"),d.register("ColorPicker"),d.register("IconPicker");const m=(t={})=>{const i=new Map,a=new Map;let n=1;const s=e.Util.newAvg();let o=0,l=0,r=0,d=null,c=null,m=!1;const u=t.itemHeight||null;return{reset:(t,e)=>{if(m=!1,i.clear(),a.clear(),s.clear(),r=0,d=null,c=null,!(null==t?void 0:t.length))return[];const p=t.length;n=Math.ceil(Math.sqrt(p))||10;const h=window.getComputedStyle(e);o=parseFloat(h.paddingTop)||0,l=parseFloat(h.rowGap)||0;const b=Math.max(10,Math.ceil((e.clientHeight||100)/(u||32)));return t.slice(0,Math.min(3*b,p))},init:(t,e)=>{if(m)return;const o=t.length;let l=u||s.get()||32;o>0&&"object"==typeof t[0]&&null!==t[0]&&t[0]._itemHeight&&(l=t[0]._itemHeight),s.add(l),null===d&&(d=0,c=0);for(let e=0;e{if(0===e.offsetHeight)return;if(null===d){const t=window.getComputedStyle(e);d=parseFloat(t.marginTop)||0,c=parseFloat(t.marginBottom)||0}0!==t||r||(r=d);const o=e.offsetHeight+d+c+l,m=i.get(t);if(o!==m){i.set(t,o),s.add(o);const e=o-(m||0),l=t-t%n;a.has(l)&&a.set(l,a.get(l)+e)}},calc:(t,e)=>{if(!m||!e)return null;const d=e.length,c=Math.max(16,s.get()||32);let u=Math.max(10,Math.ceil((t.clientHeight||100)/c)),p=o+r+l,h=0,b=0,f=0,g=0,v=[];const y=t.scrollTop;let x=0;for(let t=0;t2*d)throw new Error("VirtualScroll infinite loop");if(0===b){const s=a.get(t);if(s&&p+s<=y&&t+n0?l:0)),postHeight:h>0?Math.max(0,h-2*l):0,renderedList:v,listStartIndex:f}}}};e.Component.register("List",t=>{t.mode=t.getAttribute("mode")||"normal",t.fast=t.hasAttribute("fast"),t.collapsible=t.hasAttribute("collapsible");const i=t.fast?t.querySelector(".vs-pad-top"):null,a=t.fast?t.querySelector(".vs-pad-bottom"):null,n={idfield:"id",labelfield:"label",summaryfield:"summary",groupidfield:"id",grouplabelfield:"label",groupsummaryfield:"summary",groupfield:"group",parentfield:"parent",groupicon:"folder",itemicon:"file"};t.collapsed=e.NewState({}),t.state.renderedList=[];const s=()=>{e.Util.updateDefaults(t,n);const i=t.state.list||[],a=[];if("group"===t.mode){const e={};i.forEach(i=>{var a;return(e[a=i[t.groupfield]]??(e[a]=[])).push(i)}),(t.state.groups||[]).forEach(i=>{a.push({type:"group",...i});const n=e[i[t.groupidfield]];n&&n.forEach(t=>a.push({type:"item",...t}))})}else if("tree"===t.mode){const e={};i.forEach(i=>{var a;return(e[a=i[t.parentfield]||""]??(e[a]=[])).push(i)});const n=(i,s,o)=>i.forEach(i=>{var l;const r=i[t.idfield],d=!!(null==(l=e[r])?void 0:l.length),c=t.collapsed[r];a.push({type:"item",...i,_level:s,_hasChildren:d,_parents:o}),d&&!c&&n(e[r],s+1,[...o,r])});n(e[""]||[],0,[])}else i.forEach(t=>a.push({type:"item",...t}));t.state.flatList=a};t.state.__watch("list",s);const o=t.fast?m():null;let l=!1;t.refresh=()=>{if(t.fast&&!l){l=!0;try{const e=o.calc(t,t.state.flatList);e&&(i&&(i.style.height=`${e.prevHeight}px`),a&&(a.style.height=`${e.postHeight}px`),t.state.listStartIndex=e.listStartIndex,t.state.renderedList=e.renderedList)}finally{setTimeout(()=>{l=!1},0)}}},t.onItemUpdate=(e,i)=>{t.fast&&o.update(e+(t.state.listStartIndex||0),i)},t.state.__watch("flatList",e=>{t.fast?(i&&(i.style.height="0px"),a&&(a.style.height="0px"),t.state.listStartIndex=0,t.state.renderedList=o.reset(e,t)||[],setTimeout(()=>{t.state.flatList===e&&o.init(e,t.refresh)})):t.state.renderedList=e}),t.selectItem=(e,i)=>{t.hasAttribute("auto-select")&&(t.state.selectedItem=t.state.selectedItem===e[t.idfield]?null:e[t.idfield]),t.dispatchEvent(new CustomEvent("itemclick",{bubbles:!1,detail:{item:e,index:i+(t.fast&&t.state.listStartIndex||0)}}))},t.selectGroup=(e,i)=>{t.hasAttribute("auto-select-group")&&(t.state.selectedGroup=t.state.selectedGroup===e[t.groupidfield]?null:e[t.groupidfield]),t.dispatchEvent(new CustomEvent("groupclick",{bubbles:!1,detail:{item:e,index:i}}))},t.toggleCollapse=e=>{t.collapsible&&e._hasChildren&&(t.collapsed[e[t.idfield]]=!t.collapsed[e[t.idfield]],s())},s()},e.Util.makeDom('\n\n\t
\n\t
\n\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
\n\t\n\t
\n
\n')),e.Component.register("Nav",t=>{t.vertical=t.hasAttribute("vertical"),t.click=(i,a)=>{i.noselect||a||(e.Hash.nav=i.name),t.dispatchEvent(new CustomEvent("nav",{detail:{item:i},bubbles:!1}))}},e.Util.makeDom('\n\n\t
\n\t\t
\n\t\n\t
\n\t\t\n\t\n\t
\n\t\t\n\t\n\t
\n\t
\n\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t
\n\t\n
\n'));let u=!1,p={},h={};const b={start:(t,{onmousemove:e,onmouseup:i})=>{p={x:t.clientX,y:t.clientY,w:0,h:0},h={onmousemove:e,onmouseup:i},u=!0}};"undefined"!=typeof document&&(document.addEventListener("mouseup",t=>{var e;u&&(u=!1,null==(e=h.onmouseup)||e.call(h,{event:t,...p}))}),document.addEventListener("mousemove",t=>{var e;u&&(p.w=t.clientX-p.x,p.h=t.clientY-p.y,null==(e=h.onmousemove)||e.call(h,{event:t,...p}))})),e.Component.register("Resizer",t=>{t.isVertical=t.hasAttribute("vertical");const e=parseInt(t.getAttribute("min"))||10,i=parseInt(t.getAttribute("max"))||1e3,a=t.target||t.previousElementSibling;t.addEventListener("bind",e=>{void 0!==e.detail&&null!==e.detail&&(a.style[t.isVertical?"height":"width"]=e.detail+"px")});const n=(a,n,s)=>{const o=a+(t.isVertical?s:n);return oi?i:o};t.addEventListener("mousedown",e=>{const i=t.isVertical?a.offsetHeight:a.offsetWidth;b.start(e,{onmousemove:({w:e,h:s})=>{const o=n(i,e,s);a.style[t.isVertical?"height":"width"]=o+"px",t.dispatchEvent(new CustomEvent("resizing",{detail:{oldSize:i,newSize:o},bubbles:!1}))},onmouseup:({w:e,h:a})=>{const s=n(i,e,a);t.dispatchEvent(new CustomEvent("resize",{detail:{oldSize:i,newSize:s},bubbles:!1})),t.dispatchEvent(new CustomEvent("change",{detail:s,bubbles:!1}))}})})},e.Util.makeDom("\n\n")),"undefined"!=typeof window&&window.addEventListener("beforeunload",t=>{e.State.exitBlocks>0&&t.preventDefault()});const f=document.documentElement;f.hasAttribute("$data-bs-theme")||f.hasAttribute("data-bs-theme")||f.setAttribute("$data-bs-theme","LocalStorage.darkMode?'dark':'light'"),globalThis.HTTP=i,globalThis.UI=n,globalThis.AutoForm=d,globalThis.MouseMover=b,globalThis.VirtualScroll=m;const g={HTTP:i,UI:n,AutoForm:d,MouseMover:b,VirtualScroll:m,State:e.State,List:m};"undefined"!=typeof document&&(globalThis.ApigoBase=g),Object.defineProperty(t,"State",{enumerable:!0,get:()=>e.State}),t.APIComponent=a,t.AutoForm=d,t.HTTP=i,t.MouseMover=b,t.UI=n,t.VirtualScroll=m,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
+!function(t,e){"use strict";const i={get:({url:t,...e})=>i.request({url:t,method:"GET",...e}),post:({url:t,data:e,...a})=>i.request({url:t,method:"POST",data:e,...a}),put:({url:t,data:e,...a})=>i.request({url:t,method:"PUT",data:e,...a}),delete:({url:t,...e})=>i.request({url:t,method:"DELETE",...e}),head:({url:t,...e})=>i.request({url:t,method:"HEAD",...e}),request:async({url:t,method:e="POST",data:i,headers:a={},responseType:s,timeout:n=1e4})=>{var o;const l={method:e=e.toUpperCase(),signal:null==(o=AbortSignal.timeout)?void 0:o.call(AbortSignal,n)};if(void 0!==i&&"GET"!==e&&"HEAD"!==e){if(i instanceof HTMLFormElement&&(i=new FormData(i)),i&&"object"==typeof i&&!(i instanceof FormData)&&!(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&Object.values(i).some(t=>t instanceof File||t instanceof Blob||t instanceof FileList||Array.isArray(t)&&t.some(t=>t instanceof File||t instanceof Blob))){const t=new FormData;for(const[e,a]of Object.entries(i))a instanceof FileList||Array.isArray(a)?Array.from(a).forEach(i=>t.append(e,i)):null!=a&&t.append(e,a);i=t}i instanceof FormData?delete a["Content-Type"]:"string"==typeof i||i instanceof ArrayBuffer||ArrayBuffer.isView(i)||(i=JSON.stringify(i),a["Content-Type"]||(a["Content-Type"]="application/json")),l.body=i}Object.keys(a).length&&(l.headers=a);const r={error:null,ok:null,status:0,headers:{},responseType:"",result:null};try{const e=await fetch(t,l);if(Object.assign(r,{ok:e.ok,status:e.status,headers:Object.fromEntries(e.headers.entries())}),!s){const t=e.headers.get("Content-Type")||"";s=t.includes("application/json")?"json":/image|video|audio|pdf|zip|octet-stream/.test(t)?"binary":"text",r.responseType=s}!1===r.ok&&(r.error=(r.statusText||"HTTP "+r.status+" error")+" for "+t),r.result="json"===s?await e.json():"binary"===s?await e.arrayBuffer():await e.text()}catch(t){Object.assign(r,{error:t.message||String(t),ok:!1})}return r}};e.Component.register("API",t=>{t.request=e.NewState({url:"",method:"GET",headers:{},data:null,timeout:1e4,responseType:""}),t.response=e.NewState({loading:!1,ok:null,status:null,error:null,headers:{},responseType:"",result:null}),t.result=e.NewState(),t.do=(e={})=>new Promise((a,s)=>{const n={...t.request,...e};if(!n.url)throw new Error(".url is required");n.headers={...t.request.headers,...e.headers},t.response.loading=!0,i.request(n).then(e=>{if(Object.keys(e).forEach(i=>{"result"!==i&&(t.response[i]=e[i])}),e.result&&"object"==typeof e.result&&t.result&&"object"==typeof t.result?Object.assign(t.result,e.result):t.result=e.result,t.response.loading=!1,!1===e.ok)throw new Error(e.error);if("object"==typeof e.result&&e.result.error)throw new Error(e.result.error);t.dispatchEvent(new CustomEvent("response",{detail:e,bubbles:!1})),a(e)}).catch(i=>{var a;!e.noui&&(null==(a=globalThis.UI)?void 0:a.toast)&&UI.toast(i.message,{type:"danger"}),t.dispatchEvent(new CustomEvent("error",{detail:i,bubbles:!0})),s(i)})});let a=null;t.request.__watch(null,()=>{t.hasAttribute("auto")&&t.request.url&&(a||(a=Promise.resolve().then(()=>{t.do(),a=null})))})});const a={};e.Component.register("Modal",t=>{t.modal=new bootstrap.Modal(t),t.addEventListener("bind",e=>{e.detail?t.modal.show():t.modal.hide()}),t.addEventListener("hide.bs.modal",()=>{var e;null==(e=document.activeElement)||e.blur(),t.dispatchEvent(new CustomEvent("change",{bubbles:!1,detail:!1}))}),e.Util.copyFunction(t,t.modal,"show","hide")},e.Util.makeDom('\n\n')),e.Component.register("Dialog",e.Component.getSetupFunction("Modal"),e.Util.makeDom('\n\n'));let s=0;a.showDialog=function({title:t="",message:e="",buttons:i=["{#Close#}"],type:a="body"}){const n=document.body.appendChild(document.createElement("Dialog"));return n.style.zIndex=2e3+ ++s,Promise.resolve().then(()=>{Object.assign(n.state,{message:e,title:t,type:a,buttons:i}),n.show()}),new Promise(t=>{n.addEventListener("change",e=>{s--,t(n.result||0),n.remove()})})},a.alert=function(t,e={}){return a.showDialog({message:t,...e})},a.confirm=function(t,e={}){return new Promise(i=>a.showDialog({message:t,buttons:["{#Cancel#}","{#Confirm#}"],...e}).then(t=>i(t>=2)).catch(()=>i(!1)))},e.Component.register("Toast",t=>{t.toast=new bootstrap.Toast(t,{autohide:t.state.delay>0}),e.Util.copyFunction(t,t.toast,"show","hide"),t.addEventListener("show.bs.toast",()=>{if(t.state.delay>0){let e;const i=()=>{t.state.left=t.state.delay/1e3,e=setInterval(()=>{(!t.isConnected||--t.state.left<=0)&&clearInterval(e)},1e3)};i(),t.addEventListener("mouseenter",()=>{clearInterval(e),t.state.left=void 0}),t.addEventListener("mouseleave",i)}})},e.Util.makeDom('\n\n'),e.Util.makeDom('')),a.toast=function(t,i={}){const a=i.delay??5e3,s=document.createElement("Toast");s.state={delay:a,left:a?a/1e3:void 0,type:i.type||"primary",message:t,buttons:i.buttons||[]},e.$(`[toast-container="${i.container||"default"}"]`).appendChild(s),Promise.resolve().then(()=>s.show())},a.toastConfirm=function(t,e={}){return new Promise(i=>a.toast(t,{buttons:["{#Confirm#}"],...e}).then(t=>i(1===t)).catch(()=>i(!1)))};const n=e.Util.makeDom('\n\n'),o=e.Util.makeDom("");e.Component.register("AutoForm",t=>{t.state.schema||(t.state.schema=[]);const a=t=>t&&"object"==typeof t&&!t.__isProxy?e.NewState(t):t;t.state.__watch("data",e=>t.data=a(e)),t.data=a(t.state.data||{}),t.vertical=t.hasAttribute("vertical"),t.horizontal=t.hasAttribute("horizontal"),t.inline=t.hasAttribute("inline"),t.nobutton=t.hasAttribute("nobutton"),t.request={method:"POST"},t.response={},t.result=null,t.form=e.$(t,"form"),t.submit=(e={})=>{var a,s;if(!t.form.reportValidity())return null==(s=null==(a=globalThis.UI)?void 0:a.toast)?void 0:s.call(a,"{#verify failed#}",{type:"danger"});if(!t.dispatchEvent(new CustomEvent("submit",{detail:t.data,cancelable:!0,bubbles:!1})))return;const n={...t.request,data:t.data,noui:!0,...e};let o=null;if(t.api)o=t.api.do(n);else{if(!t.request.url)return console.warn("{#please config .api or .request.url to auto submit#}");o=i.request(n)}o.then(e=>{if(t.response=e,t.result=e.result,"object"==typeof e.result&&e.result.error)throw new Error(e.result.error);t.dispatchEvent(new CustomEvent("response",{detail:e,bubbles:!1}))}).catch(e=>{var i;(null==(i=globalThis.UI)?void 0:i.toast)&&UI.toast(e.message,{type:"danger"}),t.dispatchEvent(new CustomEvent("error",{detail:e,bubbles:!0}))})},t.checkIf=e=>{if(!e.if)return!0;try{return new Function("Hash","LocalStorage","State","item","data","return "+e.if).call(t,globalThis.Hash,globalThis.LocalStorage,globalThis.State,e,t.data)}catch(t){return!1}}},n,o);const l=t=>{let e=t.querySelector("[control-wrapper]");if(e)return e;for(const i of t.querySelectorAll("template"))if(e=l(i.content),e)return e;return null},r={customTypes:[],register:(t,e)=>{const i=e||t;r.customTypes.find(e=>e.name===t)||(r.customTypes.push({name:t,typeName:i}),r._addAutoFormComponent(t,i))},_addAutoFormComponent:(t,i)=>{const a=l(n);if(a){const s=e.Util.makeDom(`<${t} $if="item.type?.toLowerCase() === '${i.toLowerCase()}'" $name="item.name" $.="item.setting || {}" $bind="this.data[item.name]" class="w-100">${t}>`);a.appendChild(s)}}};e.Component.register("TagsInput",t=>{t._thisObj=t,t.addEventListener("bind",e=>{t.state.tags=Array.isArray(e.detail)?e.detail:[]})},e.Util.makeDom(`\n\n \n \n \n \n
\n`),e.Util.makeDom("")),r.register("TagsInput");let d=!1,c={},m={};const u={start:(t,{onmousemove:e,onmouseup:i})=>{c={x:t.clientX,y:t.clientY,w:0,h:0},m={onmousemove:e,onmouseup:i},d=!0}};"undefined"!=typeof document&&(document.addEventListener("mouseup",t=>{var e;d&&(d=!1,null==(e=m.onmouseup)||e.call(m,{event:t,...c}))}),document.addEventListener("mousemove",t=>{var e;d&&(c.w=t.clientX-c.x,c.h=t.clientY-c.y,null==(e=m.onmousemove)||e.call(m,{event:t,...c}))})),e.Component.register("Resizer",t=>{t.isVertical=t.hasAttribute("vertical");const e=parseInt(t.getAttribute("min"))||10,i=parseInt(t.getAttribute("max"))||1e3,a=t.target||t.previousElementSibling;t.addEventListener("bind",e=>{void 0!==e.detail&&null!==e.detail&&(a.style[t.isVertical?"height":"width"]=e.detail+"px")});const s=(a,s,n)=>{const o=a+(t.isVertical?n:s);return oi?i:o};t.addEventListener("mousedown",e=>{const i=t.isVertical?a.offsetHeight:a.offsetWidth;u.start(e,{onmousemove:({w:e,h:n})=>{const o=s(i,e,n);a.style[t.isVertical?"height":"width"]=o+"px",t.dispatchEvent(new CustomEvent("resizing",{detail:{oldSize:i,newSize:o},bubbles:!1}))},onmouseup:({w:e,h:a})=>{const n=s(i,e,a);t.dispatchEvent(new CustomEvent("resize",{detail:{oldSize:i,newSize:n},bubbles:!1})),t.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!1}))}})})},e.Util.makeDom("\n\n"));const p=(t={})=>{const i=new Map,a=new Map;let s=1;const n=e.Util.newAvg();let o=0,l=0,r=0,d=null,c=null,m=!1;const u=t.itemHeight||null;return{reset:(t,e)=>{if(m=!1,i.clear(),a.clear(),n.clear(),r=0,d=null,c=null,!(null==t?void 0:t.length))return[];const p=t.length;s=Math.ceil(Math.sqrt(p))||10;const h=window.getComputedStyle(e);o=parseFloat(h.paddingTop)||0,l=parseFloat(h.rowGap)||0;const b=Math.max(10,Math.ceil((e.clientHeight||100)/(u||32)));return t.slice(0,Math.min(3*b,p))},init:(t,e)=>{if(m)return;const o=t.length;let l=u||n.get()||32;o>0&&"object"==typeof t[0]&&null!==t[0]&&t[0]._itemHeight&&(l=t[0]._itemHeight),n.add(l),null===d&&(d=0,c=0);for(let e=0;e{if(0===e.offsetHeight)return;if(null===d){const t=window.getComputedStyle(e);d=parseFloat(t.marginTop)||0,c=parseFloat(t.marginBottom)||0}0!==t||r||(r=d);const o=e.offsetHeight+d+c+l,m=i.get(t);if(o!==m){i.set(t,o),n.add(o);const e=o-(m||0),l=t-t%s;a.has(l)&&a.set(l,a.get(l)+e)}},calc:(t,e)=>{if(!m||!e)return null;const d=e.length,c=Math.max(16,n.get()||32);let u=Math.max(10,Math.ceil((t.clientHeight||100)/c)),p=o+r+l,h=0,b=0,f=0,g=0,v=[];const y=t.scrollTop;let x=0;for(let t=0;t2*d)throw new Error("VirtualScroll infinite loop");if(0===b){const n=a.get(t);if(n&&p+n<=y&&t+s0?l:0)),postHeight:h>0?Math.max(0,h-2*l):0,renderedList:v,listStartIndex:f}}}};e.Component.register("List",t=>{t.mode=t.getAttribute("mode")||"normal",t.fast=t.hasAttribute("fast"),t.collapsible=t.hasAttribute("collapsible");const i=t.fast?t.querySelector(".vs-pad-top"):null,a=t.fast?t.querySelector(".vs-pad-bottom"):null,s={idfield:"id",labelfield:"label",summaryfield:"summary",groupidfield:"id",grouplabelfield:"label",groupsummaryfield:"summary",groupfield:"group",parentfield:"parent",groupicon:"folder",itemicon:"file"};t.collapsed=e.NewState({}),t.state.renderedList=[];const n=()=>{e.Util.updateDefaults(t,s);const i=t.state.list||[],a=[];if("group"===t.mode){const e={};i.forEach(i=>{var a;return(e[a=i[t.groupfield]]??(e[a]=[])).push(i)}),(t.state.groups||[]).forEach(i=>{a.push({type:"group",...i});const s=e[i[t.groupidfield]];s&&s.forEach(t=>a.push({type:"item",...t}))})}else if("tree"===t.mode){const e={};i.forEach(i=>{var a;return(e[a=i[t.parentfield]||""]??(e[a]=[])).push(i)});const s=(i,n,o)=>i.forEach(i=>{var l;const r=i[t.idfield],d=!!(null==(l=e[r])?void 0:l.length),c=t.collapsed[r];a.push({type:"item",...i,_level:n,_hasChildren:d,_parents:o}),d&&!c&&s(e[r],n+1,[...o,r])});s(e[""]||[],0,[])}else i.forEach(t=>a.push({type:"item",...t}));t.state.flatList=a};t.state.__watch("list",n);const o=t.fast?p():null;let l=!1;t.refresh=()=>{if(t.fast&&!l){l=!0;try{const e=o.calc(t,t.state.flatList);e&&(i&&(i.style.height=`${e.prevHeight}px`),a&&(a.style.height=`${e.postHeight}px`),t.state.listStartIndex=e.listStartIndex,t.state.renderedList=e.renderedList)}finally{setTimeout(()=>{l=!1},0)}}},t.onItemUpdate=(e,i)=>{t.fast&&o.update(e+(t.state.listStartIndex||0),i)},t.state.__watch("flatList",e=>{t.fast?(i&&(i.style.height="0px"),a&&(a.style.height="0px"),t.state.listStartIndex=0,t.state.renderedList=o.reset(e,t)||[],setTimeout(()=>{t.state.flatList===e&&o.init(e,t.refresh)})):t.state.renderedList=e}),t.selectItem=(e,i)=>{t.hasAttribute("auto-select")&&(t.state.selectedItem=t.state.selectedItem===e[t.idfield]?null:e[t.idfield]),t.dispatchEvent(new CustomEvent("itemclick",{bubbles:!1,detail:{item:e,index:i+(t.fast&&t.state.listStartIndex||0)}}))},t.selectGroup=(e,i)=>{t.hasAttribute("auto-select-group")&&(t.state.selectedGroup=t.state.selectedGroup===e[t.groupidfield]?null:e[t.groupidfield]),t.dispatchEvent(new CustomEvent("groupclick",{bubbles:!1,detail:{item:e,index:i}}))},t.toggleCollapse=e=>{t.collapsible&&e._hasChildren&&(t.collapsed[e[t.idfield]]=!t.collapsed[e[t.idfield]],n())},n()},e.Util.makeDom('\n\n\t
\n\t
\n\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
\n\t\n\t
\n
\n')),e.Component.register("Nav",t=>{t.vertical=t.hasAttribute("vertical"),t.click=(i,a)=>{i.noselect||a||(e.Hash.nav=i.name),t.dispatchEvent(new CustomEvent("nav",{detail:{item:i},bubbles:!1}))}},e.Util.makeDom('\n\n\t
\n\t\t
\n\t\n\t
\n\t\t\n\t\n\t
\n\t\t\n\t\n\t
\n\t
\n\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t
\n\t\n
\n')),e.Component.register("DatePicker",t=>{t._thisObj=t,t.state=e.NewState({start:"",end:""}),t.addEventListener("bind",e=>{var i,a,s;t.state.start=e.detail||"";const n=t.closest("AutoForm"),o=t.getAttribute("name"),l=null==(a=null==(i=null==n?void 0:n.state)?void 0:i.schema)?void 0:a.find(t=>t.name===o),r=(null==(s=null==l?void 0:l.setting)?void 0:s.rangeEnd)||t.rangeEnd;n&&r&&(t.state.end=n.data[r]||"")}),Object.defineProperty(t,"isRange",{get:()=>{var e,i,a;const s=t.closest("AutoForm"),n=t.getAttribute("name"),o=null==(i=null==(e=null==s?void 0:s.state)?void 0:e.schema)?void 0:i.find(t=>t.name===n);return!(!(null==(a=null==o?void 0:o.setting)?void 0:a.rangeEnd)&&!t.rangeEnd)}}),Object.defineProperty(t,"value",{get:()=>t.state.start,set:e=>{t.state.start=e||""}}),t.updateStart=e=>{t.state.start=e,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))},t.updateEnd=e=>{var i,a,s;t.state.end=e;const n=t.closest("AutoForm"),o=t.getAttribute("name"),l=null==(a=null==(i=null==n?void 0:n.state)?void 0:i.schema)?void 0:a.find(t=>t.name===o),r=(null==(s=null==l?void 0:l.setting)?void 0:s.rangeEnd)||t.rangeEnd;n&&r&&(n.data[r]=e)}},e.Util.makeDom('\n\n \n \n -\n \n \n
\n')),e.Component.register("ColorPicker",t=>{t._thisObj=t,t.state=e.NewState({value:"#000000"}),t.addEventListener("bind",e=>{t.state.value=e.detail||"#000000"}),Object.defineProperty(t,"value",{get:()=>t.state.value,set:e=>{t.state.value=e||"#000000"}}),t.updateValue=e=>{t.state.value=e,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))}},e.Util.makeDom('\n\n \n \n
\n'));const h=["alarm","archive","arrow-left","arrow-right","bag","bank","basket","bell","bookmark","box","briefcase","calendar","camera","cart","chat","check","chevron-down","chevron-left","chevron-right","chevron-up","clock","cloud","code","collection","command","cpu","credit-card","cup","dash","database","display","door-closed","download","droplet","earbuds","edit","egg","eject","envelope","eraser","eye","file","filter","flag","folder","gear","gem","gift","graph-up","grid","hammer","hand-thumbs-up","heart","house","image","inbox","info-circle","journal","key","laptop","layers","layout-text-sidebar-reverse","lightbulb","link","list","lock","map","mic","moon","mouse","music-note","newspaper","palette","paperclip","pause","pencil","person","phone","pie-chart","play","plus","printer","puzzle","question-circle","reception-4","record","reply","rss","save","search","send","server","share","shield","shop","shuffle","skip-end","skip-start","slash","sliders","smartphone","speaker","speedometer","spellcheck","square","star","stickies","stop","stopwatch","suit-heart","sun","table","tag","tags","telephone","terminal","text-paragraph","thermometer","three-dots","ticket","tools","trash","trophy","truck","tv","umbrella","unlock","upload","vector-pen","wallet","watch","wifi","window","wrench","x","zoom-in","zoom-out","activity","at","award","backspace","badge-3d","badge-4k","badge-8k","badge-ad","badge-ar","badge-cc","badge-hd","badge-tm","badge-vo","badge-vr","badge-wc","bar-chart","battery","bicycle","binoculars","blockquote-left","blockquote-right","book","bookshelf","bootstrap","border-all","border-bottom","border-center","border-inner","border-left","border-middle","border-outer","border-right","border-style","border-top","border-width","bounding-box","box-arrow-down","box-arrow-in-down","box-arrow-in-left","box-arrow-in-right","box-arrow-in-up","box-arrow-left","box-arrow-right","box-arrow-up","box-seam","brightness-alt-high","brightness-alt-low","brightness-high","brightness-low","broadcast","brush","bucket","bug","building","bullseye","calculator","calendar-check","calendar-date","calendar-day","calendar-event","calendar-minus","calendar-month","calendar-plus","calendar-range","calendar-week","calendar-x","calendar2","calendar3","calendar4","camera-reels","camera-video","capslock","card-checklist","card-heading","card-image","card-list","card-text","caret-down","caret-left","caret-right","caret-up","cart-check","cart-dash","cart-plus","cart-x","cash","cash-stack","cast","chat-dots","chat-left","chat-quote","chat-right","chat-square","chat-text","check-all","check-circle","check-square","circle","clipboard","cloud-arrow-down","cloud-arrow-up","cloud-check","cloud-download","cloud-fog","cloud-hail","cloud-lightning","cloud-minus","cloud-moon","cloud-plus","cloud-rain","cloud-slash","cloud-snow","cloud-sun","cloud-upload","clouds","cloudy","code-slash","code-square","collection-play","columns","columns-gap","compass","cone","cone-striped","controller","credit-card-2-back","credit-card-2-front","crop","cup-straw","cursor","dash-circle","dash-square","diagram-2","diagram-3","diamond","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc","discord","distribute-horizontal","distribute-vertical","door-open","dot","droplet-half","easel","egg-fried","emoji-angry","emoji-dizzy","emoji-expressionless","emoji-frown","emoji-heart-eyes","emoji-laughing","emoji-neutral","emoji-smile","emoji-sunglasses","emoji-wink","envelope-open","exclamation","exclamation-circle","exclamation-diamond","exclamation-octagon","exclamation-square","exclamation-triangle","eye-slash","eyedropper","facebook","file-arrow-down","file-arrow-up","file-binary","file-break","file-check","file-code","file-diff","file-earmark","file-excel","file-image","file-lock","file-medical","file-minus","file-music","file-pdf","file-person","file-play","file-plus","file-post","file-ppt","file-richtext","file-slides","file-spreadsheet","file-text","file-word","file-zip","files","film","filter-circle","filter-left","filter-right","filter-square","fingerprint","flower1","flower2","flower3","folder-check","folder-minus","folder-plus","folder-symlink","folder-x","folder2-open","fonts","forward","front","fullscreen","fullscreen-exit","funnel","gear-wide","gender-female","gender-male","gender-trans","geo","geo-alt","github","globe","google","graph-down","grid-1x2","grid-3x2","grid-3x3","grip-horizontal","grip-vertical","hand-index","hand-thumbs-down","handbag","hash","headphones","headset","heart-half","heptagon","hourglass","hourglass-bottom","hourglass-split","hourglass-top","house-door","hr","hurricane","image-alt","images","infinity","input-cursor","instagram","intersect","journal-album","journal-arrow-down","journal-arrow-up","journal-bookmark","journal-check","journal-code","journal-medical","journal-minus","journal-plus","journal-richtext","journal-text","journal-x","journals","justify","kanban","keyboard","ladder","lamp","layers-half","layout-sidebar","layout-split","layout-three-columns","life-preserver","lightbulb-off","lightning","lightning-charge","link-45deg","linkedin","list-check","list-nested","list-ol","list-stars","list-task","list-ul","mailbox","markdown","mask","mastodon","megaphone","menu-app","menu-button","messenger","mic-mute","minecart","minecart-loaded","moisture","mouse2","mouse3","music-note-beamed","music-note-list","music-player","node-minus","node-plus","nut","octagon","option","outlet","paint-bucket","patch-check","patch-exclamation","patch-minus","patch-plus","patch-question","pause-btn","pause-circle","peace","pen","pencil-square","pentagon","person-badge","person-bounding-box","person-circle","person-lines-fill","phone-landscape","phone-vibrate","pie-chart-fill","pin","pin-angle","pin-fill","pin-map","pip","play-btn","play-circle","plug","plus-circle","plus-square","power","question","question-diamond","question-square","rainbow","receipt","receipt-cutoff","reception-0","reception-1","reception-2","reception-3","record-btn","record-circle","record2","recycle","reddit","reply-all","router","rulers","safe","save2","sd-card","segmented-nav","shield-check","shield-exclamation","shield-lock","shield-shaded","shield-slash","shift","signpost","signpost-2","signpost-split","sim","skip-backward","skip-forward","slack","slash-circle","slash-square","smartwatch","snow","snow2","snow3","sort-alpha-down","sort-alpha-up","sort-numeric-down","sort-numeric-up","soundwave","speedometer2","square-half","stack","star-half","stars","stop-btn","stop-circle","suit-club","suit-diamond","suit-spade","sunglasses","sunrise","sunset","symmetry-horizontal","symmetry-vertical","tablet","tablet-landscape","telegram","telephone-forward","telephone-inbound","telephone-outbound","telephone-plus","telephone-x","text-center","text-indent-left","text-indent-right","text-left","text-right","thermometer-half","thermometer-high","thermometer-low","thermometer-snow","thermometer-sun","three-dots-vertical","toggle-off","toggle-on","toggle2-off","toggle2-on","tornado","translate","trash2","tree","truck-flatbed","tsunami","type","type-bold","type-h1","type-h2","type-h3","type-italic","type-strikethrough","type-underline","ui-checks","ui-checks-grid","ui-radios","ui-radios-grid","union","upc","upc-scan","view-list","view-stacked","vinyl","voicemail","volume-down","volume-mute","volume-off","volume-up","vr","wallet2","water","whatsapp","wifi-1","wifi-2","wifi-off","wind","window-dock","window-sidebar","x-circle","x-diamond","x-octagon","x-square","youtube"];e.Component.register("IconPicker",t=>{t._thisObj=t,t.state=e.NewState({value:"",search:"",open:!1}),t.addEventListener("bind",e=>{t.state.value=e.detail||""}),Object.defineProperty(t,"value",{get:()=>t.state.value,set:e=>{t.state.value=e||""}}),Object.defineProperty(t,"filteredIcons",{get:()=>{var e;const i=(null==(e=t.state.search)?void 0:e.toLowerCase())||"";return h.filter(t=>t.includes(i))}}),t.selectIcon=e=>{t.state.value=e,t.state.open=!1,t.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:e}))},t.toggle=()=>{t.state.open=!t.state.open,t.state.open&&setTimeout(()=>{var i;null==(i=e.$(t,"input"))||i.focus()},10)};const i=e=>{t.contains(e.target)||(t.state.open=!1)};window.addEventListener("click",i),t.addEventListener("remove",()=>window.removeEventListener("click",i))},e.Util.makeDom('\n\n
\n
\n
\n
\n
\n \n \n
No icons found
\n
\n
\n
\n'),e.Util.makeDom("")),r.register("DatePicker"),r.register("ColorPicker"),r.register("IconPicker"),globalThis.HTTP=i,globalThis.UI=a,globalThis.AutoForm=r,globalThis.MouseMover=u,globalThis.VirtualScroll=p,globalThis.List=p}(bootstrap,ApigoState);
diff --git a/package.json b/package.json
index bbb8c79..d3185d5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@apigo.cc/base",
- "version": "1.0.13",
+ "version": "1.0.14",
"type": "module",
"main": "dist/base.js",
"files": [
diff --git a/src/index.js b/src/index.js
index 8c337d5..cdbf72e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,29 +1,4 @@
-import { NewState, State } from '@apigo.cc/state'
import '@apigo.cc/bootstrap'
-
-// Re-exports
-export * from './http.js'
-export * from './ui.js'
-export * from './form.js'
-export * from './controls.js'
-export * from './list.js'
-export * from './nav.js'
-export * from './interaction.js'
-
-export { State }
-
-if (typeof window !== 'undefined') {
- window.addEventListener('beforeunload', (event) => {
- if (State.exitBlocks > 0) event.preventDefault()
- })
-}
-
-const htmlNode = document.documentElement;
-if (!htmlNode.hasAttribute('$data-bs-theme') && !htmlNode.hasAttribute('data-bs-theme')) {
- htmlNode.setAttribute('$data-bs-theme', "LocalStorage.darkMode?'dark':'light'");
-}
-
-// Side effects: ensure global namespaces are populated
import { HTTP } from './http.js'
import { UI } from './ui.js'
import { AutoForm } from './form.js'
@@ -37,13 +12,5 @@ globalThis.UI = UI
globalThis.AutoForm = AutoForm
globalThis.MouseMover = MouseMover
globalThis.VirtualScroll = VirtualScroll
-
-const ApigoBase = {
- HTTP, UI, AutoForm, MouseMover, VirtualScroll, State,
- List: VirtualScroll
-};
-
-if (typeof document !== 'undefined') {
- globalThis.ApigoBase = ApigoBase;
-}
+globalThis.List = VirtualScroll
diff --git a/test/lib/base.js b/test/lib/base.js
index 54a45d9..6d27aaf 100644
--- a/test/lib/base.js
+++ b/test/lib/base.js
@@ -1,6 +1,4 @@
-(function(global, factory) {
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@apigo.cc/state"), require("@apigo.cc/bootstrap")) : typeof define === "function" && define.amd ? define(["exports", "@apigo.cc/state", "@apigo.cc/bootstrap"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.ApigoBase = {}, global.ApigoState));
-})(this, function(exports2, state) {
+(function(bootstrap$1, state) {
"use strict";
const HTTP = {
get: ({ url, ...opt }) => HTTP.request({ url, method: "GET", ...opt }),
@@ -51,7 +49,7 @@
return response;
}
};
- const APIComponent = state.Component.register("API", (container) => {
+ state.Component.register("API", (container) => {
container.request = state.NewState({ url: "", method: "GET", headers: {}, data: null, timeout: 1e4, responseType: "" });
container.response = state.NewState({ loading: false, ok: null, status: null, error: null, headers: {}, responseType: "", result: null });
container.result = state.NewState();
@@ -393,162 +391,66 @@
``
));
AutoForm.register("TagsInput");
- state.Component.register("DatePicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ start: "", end: "" });
+ let _mouseMoverMoving = false;
+ let _mouseMoverPos = {};
+ let _mouseMoverEvents = {};
+ const MouseMover = {
+ start: (event, { onmousemove, onmouseup }) => {
+ _mouseMoverPos = { x: event.clientX, y: event.clientY, w: 0, h: 0 };
+ _mouseMoverEvents = { onmousemove, onmouseup };
+ _mouseMoverMoving = true;
+ }
+ };
+ if (typeof document !== "undefined") {
+ document.addEventListener("mouseup", (event) => {
+ var _a;
+ if (!_mouseMoverMoving) return;
+ _mouseMoverMoving = false;
+ (_a = _mouseMoverEvents.onmouseup) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
+ });
+ document.addEventListener("mousemove", (event) => {
+ var _a;
+ if (!_mouseMoverMoving) return;
+ _mouseMoverPos.w = event.clientX - _mouseMoverPos.x;
+ _mouseMoverPos.h = event.clientY - _mouseMoverPos.y;
+ (_a = _mouseMoverEvents.onmousemove) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
+ });
+ }
+ state.Component.register("Resizer", (container) => {
+ container.isVertical = container.hasAttribute("vertical");
+ const min = parseInt(container.getAttribute("min")) || 10;
+ const max = parseInt(container.getAttribute("max")) || 1e3;
+ const target = container.target || container.previousElementSibling;
container.addEventListener("bind", (e) => {
- var _a, _b, _c;
- container.state.start = e.detail || "";
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
- if (form && rangeEnd) {
- container.state.end = form.data[rangeEnd] || "";
+ if (e.detail !== void 0 && e.detail !== null) {
+ target.style[container.isVertical ? "height" : "width"] = e.detail + "px";
}
});
- Object.defineProperty(container, "isRange", {
- get: () => {
- var _a, _b, _c;
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- return !!(((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd);
- }
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.start,
- set: (v) => {
- container.state.start = v || "";
- }
- });
- container.updateStart = (val) => {
- container.state.start = val;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
- };
- container.updateEnd = (val) => {
- var _a, _b, _c;
- container.state.end = val;
- const form = container.closest("AutoForm");
- const name = container.getAttribute("name");
- const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
- const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
- if (form && rangeEnd) {
- form.data[rangeEnd] = val;
- }
+ const getSize = (startSize, w, h) => {
+ const newSize = startSize + (container.isVertical ? h : w);
+ return newSize < min ? min : newSize > max ? max : newSize;
};
+ container.addEventListener("mousedown", (event) => {
+ const startSize = container.isVertical ? target.offsetHeight : target.offsetWidth;
+ MouseMover.start(event, {
+ onmousemove: ({ w, h }) => {
+ const newSize = getSize(startSize, w, h);
+ target.style[container.isVertical ? "height" : "width"] = newSize + "px";
+ container.dispatchEvent(new CustomEvent("resizing", { detail: { oldSize: startSize, newSize }, bubbles: false }));
+ },
+ onmouseup: ({ w, h }) => {
+ const newSize = getSize(startSize, w, h);
+ container.dispatchEvent(new CustomEvent("resize", { detail: { oldSize: startSize, newSize }, bubbles: false }));
+ container.dispatchEvent(new CustomEvent("change", { detail: newSize, bubbles: false }));
+ }
+ });
+ });
}, state.Util.makeDom(
/*html*/
`
-
-
-
- -
-
-
-
+
`
));
- state.Component.register("ColorPicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ value: "#000000" });
- container.addEventListener("bind", (e) => {
- container.state.value = e.detail || "#000000";
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.value,
- set: (v) => {
- container.state.value = v || "#000000";
- }
- });
- container.updateValue = (val) => {
- container.state.value = val;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
- };
- }, state.Util.makeDom(
- /*html*/
- `
-
-
-
-
-`
- ));
- const BOOTSTRAP_ICONS = ["alarm", "archive", "arrow-left", "arrow-right", "bag", "bank", "basket", "bell", "bookmark", "box", "briefcase", "calendar", "camera", "cart", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "clock", "cloud", "code", "collection", "command", "cpu", "credit-card", "cup", "dash", "database", "display", "door-closed", "download", "droplet", "earbuds", "edit", "egg", "eject", "envelope", "eraser", "eye", "file", "filter", "flag", "folder", "gear", "gem", "gift", "graph-up", "grid", "hammer", "hand-thumbs-up", "heart", "house", "image", "inbox", "info-circle", "journal", "key", "laptop", "layers", "layout-text-sidebar-reverse", "lightbulb", "link", "list", "lock", "map", "mic", "moon", "mouse", "music-note", "newspaper", "palette", "paperclip", "pause", "pencil", "person", "phone", "pie-chart", "play", "plus", "printer", "puzzle", "question-circle", "reception-4", "record", "reply", "rss", "save", "search", "send", "server", "share", "shield", "shop", "shuffle", "skip-end", "skip-start", "slash", "sliders", "smartphone", "speaker", "speedometer", "spellcheck", "square", "star", "stickies", "stop", "stopwatch", "suit-heart", "sun", "table", "tag", "tags", "telephone", "terminal", "text-paragraph", "thermometer", "three-dots", "ticket", "tools", "trash", "trophy", "truck", "tv", "umbrella", "unlock", "upload", "vector-pen", "wallet", "watch", "wifi", "window", "wrench", "x", "zoom-in", "zoom-out", "activity", "at", "award", "backspace", "badge-3d", "badge-4k", "badge-8k", "badge-ad", "badge-ar", "badge-cc", "badge-hd", "badge-tm", "badge-vo", "badge-vr", "badge-wc", "bar-chart", "battery", "bicycle", "binoculars", "blockquote-left", "blockquote-right", "book", "bookshelf", "bootstrap", "border-all", "border-bottom", "border-center", "border-inner", "border-left", "border-middle", "border-outer", "border-right", "border-style", "border-top", "border-width", "bounding-box", "box-arrow-down", "box-arrow-in-down", "box-arrow-in-left", "box-arrow-in-right", "box-arrow-in-up", "box-arrow-left", "box-arrow-right", "box-arrow-up", "box-seam", "brightness-alt-high", "brightness-alt-low", "brightness-high", "brightness-low", "broadcast", "brush", "bucket", "bug", "building", "bullseye", "calculator", "calendar-check", "calendar-date", "calendar-day", "calendar-event", "calendar-minus", "calendar-month", "calendar-plus", "calendar-range", "calendar-week", "calendar-x", "calendar2", "calendar3", "calendar4", "camera-reels", "camera-video", "capslock", "card-checklist", "card-heading", "card-image", "card-list", "card-text", "caret-down", "caret-left", "caret-right", "caret-up", "cart-check", "cart-dash", "cart-plus", "cart-x", "cash", "cash-stack", "cast", "chat-dots", "chat-left", "chat-quote", "chat-right", "chat-square", "chat-text", "check-all", "check-circle", "check-square", "circle", "clipboard", "cloud-arrow-down", "cloud-arrow-up", "cloud-check", "cloud-download", "cloud-fog", "cloud-hail", "cloud-lightning", "cloud-minus", "cloud-moon", "cloud-plus", "cloud-rain", "cloud-slash", "cloud-snow", "cloud-sun", "cloud-upload", "clouds", "cloudy", "code-slash", "code-square", "collection-play", "columns", "columns-gap", "compass", "cone", "cone-striped", "controller", "credit-card-2-back", "credit-card-2-front", "crop", "cup-straw", "cursor", "dash-circle", "dash-square", "diagram-2", "diagram-3", "diamond", "dice-1", "dice-2", "dice-3", "dice-4", "dice-5", "dice-6", "disc", "discord", "distribute-horizontal", "distribute-vertical", "door-open", "dot", "droplet-half", "easel", "egg-fried", "emoji-angry", "emoji-dizzy", "emoji-expressionless", "emoji-frown", "emoji-heart-eyes", "emoji-laughing", "emoji-neutral", "emoji-smile", "emoji-sunglasses", "emoji-wink", "envelope-open", "exclamation", "exclamation-circle", "exclamation-diamond", "exclamation-octagon", "exclamation-square", "exclamation-triangle", "eye-slash", "eyedropper", "facebook", "file-arrow-down", "file-arrow-up", "file-binary", "file-break", "file-check", "file-code", "file-diff", "file-earmark", "file-excel", "file-image", "file-lock", "file-medical", "file-minus", "file-music", "file-pdf", "file-person", "file-play", "file-plus", "file-post", "file-ppt", "file-richtext", "file-slides", "file-spreadsheet", "file-text", "file-word", "file-zip", "files", "film", "filter-circle", "filter-left", "filter-right", "filter-square", "fingerprint", "flower1", "flower2", "flower3", "folder-check", "folder-minus", "folder-plus", "folder-symlink", "folder-x", "folder2-open", "fonts", "forward", "front", "fullscreen", "fullscreen-exit", "funnel", "gear-wide", "gender-female", "gender-male", "gender-trans", "geo", "geo-alt", "github", "globe", "google", "graph-down", "grid-1x2", "grid-3x2", "grid-3x3", "grip-horizontal", "grip-vertical", "hand-index", "hand-thumbs-down", "handbag", "hash", "headphones", "headset", "heart-half", "heptagon", "hourglass", "hourglass-bottom", "hourglass-split", "hourglass-top", "house-door", "hr", "hurricane", "image-alt", "images", "infinity", "input-cursor", "instagram", "intersect", "journal-album", "journal-arrow-down", "journal-arrow-up", "journal-bookmark", "journal-check", "journal-code", "journal-medical", "journal-minus", "journal-plus", "journal-richtext", "journal-text", "journal-x", "journals", "justify", "kanban", "keyboard", "ladder", "lamp", "layers-half", "layout-sidebar", "layout-split", "layout-three-columns", "life-preserver", "lightbulb-off", "lightning", "lightning-charge", "link-45deg", "linkedin", "list-check", "list-nested", "list-ol", "list-stars", "list-task", "list-ul", "mailbox", "markdown", "mask", "mastodon", "megaphone", "menu-app", "menu-button", "messenger", "mic-mute", "minecart", "minecart-loaded", "moisture", "mouse2", "mouse3", "music-note-beamed", "music-note-list", "music-player", "node-minus", "node-plus", "nut", "octagon", "option", "outlet", "paint-bucket", "patch-check", "patch-exclamation", "patch-minus", "patch-plus", "patch-question", "pause-btn", "pause-circle", "peace", "pen", "pencil-square", "pentagon", "person-badge", "person-bounding-box", "person-circle", "person-lines-fill", "phone-landscape", "phone-vibrate", "pie-chart-fill", "pin", "pin-angle", "pin-fill", "pin-map", "pip", "play-btn", "play-circle", "plug", "plus-circle", "plus-square", "power", "question", "question-diamond", "question-square", "rainbow", "receipt", "receipt-cutoff", "reception-0", "reception-1", "reception-2", "reception-3", "record-btn", "record-circle", "record2", "recycle", "reddit", "reply-all", "router", "rulers", "safe", "save2", "sd-card", "segmented-nav", "shield-check", "shield-exclamation", "shield-lock", "shield-shaded", "shield-slash", "shift", "signpost", "signpost-2", "signpost-split", "sim", "skip-backward", "skip-forward", "slack", "slash-circle", "slash-square", "smartwatch", "snow", "snow2", "snow3", "sort-alpha-down", "sort-alpha-up", "sort-numeric-down", "sort-numeric-up", "soundwave", "speedometer2", "square-half", "stack", "star-half", "stars", "stop-btn", "stop-circle", "suit-club", "suit-diamond", "suit-spade", "sunglasses", "sunrise", "sunset", "symmetry-horizontal", "symmetry-vertical", "tablet", "tablet-landscape", "telegram", "telephone-forward", "telephone-inbound", "telephone-outbound", "telephone-plus", "telephone-x", "text-center", "text-indent-left", "text-indent-right", "text-left", "text-right", "thermometer-half", "thermometer-high", "thermometer-low", "thermometer-snow", "thermometer-sun", "three-dots-vertical", "toggle-off", "toggle-on", "toggle2-off", "toggle2-on", "tornado", "translate", "trash2", "tree", "truck-flatbed", "tsunami", "type", "type-bold", "type-h1", "type-h2", "type-h3", "type-italic", "type-strikethrough", "type-underline", "ui-checks", "ui-checks-grid", "ui-radios", "ui-radios-grid", "union", "upc", "upc-scan", "view-list", "view-stacked", "vinyl", "voicemail", "volume-down", "volume-mute", "volume-off", "volume-up", "vr", "wallet2", "water", "whatsapp", "wifi-1", "wifi-2", "wifi-off", "wind", "window-dock", "window-sidebar", "x-circle", "x-diamond", "x-octagon", "x-square", "youtube"];
- state.Component.register("IconPicker", (container) => {
- container._thisObj = container;
- container.state = state.NewState({ value: "", search: "", open: false });
- container.addEventListener("bind", (e) => {
- container.state.value = e.detail || "";
- });
- Object.defineProperty(container, "value", {
- get: () => container.state.value,
- set: (v) => {
- container.state.value = v || "";
- }
- });
- Object.defineProperty(container, "filteredIcons", {
- get: () => {
- var _a;
- const s = ((_a = container.state.search) == null ? void 0 : _a.toLowerCase()) || "";
- return BOOTSTRAP_ICONS.filter((i) => i.includes(s));
- }
- });
- container.selectIcon = (icon) => {
- container.state.value = icon;
- container.state.open = false;
- container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: icon }));
- };
- container.toggle = () => {
- container.state.open = !container.state.open;
- if (container.state.open) {
- setTimeout(() => {
- var _a;
- (_a = state.$(container, "input")) == null ? void 0 : _a.focus();
- }, 10);
- }
- };
- const onGlobalClick = (e) => {
- if (!container.contains(e.target)) {
- container.state.open = false;
- }
- };
- window.addEventListener("click", onGlobalClick);
- container.addEventListener("remove", () => window.removeEventListener("click", onGlobalClick));
- }, state.Util.makeDom(
- /*html*/
- `
-
-
-
-
-
-
-
-
-
No icons found
-
-
-
-`
- ), state.Util.makeDom(
- /*html*/
- ``
- ));
- AutoForm.register("DatePicker");
- AutoForm.register("ColorPicker");
- AutoForm.register("IconPicker");
const VirtualScroll = (options = {}) => {
const itemHeights = /* @__PURE__ */ new Map();
const groupHeights = /* @__PURE__ */ new Map();
@@ -850,101 +752,166 @@
`
));
- let _mouseMoverMoving = false;
- let _mouseMoverPos = {};
- let _mouseMoverEvents = {};
- const MouseMover = {
- start: (event, { onmousemove, onmouseup }) => {
- _mouseMoverPos = { x: event.clientX, y: event.clientY, w: 0, h: 0 };
- _mouseMoverEvents = { onmousemove, onmouseup };
- _mouseMoverMoving = true;
- }
- };
- if (typeof document !== "undefined") {
- document.addEventListener("mouseup", (event) => {
- var _a;
- if (!_mouseMoverMoving) return;
- _mouseMoverMoving = false;
- (_a = _mouseMoverEvents.onmouseup) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
- });
- document.addEventListener("mousemove", (event) => {
- var _a;
- if (!_mouseMoverMoving) return;
- _mouseMoverPos.w = event.clientX - _mouseMoverPos.x;
- _mouseMoverPos.h = event.clientY - _mouseMoverPos.y;
- (_a = _mouseMoverEvents.onmousemove) == null ? void 0 : _a.call(_mouseMoverEvents, { event, ..._mouseMoverPos });
- });
- }
- state.Component.register("Resizer", (container) => {
- container.isVertical = container.hasAttribute("vertical");
- const min = parseInt(container.getAttribute("min")) || 10;
- const max = parseInt(container.getAttribute("max")) || 1e3;
- const target = container.target || container.previousElementSibling;
+ state.Component.register("DatePicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ start: "", end: "" });
container.addEventListener("bind", (e) => {
- if (e.detail !== void 0 && e.detail !== null) {
- target.style[container.isVertical ? "height" : "width"] = e.detail + "px";
+ var _a, _b, _c;
+ container.state.start = e.detail || "";
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
+ if (form && rangeEnd) {
+ container.state.end = form.data[rangeEnd] || "";
}
});
- const getSize = (startSize, w, h) => {
- const newSize = startSize + (container.isVertical ? h : w);
- return newSize < min ? min : newSize > max ? max : newSize;
- };
- container.addEventListener("mousedown", (event) => {
- const startSize = container.isVertical ? target.offsetHeight : target.offsetWidth;
- MouseMover.start(event, {
- onmousemove: ({ w, h }) => {
- const newSize = getSize(startSize, w, h);
- target.style[container.isVertical ? "height" : "width"] = newSize + "px";
- container.dispatchEvent(new CustomEvent("resizing", { detail: { oldSize: startSize, newSize }, bubbles: false }));
- },
- onmouseup: ({ w, h }) => {
- const newSize = getSize(startSize, w, h);
- container.dispatchEvent(new CustomEvent("resize", { detail: { oldSize: startSize, newSize }, bubbles: false }));
- container.dispatchEvent(new CustomEvent("change", { detail: newSize, bubbles: false }));
- }
- });
+ Object.defineProperty(container, "isRange", {
+ get: () => {
+ var _a, _b, _c;
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ return !!(((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd);
+ }
});
+ Object.defineProperty(container, "value", {
+ get: () => container.state.start,
+ set: (v) => {
+ container.state.start = v || "";
+ }
+ });
+ container.updateStart = (val) => {
+ container.state.start = val;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
+ };
+ container.updateEnd = (val) => {
+ var _a, _b, _c;
+ container.state.end = val;
+ const form = container.closest("AutoForm");
+ const name = container.getAttribute("name");
+ const item = (_b = (_a = form == null ? void 0 : form.state) == null ? void 0 : _a.schema) == null ? void 0 : _b.find((i) => i.name === name);
+ const rangeEnd = ((_c = item == null ? void 0 : item.setting) == null ? void 0 : _c.rangeEnd) || container.rangeEnd;
+ if (form && rangeEnd) {
+ form.data[rangeEnd] = val;
+ }
+ };
}, state.Util.makeDom(
/*html*/
`
-
+
+
+
+ -
+
+
+
`
));
- if (typeof window !== "undefined") {
- window.addEventListener("beforeunload", (event) => {
- if (state.State.exitBlocks > 0) event.preventDefault();
+ state.Component.register("ColorPicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ value: "#000000" });
+ container.addEventListener("bind", (e) => {
+ container.state.value = e.detail || "#000000";
});
- }
- const htmlNode = document.documentElement;
- if (!htmlNode.hasAttribute("$data-bs-theme") && !htmlNode.hasAttribute("data-bs-theme")) {
- htmlNode.setAttribute("$data-bs-theme", "LocalStorage.darkMode?'dark':'light'");
- }
+ Object.defineProperty(container, "value", {
+ get: () => container.state.value,
+ set: (v) => {
+ container.state.value = v || "#000000";
+ }
+ });
+ container.updateValue = (val) => {
+ container.state.value = val;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: val }));
+ };
+ }, state.Util.makeDom(
+ /*html*/
+ `
+
+
+
+
+`
+ ));
+ const BOOTSTRAP_ICONS = ["alarm", "archive", "arrow-left", "arrow-right", "bag", "bank", "basket", "bell", "bookmark", "box", "briefcase", "calendar", "camera", "cart", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "clock", "cloud", "code", "collection", "command", "cpu", "credit-card", "cup", "dash", "database", "display", "door-closed", "download", "droplet", "earbuds", "edit", "egg", "eject", "envelope", "eraser", "eye", "file", "filter", "flag", "folder", "gear", "gem", "gift", "graph-up", "grid", "hammer", "hand-thumbs-up", "heart", "house", "image", "inbox", "info-circle", "journal", "key", "laptop", "layers", "layout-text-sidebar-reverse", "lightbulb", "link", "list", "lock", "map", "mic", "moon", "mouse", "music-note", "newspaper", "palette", "paperclip", "pause", "pencil", "person", "phone", "pie-chart", "play", "plus", "printer", "puzzle", "question-circle", "reception-4", "record", "reply", "rss", "save", "search", "send", "server", "share", "shield", "shop", "shuffle", "skip-end", "skip-start", "slash", "sliders", "smartphone", "speaker", "speedometer", "spellcheck", "square", "star", "stickies", "stop", "stopwatch", "suit-heart", "sun", "table", "tag", "tags", "telephone", "terminal", "text-paragraph", "thermometer", "three-dots", "ticket", "tools", "trash", "trophy", "truck", "tv", "umbrella", "unlock", "upload", "vector-pen", "wallet", "watch", "wifi", "window", "wrench", "x", "zoom-in", "zoom-out", "activity", "at", "award", "backspace", "badge-3d", "badge-4k", "badge-8k", "badge-ad", "badge-ar", "badge-cc", "badge-hd", "badge-tm", "badge-vo", "badge-vr", "badge-wc", "bar-chart", "battery", "bicycle", "binoculars", "blockquote-left", "blockquote-right", "book", "bookshelf", "bootstrap", "border-all", "border-bottom", "border-center", "border-inner", "border-left", "border-middle", "border-outer", "border-right", "border-style", "border-top", "border-width", "bounding-box", "box-arrow-down", "box-arrow-in-down", "box-arrow-in-left", "box-arrow-in-right", "box-arrow-in-up", "box-arrow-left", "box-arrow-right", "box-arrow-up", "box-seam", "brightness-alt-high", "brightness-alt-low", "brightness-high", "brightness-low", "broadcast", "brush", "bucket", "bug", "building", "bullseye", "calculator", "calendar-check", "calendar-date", "calendar-day", "calendar-event", "calendar-minus", "calendar-month", "calendar-plus", "calendar-range", "calendar-week", "calendar-x", "calendar2", "calendar3", "calendar4", "camera-reels", "camera-video", "capslock", "card-checklist", "card-heading", "card-image", "card-list", "card-text", "caret-down", "caret-left", "caret-right", "caret-up", "cart-check", "cart-dash", "cart-plus", "cart-x", "cash", "cash-stack", "cast", "chat-dots", "chat-left", "chat-quote", "chat-right", "chat-square", "chat-text", "check-all", "check-circle", "check-square", "circle", "clipboard", "cloud-arrow-down", "cloud-arrow-up", "cloud-check", "cloud-download", "cloud-fog", "cloud-hail", "cloud-lightning", "cloud-minus", "cloud-moon", "cloud-plus", "cloud-rain", "cloud-slash", "cloud-snow", "cloud-sun", "cloud-upload", "clouds", "cloudy", "code-slash", "code-square", "collection-play", "columns", "columns-gap", "compass", "cone", "cone-striped", "controller", "credit-card-2-back", "credit-card-2-front", "crop", "cup-straw", "cursor", "dash-circle", "dash-square", "diagram-2", "diagram-3", "diamond", "dice-1", "dice-2", "dice-3", "dice-4", "dice-5", "dice-6", "disc", "discord", "distribute-horizontal", "distribute-vertical", "door-open", "dot", "droplet-half", "easel", "egg-fried", "emoji-angry", "emoji-dizzy", "emoji-expressionless", "emoji-frown", "emoji-heart-eyes", "emoji-laughing", "emoji-neutral", "emoji-smile", "emoji-sunglasses", "emoji-wink", "envelope-open", "exclamation", "exclamation-circle", "exclamation-diamond", "exclamation-octagon", "exclamation-square", "exclamation-triangle", "eye-slash", "eyedropper", "facebook", "file-arrow-down", "file-arrow-up", "file-binary", "file-break", "file-check", "file-code", "file-diff", "file-earmark", "file-excel", "file-image", "file-lock", "file-medical", "file-minus", "file-music", "file-pdf", "file-person", "file-play", "file-plus", "file-post", "file-ppt", "file-richtext", "file-slides", "file-spreadsheet", "file-text", "file-word", "file-zip", "files", "film", "filter-circle", "filter-left", "filter-right", "filter-square", "fingerprint", "flower1", "flower2", "flower3", "folder-check", "folder-minus", "folder-plus", "folder-symlink", "folder-x", "folder2-open", "fonts", "forward", "front", "fullscreen", "fullscreen-exit", "funnel", "gear-wide", "gender-female", "gender-male", "gender-trans", "geo", "geo-alt", "github", "globe", "google", "graph-down", "grid-1x2", "grid-3x2", "grid-3x3", "grip-horizontal", "grip-vertical", "hand-index", "hand-thumbs-down", "handbag", "hash", "headphones", "headset", "heart-half", "heptagon", "hourglass", "hourglass-bottom", "hourglass-split", "hourglass-top", "house-door", "hr", "hurricane", "image-alt", "images", "infinity", "input-cursor", "instagram", "intersect", "journal-album", "journal-arrow-down", "journal-arrow-up", "journal-bookmark", "journal-check", "journal-code", "journal-medical", "journal-minus", "journal-plus", "journal-richtext", "journal-text", "journal-x", "journals", "justify", "kanban", "keyboard", "ladder", "lamp", "layers-half", "layout-sidebar", "layout-split", "layout-three-columns", "life-preserver", "lightbulb-off", "lightning", "lightning-charge", "link-45deg", "linkedin", "list-check", "list-nested", "list-ol", "list-stars", "list-task", "list-ul", "mailbox", "markdown", "mask", "mastodon", "megaphone", "menu-app", "menu-button", "messenger", "mic-mute", "minecart", "minecart-loaded", "moisture", "mouse2", "mouse3", "music-note-beamed", "music-note-list", "music-player", "node-minus", "node-plus", "nut", "octagon", "option", "outlet", "paint-bucket", "patch-check", "patch-exclamation", "patch-minus", "patch-plus", "patch-question", "pause-btn", "pause-circle", "peace", "pen", "pencil-square", "pentagon", "person-badge", "person-bounding-box", "person-circle", "person-lines-fill", "phone-landscape", "phone-vibrate", "pie-chart-fill", "pin", "pin-angle", "pin-fill", "pin-map", "pip", "play-btn", "play-circle", "plug", "plus-circle", "plus-square", "power", "question", "question-diamond", "question-square", "rainbow", "receipt", "receipt-cutoff", "reception-0", "reception-1", "reception-2", "reception-3", "record-btn", "record-circle", "record2", "recycle", "reddit", "reply-all", "router", "rulers", "safe", "save2", "sd-card", "segmented-nav", "shield-check", "shield-exclamation", "shield-lock", "shield-shaded", "shield-slash", "shift", "signpost", "signpost-2", "signpost-split", "sim", "skip-backward", "skip-forward", "slack", "slash-circle", "slash-square", "smartwatch", "snow", "snow2", "snow3", "sort-alpha-down", "sort-alpha-up", "sort-numeric-down", "sort-numeric-up", "soundwave", "speedometer2", "square-half", "stack", "star-half", "stars", "stop-btn", "stop-circle", "suit-club", "suit-diamond", "suit-spade", "sunglasses", "sunrise", "sunset", "symmetry-horizontal", "symmetry-vertical", "tablet", "tablet-landscape", "telegram", "telephone-forward", "telephone-inbound", "telephone-outbound", "telephone-plus", "telephone-x", "text-center", "text-indent-left", "text-indent-right", "text-left", "text-right", "thermometer-half", "thermometer-high", "thermometer-low", "thermometer-snow", "thermometer-sun", "three-dots-vertical", "toggle-off", "toggle-on", "toggle2-off", "toggle2-on", "tornado", "translate", "trash2", "tree", "truck-flatbed", "tsunami", "type", "type-bold", "type-h1", "type-h2", "type-h3", "type-italic", "type-strikethrough", "type-underline", "ui-checks", "ui-checks-grid", "ui-radios", "ui-radios-grid", "union", "upc", "upc-scan", "view-list", "view-stacked", "vinyl", "voicemail", "volume-down", "volume-mute", "volume-off", "volume-up", "vr", "wallet2", "water", "whatsapp", "wifi-1", "wifi-2", "wifi-off", "wind", "window-dock", "window-sidebar", "x-circle", "x-diamond", "x-octagon", "x-square", "youtube"];
+ state.Component.register("IconPicker", (container) => {
+ container._thisObj = container;
+ container.state = state.NewState({ value: "", search: "", open: false });
+ container.addEventListener("bind", (e) => {
+ container.state.value = e.detail || "";
+ });
+ Object.defineProperty(container, "value", {
+ get: () => container.state.value,
+ set: (v) => {
+ container.state.value = v || "";
+ }
+ });
+ Object.defineProperty(container, "filteredIcons", {
+ get: () => {
+ var _a;
+ const s = ((_a = container.state.search) == null ? void 0 : _a.toLowerCase()) || "";
+ return BOOTSTRAP_ICONS.filter((i) => i.includes(s));
+ }
+ });
+ container.selectIcon = (icon) => {
+ container.state.value = icon;
+ container.state.open = false;
+ container.dispatchEvent(new CustomEvent("change", { bubbles: true, detail: icon }));
+ };
+ container.toggle = () => {
+ container.state.open = !container.state.open;
+ if (container.state.open) {
+ setTimeout(() => {
+ var _a;
+ (_a = state.$(container, "input")) == null ? void 0 : _a.focus();
+ }, 10);
+ }
+ };
+ const onGlobalClick = (e) => {
+ if (!container.contains(e.target)) {
+ container.state.open = false;
+ }
+ };
+ window.addEventListener("click", onGlobalClick);
+ container.addEventListener("remove", () => window.removeEventListener("click", onGlobalClick));
+ }, state.Util.makeDom(
+ /*html*/
+ `
+
+
+
+
+
+
+
+
+
No icons found
+
+
+
+`
+ ), state.Util.makeDom(
+ /*html*/
+ ``
+ ));
+ AutoForm.register("DatePicker");
+ AutoForm.register("ColorPicker");
+ AutoForm.register("IconPicker");
globalThis.HTTP = HTTP;
globalThis.UI = UI$1;
globalThis.AutoForm = AutoForm;
globalThis.MouseMover = MouseMover;
globalThis.VirtualScroll = VirtualScroll;
- const ApigoBase = {
- HTTP,
- UI: UI$1,
- AutoForm,
- MouseMover,
- VirtualScroll,
- State: state.State,
- List: VirtualScroll
- };
- if (typeof document !== "undefined") {
- globalThis.ApigoBase = ApigoBase;
- }
- Object.defineProperty(exports2, "State", {
- enumerable: true,
- get: () => state.State
- });
- exports2.APIComponent = APIComponent;
- exports2.AutoForm = AutoForm;
- exports2.HTTP = HTTP;
- exports2.MouseMover = MouseMover;
- exports2.UI = UI$1;
- exports2.VirtualScroll = VirtualScroll;
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
-});
+ globalThis.List = VirtualScroll;
+})(bootstrap, ApigoState);
diff --git a/vite.config.js b/vite.config.js
index 472a664..3f4a8ef 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -19,22 +19,22 @@ export default defineConfig({
lib: {
entry: resolve(__dirname, 'src/index.js'),
name: 'ApigoBase',
- formats: ['umd']
+ formats: ['iife']
},
rollupOptions: {
- external: ['@apigo.cc/state', '@apigo.cc/bootstrap'],
+ external: ['@apigo.cc/state', '@apigo.cc/bootstrap'],
output: [
{
- format: 'umd',
+ format: 'iife',
name: 'ApigoBase',
entryFileNames: 'base.js',
globals: {
- '@apigo.cc/state': 'ApigoState',
+ '@apigo.cc/state': 'ApigoState', // Dummy mapping, as we rely on globalThis.State etc.
'@apigo.cc/bootstrap': 'bootstrap'
}
},
{
- format: 'umd',
+ format: 'iife',
name: 'ApigoBase',
entryFileNames: 'base.min.js',
globals: {