@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.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/dist/FieldHOC/index.d.ts +16 -0
  3. package/dist/FieldHOC/index.js +51 -0
  4. package/dist/ProField.d.ts +18 -0
  5. package/dist/ProField.js +417 -0
  6. package/dist/ProPureField.d.ts +10 -0
  7. package/dist/ProPureField.js +222 -0
  8. package/dist/ValueTypeToComponent.d.ts +6 -0
  9. package/dist/ValueTypeToComponent.js +442 -0
  10. package/dist/components/Cascader/index.d.ts +40 -0
  11. package/dist/components/Cascader/index.js +202 -0
  12. package/dist/components/Checkbox/index.d.ts +37 -0
  13. package/dist/components/Checkbox/index.js +149 -0
  14. package/dist/components/Checkbox/style/index.d.ts +11 -0
  15. package/dist/components/Checkbox/style/index.js +26 -0
  16. package/dist/components/Code/index.d.ts +34 -0
  17. package/dist/components/Code/index.js +125 -0
  18. package/dist/components/ColorPicker/index.d.ts +22 -0
  19. package/dist/components/ColorPicker/index.js +278 -0
  20. package/dist/components/DatePicker/index.d.ts +27 -0
  21. package/dist/components/DatePicker/index.js +171 -0
  22. package/dist/components/Digit/index.d.ts +27 -0
  23. package/dist/components/Digit/index.js +159 -0
  24. package/dist/components/DigitRange/index.d.ts +48 -0
  25. package/dist/components/DigitRange/index.js +197 -0
  26. package/dist/components/FromNow/index.d.ts +23 -0
  27. package/dist/components/FromNow/index.js +123 -0
  28. package/dist/components/Image/index.d.ts +23 -0
  29. package/dist/components/Image/index.js +119 -0
  30. package/dist/components/IndexColumn/index.d.ts +13 -0
  31. package/dist/components/IndexColumn/index.js +30 -0
  32. package/dist/components/IndexColumn/style/index.d.ts +11 -0
  33. package/dist/components/IndexColumn/style/index.js +29 -0
  34. package/dist/components/Money/InputNumberPopover.d.ts +120 -0
  35. package/dist/components/Money/InputNumberPopover.js +345 -0
  36. package/dist/components/Money/index.d.ts +303 -0
  37. package/dist/components/Money/index.js +274 -0
  38. package/dist/components/Options/index.d.ts +18 -0
  39. package/dist/components/Options/index.js +120 -0
  40. package/dist/components/Password/index.d.ts +33 -0
  41. package/dist/components/Password/index.js +137 -0
  42. package/dist/components/Percent/index.d.ts +45 -0
  43. package/dist/components/Percent/index.js +171 -0
  44. package/dist/components/Percent/util.d.ts +10 -0
  45. package/dist/components/Percent/util.js +22 -0
  46. package/dist/components/Progress/index.d.ts +22 -0
  47. package/dist/components/Progress/index.js +124 -0
  48. package/dist/components/Radio/index.d.ts +36 -0
  49. package/dist/components/Radio/index.js +138 -0
  50. package/dist/components/Radio/style/index.d.ts +11 -0
  51. package/dist/components/Radio/style/index.js +21 -0
  52. package/dist/components/RangePicker/DatePicker.d.ts +29 -0
  53. package/dist/components/RangePicker/DatePicker.js +189 -0
  54. package/dist/components/RangePicker/TimePicker.d.ts +25 -0
  55. package/dist/components/RangePicker/TimePicker.js +177 -0
  56. package/dist/components/RangePicker/index.d.ts +3 -0
  57. package/dist/components/RangePicker/index.js +3 -0
  58. package/dist/components/Rate/index.d.ts +19 -0
  59. package/dist/components/Rate/index.js +98 -0
  60. package/dist/components/Second/index.d.ts +28 -0
  61. package/dist/components/Second/index.js +151 -0
  62. package/dist/components/Segmented/index.d.ts +36 -0
  63. package/dist/components/Segmented/index.js +138 -0
  64. package/dist/components/Select/Highlight/index.d.ts +14 -0
  65. package/dist/components/Select/Highlight/index.js +46 -0
  66. package/dist/components/Select/Highlight/style/index.d.ts +12 -0
  67. package/dist/components/Select/Highlight/style/index.js +24 -0
  68. package/dist/components/Select/LightSelect/index.d.ts +45 -0
  69. package/dist/components/Select/LightSelect/index.js +621 -0
  70. package/dist/components/Select/LightSelect/style/index.d.ts +11 -0
  71. package/dist/components/Select/LightSelect/style/index.js +28 -0
  72. package/dist/components/Select/SearchSelect/index.d.ts +78 -0
  73. package/dist/components/Select/SearchSelect/index.js +273 -0
  74. package/dist/components/Select/index.d.ts +67 -0
  75. package/dist/components/Select/index.js +357 -0
  76. package/dist/components/Slider/index.d.ts +18 -0
  77. package/dist/components/Slider/index.js +99 -0
  78. package/dist/components/Status/index.d.ts +31 -0
  79. package/dist/components/Status/index.js +71 -0
  80. package/dist/components/Switch/index.d.ts +31 -0
  81. package/dist/components/Switch/index.js +132 -0
  82. package/dist/components/Text/index.d.ts +37 -0
  83. package/dist/components/Text/index.js +146 -0
  84. package/dist/components/TextArea/index.d.ts +25 -0
  85. package/dist/components/TextArea/index.js +117 -0
  86. package/dist/components/TextArea/readonly/index.d.ts +17 -0
  87. package/dist/components/TextArea/readonly/index.js +20 -0
  88. package/dist/components/TextArea/readonly/style/index.d.ts +11 -0
  89. package/dist/components/TextArea/readonly/style/index.js +20 -0
  90. package/dist/components/TimePicker/index.d.ts +23 -0
  91. package/dist/components/TimePicker/index.js +153 -0
  92. package/dist/components/TreeSelect/index.d.ts +45 -0
  93. package/dist/components/TreeSelect/index.js +762 -0
  94. package/dist/index.d.ts +34 -0
  95. package/dist/index.js +33 -0
  96. package/dist/pro-field.esm.js +72945 -0
  97. package/dist/pro-field.js +214 -0
  98. package/dist/typing.d.ts +28 -0
  99. package/dist/typing.js +1 -0
  100. package/dist/utils/useFieldExpose.d.ts +7 -0
  101. package/dist/utils/useFieldExpose.js +9 -0
  102. package/package.json +63 -0
