@xn-lib/component 0.1.35 → 0.1.36

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.
@@ -12,7 +12,8 @@ import XnTextRuleConfig from './text-rule-config';
12
12
  import XnFormList from './form-list/index';
13
13
  import XnTable from './table/index';
14
14
  import XnModal from './modal/index';
15
- export { XnCascader, XnTag, XnTransfer, XnVirtualList, XnEllipsis, XnEditableText, XnEditableTextarea, XnTimeRangePicker, XnTextRuleConfig, XnFormList, XnTable, XnModal };
15
+ import XnSelectInput from './select-input/index';
16
+ export { XnCascader, XnTag, XnTransfer, XnVirtualList, XnEllipsis, XnEditableText, XnEditableTextarea, XnTimeRangePicker, XnTextRuleConfig, XnFormList, XnTable, XnModal, XnSelectInput };
16
17
  export declare const components: Record<string, Component>;
17
18
  export type { CascaderProps } from './cascader/props';
18
19
  export type { TagProps } from './tag/props';
@@ -22,6 +23,8 @@ export type { EditableTextareaProps } from './editable-textarea/props';
22
23
  export type { TimeRangePickerProps, TimeRangeValue, TimeRange } from './time-range-picker/props';
23
24
  export type { TextRuleConfigProps } from './text-rule-config/props';
24
25
  export type { FormListProps, FormListRow, FormListDefaultRow } from './form-list/props';
26
+ export type { SelectInputProps } from './select-input/props';
27
+ export type { SelectInputValue, SelectInputInst } from './types/select-input';
25
28
  export { useFormList, useFormListActions, useFormListLayout, useFormListRowForms, useFormListUidSync, generateUid, cssLength, getFormListRowKey, ensureRowUids, stripUidRow } from './form-list/index';
26
29
  export type { FormListExpose, FormListSubmitRow, RowKeyOptions, UseFormListOptions, UseFormListReturn } from './form-list/index';
27
30
  export * from './types';
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from 'vue';
2
+ import SelectInputComponent from './index.vue';
3
+ declare const SelectInput: typeof SelectInputComponent & Plugin;
4
+ export default SelectInput;
@@ -0,0 +1,59 @@
1
+ import type { SelectInputValue } from '../types/select-input';
2
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ readonly modelValue: {
4
+ readonly type: import("vue").PropType<import("./props").SelectInputValue>;
5
+ readonly default: () => {
6
+ input: string;
7
+ select: string;
8
+ };
9
+ };
10
+ readonly options: {
11
+ readonly type: import("vue").PropType<any[]>;
12
+ readonly default: () => never[];
13
+ };
14
+ readonly stripWhitespace: {
15
+ readonly type: BooleanConstructor;
16
+ readonly default: false;
17
+ };
18
+ readonly placeholder: {
19
+ readonly type: StringConstructor;
20
+ readonly default: undefined;
21
+ };
22
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ input: (val: SelectInputValue) => any;
24
+ search: (val: SelectInputValue) => any;
25
+ "update:modelValue": (val: SelectInputValue) => any;
26
+ change: (val: SelectInputValue) => any;
27
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
+ readonly modelValue: {
29
+ readonly type: import("vue").PropType<import("./props").SelectInputValue>;
30
+ readonly default: () => {
31
+ input: string;
32
+ select: string;
33
+ };
34
+ };
35
+ readonly options: {
36
+ readonly type: import("vue").PropType<any[]>;
37
+ readonly default: () => never[];
38
+ };
39
+ readonly stripWhitespace: {
40
+ readonly type: BooleanConstructor;
41
+ readonly default: false;
42
+ };
43
+ readonly placeholder: {
44
+ readonly type: StringConstructor;
45
+ readonly default: undefined;
46
+ };
47
+ }>> & Readonly<{
48
+ onInput?: ((val: SelectInputValue) => any) | undefined;
49
+ onSearch?: ((val: SelectInputValue) => any) | undefined;
50
+ "onUpdate:modelValue"?: ((val: SelectInputValue) => any) | undefined;
51
+ onChange?: ((val: SelectInputValue) => any) | undefined;
52
+ }>, {
53
+ readonly modelValue: import("./props").SelectInputValue;
54
+ readonly placeholder: string;
55
+ readonly options: any[];
56
+ readonly stripWhitespace: boolean;
57
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
58
+ declare const _default: typeof __VLS_export;
59
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import type { PropType, ExtractPropTypes } from 'vue';
2
+ export interface SelectInputValue {
3
+ input: string;
4
+ select: string;
5
+ }
6
+ export declare const selectInputProps: {
7
+ /** 绑定值 */
8
+ readonly modelValue: {
9
+ readonly type: PropType<SelectInputValue>;
10
+ readonly default: () => {
11
+ input: string;
12
+ select: string;
13
+ };
14
+ };
15
+ /** 选择框选项 */
16
+ readonly options: {
17
+ readonly type: PropType<any[]>;
18
+ readonly default: () => never[];
19
+ };
20
+ /** 是否移除输入框值中的空格,默认 false */
21
+ readonly stripWhitespace: {
22
+ readonly type: BooleanConstructor;
23
+ readonly default: false;
24
+ };
25
+ /** 输入框占位符 */
26
+ readonly placeholder: {
27
+ readonly type: StringConstructor;
28
+ readonly default: undefined;
29
+ };
30
+ };
31
+ export type SelectInputProps = Readonly<ExtractPropTypes<typeof selectInputProps>>;
@@ -0,0 +1,10 @@
1
+ import { Option } from "../types";
2
+ /**
3
+ * 计算选择框宽度
4
+ * @param options 选择框选项
5
+ * @param paddingWidth 选项 padding 宽度
6
+ * @returns 选择框宽度
7
+ * */
8
+ export declare function useCalcSelectWidth(options: Option[], paddingWidth?: number): {
9
+ maxWidth: import("vue").Ref<number, number>;
10
+ };
@@ -110,7 +110,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
110
110
  readonly default: () => never[];
111
111
  };
