@tfdesign/b-end 1.0.11 → 1.0.13
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 +23 -25
- package/package.json +1 -1
- package/skills/tfds/components.index.json +271 -67
- package/skills/tfds/components.summary.json +101 -62
- package/src/_b_end_runtime/components/ChatMessage.jsx +210 -61
- package/src/_b_end_runtime/components/ChatMessage.tokens.js +30 -0
- package/src/_b_end_runtime/components/ChatMessagePreview.jsx +14 -0
- package/src/_b_end_runtime/components/CustomerServiceWorkspaceFrame.jsx +30 -6
- package/src/_b_end_runtime/components/CustomerServiceWorkspaceFrame.tokens.js +5 -0
- package/src/_b_end_runtime/components/Filter.jsx +390 -0
- package/src/_b_end_runtime/components/Filter.tokens.js +98 -0
- package/src/_b_end_runtime/components/Input.jsx +3 -1
- package/src/_b_end_runtime/components/Modal.jsx +10 -3
- package/src/_b_end_runtime/components/Radio.jsx +174 -4
- package/src/_b_end_runtime/components/Radio.tokens.js +22 -0
- package/src/_b_end_runtime/components.js +124 -13
- package/src/_b_end_runtime/page-patterns/ChatHomePagePattern.jsx +35 -26
- package/src/_b_end_runtime/page-patterns/McpManagementPage.jsx +14 -1
- package/src/_b_end_runtime/page-patterns/StrategyListPage.jsx +19 -12
- package/src/_b_end_runtime/page-patterns/TabTopBarListPage.jsx +14 -1
- package/src/_b_end_runtime/page-patterns/VariableManagementPage.jsx +15 -2
- package/src/_b_end_runtime/page-patterns/pageListShared.jsx +54 -36
- package/src/_b_end_runtime/patterns.js +33 -21
- package/src/_b_end_runtime/preview-registry.jsx +180 -8
- package/src/index.d.ts +30 -1
- package/src/index.js +2 -1
|
@@ -37,6 +37,7 @@ import DatePicker from './components/DatePicker';
|
|
|
37
37
|
import TimePicker from './components/TimePicker';
|
|
38
38
|
import Toast from './components/Toast';
|
|
39
39
|
import Tag from './components/Tag';
|
|
40
|
+
import Filter from './components/Filter';
|
|
40
41
|
import TagInput from './components/TagInput';
|
|
41
42
|
import TagGridPreview from './components/TagGridPreview';
|
|
42
43
|
import TablePreview, {
|
|
@@ -77,6 +78,7 @@ import { DATEPICKER_TOKEN_MAP } from './components/DatePicker.tokens';
|
|
|
77
78
|
import { TIMEPICKER_TOKEN_MAP } from './components/TimePicker.tokens';
|
|
78
79
|
import { TOAST_TOKEN_MAP } from './components/Toast.tokens';
|
|
79
80
|
import { TAG_TOKEN_MAP } from './components/Tag.tokens';
|
|
81
|
+
import { FILTER_TOKEN_MAP } from './components/Filter.tokens';
|
|
80
82
|
import { TAGINPUT_TOKEN_MAP } from './components/TagInput.tokens';
|
|
81
83
|
import { TABLE_TOKEN_MAP } from './components/Table.tokens';
|
|
82
84
|
import { TOOLTIP_TOKEN_MAP } from './components/Tooltip.tokens';
|
|
@@ -112,6 +114,7 @@ import datePickerJsxRaw from './components/DatePicker.jsx?raw';
|
|
|
112
114
|
import timePickerJsxRaw from './components/TimePicker.jsx?raw';
|
|
113
115
|
import toastJsxRaw from './components/Toast.jsx?raw';
|
|
114
116
|
import tagJsxRaw from './components/Tag.jsx?raw';
|
|
117
|
+
import filterJsxRaw from './components/Filter.jsx?raw';
|
|
115
118
|
import tagInputJsxRaw from './components/TagInput.jsx?raw';
|
|
116
119
|
import tableJsxRaw from './components/Table.jsx?raw';
|
|
117
120
|
import tooltipJsxRaw from './components/Tooltip.jsx?raw';
|
|
@@ -136,6 +139,37 @@ function SwitchPreview({ variant = 'brand', defaultChecked, disabled }) {
|
|
|
136
139
|
);
|
|
137
140
|
}
|
|
138
141
|
|
|
142
|
+
const FILTER_SAMPLE_OPTIONS = [
|
|
143
|
+
{ label: '选项一', value: 'option-1' },
|
|
144
|
+
{ label: '选项二', value: 'option-2' },
|
|
145
|
+
{ label: '选项三', value: 'option-3' },
|
|
146
|
+
{ label: '禁用项', value: 'option-4', disabled: true },
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
function FilterPreview({
|
|
150
|
+
initial = 'empty',
|
|
151
|
+
disabled = false,
|
|
152
|
+
}) {
|
|
153
|
+
const [singleValues, setSingleValues] = useState(
|
|
154
|
+
initial === 'selected' ? ['option-1'] : [],
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
setSingleValues(initial === 'selected' ? ['option-1'] : []);
|
|
159
|
+
}, [initial]);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<Filter
|
|
163
|
+
label="筛选项"
|
|
164
|
+
options={FILTER_SAMPLE_OPTIONS}
|
|
165
|
+
selectedValues={singleValues}
|
|
166
|
+
onChange={setSingleValues}
|
|
167
|
+
disabled={disabled}
|
|
168
|
+
onClear={() => {}}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
139
173
|
const FORM_CONTROL_PREVIEW_WIDTH_STYLE = {
|
|
140
174
|
width: 'min(300px, 100%)',
|
|
141
175
|
maxWidth: '100%',
|
|
@@ -645,20 +679,22 @@ const CHATBUBBLE_PRESET_TIMESTAMPS = {
|
|
|
645
679
|
};
|
|
646
680
|
|
|
647
681
|
/** 预览用:key 保证切换初始选中 / 禁用 / 枚举时 defaultValue 生效 */
|
|
648
|
-
function RadioPreview({ variant, layout, disabled, initialKey }) {
|
|
682
|
+
function RadioPreview({ variant, styleType, layout, disabled, initialKey }) {
|
|
649
683
|
const defaultValue = initialKey === 'a' ? 'a' : initialKey === 'b' ? 'b' : undefined;
|
|
684
|
+
const isCardStyle = styleType === 'card' || styleType === 'pureCard';
|
|
650
685
|
return (
|
|
651
686
|
<FormControlPreviewWidth>
|
|
652
687
|
<RadioGroup
|
|
653
|
-
key={`rp-${variant}-${layout}-${disabled}-${initialKey}`}
|
|
688
|
+
key={`rp-${variant}-${styleType}-${layout}-${disabled}-${initialKey}`}
|
|
654
689
|
variant={variant}
|
|
690
|
+
styleType={styleType}
|
|
655
691
|
layout={layout}
|
|
656
692
|
disabled={disabled}
|
|
657
693
|
defaultValue={defaultValue}
|
|
658
694
|
>
|
|
659
|
-
<Radio value="a"
|
|
660
|
-
<Radio value="b"
|
|
661
|
-
<Radio value="c"
|
|
695
|
+
<Radio value="a">{isCardStyle ? '单选框标题' : '选项 A'}</Radio>
|
|
696
|
+
<Radio value="b">{isCardStyle ? '单选框标题' : '选项 B'}</Radio>
|
|
697
|
+
<Radio value="c">{isCardStyle ? '单选框标题' : '选项 C'}</Radio>
|
|
662
698
|
</RadioGroup>
|
|
663
699
|
</FormControlPreviewWidth>
|
|
664
700
|
);
|
|
@@ -2042,6 +2078,8 @@ export const PREVIEW_REGISTRY = {
|
|
|
2042
2078
|
options: [
|
|
2043
2079
|
{ id: 'task-plan', label: '任务规划' },
|
|
2044
2080
|
{ id: 'config-form', label: '配置表单' },
|
|
2081
|
+
{ id: 'option-card', label: '澄清确认卡片1' },
|
|
2082
|
+
{ id: 'form-card', label: '澄清确认卡片2' },
|
|
2045
2083
|
],
|
|
2046
2084
|
default: 'task-plan',
|
|
2047
2085
|
hidden: ({ controlValues }) => (controlValues.subComponent || 'execution-flow') !== 'card',
|
|
@@ -2212,6 +2250,59 @@ export const PREVIEW_REGISTRY = {
|
|
|
2212
2250
|
' timestamp="18:16"',
|
|
2213
2251
|
'/>',
|
|
2214
2252
|
],
|
|
2253
|
+
'option-card': [
|
|
2254
|
+
'<ChatMessage',
|
|
2255
|
+
' header',
|
|
2256
|
+
' title=""',
|
|
2257
|
+
' steps={null}',
|
|
2258
|
+
' confirms={[',
|
|
2259
|
+
' {',
|
|
2260
|
+
' mode: "option-card",',
|
|
2261
|
+
' title: "澄清确认",',
|
|
2262
|
+
' iconName: "clipboard-check-stroked",',
|
|
2263
|
+
' primaryActionLabel: "确认",',
|
|
2264
|
+
' defaultSelectedValue: "handoff-guide",',
|
|
2265
|
+
' options: [',
|
|
2266
|
+
' { value: "handoff-guide", label: "方案1: 用户请求转人工但系统未触发转接,持续引导自助操作" },',
|
|
2267
|
+
' { value: "handoff", label: "方案2: 用户请求转人工" },',
|
|
2268
|
+
' { value: "self-service", label: "方案3: 持续引导自助操作" },',
|
|
2269
|
+
' ],',
|
|
2270
|
+
' onPrimaryAction: ({ value, option }) => {},',
|
|
2271
|
+
' },',
|
|
2272
|
+
' ]}',
|
|
2273
|
+
' actions',
|
|
2274
|
+
' timestamp="18:16"',
|
|
2275
|
+
'/>',
|
|
2276
|
+
],
|
|
2277
|
+
'form-card': [
|
|
2278
|
+
'<ChatMessage',
|
|
2279
|
+
' header',
|
|
2280
|
+
' title=""',
|
|
2281
|
+
' steps={null}',
|
|
2282
|
+
' confirms={[',
|
|
2283
|
+
' {',
|
|
2284
|
+
' mode: "form-card",',
|
|
2285
|
+
' title: "澄清确认",',
|
|
2286
|
+
' iconName: "clipboard-check-stroked",',
|
|
2287
|
+
' primaryActionLabel: "确认",',
|
|
2288
|
+
' formItems: [',
|
|
2289
|
+
' { id: "scene", label: "业务场景", type: "select", placeholder: "请选择业务场景", defaultValue: "after-sales", options: [',
|
|
2290
|
+
' { value: "after-sales", label: "售后服务" },',
|
|
2291
|
+
' { value: "pre-sales", label: "售前咨询" },',
|
|
2292
|
+
' { value: "logistics", label: "物流配送" },',
|
|
2293
|
+
' ], fullWidth: true },',
|
|
2294
|
+
' { id: "channel", label: "处理渠道", type: "select", placeholder: "请选择处理渠道", defaultValue: "self-service", options: [',
|
|
2295
|
+
' { value: "self-service", label: "自助引导" },',
|
|
2296
|
+
' { value: "handoff", label: "转人工" },',
|
|
2297
|
+
' ], fullWidth: true },',
|
|
2298
|
+
' { id: "remark", label: "补充说明", type: "input", placeholder: "请输入补充说明(可选)", fullWidth: true },',
|
|
2299
|
+
' ],',
|
|
2300
|
+
' },',
|
|
2301
|
+
' ]}',
|
|
2302
|
+
' actions',
|
|
2303
|
+
' timestamp="18:16"',
|
|
2304
|
+
'/>',
|
|
2305
|
+
],
|
|
2215
2306
|
},
|
|
2216
2307
|
'user-message': {
|
|
2217
2308
|
text: [
|
|
@@ -3227,6 +3318,17 @@ export const PREVIEW_REGISTRY = {
|
|
|
3227
3318
|
jsxSource: radioJsxRaw,
|
|
3228
3319
|
|
|
3229
3320
|
controls: [
|
|
3321
|
+
{
|
|
3322
|
+
id: 'styleType',
|
|
3323
|
+
label: '样式分类',
|
|
3324
|
+
type: 'seg',
|
|
3325
|
+
options: [
|
|
3326
|
+
{ id: 'basic', label: '基础样式' },
|
|
3327
|
+
{ id: 'card', label: '带圆点单选卡片' },
|
|
3328
|
+
{ id: 'pureCard', label: '单选卡片' },
|
|
3329
|
+
],
|
|
3330
|
+
default: 'basic',
|
|
3331
|
+
},
|
|
3230
3332
|
{
|
|
3231
3333
|
id: 'initialKey',
|
|
3232
3334
|
label: '初始选中',
|
|
@@ -3251,6 +3353,7 @@ export const PREVIEW_REGISTRY = {
|
|
|
3251
3353
|
],
|
|
3252
3354
|
|
|
3253
3355
|
mapProps: (cv) => ({
|
|
3356
|
+
styleType: cv.styleType || 'basic',
|
|
3254
3357
|
initialKey: cv.initialKey || 'none',
|
|
3255
3358
|
disabled: cv.state === 'disabled',
|
|
3256
3359
|
}),
|
|
@@ -3258,7 +3361,9 @@ export const PREVIEW_REGISTRY = {
|
|
|
3258
3361
|
generateUsage: (enums, cv) => {
|
|
3259
3362
|
const lines = [`import RadioGroup, { Radio } from './components/Radio';`];
|
|
3260
3363
|
const props = [];
|
|
3364
|
+
const styleType = cv.styleType || 'basic';
|
|
3261
3365
|
if (enums.variant && enums.variant !== 'brand') props.push(`variant="${enums.variant}"`);
|
|
3366
|
+
if (styleType !== 'basic') props.push(`styleType="${styleType}"`);
|
|
3262
3367
|
if (enums.layout && enums.layout !== 'vertical') props.push(`layout="${enums.layout}"`);
|
|
3263
3368
|
if (cv.initialKey === 'a') props.push('defaultValue="a"');
|
|
3264
3369
|
if (cv.initialKey === 'b') props.push('defaultValue="b"');
|
|
@@ -3268,9 +3373,15 @@ export const PREVIEW_REGISTRY = {
|
|
|
3268
3373
|
lines.push('<RadioGroup');
|
|
3269
3374
|
props.forEach((p) => lines.push(` ${p}`));
|
|
3270
3375
|
lines.push('>');
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3376
|
+
if (styleType === 'card' || styleType === 'pureCard') {
|
|
3377
|
+
lines.push(' <Radio value="a">单选框标题</Radio>');
|
|
3378
|
+
lines.push(' <Radio value="b">单选框标题</Radio>');
|
|
3379
|
+
lines.push(' <Radio value="c" disabled>单选框标题</Radio>');
|
|
3380
|
+
} else {
|
|
3381
|
+
lines.push(' <Radio value="a">选项 A</Radio>');
|
|
3382
|
+
lines.push(' <Radio value="b">选项 B</Radio>');
|
|
3383
|
+
lines.push(' <Radio value="c" disabled>选项 C(单项禁用)</Radio>');
|
|
3384
|
+
}
|
|
3274
3385
|
lines.push('</RadioGroup>');
|
|
3275
3386
|
return lines.join('\n');
|
|
3276
3387
|
},
|
|
@@ -4081,6 +4192,67 @@ export const PREVIEW_REGISTRY = {
|
|
|
4081
4192
|
},
|
|
4082
4193
|
},
|
|
4083
4194
|
|
|
4195
|
+
filter: {
|
|
4196
|
+
component: FilterPreview,
|
|
4197
|
+
tokenMap: FILTER_TOKEN_MAP,
|
|
4198
|
+
jsxSource: filterJsxRaw,
|
|
4199
|
+
|
|
4200
|
+
getPreviewAreaStyle: () => ({
|
|
4201
|
+
alignItems: 'center',
|
|
4202
|
+
justifyContent: 'center',
|
|
4203
|
+
overflow: 'auto',
|
|
4204
|
+
padding: '32px',
|
|
4205
|
+
}),
|
|
4206
|
+
|
|
4207
|
+
controls: [
|
|
4208
|
+
{
|
|
4209
|
+
id: 'initial',
|
|
4210
|
+
label: '初始值',
|
|
4211
|
+
type: 'seg',
|
|
4212
|
+
options: [
|
|
4213
|
+
{ id: 'empty', label: '空' },
|
|
4214
|
+
{ id: 'selected', label: '已选' },
|
|
4215
|
+
],
|
|
4216
|
+
default: 'empty',
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
id: 'state',
|
|
4220
|
+
label: '交互',
|
|
4221
|
+
type: 'seg',
|
|
4222
|
+
options: [
|
|
4223
|
+
{ id: 'default', label: '可点' },
|
|
4224
|
+
{ id: 'disabled', label: '禁用' },
|
|
4225
|
+
],
|
|
4226
|
+
default: 'default',
|
|
4227
|
+
},
|
|
4228
|
+
],
|
|
4229
|
+
|
|
4230
|
+
mapProps: (cv) => ({
|
|
4231
|
+
initial: cv.initial || 'empty',
|
|
4232
|
+
disabled: cv.state === 'disabled',
|
|
4233
|
+
}),
|
|
4234
|
+
|
|
4235
|
+
generateUsage: (_enums, cv) => {
|
|
4236
|
+
const lines = [`import Filter from './components/Filter';`];
|
|
4237
|
+
const props = ['label="筛选项"'];
|
|
4238
|
+
props.push('options={options}');
|
|
4239
|
+
if ((cv.initial || 'empty') === 'selected') props.push('defaultValue={["option-1"]}');
|
|
4240
|
+
if (cv.state === 'disabled') props.push('disabled');
|
|
4241
|
+
|
|
4242
|
+
lines.push('');
|
|
4243
|
+
lines.push('const options = [');
|
|
4244
|
+
lines.push(' { label: "选项一", value: "option-1" },');
|
|
4245
|
+
lines.push(' { label: "选项二", value: "option-2" },');
|
|
4246
|
+
lines.push(' { label: "选项三", value: "option-3" },');
|
|
4247
|
+
lines.push('];');
|
|
4248
|
+
lines.push('');
|
|
4249
|
+
lines.push('<Filter');
|
|
4250
|
+
props.forEach((p) => lines.push(` ${p}`));
|
|
4251
|
+
lines.push('/>');
|
|
4252
|
+
return lines.join('\n');
|
|
4253
|
+
},
|
|
4254
|
+
},
|
|
4255
|
+
|
|
4084
4256
|
'tag-input': {
|
|
4085
4257
|
component: TagInputPreview,
|
|
4086
4258
|
tokenMap: TAGINPUT_TOKEN_MAP,
|
package/src/index.d.ts
CHANGED
|
@@ -636,10 +636,12 @@ export interface SelectProps extends TfdsCommonProps {
|
|
|
636
636
|
}
|
|
637
637
|
export const Select: React.FC<SelectProps>;
|
|
638
638
|
|
|
639
|
-
/** RadioGroup —
|
|
639
|
+
/** RadioGroup — 互斥单选:同一组内只能选一个值。支持基础样式、带圆点单选卡片、单选卡片 3 类形态,适合选项少且需要平铺比较的表单场景。多选请用 CheckboxGroup;布尔即时开关请用 Switch;选项很多请用 Select。 */
|
|
640
640
|
export interface RadioGroupProps extends TfdsCommonProps {
|
|
641
641
|
/** enum<brand | black>, default: "brand" */
|
|
642
642
|
variant?: "brand" | "black";
|
|
643
|
+
/** enum<basic | card | pureCard>, default: "basic" */
|
|
644
|
+
styleType?: "basic" | "card" | "pureCard";
|
|
643
645
|
/** enum<vertical | horizontal>, default: "vertical" */
|
|
644
646
|
layout?: "vertical" | "horizontal";
|
|
645
647
|
/** boolean, default: false */
|
|
@@ -949,6 +951,33 @@ export interface TagProps extends TfdsCommonProps {
|
|
|
949
951
|
}
|
|
950
952
|
export const Tag: React.FC<TagProps>;
|
|
951
953
|
|
|
954
|
+
/** Filter — 筛选胶囊项:用于筛选栏中的单个筛选触发器或已选条件展示,36px 高、全圆角、标签 semibold + 值 regular。支持点击展开下拉面板、多选、白底常态、填充态、品牌选中态、禁用态和可清除态。 */
|
|
955
|
+
export interface FilterProps extends TfdsCommonProps {
|
|
956
|
+
/** string, default: "筛选项" */
|
|
957
|
+
label?: string;
|
|
958
|
+
/** string|number|null, default: null */
|
|
959
|
+
value?: unknown;
|
|
960
|
+
/** array, default: [] */
|
|
961
|
+
options?: unknown[];
|
|
962
|
+
/** array, default: undefined */
|
|
963
|
+
selectedValues?: unknown[];
|
|
964
|
+
/** array, default: [] */
|
|
965
|
+
defaultValue?: unknown[];
|
|
966
|
+
/** function, default: null */
|
|
967
|
+
onChange?: (...args: any[]) => any;
|
|
968
|
+
/** boolean, default: false */
|
|
969
|
+
selected?: boolean;
|
|
970
|
+
/** boolean, default: false */
|
|
971
|
+
filled?: boolean;
|
|
972
|
+
/** boolean, default: false */
|
|
973
|
+
disabled?: boolean;
|
|
974
|
+
/** boolean, default: false */
|
|
975
|
+
closable?: boolean;
|
|
976
|
+
/** function, default: null */
|
|
977
|
+
onClear?: (...args: any[]) => any;
|
|
978
|
+
}
|
|
979
|
+
export const Filter: React.FC<FilterProps>;
|
|
980
|
+
|
|
952
981
|
/** Toast — 轻量反馈条:信息/成功/警示/错误四态,左侧状态图标(相对行首额外 4px 左边距)+ 主文案 + 可选文字操作(绿色文字 Button)+ 可关闭;宽度随内容收缩(w-fit),最大不超过 min(100%,560px);圆角 12px、可选语义描边(bordered)、内距 12px、主文案 14px 半粗,行内纵向居中对齐。规范仅覆盖单条条目视觉;全局队列、停留时长与 Portal 由业务集成(对齐 HiUI Toast)。 */
|
|
953
982
|
export interface ToastProps extends TfdsCommonProps {
|
|
954
983
|
/** enum<info | success | warning | error>, default: "info" */
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @tfdesign/b-end 公开 API(由 scripts/generate-tfds-b-end-bundle.mjs 生成,勿手改)
|
|
3
3
|
* 实现位于包内 ./src/_b_end_runtime/(与主仓 src/data/systems/b-end 同步,可独立 npm 安装)
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -35,6 +35,7 @@ export { default as Modal } from './_b_end_runtime/components/Modal.jsx';
|
|
|
35
35
|
export { default as Sheet } from './_b_end_runtime/components/Sheet.jsx';
|
|
36
36
|
export { default as TagInput } from './_b_end_runtime/components/TagInput.jsx';
|
|
37
37
|
export { default as Tag } from './_b_end_runtime/components/Tag.jsx';
|
|
38
|
+
export { default as Filter } from './_b_end_runtime/components/Filter.jsx';
|
|
38
39
|
export { default as Toast } from './_b_end_runtime/components/Toast.jsx';
|
|
39
40
|
export { default as Tooltip } from './_b_end_runtime/components/Tooltip.jsx';
|
|
40
41
|
export { default as Empty } from './_b_end_runtime/components/Empty.jsx';
|