@antdv-next1/pro-field 1.0.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/LICENSE +21 -0
- package/dist/FieldHOC/index.d.ts +16 -0
- package/dist/FieldHOC/index.js +51 -0
- package/dist/ProField.d.ts +18 -0
- package/dist/ProField.js +417 -0
- package/dist/ProPureField.d.ts +10 -0
- package/dist/ProPureField.js +222 -0
- package/dist/ValueTypeToComponent.d.ts +6 -0
- package/dist/ValueTypeToComponent.js +442 -0
- package/dist/components/Cascader/index.d.ts +40 -0
- package/dist/components/Cascader/index.js +202 -0
- package/dist/components/Checkbox/index.d.ts +37 -0
- package/dist/components/Checkbox/index.js +149 -0
- package/dist/components/Checkbox/style/index.d.ts +11 -0
- package/dist/components/Checkbox/style/index.js +26 -0
- package/dist/components/Code/index.d.ts +34 -0
- package/dist/components/Code/index.js +125 -0
- package/dist/components/ColorPicker/index.d.ts +22 -0
- package/dist/components/ColorPicker/index.js +278 -0
- package/dist/components/DatePicker/index.d.ts +27 -0
- package/dist/components/DatePicker/index.js +171 -0
- package/dist/components/Digit/index.d.ts +27 -0
- package/dist/components/Digit/index.js +159 -0
- package/dist/components/DigitRange/index.d.ts +48 -0
- package/dist/components/DigitRange/index.js +197 -0
- package/dist/components/FromNow/index.d.ts +23 -0
- package/dist/components/FromNow/index.js +123 -0
- package/dist/components/Image/index.d.ts +23 -0
- package/dist/components/Image/index.js +119 -0
- package/dist/components/IndexColumn/index.d.ts +13 -0
- package/dist/components/IndexColumn/index.js +30 -0
- package/dist/components/IndexColumn/style/index.d.ts +11 -0
- package/dist/components/IndexColumn/style/index.js +29 -0
- package/dist/components/Money/InputNumberPopover.d.ts +120 -0
- package/dist/components/Money/InputNumberPopover.js +345 -0
- package/dist/components/Money/index.d.ts +303 -0
- package/dist/components/Money/index.js +274 -0
- package/dist/components/Options/index.d.ts +18 -0
- package/dist/components/Options/index.js +120 -0
- package/dist/components/Password/index.d.ts +33 -0
- package/dist/components/Password/index.js +137 -0
- package/dist/components/Percent/index.d.ts +45 -0
- package/dist/components/Percent/index.js +171 -0
- package/dist/components/Percent/util.d.ts +10 -0
- package/dist/components/Percent/util.js +22 -0
- package/dist/components/Progress/index.d.ts +22 -0
- package/dist/components/Progress/index.js +124 -0
- package/dist/components/Radio/index.d.ts +36 -0
- package/dist/components/Radio/index.js +138 -0
- package/dist/components/Radio/style/index.d.ts +11 -0
- package/dist/components/Radio/style/index.js +21 -0
- package/dist/components/RangePicker/DatePicker.d.ts +29 -0
- package/dist/components/RangePicker/DatePicker.js +189 -0
- package/dist/components/RangePicker/TimePicker.d.ts +25 -0
- package/dist/components/RangePicker/TimePicker.js +177 -0
- package/dist/components/RangePicker/index.d.ts +3 -0
- package/dist/components/RangePicker/index.js +3 -0
- package/dist/components/Rate/index.d.ts +19 -0
- package/dist/components/Rate/index.js +98 -0
- package/dist/components/Second/index.d.ts +28 -0
- package/dist/components/Second/index.js +151 -0
- package/dist/components/Segmented/index.d.ts +36 -0
- package/dist/components/Segmented/index.js +138 -0
- package/dist/components/Select/Highlight/index.d.ts +14 -0
- package/dist/components/Select/Highlight/index.js +46 -0
- package/dist/components/Select/Highlight/style/index.d.ts +12 -0
- package/dist/components/Select/Highlight/style/index.js +24 -0
- package/dist/components/Select/LightSelect/index.d.ts +45 -0
- package/dist/components/Select/LightSelect/index.js +621 -0
- package/dist/components/Select/LightSelect/style/index.d.ts +11 -0
- package/dist/components/Select/LightSelect/style/index.js +28 -0
- package/dist/components/Select/SearchSelect/index.d.ts +78 -0
- package/dist/components/Select/SearchSelect/index.js +273 -0
- package/dist/components/Select/index.d.ts +67 -0
- package/dist/components/Select/index.js +357 -0
- package/dist/components/Slider/index.d.ts +18 -0
- package/dist/components/Slider/index.js +99 -0
- package/dist/components/Status/index.d.ts +31 -0
- package/dist/components/Status/index.js +71 -0
- package/dist/components/Switch/index.d.ts +31 -0
- package/dist/components/Switch/index.js +132 -0
- package/dist/components/Text/index.d.ts +37 -0
- package/dist/components/Text/index.js +146 -0
- package/dist/components/TextArea/index.d.ts +25 -0
- package/dist/components/TextArea/index.js +117 -0
- package/dist/components/TextArea/readonly/index.d.ts +17 -0
- package/dist/components/TextArea/readonly/index.js +20 -0
- package/dist/components/TextArea/readonly/style/index.d.ts +11 -0
- package/dist/components/TextArea/readonly/style/index.js +20 -0
- package/dist/components/TimePicker/index.d.ts +23 -0
- package/dist/components/TimePicker/index.js +153 -0
- package/dist/components/TreeSelect/index.d.ts +45 -0
- package/dist/components/TreeSelect/index.js +762 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +33 -0
- package/dist/pro-field.esm.js +72945 -0
- package/dist/pro-field.js +214 -0
- package/dist/typing.d.ts +28 -0
- package/dist/typing.js +1 -0
- package/dist/utils/useFieldExpose.d.ts +7 -0
- package/dist/utils/useFieldExpose.js +9 -0
- package/package.json +63 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProFieldFC } from "../../typing.js";
|
|
2
|
+
import { FieldSelectProps } from "../Select/index.js";
|
|
3
|
+
import * as _$vue from "vue";
|
|
4
|
+
import { CSSProperties } from "vue";
|
|
5
|
+
import * as _$_antdv_next1_pro_provider0 from "@antdv-next1/pro-provider";
|
|
6
|
+
import { SegmentedProps } from "antdv-next";
|
|
7
|
+
import { CustomSlotsType } from "@v-c/util/dist/type";
|
|
8
|
+
import { VueNode as VueNode$1 } from "antdv-next/dist/_util/type";
|
|
9
|
+
|
|
10
|
+
//#region src/components/Segmented/index.d.ts
|
|
11
|
+
type FieldSegmentedProps = ProFieldFC<{
|
|
12
|
+
options?: SegmentedProps['options'];
|
|
13
|
+
emptyText?: VueNode$1;
|
|
14
|
+
}, SegmentedProps & {
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
layout?: 'horizontal' | 'vertical';
|
|
18
|
+
}> & Omit<FieldSelectProps, 'variant' | 'fieldProps' | 'id' | 'label' | 'labelTrigger' | 'lightLabel' | 'light' | 'plain'>;
|
|
19
|
+
declare const FieldSegmented: _$vue.DefineSetupFnComponent<FieldSegmentedProps, {}, CustomSlotsType<{
|
|
20
|
+
default?: () => VueNode$1;
|
|
21
|
+
}>, _$_antdv_next1_pro_provider0.BaseProFieldFC<SegmentedProps & {
|
|
22
|
+
class?: string;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
layout?: "horizontal" | "vertical";
|
|
25
|
+
}> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<SegmentedProps & {
|
|
26
|
+
class?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
layout?: "horizontal" | "vertical";
|
|
29
|
+
}> & {
|
|
30
|
+
options?: SegmentedProps["options"];
|
|
31
|
+
emptyText?: VueNode$1;
|
|
32
|
+
} & {
|
|
33
|
+
id?: string;
|
|
34
|
+
} & Omit<FieldSelectProps, "id" | "variant" | "fieldProps" | "light" | "label" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { FieldSegmentedProps, FieldSegmented as default };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useFieldFetchData } from "../Select/index.js";
|
|
2
|
+
import { Fragment, createVNode, defineComponent, mergeProps, ref } from "vue";
|
|
3
|
+
import { objectToMap, proFieldParsingText } from "@antdv-next1/pro-utils";
|
|
4
|
+
import { Segmented, Spin } from "antdv-next";
|
|
5
|
+
//#region src/components/Segmented/index.tsx
|
|
6
|
+
const FieldSegmented = /* @__PURE__ */ defineComponent((props, { expose }) => {
|
|
7
|
+
const inputRef = ref();
|
|
8
|
+
const [loading, options, fetchData] = useFieldFetchData(props);
|
|
9
|
+
expose({ fetchData: (keyWord) => fetchData(keyWord) });
|
|
10
|
+
return () => {
|
|
11
|
+
const { mode, render, formItemRender, options: propsOptions, fieldProps, emptyText = "-", ...rest } = props;
|
|
12
|
+
if (loading.value) return createVNode(Spin, { "size": "small" }, null);
|
|
13
|
+
if (mode === "read") {
|
|
14
|
+
const optionsValueEnum = options.value?.length ? options.value?.reduce((pre, cur) => {
|
|
15
|
+
return {
|
|
16
|
+
...pre,
|
|
17
|
+
[cur.value ?? ""]: cur.label
|
|
18
|
+
};
|
|
19
|
+
}, {}) : void 0;
|
|
20
|
+
const dom = createVNode(Fragment, null, [proFieldParsingText(rest.text, objectToMap(rest.valueEnum || optionsValueEnum))]);
|
|
21
|
+
if (render) return createVNode(Fragment, null, [render(rest.text, {
|
|
22
|
+
mode,
|
|
23
|
+
...rest,
|
|
24
|
+
fieldProps
|
|
25
|
+
}, createVNode(Fragment, null, [dom])) ?? emptyText]);
|
|
26
|
+
return dom;
|
|
27
|
+
}
|
|
28
|
+
if (mode === "edit" || mode === "update") {
|
|
29
|
+
const dom = createVNode(Segmented, mergeProps({ "ref": inputRef }, fieldProps, { "options": options.value }), null);
|
|
30
|
+
if (formItemRender) return createVNode(Fragment, null, [formItemRender(rest.text, {
|
|
31
|
+
mode,
|
|
32
|
+
...rest,
|
|
33
|
+
fieldProps,
|
|
34
|
+
options: options.value,
|
|
35
|
+
loading: loading.value
|
|
36
|
+
}, dom)]);
|
|
37
|
+
return dom;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
props: {
|
|
43
|
+
text: {
|
|
44
|
+
type: [
|
|
45
|
+
Object,
|
|
46
|
+
Function,
|
|
47
|
+
String,
|
|
48
|
+
Number,
|
|
49
|
+
null,
|
|
50
|
+
Boolean,
|
|
51
|
+
Array
|
|
52
|
+
],
|
|
53
|
+
required: false,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
"onUpdate:text": {
|
|
57
|
+
type: Function,
|
|
58
|
+
required: false
|
|
59
|
+
},
|
|
60
|
+
fieldProps: {
|
|
61
|
+
type: Object,
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
mode: {
|
|
65
|
+
type: String,
|
|
66
|
+
required: false
|
|
67
|
+
},
|
|
68
|
+
light: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
label: {
|
|
74
|
+
type: [
|
|
75
|
+
Object,
|
|
76
|
+
Function,
|
|
77
|
+
String,
|
|
78
|
+
Number,
|
|
79
|
+
null,
|
|
80
|
+
Boolean,
|
|
81
|
+
Array
|
|
82
|
+
],
|
|
83
|
+
required: false,
|
|
84
|
+
default: void 0
|
|
85
|
+
},
|
|
86
|
+
valueEnum: {
|
|
87
|
+
type: [Object, Map],
|
|
88
|
+
required: false
|
|
89
|
+
},
|
|
90
|
+
proFieldKey: {
|
|
91
|
+
type: [String, Number],
|
|
92
|
+
required: false
|
|
93
|
+
},
|
|
94
|
+
render: {
|
|
95
|
+
type: Function,
|
|
96
|
+
required: false
|
|
97
|
+
},
|
|
98
|
+
formItemRender: {
|
|
99
|
+
type: Function,
|
|
100
|
+
required: false
|
|
101
|
+
},
|
|
102
|
+
options: { required: false },
|
|
103
|
+
emptyText: {
|
|
104
|
+
type: [
|
|
105
|
+
Object,
|
|
106
|
+
Function,
|
|
107
|
+
String,
|
|
108
|
+
Number,
|
|
109
|
+
null,
|
|
110
|
+
Boolean,
|
|
111
|
+
Array
|
|
112
|
+
],
|
|
113
|
+
required: false,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
id: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: false
|
|
119
|
+
},
|
|
120
|
+
debounceTime: {
|
|
121
|
+
type: Number,
|
|
122
|
+
required: false
|
|
123
|
+
},
|
|
124
|
+
request: {
|
|
125
|
+
type: Function,
|
|
126
|
+
required: false
|
|
127
|
+
},
|
|
128
|
+
params: { required: false },
|
|
129
|
+
defaultKeyWords: {
|
|
130
|
+
type: String,
|
|
131
|
+
required: false
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
name: "FieldSegmented",
|
|
135
|
+
inheritAttrs: false
|
|
136
|
+
});
|
|
137
|
+
//#endregion
|
|
138
|
+
export { FieldSegmented as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import { VueNode } from "@antdv-next1/pro-utils";
|
|
3
|
+
import { CustomSlotsType } from "@v-c/util/dist/type";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Select/Highlight/index.d.ts
|
|
6
|
+
interface HighlightProps {
|
|
7
|
+
label: string;
|
|
8
|
+
words: string[];
|
|
9
|
+
}
|
|
10
|
+
declare const Highlight: _$vue.DefineSetupFnComponent<HighlightProps, {}, CustomSlotsType<{
|
|
11
|
+
default?: () => VueNode;
|
|
12
|
+
}>, HighlightProps & {}, _$vue.PublicProps>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { HighlightProps, Highlight as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useStyle } from "./style/index.js";
|
|
2
|
+
import { computed, createVNode, defineComponent, h } from "vue";
|
|
3
|
+
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
4
|
+
//#region src/components/Select/Highlight/index.tsx
|
|
5
|
+
const Highlight = /* @__PURE__ */ defineComponent((props) => {
|
|
6
|
+
const config = useConfig();
|
|
7
|
+
const lightCls = computed(() => config.value.getPrefixCls("pro-select-item-option-content-light"));
|
|
8
|
+
const optionCls = computed(() => config.value.getPrefixCls("pro-select-item-option-content"));
|
|
9
|
+
const { wrapSSR } = useStyle(lightCls, optionCls);
|
|
10
|
+
const matchKeywordsRE = computed(() => new RegExp(props.words?.map((word) => word.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&")).join("|"), "gi"));
|
|
11
|
+
const elements = computed(() => {
|
|
12
|
+
let matchText = props.label;
|
|
13
|
+
const vnodes = [];
|
|
14
|
+
while (matchText?.length) {
|
|
15
|
+
const match = matchKeywordsRE.value.exec(matchText);
|
|
16
|
+
if (!match) {
|
|
17
|
+
vnodes.push(matchText);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
const start = match.index;
|
|
21
|
+
const matchLength = match[0].length + start;
|
|
22
|
+
vnodes.push(matchText.slice(0, start), h("span", { class: lightCls.value }, matchText.slice(start, matchLength)));
|
|
23
|
+
matchText = matchText.slice(matchLength);
|
|
24
|
+
}
|
|
25
|
+
return vnodes;
|
|
26
|
+
});
|
|
27
|
+
return () => wrapSSR(createVNode("div", {
|
|
28
|
+
"title": props.label,
|
|
29
|
+
"class": optionCls.value
|
|
30
|
+
}, [elements.value]));
|
|
31
|
+
}, {
|
|
32
|
+
props: {
|
|
33
|
+
label: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
words: {
|
|
38
|
+
type: Array,
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
name: "FieldSelectHighlight",
|
|
43
|
+
inheritAttrs: false
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Highlight as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRef } from "vue";
|
|
2
|
+
import * as _$_antdv_next1_pro_provider0 from "@antdv-next1/pro-provider";
|
|
3
|
+
import { ProAliasToken } from "@antdv-next1/pro-provider";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Select/Highlight/style/index.d.ts
|
|
6
|
+
interface ProToken extends ProAliasToken {
|
|
7
|
+
lightCls: string;
|
|
8
|
+
optionCls: string;
|
|
9
|
+
}
|
|
10
|
+
declare function useStyle(lightCls: ComputedRef<string>, optionCls: ComputedRef<string>): _$_antdv_next1_pro_provider0.UseStyleResult;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ProToken, useStyle };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useStyle as useStyle$1 } from "@antdv-next1/pro-provider";
|
|
2
|
+
//#region src/components/Select/Highlight/style/index.ts
|
|
3
|
+
const genProStyle = (token) => {
|
|
4
|
+
return {
|
|
5
|
+
[token.lightCls]: { color: token.colorPrimary },
|
|
6
|
+
[token.optionCls]: {
|
|
7
|
+
flex: "auto",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
whiteSpace: "nowrap",
|
|
10
|
+
textOverflow: "ellipsis"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
function useStyle(lightCls, optionCls) {
|
|
15
|
+
return useStyle$1("Highlight", (token) => {
|
|
16
|
+
return [genProStyle({
|
|
17
|
+
...token,
|
|
18
|
+
lightCls: `.${lightCls.value}`,
|
|
19
|
+
optionCls: `.${optionCls.value}`
|
|
20
|
+
})];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useStyle };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ProFieldLightProps } from "../../../typing.js";
|
|
2
|
+
import * as _$vue from "vue";
|
|
3
|
+
import { SelectProps } from "antdv-next";
|
|
4
|
+
import { VueNode } from "@v-c/util";
|
|
5
|
+
import { CustomSlotsType } from "@v-c/util/dist/type";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Select/LightSelect/index.d.ts
|
|
8
|
+
type LightSelectProps = {
|
|
9
|
+
label?: VueNode;
|
|
10
|
+
valueMaxLength?: number; /** 刷新数据 */
|
|
11
|
+
fetchData: (keyWord?: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* 当搜索关键词发生变化时是否请求远程数据
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
fetchDataOnSearch?: boolean; /** 变体类型 */
|
|
18
|
+
variant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
|
|
19
|
+
/**
|
|
20
|
+
* 搜索展位符
|
|
21
|
+
*/
|
|
22
|
+
searchPlaceholder?: string;
|
|
23
|
+
labelVariant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
|
|
24
|
+
} & ProFieldLightProps & SelectProps;
|
|
25
|
+
declare const LightSelect: _$vue.DefineSetupFnComponent<LightSelectProps, {}, CustomSlotsType<{
|
|
26
|
+
default?: () => VueNode;
|
|
27
|
+
}>, {
|
|
28
|
+
label?: VueNode;
|
|
29
|
+
valueMaxLength?: number; /** 刷新数据 */
|
|
30
|
+
fetchData: (keyWord?: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* 当搜索关键词发生变化时是否请求远程数据
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
fetchDataOnSearch?: boolean; /** 变体类型 */
|
|
37
|
+
variant?: "outlined" | "borderless" | "filled" | "underlined";
|
|
38
|
+
/**
|
|
39
|
+
* 搜索展位符
|
|
40
|
+
*/
|
|
41
|
+
searchPlaceholder?: string;
|
|
42
|
+
labelVariant?: "outlined" | "borderless" | "filled" | "underlined";
|
|
43
|
+
} & ProFieldLightProps & SelectProps & {}, _$vue.PublicProps>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { LightSelectProps, LightSelect as default };
|