@ithinkdt/ui 4.0.0-50 → 4.0.0-501
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/auto-imports.js +5 -2
- package/dist/components-C-o-dBCE.js +1893 -0
- package/dist/components.js +5 -5
- package/dist/{directives-DUuJW647.js → directives-Bpfh9AKg.js} +73 -62
- package/dist/directives.js +2 -2
- package/dist/index.js +6 -18
- package/dist/page.js +310 -277
- package/dist/use-style.js +1 -1
- package/esm/components.d.ts +104 -19
- package/esm/page.d.ts +55 -36
- package/package.json +12 -12
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +163 -0
- package/dist/components-BC8oa62b.js +0 -1612
- package/unocss.d.ts +0 -5
- package/unocss.js +0 -94
- /package/dist/{use-i18n-Dx7V4KrY.js → use-i18n-D-AJ8KbA.js} +0 -0
- /package/dist/{use-style-DcT-1dj4.js → use-style-mj2B1q0l.js} +0 -0
package/dist/components.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./use-i18n-
|
|
2
|
-
import "./directives-
|
|
3
|
-
import "./use-style-
|
|
4
|
-
import { a as
|
|
5
|
-
export { DataActions, DataCustom, DataFilter, DataForm, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, renderUsers, useDataTableDrag, useLocaleEdit };
|
|
1
|
+
import "./use-i18n-D-AJ8KbA.js";
|
|
2
|
+
import "./directives-Bpfh9AKg.js";
|
|
3
|
+
import "./use-style-mj2B1q0l.js";
|
|
4
|
+
import { _ as dataFormActionsProps, a as DtUserRender, b as DataActions, c as DataTable, d as DataPagination, f as DataLocaleInput, g as DataFormActions, h as DataForm, i as DtUserDept, l as useDataTableDrag, m as DataFilter, n as StateButtonProps, o as renderUsers, p as useLocaleEdit, r as DtDeptRender, s as NRadios, t as NStateButton, u as DataSelection, v as DataDescriptions, x as NCheckboxes, y as DataCustom } from "./components-C-o-dBCE.js";
|
|
5
|
+
export { DataActions, DataCustom, DataDescriptions, DataFilter, DataForm, DataFormActions, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, NStateButton, StateButtonProps, dataFormActionsProps, renderUsers, useDataTableDrag, useLocaleEdit };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-
|
|
1
|
+
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-mj2B1q0l.js";
|
|
2
2
|
import { Fragment, createVNode, defineComponent, h, nextTick, reactive, ref, shallowRef, toRef, watch } from "vue";
|
|
3
3
|
import { promiseTimeout, useEventListener } from "@vueuse/core";
|
|
4
4
|
import { NTooltip } from "ithinkdt-ui";
|
|
5
|
+
import { nanoid } from "nanoid";
|
|
6
|
+
import { debounce, throttle } from "@ithinkdt/common/fn";
|
|
5
7
|
import { useElementIntersectionRect } from "@ithinkdt/common/composables";
|
|
6
8
|
import { string2dom } from "@ithinkdt/common/dom";
|
|
7
|
-
|
|
8
|
-
var Tooltip = /* @__PURE__ */ Symbol("tooltip-dir"), current = /* @__PURE__ */ shallowRef(), _update;
|
|
9
|
+
var Tooltip = /* @__PURE__ */ Symbol("tooltip-dir"), current = /* @__PURE__ */ shallowRef(), _update, _current;
|
|
9
10
|
const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
10
11
|
name: "TooltipDirectiveProvider",
|
|
11
12
|
props: { delay: {
|
|
@@ -13,69 +14,79 @@ const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
|
13
14
|
default: 180
|
|
14
15
|
} },
|
|
15
16
|
setup(d) {
|
|
16
|
-
let
|
|
17
|
+
let M = shallowRef(), N = reactive({
|
|
17
18
|
show: !1,
|
|
18
19
|
tip: void 0,
|
|
19
20
|
placement: "top",
|
|
20
21
|
x: 0,
|
|
21
22
|
y: 0
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
+
_update = async () => {
|
|
24
25
|
if (!current.value) return;
|
|
25
26
|
d.delay > 0 && await promiseTimeout(d.delay);
|
|
26
|
-
let
|
|
27
|
-
if (!
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
let { auto:
|
|
31
|
-
if (!
|
|
32
|
-
|
|
33
|
-
let d =
|
|
34
|
-
switch (
|
|
27
|
+
let P = current.value, F = P?.[Tooltip];
|
|
28
|
+
if (!F) return;
|
|
29
|
+
let I = F.tip;
|
|
30
|
+
M.value = typeof I == "function" ? I : () => I || P.attributes.getNamedItem("title") || P.textContent;
|
|
31
|
+
let { auto: L } = F.binding.modifiers;
|
|
32
|
+
if (!L || P.firstChild.offsetWidth > P.clientWidth || P.firstChild.offsetHeight > P.clientHeight) {
|
|
33
|
+
N.show = !0;
|
|
34
|
+
let d = P.getBoundingClientRect();
|
|
35
|
+
switch (N.placement = Object.keys(F.binding.modifiers).find((d) => [
|
|
35
36
|
"top",
|
|
36
37
|
"right",
|
|
37
38
|
"left",
|
|
38
39
|
"bottom"
|
|
39
|
-
].find((
|
|
40
|
+
].find((M) => d.startsWith(M))) ?? "top", N.placement.split("-")[0]) {
|
|
40
41
|
case "top":
|
|
41
|
-
|
|
42
|
+
N.x = d.left + d.width / 2, N.y = d.top;
|
|
42
43
|
break;
|
|
43
44
|
case "right":
|
|
44
|
-
|
|
45
|
+
N.x = d.left + d.width, N.y = d.top + d.height / 2;
|
|
45
46
|
break;
|
|
46
47
|
case "left":
|
|
47
|
-
|
|
48
|
+
N.x = d.left, N.y = d.top + d.height / 2;
|
|
48
49
|
break;
|
|
49
50
|
case "bottom":
|
|
50
|
-
|
|
51
|
+
N.x = d.left + d.width / 2, N.y = d.bottom;
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
|
-
} else
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
!
|
|
54
|
+
} else N.show &&= !1;
|
|
55
|
+
};
|
|
56
|
+
let P = `ithinkdt-tooltip-${nanoid()}`, F = throttle((d) => {
|
|
57
|
+
!_current || _current.contains(d) || d.closest(`.${P}`) || (N.show = !1, current.value = void 0);
|
|
58
|
+
}, 100, { leading: !1 });
|
|
59
|
+
return useEventListener("mouseover", (d) => {
|
|
60
|
+
_current = current.value, F(d.target);
|
|
57
61
|
}, { capture: !0 }), () => createVNode(NTooltip, {
|
|
58
62
|
trigger: "manual",
|
|
59
|
-
show: !!current.value &&
|
|
60
|
-
x:
|
|
61
|
-
y:
|
|
62
|
-
placement:
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
show: !!current.value && N.show,
|
|
64
|
+
x: N.x,
|
|
65
|
+
y: N.y,
|
|
66
|
+
placement: N.placement,
|
|
67
|
+
internalInheritedEventHandlers: [{
|
|
68
|
+
onMouseenter: () => {
|
|
69
|
+
console.log("111");
|
|
70
|
+
},
|
|
71
|
+
onMouseleave: () => {
|
|
72
|
+
console.log("222");
|
|
73
|
+
}
|
|
74
|
+
}]
|
|
75
|
+
}, { default: () => [createVNode("div", { class: P }, [M.value?.()])] });
|
|
65
76
|
}
|
|
66
77
|
});
|
|
67
78
|
var _listener = (d) => {
|
|
68
|
-
current.value = d.target, _update?.();
|
|
79
|
+
_current = void 0, current.value = d.target, _update?.();
|
|
69
80
|
};
|
|
70
81
|
const vTooltip = {
|
|
71
|
-
mounted(d,
|
|
82
|
+
mounted(d, M) {
|
|
72
83
|
d[Tooltip] = {
|
|
73
|
-
binding:
|
|
74
|
-
tip:
|
|
84
|
+
binding: M,
|
|
85
|
+
tip: M.value
|
|
75
86
|
}, d.addEventListener("mouseenter", _listener);
|
|
76
87
|
},
|
|
77
|
-
updated(d,
|
|
78
|
-
d[Tooltip].binding =
|
|
88
|
+
updated(d, M) {
|
|
89
|
+
d[Tooltip].binding = M, d[Tooltip].tip = M.value, _update();
|
|
79
90
|
},
|
|
80
91
|
beforeUnmount(d) {
|
|
81
92
|
d[Tooltip] && d.removeEventListener("mouseenter", _listener), current.value === d && (current.value = void 0), delete d[Tooltip];
|
|
@@ -105,19 +116,19 @@ var clsPrefix, isDark, style = /* @__PURE__ */ c([c(({ props: d }) => `:where(${
|
|
|
105
116
|
const SpinDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
106
117
|
name: "SpinDirectiveProvider",
|
|
107
118
|
props: { dark: Boolean },
|
|
108
|
-
setup(
|
|
109
|
-
return clsPrefix = useStyle("-spin-directive", style), isDark = toRef(
|
|
119
|
+
setup(M) {
|
|
120
|
+
return clsPrefix = useStyle("-spin-directive", style), isDark = toRef(M, "dark"), () => h(Fragment);
|
|
110
121
|
}
|
|
111
122
|
});
|
|
112
|
-
var Spin = /* @__PURE__ */ Symbol("spin-dir"), updateLoading = (d, { value:
|
|
113
|
-
if (d[Spin].loading.value = !!
|
|
114
|
-
let
|
|
115
|
-
d[Spin].spinEl.style.setProperty("--host-bg",
|
|
123
|
+
var Spin = /* @__PURE__ */ Symbol("spin-dir"), updateLoading = (d, { value: M, modifiers: N }) => {
|
|
124
|
+
if (d[Spin].loading.value = !!M, !d[Spin].loading.value) return;
|
|
125
|
+
let P = N.dark || !N.light && isDark.value;
|
|
126
|
+
d[Spin].spinEl.style.setProperty("--host-bg", P ? "0 0 0" : "255 255 255");
|
|
116
127
|
};
|
|
117
128
|
const vSpin = {
|
|
118
129
|
beforeMount(d) {
|
|
119
130
|
if (d.classList.add(`${clsPrefix.value}-spin-host`), d[Spin]) return;
|
|
120
|
-
let
|
|
131
|
+
let M = ref(!1), N = string2dom(`
|
|
121
132
|
<div class="${clsPrefix.value}-spin-directive">
|
|
122
133
|
<svg class="${clsPrefix.value}-spin-directive__icon" width="32" height="32" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
|
123
134
|
<g>
|
|
@@ -130,42 +141,42 @@ const vSpin = {
|
|
|
130
141
|
</svg>
|
|
131
142
|
<div class="${clsPrefix.value}-spin-directive__tip"></div>
|
|
132
143
|
</div>
|
|
133
|
-
`.trim()),
|
|
134
|
-
|
|
144
|
+
`.trim()), P, { stop: F, update: I } = useElementIntersectionRect(d, (d) => {
|
|
145
|
+
P = d, Object.assign(N.style, {
|
|
135
146
|
left: 0,
|
|
136
147
|
top: 0,
|
|
137
|
-
width:
|
|
138
|
-
height:
|
|
148
|
+
width: P.width + "px",
|
|
149
|
+
height: P.height + "px"
|
|
139
150
|
});
|
|
140
|
-
}, { interval: 1e3 / 30 }),
|
|
141
|
-
if (
|
|
142
|
-
|
|
151
|
+
}, { interval: 1e3 / 30 }), L, R = watch(M, debounce(() => {
|
|
152
|
+
if (M.value) L === void 0 && (clearTimeout(L), L = void 0), I(), d.append(N), requestAnimationFrame(() => {
|
|
153
|
+
M.value && N.classList.add(`${clsPrefix.value}-spin-directive--spining`);
|
|
143
154
|
});
|
|
144
155
|
else {
|
|
145
|
-
|
|
156
|
+
N.classList.remove(`${clsPrefix.value}-spin-directive--spining`);
|
|
146
157
|
let d = () => {
|
|
147
|
-
|
|
158
|
+
N.remove(), M && clearTimeout(M), M = null, N.removeEventListener("transitioncancel", d), N.removeEventListener("transitionend", d);
|
|
148
159
|
};
|
|
149
|
-
|
|
150
|
-
let
|
|
160
|
+
N.addEventListener("transitioncancel", d), N.addEventListener("transitionend", d);
|
|
161
|
+
let M = setTimeout(d, 300);
|
|
151
162
|
}
|
|
152
163
|
}, 30));
|
|
153
164
|
d[Spin] = {
|
|
154
|
-
loading:
|
|
155
|
-
spinEl:
|
|
165
|
+
loading: M,
|
|
166
|
+
spinEl: N,
|
|
156
167
|
updateTip: () => {
|
|
157
|
-
let
|
|
158
|
-
|
|
168
|
+
let M = N.querySelector(`.${clsPrefix.value}-spin-directive__tip`);
|
|
169
|
+
M.textContent = d.dataset.spinTip;
|
|
159
170
|
},
|
|
160
171
|
stop: () => {
|
|
161
|
-
|
|
172
|
+
F(), R();
|
|
162
173
|
}
|
|
163
174
|
};
|
|
164
175
|
},
|
|
165
|
-
mounted(d,
|
|
166
|
-
updateLoading(d,
|
|
167
|
-
(d[Spin].observer = new MutationObserver((
|
|
168
|
-
for (let
|
|
176
|
+
mounted(d, M) {
|
|
177
|
+
updateLoading(d, M), d[Spin].updateTip(), !d[Spin].observer && nextTick().then(() => {
|
|
178
|
+
(d[Spin].observer = new MutationObserver((M) => {
|
|
179
|
+
for (let N of M) if (N.type === "attributes" && N.attributeName === "data-spin-tip") {
|
|
169
180
|
d[Spin].updateTip();
|
|
170
181
|
return;
|
|
171
182
|
}
|
package/dist/directives.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-
|
|
2
|
-
import "./use-style-
|
|
1
|
+
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-Bpfh9AKg.js";
|
|
2
|
+
import "./use-style-mj2B1q0l.js";
|
|
3
3
|
export { SpinDirectiveProvider, TooltipDirectiveProvider, vSpin, vTooltip };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-
|
|
2
|
-
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-
|
|
3
|
-
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-
|
|
1
|
+
import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-D-AJ8KbA.js";
|
|
2
|
+
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-Bpfh9AKg.js";
|
|
3
|
+
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-mj2B1q0l.js";
|
|
4
4
|
import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
|
|
5
5
|
import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
|
|
6
6
|
import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, useThemeVars } from "ithinkdt-ui";
|
|
@@ -630,7 +630,7 @@ function useCtxMenu(z, B, V) {
|
|
|
630
630
|
{
|
|
631
631
|
key: "reload",
|
|
632
632
|
label: H("common.layout.tabs.reloadTab"),
|
|
633
|
-
disabled: U.tab
|
|
633
|
+
disabled: !U.tab || U.tab.key !== B.value,
|
|
634
634
|
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
635
635
|
xmlns: "http://www.w3.org/2000/svg",
|
|
636
636
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
@@ -665,7 +665,7 @@ function useCtxMenu(z, B, V) {
|
|
|
665
665
|
{
|
|
666
666
|
key: "open",
|
|
667
667
|
label: H("common.layout.tabs.openTabBlank"),
|
|
668
|
-
disabled: U.tab
|
|
668
|
+
disabled: !U.tab,
|
|
669
669
|
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
670
670
|
xmlns: "http://www.w3.org/2000/svg",
|
|
671
671
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
@@ -756,19 +756,7 @@ function useCtxMenu(z, B, V) {
|
|
|
756
756
|
V();
|
|
757
757
|
return;
|
|
758
758
|
}
|
|
759
|
-
if (
|
|
760
|
-
let z = H.find((d) => d.key === B.value);
|
|
761
|
-
switch (d) {
|
|
762
|
-
case "open":
|
|
763
|
-
window.open(z.href, "_blank");
|
|
764
|
-
break;
|
|
765
|
-
case "reload":
|
|
766
|
-
z.reloading ||= (z.reloading = !0, await promiseTimeout(220), !1);
|
|
767
|
-
break;
|
|
768
|
-
}
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
switch (d) {
|
|
759
|
+
if (U.tab) switch (d) {
|
|
772
760
|
case "open":
|
|
773
761
|
window.open(U.tab.href, "_blank");
|
|
774
762
|
break;
|