@movk/nuxt 1.3.1 → 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/README.md +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -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/useDownloadWithProgress.d.ts +6 -5
- package/dist/runtime/composables/useDownloadWithProgress.js +4 -16
- 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 +16 -16
- 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 +9 -8
- package/dist/runtime/domains/data-table/tree-selection.d.ts +0 -9
- package/dist/runtime/domains/data-table/tree-selection.js +0 -76
|
@@ -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",
|
|
@@ -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",
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
"nuxt-auth-utils": "^0.5.29",
|
|
142
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
148
|
"tailwindcss": "^4.3.1",
|
|
@@ -155,11 +156,11 @@
|
|
|
155
156
|
"@nuxt/kit": "^4.4.8",
|
|
156
157
|
"@nuxt/module-builder": "^1.0.2",
|
|
157
158
|
"@nuxt/schema": "^4.4.8",
|
|
158
|
-
"@release-it/bumper": "^7.0.6",
|
|
159
159
|
"@release-it/conventional-changelog": "^11.0.1",
|
|
160
160
|
"eslint": "^10.5.0",
|
|
161
|
-
"happy-dom": "^20.10.
|
|
161
|
+
"happy-dom": "^20.10.6",
|
|
162
162
|
"nuxt": "^4.4.8",
|
|
163
|
+
"release-it": "^20.2.0",
|
|
163
164
|
"typescript": "^6.0.3",
|
|
164
165
|
"unbuild": "^3.6.1",
|
|
165
166
|
"unplugin-auto-import": "^21.0.0",
|
|
@@ -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
|
-
}
|