litos-ui 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base.d.ts +3 -2
- package/lib/base.js +11 -8
- package/lib/button/index.d.ts +21 -5
- package/lib/button/index.js +115 -62
- package/lib/button/index.less_inline.js +2 -3
- package/lib/button/style.js +1 -2
- package/lib/calendar/index.js +22 -24
- package/lib/calendar/index.less_inline.js +1 -2
- package/lib/calendar/langs.js +1 -2
- package/lib/card/index.js +8 -9
- package/lib/card/index.less_inline.js +1 -2
- package/lib/carousel/index.js +10 -11
- package/lib/carousel/index.less_inline.js +1 -2
- package/lib/carousel/item.js +1 -2
- package/lib/carousel/item.less_inline.js +1 -2
- package/lib/carousel/timer.js +1 -2
- package/lib/check/check.d.ts +40 -8
- package/lib/check/check.js +200 -65
- package/lib/check/check.less_inline.js +2 -3
- package/lib/check/checkbox.js +2 -3
- package/lib/check/checkbox.less_inline.js +2 -3
- package/lib/check/checkbox_group.js +1 -2
- package/lib/check/index.d.ts +28 -8
- package/lib/check/index.js +151 -46
- package/lib/check/index.less_inline.js +1 -2
- package/lib/check/radio.js +2 -3
- package/lib/check/radio.less_inline.js +1 -2
- package/lib/check/radio_group.js +2 -3
- package/lib/collapse/index.d.ts +12 -4
- package/lib/collapse/index.js +80 -46
- package/lib/collapse/index.less_inline.js +2 -3
- package/lib/collapse/item.d.ts +35 -9
- package/lib/collapse/item.js +219 -57
- package/lib/collapse/item.less_inline.js +2 -3
- package/lib/collapse/types.d.ts +17 -3
- package/lib/color_picker/index.d.ts +4 -2
- package/lib/color_picker/index.js +26 -17
- package/lib/color_picker/index.less_inline.js +1 -2
- package/lib/date_picker/index.d.ts +5 -1
- package/lib/date_picker/index.js +39 -23
- package/lib/date_picker/index.less_inline.js +1 -2
- package/lib/date_picker_ori/index.d.ts +7 -2
- package/lib/date_picker_ori/index.js +123 -47
- package/lib/date_picker_ori/index.less_inline.js +1 -2
- package/lib/description_panel/index.js +2 -10
- package/lib/description_panel/index.less_inline.js +1 -2
- package/lib/dialog/dialog_box.js +28 -29
- package/lib/dialog/dialog_container.css_inline.js +1 -2
- package/lib/dialog/dialog_container.js +13 -14
- package/lib/dialog/dialog_container_style.js +1 -2
- package/lib/dialog/index.js +1 -2
- package/lib/dropdown/index.d.ts +39 -0
- package/lib/dropdown/index.js +98 -0
- package/lib/entries/base.js +1 -2
- package/lib/entries/button.js +5 -6
- package/lib/entries/calendar.js +5 -6
- package/lib/entries/card.js +5 -6
- package/lib/entries/carousel-item.js +5 -6
- package/lib/entries/carousel.js +5 -6
- package/lib/entries/checkbox-group.js +5 -6
- package/lib/entries/checkbox.js +5 -6
- package/lib/entries/collapse-item.d.ts +0 -1
- package/lib/entries/collapse-item.js +6 -6
- package/lib/entries/collapse.d.ts +0 -1
- package/lib/entries/collapse.js +11 -6
- package/lib/entries/color-picker.js +5 -6
- package/lib/entries/date-picker-ori.js +5 -6
- package/lib/entries/date-picker.js +5 -6
- package/lib/entries/description-panel.js +5 -6
- package/lib/entries/dialog-box.js +1 -2
- package/lib/entries/dialog-container.js +5 -6
- package/lib/entries/dialog.js +1 -2
- package/lib/entries/dropdown.d.ts +2 -0
- package/lib/entries/dropdown.js +1 -0
- package/lib/entries/form-item.js +5 -6
- package/lib/entries/form.js +5 -6
- package/lib/entries/icon-arrow-down.js +5 -6
- package/lib/entries/icon-arrow-left.js +5 -6
- package/lib/entries/icon-arrow-right.js +5 -6
- package/lib/entries/icon-arrow-up.js +5 -6
- package/lib/entries/icon-base.js +5 -6
- package/lib/entries/icon-calendar.js +5 -6
- package/lib/entries/icon-caret-bottom.js +5 -6
- package/lib/entries/icon-caret-top.js +5 -6
- package/lib/entries/icon-close-filled.js +5 -6
- package/lib/entries/icon-close.js +5 -6
- package/lib/entries/icon-copy.js +5 -6
- package/lib/entries/icon-d-arrow-left.js +5 -6
- package/lib/entries/icon-d-arrow-right.js +5 -6
- package/lib/entries/icon-delete.js +5 -6
- package/lib/entries/icon-eye-outline.js +5 -6
- package/lib/entries/icon-font-icon.js +5 -6
- package/lib/entries/icon-info.js +5 -6
- package/lib/entries/icon-loading.js +5 -6
- package/lib/entries/icon-minus.js +5 -6
- package/lib/entries/icon-moon.js +5 -6
- package/lib/entries/icon-more.js +5 -6
- package/lib/entries/icon-picture.js +5 -6
- package/lib/entries/icon-plus.js +5 -6
- package/lib/entries/icon-reduction.js +5 -6
- package/lib/entries/icon-refresh-left.js +5 -6
- package/lib/entries/icon-refresh-right.js +5 -6
- package/lib/entries/icon-refresh.js +5 -6
- package/lib/entries/icon-search.js +5 -6
- package/lib/entries/icon-select.js +5 -6
- package/lib/entries/icon-sort.js +5 -6
- package/lib/entries/icon-success.js +5 -6
- package/lib/entries/icon-sun.js +5 -6
- package/lib/entries/icon-theme-default.js +5 -6
- package/lib/entries/icon-warn.js +5 -6
- package/lib/entries/icon-zoom-in.js +5 -6
- package/lib/entries/icon-zoom-out.js +5 -6
- package/lib/entries/image-preview.js +5 -6
- package/lib/entries/image.js +5 -6
- package/lib/entries/input-number.js +5 -6
- package/lib/entries/input.js +5 -6
- package/lib/entries/list.js +5 -6
- package/lib/entries/loading.js +1 -2
- package/lib/entries/mask.js +5 -6
- package/lib/entries/md-input.js +5 -6
- package/lib/entries/menu.js +5 -6
- package/lib/entries/message.js +1 -2
- package/lib/entries/modal-box.js +1 -2
- package/lib/entries/modal.js +5 -6
- package/lib/entries/notification-box.js +1 -2
- package/lib/entries/notification.js +1 -2
- package/lib/entries/page-header.js +5 -6
- package/lib/entries/pagination.js +5 -6
- package/lib/entries/polygon.js +5 -6
- package/lib/entries/popconfirm.js +1 -2
- package/lib/entries/popover.js +1 -2
- package/lib/entries/qrcode.js +5 -6
- package/lib/entries/radio-group.js +5 -6
- package/lib/entries/radio.js +5 -6
- package/lib/entries/select-ori.js +5 -6
- package/lib/entries/select.js +5 -6
- package/lib/entries/space.js +5 -6
- package/lib/entries/switch.js +5 -6
- package/lib/entries/tabbar-item.js +5 -6
- package/lib/entries/tabbar.js +5 -6
- package/lib/entries/table.js +5 -6
- package/lib/entries/tabs.js +1 -2
- package/lib/entries/tag.js +5 -6
- package/lib/entries/theme-color.js +5 -6
- package/lib/entries/theme.js +5 -6
- package/lib/entries/transition.js +1 -2
- package/lib/entries/upload.js +5 -6
- package/lib/entries/utils.js +1 -3
- package/lib/form/accessibility.d.ts +15 -0
- package/lib/form/accessibility.js +56 -0
- package/lib/form/autocomplete.d.ts +21 -0
- package/lib/form/autocomplete.js +59 -0
- package/lib/form/context.d.ts +157 -0
- package/lib/form/context.js +88 -0
- package/lib/form/form_inner.d.ts +99 -24
- package/lib/form/form_inner.js +424 -72
- package/lib/form/form_item.d.ts +35 -11
- package/lib/form/form_item.js +210 -78
- package/lib/form/form_item.less_inline.js +2 -3
- package/lib/form/form_item_style.d.ts +3 -0
- package/lib/form/form_item_style.js +7 -0
- package/lib/form/index.d.ts +69 -15
- package/lib/form/index.js +501 -101
- package/lib/form/index.less_inline.js +1 -2
- package/lib/form/owner.d.ts +78 -0
- package/lib/form/owner.js +138 -0
- package/lib/form/style.d.ts +3 -0
- package/lib/form/style.js +7 -0
- package/lib/icon/arrow_down.js +1 -2
- package/lib/icon/arrow_left.js +1 -2
- package/lib/icon/arrow_right.js +1 -2
- package/lib/icon/arrow_up.js +1 -2
- package/lib/icon/base.js +1 -2
- package/lib/icon/calendar.js +1 -2
- package/lib/icon/caret_bottom.js +1 -2
- package/lib/icon/caret_top.js +1 -2
- package/lib/icon/close.js +1 -2
- package/lib/icon/close_filled.js +1 -2
- package/lib/icon/copy.js +1 -2
- package/lib/icon/d_arrow_left.js +1 -2
- package/lib/icon/d_arrow_right.js +1 -2
- package/lib/icon/delete.js +1 -2
- package/lib/icon/eye_outline.js +1 -2
- package/lib/icon/font_icon.js +1 -2
- package/lib/icon/icon_style.js +1 -2
- package/lib/icon/index.less_inline.js +1 -2
- package/lib/icon/info.js +1 -2
- package/lib/icon/loading.js +1 -2
- package/lib/icon/minus.js +1 -2
- package/lib/icon/moon.js +1 -2
- package/lib/icon/more.js +1 -2
- package/lib/icon/picture.js +1 -2
- package/lib/icon/plus.js +1 -2
- package/lib/icon/reduction.js +1 -2
- package/lib/icon/refresh.js +1 -2
- package/lib/icon/refresh_left.js +1 -2
- package/lib/icon/refresh_right.js +1 -2
- package/lib/icon/search.js +1 -2
- package/lib/icon/select.js +1 -2
- package/lib/icon/sort.js +1 -2
- package/lib/icon/success.js +1 -2
- package/lib/icon/sun.js +1 -2
- package/lib/icon/theme_default.js +1 -2
- package/lib/icon/warn.js +1 -2
- package/lib/icon/zoom_in.js +1 -2
- package/lib/icon/zoom_out.js +1 -2
- package/lib/image/image_preview.js +1 -2
- package/lib/image/image_preview.less_inline.js +1 -2
- package/lib/image/index.js +1 -2
- package/lib/image/index.less_inline.js +1 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +91 -91
- package/lib/input/index.d.ts +14 -0
- package/lib/input/index.js +126 -31
- package/lib/input/index.less_inline.js +2 -3
- package/lib/input/input_inner.less_inline.js +1 -2
- package/lib/input/style.d.ts +1 -0
- package/lib/input/style.js +5 -7
- package/lib/input_number/index.d.ts +7 -0
- package/lib/input_number/index.js +70 -48
- package/lib/input_number/index.less_inline.js +1 -2
- package/lib/input_number/style.js +1 -2
- package/lib/list/index.js +4 -5
- package/lib/list/index.less_inline.js +1 -2
- package/lib/loading/index.js +1 -2
- package/lib/mask/index.js +2 -7
- package/lib/mask/index.less_inline.js +1 -2
- package/lib/md_input/index.d.ts +11 -2
- package/lib/md_input/index.js +63 -27
- package/lib/md_input/index.less_inline.js +2 -3
- package/lib/menu/index.js +2 -7
- package/lib/menu/index.less_inline.js +1 -2
- package/lib/message/index.js +1 -2
- package/lib/modal/index.js +15 -16
- package/lib/modal/index.less_inline.js +1 -2
- package/lib/modal/modal_box.js +24 -25
- package/lib/notification/index.js +15 -29
- package/lib/notification/index.less_inline.js +1 -2
- package/lib/notification/notification_box.js +2 -3
- package/lib/notification/placement.js +1 -2
- package/lib/notification/style.js +1 -2
- package/lib/page_header/index.js +1 -2
- package/lib/page_header/index.less_inline.js +1 -2
- package/lib/pagination/index.js +2 -7
- package/lib/pagination/index.less_inline.js +1 -2
- package/lib/polygon/index.js +1 -2
- package/lib/polygon/index.less_inline.js +1 -2
- package/lib/qrcode/index.js +1 -2
- package/lib/qrcode/index.less_inline.js +1 -2
- package/lib/select/index.d.ts +19 -2
- package/lib/select/index.js +128 -74
- package/lib/select/index.less_inline.js +1 -2
- package/lib/select_ori/index.d.ts +9 -1
- package/lib/select_ori/index.js +36 -24
- package/lib/select_ori/index.less_inline.js +1 -2
- package/lib/space/index.js +1 -2
- package/lib/space/index.less_inline.js +1 -2
- package/lib/styles/animation/index.css_inline.js +1 -2
- package/lib/styles/animation/index.js +1 -2
- package/lib/styles/mask/index.css_inline.js +1 -2
- package/lib/styles/mask/index.js +1 -2
- package/lib/switch/index.d.ts +6 -0
- package/lib/switch/index.js +31 -16
- package/lib/switch/index.less_inline.js +1 -2
- package/lib/tabbar/index.js +1 -2
- package/lib/tabbar/index.less_inline.js +1 -2
- package/lib/tabbar/item.js +1 -2
- package/lib/tabbar/item.less_inline.js +1 -2
- package/lib/table/index.js +1 -2
- package/lib/table/index.less_inline.js +1 -2
- package/lib/tabs/index.js +1 -2
- package/lib/tag/index.d.ts +11 -3
- package/lib/tag/index.js +25 -24
- package/lib/tag/index.less_inline.js +2 -3
- package/lib/theme/appearance.d.ts +5 -0
- package/lib/theme/appearance.js +34 -0
- package/lib/theme/index.js +83 -39
- package/lib/theme/index.less_inline.js +1 -2
- package/lib/theme/theme_color.js +1 -2
- package/lib/upload/index.js +28 -41
- package/lib/upload/index.less_inline.js +2 -3
- package/lib/upload/style.js +1 -2
- package/lib/utils/clickoutside.js +1 -2
- package/lib/utils/event.js +1 -2
- package/lib/utils/index.d.ts +27 -6
- package/lib/utils/index.js +26 -6
- package/lib/utils/popover.js +7 -16
- package/lib/utils/transition.js +1 -2
- package/package.json +16 -13
- package/styles/dark.css +10 -2
- package/styles/dropdown.css +46 -0
- package/styles/reset.css +0 -1
- package/styles/select.css +5 -0
- package/styles/themes/apple.css +47 -0
- package/styles/{theme-coral.css → themes/coral.css} +5 -3
- package/styles/themes/deep-sea-blue.css +12 -0
- package/styles/themes/gamboge.css +15 -0
- package/styles/{theme-jade.css → themes/jade.css} +5 -3
- package/styles/themes/lotus-seed.css +12 -0
- package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
- package/styles/themes.css +8 -0
- package/styles/vars.css +8 -2
- package/types/preact.d.ts +42 -0
- package/lib/form/types.d.ts +0 -7
- package/lib/utils/context_provide.d.ts +0 -10
- package/lib/utils/context_provide.js +0 -22
- package/lib/utils/locale.d.ts +0 -6
- package/lib/utils/locale.js +0 -34
- package/lib/utils/signal_types.d.ts +0 -5
package/lib/upload/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import
|
|
1
|
+
import { kebabToCamel as e, parseAttrValue as t } from "../utils/index.js";
|
|
2
|
+
import n from "../base.js";
|
|
3
3
|
import r from "../styles/animation/index.js";
|
|
4
4
|
import i from "./style.js";
|
|
5
5
|
import { $$ as a, $one as o, addClass as s, formatClass as c, off as l, on as u, removeClass as d } from "utilane/browser";
|
|
6
|
-
|
|
6
|
+
// src/components/upload/index.ts
|
|
7
7
|
var f = (e) => {
|
|
8
8
|
if (!e || typeof e != "object") return;
|
|
9
9
|
let t = e;
|
|
@@ -48,7 +48,7 @@ function p(e, t, n) {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
var m = 0, h = class h extends
|
|
51
|
+
var m = 0, h = class h extends n {
|
|
52
52
|
static baseName = "upload";
|
|
53
53
|
$input;
|
|
54
54
|
$trigger;
|
|
@@ -218,11 +218,11 @@ var m = 0, h = class h extends e {
|
|
|
218
218
|
"with-credentials"
|
|
219
219
|
];
|
|
220
220
|
}
|
|
221
|
-
attributeChanged(
|
|
222
|
-
switch (
|
|
221
|
+
attributeChanged(n, r, i) {
|
|
222
|
+
switch (n) {
|
|
223
223
|
case "accept":
|
|
224
224
|
case "action":
|
|
225
|
-
this._state[
|
|
225
|
+
this._state[e(n)] = i ?? "";
|
|
226
226
|
break;
|
|
227
227
|
case "list-type":
|
|
228
228
|
this._state.listType = i === "picture" || i === "picture-card" ? i : "text";
|
|
@@ -233,20 +233,20 @@ var m = 0, h = class h extends e {
|
|
|
233
233
|
case "auto-upload":
|
|
234
234
|
case "show-file-list":
|
|
235
235
|
case "with-credentials":
|
|
236
|
-
this._state[
|
|
236
|
+
this._state[e(n)] = t(i, n === "auto-upload" || n === "show-file-list", n);
|
|
237
237
|
break;
|
|
238
238
|
case "max-size":
|
|
239
239
|
case "max-count":
|
|
240
240
|
case "timeout": {
|
|
241
|
-
let
|
|
242
|
-
this._state[
|
|
241
|
+
let t = i == null ? 0 : Number(i);
|
|
242
|
+
this._state[e(n)] = this._validLimit(t, n) ? t : 0;
|
|
243
243
|
break;
|
|
244
244
|
}
|
|
245
245
|
case "headers":
|
|
246
246
|
case "data": try {
|
|
247
|
-
this._state[
|
|
247
|
+
this._state[n] = this._validateRecord(i == null ? void 0 : JSON.parse(i), n);
|
|
248
248
|
} catch {
|
|
249
|
-
this._state[
|
|
249
|
+
this._state[e(n)] = {};
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -331,11 +331,8 @@ var m = 0, h = class h extends e {
|
|
|
331
331
|
raw: e.raw
|
|
332
332
|
} : void 0;
|
|
333
333
|
let t = o("slot", this.$trigger), n = o(".l-upload-trigger-image", this.$trigger), r = o(".l-upload-trigger-status", this.$trigger);
|
|
334
|
-
if (t && (t.hidden = !!e), !e)
|
|
335
|
-
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
if (e.status === "fail") {
|
|
334
|
+
if (t && (t.hidden = !!e), !e) n?.remove(), r?.remove();
|
|
335
|
+
else if (e.status === "fail") {
|
|
339
336
|
if (n?.remove(), !r || !o("l-picture-icon", r)) {
|
|
340
337
|
r?.remove();
|
|
341
338
|
let e = a("div", {
|
|
@@ -346,9 +343,7 @@ var m = 0, h = class h extends e {
|
|
|
346
343
|
});
|
|
347
344
|
e.appendChild(a("l-picture-icon", { "aria-hidden": "true" })), this.$trigger.appendChild(e);
|
|
348
345
|
}
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
n || (n = a("img", {
|
|
346
|
+
} else n || (n = a("img", {
|
|
352
347
|
class: "l-upload-trigger-image",
|
|
353
348
|
part: "image"
|
|
354
349
|
}), this.$trigger.appendChild(n)), this._updateImage(n, e), this._appendPictureProgress(this.$trigger, e);
|
|
@@ -368,14 +363,14 @@ var m = 0, h = class h extends e {
|
|
|
368
363
|
r.textContent !== i && (r.textContent = i), this._updateProgressBar(o(".l-upload-trigger-progress", n), t, "l-upload-trigger-progress");
|
|
369
364
|
}
|
|
370
365
|
_handleTriggerKeydown = (e) => {
|
|
371
|
-
e.target
|
|
366
|
+
e.target === this.$trigger && ["Enter", " "].includes(e.key) && (e.preventDefault(), this._handleClick());
|
|
372
367
|
};
|
|
373
368
|
_handleClick = () => {
|
|
374
|
-
this._state.disabled
|
|
369
|
+
!this._state.disabled && this.$input && (this._state.listType === "picture-card" && this._state.maxCount > 0 && this._state.fileList.length >= this._state.maxCount || this.$input.click());
|
|
375
370
|
};
|
|
376
371
|
_handleInputChange = (e) => {
|
|
377
372
|
let t = e.target, n = t.files;
|
|
378
|
-
|
|
373
|
+
n && n.length !== 0 && (this._handleFiles(n), t.value = "");
|
|
379
374
|
};
|
|
380
375
|
_acceptsFile(e) {
|
|
381
376
|
let t = this._state.accept.split(",").map((e) => e.trim().toLowerCase()).filter((e) => /^\.[^\s,/.]+(?:\.[^\s,/.]+)*$/.test(e) || /^[a-z0-9!#$&^_.+-]+\/(?:[a-z0-9!#$&^_.+-]+|\*)$/.test(e));
|
|
@@ -451,7 +446,7 @@ var m = 0, h = class h extends e {
|
|
|
451
446
|
o(".l-upload-list", this.root)?.remove(), this._fileNodes.clear(), this._listElement = void 0, this._listMode = void 0;
|
|
452
447
|
return;
|
|
453
448
|
}
|
|
454
|
-
|
|
449
|
+
this._listElement && this._listMode === this._state.listType || (o(".l-upload-list", this.root)?.remove(), this._fileNodes.clear(), this._listElement = a("div", {
|
|
455
450
|
class: this._state.listType === "picture-card" ? "l-upload-list l-upload-list-picture-card" : "l-upload-list l-upload-list-text",
|
|
456
451
|
part: "list"
|
|
457
452
|
}), this._listMode = this._state.listType, this._state.listType === "picture-card" && this.$trigger?.parentElement ? this.$trigger.parentElement.insertBefore(this._listElement, this.$trigger) : (o(".l-upload", this.root) || this.root).appendChild(this._listElement));
|
|
@@ -486,11 +481,7 @@ var m = 0, h = class h extends e {
|
|
|
486
481
|
}
|
|
487
482
|
_updateTextProgress(e, t) {
|
|
488
483
|
let n = o(".l-upload-list-item-progress", e);
|
|
489
|
-
|
|
490
|
-
n?.remove();
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
n || (n = a("div", { class: "l-upload-list-item-progress" }), n.appendChild(this._createProgressBar(t, "l-upload-list-item-progress-bar")), e.appendChild(n)), this._updateProgressBar(o(".l-upload-list-item-progress-bar", n), t, "l-upload-list-item-progress-bar");
|
|
484
|
+
t.status === "uploading" ? (n || (n = a("div", { class: "l-upload-list-item-progress" }), n.appendChild(this._createProgressBar(t, "l-upload-list-item-progress-bar")), e.appendChild(n)), this._updateProgressBar(o(".l-upload-list-item-progress-bar", n), t, "l-upload-list-item-progress-bar")) : n?.remove();
|
|
494
485
|
}
|
|
495
486
|
_renderFileItem(e) {
|
|
496
487
|
if (this._state.listType === "picture-card") return this._renderPictureCard(e);
|
|
@@ -604,10 +595,10 @@ var m = 0, h = class h extends e {
|
|
|
604
595
|
e && !this._dragBound ? (u(this, "dragenter", this._onDragEnter), u(this, "dragover", this._onDragOver), u(this, "dragleave", this._onDragLeave), u(this, "drop", this._onDrop), this._dragBound = !0) : !e && this._dragBound && (l(this, "dragenter", this._onDragEnter), l(this, "dragover", this._onDragOver), l(this, "dragleave", this._onDragLeave), l(this, "drop", this._onDrop), this._dragBound = !1);
|
|
605
596
|
}
|
|
606
597
|
_onDragEnter = (e) => {
|
|
607
|
-
e.preventDefault(),
|
|
598
|
+
e.preventDefault(), this._state.disabled || s(this, "l-upload-dragover");
|
|
608
599
|
};
|
|
609
600
|
_onDragOver = (e) => {
|
|
610
|
-
e.preventDefault(),
|
|
601
|
+
e.preventDefault(), this._state.disabled || s(this, "l-upload-dragover");
|
|
611
602
|
};
|
|
612
603
|
_onDragLeave = (e) => {
|
|
613
604
|
e.preventDefault(), d(this, "l-upload-dragover");
|
|
@@ -619,7 +610,7 @@ var m = 0, h = class h extends e {
|
|
|
619
610
|
};
|
|
620
611
|
handlePreview(e) {
|
|
621
612
|
let t = this._state.fileList.find((t) => t.id === e.id);
|
|
622
|
-
if (
|
|
613
|
+
if (t && t.status === "success" && !this._state.disabled) {
|
|
623
614
|
if (this._state.listType === "picture-card") {
|
|
624
615
|
let e = this._state.fileList.filter((e) => e.status === "success").map((e) => ({
|
|
625
616
|
id: e.id,
|
|
@@ -647,7 +638,7 @@ var m = 0, h = class h extends e {
|
|
|
647
638
|
}
|
|
648
639
|
upload(e) {
|
|
649
640
|
let t = e || this._state.fileList.filter((e) => e.status === "ready");
|
|
650
|
-
if (
|
|
641
|
+
if ((this._state.action || this._customRequest) && t.length !== 0) for (let e of t) {
|
|
651
642
|
let t = this._state.fileList.find((t) => t.id === e.id);
|
|
652
643
|
t && this._uploadFile(t);
|
|
653
644
|
}
|
|
@@ -662,11 +653,8 @@ var m = 0, h = class h extends e {
|
|
|
662
653
|
_currentRequest(e, t) {
|
|
663
654
|
let n = this._requests.get(e);
|
|
664
655
|
if (n?.token === t) {
|
|
665
|
-
if (this._destroyed || !this._state.fileList.includes(n.file))
|
|
666
|
-
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
return n;
|
|
656
|
+
if (this._destroyed || !this._state.fileList.includes(n.file)) this._disposeRequest(e);
|
|
657
|
+
else return n;
|
|
670
658
|
}
|
|
671
659
|
}
|
|
672
660
|
_clearRequestTimeout(e) {
|
|
@@ -689,7 +677,7 @@ var m = 0, h = class h extends e {
|
|
|
689
677
|
let i = this._currentRequest(e, t);
|
|
690
678
|
if (!i) return;
|
|
691
679
|
let { file: a, status: o } = i;
|
|
692
|
-
this._disposeRequest(e), !
|
|
680
|
+
this._disposeRequest(e), !this._destroyed && this._state.fileList.includes(a) && (a.status = "fail", this._syncPreview(this._state.fileList), this._renderFileList(), this.emit("error", { detail: {
|
|
693
681
|
file: a,
|
|
694
682
|
status: o,
|
|
695
683
|
phase: n,
|
|
@@ -721,7 +709,7 @@ var m = 0, h = class h extends e {
|
|
|
721
709
|
}
|
|
722
710
|
_reportProgress(e, t, n) {
|
|
723
711
|
let r = this._currentRequest(e, t);
|
|
724
|
-
|
|
712
|
+
r && r.phase === "upload" && Number.isFinite(n) && (r.file.percentage = Math.max(0, Math.min(100, n)), this._updateFileProgress(r.file), this.emit("progress", { detail: {
|
|
725
713
|
file: r.file,
|
|
726
714
|
percent: r.file.percentage
|
|
727
715
|
} }));
|
|
@@ -844,5 +832,4 @@ var m = 0, h = class h extends e {
|
|
|
844
832
|
}
|
|
845
833
|
}
|
|
846
834
|
};
|
|
847
|
-
//#endregion
|
|
848
835
|
export { h as default, f as defaultUploadResponseParser };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
var e = ":host{width:var(--l-upload-width,100%);height:var(--l-upload-height,auto);box-sizing:border-box;font-size:var(--l-upload-font-size,14px);color:var(--l-upload-text-color,var(--l-text-color,#000000e0));display:block}.l-upload-trigger--picture,.l-upload-trigger--picture-card{box-sizing:border-box;cursor:pointer;width:var(--l-upload-picture-size,90px);height:var(--l-upload-picture-size,90px);border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));border:1px dashed var(--l-upload-border-color,var(--l-border-color,#d9d9d9));color:var(--l-upload-border-color,var(--l-border-color,#d9d9d9));justify-content:center;align-items:center;font-size:20px;transition:color .3s,border-color .3s;display:flex;position:relative;overflow:hidden}.l-upload-trigger--picture:not(.l-upload-trigger--disabled):hover,.l-upload-trigger--picture-card:not(.l-upload-trigger--disabled):hover{color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff));border-color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff))}.l-upload-trigger-image{object-fit:contain;width:100%;height:100%;display:block}.l-upload-trigger-status{color:#fff;text-align:center;pointer-events:none;background:#00000073;flex-direction:column;justify-content:center;align-items:center;gap:6px;padding:4px;font-size:12px;display:flex;position:absolute;inset:0}.l-upload-trigger-status l-picture-icon{font-size:24px}.l-upload-trigger-progress{background:var(--l-upload-progress-color,var(--l-primary-color,#007bff));height:3px;transition:width .3s;position:absolute;bottom:0;left:0}.l-upload-progress--indeterminate{animation:1.2s ease-in-out infinite l-upload-indeterminate}.l-upload-list-item-progress{overflow:hidden}@keyframes l-upload-indeterminate{0%{transform:translate(-100%)}to{transform:translate(300%)}}@media (prefers-reduced-motion:reduce){.l-upload-progress--indeterminate{animation:none}}.l-upload-trigger--fail,.l-upload-trigger--fail:hover{color:var(--l-upload-error-color,var(--l-error-color,#f5222d));border-color:var(--l-upload-error-color,var(--l-error-color,#f5222d))}.l-upload-trigger--fail .l-upload-trigger-status,.l-upload-trigger--fail:hover .l-upload-trigger-status{color:inherit;background:var(--l-upload-background,#fff)}.l-upload-tip{color:var(--l-upload-text-secondary-color,var(--l-text-secondary-color,#
|
|
3
|
-
//#endregion
|
|
1
|
+
// src/components/upload/index.less?inline
|
|
2
|
+
var e = ":host{width:var(--l-upload-width,100%);height:var(--l-upload-height,auto);box-sizing:border-box;font-size:var(--l-upload-font-size,14px);color:var(--l-upload-text-color,var(--l-text-color,#000000e0));display:block}.l-upload-trigger--picture,.l-upload-trigger--picture-card{box-sizing:border-box;cursor:pointer;width:var(--l-upload-picture-size,90px);height:var(--l-upload-picture-size,90px);border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));border:1px dashed var(--l-upload-border-color,var(--l-border-color,#d9d9d9));color:var(--l-upload-border-color,var(--l-border-color,#d9d9d9));justify-content:center;align-items:center;font-size:20px;transition:color .3s,border-color .3s;display:flex;position:relative;overflow:hidden}.l-upload-trigger--picture:not(.l-upload-trigger--disabled):hover,.l-upload-trigger--picture-card:not(.l-upload-trigger--disabled):hover{color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff));border-color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff))}.l-upload-trigger-image{object-fit:contain;width:100%;height:100%;display:block}.l-upload-trigger-status{color:#fff;text-align:center;pointer-events:none;background:#00000073;flex-direction:column;justify-content:center;align-items:center;gap:6px;padding:4px;font-size:12px;display:flex;position:absolute;inset:0}.l-upload-trigger-status l-picture-icon{font-size:24px}.l-upload-trigger-progress{background:var(--l-upload-progress-color,var(--l-primary-color,#007bff));height:3px;transition:width .3s;position:absolute;bottom:0;left:0}.l-upload-progress--indeterminate{animation:1.2s ease-in-out infinite l-upload-indeterminate}.l-upload-list-item-progress{overflow:hidden}@keyframes l-upload-indeterminate{0%{transform:translate(-100%)}to{transform:translate(300%)}}@media (prefers-reduced-motion:reduce){.l-upload-progress--indeterminate{animation:none}}.l-upload-trigger--fail,.l-upload-trigger--fail:hover{color:var(--l-upload-error-color,var(--l-error-color,#f5222d));border-color:var(--l-upload-error-color,var(--l-error-color,#f5222d))}.l-upload-trigger--fail .l-upload-trigger-status,.l-upload-trigger--fail:hover .l-upload-trigger-status{color:inherit;background:var(--l-upload-background,#fff)}.l-upload-tip{color:var(--l-upload-text-secondary-color,var(--l-text-secondary-color,#000000a6));margin-top:5px;font-size:12px}.l-upload-trigger--drag.l-upload-trigger--text{border:1px dashed var(--l-upload-border-color,var(--l-border-color,#d9d9d9));border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));background-color:var(--l-upload-background,#fff);padding:12px 8px;transition:border-color .3s,background-color .3s}:host(.l-upload-dragover) .l-upload-trigger:not(.l-upload-trigger--disabled){border-color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff));background-color:var(--l-upload-dragover-background,var(--l-primary-color-light5,#e6f2ff))}.l-upload-trigger.l-upload-trigger--disabled,.l-upload-trigger.l-upload-trigger--disabled:hover{cursor:not-allowed;color:var(--l-upload-disabled-color,var(--l-disabled-color,#c9c9c9));background-color:var(--l-upload-disabled-background,#fbfbfb);border-color:var(--l-upload-disabled-border-color,var(--l-disabled-color,#e6e6e6));opacity:.6}.l-upload-input{display:none}.l-upload-list{margin-top:5px}.l-upload-list-item{position:relative}.l-upload-list-text .l-upload-list-item{min-height:var(--l-upload-list-item-height,32px);box-sizing:border-box;border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));justify-content:space-between;align-items:center;padding:4px 7px;transition:background-color .3s;display:flex}.l-upload-list-text .l-upload-list-item:hover{background-color:var(--l-upload-list-hover-background,#0000000a)}.l-upload-list-text .l-upload-list-item-info{flex:1;align-items:center;gap:8px;min-width:0;margin-right:10px;display:flex}.l-upload-list-text .l-upload-list-item-name{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.l-upload-list-text .l-upload-list-item-size{color:var(--l-upload-text-secondary-color,var(--l-text-secondary-color,#000000a6));flex-shrink:0;font-size:12px}.l-upload-list-item--uploading .l-upload-list-item-progress{background:#0000001a;height:2px;position:absolute;bottom:0;left:0;right:0}.l-upload-list-item--uploading .l-upload-list-item-progress-bar{background:var(--l-upload-progress-color,var(--l-primary-color,#007bff));height:100%;transition:width .3s}.l-upload-list-item--success .l-upload-list-item-name{color:var(--l-upload-success-color,var(--l-success-color,#52c41a))}.l-upload-list-item--fail .l-upload-list-item-name{color:var(--l-upload-error-color,var(--l-error-color,#f5222d))}.l-upload--close{border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));width:24px;height:24px;color:var(--l-upload-text-color,var(--l-text-color,#000000e0));font-size:inherit;cursor:pointer;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;transition:color .3s;display:inline-flex}.l-upload--close:not(:disabled):hover{color:var(--l-upload-border-hover-color,var(--l-primary-color,#007bff))}.l-upload--close:focus-visible{outline:2px solid var(--l-primary-color,#007bff);outline-offset:1px}.l-upload--close:disabled{cursor:not-allowed;color:var(--l-upload-disabled-color,var(--l-disabled-color,#c9c9c9));opacity:.6}.l-upload-items{display:contents}.l-upload-items--picture-card{flex-wrap:wrap;align-items:flex-start;gap:10px;display:flex}.l-upload-items--picture-card .l-upload-list-picture-card{display:contents}.l-upload-items--picture-card .l-upload-trigger{flex:none}.l-upload-card{box-sizing:border-box;width:var(--l-upload-picture-size,90px);height:var(--l-upload-picture-size,90px);border:1px solid var(--l-upload-border-color,var(--l-border-color,#d9d9d9));border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));color:var(--l-upload-text-secondary-color,var(--l-text-secondary-color,#000000a6));flex:none;justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.l-upload-card--fail{border-color:var(--l-upload-error-color,var(--l-error-color,#f5222d));color:var(--l-upload-error-color,var(--l-error-color,#f5222d))}.l-upload-card .l-upload-card-error{font-size:24px}.l-upload-card-actions{opacity:0;pointer-events:none;background:#00000080;justify-content:center;align-items:center;gap:5px;transition:opacity .2s;display:flex;position:absolute;inset:0}.l-upload-card:hover .l-upload-card-actions,.l-upload-card:focus-within .l-upload-card-actions{opacity:1;pointer-events:auto}.l-upload-card-action{border-radius:var(--l-upload-border-radius,var(--l-border-radius,3px));color:#fff;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:30px;height:30px;font-size:20px;display:inline-flex}.l-upload-card-action:not(:disabled):hover{color:var(--l-primary-color,#007bff)}.l-upload-card-action:focus-visible{outline:2px solid var(--l-primary-color,#007bff);outline-offset:-2px}.l-upload-card-action:disabled{cursor:not-allowed;opacity:.5}.l-upload-trigger:focus-visible{outline:2px solid var(--l-primary-color,#007bff);outline-offset:2px}@media (hover:none){.l-upload-card-actions{opacity:1;pointer-events:auto}}";
|
|
4
3
|
export { e as default };
|
package/lib/upload/style.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
|
-
|
|
2
|
+
// src/components/upload/style.ts
|
|
3
3
|
var t = /* @__PURE__ */ (() => {
|
|
4
4
|
let t = new CSSStyleSheet();
|
|
5
5
|
return t.replaceSync(e), t;
|
|
6
6
|
})();
|
|
7
|
-
//#endregion
|
|
8
7
|
export { t as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/utils/clickoutside.ts
|
|
2
2
|
var e = /* @__PURE__ */ new Map();
|
|
3
3
|
function t(t) {
|
|
4
4
|
for (let r of e.values()) for (let e of r) n(t, e);
|
|
@@ -18,5 +18,4 @@ function r(n, r) {
|
|
|
18
18
|
function i(n) {
|
|
19
19
|
e.delete(n), e.size === 0 && document.removeEventListener("click", t, !0);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { i as remove, r as set };
|
package/lib/utils/event.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/utils/event.ts
|
|
2
2
|
var e;
|
|
3
3
|
function t(t, n, r) {
|
|
4
4
|
e ??= /* @__PURE__ */ new Map(), e.has(t) || e.set(t, /* @__PURE__ */ new Map([[n, /* @__PURE__ */ new Set()]])), e.get(t).has(n) || e.get(t).set(n, /* @__PURE__ */ new Set()), e.get(t).get(n).add(r);
|
|
@@ -13,5 +13,4 @@ function i(t, n, ...r) {
|
|
|
13
13
|
let i = e?.get(t)?.get(n);
|
|
14
14
|
if (i != null) for (let e of i) e(...r);
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { t as add, r as clear, i as emit, n as remove };
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SignalStop } from "./signal_types";
|
|
2
1
|
/**
|
|
3
2
|
* 注册 Web Components 组件
|
|
4
3
|
* @param component Web Components 组件
|
|
@@ -13,9 +12,9 @@ export declare function regist(component: any | any[], name?: string): void;
|
|
|
13
12
|
* @returns 唯一标识符字符串
|
|
14
13
|
*/
|
|
15
14
|
export declare function useId(): string;
|
|
16
|
-
export declare function parseAttrValue(value: string, defaultValue?: string): string;
|
|
17
|
-
export declare function parseAttrValue(value: string, defaultValue?: boolean, key?: string): boolean;
|
|
18
|
-
export declare function parseAttrValue(value: string, defaultValue?: number): number;
|
|
15
|
+
export declare function parseAttrValue(value: string | null | undefined, defaultValue?: string): string;
|
|
16
|
+
export declare function parseAttrValue(value: string | null | undefined, defaultValue?: boolean, key?: string): boolean;
|
|
17
|
+
export declare function parseAttrValue(value: string | null | undefined, defaultValue?: number): number;
|
|
19
18
|
/**
|
|
20
19
|
* 初始化元素的属性值。
|
|
21
20
|
* 遍历元素的所有属性,并对每个属性的值进行解析,然后将解析后的值赋给元素的相应属性。
|
|
@@ -37,6 +36,28 @@ export declare function setAttrs(el: HTMLElement, attrs: [string, string | undef
|
|
|
37
36
|
* @returns
|
|
38
37
|
*/
|
|
39
38
|
export declare function kebabToCamel(attr: string): string;
|
|
40
|
-
|
|
39
|
+
/** 兼容非表单组件的旧清理入口;仅调用清理函数,不依赖 signal 类型或运行时。 */
|
|
40
|
+
export declare function stopSignal(fn?: () => void): undefined;
|
|
41
41
|
export declare function unitNumberStr(value?: string | null | undefined, unit?: string): string | null | undefined;
|
|
42
|
-
|
|
42
|
+
/** Button 支持的自定义颜色变量,可只覆盖其中一部分。 */
|
|
43
|
+
export type ButtonColor = Partial<Record<"--l-btn-border-color" | "--l-btn-text-color" | "--l-btn-hover-text-color" | "--l-btn-background" | "--l-btn-active-text-color" | "--l-btn-hover-border-color" | "--l-btn-hover-background" | "--l-btn-active-background" | "--l-btn-active-border-color", string>>;
|
|
44
|
+
/**
|
|
45
|
+
* 按需生成普通、文本或幽灵按钮的颜色变量,不修改按钮或 DOM。
|
|
46
|
+
* 仅调用此函数时进行颜色调整;普通按钮无需引入颜色计算。
|
|
47
|
+
*
|
|
48
|
+
* @param {string} color 基础颜色,使用 adjust 支持的颜色字符串,例如 "#00AA7E";空字符串返回空对象。
|
|
49
|
+
* @param {boolean} [text=false] 是否生成文本按钮配色;为 true 时背景和边框透明,文字随交互状态变色。
|
|
50
|
+
* @param {boolean} [ghost=false] 是否生成幽灵按钮配色;为 true 时背景透明,文字和边框随交互状态变色。
|
|
51
|
+
* text 与 ghost 同为 true 时,按文本按钮处理(边框透明)。
|
|
52
|
+
* @returns {ButtonColor} 包含默认、hover 和 active 状态的九个 CSS 变量的全新对象;
|
|
53
|
+
* 可赋给 Button.color 或传入 Button.setColor(),不会随按钮属性变化自动重新计算。
|
|
54
|
+
*/
|
|
55
|
+
export declare function generateButtonColor(color: string, text?: boolean, ghost?: boolean): ButtonColor;
|
|
56
|
+
/** Tag 支持的自定义颜色变量,可只覆盖其中一部分。 */
|
|
57
|
+
export type TagColor = Partial<Record<"--l-tag-color" | "--l-tag-border-color" | "--l-tag-background", string>>;
|
|
58
|
+
/**
|
|
59
|
+
* 生成标签的文字、边框和浅色背景配色,不修改标签或 DOM。
|
|
60
|
+
* @param {string} color 基础颜色,使用 adjust 支持的颜色字符串,例如 "#00AA7E";空白字符串返回空对象。
|
|
61
|
+
* @returns {TagColor} 包含三个 CSS 变量的全新对象,可赋给 Tag.color 或传入 Tag.setColor()。
|
|
62
|
+
*/
|
|
63
|
+
export declare function generateTagColor(color: string): TagColor;
|
package/lib/utils/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/components/utils/index.ts
|
|
1
|
+
import { adjust as e, isBlank as t, isNumeric as n } from "utilane";
|
|
2
|
+
// src/components/utils/index.ts
|
|
4
3
|
var r = -1;
|
|
5
4
|
function i(e, t) {
|
|
6
5
|
let n = Array.isArray(e) ? e : [e];
|
|
@@ -36,7 +35,7 @@ function s(e) {
|
|
|
36
35
|
"style"
|
|
37
36
|
].includes(t)) continue;
|
|
38
37
|
let i = t.split("-").map((e, t) => t === 0 ? e : e[0].toUpperCase() + e.slice(1)).join(""), a = o(r, e[i], t), s = Object.getOwnPropertyNames(e);
|
|
39
|
-
(e._ignoreInitAttrs || []).includes(i) || (t === "value"
|
|
38
|
+
(e._ignoreInitAttrs || []).includes(i) || (t === "value" || s.includes(i) || s.includes(`_${i}`)) && (e[i] = a);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
function c(e, n) {
|
|
@@ -62,5 +61,26 @@ function f(e) {
|
|
|
62
61
|
function p(e, t = "px") {
|
|
63
62
|
return e && (n(e) ? `${e}${t}` : e);
|
|
64
63
|
}
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
function m(t, n = !1, r = !1) {
|
|
65
|
+
if (!t) return {};
|
|
66
|
+
let i = e(t, 1, !0), a = e(t, 3, !1);
|
|
67
|
+
return {
|
|
68
|
+
"--l-btn-border-color": n ? "transparent" : t,
|
|
69
|
+
"--l-btn-text-color": r || n ? t : "#ffffff",
|
|
70
|
+
"--l-btn-hover-text-color": r || n ? i : "#ffffff",
|
|
71
|
+
"--l-btn-background": r || n ? "transparent" : t,
|
|
72
|
+
"--l-btn-active-text-color": r || n ? a : "#ffffff",
|
|
73
|
+
"--l-btn-hover-border-color": n ? "transparent" : i,
|
|
74
|
+
"--l-btn-hover-background": r || n ? "transparent" : i,
|
|
75
|
+
"--l-btn-active-background": r || n ? "transparent" : a,
|
|
76
|
+
"--l-btn-active-border-color": n ? "transparent" : a
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function h(n) {
|
|
80
|
+
return t(n) ? {} : {
|
|
81
|
+
"--l-tag-color": n,
|
|
82
|
+
"--l-tag-border-color": n,
|
|
83
|
+
"--l-tag-background": e(n, 5, !0)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export { m as generateButtonColor, h as generateTagColor, s as initAttr, d as kebabToCamel, o as parseAttrValue, i as regist, u as setAttrs, f as stopSignal, c as tagAttr, l as tagAttrs, p as unitNumberStr, a as useId };
|
package/lib/utils/popover.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "utilane/browser";
|
|
2
|
-
|
|
2
|
+
// src/components/utils/popover.ts
|
|
3
3
|
function s(e, t, n, r, i = 10, a = "x") {
|
|
4
4
|
let o = a === "x" ? "width" : "height", s = [
|
|
5
5
|
"left",
|
|
@@ -154,7 +154,7 @@ var p = class {
|
|
|
154
154
|
this._hideTimer &&= (clearTimeout(this._hideTimer), void 0);
|
|
155
155
|
}
|
|
156
156
|
_onMouseEnter = (e) => {
|
|
157
|
-
let t = e.
|
|
157
|
+
let t = e.currentTarget;
|
|
158
158
|
this._clearHideTimer(), this.$reference != t && this.show(t);
|
|
159
159
|
};
|
|
160
160
|
_onMouseLeave = () => {
|
|
@@ -164,13 +164,11 @@ var p = class {
|
|
|
164
164
|
};
|
|
165
165
|
_onRefTap = (e) => {
|
|
166
166
|
this._destroyUpdater();
|
|
167
|
-
let t = e.
|
|
168
|
-
if (this.$reference) {
|
|
167
|
+
let t = e.currentTarget;
|
|
168
|
+
if (this.$reference === t) {
|
|
169
169
|
if (this.options.trigger === "focus") return;
|
|
170
170
|
this.hide();
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
this.show(t);
|
|
171
|
+
} else this.show(t);
|
|
174
172
|
};
|
|
175
173
|
show(e) {
|
|
176
174
|
let t = e.dataset, n = t.disabled;
|
|
@@ -206,20 +204,14 @@ var p = class {
|
|
|
206
204
|
this.popoverElement && this.options.updateContent && this.options.updateContent(this.popoverElement, {});
|
|
207
205
|
}
|
|
208
206
|
_onOuterTap = (e) => {
|
|
209
|
-
let t = e.target, n =
|
|
207
|
+
let t = e.target, n = !(!this.$reference || !this.$reference.contains(t) && this.$reference != t), r = !(!this.popoverElement || !this.popoverElement.contains(t) && this.popoverElement != t);
|
|
210
208
|
if (r) {
|
|
211
209
|
let [t, n, r] = o(e, "data-action", this.popoverElement);
|
|
212
210
|
if (t) {
|
|
213
211
|
let e = "";
|
|
214
212
|
n === "popconfirm-cancel" ? e = "cancel" : n === "popconfirm-ok" && (e = "ok"), e && this.hide(), this.options.onPopoverAction && this.options.onPopoverAction(e || n, r);
|
|
215
213
|
}
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
if (!n && this.options.trigger !== "manual") {
|
|
219
|
-
this.hide();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
this.options.onOutsideTap && this.options.onOutsideTap(e, n, r);
|
|
214
|
+
} else !n && this.options.trigger !== "manual" ? this.hide() : this.options.onOutsideTap && this.options.onOutsideTap(e, n, r);
|
|
223
215
|
};
|
|
224
216
|
_renderPopover() {
|
|
225
217
|
let e = `l-popover l-popover--${this.options.theme || "default"}`;
|
|
@@ -278,5 +270,4 @@ function g(e, t, n) {
|
|
|
278
270
|
subtree: !0
|
|
279
271
|
}), i;
|
|
280
272
|
}
|
|
281
|
-
//#endregion
|
|
282
273
|
export { p as Popover, f as autoUpdate, g as createPopoverObserver, c as getOverflowAncestors, m as popconfirmProps, d as updatePosition };
|
package/lib/utils/transition.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as e, iterate as t, transition as n } from "utilane/browser";
|
|
2
|
-
|
|
2
|
+
// src/components/utils/transition.ts
|
|
3
3
|
function r() {
|
|
4
4
|
let r, i = {
|
|
5
5
|
attributes: !0,
|
|
@@ -30,5 +30,4 @@ function r() {
|
|
|
30
30
|
init: s
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { r as createTransition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litos-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "A framework-agnostic UI component library built with native Web Components and TypeScript, featuring customizable themes and dark mode.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component-library",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"type": "module",
|
|
32
32
|
"sideEffects": [
|
|
33
33
|
"./lib/entries/*.js",
|
|
34
|
-
"./styles/*.css"
|
|
34
|
+
"./styles/*.css",
|
|
35
|
+
"./styles/**/*.css"
|
|
35
36
|
],
|
|
36
37
|
"main": "./lib/index.js",
|
|
37
38
|
"module": "./lib/index.js",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"build": "vite build",
|
|
59
60
|
"docs:dev": "vitepress dev docs",
|
|
60
61
|
"docs:build": "vitepress build docs",
|
|
62
|
+
"docs:llms:test": "node --test --test-isolation=none scripts/docs-llms.test.mjs",
|
|
61
63
|
"docs:preview": "vitepress preview docs",
|
|
62
64
|
"dts:build": "tsc -p tsconfig.build.json",
|
|
63
65
|
"lib:build": "npm run build && npm run dts:build",
|
|
@@ -69,22 +71,23 @@
|
|
|
69
71
|
"fmt:check": "oxfmt --check ."
|
|
70
72
|
},
|
|
71
73
|
"dependencies": {
|
|
72
|
-
"alien-signals": "^3.2.1",
|
|
73
74
|
"qrcode-generator-es": "^2.1.3",
|
|
74
|
-
"utilane": "^1.
|
|
75
|
+
"utilane": "^1.3.0"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
|
-
"@types/node": "^26.
|
|
78
|
-
"iconify-icon": "^3.0.
|
|
79
|
-
"less": "^4.9.
|
|
78
|
+
"@types/node": "^26.6.6",
|
|
79
|
+
"iconify-icon": "^3.0.5",
|
|
80
|
+
"less": "^4.9.1",
|
|
80
81
|
"lightningcss": "^1.33.0",
|
|
81
|
-
"oxfmt": "^0.
|
|
82
|
-
"oxlint": "^1.
|
|
83
|
-
"preact": "^
|
|
84
|
-
"shiki": "^4.
|
|
82
|
+
"oxfmt": "^0.79.0",
|
|
83
|
+
"oxlint": "^1.94.0",
|
|
84
|
+
"preact": "^11.2.0",
|
|
85
|
+
"shiki": "^4.6.0",
|
|
85
86
|
"typescript": "^7.0.2",
|
|
86
|
-
"vite": "^8.
|
|
87
|
-
"vitepress": "^1.6.4"
|
|
87
|
+
"vite": "^8.3.8",
|
|
88
|
+
"vitepress": "^1.6.4",
|
|
89
|
+
"vitepress-plugin-llms": "1.15.0",
|
|
90
|
+
"vue": "^3.5.45"
|
|
88
91
|
},
|
|
89
92
|
"packageManager": "pnpm@12.5.1"
|
|
90
93
|
}
|
package/styles/dark.css
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* 暗黑模式 */
|
|
2
2
|
:root.dark {
|
|
3
3
|
--l-disabled-color: #6c6c6c;
|
|
4
|
+
/* 中性色 */
|
|
5
|
+
--l-text-color: rgba(255, 255, 255, 0.88);
|
|
6
|
+
--l-text-secondary-color: rgba(255, 255, 255, 0.65);
|
|
7
|
+
--l-fill-secondary-color: #262626;
|
|
8
|
+
--l-border-color: #434343;
|
|
9
|
+
/* Collapse:带背景边框的标题与面板填充。 */
|
|
10
|
+
--_l-collapse-header-fill: rgba(255, 255, 255, 0.04);
|
|
11
|
+
--_l-collapse-panel-fill: var(--l-fill-secondary-color);
|
|
4
12
|
/* 表格配置 */
|
|
5
13
|
--l-table-border-color: #444444;
|
|
6
14
|
--l-table-th-bg: #2d2d2d;
|
|
@@ -19,8 +27,8 @@
|
|
|
19
27
|
--l-upload-border-color: rgba(255, 255, 255, 0.2);
|
|
20
28
|
--l-upload-border-hover-color: var(--l-primary-color-light1, #3399ff);
|
|
21
29
|
--l-upload-background: #1e1e1e;
|
|
22
|
-
--l-upload-text-color: rgba(255, 255, 255, 0.88);
|
|
23
|
-
--l-upload-text-secondary-color: rgba(255, 255, 255, 0.
|
|
30
|
+
--l-upload-text-color: var(--l-text-color, rgba(255, 255, 255, 0.88));
|
|
31
|
+
--l-upload-text-secondary-color: var(--l-text-secondary-color, rgba(255, 255, 255, 0.65));
|
|
24
32
|
--l-upload-disabled-color: rgba(255, 255, 255, 0.3);
|
|
25
33
|
--l-upload-disabled-background: rgba(255, 255, 255, 0.04);
|
|
26
34
|
--l-upload-disabled-border-color: rgba(255, 255, 255, 0.15);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.l-dropdown-menu {
|
|
2
|
+
min-width: var(--l-dropdown-min-width, 160px);
|
|
3
|
+
max-width: calc(100vw - 16px);
|
|
4
|
+
max-height: var(--l-dropdown-max-height, min(320px, 60vh));
|
|
5
|
+
overflow: auto;
|
|
6
|
+
padding: 5px;
|
|
7
|
+
border-color: var(--l-border-color, #dedede);
|
|
8
|
+
border-radius: var(--l-border-radius, 5px);
|
|
9
|
+
background: var(--l-dropdown-background, var(--l-fill-secondary-color, #fff));
|
|
10
|
+
color: var(--l-text-color, #333);
|
|
11
|
+
box-shadow: var(--l-dropdown-shadow, 0 6px 24px #0002);
|
|
12
|
+
}
|
|
13
|
+
.l-dropdown-item {
|
|
14
|
+
display: block;
|
|
15
|
+
width: 100%;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
border: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
color: inherit;
|
|
20
|
+
font: inherit;
|
|
21
|
+
text-align: start;
|
|
22
|
+
padding: 8px 12px;
|
|
23
|
+
border-radius: 3px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
overflow-wrap: anywhere;
|
|
26
|
+
}
|
|
27
|
+
.l-dropdown-item:hover:not(:disabled) {
|
|
28
|
+
background: var(--l-dropdown-hover-background, var(--l-primary-color-light5, #e6f2ff));
|
|
29
|
+
color: var(--l-primary-color-dark2, #004c99);
|
|
30
|
+
}
|
|
31
|
+
.l-dropdown-item:disabled {
|
|
32
|
+
opacity: 0.45;
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
}
|
|
35
|
+
.l-dropdown-item--danger {
|
|
36
|
+
color: var(--l-error-color, #f5222d);
|
|
37
|
+
}
|
|
38
|
+
.l-dropdown-item--danger:hover:not(:disabled) {
|
|
39
|
+
color: var(--l-error-color);
|
|
40
|
+
background: var(--l-error-color-light5);
|
|
41
|
+
}
|
|
42
|
+
.l-dropdown-menu > [role="separator"] {
|
|
43
|
+
height: 1px;
|
|
44
|
+
background: var(--l-border-color, #dedede);
|
|
45
|
+
margin: 5px 4px;
|
|
46
|
+
}
|
package/styles/reset.css
CHANGED
package/styles/select.css
CHANGED
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
cursor: default;
|
|
33
33
|
color: var(--l-text-color, #999);
|
|
34
34
|
}
|
|
35
|
+
.l-select-option--disabled {
|
|
36
|
+
--l-select-option-hover-background: transparent;
|
|
37
|
+
color: var(--l-disabled-color, #999);
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
}
|
|
35
40
|
.l-select-option--selected {
|
|
36
41
|
color: var(--l-primary-color-light1, #9254de);
|
|
37
42
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* 苹果主题 · #9E8D51;默认配色按引入顺序覆盖,data-theme 可显式选择。 */
|
|
2
|
+
:root,
|
|
3
|
+
:root[data-theme="apple"] {
|
|
4
|
+
--l-primary-color: #9e8d51;
|
|
5
|
+
--l-primary-color-light1: #b1a474;
|
|
6
|
+
--l-primary-color-light2: #c5bb97;
|
|
7
|
+
--l-primary-color-light3: #d8d1b9;
|
|
8
|
+
--l-primary-color-light4: #ece8dc;
|
|
9
|
+
--l-primary-color-light5: #f5f4ee;
|
|
10
|
+
--l-primary-color-dark1: #7e7141;
|
|
11
|
+
--l-primary-color-dark2: #5f5531;
|
|
12
|
+
--l-success-color: #52c41a;
|
|
13
|
+
--l-success-color-light1: #73d13d;
|
|
14
|
+
--l-success-color-light2: #95de64;
|
|
15
|
+
--l-success-color-light3: #b7eb8f;
|
|
16
|
+
--l-success-color-light4: #d9f7be;
|
|
17
|
+
--l-success-color-light5: #f6ffed;
|
|
18
|
+
--l-success-color-dark1: #389e0d;
|
|
19
|
+
--l-success-color-dark2: #317610;
|
|
20
|
+
--l-error-color: #f5222d;
|
|
21
|
+
--l-error-color-light1: #f74e57;
|
|
22
|
+
--l-error-color-light2: #f97a81;
|
|
23
|
+
--l-error-color-light3: #ffa39e;
|
|
24
|
+
--l-error-color-light4: #fdd3d5;
|
|
25
|
+
--l-error-color-light5: #fff1f0;
|
|
26
|
+
--l-error-color-dark1: #c41b24;
|
|
27
|
+
--l-error-color-dark2: #93141b;
|
|
28
|
+
/* 主色与默认警告色相近,使用深琥珀色保持警告语义。 */
|
|
29
|
+
--l-warning-color: #a65b00;
|
|
30
|
+
--l-warning-color-light1: #b87c33;
|
|
31
|
+
--l-warning-color-light2: #ca9d66;
|
|
32
|
+
--l-warning-color-light3: #dbbd99;
|
|
33
|
+
--l-warning-color-light4: #eddecc;
|
|
34
|
+
--l-warning-color-light5: #f6efe6;
|
|
35
|
+
--l-warning-color-dark1: #854900;
|
|
36
|
+
--l-warning-color-dark2: #643700;
|
|
37
|
+
--l-text-color: #433f30;
|
|
38
|
+
--l-text-secondary-color: #68614d;
|
|
39
|
+
--l-fill-secondary-color: #faf9f5;
|
|
40
|
+
--l-border-color: #e5e0cf;
|
|
41
|
+
--l-disabled-color: #ebe8de;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* 暗黑模式下保持禁用状态的可辨识度。 */
|
|
45
|
+
:root.dark {
|
|
46
|
+
--l-disabled-color: #6c6c6c;
|
|
47
|
+
}
|