@shwfed/nuxt 0.11.13 → 0.11.15
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/module.json +1 -1
- package/dist/runtime/components/button.d.vue.ts +7 -1
- package/dist/runtime/components/button.vue.d.ts +7 -1
- package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.d.vue.ts +6 -0
- package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue +186 -5
- package/dist/runtime/components/ui/button-configurator/ButtonConfiguratorDialog.vue.d.ts +6 -0
- package/dist/runtime/components/ui/button-configurator/menu.d.ts +3 -0
- package/dist/runtime/components/ui/button-configurator/menu.js +28 -4
- package/dist/runtime/components/ui/buttons/Buttons.d.vue.ts +7 -1
- package/dist/runtime/components/ui/buttons/Buttons.vue +24 -8
- package/dist/runtime/components/ui/buttons/Buttons.vue.d.ts +7 -1
- package/dist/runtime/components/ui/buttons/schema.d.ts +91 -0
- package/dist/runtime/components/ui/buttons/schema.js +4 -0
- package/dist/runtime/plugins/api/index.js +13 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Effect } from 'effect';
|
|
|
2
2
|
import type { OverlayBodyRender } from '../composables/useOverlay.js';
|
|
3
3
|
import type { ButtonConfigInput } from './ui/buttons/schema.js';
|
|
4
4
|
export { ButtonActionC, ButtonBodyC, ButtonBodyInputC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC, CURRENT_COMPATIBILITY_DATE, KIND, SUPPORTED_COMPATIBILITY_DATES, createButtonConfig, } from './ui/buttons/schema.js';
|
|
5
|
-
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, } from './ui/buttons/schema.js';
|
|
5
|
+
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, ButtonSize, ButtonVariant, } from './ui/buttons/schema.js';
|
|
6
6
|
export type { ButtonActionEffect, ButtonActionEffectFactory, ButtonActionRuntime } from '../composables/useButtonAction.js';
|
|
7
7
|
export { ButtonActionService, currentButtonAction } from '../composables/useButtonAction.js';
|
|
8
8
|
declare const _default: typeof __VLS_export;
|
|
@@ -25,6 +25,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
25
25
|
}[] | undefined;
|
|
26
26
|
icon?: string | undefined;
|
|
27
27
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
28
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
28
29
|
hideTitle?: boolean | undefined;
|
|
29
30
|
modal?: Readonly<{
|
|
30
31
|
title?: readonly {
|
|
@@ -73,6 +74,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
73
74
|
}>[];
|
|
74
75
|
icon?: string | undefined;
|
|
75
76
|
}>)[];
|
|
77
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
78
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
76
79
|
}>[];
|
|
77
80
|
kind: string;
|
|
78
81
|
compatibilityDate: string;
|
|
@@ -97,6 +100,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
97
100
|
}[] | undefined;
|
|
98
101
|
icon?: string | undefined;
|
|
99
102
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
103
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
100
104
|
hideTitle?: boolean | undefined;
|
|
101
105
|
modal?: Readonly<{
|
|
102
106
|
title?: readonly {
|
|
@@ -145,6 +149,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
145
149
|
}>[];
|
|
146
150
|
icon?: string | undefined;
|
|
147
151
|
}>)[];
|
|
152
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
153
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
148
154
|
}>[];
|
|
149
155
|
kind: string;
|
|
150
156
|
compatibilityDate: string;
|
|
@@ -2,7 +2,7 @@ import { Effect } from 'effect';
|
|
|
2
2
|
import type { OverlayBodyRender } from '../composables/useOverlay.js';
|
|
3
3
|
import type { ButtonConfigInput } from './ui/buttons/schema.js';
|
|
4
4
|
export { ButtonActionC, ButtonBodyC, ButtonBodyInputC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC, CURRENT_COMPATIBILITY_DATE, KIND, SUPPORTED_COMPATIBILITY_DATES, createButtonConfig, } from './ui/buttons/schema.js';
|
|
5
|
-
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, } from './ui/buttons/schema.js';
|
|
5
|
+
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, ButtonSize, ButtonVariant, } from './ui/buttons/schema.js';
|
|
6
6
|
export type { ButtonActionEffect, ButtonActionEffectFactory, ButtonActionRuntime } from '../composables/useButtonAction.js';
|
|
7
7
|
export { ButtonActionService, currentButtonAction } from '../composables/useButtonAction.js';
|
|
8
8
|
declare const _default: typeof __VLS_export;
|
|
@@ -25,6 +25,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
25
25
|
}[] | undefined;
|
|
26
26
|
icon?: string | undefined;
|
|
27
27
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
28
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
28
29
|
hideTitle?: boolean | undefined;
|
|
29
30
|
modal?: Readonly<{
|
|
30
31
|
title?: readonly {
|
|
@@ -73,6 +74,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
73
74
|
}>[];
|
|
74
75
|
icon?: string | undefined;
|
|
75
76
|
}>)[];
|
|
77
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
78
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
76
79
|
}>[];
|
|
77
80
|
kind: string;
|
|
78
81
|
compatibilityDate: string;
|
|
@@ -97,6 +100,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
97
100
|
}[] | undefined;
|
|
98
101
|
icon?: string | undefined;
|
|
99
102
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
103
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
100
104
|
hideTitle?: boolean | undefined;
|
|
101
105
|
modal?: Readonly<{
|
|
102
106
|
title?: readonly {
|
|
@@ -145,6 +149,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
145
149
|
}>[];
|
|
146
150
|
icon?: string | undefined;
|
|
147
151
|
}>)[];
|
|
152
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
153
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
148
154
|
}>[];
|
|
149
155
|
kind: string;
|
|
150
156
|
compatibilityDate: string;
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
23
23
|
}[] | undefined;
|
|
24
24
|
icon?: string | undefined;
|
|
25
25
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
26
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
26
27
|
hideTitle?: boolean | undefined;
|
|
27
28
|
modal?: Readonly<{
|
|
28
29
|
title?: readonly {
|
|
@@ -71,6 +72,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
71
72
|
}>[];
|
|
72
73
|
icon?: string | undefined;
|
|
73
74
|
}>)[];
|
|
75
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
76
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
74
77
|
}>[];
|
|
75
78
|
kind: string;
|
|
76
79
|
compatibilityDate: string;
|
|
@@ -94,6 +97,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
94
97
|
}[] | undefined;
|
|
95
98
|
icon?: string | undefined;
|
|
96
99
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
100
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
97
101
|
hideTitle?: boolean | undefined;
|
|
98
102
|
modal?: Readonly<{
|
|
99
103
|
title?: readonly {
|
|
@@ -142,6 +146,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
142
146
|
}>[];
|
|
143
147
|
icon?: string | undefined;
|
|
144
148
|
}>)[];
|
|
149
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
150
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
145
151
|
}>[];
|
|
146
152
|
kind: string;
|
|
147
153
|
compatibilityDate: string;
|
|
@@ -231,6 +231,12 @@ function normalizeOptionalString(value) {
|
|
|
231
231
|
const normalized = value.trim();
|
|
232
232
|
return normalized.length > 0 ? normalized : void 0;
|
|
233
233
|
}
|
|
234
|
+
function normalizeButtonVariant(value) {
|
|
235
|
+
return value === "default" || value === "primary" || value === "destructive" || value === "ghost" ? value : void 0;
|
|
236
|
+
}
|
|
237
|
+
function normalizeButtonSize(value) {
|
|
238
|
+
return value === "default" || value === "sm" || value === "xs" ? value : void 0;
|
|
239
|
+
}
|
|
234
240
|
function getGeneralErrorKey(field) {
|
|
235
241
|
return `general.${field}`;
|
|
236
242
|
}
|
|
@@ -394,6 +400,9 @@ function updateSelectedIcon(value) {
|
|
|
394
400
|
if (item.variant) {
|
|
395
401
|
nextItem2.variant = item.variant;
|
|
396
402
|
}
|
|
403
|
+
if (item.size) {
|
|
404
|
+
nextItem2.size = item.size;
|
|
405
|
+
}
|
|
397
406
|
if (item.hideTitle) {
|
|
398
407
|
nextItem2.hideTitle = item.hideTitle;
|
|
399
408
|
}
|
|
@@ -427,7 +436,52 @@ function updateSelectedVariant(value) {
|
|
|
427
436
|
}
|
|
428
437
|
return {
|
|
429
438
|
...item,
|
|
430
|
-
variant: value
|
|
439
|
+
variant: normalizeButtonVariant(value)
|
|
440
|
+
};
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
function updateSelectedButtonSize(value) {
|
|
444
|
+
const node = selectedNode.value;
|
|
445
|
+
if (!node || node.item.type !== "button" || typeof value !== "string") {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
draftTree.value = updateButtonConfiguratorNode(draftTree.value, node.itemId, (item) => {
|
|
449
|
+
if (item.type !== "button") {
|
|
450
|
+
return item;
|
|
451
|
+
}
|
|
452
|
+
return {
|
|
453
|
+
...item,
|
|
454
|
+
size: normalizeButtonSize(value)
|
|
455
|
+
};
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
function updateSelectedGroupVariant(value) {
|
|
459
|
+
const node = selectedNode.value;
|
|
460
|
+
if (!node || node.item.type !== "group" || typeof value !== "string") {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
draftTree.value = updateButtonConfiguratorNode(draftTree.value, node.itemId, (item) => {
|
|
464
|
+
if (item.type !== "group") {
|
|
465
|
+
return item;
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
...item,
|
|
469
|
+
variant: normalizeButtonVariant(value)
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function updateSelectedGroupSize(value) {
|
|
474
|
+
const node = selectedNode.value;
|
|
475
|
+
if (!node || node.item.type !== "group" || typeof value !== "string") {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
draftTree.value = updateButtonConfiguratorNode(draftTree.value, node.itemId, (item) => {
|
|
479
|
+
if (item.type !== "group") {
|
|
480
|
+
return item;
|
|
481
|
+
}
|
|
482
|
+
return {
|
|
483
|
+
...item,
|
|
484
|
+
size: normalizeButtonSize(value)
|
|
431
485
|
};
|
|
432
486
|
});
|
|
433
487
|
}
|
|
@@ -447,7 +501,8 @@ function updateSelectedHideTitle(value) {
|
|
|
447
501
|
title: item.title,
|
|
448
502
|
tooltip: item.tooltip,
|
|
449
503
|
icon: item.icon,
|
|
450
|
-
variant: item.variant
|
|
504
|
+
variant: item.variant,
|
|
505
|
+
size: item.size
|
|
451
506
|
};
|
|
452
507
|
}
|
|
453
508
|
return {
|
|
@@ -483,6 +538,21 @@ function handleSelectedVariantUpdate(value) {
|
|
|
483
538
|
updateSelectedVariant(value);
|
|
484
539
|
}
|
|
485
540
|
}
|
|
541
|
+
function handleSelectedButtonSizeUpdate(value) {
|
|
542
|
+
if (typeof value === "string") {
|
|
543
|
+
updateSelectedButtonSize(value);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function handleSelectedGroupVariantUpdate(value) {
|
|
547
|
+
if (typeof value === "string") {
|
|
548
|
+
updateSelectedGroupVariant(value);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function handleSelectedGroupSizeUpdate(value) {
|
|
552
|
+
if (typeof value === "string") {
|
|
553
|
+
updateSelectedGroupSize(value);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
486
556
|
function handleSelectedButtonParentUpdate(value) {
|
|
487
557
|
if (typeof value === "string") {
|
|
488
558
|
moveSelectedButtonParent(value);
|
|
@@ -984,7 +1054,54 @@ function confirmChanges() {
|
|
|
984
1054
|
v-else-if="selectedGroup"
|
|
985
1055
|
data-slot="button-configurator-group"
|
|
986
1056
|
class="mt-6 grid gap-4"
|
|
987
|
-
|
|
1057
|
+
>
|
|
1058
|
+
<label class="flex flex-col gap-2">
|
|
1059
|
+
<span class="text-xs font-medium text-zinc-500">{{ t("group-variant") }}</span>
|
|
1060
|
+
<NativeSelect
|
|
1061
|
+
data-slot="button-configurator-group-variant"
|
|
1062
|
+
:model-value="selectedGroup.variant ?? ''"
|
|
1063
|
+
@update:model-value="handleSelectedGroupVariantUpdate"
|
|
1064
|
+
>
|
|
1065
|
+
<NativeSelectOption value="">
|
|
1066
|
+
{{ t("group-default-unset") }}
|
|
1067
|
+
</NativeSelectOption>
|
|
1068
|
+
<NativeSelectOption value="default">
|
|
1069
|
+
{{ t("button-variant-default-option") }}
|
|
1070
|
+
</NativeSelectOption>
|
|
1071
|
+
<NativeSelectOption value="primary">
|
|
1072
|
+
{{ t("button-variant-primary") }}
|
|
1073
|
+
</NativeSelectOption>
|
|
1074
|
+
<NativeSelectOption value="destructive">
|
|
1075
|
+
{{ t("button-variant-destructive") }}
|
|
1076
|
+
</NativeSelectOption>
|
|
1077
|
+
<NativeSelectOption value="ghost">
|
|
1078
|
+
{{ t("button-variant-ghost") }}
|
|
1079
|
+
</NativeSelectOption>
|
|
1080
|
+
</NativeSelect>
|
|
1081
|
+
</label>
|
|
1082
|
+
|
|
1083
|
+
<label class="flex flex-col gap-2">
|
|
1084
|
+
<span class="text-xs font-medium text-zinc-500">{{ t("button-size") }}</span>
|
|
1085
|
+
<NativeSelect
|
|
1086
|
+
data-slot="button-configurator-group-size"
|
|
1087
|
+
:model-value="selectedGroup.size ?? ''"
|
|
1088
|
+
@update:model-value="handleSelectedGroupSizeUpdate"
|
|
1089
|
+
>
|
|
1090
|
+
<NativeSelectOption value="">
|
|
1091
|
+
{{ t("group-size-unset") }}
|
|
1092
|
+
</NativeSelectOption>
|
|
1093
|
+
<NativeSelectOption value="default">
|
|
1094
|
+
{{ t("button-size-default") }}
|
|
1095
|
+
</NativeSelectOption>
|
|
1096
|
+
<NativeSelectOption value="sm">
|
|
1097
|
+
{{ t("button-size-sm") }}
|
|
1098
|
+
</NativeSelectOption>
|
|
1099
|
+
<NativeSelectOption value="xs">
|
|
1100
|
+
{{ t("button-size-xs") }}
|
|
1101
|
+
</NativeSelectOption>
|
|
1102
|
+
</NativeSelect>
|
|
1103
|
+
</label>
|
|
1104
|
+
</section>
|
|
988
1105
|
|
|
989
1106
|
<section
|
|
990
1107
|
v-else-if="selectedButton"
|
|
@@ -1030,7 +1147,10 @@ function confirmChanges() {
|
|
|
1030
1147
|
/>
|
|
1031
1148
|
</label>
|
|
1032
1149
|
|
|
1033
|
-
<label
|
|
1150
|
+
<label
|
|
1151
|
+
v-if="selectedButtonIsInGroup"
|
|
1152
|
+
class="flex flex-col gap-2"
|
|
1153
|
+
>
|
|
1034
1154
|
<span class="text-xs font-medium text-zinc-500">{{ t("button-variant") }}</span>
|
|
1035
1155
|
<NativeSelect
|
|
1036
1156
|
data-slot="button-configurator-button-variant"
|
|
@@ -1038,7 +1158,7 @@ function confirmChanges() {
|
|
|
1038
1158
|
@update:model-value="handleSelectedVariantUpdate"
|
|
1039
1159
|
>
|
|
1040
1160
|
<NativeSelectOption value="">
|
|
1041
|
-
{{ t("button-variant-
|
|
1161
|
+
{{ t("button-variant-inherit-group") }}
|
|
1042
1162
|
</NativeSelectOption>
|
|
1043
1163
|
<NativeSelectOption value="default">
|
|
1044
1164
|
{{ t("button-variant-default-option") }}
|
|
@@ -1055,6 +1175,31 @@ function confirmChanges() {
|
|
|
1055
1175
|
</NativeSelect>
|
|
1056
1176
|
</label>
|
|
1057
1177
|
|
|
1178
|
+
<label
|
|
1179
|
+
v-if="selectedButtonIsInGroup"
|
|
1180
|
+
class="flex flex-col gap-2"
|
|
1181
|
+
>
|
|
1182
|
+
<span class="text-xs font-medium text-zinc-500">{{ t("button-size") }}</span>
|
|
1183
|
+
<NativeSelect
|
|
1184
|
+
data-slot="button-configurator-button-size"
|
|
1185
|
+
:model-value="selectedButton.size ?? ''"
|
|
1186
|
+
@update:model-value="handleSelectedButtonSizeUpdate"
|
|
1187
|
+
>
|
|
1188
|
+
<NativeSelectOption value="">
|
|
1189
|
+
{{ t("button-size-inherit-group") }}
|
|
1190
|
+
</NativeSelectOption>
|
|
1191
|
+
<NativeSelectOption value="default">
|
|
1192
|
+
{{ t("button-size-default") }}
|
|
1193
|
+
</NativeSelectOption>
|
|
1194
|
+
<NativeSelectOption value="sm">
|
|
1195
|
+
{{ t("button-size-sm") }}
|
|
1196
|
+
</NativeSelectOption>
|
|
1197
|
+
<NativeSelectOption value="xs">
|
|
1198
|
+
{{ t("button-size-xs") }}
|
|
1199
|
+
</NativeSelectOption>
|
|
1200
|
+
</NativeSelect>
|
|
1201
|
+
</label>
|
|
1202
|
+
|
|
1058
1203
|
<label class="flex flex-col gap-2">
|
|
1059
1204
|
<span class="text-xs font-medium text-zinc-500">{{ t("button-parent") }}</span>
|
|
1060
1205
|
<NativeSelect
|
|
@@ -1271,6 +1416,9 @@ function confirmChanges() {
|
|
|
1271
1416
|
"add-button": "新增按钮",
|
|
1272
1417
|
"add-dropdown": "新增下拉按钮",
|
|
1273
1418
|
"group-gap": "按钮组间距",
|
|
1419
|
+
"group-variant": "按钮组默认变体",
|
|
1420
|
+
"group-default-unset": "未设置(使用组件默认)",
|
|
1421
|
+
"group-size-unset": "未设置(使用组件默认大小)",
|
|
1274
1422
|
"general-style": "通用样式表达式",
|
|
1275
1423
|
"general-style-placeholder": "例如返回一个 style map,例如 display: flex",
|
|
1276
1424
|
"general-style-invalid": "样式表达式无效",
|
|
@@ -1284,10 +1432,16 @@ function confirmChanges() {
|
|
|
1284
1432
|
"button-icon": "按钮图标",
|
|
1285
1433
|
"button-variant": "按钮变体",
|
|
1286
1434
|
"button-variant-default": "默认",
|
|
1435
|
+
"button-variant-inherit-group": "继承按钮组默认",
|
|
1287
1436
|
"button-variant-default-option": "默认按钮",
|
|
1288
1437
|
"button-variant-primary": "主按钮",
|
|
1289
1438
|
"button-variant-destructive": "危险按钮",
|
|
1290
1439
|
"button-variant-ghost": "幽灵按钮",
|
|
1440
|
+
"button-size": "按钮大小",
|
|
1441
|
+
"button-size-inherit-group": "继承按钮组默认大小",
|
|
1442
|
+
"button-size-default": "默认",
|
|
1443
|
+
"button-size-sm": "小",
|
|
1444
|
+
"button-size-xs": "超小",
|
|
1291
1445
|
"button-parent": "所属容器",
|
|
1292
1446
|
"button-hide-title": "隐藏文字,仅显示图标",
|
|
1293
1447
|
"dropdown-title": "下拉名称",
|
|
@@ -1328,6 +1482,9 @@ function confirmChanges() {
|
|
|
1328
1482
|
"add-button": "Add button",
|
|
1329
1483
|
"add-dropdown": "Add dropdown",
|
|
1330
1484
|
"group-gap": "Group gap",
|
|
1485
|
+
"group-variant": "Group default variant",
|
|
1486
|
+
"group-default-unset": "Unset (use component default)",
|
|
1487
|
+
"group-size-unset": "Unset (use component default size)",
|
|
1331
1488
|
"general-style": "Shared style expression",
|
|
1332
1489
|
"general-style-placeholder": "Return a style map, for example display: flex",
|
|
1333
1490
|
"general-style-invalid": "The style expression is invalid",
|
|
@@ -1341,10 +1498,16 @@ function confirmChanges() {
|
|
|
1341
1498
|
"button-icon": "Button icon",
|
|
1342
1499
|
"button-variant": "Button variant",
|
|
1343
1500
|
"button-variant-default": "Default",
|
|
1501
|
+
"button-variant-inherit-group": "Inherit group default",
|
|
1344
1502
|
"button-variant-default-option": "Default",
|
|
1345
1503
|
"button-variant-primary": "Primary",
|
|
1346
1504
|
"button-variant-destructive": "Destructive",
|
|
1347
1505
|
"button-variant-ghost": "Ghost",
|
|
1506
|
+
"button-size": "Button size",
|
|
1507
|
+
"button-size-inherit-group": "Inherit group default size",
|
|
1508
|
+
"button-size-default": "Default",
|
|
1509
|
+
"button-size-sm": "Small",
|
|
1510
|
+
"button-size-xs": "Extra small",
|
|
1348
1511
|
"button-parent": "Parent container",
|
|
1349
1512
|
"button-hide-title": "Hide text and show icon only",
|
|
1350
1513
|
"dropdown-title": "Dropdown title",
|
|
@@ -1385,6 +1548,9 @@ function confirmChanges() {
|
|
|
1385
1548
|
"add-button": "ボタンを追加",
|
|
1386
1549
|
"add-dropdown": "ドロップダウンを追加",
|
|
1387
1550
|
"group-gap": "グループ間隔",
|
|
1551
|
+
"group-variant": "グループの既定バリアント",
|
|
1552
|
+
"group-default-unset": "未設定(コンポーネント既定)",
|
|
1553
|
+
"group-size-unset": "未設定(コンポーネント既定サイズ)",
|
|
1388
1554
|
"general-style": "共通スタイル式",
|
|
1389
1555
|
"general-style-placeholder": "例: style map を返す式。例: display: flex",
|
|
1390
1556
|
"general-style-invalid": "スタイル式が無効です",
|
|
@@ -1398,10 +1564,16 @@ function confirmChanges() {
|
|
|
1398
1564
|
"button-icon": "ボタンアイコン",
|
|
1399
1565
|
"button-variant": "ボタンバリアント",
|
|
1400
1566
|
"button-variant-default": "デフォルト",
|
|
1567
|
+
"button-variant-inherit-group": "グループ既定を継承",
|
|
1401
1568
|
"button-variant-default-option": "通常",
|
|
1402
1569
|
"button-variant-primary": "プライマリ",
|
|
1403
1570
|
"button-variant-destructive": "危険",
|
|
1404
1571
|
"button-variant-ghost": "ゴースト",
|
|
1572
|
+
"button-size": "ボタンサイズ",
|
|
1573
|
+
"button-size-inherit-group": "グループ既定サイズを継承",
|
|
1574
|
+
"button-size-default": "標準",
|
|
1575
|
+
"button-size-sm": "小",
|
|
1576
|
+
"button-size-xs": "極小",
|
|
1405
1577
|
"button-parent": "親コンテナ",
|
|
1406
1578
|
"button-hide-title": "テキストを隠してアイコンのみ表示",
|
|
1407
1579
|
"dropdown-title": "ドロップダウン名",
|
|
@@ -1442,6 +1614,9 @@ function confirmChanges() {
|
|
|
1442
1614
|
"add-button": "버튼 추가",
|
|
1443
1615
|
"add-dropdown": "드롭다운 추가",
|
|
1444
1616
|
"group-gap": "그룹 간격",
|
|
1617
|
+
"group-variant": "그룹 기본 변형",
|
|
1618
|
+
"group-default-unset": "미설정 (컴포넌트 기본값 사용)",
|
|
1619
|
+
"group-size-unset": "미설정 (컴포넌트 기본 크기 사용)",
|
|
1445
1620
|
"general-style": "공통 스타일 식",
|
|
1446
1621
|
"general-style-placeholder": "예: style map 을 반환하는 식. 예: display: flex",
|
|
1447
1622
|
"general-style-invalid": "스타일 식이 올바르지 않습니다",
|
|
@@ -1455,10 +1630,16 @@ function confirmChanges() {
|
|
|
1455
1630
|
"button-icon": "버튼 아이콘",
|
|
1456
1631
|
"button-variant": "버튼 변형",
|
|
1457
1632
|
"button-variant-default": "기본값",
|
|
1633
|
+
"button-variant-inherit-group": "그룹 기본값 상속",
|
|
1458
1634
|
"button-variant-default-option": "기본",
|
|
1459
1635
|
"button-variant-primary": "주 버튼",
|
|
1460
1636
|
"button-variant-destructive": "위험",
|
|
1461
1637
|
"button-variant-ghost": "고스트",
|
|
1638
|
+
"button-size": "버튼 크기",
|
|
1639
|
+
"button-size-inherit-group": "그룹 기본 크기 상속",
|
|
1640
|
+
"button-size-default": "기본",
|
|
1641
|
+
"button-size-sm": "작게",
|
|
1642
|
+
"button-size-xs": "매우 작게",
|
|
1462
1643
|
"button-parent": "부모 컨테이너",
|
|
1463
1644
|
"button-hide-title": "텍스트를 숨기고 아이콘만 표시",
|
|
1464
1645
|
"dropdown-title": "드롭다운 이름",
|
|
@@ -23,6 +23,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
23
23
|
}[] | undefined;
|
|
24
24
|
icon?: string | undefined;
|
|
25
25
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
26
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
26
27
|
hideTitle?: boolean | undefined;
|
|
27
28
|
modal?: Readonly<{
|
|
28
29
|
title?: readonly {
|
|
@@ -71,6 +72,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
71
72
|
}>[];
|
|
72
73
|
icon?: string | undefined;
|
|
73
74
|
}>)[];
|
|
75
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
76
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
74
77
|
}>[];
|
|
75
78
|
kind: string;
|
|
76
79
|
compatibilityDate: string;
|
|
@@ -94,6 +97,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
94
97
|
}[] | undefined;
|
|
95
98
|
icon?: string | undefined;
|
|
96
99
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
100
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
97
101
|
hideTitle?: boolean | undefined;
|
|
98
102
|
modal?: Readonly<{
|
|
99
103
|
title?: readonly {
|
|
@@ -142,6 +146,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
142
146
|
}>[];
|
|
143
147
|
icon?: string | undefined;
|
|
144
148
|
}>)[];
|
|
149
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
150
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
145
151
|
}>[];
|
|
146
152
|
kind: string;
|
|
147
153
|
compatibilityDate: string;
|
|
@@ -3,6 +3,8 @@ import type { ButtonAction, ButtonDropdown, ButtonGroup } from '../buttons/schem
|
|
|
3
3
|
export type ButtonConfiguratorDraftNodeData = Readonly<{
|
|
4
4
|
type: 'group';
|
|
5
5
|
id: string;
|
|
6
|
+
variant?: ButtonGroup['variant'];
|
|
7
|
+
size?: ButtonGroup['size'];
|
|
6
8
|
}> | Readonly<{
|
|
7
9
|
type: 'button';
|
|
8
10
|
id: string;
|
|
@@ -10,6 +12,7 @@ export type ButtonConfiguratorDraftNodeData = Readonly<{
|
|
|
10
12
|
tooltip?: LocaleValue;
|
|
11
13
|
icon?: string;
|
|
12
14
|
variant?: ButtonAction['variant'];
|
|
15
|
+
size?: ButtonAction['size'];
|
|
13
16
|
hideTitle?: boolean;
|
|
14
17
|
}> | Readonly<{
|
|
15
18
|
type: 'dropdown';
|
|
@@ -50,6 +50,9 @@ function stripButton(button) {
|
|
|
50
50
|
if (button.variant) {
|
|
51
51
|
nextItem.variant = button.variant;
|
|
52
52
|
}
|
|
53
|
+
if (button.size) {
|
|
54
|
+
nextItem.size = button.size;
|
|
55
|
+
}
|
|
53
56
|
if (button.hideTitle) {
|
|
54
57
|
nextItem.hideTitle = button.hideTitle;
|
|
55
58
|
}
|
|
@@ -67,10 +70,17 @@ function stripDropdown(dropdown) {
|
|
|
67
70
|
return nextItem;
|
|
68
71
|
}
|
|
69
72
|
function stripGroup(group) {
|
|
70
|
-
|
|
73
|
+
const nextItem = {
|
|
71
74
|
type: "group",
|
|
72
75
|
id: group.id
|
|
73
76
|
};
|
|
77
|
+
if (group.variant) {
|
|
78
|
+
nextItem.variant = group.variant;
|
|
79
|
+
}
|
|
80
|
+
if (group.size) {
|
|
81
|
+
nextItem.size = group.size;
|
|
82
|
+
}
|
|
83
|
+
return nextItem;
|
|
74
84
|
}
|
|
75
85
|
export function createButtonConfiguratorGroupNode(group, createItemId) {
|
|
76
86
|
return {
|
|
@@ -309,12 +319,19 @@ export function materializeButtonConfiguratorTree(tree) {
|
|
|
309
319
|
if (node.item.variant === "default" || node.item.variant === "primary" || node.item.variant === "destructive" || node.item.variant === "ghost") {
|
|
310
320
|
nextButton.variant = node.item.variant;
|
|
311
321
|
}
|
|
322
|
+
if (node.item.size === "default" || node.item.size === "sm" || node.item.size === "xs") {
|
|
323
|
+
nextButton.size = node.item.size;
|
|
324
|
+
}
|
|
312
325
|
if (node.item.tooltip) {
|
|
313
326
|
nextButton.tooltip = node.item.tooltip;
|
|
314
327
|
}
|
|
315
328
|
const parentNode = node.parentItemId ? getButtonConfiguratorNode(tree, node.parentItemId) : void 0;
|
|
316
|
-
if (parentNode?.item.type === "group"
|
|
317
|
-
|
|
329
|
+
if (parentNode?.item.type === "group") {
|
|
330
|
+
if (node.item.hideTitle) {
|
|
331
|
+
nextButton.hideTitle = node.item.hideTitle;
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
delete nextButton.size;
|
|
318
335
|
}
|
|
319
336
|
return nextButton;
|
|
320
337
|
}
|
|
@@ -360,13 +377,20 @@ export function materializeButtonConfiguratorTree(tree) {
|
|
|
360
377
|
if (!node || node.item.type !== "group") {
|
|
361
378
|
return void 0;
|
|
362
379
|
}
|
|
363
|
-
|
|
380
|
+
const nextGroup = {
|
|
364
381
|
id: node.item.id,
|
|
365
382
|
items: node.childItemIds.flatMap((childItemId) => {
|
|
366
383
|
const item = visitGroupItem(childItemId);
|
|
367
384
|
return item ? [item] : [];
|
|
368
385
|
})
|
|
369
386
|
};
|
|
387
|
+
if (node.item.variant === "default" || node.item.variant === "primary" || node.item.variant === "destructive" || node.item.variant === "ghost") {
|
|
388
|
+
nextGroup.variant = node.item.variant;
|
|
389
|
+
}
|
|
390
|
+
if (node.item.size === "default" || node.item.size === "sm" || node.item.size === "xs") {
|
|
391
|
+
nextGroup.size = node.item.size;
|
|
392
|
+
}
|
|
393
|
+
return nextGroup;
|
|
370
394
|
}
|
|
371
395
|
return tree.rootItemIds.flatMap((itemId) => {
|
|
372
396
|
const group = visitGroup(itemId);
|
|
@@ -4,7 +4,7 @@ import { type ButtonConfigInput } from './schema.js';
|
|
|
4
4
|
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC } from './schema.js';
|
|
5
5
|
export { ButtonBodyC, ButtonBodyInputC, CURRENT_COMPATIBILITY_DATE, KIND, SUPPORTED_COMPATIBILITY_DATES, createButtonConfig, } from './schema.js';
|
|
6
6
|
export { ButtonActionService, currentButtonAction } from '../../../composables/useButtonAction.js';
|
|
7
|
-
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, } from './schema.js';
|
|
7
|
+
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, ButtonSize, ButtonVariant, } from './schema.js';
|
|
8
8
|
export type { ButtonActionEffect, ButtonActionEffectFactory, ButtonActionRuntime } from '../../../composables/useButtonAction.js';
|
|
9
9
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -26,6 +26,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
26
26
|
}[] | undefined;
|
|
27
27
|
icon?: string | undefined;
|
|
28
28
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
29
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
29
30
|
hideTitle?: boolean | undefined;
|
|
30
31
|
modal?: Readonly<{
|
|
31
32
|
title?: readonly {
|
|
@@ -74,6 +75,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
74
75
|
}>[];
|
|
75
76
|
icon?: string | undefined;
|
|
76
77
|
}>)[];
|
|
78
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
79
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
77
80
|
}>[];
|
|
78
81
|
kind: string;
|
|
79
82
|
compatibilityDate: string;
|
|
@@ -98,6 +101,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
98
101
|
}[] | undefined;
|
|
99
102
|
icon?: string | undefined;
|
|
100
103
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
104
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
101
105
|
hideTitle?: boolean | undefined;
|
|
102
106
|
modal?: Readonly<{
|
|
103
107
|
title?: readonly {
|
|
@@ -146,6 +150,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
146
150
|
}>[];
|
|
147
151
|
icon?: string | undefined;
|
|
148
152
|
}>)[];
|
|
153
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
154
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
149
155
|
}>[];
|
|
150
156
|
kind: string;
|
|
151
157
|
compatibilityDate: string;
|
|
@@ -245,16 +245,28 @@ function handleConfiguratorConfirm(nextConfig) {
|
|
|
245
245
|
function isDropdownItem(item) {
|
|
246
246
|
return "items" in item;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function getResolvedButtonVariant(group, button) {
|
|
249
|
+
return button.variant ?? group.variant ?? "default";
|
|
250
|
+
}
|
|
251
|
+
function getResolvedButtonSize(group, button) {
|
|
252
|
+
return button.size ?? group.size ?? "default";
|
|
253
|
+
}
|
|
254
|
+
function getResolvedDropdownVariant(group) {
|
|
255
|
+
return group.variant ?? "default";
|
|
256
|
+
}
|
|
257
|
+
function getResolvedDropdownSize(group) {
|
|
258
|
+
return group.size ?? "default";
|
|
259
|
+
}
|
|
260
|
+
function hasLeadingPrimaryGap(group, itemIndex) {
|
|
249
261
|
if (itemIndex === 0) {
|
|
250
262
|
return false;
|
|
251
263
|
}
|
|
252
|
-
const item = items[itemIndex];
|
|
253
|
-
const previousItem = items[itemIndex - 1];
|
|
264
|
+
const item = group.items[itemIndex];
|
|
265
|
+
const previousItem = group.items[itemIndex - 1];
|
|
254
266
|
if (!item || !previousItem || isDropdownItem(item) || isDropdownItem(previousItem)) {
|
|
255
267
|
return false;
|
|
256
268
|
}
|
|
257
|
-
return item
|
|
269
|
+
return getResolvedButtonVariant(group, item) === "primary" && getResolvedButtonVariant(group, previousItem) === "primary";
|
|
258
270
|
}
|
|
259
271
|
</script>
|
|
260
272
|
|
|
@@ -316,9 +328,10 @@ export { ButtonActionService, currentButtonAction } from "../../../composables/u
|
|
|
316
328
|
<Button
|
|
317
329
|
v-if="!isDropdownItem(item) && !hasButtonTooltip(item)"
|
|
318
330
|
data-slot="buttons-item"
|
|
319
|
-
:variant="item
|
|
331
|
+
:variant="getResolvedButtonVariant(group, item)"
|
|
332
|
+
:size="getResolvedButtonSize(group, item)"
|
|
320
333
|
:disabled="isButtonDisabled(item.id)"
|
|
321
|
-
:class="hasLeadingPrimaryGap(group
|
|
334
|
+
:class="hasLeadingPrimaryGap(group, itemIndex) ? 'ml-px' : void 0"
|
|
322
335
|
:title="item.hideTitle ? getButtonLabel(item) : void 0"
|
|
323
336
|
@click="void runButton(item.id)"
|
|
324
337
|
>
|
|
@@ -340,9 +353,10 @@ export { ButtonActionService, currentButtonAction } from "../../../composables/u
|
|
|
340
353
|
<TooltipTrigger as-child>
|
|
341
354
|
<Button
|
|
342
355
|
data-slot="buttons-item"
|
|
343
|
-
:variant="item
|
|
356
|
+
:variant="getResolvedButtonVariant(group, item)"
|
|
357
|
+
:size="getResolvedButtonSize(group, item)"
|
|
344
358
|
:disabled="isButtonDisabled(item.id)"
|
|
345
|
-
:class="hasLeadingPrimaryGap(group
|
|
359
|
+
:class="hasLeadingPrimaryGap(group, itemIndex) ? 'ml-px' : void 0"
|
|
346
360
|
:title="item.hideTitle ? getButtonLabel(item) : void 0"
|
|
347
361
|
@click="void runButton(item.id)"
|
|
348
362
|
>
|
|
@@ -370,6 +384,8 @@ export { ButtonActionService, currentButtonAction } from "../../../composables/u
|
|
|
370
384
|
<DropdownMenuTrigger as-child>
|
|
371
385
|
<Button
|
|
372
386
|
data-slot="buttons-dropdown-trigger"
|
|
387
|
+
:variant="getResolvedDropdownVariant(group)"
|
|
388
|
+
:size="getResolvedDropdownSize(group)"
|
|
373
389
|
:disabled="isDropdownPending(item)"
|
|
374
390
|
>
|
|
375
391
|
<Icon
|
|
@@ -4,7 +4,7 @@ import { type ButtonConfigInput } from './schema.js';
|
|
|
4
4
|
export { ButtonActionC, ButtonConfigC, ButtonConfigInputC, ButtonDropdownC, ButtonGroupC, ButtonModalC, ButtonsStyleC } from './schema.js';
|
|
5
5
|
export { ButtonBodyC, ButtonBodyInputC, CURRENT_COMPATIBILITY_DATE, KIND, SUPPORTED_COMPATIBILITY_DATES, createButtonConfig, } from './schema.js';
|
|
6
6
|
export { ButtonActionService, currentButtonAction } from '../../../composables/useButtonAction.js';
|
|
7
|
-
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, } from './schema.js';
|
|
7
|
+
export type { ButtonAction, ButtonBody, ButtonBodyInput, ButtonConfig, ButtonConfigInput, ButtonDropdown, ButtonDropdownAction, ButtonGroup, ButtonGroupItem, ButtonModal, ButtonSize, ButtonVariant, } from './schema.js';
|
|
8
8
|
export type { ButtonActionEffect, ButtonActionEffectFactory, ButtonActionRuntime } from '../../../composables/useButtonAction.js';
|
|
9
9
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -26,6 +26,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
26
26
|
}[] | undefined;
|
|
27
27
|
icon?: string | undefined;
|
|
28
28
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
29
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
29
30
|
hideTitle?: boolean | undefined;
|
|
30
31
|
modal?: Readonly<{
|
|
31
32
|
title?: readonly {
|
|
@@ -74,6 +75,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
74
75
|
}>[];
|
|
75
76
|
icon?: string | undefined;
|
|
76
77
|
}>)[];
|
|
78
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
79
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
77
80
|
}>[];
|
|
78
81
|
kind: string;
|
|
79
82
|
compatibilityDate: string;
|
|
@@ -98,6 +101,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
98
101
|
}[] | undefined;
|
|
99
102
|
icon?: string | undefined;
|
|
100
103
|
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
104
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
101
105
|
hideTitle?: boolean | undefined;
|
|
102
106
|
modal?: Readonly<{
|
|
103
107
|
title?: readonly {
|
|
@@ -146,6 +150,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
146
150
|
}>[];
|
|
147
151
|
icon?: string | undefined;
|
|
148
152
|
}>)[];
|
|
153
|
+
variant?: "default" | "destructive" | "primary" | "ghost" | undefined;
|
|
154
|
+
size?: "default" | "sm" | "xs" | undefined;
|
|
149
155
|
}>[];
|
|
150
156
|
kind: string;
|
|
151
157
|
compatibilityDate: string;
|
|
@@ -54,6 +54,11 @@ export declare const ButtonActionC: z.ZodReadonly<z.ZodObject<{
|
|
|
54
54
|
primary: "primary";
|
|
55
55
|
ghost: "ghost";
|
|
56
56
|
}>>;
|
|
57
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
default: "default";
|
|
59
|
+
sm: "sm";
|
|
60
|
+
xs: "xs";
|
|
61
|
+
}>>;
|
|
57
62
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
58
63
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
59
64
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -221,6 +226,11 @@ export declare const ButtonGroupItemC: z.ZodUnion<readonly [z.ZodReadonly<z.ZodO
|
|
|
221
226
|
primary: "primary";
|
|
222
227
|
ghost: "ghost";
|
|
223
228
|
}>>;
|
|
229
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
default: "default";
|
|
231
|
+
sm: "sm";
|
|
232
|
+
xs: "xs";
|
|
233
|
+
}>>;
|
|
224
234
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
225
235
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
226
236
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -311,6 +321,17 @@ export declare const ButtonGroupItemC: z.ZodUnion<readonly [z.ZodReadonly<z.ZodO
|
|
|
311
321
|
}, z.core.$strict>>]>;
|
|
312
322
|
export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
|
|
313
323
|
id: z.ZodUUID;
|
|
324
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
325
|
+
default: "default";
|
|
326
|
+
destructive: "destructive";
|
|
327
|
+
primary: "primary";
|
|
328
|
+
ghost: "ghost";
|
|
329
|
+
}>>;
|
|
330
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
331
|
+
default: "default";
|
|
332
|
+
sm: "sm";
|
|
333
|
+
xs: "xs";
|
|
334
|
+
}>>;
|
|
314
335
|
items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
315
336
|
id: z.ZodUUID;
|
|
316
337
|
title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -338,6 +359,11 @@ export declare const ButtonGroupC: z.ZodReadonly<z.ZodObject<{
|
|
|
338
359
|
primary: "primary";
|
|
339
360
|
ghost: "ghost";
|
|
340
361
|
}>>;
|
|
362
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
363
|
+
default: "default";
|
|
364
|
+
sm: "sm";
|
|
365
|
+
xs: "xs";
|
|
366
|
+
}>>;
|
|
341
367
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
342
368
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
343
369
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -432,6 +458,17 @@ export declare const ButtonBodyC: z.ZodReadonly<z.ZodObject<{
|
|
|
432
458
|
style: z.ZodOptional<z.ZodString>;
|
|
433
459
|
groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
434
460
|
id: z.ZodUUID;
|
|
461
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
462
|
+
default: "default";
|
|
463
|
+
destructive: "destructive";
|
|
464
|
+
primary: "primary";
|
|
465
|
+
ghost: "ghost";
|
|
466
|
+
}>>;
|
|
467
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
468
|
+
default: "default";
|
|
469
|
+
sm: "sm";
|
|
470
|
+
xs: "xs";
|
|
471
|
+
}>>;
|
|
435
472
|
items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
436
473
|
id: z.ZodUUID;
|
|
437
474
|
title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -459,6 +496,11 @@ export declare const ButtonBodyC: z.ZodReadonly<z.ZodObject<{
|
|
|
459
496
|
primary: "primary";
|
|
460
497
|
ghost: "ghost";
|
|
461
498
|
}>>;
|
|
499
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
500
|
+
default: "default";
|
|
501
|
+
sm: "sm";
|
|
502
|
+
xs: "xs";
|
|
503
|
+
}>>;
|
|
462
504
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
463
505
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
464
506
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -554,6 +596,17 @@ export declare const ButtonBodyInputC: z.ZodReadonly<z.ZodObject<{
|
|
|
554
596
|
style: z.ZodOptional<z.ZodString>;
|
|
555
597
|
groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
556
598
|
id: z.ZodUUID;
|
|
599
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
600
|
+
default: "default";
|
|
601
|
+
destructive: "destructive";
|
|
602
|
+
primary: "primary";
|
|
603
|
+
ghost: "ghost";
|
|
604
|
+
}>>;
|
|
605
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
606
|
+
default: "default";
|
|
607
|
+
sm: "sm";
|
|
608
|
+
xs: "xs";
|
|
609
|
+
}>>;
|
|
557
610
|
items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
558
611
|
id: z.ZodUUID;
|
|
559
612
|
title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -581,6 +634,11 @@ export declare const ButtonBodyInputC: z.ZodReadonly<z.ZodObject<{
|
|
|
581
634
|
primary: "primary";
|
|
582
635
|
ghost: "ghost";
|
|
583
636
|
}>>;
|
|
637
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
638
|
+
default: "default";
|
|
639
|
+
sm: "sm";
|
|
640
|
+
xs: "xs";
|
|
641
|
+
}>>;
|
|
584
642
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
585
643
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
586
644
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -676,6 +734,17 @@ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
|
|
|
676
734
|
style: z.ZodOptional<z.ZodString>;
|
|
677
735
|
groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
678
736
|
id: z.ZodUUID;
|
|
737
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
738
|
+
default: "default";
|
|
739
|
+
destructive: "destructive";
|
|
740
|
+
primary: "primary";
|
|
741
|
+
ghost: "ghost";
|
|
742
|
+
}>>;
|
|
743
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
744
|
+
default: "default";
|
|
745
|
+
sm: "sm";
|
|
746
|
+
xs: "xs";
|
|
747
|
+
}>>;
|
|
679
748
|
items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
680
749
|
id: z.ZodUUID;
|
|
681
750
|
title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -703,6 +772,11 @@ export declare const ButtonConfigC: z.ZodReadonly<z.ZodObject<{
|
|
|
703
772
|
primary: "primary";
|
|
704
773
|
ghost: "ghost";
|
|
705
774
|
}>>;
|
|
775
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
776
|
+
default: "default";
|
|
777
|
+
sm: "sm";
|
|
778
|
+
xs: "xs";
|
|
779
|
+
}>>;
|
|
706
780
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
707
781
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
708
782
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -800,6 +874,17 @@ export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
|
|
|
800
874
|
style: z.ZodOptional<z.ZodString>;
|
|
801
875
|
groups: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
802
876
|
id: z.ZodUUID;
|
|
877
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
878
|
+
default: "default";
|
|
879
|
+
destructive: "destructive";
|
|
880
|
+
primary: "primary";
|
|
881
|
+
ghost: "ghost";
|
|
882
|
+
}>>;
|
|
883
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
884
|
+
default: "default";
|
|
885
|
+
sm: "sm";
|
|
886
|
+
xs: "xs";
|
|
887
|
+
}>>;
|
|
803
888
|
items: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
804
889
|
id: z.ZodUUID;
|
|
805
890
|
title: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -827,6 +912,11 @@ export declare const ButtonConfigInputC: z.ZodReadonly<z.ZodObject<{
|
|
|
827
912
|
primary: "primary";
|
|
828
913
|
ghost: "ghost";
|
|
829
914
|
}>>;
|
|
915
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
916
|
+
default: "default";
|
|
917
|
+
sm: "sm";
|
|
918
|
+
xs: "xs";
|
|
919
|
+
}>>;
|
|
830
920
|
hideTitle: z.ZodOptional<z.ZodBoolean>;
|
|
831
921
|
modal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
832
922
|
title: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
@@ -931,4 +1021,5 @@ export type ButtonConfig = z.infer<typeof ButtonConfigC>;
|
|
|
931
1021
|
export type ButtonConfigInput = z.input<typeof ButtonConfigInputC>;
|
|
932
1022
|
export declare function createButtonConfig(body: ButtonBody): ButtonConfig;
|
|
933
1023
|
export type ButtonVariant = ButtonVariants['variant'];
|
|
1024
|
+
export type ButtonSize = ButtonVariants['size'];
|
|
934
1025
|
export {};
|
|
@@ -7,6 +7,7 @@ export const KIND = "shwfed.component.button";
|
|
|
7
7
|
export const CURRENT_COMPATIBILITY_DATE = "2026-03-20";
|
|
8
8
|
export const SUPPORTED_COMPATIBILITY_DATES = [CURRENT_COMPATIBILITY_DATE];
|
|
9
9
|
const buttonVariantC = z.enum(["default", "primary", "destructive", "ghost"]).optional().describe("\u6309\u94AE\u53D8\u4F53");
|
|
10
|
+
const buttonSizeC = z.enum(["default", "sm", "xs"]).optional().describe("\u6309\u94AE\u5927\u5C0F");
|
|
10
11
|
export const ButtonsStyleC = expressionC(/^map/).optional().describe("\u8FD4\u56DE\u6309\u94AE\u5BB9\u5668\u6837\u5F0F\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F");
|
|
11
12
|
export const ButtonModalC = z.strictObject({
|
|
12
13
|
title: localeC.optional().describe("Modal \u6807\u9898\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
|
|
@@ -21,6 +22,7 @@ export const ButtonActionC = z.strictObject({
|
|
|
21
22
|
tooltip: localeC.optional().describe("\u6309\u94AE\u63D0\u793A\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
|
|
22
23
|
icon: z.string().optional().describe("Iconify \u56FE\u6807\u6807\u8BC6\u7B26"),
|
|
23
24
|
variant: buttonVariantC,
|
|
25
|
+
size: buttonSizeC,
|
|
24
26
|
hideTitle: z.boolean().optional().describe("\u4EC5\u5BF9\u975E\u4E0B\u62C9\u6309\u94AE\u751F\u6548\uFF1B\u4E3A true \u65F6\u9690\u85CF\u6309\u94AE\u6587\u5B57\uFF0C\u4EC5\u663E\u793A\u56FE\u6807"),
|
|
25
27
|
modal: ButtonModalC.optional().describe("\u4E0E\u5F53\u524D\u6309\u94AE UUID \u540C\u540D slot \u6253\u5F00\u65F6\u4F7F\u7528\u7684\u9ED8\u8BA4 Modal \u58F3\u914D\u7F6E")
|
|
26
28
|
}).readonly();
|
|
@@ -41,6 +43,8 @@ export const ButtonDropdownC = z.strictObject({
|
|
|
41
43
|
export const ButtonGroupItemC = z.union([ButtonActionC, ButtonDropdownC]);
|
|
42
44
|
export const ButtonGroupC = z.strictObject({
|
|
43
45
|
id: buttonGroupIdC,
|
|
46
|
+
variant: buttonVariantC.describe("\u6309\u94AE\u7EC4\u5185\u9876\u5C42\u6309\u94AE\u4E0E\u4E0B\u62C9\u89E6\u53D1\u6309\u94AE\u7684\u9ED8\u8BA4\u53D8\u4F53"),
|
|
47
|
+
size: buttonSizeC.describe("\u6309\u94AE\u7EC4\u5185\u9876\u5C42\u6309\u94AE\u4E0E\u4E0B\u62C9\u89E6\u53D1\u6309\u94AE\u7684\u9ED8\u8BA4\u5927\u5C0F"),
|
|
44
48
|
items: z.array(ButtonGroupItemC).readonly().describe("\u6309\u94AE\u7EC4\u5185\u7684\u6309\u94AE\u4E0E\u4E0B\u62C9\u6309\u94AE")
|
|
45
49
|
}).readonly();
|
|
46
50
|
const ButtonBodyObjectC = z.strictObject({
|
|
@@ -57,8 +57,20 @@ export default defineNuxtPlugin({
|
|
|
57
57
|
const name = config.headers.token || "Authorization";
|
|
58
58
|
headers.set(name, sessionStorage.getItem("token") ?? "");
|
|
59
59
|
}
|
|
60
|
+
function joinBaseUrl(base, input) {
|
|
61
|
+
return `${base.replace(/\/+$/, "")}/${input.replace(/^\/+/, "")}`;
|
|
62
|
+
}
|
|
60
63
|
function createRequestUrl(input, query) {
|
|
61
|
-
const url =
|
|
64
|
+
const url = (() => {
|
|
65
|
+
try {
|
|
66
|
+
return new URL(input);
|
|
67
|
+
} catch {
|
|
68
|
+
if (config.api.host) {
|
|
69
|
+
return new URL(joinBaseUrl(config.api.host, input));
|
|
70
|
+
}
|
|
71
|
+
return new URL(input, window.location.href);
|
|
72
|
+
}
|
|
73
|
+
})();
|
|
62
74
|
if (!query) {
|
|
63
75
|
return url.toString();
|
|
64
76
|
}
|