@fibrae/semi-ui-svelte 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_base/create-context.js +0 -1
- package/dist/_base/css-animation.js +0 -1
- package/dist/_base/group-role.d.ts +0 -1
- package/dist/_base/group-role.js +0 -1
- package/dist/_base/slot-kind.d.ts +0 -1
- package/dist/_base/slot-kind.js +0 -1
- package/dist/_base/teleport.d.ts +0 -2
- package/dist/_base/teleport.js +0 -2
- package/dist/_base/use-click-outside.svelte.d.ts +2 -2
- package/dist/_base/use-click-outside.svelte.js +2 -2
- package/dist/_base/use-foundation.svelte.js +2 -5
- package/dist/_base/virtual-list.svelte +2 -3
- package/dist/_base/virtual-list.svelte.d.ts +0 -1
- package/dist/_sortable/interface.d.ts +0 -1
- package/dist/anchor/interface.d.ts +0 -3
- package/dist/anchor/link-item.svelte +0 -1
- package/dist/anchor/links.d.ts +0 -1
- package/dist/anchor/links.js +0 -1
- package/dist/audio-player/audio-player.svelte +0 -2
- package/dist/audio-player/audio-slider.svelte +0 -3
- package/dist/auto-complete/auto-complete.svelte +0 -5
- package/dist/auto-complete/interface.d.ts +0 -9
- package/dist/avatar/avatar-group-more.svelte +0 -1
- package/dist/avatar/avatar.svelte +0 -4
- package/dist/avatar/context.d.ts +0 -1
- package/dist/avatar/interface.d.ts +0 -4
- package/dist/backtop/backtop.svelte +0 -2
- package/dist/backtop/interface.d.ts +0 -1
- package/dist/badge/interface.d.ts +0 -1
- package/dist/banner/banner.svelte +1 -1
- package/dist/banner/interface.d.ts +1 -3
- package/dist/breadcrumb/breadcrumb-item.svelte +0 -1
- package/dist/breadcrumb/breadcrumb.svelte +0 -1
- package/dist/breadcrumb/interface.d.ts +0 -7
- package/dist/calendar/calendar.svelte +0 -1
- package/dist/calendar/day-calendar.svelte +0 -3
- package/dist/calendar/interface.d.ts +0 -8
- package/dist/calendar/month-calendar.svelte +0 -4
- package/dist/calendar/time-grid.svelte +0 -2
- package/dist/calendar/time-grid.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.js +0 -1
- package/dist/card/index.js +0 -1
- package/dist/card/interface.d.ts +0 -3
- package/dist/carousel/carousel.svelte +0 -4
- package/dist/carousel/interface.d.ts +0 -3
- package/dist/cascader/cascader.svelte +0 -6
- package/dist/cascader/interface.d.ts +0 -19
- package/dist/cascader/item.svelte +0 -4
- package/dist/cascader/item.svelte.d.ts +0 -4
- package/dist/checkbox/checkbox-group.svelte +0 -3
- package/dist/checkbox/checkbox.svelte +0 -4
- package/dist/checkbox/index.js +0 -1
- package/dist/checkbox/interface.d.ts +0 -1
- package/dist/code-highlight/interface.d.ts +0 -1
- package/dist/collapse/collapse.svelte +0 -2
- package/dist/collapse/index.js +0 -1
- package/dist/collapse/interface.d.ts +0 -2
- package/dist/collapse/panel.svelte +0 -1
- package/dist/collapsible/collapsible.svelte +0 -2
- package/dist/color-picker/alpha-slider.svelte +0 -1
- package/dist/color-picker/color-choose-area.svelte +0 -1
- package/dist/color-picker/color-slider.svelte +0 -1
- package/dist/color-picker/data-part.svelte +0 -1
- package/dist/cropper/cropper.svelte +0 -1
- package/dist/cropper/interface.d.ts +0 -6
- package/dist/date-picker/date-input.svelte +0 -4
- package/dist/date-picker/date-picker.svelte +0 -7
- package/dist/date-picker/inset-input.svelte +0 -1
- package/dist/date-picker/interface.d.ts +0 -7
- package/dist/date-picker/internal.d.ts +0 -7
- package/dist/date-picker/month.svelte +0 -1
- package/dist/date-picker/months-grid.svelte +0 -6
- package/dist/date-picker/navigation.svelte +0 -1
- package/dist/descriptions/interface.d.ts +0 -1
- package/dist/divider/divider.svelte +0 -1
- package/dist/divider/interface.d.ts +0 -4
- package/dist/drag-move/drag-move.js +0 -1
- package/dist/drag-move/interface.d.ts +0 -3
- package/dist/dropdown/context.d.ts +0 -6
- package/dist/dropdown/context.js +0 -1
- package/dist/dropdown/dropdown-item.svelte +0 -1
- package/dist/dropdown/dropdown.svelte +0 -7
- package/dist/dropdown/interface.d.ts +0 -4
- package/dist/empty/empty.svelte +0 -1
- package/dist/empty/interface.d.ts +0 -3
- package/dist/feedback/feedback-content.svelte +4 -4
- package/dist/feedback/feedback.svelte +0 -1
- package/dist/feedback/interface.d.ts +4 -12
- package/dist/float-button/float-button-action.svelte +0 -2
- package/dist/float-button/interface.d.ts +0 -2
- package/dist/form/array-field.svelte +0 -2
- package/dist/form/context.d.ts +0 -2
- package/dist/form/error-message.svelte +0 -1
- package/dist/form/field-grid.svelte +0 -2
- package/dist/form/field-grid.svelte.d.ts +0 -2
- package/dist/form/field-inner.svelte +9 -5
- package/dist/form/field-inner.svelte.d.ts +3 -1
- package/dist/form/field.svelte +9 -2
- package/dist/form/field.svelte.d.ts +6 -2
- package/dist/form/form-auto-complete.svelte +7 -1
- package/dist/form/form-auto-complete.svelte.d.ts +3 -1
- package/dist/form/form-cascader.svelte +7 -1
- package/dist/form/form-cascader.svelte.d.ts +3 -1
- package/dist/form/form-checkbox-group.svelte +7 -1
- package/dist/form/form-checkbox-group.svelte.d.ts +3 -1
- package/dist/form/form-checkbox.svelte +7 -1
- package/dist/form/form-checkbox.svelte.d.ts +3 -1
- package/dist/form/form-date-picker.svelte +7 -1
- package/dist/form/form-date-picker.svelte.d.ts +3 -1
- package/dist/form/form-input-number.svelte +7 -1
- package/dist/form/form-input-number.svelte.d.ts +3 -1
- package/dist/form/form-input.svelte +7 -1
- package/dist/form/form-input.svelte.d.ts +3 -1
- package/dist/form/form-pin-code.svelte +7 -1
- package/dist/form/form-pin-code.svelte.d.ts +3 -1
- package/dist/form/form-radio-group.svelte +7 -1
- package/dist/form/form-radio-group.svelte.d.ts +3 -1
- package/dist/form/form-radio.svelte +7 -1
- package/dist/form/form-radio.svelte.d.ts +3 -1
- package/dist/form/form-rating.svelte +7 -1
- package/dist/form/form-rating.svelte.d.ts +3 -1
- package/dist/form/form-select.svelte +7 -1
- package/dist/form/form-select.svelte.d.ts +3 -1
- package/dist/form/form-slider.svelte +7 -1
- package/dist/form/form-slider.svelte.d.ts +3 -1
- package/dist/form/form-switch.svelte +7 -1
- package/dist/form/form-switch.svelte.d.ts +3 -1
- package/dist/form/form-tag-input.svelte +7 -1
- package/dist/form/form-tag-input.svelte.d.ts +3 -1
- package/dist/form/form-text-area.svelte +7 -1
- package/dist/form/form-text-area.svelte.d.ts +3 -1
- package/dist/form/form-time-picker.svelte +7 -1
- package/dist/form/form-time-picker.svelte.d.ts +3 -1
- package/dist/form/form-transfer.svelte +7 -1
- package/dist/form/form-transfer.svelte.d.ts +3 -1
- package/dist/form/form-tree-select.svelte +7 -1
- package/dist/form/form-tree-select.svelte.d.ts +3 -1
- package/dist/form/form-upload.svelte +7 -1
- package/dist/form/form-upload.svelte.d.ts +3 -1
- package/dist/form/form.svelte +0 -1
- package/dist/form/hooks.d.ts +1 -2
- package/dist/form/hooks.js +1 -2
- package/dist/form/interface.d.ts +0 -7
- package/dist/form/utils.d.ts +0 -1
- package/dist/form/utils.js +0 -2
- package/dist/highlight/interface.d.ts +0 -1
- package/dist/hot-keys/interface.d.ts +0 -1
- package/dist/icon-button/icon-button.svelte +6 -2
- package/dist/image/context.d.ts +0 -1
- package/dist/image/footer.d.ts +0 -1
- package/dist/image/interface.d.ts +0 -8
- package/dist/image/preview-image.svelte +0 -3
- package/dist/image/preview-image.svelte.d.ts +0 -1
- package/dist/image/preview-inner.svelte +0 -3
- package/dist/image/preview-inner.svelte.d.ts +0 -1
- package/dist/input/context.d.ts +0 -1
- package/dist/input/input-group.svelte +8 -2
- package/dist/input/interface.d.ts +0 -3
- package/dist/input/textarea.svelte +0 -3
- package/dist/input-number/input-number.svelte +0 -2
- package/dist/input-number/interface.d.ts +0 -1
- package/dist/json-viewer/interface.d.ts +0 -4
- package/dist/json-viewer/json-viewer.svelte +0 -3
- package/dist/layout/interface.d.ts +0 -2
- package/dist/list/interface.d.ts +0 -2
- package/dist/lottie/interface.d.ts +1 -1
- package/dist/markdown-render/code-text.js +0 -1
- package/dist/markdown-render/components/code.svelte +0 -1
- package/dist/markdown-render/components/heading.svelte +0 -1
- package/dist/markdown-render/components/p.svelte +0 -1
- package/dist/markdown-render/components/table.svelte +0 -1
- package/dist/markdown-render/components/tree.d.ts +0 -4
- package/dist/markdown-render/components/tree.js +0 -2
- package/dist/markdown-render/interface.d.ts +0 -1
- package/dist/markdown-render/markdown-children.svelte +0 -2
- package/dist/markdown-render/markdown-render.svelte +0 -1
- package/dist/markdown-render/runtime.js +0 -1
- package/dist/modal/confirm-modal.svelte +0 -1
- package/dist/modal/confirm.svelte.d.ts +0 -1
- package/dist/modal/confirm.svelte.js +0 -1
- package/dist/modal/index.js +0 -1
- package/dist/modal/interface.d.ts +0 -6
- package/dist/modal/modal-content.svelte +0 -4
- package/dist/modal/modal.svelte +0 -1
- package/dist/modal/use-show-hide.svelte.d.ts +0 -2
- package/dist/modal/use-show-hide.svelte.js +0 -4
- package/dist/navigation/context.d.ts +0 -2
- package/dist/navigation/index.js +0 -1
- package/dist/navigation/interface.d.ts +1 -17
- package/dist/navigation/item-shell.svelte +0 -4
- package/dist/navigation/item-shell.svelte.d.ts +0 -3
- package/dist/navigation/nav-footer.svelte +0 -2
- package/dist/navigation/nav-items.svelte +0 -1
- package/dist/navigation/nav.svelte +2 -2
- package/dist/navigation/sub-nav.svelte +0 -5
- package/dist/navigation/wrapper-outlet.svelte +0 -1
- package/dist/notification/context.d.ts +0 -3
- package/dist/notification/interface.d.ts +0 -5
- package/dist/notification/notice-list.svelte +0 -2
- package/dist/notification/notice-list.svelte.d.ts +0 -1
- package/dist/notification/notice.svelte +0 -2
- package/dist/notification/notification-list.svelte +0 -1
- package/dist/notification/static-api.js +0 -1
- package/dist/overflow-list/interface.d.ts +0 -2
- package/dist/overflow-list/overflow-list.svelte +0 -2
- package/dist/pagination/interface.d.ts +0 -1
- package/dist/pagination/pagination.svelte +0 -2
- package/dist/pagination/step-button.svelte +0 -3
- package/dist/pagination/step-button.svelte.d.ts +0 -1
- package/dist/pincode/interface.d.ts +0 -1
- package/dist/pincode/pincode.svelte +4 -5
- package/dist/popconfirm/interface.d.ts +0 -1
- package/dist/popconfirm/popconfirm.svelte +0 -2
- package/dist/popover/interface.d.ts +0 -1
- package/dist/popover/popover.svelte +0 -1
- package/dist/radio/index.js +0 -1
- package/dist/radio/radio-group.svelte +2 -2
- package/dist/radio/radio.svelte +0 -1
- package/dist/rating/interface.d.ts +0 -2
- package/dist/rating/item.svelte +0 -1
- package/dist/rating/rating.svelte +0 -7
- package/dist/resizable/interface.d.ts +0 -2
- package/dist/resizable/resizable.svelte +0 -1
- package/dist/resizable/resize-group.svelte +30 -14
- package/dist/resizable/resize-handler.svelte +0 -1
- package/dist/resize-observer/observe-resize.d.ts +1 -5
- package/dist/resize-observer/observe-resize.js +1 -5
- package/dist/scroll-list/index.js +0 -1
- package/dist/scroll-list/interface.d.ts +0 -2
- package/dist/scroll-list/scroll-item.svelte +0 -2
- package/dist/select/interface.d.ts +0 -14
- package/dist/select/option.svelte +0 -5
- package/dist/select/option.svelte.d.ts +0 -5
- package/dist/select/select.svelte +0 -14
- package/dist/side-sheet/interface.d.ts +0 -1
- package/dist/side-sheet/side-sheet.svelte +0 -9
- package/dist/skeleton/index.js +0 -1
- package/dist/skeleton/interface.d.ts +0 -2
- package/dist/skeleton/skeleton-item.svelte +0 -1
- package/dist/slider/interface.d.ts +0 -5
- package/dist/slider/slider.svelte +14 -11
- package/dist/space/interface.d.ts +0 -1
- package/dist/space/space.svelte +0 -1
- package/dist/steps/context.d.ts +0 -1
- package/dist/steps/interface.d.ts +0 -2
- package/dist/steps/step.svelte +0 -3
- package/dist/switch/switch.svelte +0 -2
- package/dist/table/body/base-row.svelte +0 -4
- package/dist/table/body/base-row.svelte.d.ts +0 -4
- package/dist/table/body/body.svelte +0 -7
- package/dist/table/body/body.svelte.d.ts +0 -5
- package/dist/table/body/expanded-row.svelte +0 -1
- package/dist/table/body/expanded-row.svelte.d.ts +0 -1
- package/dist/table/body/section-row.svelte +0 -2
- package/dist/table/body/section-row.svelte.d.ts +0 -2
- package/dist/table/column-filter-menu.svelte +0 -3
- package/dist/table/column-filter-menu.svelte.d.ts +0 -3
- package/dist/table/column-filter.svelte +0 -2
- package/dist/table/column-filter.svelte.d.ts +0 -2
- package/dist/table/column-selection.svelte +1 -2
- package/dist/table/column-selection.svelte.d.ts +0 -1
- package/dist/table/column-sorter.svelte +1 -6
- package/dist/table/column-sorter.svelte.d.ts +1 -6
- package/dist/table/context.d.ts +0 -10
- package/dist/table/context.js +0 -1
- package/dist/table/custom-expand-icon.svelte +0 -2
- package/dist/table/custom-expand-icon.svelte.d.ts +0 -2
- package/dist/table/head-table.svelte +0 -1
- package/dist/table/head-table.svelte.d.ts +0 -1
- package/dist/table/interface.d.ts +2 -21
- package/dist/table/table-cell.svelte +0 -7
- package/dist/table/table-cell.svelte.d.ts +0 -7
- package/dist/table/table-header-row.svelte +0 -2
- package/dist/table/table-header-row.svelte.d.ts +0 -2
- package/dist/table/table-pagination.svelte +0 -2
- package/dist/table/table-pagination.svelte.d.ts +0 -2
- package/dist/table/table.svelte +0 -5
- package/dist/table/utils.d.ts +1 -13
- package/dist/table/utils.js +1 -11
- package/dist/tabs/index.js +0 -1
- package/dist/tabs/interface.d.ts +0 -13
- package/dist/tabs/tab-bar.svelte +0 -3
- package/dist/tabs/tab-bar.svelte.d.ts +0 -1
- package/dist/tabs/tab-pane.svelte +0 -2
- package/dist/tabs/tabs.svelte +0 -1
- package/dist/tag-input/interface.d.ts +0 -5
- package/dist/tag-input/tag-input.svelte +2 -3
- package/dist/tag-input/tag-item.svelte +0 -1
- package/dist/tag-input/tag-item.svelte.d.ts +0 -1
- package/dist/time-picker/combobox.svelte +0 -1
- package/dist/time-picker/interface.d.ts +0 -9
- package/dist/time-picker/time-picker.svelte +0 -2
- package/dist/timeline/interface.d.ts +0 -4
- package/dist/timeline/timeline.svelte +0 -1
- package/dist/toast/context.d.ts +0 -2
- package/dist/toast/interface.d.ts +0 -2
- package/dist/toast/static-api.js +0 -1
- package/dist/toast/toast.svelte +0 -1
- package/dist/toast/use-toast.js +0 -1
- package/dist/tooltip/context.d.ts +0 -2
- package/dist/tooltip/interface.d.ts +0 -2
- package/dist/tooltip/tooltip.svelte +0 -5
- package/dist/transfer/interface.d.ts +1 -8
- package/dist/transfer/transfer-selected-item.svelte +0 -1
- package/dist/transfer/transfer-selected-item.svelte.d.ts +0 -1
- package/dist/transfer/transfer.svelte +3 -3
- package/dist/tree/auto-sizer.svelte +0 -1
- package/dist/tree/context.d.ts +0 -1
- package/dist/tree/interface.d.ts +0 -9
- package/dist/tree/node-collapsible.svelte +0 -1
- package/dist/tree/node-list.svelte +0 -4
- package/dist/tree/tree-node.svelte +0 -1
- package/dist/tree/tree.svelte +5 -3
- package/dist/tree/use-tree-keyboard.svelte.d.ts +1 -8
- package/dist/tree/use-tree-keyboard.svelte.js +1 -6
- package/dist/tree-select/interface.d.ts +0 -11
- package/dist/tree-select/tree-select.svelte +0 -2
- package/dist/typography/base.svelte +0 -2
- package/dist/typography/index.js +0 -1
- package/dist/typography/interface.d.ts +0 -1
- package/dist/typography/internal.d.ts +0 -2
- package/dist/upload/file-card.svelte +0 -1
- package/dist/upload/index.js +0 -1
- package/dist/upload/interface.d.ts +0 -4
- package/dist/upload/upload.svelte +0 -1
- package/dist/user-guide/interface.d.ts +0 -1
- package/dist/user-guide/user-guide.svelte +0 -1
- package/dist/video-player/video-progress.svelte +0 -2
- package/package.json +3 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AutoCompleteProps } from '../auto-complete/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormAutoComplete: import("svelte").Component<FieldProps<AutoCompleteProps<import("..").AutoCompleteItems>>, {
|
|
3
|
+
declare const FormAutoComplete: import("svelte").Component<FieldProps<AutoCompleteProps<import("..").AutoCompleteItems>>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormAutoComplete = ReturnType<typeof FormAutoComplete>;
|
|
5
7
|
export default FormAutoComplete;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<CascaderProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={Cascader} />
|
|
16
|
+
<Field bind:this={field} {...props} component={Cascader} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CascaderProps } from '../cascader/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormCascader: import("svelte").Component<FieldProps<CascaderProps>, {
|
|
3
|
+
declare const FormCascader: import("svelte").Component<FieldProps<CascaderProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormCascader = ReturnType<typeof FormCascader>;
|
|
5
7
|
export default FormCascader;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<CheckboxGroupProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { insetLabel: false, validateStatus: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={CheckboxGroup} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={CheckboxGroup} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CheckboxGroupProps } from '../checkbox/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormCheckboxGroup: import("svelte").Component<FieldProps<CheckboxGroupProps>, {
|
|
3
|
+
declare const FormCheckboxGroup: import("svelte").Component<FieldProps<CheckboxGroupProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormCheckboxGroup = ReturnType<typeof FormCheckboxGroup>;
|
|
5
7
|
export default FormCheckboxGroup;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
let props: OptionalFieldProps<CheckboxProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
// Checkbox forwards native focus listeners to its input
|
|
10
12
|
const fieldOptions: WithFieldOption = { valueKey: 'checked', valuePath: 'target.checked', shouldInject: false, onBlurFnName: 'onblur', insetLabel: false, validateStatus: false };
|
|
13
|
+
|
|
14
|
+
export function getControl() {
|
|
15
|
+
return field?.getControl();
|
|
16
|
+
}
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
|
-
<Field {...props as OptionalFieldProps<CheckboxProps> & { field: string }} component={Checkbox} {fieldOptions} />
|
|
19
|
+
<Field bind:this={field} {...props as OptionalFieldProps<CheckboxProps> & { field: string }} component={Checkbox} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CheckboxProps } from '../checkbox/interface.js';
|
|
2
2
|
import type { OptionalFieldProps } from './interface.js';
|
|
3
|
-
declare const FormCheckbox: import("svelte").Component<OptionalFieldProps<CheckboxProps>, {
|
|
3
|
+
declare const FormCheckbox: import("svelte").Component<OptionalFieldProps<CheckboxProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormCheckbox = ReturnType<typeof FormCheckbox>;
|
|
5
7
|
export default FormCheckbox;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<DatePickerProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={DatePicker} />
|
|
16
|
+
<Field bind:this={field} {...props} component={DatePicker} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DatePickerProps } from '../date-picker/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormDatePicker: import("svelte").Component<FieldProps<DatePickerProps>, {
|
|
3
|
+
declare const FormDatePicker: import("svelte").Component<FieldProps<DatePickerProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormDatePicker = ReturnType<typeof FormDatePicker>;
|
|
5
7
|
export default FormDatePicker;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<InputNumberProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={InputNumber} />
|
|
16
|
+
<Field bind:this={field} {...props} component={InputNumber} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { InputNumberProps } from '../input-number/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormInputNumber: import("svelte").Component<FieldProps<InputNumberProps>, {
|
|
3
|
+
declare const FormInputNumber: import("svelte").Component<FieldProps<InputNumberProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormInputNumber = ReturnType<typeof FormInputNumber>;
|
|
5
7
|
export default FormInputNumber;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<InputProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={Input} />
|
|
16
|
+
<Field bind:this={field} {...props} component={Input} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { InputProps } from '../input/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormInput: import("svelte").Component<FieldProps<InputProps>, {
|
|
3
|
+
declare const FormInput: import("svelte").Component<FieldProps<InputProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormInput = ReturnType<typeof FormInput>;
|
|
5
7
|
export default FormInput;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<PinCodeProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { insetLabel: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={PinCode} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={PinCode} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PinCodeProps } from '../pincode/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormPinCode: import("svelte").Component<FieldProps<PinCodeProps>, {
|
|
3
|
+
declare const FormPinCode: import("svelte").Component<FieldProps<PinCodeProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormPinCode = ReturnType<typeof FormPinCode>;
|
|
5
7
|
export default FormPinCode;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<RadioGroupProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { valuePath: 'target.value', insetLabel: false, validateStatus: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={RadioGroup} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={RadioGroup} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RadioGroupProps } from '../radio/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormRadioGroup: import("svelte").Component<FieldProps<RadioGroupProps>, {
|
|
3
|
+
declare const FormRadioGroup: import("svelte").Component<FieldProps<RadioGroupProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormRadioGroup = ReturnType<typeof FormRadioGroup>;
|
|
5
7
|
export default FormRadioGroup;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
let props: OptionalFieldProps<RadioProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
// Radio forwards native focus listeners to its input
|
|
10
12
|
const fieldOptions: WithFieldOption = { valueKey: 'checked', valuePath: 'target.checked', shouldInject: false, onBlurFnName: 'onblur', insetLabel: false, validateStatus: false };
|
|
13
|
+
|
|
14
|
+
export function getControl() {
|
|
15
|
+
return field?.getControl();
|
|
16
|
+
}
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
|
-
<Field {...props as OptionalFieldProps<RadioProps> & { field: string }} component={Radio} {fieldOptions} />
|
|
19
|
+
<Field bind:this={field} {...props as OptionalFieldProps<RadioProps> & { field: string }} component={Radio} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RadioProps } from '../radio/interface.js';
|
|
2
2
|
import type { OptionalFieldProps } from './interface.js';
|
|
3
|
-
declare const FormRadio: import("svelte").Component<OptionalFieldProps<RadioProps>, {
|
|
3
|
+
declare const FormRadio: import("svelte").Component<OptionalFieldProps<RadioProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormRadio = ReturnType<typeof FormRadio>;
|
|
5
7
|
export default FormRadio;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<RatingProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { insetLabel: false, validateStatus: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={Rating} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={Rating} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RatingProps } from '../rating/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormRating: import("svelte").Component<FieldProps<RatingProps>, {
|
|
3
|
+
declare const FormRating: import("svelte").Component<FieldProps<RatingProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormRating = ReturnType<typeof FormRating>;
|
|
5
7
|
export default FormRating;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<SelectProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={Select} />
|
|
16
|
+
<Field bind:this={field} {...props} component={Select} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SelectProps } from '../select/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormSelect: import("svelte").Component<FieldProps<SelectProps>, {
|
|
3
|
+
declare const FormSelect: import("svelte").Component<FieldProps<SelectProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormSelect = ReturnType<typeof FormSelect>;
|
|
5
7
|
export default FormSelect;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<SliderProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { insetLabel: false, validateStatus: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={Slider} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={Slider} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SliderProps } from '../slider/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormSlider: import("svelte").Component<FieldProps<SliderProps>, {
|
|
3
|
+
declare const FormSlider: import("svelte").Component<FieldProps<SliderProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormSlider = ReturnType<typeof FormSlider>;
|
|
5
7
|
export default FormSlider;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<SwitchProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
// Switch forwards native focus listeners to its input
|
|
10
12
|
const fieldOptions: WithFieldOption = { valueKey: 'checked', onBlurFnName: 'onblur', insetLabel: false, validateStatus: false };
|
|
13
|
+
|
|
14
|
+
export function getControl() {
|
|
15
|
+
return field?.getControl();
|
|
16
|
+
}
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
|
-
<Field {...props} component={Switch} {fieldOptions} />
|
|
19
|
+
<Field bind:this={field} {...props} component={Switch} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SwitchProps } from '../switch/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormSwitch: import("svelte").Component<FieldProps<SwitchProps>, {
|
|
3
|
+
declare const FormSwitch: import("svelte").Component<FieldProps<SwitchProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormSwitch = ReturnType<typeof FormSwitch>;
|
|
5
7
|
export default FormSwitch;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<TagInputProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={TagInput} />
|
|
16
|
+
<Field bind:this={field} {...props} component={TagInput} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TagInputProps } from '../tag-input/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormTagInput: import("svelte").Component<FieldProps<TagInputProps>, {
|
|
3
|
+
declare const FormTagInput: import("svelte").Component<FieldProps<TagInputProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormTagInput = ReturnType<typeof FormTagInput>;
|
|
5
7
|
export default FormTagInput;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<TextAreaProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
const fieldOptions: WithFieldOption = { insetLabel: false };
|
|
12
|
+
|
|
13
|
+
export function getControl() {
|
|
14
|
+
return field?.getControl();
|
|
15
|
+
}
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
|
-
<Field {...props} component={TextArea} {fieldOptions} />
|
|
18
|
+
<Field bind:this={field} {...props} component={TextArea} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TextAreaProps } from '../input/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormTextArea: import("svelte").Component<FieldProps<TextAreaProps>, {
|
|
3
|
+
declare const FormTextArea: import("svelte").Component<FieldProps<TextAreaProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormTextArea = ReturnType<typeof FormTextArea>;
|
|
5
7
|
export default FormTextArea;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<TimePickerProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={TimePicker} />
|
|
16
|
+
<Field bind:this={field} {...props} component={TimePicker} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TimePickerProps } from '../time-picker/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormTimePicker: import("svelte").Component<FieldProps<TimePickerProps>, {
|
|
3
|
+
declare const FormTimePicker: import("svelte").Component<FieldProps<TimePickerProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormTimePicker = ReturnType<typeof FormTimePicker>;
|
|
5
7
|
export default FormTimePicker;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<TransferProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
// Transfer has no inset label or validateStatus
|
|
10
12
|
const fieldOptions: WithFieldOption = { insetLabel: false, validateStatus: false };
|
|
13
|
+
|
|
14
|
+
export function getControl() {
|
|
15
|
+
return field?.getControl();
|
|
16
|
+
}
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
|
-
<Field {...props} component={Transfer} {fieldOptions} />
|
|
19
|
+
<Field bind:this={field} {...props} component={Transfer} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TransferProps } from '../transfer/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormTransfer: import("svelte").Component<FieldProps<TransferProps>, {
|
|
3
|
+
declare const FormTransfer: import("svelte").Component<FieldProps<TransferProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormTransfer = ReturnType<typeof FormTransfer>;
|
|
5
7
|
export default FormTransfer;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { FieldProps } from './interface.js';
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<TreeSelectProps> = $props();
|
|
8
|
+
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
11
|
+
export function getControl() {
|
|
12
|
+
return field?.getControl();
|
|
13
|
+
}
|
|
8
14
|
</script>
|
|
9
15
|
|
|
10
|
-
<Field {...props} component={TreeSelect} />
|
|
16
|
+
<Field bind:this={field} {...props} component={TreeSelect} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TreeSelectProps } from '../tree-select/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormTreeSelect: import("svelte").Component<FieldProps<TreeSelectProps>, {
|
|
3
|
+
declare const FormTreeSelect: import("svelte").Component<FieldProps<TreeSelectProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormTreeSelect = ReturnType<typeof FormTreeSelect>;
|
|
5
7
|
export default FormTreeSelect;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
let props: FieldProps<UploadProps> = $props();
|
|
8
8
|
|
|
9
|
+
let field: ReturnType<typeof Field> | undefined;
|
|
10
|
+
|
|
9
11
|
// Upload reports `{ fileList, ... }`, so the value is read from it; it has no blur callback
|
|
10
12
|
const fieldOptions: WithFieldOption = { valueKey: 'fileList', valuePath: 'fileList', onBlurFnName: '', insetLabel: false };
|
|
13
|
+
|
|
14
|
+
export function getControl() {
|
|
15
|
+
return field?.getControl();
|
|
16
|
+
}
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
|
-
<Field {...props} component={Upload} {fieldOptions} />
|
|
19
|
+
<Field bind:this={field} {...props} component={Upload} {fieldOptions} />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { UploadProps } from '../upload/interface.js';
|
|
2
2
|
import type { FieldProps } from './interface.js';
|
|
3
|
-
declare const FormUpload: import("svelte").Component<FieldProps<UploadProps>, {
|
|
3
|
+
declare const FormUpload: import("svelte").Component<FieldProps<UploadProps>, {
|
|
4
|
+
getControl: () => Record<string, any> | undefined;
|
|
5
|
+
}, "">;
|
|
4
6
|
type FormUpload = ReturnType<typeof FormUpload>;
|
|
5
7
|
export default FormUpload;
|
package/dist/form/form.svelte
CHANGED
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
const uid = $props.id();
|
|
54
54
|
let formElement = $state<HTMLFormElement>();
|
|
55
55
|
|
|
56
|
-
// The props with their defaults resolved: the foundation reads them through getProps, the fields through the context
|
|
57
56
|
const formProps: FormProps<Values> = {
|
|
58
57
|
get initValues() {
|
|
59
58
|
return initValues;
|
package/dist/form/hooks.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { FieldError, FormApi, FormState } from './interface.js';
|
|
|
2
2
|
type FieldPath = string | (() => string);
|
|
3
3
|
/** The formApi of the enclosing Form; an empty object outside one. Call it during component initialisation. */
|
|
4
4
|
export declare function useFormApi<Values extends Record<string, any> = any>(): FormApi<Values>;
|
|
5
|
-
/**
|
|
5
|
+
/** An empty object outside a Form; call the result in the template to follow the state */
|
|
6
6
|
export declare function useFormState<Values extends Record<string, any> = any>(): () => FormState<Values>;
|
|
7
|
-
/** The formApi methods of one field; a getter path follows its changes */
|
|
8
7
|
export declare function useFieldApi(field: FieldPath): {
|
|
9
8
|
getError: () => any;
|
|
10
9
|
setError: (error: FieldError) => void;
|
package/dist/form/hooks.js
CHANGED
|
@@ -5,12 +5,11 @@ const readPath = (field) => (typeof field === 'function' ? field() : field);
|
|
|
5
5
|
export function useFormApi() {
|
|
6
6
|
return getFormContext()?.formApi ?? {};
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
8
|
+
/** An empty object outside a Form; call the result in the template to follow the state */
|
|
9
9
|
export function useFormState() {
|
|
10
10
|
const form = getFormContext();
|
|
11
11
|
return () => form?.formState ?? {};
|
|
12
12
|
}
|
|
13
|
-
/** The formApi methods of one field; a getter path follows its changes */
|
|
14
13
|
export function useFieldApi(field) {
|
|
15
14
|
const formApi = useFormApi();
|
|
16
15
|
return {
|
package/dist/form/interface.d.ts
CHANGED
|
@@ -16,14 +16,11 @@ export type FieldValidateResult = FieldError;
|
|
|
16
16
|
export interface LabelProps extends Omit<HTMLLabelAttributes, 'children'> {
|
|
17
17
|
/** Content of the label; the `children` snippet takes precedence */
|
|
18
18
|
text?: string | number;
|
|
19
|
-
/** text-align of the label */
|
|
20
19
|
align?: string;
|
|
21
20
|
disabled?: boolean;
|
|
22
21
|
/** Whether to display the required * symbol; hidden while `optional` is true */
|
|
23
22
|
required?: boolean;
|
|
24
|
-
/** Appends the locale's optional text */
|
|
25
23
|
optional?: boolean;
|
|
26
|
-
/** The id of the labeled field, written to the `for` attribute */
|
|
27
24
|
name?: string;
|
|
28
25
|
/** Width of the label; a number is in px */
|
|
29
26
|
width?: number | string;
|
|
@@ -68,7 +65,6 @@ export interface FormProps<Values extends Record<string, any> = any> extends Omi
|
|
|
68
65
|
};
|
|
69
66
|
/** Form-level validation; when set, it replaces the fields' own validation */
|
|
70
67
|
validator?: (values: Values) => FormValidateResult<Values> | Promise<FormValidateResult<Values>>;
|
|
71
|
-
/** The `formApi` returned by `useForm()` */
|
|
72
68
|
form?: FormApi<Values>;
|
|
73
69
|
/** Also written to `x-form-id`; generated when missing */
|
|
74
70
|
id?: string;
|
|
@@ -121,12 +117,10 @@ export interface CommonFieldProps {
|
|
|
121
117
|
id?: string;
|
|
122
118
|
fieldClassName?: string;
|
|
123
119
|
fieldStyle?: string;
|
|
124
|
-
/** Replaces the label text */
|
|
125
120
|
fieldLabel?: Snippet;
|
|
126
121
|
labelExtra?: Snippet;
|
|
127
122
|
/** Shown in the error message's place while the field has no error */
|
|
128
123
|
helpText?: Snippet;
|
|
129
|
-
/** Shown together with the error or the help text */
|
|
130
124
|
extraText?: Snippet;
|
|
131
125
|
/** Renders the error; the default joins the messages with commas */
|
|
132
126
|
error?: Snippet<[{
|
|
@@ -219,7 +213,6 @@ export interface SlotProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
219
213
|
noLabel?: boolean;
|
|
220
214
|
error?: FieldError;
|
|
221
215
|
children?: Snippet;
|
|
222
|
-
/** Replaces the label text */
|
|
223
216
|
fieldLabel?: Snippet;
|
|
224
217
|
labelExtra?: Snippet;
|
|
225
218
|
errorContent?: Snippet<[{
|
package/dist/form/utils.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare function omitFieldProps(props: Record<string, unknown>): {
|
|
|
4
4
|
};
|
|
5
5
|
/** Deep clone that keeps functions, DOM nodes and errors as they are; the server has no DOM nodes to keep */
|
|
6
6
|
export declare function cloneDeep<T>(value: T): T;
|
|
7
|
-
/** Whether an error has content ErrorMessage renders; a number or a boolean does not */
|
|
8
7
|
export declare function hasErrorContent(error: unknown): boolean;
|
|
9
8
|
export declare function errorText(error: FieldError): string;
|
|
10
9
|
export declare function isLabelConfig<L extends FieldLabel>(label?: string | number | L): label is L;
|
package/dist/form/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { untrack } from 'svelte';
|
|
2
2
|
import { cloneFormValue } from '@fibrae/semi-foundation/form/utils';
|
|
3
|
-
/** The props a field consumes itself; a bare Checkbox or Radio drops them, except id and name */
|
|
4
3
|
const fieldOnlyKeys = new Set([
|
|
5
4
|
'allowEmpty',
|
|
6
5
|
'allowEmptyString',
|
|
@@ -40,7 +39,6 @@ export function omitFieldProps(props) {
|
|
|
40
39
|
export function cloneDeep(value) {
|
|
41
40
|
return cloneFormValue(value, (item) => typeof Node !== 'undefined' && item instanceof Node);
|
|
42
41
|
}
|
|
43
|
-
/** Whether an error has content ErrorMessage renders; a number or a boolean does not */
|
|
44
42
|
export function hasErrorContent(error) {
|
|
45
43
|
if (Array.isArray(error)) {
|
|
46
44
|
return error.some(Boolean);
|
|
@@ -15,6 +15,5 @@ export interface HighlightProps {
|
|
|
15
15
|
/** Camel-case or kebab-case keys; numbers are written as-is, so lengths need a unit string */
|
|
16
16
|
highlightStyle?: HighlightStyle;
|
|
17
17
|
highlightClassName?: string;
|
|
18
|
-
/** Tag of each highlighted chunk */
|
|
19
18
|
component?: string;
|
|
20
19
|
}
|
|
@@ -2,7 +2,6 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
2
2
|
export interface HotKeysProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Keys that must be pressed together: any number of modifiers and exactly one other key */
|
|
4
4
|
hotKeys: KeyboardEvent['key'][];
|
|
5
|
-
/** Shown instead of `hotKeys` */
|
|
6
5
|
content?: string[];
|
|
7
6
|
preventDefault?: boolean;
|
|
8
7
|
/** Element that listens for keydown; defaults to document.body */
|