@simplysm/solid 13.0.51 → 13.0.55
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 +3 -1
- package/dist/components/data/sheet/DataSheet.css +28 -10
- package/dist/components/data/sheet/DataSheet.d.ts.map +1 -1
- package/dist/components/data/sheet/DataSheet.js +13 -4
- package/dist/components/data/sheet/DataSheet.js.map +2 -2
- package/dist/components/data/sheet/sheetUtils.d.ts +2 -2
- package/dist/components/data/sheet/sheetUtils.d.ts.map +1 -1
- package/dist/components/data/sheet/sheetUtils.js +16 -13
- package/dist/components/data/sheet/sheetUtils.js.map +1 -1
- package/dist/components/data/sheet/types.d.ts +6 -0
- package/dist/components/data/sheet/types.d.ts.map +1 -1
- package/dist/components/display/Icon.d.ts.map +1 -1
- package/dist/components/display/Icon.js +7 -2
- package/dist/components/display/Icon.js.map +2 -2
- package/dist/components/display/Link.d.ts +4 -0
- package/dist/components/display/Link.d.ts.map +1 -1
- package/dist/components/display/Link.js +13 -3
- package/dist/components/display/Link.js.map +2 -2
- package/dist/components/form-control/Invalid.d.ts.map +1 -1
- package/dist/components/form-control/Invalid.js +4 -3
- package/dist/components/form-control/Invalid.js.map +2 -2
- package/dist/components/form-control/checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/form-control/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/form-control/combobox/Combobox.js +2 -2
- package/dist/components/form-control/combobox/Combobox.js.map +1 -1
- package/dist/components/form-control/editor/RichTextEditor.js +1 -1
- package/dist/components/form-control/editor/RichTextEditor.js.map +1 -1
- package/dist/components/form-control/field/DatePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/DatePicker.js +3 -2
- package/dist/components/form-control/field/DatePicker.js.map +2 -2
- package/dist/components/form-control/field/DateTimePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/DateTimePicker.js +3 -2
- package/dist/components/form-control/field/DateTimePicker.js.map +2 -2
- package/dist/components/form-control/field/NumberInput.d.ts.map +1 -1
- package/dist/components/form-control/field/NumberInput.js +1 -1
- package/dist/components/form-control/field/NumberInput.js.map +1 -1
- package/dist/components/form-control/field/TextInput.js +2 -2
- package/dist/components/form-control/field/TextInput.js.map +1 -1
- package/dist/components/form-control/field/TimePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/TimePicker.js +3 -2
- package/dist/components/form-control/field/TimePicker.js.map +2 -2
- package/dist/components/form-control/state-preset/StatePreset.d.ts.map +1 -1
- package/dist/components/form-control/state-preset/StatePreset.js +1 -1
- package/dist/components/form-control/state-preset/StatePreset.js.map +1 -1
- package/dist/components/layout/topbar/Topbar.d.ts +2 -0
- package/dist/components/layout/topbar/Topbar.d.ts.map +1 -1
- package/dist/components/layout/topbar/Topbar.js +2 -0
- package/dist/components/layout/topbar/Topbar.js.map +2 -2
- package/dist/components/layout/topbar/TopbarActions.d.ts +3 -0
- package/dist/components/layout/topbar/TopbarActions.d.ts.map +1 -0
- package/dist/components/layout/topbar/TopbarActions.js +17 -0
- package/dist/components/layout/topbar/TopbarActions.js.map +6 -0
- package/dist/components/layout/topbar/TopbarContainer.d.ts +1 -1
- package/dist/components/layout/topbar/TopbarContainer.d.ts.map +1 -1
- package/dist/components/layout/topbar/TopbarContainer.js +21 -12
- package/dist/components/layout/topbar/TopbarContainer.js.map +2 -2
- package/dist/components/layout/topbar/TopbarContext.d.ts +9 -0
- package/dist/components/layout/topbar/TopbarContext.d.ts.map +1 -0
- package/dist/components/layout/topbar/TopbarContext.js +29 -0
- package/dist/components/layout/topbar/TopbarContext.js.map +6 -0
- package/dist/helpers/createAppStructure.d.ts +2 -6
- package/dist/helpers/createAppStructure.d.ts.map +1 -1
- package/dist/helpers/createAppStructure.js +26 -58
- package/dist/helpers/createAppStructure.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/patterns.styles.js +2 -2
- package/dist/styles/patterns.styles.js.map +1 -1
- package/dist/styles/tokens.styles.d.ts +2 -2
- package/dist/styles/tokens.styles.js +2 -2
- package/docs/layout.md +70 -1
- package/package.json +3 -3
- package/src/components/data/sheet/DataSheet.css +28 -10
- package/src/components/data/sheet/DataSheet.tsx +27 -4
- package/src/components/data/sheet/sheetUtils.ts +16 -11
- package/src/components/data/sheet/types.ts +6 -0
- package/src/components/display/Icon.tsx +10 -1
- package/src/components/display/Link.tsx +19 -9
- package/src/components/form-control/Invalid.tsx +13 -6
- package/src/components/form-control/combobox/Combobox.tsx +2 -1
- package/src/components/form-control/editor/RichTextEditor.tsx +1 -1
- package/src/components/form-control/field/DatePicker.tsx +4 -1
- package/src/components/form-control/field/DateTimePicker.tsx +3 -0
- package/src/components/form-control/field/NumberInput.tsx +2 -0
- package/src/components/form-control/field/TextInput.tsx +2 -2
- package/src/components/form-control/field/TimePicker.tsx +3 -0
- package/src/components/form-control/state-preset/StatePreset.tsx +1 -0
- package/src/components/layout/topbar/Topbar.tsx +3 -0
- package/src/components/layout/topbar/TopbarActions.tsx +8 -0
- package/src/components/layout/topbar/TopbarContainer.tsx +9 -5
- package/src/components/layout/topbar/TopbarContext.ts +36 -0
- package/src/helpers/createAppStructure.ts +32 -74
- package/src/index.ts +1 -0
- package/src/styles/patterns.styles.ts +2 -2
- package/src/styles/tokens.styles.ts +2 -2
|
@@ -61,12 +61,9 @@ export interface AppFlatPerm<TModule = string> {
|
|
|
61
61
|
requiredModulesChain: TModule[][];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export interface AppRoute
|
|
64
|
+
export interface AppRoute {
|
|
65
65
|
path: string;
|
|
66
66
|
component: Component;
|
|
67
|
-
permCode?: string;
|
|
68
|
-
modulesChain: TModule[][];
|
|
69
|
-
requiredModulesChain: TModule[][];
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
export interface AppFlatMenu {
|
|
@@ -76,12 +73,11 @@ export interface AppFlatMenu {
|
|
|
76
73
|
|
|
77
74
|
export interface AppStructure<TModule> {
|
|
78
75
|
items: AppStructureItem<TModule>[];
|
|
79
|
-
|
|
76
|
+
usableRoutes: Accessor<AppRoute[]>;
|
|
80
77
|
usableMenus: Accessor<AppMenu[]>;
|
|
81
78
|
usableFlatMenus: Accessor<AppFlatMenu[]>;
|
|
82
79
|
usablePerms: Accessor<AppPerm<TModule>[]>;
|
|
83
80
|
allFlatPerms: AppFlatPerm<TModule>[];
|
|
84
|
-
checkRouteAccess(route: AppRoute<TModule>): boolean;
|
|
85
81
|
getTitleChainByHref(href: string): string[];
|
|
86
82
|
}
|
|
87
83
|
|
|
@@ -146,44 +142,29 @@ function checkModules<TModule>(
|
|
|
146
142
|
|
|
147
143
|
// ── Routes ──
|
|
148
144
|
|
|
149
|
-
function
|
|
145
|
+
function buildUsableRoutes<TModule>(
|
|
150
146
|
items: AppStructureItem<TModule>[],
|
|
151
147
|
routeBasePath: string,
|
|
152
148
|
permBasePath: string,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
): AppRoute
|
|
156
|
-
const result: AppRoute
|
|
149
|
+
usableModules: TModule[] | undefined,
|
|
150
|
+
permRecord: Record<string, boolean> | undefined,
|
|
151
|
+
): AppRoute[] {
|
|
152
|
+
const result: AppRoute[] = [];
|
|
157
153
|
|
|
158
154
|
for (const item of items) {
|
|
159
|
-
|
|
160
|
-
? [...modulesChain, item.modules]
|
|
161
|
-
: modulesChain;
|
|
162
|
-
const currRequiredModulesChain: TModule[][] = item.requiredModules
|
|
163
|
-
? [...requiredModulesChain, item.requiredModules]
|
|
164
|
-
: requiredModulesChain;
|
|
155
|
+
if (!checkModules(item.modules, item.requiredModules, usableModules)) continue;
|
|
165
156
|
|
|
166
157
|
const routePath = routeBasePath + "/" + item.code;
|
|
167
158
|
const permPath = permBasePath + "/" + item.code;
|
|
168
159
|
|
|
169
160
|
if (isGroupItem(item)) {
|
|
170
161
|
result.push(
|
|
171
|
-
...
|
|
172
|
-
item.children,
|
|
173
|
-
routePath,
|
|
174
|
-
permPath,
|
|
175
|
-
currModulesChain,
|
|
176
|
-
currRequiredModulesChain,
|
|
177
|
-
),
|
|
162
|
+
...buildUsableRoutes(item.children, routePath, permPath, usableModules, permRecord),
|
|
178
163
|
);
|
|
179
164
|
} else if (item.component !== undefined) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
permCode: item.perms?.includes("use") ? permPath + "/use" : undefined,
|
|
184
|
-
modulesChain: currModulesChain,
|
|
185
|
-
requiredModulesChain: currRequiredModulesChain,
|
|
186
|
-
});
|
|
165
|
+
if (permRecord !== undefined && item.perms?.includes("use") && !permRecord[permPath + "/use"])
|
|
166
|
+
continue;
|
|
167
|
+
result.push({ path: routePath, component: item.component });
|
|
187
168
|
}
|
|
188
169
|
}
|
|
189
170
|
|
|
@@ -441,24 +422,25 @@ export function createAppStructure<
|
|
|
441
422
|
}): AppStructure<TModule> & { perms: InferPerms<TItems> } {
|
|
442
423
|
const allFlatPerms = collectFlatPerms(opts.items);
|
|
443
424
|
|
|
444
|
-
const allRoutes: AppRoute<TModule>[] = [];
|
|
445
|
-
for (const top of opts.items) {
|
|
446
|
-
if (isGroupItem(top)) {
|
|
447
|
-
const topModulesChain: TModule[][] = top.modules ? [top.modules] : [];
|
|
448
|
-
const topRequiredModulesChain: TModule[][] = top.requiredModules ? [top.requiredModules] : [];
|
|
449
|
-
allRoutes.push(
|
|
450
|
-
...buildAllRoutes(
|
|
451
|
-
top.children,
|
|
452
|
-
"",
|
|
453
|
-
"/" + top.code,
|
|
454
|
-
topModulesChain,
|
|
455
|
-
topRequiredModulesChain,
|
|
456
|
-
),
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
425
|
const memos = createRoot(() => {
|
|
426
|
+
const usableRoutes = createMemo(() => {
|
|
427
|
+
const routes: AppRoute[] = [];
|
|
428
|
+
for (const top of opts.items) {
|
|
429
|
+
if (isGroupItem(top)) {
|
|
430
|
+
routes.push(
|
|
431
|
+
...buildUsableRoutes(
|
|
432
|
+
top.children,
|
|
433
|
+
"",
|
|
434
|
+
"/" + top.code,
|
|
435
|
+
opts.usableModules?.(),
|
|
436
|
+
opts.permRecord?.(),
|
|
437
|
+
),
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return routes;
|
|
442
|
+
});
|
|
443
|
+
|
|
462
444
|
const usableMenus = createMemo(() => {
|
|
463
445
|
const menus: AppMenu[] = [];
|
|
464
446
|
for (const top of opts.items) {
|
|
@@ -480,42 +462,18 @@ export function createAppStructure<
|
|
|
480
462
|
|
|
481
463
|
const usablePerms = createMemo(() => buildPerms(opts.items, "", opts.usableModules?.()));
|
|
482
464
|
|
|
483
|
-
return { usableMenus, usableFlatMenus, usablePerms };
|
|
465
|
+
return { usableRoutes, usableMenus, usableFlatMenus, usablePerms };
|
|
484
466
|
});
|
|
485
467
|
|
|
486
468
|
const permsObj = buildPermsObject(opts.items, "", opts.permRecord);
|
|
487
469
|
|
|
488
470
|
return {
|
|
489
471
|
items: opts.items,
|
|
490
|
-
|
|
472
|
+
usableRoutes: memos.usableRoutes,
|
|
491
473
|
usableMenus: memos.usableMenus,
|
|
492
474
|
usableFlatMenus: memos.usableFlatMenus,
|
|
493
475
|
usablePerms: memos.usablePerms,
|
|
494
476
|
allFlatPerms,
|
|
495
|
-
checkRouteAccess(route: AppRoute<TModule>): boolean {
|
|
496
|
-
const usableModules = opts.usableModules?.();
|
|
497
|
-
if (usableModules !== undefined) {
|
|
498
|
-
for (const modules of route.modulesChain) {
|
|
499
|
-
if (modules.length > 0 && !modules.some((m) => usableModules.includes(m))) {
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
for (const modules of route.requiredModulesChain) {
|
|
504
|
-
if (modules.length > 0 && !modules.every((m) => usableModules.includes(m))) {
|
|
505
|
-
return false;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (route.permCode !== undefined) {
|
|
511
|
-
const permRecord = opts.permRecord?.();
|
|
512
|
-
if (permRecord !== undefined) {
|
|
513
|
-
return permRecord[route.permCode] ?? false;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
return true;
|
|
518
|
-
},
|
|
519
477
|
perms: permsObj as InferPerms<TItems>,
|
|
520
478
|
getTitleChainByHref(href: string): string[] {
|
|
521
479
|
const codes = href.split("/").filter(Boolean);
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ export * from "./components/layout/FormTable";
|
|
|
43
43
|
export * from "./components/layout/sidebar/Sidebar";
|
|
44
44
|
export * from "./components/layout/sidebar/SidebarContext";
|
|
45
45
|
export * from "./components/layout/topbar/Topbar";
|
|
46
|
+
export * from "./components/layout/topbar/TopbarContext";
|
|
46
47
|
|
|
47
48
|
//#endregion
|
|
48
49
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import {
|
|
2
|
+
import { borderDefault, textDefault, textPlaceholder } from "./tokens.styles";
|
|
3
3
|
|
|
4
4
|
// ── 아이콘 버튼 공통 ──
|
|
5
5
|
export const iconButtonBase = clsx(
|
|
@@ -32,7 +32,7 @@ export const insetBase = "w-full rounded-none border-none";
|
|
|
32
32
|
|
|
33
33
|
// ── 폼 필드 공통 표면 (배경 + 텍스트 + 테두리 + 포커스) ──
|
|
34
34
|
export const fieldSurface = clsx(
|
|
35
|
-
|
|
35
|
+
"bg-primary-50 dark:bg-primary-950/30",
|
|
36
36
|
textDefault,
|
|
37
37
|
"border",
|
|
38
38
|
borderDefault,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ── 테두리 ──
|
|
2
|
-
export const borderDefault = "border-base-
|
|
2
|
+
export const borderDefault = "border-base-200 dark:border-base-700";
|
|
3
3
|
export const borderSubtle = "border-base-200 dark:border-base-700";
|
|
4
4
|
|
|
5
5
|
// ── 표면 배경 ──
|
|
@@ -11,7 +11,7 @@ export const textMuted = "text-base-400 dark:text-base-500";
|
|
|
11
11
|
export const textPlaceholder = "placeholder:text-base-400 dark:placeholder:text-base-500";
|
|
12
12
|
|
|
13
13
|
// ── disabled ──
|
|
14
|
-
export const disabledOpacity = "cursor-default opacity-
|
|
14
|
+
export const disabledOpacity = "cursor-default opacity-30 pointer-events-none";
|
|
15
15
|
|
|
16
16
|
// ── 사이즈 ──
|
|
17
17
|
export type ComponentSize = "xs" | "sm" | "lg" | "xl";
|