@fibrae/semi-ui-svelte 0.8.0 → 0.9.1

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.
@@ -248,6 +248,7 @@
248
248
  contentEl?.querySelector(`#${CSS.escape(optionId(key))}`)?.scrollIntoView({ block: 'nearest' });
249
249
  }
250
250
  },
251
+ getColumnRect: (index) => contentEl?.querySelectorAll(`.${cssClasses.PREFIX_OPTION}-list`)[index]?.getBoundingClientRect() ?? null,
251
252
  })
252
253
  );
253
254
 
@@ -516,8 +517,8 @@
516
517
  <span
517
518
  class={{
518
519
  [`${cls}-selection-placeholder`]: !selection,
519
- [`${cls}-selection-text-hide`]: Boolean(view.showInput && view.inputValue),
520
- [`${cls}-selection-text-inactive`]: Boolean(view.showInput && !view.inputValue),
520
+ [`${cls}-selection-text-hide`]: view.showInput && view.inputValue,
521
+ [`${cls}-selection-text-inactive`]: view.showInput && !view.inputValue,
521
522
  }}
522
523
  {id}
523
524
  >
@@ -660,13 +661,13 @@
660
661
  [`${cls}-focus`]: view.isOpen,
661
662
  [`${cls}-disabled`]: disabled,
662
663
  [`${cls}-single`]: true,
663
- [`${cls}-filterable`]: Boolean(filterTreeNode),
664
+ [`${cls}-filterable`]: filterTreeNode,
664
665
  [`${cls}-error`]: validateStatus === 'error',
665
666
  [`${cls}-warning`]: validateStatus === 'warning',
666
667
  [`${cls}-small`]: size === 'small',
667
668
  [`${cls}-large`]: size === 'large',
668
- [`${cls}-with-prefix`]: Boolean(prefix || insetLabel),
669
- [`${cls}-with-suffix`]: Boolean(suffix),
669
+ [`${cls}-with-prefix`]: prefix || insetLabel,
670
+ [`${cls}-with-suffix`]: suffix,
670
671
  },
671
672
  ]}
672
673
  tabindex={disabled || inputIsCombobox ? -1 : 0}
@@ -29,7 +29,7 @@
29
29
  })
30
30
  );
31
31
 
