@movk/nuxt 1.3.0 → 1.4.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/.nuxt/movk-ui.css +1 -1
- package/README.md +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -2
- package/dist/runtime/components/AutoForm.vue +7 -2
- package/dist/runtime/components/ColorChooser.d.vue.ts +2 -2
- package/dist/runtime/components/ColorChooser.vue.d.ts +2 -2
- package/dist/runtime/components/DataTable.d.vue.ts +2 -2
- package/dist/runtime/components/DataTable.vue +38 -10
- package/dist/runtime/components/DataTable.vue.d.ts +2 -2
- package/dist/runtime/components/DatePicker.d.vue.ts +3 -3
- package/dist/runtime/components/DatePicker.vue +1 -1
- package/dist/runtime/components/DatePicker.vue.d.ts +3 -3
- package/dist/runtime/components/PillGroup.d.vue.ts +1 -1
- package/dist/runtime/components/PillGroup.vue.d.ts +1 -1
- package/dist/runtime/components/SearchForm.d.vue.ts +3 -3
- package/dist/runtime/components/SearchForm.vue +14 -5
- package/dist/runtime/components/SearchForm.vue.d.ts +3 -3
- package/dist/runtime/components/StarRating.d.vue.ts +2 -2
- package/dist/runtime/components/StarRating.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.d.vue.ts +44 -0
- package/dist/runtime/components/Tree.vue +332 -0
- package/dist/runtime/components/Tree.vue.d.ts +44 -0
- package/dist/runtime/composables/useDateFormatter.js +7 -5
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +6 -5
- package/dist/runtime/composables/useDownloadWithProgress.js +4 -16
- package/dist/runtime/composables/useTheme.d.ts +14 -12
- package/dist/runtime/composables/useUploadWithProgress.d.ts +6 -5
- package/dist/runtime/composables/useUploadWithProgress.js +4 -16
- package/dist/runtime/domains/auto-form/controls.d.ts +651 -11
- package/dist/runtime/domains/auto-form/controls.js +1 -0
- package/dist/runtime/domains/auto-form/provider.js +3 -2
- package/dist/runtime/domains/auto-form/schema.d.ts +5 -0
- package/dist/runtime/domains/auto-form/schema.js +13 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +34 -2
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +1 -1
- package/dist/runtime/domains/data-table/columns/style.js +4 -3
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +1 -1
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +1 -1
- package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +43 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.vue +76 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +43 -0
- package/dist/runtime/domains/tree/resolve-tree.d.ts +14 -0
- package/dist/runtime/domains/tree/resolve-tree.js +16 -0
- package/dist/runtime/domains/tree/tree-lazy.d.ts +20 -0
- package/dist/runtime/domains/tree/tree-lazy.js +19 -0
- package/dist/runtime/domains/tree/tree-search.d.ts +6 -0
- package/dist/runtime/domains/tree/tree-search.js +5 -0
- package/dist/runtime/types/auto-form/search-form.d.ts +3 -3
- package/dist/runtime/types/components/index.d.ts +1 -0
- package/dist/runtime/types/components/message-box.d.ts +3 -3
- package/dist/runtime/types/components/tree.d.ts +134 -0
- package/dist/runtime/types/components/tree.js +0 -0
- package/dist/runtime/types/data-table/columns.d.ts +1 -17
- package/dist/runtime/types/data-table/component.d.ts +5 -0
- package/dist/runtime/types/shared.d.ts +13 -0
- package/dist/runtime/utils/extend-theme.d.ts +2 -2
- package/dist/runtime/utils/tree-expand.d.ts +22 -0
- package/dist/runtime/utils/tree-expand.js +18 -0
- package/dist/runtime/utils/tree-selection.d.ts +37 -0
- package/dist/runtime/utils/tree-selection.js +59 -0
- package/dist/shared/{nuxt.DfBEyjld.mjs → nuxt.CXM2nhP4.mjs} +76 -4
- package/dist/unplugin.d.mts +4 -2
- package/dist/unplugin.mjs +1 -35
- package/dist/vite.mjs +1 -1
- package/package.json +21 -21
- package/dist/runtime/domains/data-table/tree-selection.d.ts +0 -9
- package/dist/runtime/domains/data-table/tree-selection.js +0 -76
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 默认展开策略:true 全部父级、number 取 depth 小于该值、函数自定义 */
|
|
2
|
+
export type DefaultExpanded<T> = boolean | number | ((node: T, depth: number) => boolean);
|
|
3
|
+
/** key 派生上下文:depth 从 0 起算,index 为同层序号,parentKey 为父节点 key */
|
|
4
|
+
export interface ExpandKeyContext {
|
|
5
|
+
depth: number;
|
|
6
|
+
index: number;
|
|
7
|
+
parentKey?: string;
|
|
8
|
+
}
|
|
9
|
+
interface ExpandOptions<T> {
|
|
10
|
+
/** 取节点唯一 key,可借 ctx 复刻 TanStack getRowId 的 index 路径 */
|
|
11
|
+
getKey: (node: T, ctx: ExpandKeyContext) => string;
|
|
12
|
+
/** 取子节点数组,缺省读 node.children */
|
|
13
|
+
getChildren?: (node: T) => unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 由 defaultExpanded 策略推导初始展开的节点 key 列表(Tree 与 DataTable 共用)
|
|
17
|
+
*
|
|
18
|
+
* 仅命中有非空 children 的父节点;depth 从 0 起算,可复用为 expandToDepth(depth=0 收起全部)。
|
|
19
|
+
* 通过 getKey / getChildren 适配不同数据形态与 key 派生规则。
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveDefaultExpandedKeys<T>(items: T[], defaultExpanded: DefaultExpanded<T>, options: ExpandOptions<T>): string[];
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function resolveDefaultExpandedKeys(items, defaultExpanded, options) {
|
|
2
|
+
if (!defaultExpanded) return [];
|
|
3
|
+
const { getKey } = options;
|
|
4
|
+
const getChildren = options.getChildren ?? ((node) => node.children);
|
|
5
|
+
const predicate = typeof defaultExpanded === "function" ? defaultExpanded : typeof defaultExpanded === "number" ? (_node, depth) => depth < defaultExpanded : () => true;
|
|
6
|
+
const keys = [];
|
|
7
|
+
const walk = (nodes, depth, parentKey) => {
|
|
8
|
+
nodes.forEach((node, index) => {
|
|
9
|
+
const key = getKey(node, { depth, index, parentKey });
|
|
10
|
+
const children = getChildren(node);
|
|
11
|
+
if (!Array.isArray(children) || children.length === 0) return;
|
|
12
|
+
if (predicate(node, depth)) keys.push(key);
|
|
13
|
+
walk(children, depth + 1, key);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
walk(items, 0);
|
|
17
|
+
return keys;
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { TreeSelectionResult } from '../types/shared';
|
|
2
|
+
/** 父子勾选策略,仅 cascade 会在 strictlyChecked 中剔除随父级联的子节点 */
|
|
3
|
+
export type TreeSelectionStrategy = 'cascade' | 'isolated' | 'leaf';
|
|
4
|
+
/** 工具栏选中态摘要 */
|
|
5
|
+
export interface TreeSelectionSummary {
|
|
6
|
+
/** 已选节点数 */
|
|
7
|
+
checkedCount: number;
|
|
8
|
+
/** 可选节点总数 */
|
|
9
|
+
total: number;
|
|
10
|
+
/** 是否全部选中 */
|
|
11
|
+
allChecked: boolean;
|
|
12
|
+
/** 是否处于半选态 */
|
|
13
|
+
indeterminate: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 由已选数量与可选总数推导工具栏选中态摘要
|
|
17
|
+
*
|
|
18
|
+
* 供三态全选复选框与选中计数复用:全空与无可选节点时既非全选也非半选。
|
|
19
|
+
*/
|
|
20
|
+
export declare function selectionSummary(checkedCount: number, total: number): TreeSelectionSummary;
|
|
21
|
+
interface SelectionOptions<T> {
|
|
22
|
+
/** 取节点唯一 key */
|
|
23
|
+
getKey: (node: T) => string;
|
|
24
|
+
/** 取子节点数组,缺省读 node.children */
|
|
25
|
+
getChildren?: (node: T) => T[] | undefined;
|
|
26
|
+
/** 勾选策略 */
|
|
27
|
+
strategy?: TreeSelectionStrategy;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 由选中 key 集合派生选中结果分类(Tree 与 DataTable 共用)
|
|
31
|
+
*
|
|
32
|
+
* 统计每节点子孙叶子总数与已选数,得 selected / leaves / parents(满选父)/
|
|
33
|
+
* halfSelected(半选父)/ strictlyChecked(cascade 下剔除随父级联的子节点)。
|
|
34
|
+
* 通过 getKey / getChildren 适配不同数据形态。
|
|
35
|
+
*/
|
|
36
|
+
export declare function computeTreeSelection<T>(items: T[], selectedKeys: Iterable<string | number>, options: SelectionOptions<T>): TreeSelectionResult<T>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function selectionSummary(checkedCount, total) {
|
|
2
|
+
const allChecked = total > 0 && checkedCount >= total;
|
|
3
|
+
return {
|
|
4
|
+
checkedCount,
|
|
5
|
+
total,
|
|
6
|
+
allChecked,
|
|
7
|
+
indeterminate: checkedCount > 0 && !allChecked
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function computeTreeSelection(items, selectedKeys, options) {
|
|
11
|
+
const { getKey, strategy = "cascade" } = options;
|
|
12
|
+
const getChildren = options.getChildren ?? ((node) => node.children);
|
|
13
|
+
const keySet = /* @__PURE__ */ new Set();
|
|
14
|
+
for (const key of selectedKeys) keySet.add(String(key));
|
|
15
|
+
const selected = [];
|
|
16
|
+
const leaves = [];
|
|
17
|
+
const parents = [];
|
|
18
|
+
const halfSelected = [];
|
|
19
|
+
const strictlyChecked = [];
|
|
20
|
+
const build = (nodes, parent) => nodes.map((node) => {
|
|
21
|
+
const entry = {
|
|
22
|
+
node,
|
|
23
|
+
parent,
|
|
24
|
+
children: [],
|
|
25
|
+
selfSelected: keySet.has(getKey(node)),
|
|
26
|
+
leafTotal: 0,
|
|
27
|
+
leafSelected: 0
|
|
28
|
+
};
|
|
29
|
+
const children = getChildren(node);
|
|
30
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
31
|
+
entry.children = build(children, entry);
|
|
32
|
+
for (const child of entry.children) {
|
|
33
|
+
entry.leafTotal += child.leafTotal;
|
|
34
|
+
entry.leafSelected += child.leafSelected;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
entry.leafTotal = 1;
|
|
38
|
+
entry.leafSelected = entry.selfSelected ? 1 : 0;
|
|
39
|
+
}
|
|
40
|
+
return entry;
|
|
41
|
+
});
|
|
42
|
+
const visit = (entry) => {
|
|
43
|
+
const isLeaf = entry.children.length === 0;
|
|
44
|
+
if (entry.selfSelected) {
|
|
45
|
+
selected.push(entry.node);
|
|
46
|
+
if (isLeaf) leaves.push(entry.node);
|
|
47
|
+
if (strategy !== "cascade" || !entry.parent?.selfSelected) {
|
|
48
|
+
strictlyChecked.push(entry.node);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!isLeaf) {
|
|
52
|
+
if (entry.leafTotal > 0 && entry.leafSelected === entry.leafTotal) parents.push(entry.node);
|
|
53
|
+
else if (entry.leafSelected > 0) halfSelected.push(entry.node);
|
|
54
|
+
}
|
|
55
|
+
for (const child of entry.children) visit(child);
|
|
56
|
+
};
|
|
57
|
+
for (const root of build(items, null)) visit(root);
|
|
58
|
+
return { selected, leaves, parents, halfSelected, strictlyChecked };
|
|
59
|
+
}
|
|
@@ -197,6 +197,14 @@ const PINNED = "data-[pinned]";
|
|
|
197
197
|
const PINNED_L = "data-[pinned=left]";
|
|
198
198
|
const NOT_LAST_NOT_PIN = "not-last:not-data-[pinned=left]:not-data-[pinned=right]";
|
|
199
199
|
const GROUP_HEADER = "[[data-slot=tr]:has([colspan])>&]";
|
|
200
|
+
const PIN = "&:is([data-pinned=left],[data-pinned=right])";
|
|
201
|
+
const NOT_PIN = "&[data-pinned]:not([data-pinned=left]):not([data-pinned=right])";
|
|
202
|
+
const PIN_BG_SELECTED = `[[data-selected=true]>${PIN}]:bg-[color:color-mix(in_oklab,var(--ui-bg-elevated)_50%,var(--ui-bg))]`;
|
|
203
|
+
const PIN_BG_HOVER = `[[data-slot=tr][data-selectable=true]:hover>${PIN}]:bg-[color:color-mix(in_oklab,var(--ui-bg-elevated)_50%,var(--ui-bg))]`;
|
|
204
|
+
const NOT_PIN_BG_SELECTED = `[[data-selected=true]>${NOT_PIN}]:bg-[color:color-mix(in_oklab,var(--ui-bg-elevated)_50%,transparent)]`;
|
|
205
|
+
const PIN_SHADOW_COLOR = `[${PIN}]:[--m-dt-pin-shadow-color:color-mix(in_oklab,var(--ui-text-muted)_25%,transparent)]`;
|
|
206
|
+
const PIN_L_EDGE = `[[data-pin-start]_&[data-pinned=left]:not(:has(+[data-pinned=left]))]:[--m-dt-pin-shadow:8px_0_10px_-8px_var(--m-dt-pin-shadow-color)]`;
|
|
207
|
+
const PIN_R_EDGE = `[[data-pin-end]_:not([data-pinned=right])+&[data-pinned=right]]:[--m-dt-pin-shadow:-8px_0_10px_-8px_var(--m-dt-pin-shadow-color)]`;
|
|
200
208
|
const BW = "var(--m-dt-border-width,1px)";
|
|
201
209
|
const BC = "var(--m-dt-border-color,var(--ui-border))";
|
|
202
210
|
const BS = "var(--m-dt-border-style,solid)";
|
|
@@ -207,17 +215,27 @@ const dataTable = () => ({
|
|
|
207
215
|
tbody: "divide-y-0",
|
|
208
216
|
th: [
|
|
209
217
|
`${PINNED}:sticky`,
|
|
218
|
+
`[${PIN}]:bg-default`,
|
|
219
|
+
PIN_SHADOW_COLOR,
|
|
210
220
|
`${PINNED}:[--m-dt-pin-shadow:0_0_0_0_transparent]`,
|
|
211
|
-
`${PINNED}:shadow-[var(--m-dt-pin-shadow)]
|
|
221
|
+
`${PINNED}:shadow-[var(--m-dt-pin-shadow)]`,
|
|
222
|
+
PIN_L_EDGE,
|
|
223
|
+
PIN_R_EDGE
|
|
212
224
|
].join(" "),
|
|
213
225
|
td: [
|
|
214
226
|
"empty:p-0",
|
|
215
227
|
`${ROW_SEP}:border-t`,
|
|
216
228
|
`${ROW_SEP}:border-default`,
|
|
217
229
|
`${PINNED}:sticky`,
|
|
230
|
+
`[${PIN}]:bg-default`,
|
|
231
|
+
PIN_SHADOW_COLOR,
|
|
218
232
|
`${PINNED}:[--m-dt-pin-shadow:0_0_0_0_transparent]`,
|
|
219
233
|
`${PINNED}:shadow-[var(--m-dt-pin-shadow)]`,
|
|
220
|
-
|
|
234
|
+
PIN_L_EDGE,
|
|
235
|
+
PIN_R_EDGE,
|
|
236
|
+
NOT_PIN_BG_SELECTED,
|
|
237
|
+
PIN_BG_SELECTED,
|
|
238
|
+
PIN_BG_HOVER
|
|
221
239
|
].join(" ")
|
|
222
240
|
},
|
|
223
241
|
variants: {
|
|
@@ -256,7 +274,10 @@ const dataTable = () => ({
|
|
|
256
274
|
},
|
|
257
275
|
striped: {
|
|
258
276
|
true: {
|
|
259
|
-
td:
|
|
277
|
+
td: [
|
|
278
|
+
`[[data-slot=tr]:nth-child(even)>${NOT_PIN}]:bg-[color:color-mix(in_oklab,var(--ui-bg-accented)_10%,transparent)]`,
|
|
279
|
+
`[[data-slot=tr]:nth-child(even)>${PIN}]:bg-[color:color-mix(in_oklab,var(--ui-bg-accented)_10%,var(--ui-bg))]`
|
|
280
|
+
].join(" ")
|
|
260
281
|
}
|
|
261
282
|
},
|
|
262
283
|
tree: {
|
|
@@ -409,6 +430,20 @@ const pillGroup = () => ({
|
|
|
409
430
|
}
|
|
410
431
|
});
|
|
411
432
|
|
|
433
|
+
const tree = () => ({
|
|
434
|
+
slots: {
|
|
435
|
+
container: "flex flex-col gap-2 min-h-0",
|
|
436
|
+
toolbar: "flex items-center gap-1.5",
|
|
437
|
+
toolbarButton: "shrink-0",
|
|
438
|
+
search: "flex-1 min-w-0",
|
|
439
|
+
checkbox: "shrink-0 me-1.5",
|
|
440
|
+
highlight: "rounded-[2px] bg-primary/15 text-primary",
|
|
441
|
+
loading: "flex items-center gap-1.5 text-sm text-muted",
|
|
442
|
+
loadingIcon: "size-4 shrink-0 animate-spin",
|
|
443
|
+
empty: "py-6 text-center text-sm text-muted"
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
|
|
412
447
|
const theme = {
|
|
413
448
|
__proto__: null,
|
|
414
449
|
asPhoneNumberInput: asPhoneNumberInput,
|
|
@@ -424,6 +459,7 @@ const theme = {
|
|
|
424
459
|
slideVerify: slideVerify,
|
|
425
460
|
starRating: starRating,
|
|
426
461
|
themePicker: themePicker,
|
|
462
|
+
tree: tree,
|
|
427
463
|
withCharacterLimit: withCharacterLimit,
|
|
428
464
|
withClear: withClear,
|
|
429
465
|
withCopy: withCopy,
|
|
@@ -664,4 +700,40 @@ async function addTemplates(options, nuxt) {
|
|
|
664
700
|
}
|
|
665
701
|
}
|
|
666
702
|
|
|
667
|
-
|
|
703
|
+
const UI_COMPONENTS = [
|
|
704
|
+
"UAccordion",
|
|
705
|
+
"UButton",
|
|
706
|
+
"UBadge",
|
|
707
|
+
"UCheckbox",
|
|
708
|
+
"UCollapsible",
|
|
709
|
+
"UForm",
|
|
710
|
+
"UDropdownMenu",
|
|
711
|
+
"UIcon",
|
|
712
|
+
"UInput",
|
|
713
|
+
"UModal",
|
|
714
|
+
"UPagination",
|
|
715
|
+
"USelect",
|
|
716
|
+
"UPopover",
|
|
717
|
+
"UCalendar",
|
|
718
|
+
"UColorPicker",
|
|
719
|
+
"UTable",
|
|
720
|
+
"UFormField",
|
|
721
|
+
"UTooltip",
|
|
722
|
+
"UInputNumber",
|
|
723
|
+
"USwitch",
|
|
724
|
+
"UTextarea",
|
|
725
|
+
"USlider",
|
|
726
|
+
"UPinInput",
|
|
727
|
+
"UInputTags",
|
|
728
|
+
"UFileUpload",
|
|
729
|
+
"USelectMenu",
|
|
730
|
+
"UInputMenu",
|
|
731
|
+
"UCheckboxGroup",
|
|
732
|
+
"URadioGroup",
|
|
733
|
+
"UInputDate",
|
|
734
|
+
"UInputTime",
|
|
735
|
+
"UListbox",
|
|
736
|
+
"UTree"
|
|
737
|
+
];
|
|
738
|
+
|
|
739
|
+
export { UI_COMPONENTS as U, addTemplates as a, getTemplates as g };
|
package/dist/unplugin.d.mts
CHANGED
|
@@ -6,6 +6,9 @@ import '../dist/runtime/types/api/module.js';
|
|
|
6
6
|
import '@nuxt/ui';
|
|
7
7
|
import '../dist/runtime/types/index.js';
|
|
8
8
|
|
|
9
|
+
/** movk 组件层从 `#components` 具名导入的 @nuxt/ui 组件(去 U 前缀映射到 @nuxt/ui/components/<Name>.vue) */
|
|
10
|
+
declare const UI_COMPONENTS: readonly ["UAccordion", "UButton", "UBadge", "UCheckbox", "UCollapsible", "UForm", "UDropdownMenu", "UIcon", "UInput", "UModal", "UPagination", "USelect", "UPopover", "UCalendar", "UColorPicker", "UTable", "UFormField", "UTooltip", "UInputNumber", "USwitch", "UTextarea", "USlider", "UPinInput", "UInputTags", "UFileUpload", "USelectMenu", "UInputMenu", "UCheckboxGroup", "URadioGroup", "UInputDate", "UInputTime", "UListbox", "UTree"];
|
|
11
|
+
|
|
9
12
|
interface MovkUIOptions extends Pick<ModuleOptions, 'prefix' | 'theme'> {
|
|
10
13
|
/** 站点信息,注入 app.config.movkSite;name 作为主题 localStorage key 前缀 */
|
|
11
14
|
site?: {
|
|
@@ -20,8 +23,7 @@ interface MovkUIOptions extends Pick<ModuleOptions, 'prefix' | 'theme'> {
|
|
|
20
23
|
ui?: Partial<NuxtUIOptions>;
|
|
21
24
|
}
|
|
22
25
|
declare const runtimeDir: string;
|
|
23
|
-
|
|
24
|
-
declare const UI_COMPONENTS: readonly ["UAccordion", "UButton", "UBadge", "UCheckbox", "UCollapsible", "UForm", "UDropdownMenu", "UIcon", "UInput", "UModal", "UPagination", "USelect", "UPopover", "UCalendar", "UColorPicker", "UTable", "UFormField", "UTooltip", "UInputNumber", "USwitch", "UTextarea", "USlider", "UPinInput", "UInputTags", "UFileUpload", "USelectMenu", "UInputMenu", "UCheckboxGroup", "URadioGroup", "UInputDate", "UInputTime", "UListbox"];
|
|
26
|
+
|
|
25
27
|
declare const MovkPlugin: unplugin.UnpluginInstance<MovkUIOptions | undefined, boolean>;
|
|
26
28
|
|
|
27
29
|
export { MovkPlugin, UI_COMPONENTS, runtimeDir };
|
package/dist/unplugin.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import MagicString from 'magic-string';
|
|
|
8
8
|
import { resolvePathSync } from 'mlly';
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
import path from 'node:path';
|
|
11
|
-
import { g as getTemplates } from './shared/nuxt.
|
|
11
|
+
import { U as UI_COMPONENTS, g as getTemplates } from './shared/nuxt.CXM2nhP4.mjs';
|
|
12
12
|
import { kebabCase } from 'scule';
|
|
13
13
|
import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
|
|
14
14
|
import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
|
|
@@ -202,40 +202,6 @@ function MovkPluginsPlugin(options) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
const runtimeDir = normalize(fileURLToPath(new URL("./runtime", import.meta.url)));
|
|
205
|
-
const UI_COMPONENTS = [
|
|
206
|
-
"UAccordion",
|
|
207
|
-
"UButton",
|
|
208
|
-
"UBadge",
|
|
209
|
-
"UCheckbox",
|
|
210
|
-
"UCollapsible",
|
|
211
|
-
"UForm",
|
|
212
|
-
"UDropdownMenu",
|
|
213
|
-
"UIcon",
|
|
214
|
-
"UInput",
|
|
215
|
-
"UModal",
|
|
216
|
-
"UPagination",
|
|
217
|
-
"USelect",
|
|
218
|
-
"UPopover",
|
|
219
|
-
"UCalendar",
|
|
220
|
-
"UColorPicker",
|
|
221
|
-
"UTable",
|
|
222
|
-
"UFormField",
|
|
223
|
-
"UTooltip",
|
|
224
|
-
"UInputNumber",
|
|
225
|
-
"USwitch",
|
|
226
|
-
"UTextarea",
|
|
227
|
-
"USlider",
|
|
228
|
-
"UPinInput",
|
|
229
|
-
"UInputTags",
|
|
230
|
-
"UFileUpload",
|
|
231
|
-
"USelectMenu",
|
|
232
|
-
"UInputMenu",
|
|
233
|
-
"UCheckboxGroup",
|
|
234
|
-
"URadioGroup",
|
|
235
|
-
"UInputDate",
|
|
236
|
-
"UInputTime",
|
|
237
|
-
"UListbox"
|
|
238
|
-
];
|
|
239
205
|
const MOVK_COMPOSABLES = {
|
|
240
206
|
useAutoForm: ["useAutoForm", "defineControl", "DEFAULT_CONTROLS", "getAutoFormMetadata"],
|
|
241
207
|
useTheme: ["useTheme"],
|
package/dist/vite.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@11.
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"packageManager": "pnpm@11.8.0",
|
|
6
6
|
"description": "An engineering suite built on Nuxt UI: schema-driven AutoForm (Zod v4), a full-featured DataTable, standalone UI components and composables. Get the full capabilities — including API integration with auth & progress — in Nuxt 4, and use its UI, forms, tables and theming in plain Vue + Vite via the Vite plugin.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"validation",
|
|
29
29
|
"data-table",
|
|
30
30
|
"table",
|
|
31
|
+
"tree",
|
|
31
32
|
"api",
|
|
32
33
|
"fetch",
|
|
33
34
|
"auth",
|
|
@@ -107,12 +108,12 @@
|
|
|
107
108
|
"scripts": {
|
|
108
109
|
"prepack": "pnpm build",
|
|
109
110
|
"build": "nuxt-module-build build",
|
|
110
|
-
"dev": "
|
|
111
|
+
"dev": "nuxt dev playgrounds/play --uiDev",
|
|
111
112
|
"dev:build": "nuxt build playgrounds/play",
|
|
112
113
|
"dev:vue": "pnpm --filter './playgrounds/vue' dev",
|
|
113
114
|
"dev:vue:build": "pnpm --filter './playgrounds/vue' build",
|
|
114
115
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playgrounds/play && nuxt prepare docs && pnpm dev:vue:build",
|
|
115
|
-
"docs": "
|
|
116
|
+
"docs": "nuxt dev docs --uiDev",
|
|
116
117
|
"docs:build": "nuxt build docs",
|
|
117
118
|
"release": "release-it && npm publish",
|
|
118
119
|
"lint": "eslint .",
|
|
@@ -123,13 +124,13 @@
|
|
|
123
124
|
"test:vue": "vitest --project vue"
|
|
124
125
|
},
|
|
125
126
|
"dependencies": {
|
|
126
|
-
"@iconify-json/lucide": "^1.2.
|
|
127
|
+
"@iconify-json/lucide": "^1.2.114",
|
|
127
128
|
"@iconify-json/ph": "^1.2.2",
|
|
128
129
|
"@iconify-json/tabler": "^1.2.35",
|
|
129
130
|
"@internationalized/date": "^3.12.2",
|
|
130
|
-
"@movk/core": "^1.3.
|
|
131
|
+
"@movk/core": "^1.3.1",
|
|
131
132
|
"@nuxt/image": "^2.0.0",
|
|
132
|
-
"@nuxt/ui": "^4.
|
|
133
|
+
"@nuxt/ui": "^4.9.0",
|
|
133
134
|
"@tanstack/vue-table": "^8.21.3",
|
|
134
135
|
"@vueuse/core": "^14.3.0",
|
|
135
136
|
"@vueuse/nuxt": "^14.3.0",
|
|
@@ -139,34 +140,33 @@
|
|
|
139
140
|
"maska": "^3.2.0",
|
|
140
141
|
"mlly": "^1.8.2",
|
|
141
142
|
"nuxt-auth-utils": "^0.5.29",
|
|
142
|
-
"nuxt-site-config": "^4.0
|
|
143
|
+
"nuxt-site-config": "^4.1.0",
|
|
143
144
|
"pathe": "^2.0.3",
|
|
144
|
-
"reka-ui": "
|
|
145
|
+
"reka-ui": "2.9.10",
|
|
145
146
|
"scule": "^1.3.0",
|
|
146
147
|
"tailwind-variants": "^3.2.2",
|
|
147
|
-
"tailwindcss": "^4.3.
|
|
148
|
+
"tailwindcss": "^4.3.1",
|
|
148
149
|
"tinyglobby": "^0.2.17",
|
|
149
150
|
"unifont": "^0.7.4",
|
|
150
151
|
"unplugin": "^3.0.0",
|
|
151
152
|
"zod": "^4.4.3"
|
|
152
153
|
},
|
|
153
154
|
"devDependencies": {
|
|
154
|
-
"@nuxt/eslint-config": "^1.
|
|
155
|
-
"@nuxt/kit": "^4.4.
|
|
155
|
+
"@nuxt/eslint-config": "^1.16.0",
|
|
156
|
+
"@nuxt/kit": "^4.4.8",
|
|
156
157
|
"@nuxt/module-builder": "^1.0.2",
|
|
157
|
-
"@nuxt/schema": "^4.4.
|
|
158
|
-
"@release-it/bumper": "^7.0.6",
|
|
158
|
+
"@nuxt/schema": "^4.4.8",
|
|
159
159
|
"@release-it/conventional-changelog": "^11.0.1",
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
160
|
+
"eslint": "^10.5.0",
|
|
161
|
+
"happy-dom": "^20.10.6",
|
|
162
|
+
"nuxt": "^4.4.8",
|
|
163
|
+
"release-it": "^20.2.0",
|
|
164
164
|
"typescript": "^6.0.3",
|
|
165
165
|
"unbuild": "^3.6.1",
|
|
166
166
|
"unplugin-auto-import": "^21.0.0",
|
|
167
167
|
"unplugin-vue-components": "^32.1.0",
|
|
168
|
-
"vitest": "^4.1.
|
|
169
|
-
"vue": "^3.5.
|
|
170
|
-
"vue-tsc": "^3.3.
|
|
168
|
+
"vitest": "^4.1.9",
|
|
169
|
+
"vue": "^3.5.38",
|
|
170
|
+
"vue-tsc": "^3.3.5"
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DataTableTreeSelectionStrategy } from '../../types/data-table';
|
|
2
|
-
import type { TreeSelectionResult } from '../../types/data-table/columns';
|
|
3
|
-
interface ComputeOptions {
|
|
4
|
-
rowKey?: string;
|
|
5
|
-
childrenKey?: string;
|
|
6
|
-
strategy?: DataTableTreeSelectionStrategy;
|
|
7
|
-
}
|
|
8
|
-
export declare function computeTreeRowSelection<T>(rows: T[], keys: readonly (string | number)[], options?: ComputeOptions): TreeSelectionResult<T>;
|
|
9
|
-
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export function computeTreeRowSelection(rows, keys, options = {}) {
|
|
2
|
-
const rowKey = options.rowKey ?? "id";
|
|
3
|
-
const childrenKey = options.childrenKey;
|
|
4
|
-
const strategy = options.strategy ?? "cascade";
|
|
5
|
-
const keySet = new Set(keys.map(String));
|
|
6
|
-
const selected = [];
|
|
7
|
-
const leaves = [];
|
|
8
|
-
const parents = [];
|
|
9
|
-
const halfSelected = [];
|
|
10
|
-
const strictlyChecked = [];
|
|
11
|
-
const readKey = (row, key) => row[key];
|
|
12
|
-
if (!childrenKey) {
|
|
13
|
-
for (const row of rows) {
|
|
14
|
-
if (keySet.has(String(readKey(row, rowKey)))) {
|
|
15
|
-
selected.push(row);
|
|
16
|
-
leaves.push(row);
|
|
17
|
-
strictlyChecked.push(row);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return { selected, leaves, parents, halfSelected, strictlyChecked };
|
|
21
|
-
}
|
|
22
|
-
const build = (items, parent) => {
|
|
23
|
-
const list = [];
|
|
24
|
-
for (const row of items) {
|
|
25
|
-
const id = String(readKey(row, rowKey));
|
|
26
|
-
const selfSelected = keySet.has(id);
|
|
27
|
-
const node = {
|
|
28
|
-
row,
|
|
29
|
-
id,
|
|
30
|
-
parent,
|
|
31
|
-
children: [],
|
|
32
|
-
selfSelected,
|
|
33
|
-
leafTotal: 0,
|
|
34
|
-
leafSelected: 0
|
|
35
|
-
};
|
|
36
|
-
const childArr = readKey(row, childrenKey);
|
|
37
|
-
if (Array.isArray(childArr) && childArr.length > 0) {
|
|
38
|
-
node.children = build(childArr, node);
|
|
39
|
-
for (const c of node.children) {
|
|
40
|
-
node.leafTotal += c.leafTotal;
|
|
41
|
-
node.leafSelected += c.leafSelected;
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
node.leafTotal = 1;
|
|
45
|
-
node.leafSelected = selfSelected ? 1 : 0;
|
|
46
|
-
}
|
|
47
|
-
list.push(node);
|
|
48
|
-
}
|
|
49
|
-
return list;
|
|
50
|
-
};
|
|
51
|
-
const roots = build(rows, null);
|
|
52
|
-
const visit = (node) => {
|
|
53
|
-
const isLeaf = node.children.length === 0;
|
|
54
|
-
if (node.selfSelected) {
|
|
55
|
-
selected.push(node.row);
|
|
56
|
-
if (isLeaf) leaves.push(node.row);
|
|
57
|
-
if (strategy === "cascade") {
|
|
58
|
-
if (!node.parent || !node.parent.selfSelected) {
|
|
59
|
-
strictlyChecked.push(node.row);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
strictlyChecked.push(node.row);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (!isLeaf) {
|
|
66
|
-
if (node.leafTotal > 0 && node.leafSelected === node.leafTotal) {
|
|
67
|
-
parents.push(node.row);
|
|
68
|
-
} else if (node.leafSelected > 0) {
|
|
69
|
-
halfSelected.push(node.row);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
for (const child of node.children) visit(child);
|
|
73
|
-
};
|
|
74
|
-
for (const root of roots) visit(root);
|
|
75
|
-
return { selected, leaves, parents, halfSelected, strictlyChecked };
|
|
76
|
-
}
|