112
112
  }>, TableInst, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
113
- search: (params: Record<string, any>) => any;
113
+ search: (params: Record<string, any>, searchParams: Record<string, any>) => any;
114
114
  reset: () => any;
115
115
  "selection-change": (selection: any[]) => any;
116
116
  "page-change": (page: number) => any;
@@ -217,7 +217,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
217
217
  readonly default: () => never[];
218
218
  };
219
219
  }>> & Readonly<{
220
- onSearch?: ((params: Record<string, any>) => any) | undefined;
220
+ onSearch?: ((params: Record<string, any>, searchParams: Record<string, any>) => any) | undefined;
221
221
  onReset?: (() => any) | undefined;
222
222
  "onSelection-change"?: ((selection: any[]) => any) | undefined;
223
223
  "onPage-change"?: ((page: number) => any) | undefined;
@@ -0,0 +1,7 @@
1
+ export interface SelectInputValue {
2
+ input: string;
3
+ select: string;
4
+ }
5
+ export interface SelectInputInst {
6
+ focus: () => void;
7
+ }
@@ -6,7 +6,7 @@ export type AlignType = typeof TableAlign.Left.value | typeof TableAlign.Center.
6
6
  export type FixedType = boolean | typeof TableFixed.Left.value | typeof TableFixed.Right.value;
7
7
  export type SizeType = typeof TableSize.Large.value | typeof TableSize.Default.value | typeof TableSize.Small.value;
8
8
  export type ButtonTypeValue = typeof ButtonType.Primary.value | typeof ButtonType.Success.value | typeof ButtonType.Warning.value | typeof ButtonType.Danger.value | typeof ButtonType.Info.value | typeof ButtonType.Text.value;
9
- export type SearchTypeValue = typeof SearchType.Input.value | typeof SearchType.Select.value | typeof SearchType.Date.value | typeof SearchType.DateRange.value | typeof SearchType.DateTimeRange.value | typeof SearchType.Cascader.value | typeof SearchType.Custom.value;
9
+ export type SearchTypeValue = typeof SearchType.Input.value | typeof SearchType.Select.value | typeof SearchType.Date.value | typeof SearchType.DateRange.value | typeof SearchType.DateTimeRange.value | typeof SearchType.Cascader.value | typeof SearchType.Custom.value | typeof SearchType.SelectInput.value;
10
10
  export type SelectionTypeValue = typeof SelectionType.Single.value | typeof SelectionType.Multiple.value;
11
11
  export interface ConfirmConfig {
12
12
  /** 确认消息 */
@@ -188,10 +188,21 @@ export interface SearchConfig {
188
188
  attrs?: Record<string, any>;
189
189
  /** 日期格式(date/daterange/datetimerange 时有效) */
190
190
  format?: string;
191
+ stripWhitespace?: boolean;
191
192
  /** 值变化事件 */
192
193
  onChange?: (value: any) => void;
193
194
  /** 自定义渲染(type=custom 时) */
194
195
  render?: (config: SearchConfig, model: Record<string, any>, setModel: (key: string, value: any) => void) => VNode;
196
+ /**
197
+ * 日期范围字段映射(daterange/datetimerange 时有效)
198
+ * 传入如 ['start', 'end'],则返回 { start: 开始时间, end: 结束时间 }
199
+ */
200
+ rangeKeys?: [string, string];
201
+ /**
202
+ * select-input 类型时,是否格式化为 "select值: input值" 格式
203
+ * 默认为 false,即返回 { input: string, select: string } 对象
204
+ */
205
+ combineValue?: boolean;
195
206
  }
196
207
  export interface DropdownItem {
197
208
  /** 唯一标识 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xn-lib/component",
4
- "version": "0.1.35",
4
+ "version": "0.1.36",
5
5
  "description": "",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.mjs",