@ithinkdt/ui 4.0.0-600 → 4.0.0-700
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/dist/{components-BMKQsJ4d.js → components-Yo5FKzwp.js} +671 -635
- package/dist/components.js +1 -4
- package/dist/directives-RPqFovTo.js +237 -0
- package/dist/directives.js +1 -2
- package/dist/index.js +2 -3
- package/dist/page.js +320 -321
- package/esm/components.d.ts +3 -0
- package/esm/directives.d.ts +6 -0
- package/package.json +5 -5
- package/dist/directives-CB8tcZsk.js +0 -203
package/dist/components.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./use-style-DrH-89qR.js";
|
|
3
|
-
import "./directives-CB8tcZsk.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-BMKQsJ4d.js";
|
|
1
|
+
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-Yo5FKzwp.js";
|
|
5
2
|
export { DataActions, DataCustom, DataDescriptions, DataFilter, DataForm, DataFormActions, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, NStateButton, StateButtonProps, dataFormActionsProps, renderUsers, useDataTableDrag, useLocaleEdit };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DrH-89qR.js";
|
|
2
|
+
import { Fragment, createVNode, defineComponent, h, nextTick, reactive, ref, shallowRef, toRef, watch } from "vue";
|
|
3
|
+
import { promiseTimeout, useEventListener } from "@vueuse/core";
|
|
4
|
+
import { NTooltip } from "ithinkdt-ui";
|
|
5
|
+
import { nanoid } from "nanoid";
|
|
6
|
+
import { debounce, throttle } from "@ithinkdt/common/fn";
|
|
7
|
+
import { useElementIntersectionRect } from "@ithinkdt/common/composables";
|
|
8
|
+
import { string2dom } from "@ithinkdt/common/dom";
|
|
9
|
+
var SUPPORT_LINE_CLAMP = [
|
|
10
|
+
2,
|
|
11
|
+
3,
|
|
12
|
+
5
|
|
13
|
+
], style$1 = /* @__PURE__ */ c([
|
|
14
|
+
c(({ props: g }) => `:where(span${g.bPrefix}tooltip-host)`, { display: "inline-block" }),
|
|
15
|
+
c(({ props: g }) => `:where(${g.bPrefix}tooltip-host)`, {
|
|
16
|
+
maxWidth: "100%",
|
|
17
|
+
whiteSpace: "nowrap",
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
textOverflow: "ellipsis"
|
|
20
|
+
}),
|
|
21
|
+
...SUPPORT_LINE_CLAMP.map((g) => c(({ props: L }) => `:where(${L.bPrefix}tooltip-ell${g}:not(${L.bPrefix}tooltip-expanded))`, {
|
|
22
|
+
display: "-webkit-box",
|
|
23
|
+
WebkitLineClamp: g,
|
|
24
|
+
WebkitBoxOrient: "vertical",
|
|
25
|
+
whiteSpace: "normal"
|
|
26
|
+
})),
|
|
27
|
+
c(({ props: g }) => `:where(${g.bPrefix}tooltip-expandable)`, { cursor: "pointer" }),
|
|
28
|
+
c(({ props: g }) => `:where(${g.bPrefix}tooltip-expanded)`, {
|
|
29
|
+
cursor: "pointer",
|
|
30
|
+
whiteSpace: "normal",
|
|
31
|
+
lineHeight: "1.25"
|
|
32
|
+
})
|
|
33
|
+
]), Tooltip = /* @__PURE__ */ Symbol("tooltip-dir"), current = /* @__PURE__ */ shallowRef();
|
|
34
|
+
function detactOverflow(g) {
|
|
35
|
+
let L = g.firstChild;
|
|
36
|
+
if (!L) return !1;
|
|
37
|
+
let R = L instanceof Text ? {
|
|
38
|
+
width: g.scrollWidth,
|
|
39
|
+
height: g.scrollHeight
|
|
40
|
+
} : L.getBoundingClientRect?.() ?? {
|
|
41
|
+
width: L.clientWidth,
|
|
42
|
+
height: L.clientHeight
|
|
43
|
+
};
|
|
44
|
+
return R.width > g.clientWidth + 1 || R.height > g.clientHeight + 2;
|
|
45
|
+
}
|
|
46
|
+
var _update, _current, clsPrefix$1;
|
|
47
|
+
const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
48
|
+
name: "TooltipDirectiveProvider",
|
|
49
|
+
props: { delay: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 180
|
|
52
|
+
} },
|
|
53
|
+
setup(L) {
|
|
54
|
+
clsPrefix$1 = useStyle("-tooltip-directive", style$1);
|
|
55
|
+
let R = shallowRef(), z = reactive({
|
|
56
|
+
show: !1,
|
|
57
|
+
tip: void 0,
|
|
58
|
+
placement: "top",
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0
|
|
61
|
+
});
|
|
62
|
+
_update = async () => {
|
|
63
|
+
if (!current.value) return;
|
|
64
|
+
L.delay > 0 && await promiseTimeout(L.delay);
|
|
65
|
+
let g = current.value;
|
|
66
|
+
if (g?.classList.contains(`${clsPrefix$1.value}-tooltip-expanded`)) {
|
|
67
|
+
z.show = !1;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let B = g?.[Tooltip];
|
|
71
|
+
if (!B) return;
|
|
72
|
+
B.binding.modifiers.expandable && g.classList.remove(`${clsPrefix$1.value}-tooltip-expandable`);
|
|
73
|
+
let V = B.tip;
|
|
74
|
+
if (R.value = typeof V == "function" ? V : () => V || g.attributes.getNamedItem("title") || g.textContent, !B.binding.modifiers || detactOverflow(g)) {
|
|
75
|
+
z.show = !0, B.binding.modifiers.expandable && g.classList.add(`${clsPrefix$1.value}-tooltip-expandable`);
|
|
76
|
+
let L = g.getBoundingClientRect();
|
|
77
|
+
switch (z.placement = Object.keys(B.binding.modifiers).find((g) => [
|
|
78
|
+
"top",
|
|
79
|
+
"right",
|
|
80
|
+
"left",
|
|
81
|
+
"bottom"
|
|
82
|
+
].find((L) => g.startsWith(L))) ?? "top", z.placement.split("-")[0]) {
|
|
83
|
+
case "top":
|
|
84
|
+
z.x = L.left + L.width / 2, z.y = L.top;
|
|
85
|
+
break;
|
|
86
|
+
case "right":
|
|
87
|
+
z.x = L.left + L.width, z.y = L.top + L.height / 2;
|
|
88
|
+
break;
|
|
89
|
+
case "left":
|
|
90
|
+
z.x = L.left, z.y = L.top + L.height / 2;
|
|
91
|
+
break;
|
|
92
|
+
case "bottom":
|
|
93
|
+
z.x = L.left + L.width / 2, z.y = L.bottom;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
} else z.show &&= !1;
|
|
97
|
+
};
|
|
98
|
+
let B = `ithinkdt-tooltip-${nanoid()}`, V = throttle((g) => {
|
|
99
|
+
!_current || _current.contains(g) || g.closest(`.${B}`) || (z.show = !1, current.value = void 0);
|
|
100
|
+
}, 100, { leading: !1 });
|
|
101
|
+
return useEventListener("mouseover", (g) => {
|
|
102
|
+
_current = current.value, V(g.target);
|
|
103
|
+
}, { capture: !0 }), () => createVNode(NTooltip, {
|
|
104
|
+
trigger: "manual",
|
|
105
|
+
show: !!current.value && z.show,
|
|
106
|
+
x: z.x,
|
|
107
|
+
y: z.y,
|
|
108
|
+
placement: z.placement
|
|
109
|
+
}, { default: () => [createVNode("div", { class: B }, [R.value?.()])] });
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var _mouseenter = (g) => {
|
|
113
|
+
_current = void 0, current.value = g.target, _update?.();
|
|
114
|
+
}, _mouseclick = (g) => {
|
|
115
|
+
g.target.classList.contains(`${clsPrefix$1.value}-tooltip-expandable`) ? (g.target.classList.remove(`${clsPrefix$1.value}-tooltip-expandable`), g.target.classList.add(`${clsPrefix$1.value}-tooltip-expanded`), _update()) : g.target.classList.contains(`${clsPrefix$1.value}-tooltip-expanded`) && (g.target.classList.remove(`${clsPrefix$1.value}-tooltip-expanded`), g.target.classList.add(`${clsPrefix$1.value}-tooltip-expandable`), _update());
|
|
116
|
+
};
|
|
117
|
+
const vTooltip = {
|
|
118
|
+
mounted(g, L) {
|
|
119
|
+
g[Tooltip] = {
|
|
120
|
+
binding: L,
|
|
121
|
+
tip: L.value
|
|
122
|
+
}, g.addEventListener("mouseenter", _mouseenter), L.modifiers.auto && g.classList.add(`${clsPrefix$1.value}-tooltip-host`), L.modifiers.expandable && g.addEventListener("click", _mouseclick);
|
|
123
|
+
for (let R of SUPPORT_LINE_CLAMP) L.modifiers[`ell${R}`] && g.classList.add(`${clsPrefix$1.value}-tooltip-ell${R}`);
|
|
124
|
+
},
|
|
125
|
+
updated(g, L) {
|
|
126
|
+
if (g[Tooltip]) {
|
|
127
|
+
g[Tooltip].binding = L, g[Tooltip].tip = L.value, g.classList.toggle(`${clsPrefix$1.value}-tooltip-host`, L.modifiers.auto);
|
|
128
|
+
for (let R of SUPPORT_LINE_CLAMP) g.classList.toggle(`${clsPrefix$1.value}-tooltip-ell${R}`, L.modifiers[`ell${R}`]);
|
|
129
|
+
L.modifiers.expandable ? g.addEventListener("click", _mouseclick) : g.removeEventListener("click", _mouseclick), _update();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
beforeUnmount(g) {
|
|
133
|
+
current.value === g && (current.value = void 0), g[Tooltip] && (g.removeEventListener("mouseenter", _mouseenter), g.removeEventListener("click", _mouseclick), g.classList.remove(`${clsPrefix$1.value}-tooltip-host`, `${clsPrefix$1.value}-tooltip-expandable`, `${clsPrefix$1.value}-tooltip-expanded`, ...SUPPORT_LINE_CLAMP.map((g) => `${clsPrefix$1.value}-tooltip-ell${g}`)), delete g[Tooltip]);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var clsPrefix, isDark, style = /* @__PURE__ */ c([c(({ props: g }) => `:where(${g.bPrefix}spin-host)`, { position: "relative" }), cB("spin-directive", {
|
|
137
|
+
zIndex: "999999",
|
|
138
|
+
position: "absolute",
|
|
139
|
+
color: "var(--color-primary)",
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
justifyContent: "center",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
gap: "4px",
|
|
145
|
+
willChange: "background-color",
|
|
146
|
+
backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0)",
|
|
147
|
+
transition: "background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
148
|
+
}, [
|
|
149
|
+
cE("tip, icon", {
|
|
150
|
+
willChange: "opacity",
|
|
151
|
+
opacity: "0",
|
|
152
|
+
transition: "opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
153
|
+
}),
|
|
154
|
+
cE("tip:empty", { display: "none" }),
|
|
155
|
+
cM("spining", { backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0.5)" }, [cE("tip, icon", { opacity: "1" })])
|
|
156
|
+
])]);
|
|
157
|
+
const SpinDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
158
|
+
name: "SpinDirectiveProvider",
|
|
159
|
+
props: { dark: Boolean },
|
|
160
|
+
setup(L) {
|
|
161
|
+
return clsPrefix = useStyle("-spin-directive", style), isDark = toRef(L, "dark"), () => h(Fragment);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var Spin = /* @__PURE__ */ Symbol("spin-dir"), updateLoading = (g, { value: L, modifiers: R }) => {
|
|
165
|
+
if (g[Spin].loading.value = !!L, !g[Spin].loading.value) return;
|
|
166
|
+
let z = R.dark || !R.light && isDark.value;
|
|
167
|
+
g[Spin].spinEl.style.setProperty("--host-bg", z ? "0 0 0" : "255 255 255");
|
|
168
|
+
};
|
|
169
|
+
const vSpin = {
|
|
170
|
+
beforeMount(g) {
|
|
171
|
+
if (g.classList.add(`${clsPrefix.value}-spin-host`), g[Spin]) return;
|
|
172
|
+
let L = ref(!1), R = string2dom(`
|
|
173
|
+
<div class="${clsPrefix.value}-spin-directive">
|
|
174
|
+
<svg class="${clsPrefix.value}-spin-directive__icon" width="32" height="32" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
|
175
|
+
<g>
|
|
176
|
+
<animateTransform attributeName="transform" type="rotate" values="0 100 100;270 100 100" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animateTransform>
|
|
177
|
+
<circle fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" cx="100" cy="100" r="92" stroke-dasharray="567" stroke-dashoffset="1848">
|
|
178
|
+
<animateTransform attributeName="transform" type="rotate" values="0 100 100;135 100 100;450 100 100" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animateTransform>
|
|
179
|
+
<animate attributeName="stroke-dashoffset" values="567;142;567" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animate>
|
|
180
|
+
</circle>
|
|
181
|
+
</g>
|
|
182
|
+
</svg>
|
|
183
|
+
<div class="${clsPrefix.value}-spin-directive__tip"></div>
|
|
184
|
+
</div>
|
|
185
|
+
`.trim()), z, { stop: B, update: V } = useElementIntersectionRect(g, (g) => {
|
|
186
|
+
z = g, Object.assign(R.style, {
|
|
187
|
+
left: 0,
|
|
188
|
+
top: 0,
|
|
189
|
+
width: z.width + "px",
|
|
190
|
+
height: z.height + "px"
|
|
191
|
+
});
|
|
192
|
+
}, { interval: 1e3 / 30 }), H, U = watch(L, debounce(() => {
|
|
193
|
+
if (L.value) H === void 0 && (clearTimeout(H), H = void 0), V(), g.append(R), requestAnimationFrame(() => {
|
|
194
|
+
L.value && R.classList.add(`${clsPrefix.value}-spin-directive--spining`);
|
|
195
|
+
});
|
|
196
|
+
else {
|
|
197
|
+
R.classList.remove(`${clsPrefix.value}-spin-directive--spining`);
|
|
198
|
+
let g = () => {
|
|
199
|
+
R.remove(), L && clearTimeout(L), L = null, R.removeEventListener("transitioncancel", g), R.removeEventListener("transitionend", g);
|
|
200
|
+
};
|
|
201
|
+
R.addEventListener("transitioncancel", g), R.addEventListener("transitionend", g);
|
|
202
|
+
let L = setTimeout(g, 300);
|
|
203
|
+
}
|
|
204
|
+
}, 30));
|
|
205
|
+
g[Spin] = {
|
|
206
|
+
loading: L,
|
|
207
|
+
spinEl: R,
|
|
208
|
+
updateTip: () => {
|
|
209
|
+
let L = R.querySelector(`.${clsPrefix.value}-spin-directive__tip`);
|
|
210
|
+
L.textContent = g.dataset.spinTip;
|
|
211
|
+
},
|
|
212
|
+
stop: () => {
|
|
213
|
+
B(), U();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
mounted(g, L) {
|
|
218
|
+
g[Spin] && (updateLoading(g, L), g[Spin].updateTip(), !g[Spin].observer && nextTick().then(() => {
|
|
219
|
+
(g[Spin].observer = new MutationObserver((L) => {
|
|
220
|
+
for (let R of L) if (R.type === "attributes" && R.attributeName === "data-spin-tip") {
|
|
221
|
+
g[Spin].updateTip();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
})).observe(g, {
|
|
225
|
+
attributes: !0,
|
|
226
|
+
attributeFilter: ["data-spin-tip"]
|
|
227
|
+
});
|
|
228
|
+
}));
|
|
229
|
+
},
|
|
230
|
+
updated(g, L) {
|
|
231
|
+
g[Spin] && updateLoading(g, L);
|
|
232
|
+
},
|
|
233
|
+
beforeUnmount(g) {
|
|
234
|
+
g[Spin] && (g[Spin].loading.value = !1, g[Spin].stop(), g[Spin].observer?.disconnect(), delete g[Spin]);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
export { vTooltip as i, vSpin as n, TooltipDirectiveProvider as r, SpinDirectiveProvider as t };
|
package/dist/directives.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CB8tcZsk.js";
|
|
1
|
+
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-RPqFovTo.js";
|
|
3
2
|
export { SpinDirectiveProvider, TooltipDirectiveProvider, vSpin, vTooltip };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-D-AJ8KbA.js";
|
|
2
2
|
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DrH-89qR.js";
|
|
3
|
-
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-
|
|
3
|
+
import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-RPqFovTo.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";
|
|
@@ -303,8 +303,7 @@ var style = /* @__PURE__ */ c([
|
|
|
303
303
|
gridArea: "header",
|
|
304
304
|
overflow: "hidden",
|
|
305
305
|
zIndex: 2,
|
|
306
|
-
height: "var(--app-header-height, 44px)"
|
|
307
|
-
zIndex: "2"
|
|
306
|
+
height: "var(--app-header-height, 44px)"
|
|
308
307
|
}),
|
|
309
308
|
cB("sider", {
|
|
310
309
|
gridArea: "sider",
|