32
- const handleSelectFormat = (format: string | number) => {
32
+ const handleSelectFormat = (format: string | number | boolean) => {
33
33
  foundation.handleFormatChange(format as ColorFormat);
34
34
  };
35
35
  </script>
@@ -185,7 +185,7 @@
185
185
  style={props.inputStyle}
186
186
  />
187
187
  </div>
188
- <span class={[`${prefix}-range-input-separator`, { [`${prefix}-range-input-separator-active`]: Boolean(rangeParts.start || rangeParts.end) && !props.disabled }]} onclick={(event) => focusRange(event, 'rangeStart')}>
188
+ <span class={[`${prefix}-range-input-separator`, { [`${prefix}-range-input-separator-active`]: (rangeParts.start || rangeParts.end) && !props.disabled }]} onclick={(event) => focusRange(event, 'rangeStart')}>
189
189
  {#if props.rangeSeparatorNode}
190
190
  {@render props.rangeSeparatorNode()}
191
191
  {:else}
@@ -17,7 +17,7 @@
17
17
  </script>
18
18
 
19
19
  {#if rendered}
20
- <div {...rest} class={[rest.class, { [`${prefix}-field-error-message`]: failed, [`${prefix}-field-help-text`]: Boolean(helpText) }]}>
20
+ <div {...rest} class={[rest.class, { [`${prefix}-field-error-message`]: failed, [`${prefix}-field-help-text`]: helpText }]}>
21
21
  {#if showValidateIcon}
22
22
  {#if isInInputGroup || validateStatus === 'error'}
23
23
  <IconAlertCircle class={iconClass} />
@@ -31,6 +31,6 @@ import { semiRenderers } from './schema-form/semi-renderers.svelte';
31
31
  import FormSection from './section.svelte';
32
32
  import FormSlot from './slot.svelte';
33
33
  export { ArrayField, Form, FormAutoComplete, FormCascader, FormCheckbox, FormCheckboxGroup, FormDatePicker, FormErrorMessage, FormField, FormInput, FormInputGroup, FormInputNumber, FormLabel, FormPinCode, FormRadio, FormRadioGroup, FormRating, FormSection, FormSelect, FormSlider, FormSlot, FormSwitch, FormTagInput, FormTextArea, FormTimePicker, FormTransfer, FormTreeSelect, FormUpload, SchemaField, SchemaForm, semiRenderers, useForm, };
34
- export { blankRow } from '@fibrae/semi-foundation/components/form/json-schema';
34
+ export { blankRow, controlProps, singleItemName } from '@fibrae/semi-foundation/components/form/json-schema';
35
35
  export { useFieldApi, useFieldState, useFormApi, useFormState } from './hooks/index.js';
36
36
  export type { ArrayFieldItem, ArrayFieldProps, ArrayFieldSnippetProps, CommonFieldProps, ErrorMessageProps as FormErrorMessageProps, FieldError, FieldErrorInput, FieldLabel, FieldProps, FieldValidateTriggerType, FieldValidator, FormApi, FormFieldProps, FormProps, FormRenderProps, FormState, FormValidator, InputGroupProps as FormInputGroupProps, JsonSchema, LabelProps as FormLabelProps, OptionalFieldProps, RuleItem, RuleType, SchemaArrayContext, SchemaArrayItem, SchemaFieldContext, SchemaFieldKind, SchemaFieldNode, SchemaFieldProps, SchemaFieldRenderers, SchemaFormProps, SchemaLeafContext, SchemaObjectContext, ScrollOptions, SectionProps as FormSectionProps, SlotProps as FormSlotProps, WithFieldOption, } from './interface.js';
@@ -31,5 +31,5 @@ import { semiRenderers } from './schema-form/semi-renderers.svelte';
31
31
  import FormSection from './section.svelte';
32
32
  import FormSlot from './slot.svelte';
33
33
  export { ArrayField, Form, FormAutoComplete, FormCascader, FormCheckbox, FormCheckboxGroup, FormDatePicker, FormErrorMessage, FormField, FormInput, FormInputGroup, FormInputNumber, FormLabel, FormPinCode, FormRadio, FormRadioGroup, FormRating, FormSection, FormSelect, FormSlider, FormSlot, FormSwitch, FormTagInput, FormTextArea, FormTimePicker, FormTransfer, FormTreeSelect, FormUpload, SchemaField, SchemaForm, semiRenderers, useForm, };
34
- export { blankRow } from '@fibrae/semi-foundation/components/form/json-schema';
34
+ export { blankRow, controlProps, singleItemName } from '@fibrae/semi-foundation/components/form/json-schema';
35
35
  export { useFieldApi, useFieldState, useFormApi, useFormState } from './hooks/index.js';
@@ -49,8 +49,8 @@
49
49
  // the group's own aria-labelledby and aria-describedby are added to each field's references rather than set on the group
50
50
  get aria() {
51
51
  return {
52
- labelledby: joinIds(ariaLabelledby ?? undefined, hasLabel && labelId),
53
- describedby: joinIds(ariaDescribedby ?? undefined, Boolean(extraText) && ids.extraText),
52
+ labelledby: joinIds(ariaLabelledby, hasLabel && labelId),
53
+ describedby: joinIds(ariaDescribedby, extraText && ids.extraText),
54
54
  errormessage: ids.errorMessage,
55
55
  };
56
56
  },
@@ -2,7 +2,7 @@
2
2
  import { cssClasses } from '@fibrae/semi-foundation/components/form/constants';
3
3
  import { toCssLength } from '@fibrae/semi-foundation/utils';
4
4
  import '@fibrae/semi-foundation/components/form/form.css';
5
- import { IconHelpCircle } from '@fibrae/semi-icons-svelte';
5
+ import { IconHelpCircleStroked } from '@fibrae/semi-icons-svelte';
6
6
  import useLocale from '../locale/use-locale.svelte.js';
7
7
  import type { TooltipTriggerProps } from '../tooltip/interface.js';
8
8
  import Tooltip from '../tooltip/tooltip.svelte';
@@ -35,12 +35,12 @@
35
35
 
36
36
  {#snippet tooltipButton(triggerProps: Partial<TooltipTriggerProps>)}
37
37
  <button {...triggerProps} aria-label={locale().locale.labelTooltip} class={`${prefix}-tooltip`} type="button">
38
- <IconHelpCircle />
38
+ <IconHelpCircleStroked size="inherit" />
39
39
  </button>
40
40
  {/snippet}
41
41
 
42
42
  {#if hasTooltip}
43
- <div class={`${prefix}-with-tooltip`} style={width === undefined ? undefined : `width: ${toCssLength(width)}`}>
43
+ <div class={`${prefix}-with-tooltip`} style:width={toCssLength(width)}>
44
44
  {@render labelView()}
45
45
  <Tooltip>
46
46
  {#snippet child({ props })}{@render tooltipButton(props)}{/snippet}
@@ -24,7 +24,7 @@
24
24
 
25
25
  // a rendered label names the slot, so the slot becomes a group its content belongs to
26
26
  const labelShown = $derived(!noLabel && ((labelConfig.text != null && labelConfig.text !== '') || Boolean(fieldLabel)));
27
- const labelledby = $derived(joinIds(rest['aria-labelledby'] ?? undefined, labelShown && labelId));
27
+ const labelledby = $derived(joinIds(rest['aria-labelledby'], labelShown && labelId));
28
28
  </script>
29
29
 
30
30
  {#snippet labelView()}
@@ -238,14 +238,14 @@
238
238
  `${prefixCls}-wrapper`,
239
239
  attrs.root.class,
240
240
  {
241
- [`${prefixCls}-wrapper__with-prefix`]: Boolean(prefix || insetLabel),
242
- [`${prefixCls}-wrapper__with-suffix`]: Boolean(suffix),
241
+ [`${prefixCls}-wrapper__with-prefix`]: prefix || insetLabel,
242
+ [`${prefixCls}-wrapper__with-suffix`]: suffix,
243
243
  [`${prefixCls}-wrapper__with-suffix-hidden`]: allowClear && hideSuffix,
244
244
  [`${prefixCls}-wrapper__with-suffix-icon`]: suffixKind === 'icon',
245
- [`${prefixCls}-wrapper__with-append`]: Boolean(addonBefore),
246
- [`${prefixCls}-wrapper__with-prepend`]: Boolean(addonAfter),
247
- [`${prefixCls}-wrapper__with-append-only`]: Boolean(addonBefore && !addonAfter),
248
- [`${prefixCls}-wrapper__with-prepend-only`]: Boolean(!addonBefore && addonAfter),
245
+ [`${prefixCls}-wrapper__with-append`]: addonBefore,
246
+ [`${prefixCls}-wrapper__with-prepend`]: addonAfter,
247
+ [`${prefixCls}-wrapper__with-append-only`]: addonBefore && !addonAfter,
248
+ [`${prefixCls}-wrapper__with-prepend-only`]: !addonBefore && addonAfter,
249
249
  [`${prefixCls}-wrapper-readonly`]: readonly,
250
250
  [`${prefixCls}-wrapper-disabled`]: isDisabled,
251
251
  [`${prefixCls}-wrapper-warning`]: validateStatus === 'warning',
@@ -254,7 +254,7 @@
254
254
  [`${prefixCls}-wrapper-clearable`]: showClear,
255
255
  [`${prefixCls}-wrapper-modebtn`]: mode === 'password',
256
256
  [`${prefixCls}-wrapper-hidden`]: type === 'hidden',
257
- [`${prefixCls}-wrapper-${shownSize}`]: Boolean(shownSize),
257
+ [`${prefixCls}-wrapper-${shownSize}`]: shownSize,
258
258
  [`${prefixCls}-borderless`]: borderless,
259
259
  },
260
260
  ]}
@@ -283,7 +283,7 @@
283
283
  class={[
284
284
  `${prefixCls}-prefix`,
285
285
  {
286
- [`${prefixCls}-inset-label`]: Boolean(insetLabel),
286
+ [`${prefixCls}-inset-label`]: insetLabel,
287
287
  [`${prefixCls}-prefix-text`]: prefixKind === 'text',
288
288
  [`${prefixCls}-prefix-icon`]: prefixKind === 'icon',
289
289
  },
@@ -308,7 +308,7 @@
308
308
  class={[
309
309
  prefixCls,
310
310
  {
311
- [`${prefixCls}-${shownSize}`]: Boolean(shownSize),
311
+ [`${prefixCls}-${shownSize}`]: shownSize,
312
312
  [`${prefixCls}-disabled`]: isDisabled,
313
313
  [`${prefixCls}-sibling-clearbtn`]: allowClear,
314
314
  [`${prefixCls}-sibling-modebtn`]: mode === 'password',
@@ -275,7 +275,7 @@
275
275
  {
276
276
  [`${prefixCls}-textarea-disabled`]: disabled,
277
277
  [`${prefixCls}-textarea-readonly`]: readonly,
278
- [`${prefixCls}-textarea-autosize`]: Boolean(autosize),
278
+ [`${prefixCls}-textarea-autosize`]: autosize,
279
279
  [`${prefixCls}-textarea-showClear`]: showClear,
280
280
  },
281
281
  classNames?.textarea,
@@ -308,7 +308,7 @@
308
308
  [`${prefixCls}-textarea-borderless`]: borderless,
309
309
  [`${prefixCls}-textarea-wrapper-disabled`]: disabled,
310
310
  [`${prefixCls}-textarea-wrapper-readonly`]: readonly,
311
- [`${prefixCls}-textarea-wrapper-${validateStatus}`]: Boolean(validateStatus),
311
+ [`${prefixCls}-textarea-wrapper-${validateStatus}`]: validateStatus,
312
312
  [`${prefixCls}-textarea-wrapper-focus`]: states().isFocus,
313
313
  [`${prefixCls}-textarea-wrapper-withLineNumber`]: showLineNumber,
314
314
  [`${prefixCls}-textarea-wrapper-resizeX`]: isResizable(['horizontal', 'both', 'inline']),
@@ -91,8 +91,8 @@
91
91
  closeIcon={closeIcon ? closeIconSlot : undefined}
92
92
  {confirmLoading}
93
93
  {dir}
94
- footer={footer === undefined ? undefined : footer === null ? null : footerSlot}
95
- header={header === undefined ? undefined : header === null ? null : headerSlot}
94
+ footer={footer == null ? footer : footerSlot}
95
+ header={header == null ? header : headerSlot}
96
96
  icon={icon === null ? undefined : iconSlot}
97
97
  role="alertdialog"
98
98
  title={title == null ? undefined : titleSlot}
@@ -2,7 +2,7 @@
2
2
  import { onMount } from 'svelte';
3
3
  import { radioClasses } from '@fibrae/semi-foundation/components/radio/constants';
4
4
  import RadioFoundation, { type RadioAdapter, type RadioBaseProps, type RadioBaseState } from '@fibrae/semi-foundation/components/radio/radio-foundation';
5
- import { joinIds } from '@fibrae/semi-foundation/utils';
5
+ import { isAriaInvalid, joinIds } from '@fibrae/semi-foundation/utils';
6
6
  import '@fibrae/semi-foundation/components/radio/radio.css';
7
7
  import { IconRadio } from '@fibrae/semi-icons-svelte';
8
8
  import { useDefaultProps, useFoundation } from '../../base/index.js';
@@ -111,7 +111,7 @@
111
111
 
112
112
  const view = $derived(RadioFoundation.deriveView(foundationProps, states(), groupView()));
113
113
  const hasExtra = $derived(Boolean(extra) && !view.isButtonRadio);
114
- const describedby = $derived(joinIds(rest['aria-describedby'], hasExtra ? extraDomId : undefined, rest['aria-invalid'] ? rest['aria-errormessage'] : undefined));
114
+ const describedby = $derived(joinIds(rest['aria-describedby'], hasExtra ? extraDomId : undefined, isAriaInvalid(rest['aria-invalid']) ? rest['aria-errormessage'] : undefined));
115
115
 
116
116
  // A native radio checks itself and unchecks its same-name siblings on click. Svelte does not patch a value that did
117
117
  // not change, so when the owner refuses the change the DOM is written back by hand.
@@ -176,7 +176,7 @@
176
176
  {
177
177
  [`${prefix}-disabled`]: view.disabled,
178
178
  [`${prefix}-checked`]: view.checked,
179
- [`${prefix}-${displayMode}`]: Boolean(displayMode),
179
+ [`${prefix}-${displayMode}`]: displayMode,
180
180
  [`${prefix}-buttonRadioComponent`]: !view.inGroup && view.isButtonRadio,
181
181
  [`${prefix}-buttonRadioGroup`]: view.isButtonRadio,
182
182
  [`${prefix}-buttonRadioGroup-${view.buttonSize}`]: view.isButtonRadio && view.buttonSize,
@@ -81,7 +81,7 @@
81
81
  class: {
82
82
  [`${prefix}-item-sel`]: selected && !isWheel,
83
83
  [cssClasses.SELECTED]: isWheel && key === states().highlightedKey,
84
- [`${prefix}-item-disabled`]: Boolean(item.disabled),
84
+ [`${prefix}-item-disabled`]: item.disabled,
85
85
  },
86
86
  text: ItemFoundation.getItemText(item, selected, transform),
87
87
  };
@@ -6,7 +6,7 @@ import type { InputProps, ValidateStatus } from '../input/index.js';
6
6
  import type { PopoverProps } from '../popover/index.js';
7
7
  import type { TagCloseEvent } from '../tag/index.js';
8
8
  import type { Position } from '../tooltip/index.js';
9
- export type BasicSelectValue = string | number | Record<string, any>;
9
+ export type BasicSelectValue = string | number | boolean | Record<string, any>;
10
10
  export type SelectValue = BasicSelectValue | BasicSelectValue[] | undefined;
11
11
  export type SelectSize = Size;
12
12
  export interface SelectVirtualize {
@@ -20,7 +20,7 @@ export interface SelectOptionGroup {
20
20
  label?: string | number;
21
21
  }
22
22
  export interface SelectOptionProps {
23
- value?: string | number;
23
+ value?: string | number | boolean;
24
24
  label?: string | number;
25
25
  disabled?: boolean;
26
26
  showTick?: boolean;
@@ -36,7 +36,7 @@ export type SelectInputProps = Omit<InputProps, 'value'>;
36
36
  export interface SelectOptionItemSnippetProps {
37
37
  /** Put it on the role="option" element: the combobox's aria-activedescendant points at it */
38
38
  id: string;
39
- value?: string | number;
39
+ value?: string | number | boolean;
40
40
  label?: string | number;
41
41
  selected: boolean;
42
42
  focused: boolean;
@@ -130,8 +130,8 @@ export interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
130
130
  onDropdownVisibleChange?: (visible: boolean) => void;
131
131
  /** No event when called through `search()` or the trigger snippet's `onSearch` */
132
132
  onSearch?: (value: string, event?: Event) => void;
133
- onSelect?: (value: string | number, option: SelectOptionProps) => void;
134
- onDeselect?: (value: string | number, option: SelectOptionProps) => void;
133
+ onSelect?: (value: string | number | boolean, option: SelectOptionProps) => void;
134
+ onDeselect?: (value: string | number | boolean, option: SelectOptionProps) => void;
135
135
  onExceed?: (option: SelectOptionProps) => void;
136
136
  onCreate?: (option: SelectOptionProps) => void;
137
137
  onClear?: () => void;
@@ -550,7 +550,7 @@
550
550
  {/if}
551
551
  </div>
552
552
  {:else}
553
- <TagGroup maxTagCount={tagFold.limit} onPlusNMouseEnter={foundation.updateIsFullTags} popoverProps={showRestTagsPopover ? restTagsPopoverProps : undefined} restCount={tagFold.restCount} showPopover={showRestTagsPopover} size={tagSize} tagList={groupTags.map((item) => ({ tagKey: item.value }))}>
553
+ <TagGroup maxTagCount={tagFold.limit} onPlusNMouseEnter={foundation.updateIsFullTags} popoverProps={showRestTagsPopover ? restTagsPopoverProps : undefined} restCount={tagFold.restCount} showPopover={showRestTagsPopover} size={tagSize} tagList={groupTags.map((item) => ({ tagKey: `${item.value}` }))}>
554
554
  {#snippet tag({ index }: { index: number })}
555
555
  {@render tagItem(selectedItems[index], index, true)}
556
556
  {/snippet}
@@ -607,7 +607,7 @@
607
607
  `${cls}-selection-text`,
608
608
  {
609
609
  [`${cls}-selection-placeholder`]: !hasSingleContent,
610
- [`${cls}-selection-text-hide`]: Boolean(states().inputValue) && states().showInput && searchInTrigger,
610
+ [`${cls}-selection-text-hide`]: states().inputValue && states().showInput && searchInTrigger,
611
611
  [`${cls}-selection-text-inactive`]: !states().inputValue && states().showInput && searchInTrigger,
612
612
  },
613
613
  ]}
@@ -670,8 +670,8 @@
670
670
  [`${cls}-error`]: validateStatus === 'error',
671
671
  [`${cls}-warning`]: validateStatus === 'warning',
672
672
  [`${cls}-no-arrow`]: !showArrow,
673
- [`${cls}-with-prefix`]: Boolean(prefix || insetLabel),
674
- [`${cls}-with-suffix`]: Boolean(suffix),
673
+ [`${cls}-with-prefix`]: prefix || insetLabel,
674
+ [`${cls}-with-suffix`]: suffix,
675
675
  },
676
676
  ]}
677
677
  id={selectId}
@@ -26,7 +26,6 @@
26
26
  import { getTableContext } from '../context.js';
27
27
  import type { ColumnProps, TableVirtualizedScrollArgs } from '../interface.js';
28
28
  import TableHeader from '../table-header/table-header.svelte';
29
- import { joinStyles } from '../utils.js';
30
29
  import BaseRow from './base-row.svelte';
31
30
  import ExpandedRow from './expanded-row.svelte';
32
31
  import SectionRow from './section-row.svelte';
@@ -247,7 +246,7 @@
247
246
  {#if includeHeader}
248
247
  <!-- a hidden header stays for its column widths; inert keeps its controls out of the Tab order and the a11y tree; rendered in the list's scroller above the rows, so the browser moves it with them in the same frame -->
249
248
  <div {@attach observeResize(() => (listHeaderHeight = listHeader?.offsetHeight ?? 0))} bind:this={listHeader} class="{table.prefixCls}-list-header" inert={!table.showHeader}>
250
- <svelte:element this={table.components.header.outer} class={[table.prefixCls, `${table.prefixCls}-fixed`]} role="none" style={joinStyles(table.scroll?.x != null && `width: ${toCssLength(table.scroll.x)}`, minWidth !== undefined && `min-width: ${toCssLength(minWidth)}`)}>
249
+ <svelte:element this={table.components.header.outer} class={[table.prefixCls, `${table.prefixCls}-fixed`]} role="none" style:min-width={toCssLength(minWidth)} style:width={toCssLength(table.scroll?.x)}>
251
250
  <ColGroup {columns} prefixCls={table.prefixCls} />
252
251
  <TableHeader {columns} hidden={!table.showHeader} />
253
252
  </svelte:element>
@@ -287,7 +286,8 @@
287
286
  {@attach observeResize(measureOverflow)}
288
287
  class={[table.prefixCls, { [`${table.prefixCls}-fixed`]: table.tableLayout === 'fixed' }]}
289
288
  role={table.splitTable ? 'none' : 'table'}
290
- style={joinStyles(table.scroll?.x != null && `width: ${toCssLength(table.scroll.x)}`, minWidth !== undefined && `min-width: ${toCssLength(minWidth)}`)}
289
+ style:min-width={toCssLength(minWidth)}
290
+ style:width={toCssLength(table.scroll?.x)}
291
291
  >
292
292
  <ColGroup col={table.components.body.colgroup.col} {columns} prefixCls={table.prefixCls} wrapper={table.components.body.colgroup.wrapper} />
293
293
  <!-- without a header the fixed columns still need its measured widths for their offsets -->
@@ -74,7 +74,7 @@
74
74
  [`${table.prefixCls}-cell-fixed-right`]: right,
75
75
  [`${table.prefixCls}-cell-fixed-right-first`]: rightFirst,
76
76
  [`${table.prefixCls}-cell-last`]: columnsToEnd != null && (colspan ?? 1) >= columnsToEnd,
77
- [`${table.prefixCls}-row-cell-ellipsis`]: Boolean(column.ellipsis),
77
+ [`${table.prefixCls}-row-cell-ellipsis`]: column.ellipsis,
78
78
  },
79
79
  ],
80
80
  // a role="none" table no longer gives colspan and rowspan their table meaning
@@ -22,12 +22,12 @@
22
22
 
23
23
  <div
24
24
  bind:this={element}
25
- class={[`${table.prefixCls}-header`, { [`${table.prefixCls}-header-sticky`]: Boolean(table.sticky), [`${table.prefixCls}-header-hidden`]: !table.showHeader }]}
25
+ class={[`${table.prefixCls}-header`, { [`${table.prefixCls}-header-sticky`]: table.sticky, [`${table.prefixCls}-header-hidden`]: !table.showHeader }]}
26
26
  inert={!table.showHeader}
27
27
  style={joinStyles(table.bodyHasScrollbar && 'overflow-y: scroll', `top: ${toCssLength(top)}`)}
28
28
  onscroll={table.handleBodyScroll}
29
29
  >
30
- <svelte:element this={table.components.header.outer} class={[table.prefixCls, { [`${table.prefixCls}-fixed`]: table.tableLayout === 'fixed' }]} role="none" style={joinStyles(table.scroll?.x != null && `width: ${toCssLength(table.scroll.x)}`, minWidth !== undefined && `min-width: ${toCssLength(minWidth)}`)}>
30
+ <svelte:element this={table.components.header.outer} class={[table.prefixCls, { [`${table.prefixCls}-fixed`]: table.tableLayout === 'fixed' }]} role="none" style:min-width={toCssLength(minWidth)} style:width={toCssLength(table.scroll?.x)}>
31
31
  <ColGroup {columns} prefixCls={table.prefixCls} />
32
32
  <TableHeader {columns} />
33
33
  </svelte:element>
@@ -82,13 +82,13 @@
82
82
  column.class,
83
83
  customClass,
84
84
  {
85
- [`${table.prefixCls}-align-${textAlign}`]: Boolean(textAlign),
85
+ [`${table.prefixCls}-align-${textAlign}`]: textAlign,
86
86
  [`${table.prefixCls}-cell-fixed-left`]: fixedLeft,
87
87
  [`${table.prefixCls}-cell-fixed-left-last`]: fixedLeftLast,
88
88
  [`${table.prefixCls}-cell-fixed-right`]: fixedRight,
89
89
  [`${table.prefixCls}-cell-fixed-right-first`]: fixedRightFirst,
90
- [`${table.prefixCls}-cell-last`]: Boolean(cell.last),
91
- [`${table.prefixCls}-row-head-ellipsis`]: Boolean(column.ellipsis),
90
+ [`${table.prefixCls}-cell-last`]: cell.last,
91
+ [`${table.prefixCls}-row-head-ellipsis`]: column.ellipsis,
92
92
  [`${table.prefixCls}-row-head-clickSort`]: flags.clickToSort,
93
93
  },
94
94
  ],
@@ -641,7 +641,7 @@
641
641
  [`${prefixCls}-${strings.SIZE_MIDDLE}`]: size === strings.SIZE_MIDDLE,
642
642
  [`${prefixCls}-virtualized`]: isVirtualized,
643
643
  [`${prefixCls}-bordered`]: bordered,
644
- [`${prefixCls}-fixed-header`]: Boolean(scroll?.y),
644
+ [`${prefixCls}-fixed-header`]: scroll?.y,
645
645
  }}
646
646
  >
647
647
  {#if mergedPagination && (paginationPosition === 'top' || paginationPosition === 'both')}
@@ -319,8 +319,8 @@
319
319
  [`${prefixCls}-warning`]: validateStatus === 'warning',
320
320
  [`${prefixCls}-small`]: size === 'small',
321
321
  [`${prefixCls}-large`]: size === 'large',
322
- [`${prefixCls}-with-prefix`]: Boolean(prefix || insetLabel),
323
- [`${prefixCls}-with-suffix`]: Boolean(suffix),
322
+ [`${prefixCls}-with-prefix`]: prefix || insetLabel,
323
+ [`${prefixCls}-with-suffix`]: suffix,
324
324
  },
325
325
  ]}
326
326
  role="group"
@@ -331,7 +331,7 @@
331
331
  {#if prefix || insetLabel}
332
332
  <div
333
333
  {@attach trackPrefix}
334
- class={[`${prefixCls}-prefix`, { [`${prefixCls}-inset-label`]: Boolean(insetLabel), [`${prefixCls}-prefix-text`]: prefixKind === 'text', [`${prefixCls}-prefix-icon`]: prefixKind === 'icon' }]}
334
+ class={[`${prefixCls}-prefix`, { [`${prefixCls}-inset-label`]: insetLabel, [`${prefixCls}-prefix-text`]: prefixKind === 'text', [`${prefixCls}-prefix-icon`]: prefixKind === 'icon' }]}
335
335
  id={prefixId}
336
336
  x-semi-prop="prefix"
337
337
  onclick={foundation.handleClickPrefixOrSuffix}
@@ -145,6 +145,9 @@
145
145
  get returnFocusOnClose() {
146
146
  return returnFocusOnClose;
147
147
  },
148
+ get role() {
149
+ return role;
150
+ },
148
151
  get showArrow() {
149
152
  return showArrow;
150
153
  },
@@ -781,13 +781,13 @@
781
781
  [`${cls}-multiple`]: multiple,
782
782
  [`${cls}-multiple-tagInput-empty`]: multiple && triggerSearch && !hasValue,
783
783
  [`${cls}-multiple-tagInput-notEmpty`]: multiple && triggerSearch && hasValue,
784
- [`${cls}-filterable`]: Boolean(filterTreeNode),
784
+ [`${cls}-filterable`]: filterTreeNode,
785
785
  [`${cls}-error`]: validateStatus === 'error',
786
786
  [`${cls}-warning`]: validateStatus === 'warning',
787
787
  [`${cls}-small`]: size === 'small',
788
788
  [`${cls}-large`]: size === 'large',
789
- [`${cls}-with-prefix`]: Boolean(prefix || insetLabel),
790
- [`${cls}-with-suffix`]: Boolean(suffix),
789
+ [`${cls}-with-prefix`]: prefix || insetLabel,
790
+ [`${cls}-with-suffix`]: suffix,
791
791
  [`${cls}-triggerTagWrap`]: triggerTagWrap && multiple && triggerSearch,
792
792
  },
793
793
  ]}