@@ -0,0 +1,40 @@
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 { CascaderProps } from "antdv-next";
7
+ import { CustomSlotsType, VueNode } from "@v-c/util/dist/type";
8
+ import * as _$_v_c_cascader0 from "@v-c/cascader";
9
+
10
+ //#region src/components/Cascader/index.d.ts
11
+ type FieldCascaderProps = ProFieldFC<{
12
+ options?: CascaderProps['options'];
13
+ placeholder?: string;
14
+ variant?: 'outlined' | 'borderless' | 'filled';
15
+ }, CascaderProps & {
16
+ class?: string;
17
+ style?: CSSProperties;
18
+ }> & Omit<FieldSelectProps, 'variant' | 'fieldProps' | 'id' | 'label' | 'labelTrigger' | 'lightLabel' | 'text' | 'light' | 'plain'>;
19
+ interface FieldCascaderRef {
20
+ focus: () => void;
21
+ blur: () => void;
22
+ fetchData: (keyWord: string) => void;
23
+ }
24
+ declare const FieldCascader: _$vue.DefineSetupFnComponent<FieldCascaderProps, {}, CustomSlotsType<{
25
+ default?: () => VueNode;
26
+ }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<CascaderProps<_$_v_c_cascader0.DefaultOptionType, string, boolean> & {
27
+ class?: string;
28
+ style?: CSSProperties;
29
+ }> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<CascaderProps<_$_v_c_cascader0.DefaultOptionType, string, boolean> & {
30
+ class?: string;
31
+ style?: CSSProperties;
32
+ }> & {
33
+ options?: CascaderProps["options"];
34
+ placeholder?: string;
35
+ variant?: "outlined" | "borderless" | "filled";
36
+ } & {
37
+ id?: string;
38
+ } & Omit<FieldSelectProps, "id" | "variant" | "text" | "fieldProps" | "light" | "label" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
39
+ //#endregion
40
+ export { FieldCascaderProps, FieldCascaderRef, FieldCascader as default };
@@ -0,0 +1,202 @@
1
+ import { useFieldFetchData } from "../Select/index.js";
2
+ import { Fragment, computed, createVNode, defineComponent, mergeProps, ref } from "vue";
3
+ import { useIntl } from "@antdv-next1/pro-provider";
4
+ import { FieldLabel, objectToMap, proFieldParsingText, useMemo, useState } from "@antdv-next1/pro-utils";
5
+ import { Cascader } from "antdv-next";
6
+ import { LoadingOutlined } from "@antdv-next/icons";
7
+ import { classNames } from "@v-c/util";
8
+ import { useConfig as useConfig$1 } from "antdv-next/dist/config-provider/context";
9
+ //#region src/components/Cascader/index.tsx
10
+ const FieldCascader = /* @__PURE__ */ defineComponent((props, { expose }) => {
11
+ const config = useConfig$1();
12
+ const layoutClassName = computed(() => config.value.getPrefixCls("field-cascader"));
13
+ const [loading, options, fetchData] = useFieldFetchData(props);
14
+ const intl = useIntl();
15
+ const cascaderRef = ref(null);
16
+ const [open, setOpen] = useState(false);
17
+ const optionsValueEnum = useMemo(() => {
18
+ if (props.mode !== "read") return;
19
+ /**
20
+ * Support cascader fieldNames
21
+ *
22
+ * @see https://ant.design/components/cascader-cn/#header
23
+ */
24
+ const { value: valuePropsName = "value", label: labelPropsName = "label", children: childrenPropsName = "children" } = props.fieldProps?.fieldNames || {};
25
+ const valueEnumObj = {};
26
+ const traverseOptions = (_options) => {
27
+ if (!_options?.length) return valueEnumObj;
28
+ const length = _options.length;
29
+ let i = 0;
30
+ while (i < length) {
31
+ const cur = _options[i++];
32
+ valueEnumObj[cur[valuePropsName]] = {
33
+ text: cur.text || cur[labelPropsName],
34
+ status: cur.status,
35
+ color: cur.color,
36
+ disabled: cur.disabled
37
+ };
38
+ traverseOptions(cur?.[childrenPropsName]);
39
+ }
40
+ return valueEnumObj;
41
+ };
42
+ return traverseOptions(options?.value);
43
+ }, [
44
+ () => props.mode,
45
+ options,
46
+ () => props.fieldProps?.fieldNames
47
+ ]);
48
+ expose({
49
+ focus: () => cascaderRef.value?.focus(),
50
+ blur: () => cascaderRef.value?.blur(),
51
+ fetchData: (keyWord) => fetchData(keyWord)
52
+ });
53
+ return () => {
54
+ const { mode, render, formItemRender, variant, placeholder: propsPlaceholder, ...rest } = props;
55
+ if (mode === "read") {
56
+ console.log(objectToMap(rest.valueEnum || optionsValueEnum.value), "optionsValueEnum=23");
57
+ const dom = createVNode(Fragment, null, [proFieldParsingText(rest.text, objectToMap(rest.valueEnum || optionsValueEnum.value))]);
58
+ if (render) return createVNode(Fragment, null, [render(rest.text, {
59
+ mode,
60
+ ...rest
61
+ }, dom) ?? null]);
62
+ return dom;
63
+ }
64
+ if (mode === "edit") {
65
+ const placeholder = rest.fieldProps?.placeholder || propsPlaceholder || intl.value.getMessage({
66
+ id: "tableForm.selectPlaceholder",
67
+ defaultMessage: "请选择"
68
+ });
69
+ let dom = createVNode(Cascader, mergeProps({
70
+ "ref": cascaderRef,
71
+ "open": open.value,
72
+ "suffixIcon": loading.value ? createVNode(LoadingOutlined, null, null) : void 0,
73
+ "placeholder": placeholder,
74
+ "allowClear": rest.fieldProps?.allowClear !== false
75
+ }, rest.fieldProps, {
76
+ "onOpenChange": (isOpen) => {
77
+ rest.fieldProps?.onOpenChange?.(isOpen);
78
+ setOpen(isOpen);
79
+ },
80
+ "class": classNames((rest.fieldProps || {}).class, layoutClassName.value),
81
+ "options": options.value
82
+ }), null);
83
+ if (formItemRender) dom = createVNode(Fragment, null, [formItemRender(rest.text, {
84
+ mode: props.mode,
85
+ ...rest,
86
+ options: options.value,
87
+ loading: loading.value
88
+ }, dom) ?? null]);
89
+ if (rest.light) {
90
+ const { disabled, value } = props.fieldProps;
91
+ const notEmpty = !!value && value?.length !== 0;
92
+ return createVNode(FieldLabel, {
93
+ "label": rest.label,
94
+ "disabled": disabled,
95
+ "variant": variant,
96
+ "value": notEmpty || open.value ? dom : null,
97
+ "style": notEmpty ? { paddingInlineEnd: 0 } : void 0,
98
+ "allowClear": false,
99
+ "downIcon": notEmpty || open.value ? false : void 0,
100
+ "onClick": () => {
101
+ setOpen(true);
102
+ rest.fieldProps?.onOpenChange?.(true);
103
+ }
104
+ }, null);
105
+ }
106
+ return dom;
107
+ }
108
+ return null;
109
+ };
110
+ }, {
111
+ props: {
112
+ text: {
113
+ type: [
114
+ Object,
115
+ Function,
116
+ String,
117
+ Number,
118
+ null,
119
+ Boolean,
120
+ Array
121
+ ],
122
+ required: false,
123
+ default: void 0
124
+ },
125
+ "onUpdate:text": {
126
+ type: Function,
127
+ required: false
128
+ },
129
+ fieldProps: {
130
+ type: Object,
131
+ required: false
132
+ },
133
+ mode: {
134
+ type: String,
135
+ required: false
136
+ },
137
+ light: {
138
+ type: Boolean,
139
+ required: false,
140
+ default: void 0
141
+ },
142
+ label: {
143
+ type: [
144
+ Object,
145
+ Function,
146
+ String,
147
+ Number,
148
+ null,
149
+ Boolean,
150
+ Array
151
+ ],
152
+ required: false,
153
+ default: void 0
154
+ },
155
+ valueEnum: {
156
+ type: [Object, Map],
157
+ required: false
158
+ },
159
+ proFieldKey: {
160
+ type: [String, Number],
161
+ required: false
162
+ },
163
+ render: {
164
+ type: Function,
165
+ required: false
166
+ },
167
+ formItemRender: {
168
+ type: Function,
169
+ required: false
170
+ },
171
+ options: { required: false },
172
+ placeholder: {
173
+ type: String,
174
+ required: false
175
+ },
176
+ variant: {
177
+ type: String,
178
+ required: false
179
+ },
180
+ id: {
181
+ type: String,
182
+ required: false
183
+ },
184
+ debounceTime: {
185
+ type: Number,
186
+ required: false
187
+ },
188
+ request: {
189
+ type: Function,
190
+ required: false
191
+ },
192
+ params: { required: false },
193
+ defaultKeyWords: {
194
+ type: String,
195
+ required: false
196
+ }
197
+ },
198
+ name: "FieldCascader",
199
+ inheritAttrs: false
200
+ });
201
+ //#endregion
202
+ export { FieldCascader as default };
@@ -0,0 +1,37 @@
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 { CheckboxGroupProps } from "antdv-next";
7
+ import { CustomSlotsType, VueNode } from "@v-c/util/dist/type";
8
+
9
+ //#region src/components/Checkbox/index.d.ts
10
+ type FieldCheckBoxProps = ProFieldFC<{
11
+ layout?: 'horizontal' | 'vertical';
12
+ options?: CheckboxGroupProps['options'];
13
+ }, CheckboxGroupProps & {
14
+ class?: string;
15
+ style?: CSSProperties;
16
+ }> & Omit<FieldSelectProps, 'variant' | 'fieldProps' | 'id' | 'label' | 'labelTrigger' | 'lightLabel' | 'light' | 'plain'>;
17
+ interface FieldCheckboxRef {
18
+ focus: () => void;
19
+ blur: () => void;
20
+ fetchData: (keyWord: string) => void;
21
+ }
22
+ declare const FieldCheckbox: _$vue.DefineSetupFnComponent<FieldCheckBoxProps, {}, CustomSlotsType<{
23
+ default?: () => VueNode;
24
+ }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<CheckboxGroupProps & {
25
+ class?: string;
26
+ style?: CSSProperties;
27
+ }> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<CheckboxGroupProps & {
28
+ class?: string;
29
+ style?: CSSProperties;
30
+ }> & {
31
+ layout?: "horizontal" | "vertical";
32
+ options?: CheckboxGroupProps["options"];
33
+ } & {
34
+ id?: string;
35
+ } & Omit<FieldSelectProps, "id" | "variant" | "fieldProps" | "light" | "label" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
36
+ //#endregion
37
+ export { FieldCheckBoxProps, FieldCheckboxRef, FieldCheckbox as default };
@@ -0,0 +1,149 @@
1
+ import { useFieldFetchData } from "../Select/index.js";
2
+ import { useStyle as useStyle$1 } from "./style/index.js";
3
+ import { Fragment, computed, createVNode, defineComponent, mergeProps, shallowRef } from "vue";
4
+ import { useToken } from "@antdv-next1/pro-provider";
5
+ import { objectToMap, proFieldParsingText } from "@antdv-next1/pro-utils";
6
+ import { CheckboxGroup, Spin } from "antdv-next";
7
+ import { classNames, omit } from "@v-c/util";
8
+ import { useConfig as useConfig$1 } from "antdv-next/dist/config-provider/context";
9
+ import { useFormItemInputContext } from "antdv-next/dist/form/context";
10
+ //#region src/components/Checkbox/index.tsx
11
+ const FieldCheckbox = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
12
+ const config = useConfig$1();
13
+ const formItemInputContext = useFormItemInputContext();
14
+ const layoutClassName = computed(() => config.value.getPrefixCls("pro-field-checkbox"));
15
+ const [loading, options, fetchData] = useFieldFetchData(props);
16
+ const { wrapSSR, hashId } = useStyle$1(layoutClassName);
17
+ const { token } = useToken();
18
+ const checkBoxRef = shallowRef(null);
19
+ expose({ fetchData: (keyWord) => fetchData(keyWord) });
20
+ console.log(checkBoxRef, "checkBoxRef");
21
+ return () => {
22
+ const { mode, render, formItemRender, options: propsOptions, request, params, debounceTime, defaultKeyWords, layout = "horizontal", ...rest } = props;
23
+ if (loading.value) return createVNode(Spin, { "size": "small" }, null);
24
+ if (mode === "read") {
25
+ const optionsValueEnum = options.value?.length ? options.value?.reduce((pre, cur) => {
26
+ return {
27
+ ...pre,
28
+ [cur.value ?? ""]: cur.label
29
+ };
30
+ }, {}) : void 0;
31
+ const dom = proFieldParsingText(rest.text, objectToMap(rest.valueEnum || optionsValueEnum));
32
+ if (render) return createVNode(Fragment, null, [render(rest.text, {
33
+ mode,
34
+ ...rest
35
+ }, createVNode(Fragment, null, [dom])) ?? null]);
36
+ return createVNode("div", { "style": {
37
+ display: "flex",
38
+ flexWrap: "wrap",
39
+ alignItems: "center",
40
+ gap: `${token.value.marginSM}px`
41
+ } }, [dom]);
42
+ }
43
+ if (mode === "edit") {
44
+ const dom = wrapSSR(createVNode(CheckboxGroup, mergeProps({ "ref": checkBoxRef }, omit(attrs, ["lightProps"]), rest.fieldProps, {
45
+ "class": classNames(rest.fieldProps?.class, hashId.value, `${layoutClassName.value}-${layout}`, {
46
+ [`${layoutClassName.value}-error`]: formItemInputContext.value.status === "error",
47
+ [`${layoutClassName.value}-warning`]: formItemInputContext.value.status === "warning"
48
+ }),
49
+ "options": options.value
50
+ }), null));
51
+ if (formItemRender) return createVNode(Fragment, null, [formItemRender(rest.text, {
52
+ mode,
53
+ ...rest,
54
+ options: options.value,
55
+ loading: loading.value
56
+ }, dom) ?? null]);
57
+ return dom;
58
+ }
59
+ return null;
60
+ };
61
+ }, {
62
+ props: {
63
+ text: {
64
+ type: [
65
+ Object,
66
+ Function,
67
+ String,
68
+ Number,
69
+ null,
70
+ Boolean,
71
+ Array
72
+ ],
73
+ required: false,
74
+ default: void 0
75
+ },
76
+ "onUpdate:text": {
77
+ type: Function,
78
+ required: false
79
+ },
80
+ fieldProps: {
81
+ type: Object,
82
+ required: false
83
+ },
84
+ mode: {
85
+ type: String,
86
+ required: false
87
+ },
88
+ light: {
89
+ type: Boolean,
90
+ required: false,
91
+ default: void 0
92
+ },
93
+ label: {
94
+ type: [
95
+ Object,
96
+ Function,
97
+ String,
98
+ Number,
99
+ null,
100
+ Boolean,
101
+ Array
102
+ ],
103
+ required: false,
104
+ default: void 0
105
+ },
106
+ valueEnum: {
107
+ type: [Object, Map],
108
+ required: false
109
+ },
110
+ proFieldKey: {
111
+ type: [String, Number],
112
+ required: false
113
+ },
114
+ render: {
115
+ type: Function,
116
+ required: false
117
+ },
118
+ formItemRender: {
119
+ type: Function,
120
+ required: false
121
+ },
122
+ layout: {
123
+ type: String,
124
+ required: false
125
+ },
126
+ options: { required: false },
127
+ id: {
128
+ type: String,
129
+ required: false
130
+ },
131
+ debounceTime: {
132
+ type: Number,
133
+ required: false
134
+ },
135
+ request: {
136
+ type: Function,
137
+ required: false
138
+ },
139
+ params: { required: false },
140
+ defaultKeyWords: {
141
+ type: String,
142
+ required: false
143
+ }
144
+ },
145
+ name: "FieldCheckBox",
146
+ inheritAttrs: false
147
+ });
148
+ //#endregion
149
+ export { FieldCheckbox as default };
@@ -0,0 +1,11 @@
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/Checkbox/style/index.d.ts
6
+ interface ProFieldCheckboxToken extends ProAliasToken {
7
+ componentCls: string;
8
+ }
9
+ declare function useStyle(prefixCls: ComputedRef<string>): _$_antdv_next1_pro_provider0.UseStyleResult;
10
+ //#endregion
11
+ export { ProFieldCheckboxToken, useStyle };
@@ -0,0 +1,26 @@
1
+ import { useStyle as useStyle$1 } from "@antdv-next1/pro-provider";
2
+ //#region src/components/Checkbox/style/index.ts
3
+ const genProFieldCheckboxStyle = (token) => {
4
+ return { [token.componentCls]: {
5
+ "&-error": { span: { color: token.colorError } },
6
+ "&-warning": { span: { color: token.colorWarning } },
7
+ "&-vertical": {
8
+ [`&${token.antCls}-checkbox-group`]: { display: "inline-block" },
9
+ [`${token.antCls}-checkbox-wrapper+${token.antCls}-checkbox-wrapper`]: { "margin-inline-start": "0 !important" },
10
+ [`${token.antCls}-checkbox-group-item`]: {
11
+ display: "flex",
12
+ marginInlineEnd: 0
13
+ }
14
+ }
15
+ } };
16
+ };
17
+ function useStyle(prefixCls) {
18
+ return useStyle$1("ProFieldCheckbox", (token) => {
19
+ return [genProFieldCheckboxStyle({
20
+ ...token,
21
+ componentCls: `.${prefixCls.value}`
22
+ })];
23
+ });
24
+ }
25
+ //#endregion
26
+ export { useStyle };
@@ -0,0 +1,34 @@
1
+ import { ProFieldFC } from "../../typing.js";
2
+ import * as _$vue from "vue";
3
+ import { CSSProperties, HTMLAttributes } from "vue";
4
+ import * as _$_antdv_next1_pro_provider0 from "@antdv-next1/pro-provider";
5
+ import { InputProps, TextAreaProps } from "antdv-next";
6
+ import { CustomSlotsType, VueNode } from "@v-c/util/dist/type";
7
+
8
+ //#region src/components/Code/index.d.ts
9
+ type FieldCodeProps = ProFieldFC<{
10
+ text: string;
11
+ language?: 'json' | 'text';
12
+ }, InputProps & {
13
+ style?: CSSProperties;
14
+ } | TextAreaProps & {
15
+ style?: CSSProperties;
16
+ } | HTMLAttributes>;
17
+ declare const FieldCode: _$vue.DefineSetupFnComponent<FieldCodeProps, {}, CustomSlotsType<{
18
+ default?: () => VueNode;
19
+ }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<HTMLAttributes | (InputProps & {
20
+ style?: CSSProperties;
21
+ }) | (TextAreaProps & {
22
+ style?: CSSProperties;
23
+ })> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<HTMLAttributes | (InputProps & {
24
+ style?: CSSProperties;
25
+ }) | (TextAreaProps & {
26
+ style?: CSSProperties;
27
+ })> & {
28
+ text: string;
29
+ language?: "json" | "text";
30
+ } & {
31
+ id?: string;
32
+ } & {}, _$vue.PublicProps>;
33
+ //#endregion
34
+ export { FieldCodeProps, FieldCode as default };
@@ -0,0 +1,125 @@
1
+ import { Fragment, createVNode, defineComponent, mergeProps } from "vue";
2
+ import { proTheme } from "@antdv-next1/pro-provider";
3
+ import { Input, TextArea } from "antdv-next";
4
+ import { unit } from "@antdv-next/cssinjs";
5
+ //#region src/components/Code/index.tsx
6
+ function languageFormat(text, language) {
7
+ if (typeof text !== "string") return text;
8
+ try {
9
+ if (language === "json") return JSON.stringify(JSON.parse(text), null, 2);
10
+ } catch (error) {}
11
+ return text;
12
+ }
13
+ const FieldCode = /* @__PURE__ */ defineComponent((props) => {
14
+ const { token } = proTheme.useToken();
15
+ return () => {
16
+ const { mode, text, render, language = "text", formItemRender, plain, fieldProps, ...rest } = props;
17
+ const code = languageFormat(text, language);
18
+ if (mode === "read") {
19
+ const dom = createVNode("pre", mergeProps(fieldProps, { "style": {
20
+ padding: unit(16),
21
+ overflow: "auto",
22
+ fontSize: "85%",
23
+ lineHeight: 1.45,
24
+ color: token.value.colorTextSecondary,
25
+ fontFamily: token.value.fontFamilyCode,
26
+ backgroundColor: "rgba(150, 150, 150, 0.1)",
27
+ borderRadius: unit(3),
28
+ width: "min-content",
29
+ ...fieldProps?.style
30
+ } }), [createVNode("code", null, [code])]);
31
+ if (render) return createVNode(Fragment, null, [render(code, {
32
+ mode,
33
+ ...rest,
34
+ fieldProps
35
+ }, dom)]);
36
+ return dom;
37
+ }
38
+ if (mode === "edit" || mode === "update") {
39
+ fieldProps.value = code;
40
+ let dom = createVNode(TextArea, mergeProps({ "rows": 5 }, fieldProps), null);
41
+ if (plain) dom = createVNode(Input, fieldProps, null);
42
+ if (formItemRender) return createVNode(Fragment, null, [formItemRender(code, {
43
+ mode,
44
+ fieldProps,
45
+ ...rest
46
+ }, dom) ?? null]);
47
+ return dom;
48
+ }
49
+ return null;
50
+ };
51
+ }, {
52
+ props: {
53
+ text: {
54
+ type: [
55
+ Object,
56
+ Function,
57
+ String,
58
+ Number,
59
+ null,
60
+ Boolean,
61
+ Array
62
+ ],
63
+ required: false,
64
+ default: void 0
65
+ },
66
+ "onUpdate:text": {
67
+ type: Function,
68
+ required: false
69
+ },
70
+ fieldProps: {
71
+ type: Object,
72
+ required: false
73
+ },
74
+ mode: {
75
+ type: String,
76
+ required: false
77
+ },
78
+ light: {
79
+ type: Boolean,
80
+ required: false,
81
+ default: void 0
82
+ },
83
+ label: {
84
+ type: [
85
+ Object,
86
+ Function,
87
+ String,
88
+ Number,
89
+ null,
90
+ Boolean,
91
+ Array
92
+ ],
93
+ required: false,
94
+ default: void 0
95
+ },
96
+ valueEnum: {
97
+ type: [Object, Map],
98
+ required: false
99
+ },
100
+ proFieldKey: {
101
+ type: [String, Number],
102
+ required: false
103
+ },
104
+ render: {
105
+ type: Function,
106
+ required: false
107
+ },
108
+ formItemRender: {
109
+ type: Function,
110
+ required: false
111
+ },
112
+ language: {
113
+ type: String,
114
+ required: false
115
+ },
116
+ id: {
117
+ type: String,
118
+ required: false
119
+ }
120
+ },
121
+ name: "FieldCode",
122
+ inheritAttrs: false
123
+ });
124
+ //#endregion
125
+ export { FieldCode as default };
@@ -0,0 +1,22 @@
1
+ import { ProFieldFC } from "../../typing.js";
2
+ import * as _$vue from "vue";
3
+ import * as _$_antdv_next1_pro_provider0 from "@antdv-next1/pro-provider";
4
+ import { ColorPickerProps } from "antdv-next";
5
+ import { CustomSlotsType, VueNode } from "@v-c/util/dist/type";
6
+ import * as _$antdv_next_dist_color_picker_ColorPicker0 from "antdv-next/dist/color-picker/ColorPicker";
7
+
8
+ //#region src/components/ColorPicker/index.d.ts
9
+ type FieldColorPickerProps = ProFieldFC<{
10
+ text: string;
11
+ mode?: 'read' | 'edit' | 'update';
12
+ }, ColorPickerProps> & Partial<Omit<ColorPickerProps, 'value' | 'mode'>>;
13
+ declare const FieldColorPicker: _$vue.DefineSetupFnComponent<FieldColorPickerProps, {}, CustomSlotsType<{
14
+ default?: () => VueNode;
15
+ }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<_$antdv_next_dist_color_picker_ColorPicker0.InternalColorPickerProps> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<_$antdv_next_dist_color_picker_ColorPicker0.InternalColorPickerProps> & {
16
+ text: string;
17
+ mode?: "read" | "edit" | "update";
18
+ } & {
19
+ id?: string;
20
+ } & Partial<Omit<_$antdv_next_dist_color_picker_ColorPicker0.InternalColorPickerProps, "mode" | "value">> & {}, _$vue.PublicProps>;
21
+ //#endregion
22
+ export { FieldColorPickerProps, FieldColorPicker as default };