@antdv-next1/pro-field 1.0.6 → 1.0.8

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/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @antdv-next1/pro-field
2
+
3
+ Rich field rendering component for Pro Components. Supports read-only and edit modes with 30+ built-in value types.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @antdv-next1/pro-field
9
+ # or
10
+ pnpm add @antdv-next1/pro-field
11
+ ```
12
+
13
+ ## Peer Dependencies
14
+
15
+ - `vue` >= 3.5.30
16
+ - `antdv-next` >= 1.3.4
17
+
18
+ ## Components
19
+
20
+ ### Main Components
21
+
22
+ | Component | Description |
23
+ |-----------|-------------|
24
+ | `ProField` | Unified field renderer with automatic value type mapping |
25
+ | `ProPureField` | Pure field renderer without form item wrapper |
26
+ | `ValueTypeToComponent` | Automatic value-type to component mapper |
27
+
28
+ ### Field Type Components
29
+
30
+ | Component | Value Type | Description |
31
+ |-----------|------------|-------------|
32
+ | `FieldText` | `text` | Plain text display / input |
33
+ | `FieldTextArea` | `textarea` | Multi-line text |
34
+ | `FieldPassword` | `password` | Password with visibility toggle |
35
+ | `FieldSelect` | `select` | Dropdown select |
36
+ | `FieldCheckbox` | `checkbox` | Checkbox input |
37
+ | `FieldRadio` | `radio` | Radio input |
38
+ | `FieldDigit` | `digit` | Numeric input |
39
+ | `FieldDigitRange` | `digitRange` | Numeric range input |
40
+ | `FieldMoney` | `money` | Currency display / input |
41
+ | `FieldPercent` | `percent` | Percentage display / input |
42
+ | `FieldProgress` | `progress` | Progress bar |
43
+ | `FieldRate` | `rate` | Star rating |
44
+ | `FieldSlider` | `slider` | Slider input |
45
+ | `FieldSwitch` | `switch` | Toggle switch |
46
+ | `FieldDatePicker` | `date` | Date picker |
47
+ | `FieldDateRangePicker` | `dateRange` | Date range picker |
48
+ | `FieldTimePicker` | `time` | Time picker |
49
+ | `FieldTimeRangePicker` | `timeRange` | Time range picker |
50
+ | `FieldFromNow` | `fromNow` | Relative time display |
51
+ | `FieldSecond` | `second` | Seconds display |
52
+ | `FieldCascader` | `cascader` | Cascading select |
53
+ | `FieldTreeSelect` | `treeSelect` | Tree select |
54
+ | `FieldColorPicker` | `colorPicker` | Color picker |
55
+ | `FieldImage` | `image` | Image display |
56
+ | `FieldCode` | `code` | Code block display |
57
+ | `FieldStatus` | `status` | Status badge |
58
+ | `FieldIndexColumn` | `indexColumn` | Index column |
59
+ | `FieldSegmented` | `segmented` | Segmented control |
60
+ | `FieldOptions` | `options` | Options group |
61
+
62
+ ## Usage
63
+
64
+ ```vue
65
+ <script setup lang="ts">
66
+ import { ProField } from '@antdv-next1/pro-field'
67
+ </script>
68
+
69
+ <template>
70
+ <!-- Read-only mode -->
71
+ <ProField :text="1000" mode="read" value-type="money" />
72
+
73
+ <!-- Edit mode -->
74
+ <ProField v-model:text="value" mode="edit" value-type="select" :field-props="{ options }" />
75
+ </template>
76
+ ```
77
+
78
+ ## Dependencies
79
+
80
+ - `@antdv-next1/pro-provider` — Theme and configuration context
81
+ - `@antdv-next1/pro-utils` — Shared utilities
82
+ - `swrv` — Stale-while-revalidate data fetching
83
+
84
+ ## License
85
+
86
+ [MIT](../../LICENSE)
package/dist/ProField.js CHANGED
@@ -301,7 +301,19 @@ const ProField = /* @__PURE__ */ defineComponent((props, { expose }) => {
301
301
  }, {
302
302
  props: {
303
303
  valueType: { required: false },
304
- text: { required: false },
304
+ text: {
305
+ type: [
306
+ Object,
307
+ Function,
308
+ String,
309
+ Number,
310
+ null,
311
+ Boolean,
312
+ Array
313
+ ],
314
+ required: false,
315
+ default: void 0
316
+ },
305
317
  placeholder: {
306
318
  type: [String, Array],
307
319
  required: false
@@ -367,7 +379,10 @@ const ProField = /* @__PURE__ */ defineComponent((props, { expose }) => {
367
379
  type: String,
368
380
  required: false
369
381
  },
370
- request: { required: false },
382
+ request: {
383
+ type: Function,
384
+ required: false
385
+ },
371
386
  emptyText: {
372
387
  type: [
373
388
  Object,
@@ -107,7 +107,19 @@ const ProPureField = /* @__PURE__ */ defineComponent((props, { attrs, expose })
107
107
  }, {
108
108
  props: {
109
109
  valueType: { required: false },
110
- text: { required: false },
110
+ text: {
111
+ type: [
112
+ Object,
113
+ Function,
114
+ String,
115
+ Number,
116
+ null,
117
+ Boolean,
118
+ Array
119
+ ],
120
+ required: false,
121
+ default: void 0
122
+ },
111
123
  placeholder: {
112
124
  type: [String, Array],
113
125
  required: false
@@ -173,7 +185,10 @@ const ProPureField = /* @__PURE__ */ defineComponent((props, { attrs, expose })
173
185
  type: String,
174
186
  required: false
175
187
  },
176
- request: { required: false },
188
+ request: {
189
+ type: Function,
190
+ required: false
191
+ },
177
192
  emptyText: {
178
193
  type: [
179
194
  Object,
@@ -35,6 +35,6 @@ declare const FieldCascader: _$vue.DefineSetupFnComponent<FieldCascaderProps, {}
35
35
  variant?: "outlined" | "borderless" | "filled";
36
36
  } & {
37
37
  id?: string;
38
- } & Omit<FieldSelectProps, "text" | "fieldProps" | "light" | "label" | "id" | "variant" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
38
+ } & Omit<FieldSelectProps, "text" | "fieldProps" | "light" | "label" | "id" | "variant" | "lightLabel" | "labelTrigger" | "plain"> & {}, _$vue.PublicProps>;
39
39
  //#endregion
40
40
  export { FieldCascaderProps, FieldCascaderRef, FieldCascader as default };
@@ -184,7 +184,10 @@ const FieldCascader = /* @__PURE__ */ defineComponent((props, { expose }) => {
184
184
  type: Number,
185
185
  required: false
186
186
  },
187
- request: { required: false },
187
+ request: {
188
+ type: Function,
189
+ required: false
190
+ },
188
191
  params: { required: false },
189
192
  defaultKeyWords: {
190
193
  type: String,
@@ -32,6 +32,6 @@ declare const FieldCheckbox: _$vue.DefineSetupFnComponent<FieldCheckBoxProps, {}
32
32
  options?: CheckboxGroupProps["options"];
33
33
  } & {
34
34
  id?: string;
35
- } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
35
+ } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "lightLabel" | "labelTrigger" | "plain"> & {}, _$vue.PublicProps>;
36
36
  //#endregion
37
37
  export { FieldCheckBoxProps, FieldCheckboxRef, FieldCheckbox as default };
@@ -131,7 +131,10 @@ const FieldCheckbox = /* @__PURE__ */ defineComponent((props, { expose, attrs })
131
131
  type: Number,
132
132
  required: false
133
133
  },
134
- request: { required: false },
134
+ request: {
135
+ type: Function,
136
+ required: false
137
+ },
135
138
  params: { required: false },
136
139
  defaultKeyWords: {
137
140
  type: String,
@@ -37,7 +37,7 @@ const FieldCode = /* @__PURE__ */ defineComponent((props) => {
37
37
  }
38
38
  if (mode === "edit" || mode === "update") {
39
39
  fieldProps.value = code;
40
- let dom = createVNode(TextArea, mergeProps({ "rows": 5 }, fieldProps), null);
40
+ const dom = createVNode(TextArea, mergeProps({ "rows": 5 }, fieldProps), null);
41
41
  if (formItemRender) return createVNode(Fragment, null, [formItemRender(code, {
42
42
  mode,
43
43
  fieldProps,
@@ -12,7 +12,7 @@ type FieldImageProps = ProFieldFC<{
12
12
  }, ImageProps | InputProps>;
13
13
  declare const FieldImage: _$vue.DefineSetupFnComponent<FieldImageProps, {}, CustomSlotsType<{
14
14
  default?: () => VueNode;
15
- }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<InputProps | ImageProps> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<InputProps | ImageProps> & {
15
+ }>, _$_antdv_next1_pro_provider0.BaseProFieldFC<ImageProps | InputProps> & _$_antdv_next1_pro_provider0.ProRenderFieldPropsType<ImageProps | InputProps> & {
16
16
  text: string;
17
17
  width?: number;
18
18
  placeholder?: string;
@@ -31,6 +31,6 @@ declare const FieldRadio: _$vue.DefineSetupFnComponent<FieldRadioProps, {}, Cust
31
31
  radioType?: RadioGroupProps["optionType"];
32
32
  } & {
33
33
  id?: string;
34
- } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
34
+ } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "lightLabel" | "labelTrigger" | "plain"> & {}, _$vue.PublicProps>;
35
35
  //#endregion
36
36
  export { FieldRadioProps, FieldRadio as default };
@@ -121,7 +121,10 @@ const FieldRadio = /* @__PURE__ */ defineComponent((props, { expose, attrs }) =>
121
121
  type: Number,
122
122
  required: false
123
123
  },
124
- request: { required: false },
124
+ request: {
125
+ type: Function,
126
+ required: false
127
+ },
125
128
  params: { required: false },
126
129
  defaultKeyWords: {
127
130
  type: String,
@@ -31,6 +31,6 @@ declare const FieldSegmented: _$vue.DefineSetupFnComponent<FieldSegmentedProps,
31
31
  emptyText?: VueNode$1;
32
32
  } & {
33
33
  id?: string;
34
- } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
34
+ } & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "lightLabel" | "labelTrigger" | "plain"> & {}, _$vue.PublicProps>;
35
35
  //#endregion
36
36
  export { FieldSegmentedProps, FieldSegmented as default };
@@ -121,7 +121,10 @@ const FieldSegmented = /* @__PURE__ */ defineComponent((props, { expose }) => {
121
121
  type: Number,
122
122
  required: false
123
123
  },
124
- request: { required: false },
124
+ request: {
125
+ type: Function,
126
+ required: false
127
+ },
125
128
  params: { required: false },
126
129
  defaultKeyWords: {
127
130
  type: String,
@@ -265,18 +265,30 @@ const FieldSelect = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =
265
265
  }, {
266
266
  props: {
267
267
  text: {
268
- type: void 0,
269
- required: false
268
+ type: [
269
+ Object,
270
+ Function,
271
+ String,
272
+ Number,
273
+ null,
274
+ Boolean,
275
+ Array
276
+ ],
277
+ required: false,
278
+ default: void 0
270
279
  },
271
280
  valueEnum: {
272
- type: void 0,
281
+ type: [Map, Object],
273
282
  required: false
274
283
  },
275
284
  debounceTime: {
276
285
  type: Number,
277
286
  required: false
278
287
  },
279
- request: { required: false },
288
+ request: {
289
+ type: Function,
290
+ required: false
291
+ },
280
292
  params: { required: false },
281
293
  fieldProps: {
282
294
  type: Object,
@@ -40,6 +40,6 @@ declare const FieldTreeSelect: _$vue.DefineSetupFnComponent<FieldTreeSelectProps
40
40
  fetchDataOnSearch?: boolean;
41
41
  } & {
42
42
  id?: string;
43
- } & TreeSelectProps<any, _$_v_c_tree_select0.DataNode> & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "labelTrigger" | "lightLabel" | "plain"> & {}, _$vue.PublicProps>;
43
+ } & TreeSelectProps<any, _$_v_c_tree_select0.DataNode> & Omit<FieldSelectProps, "fieldProps" | "light" | "label" | "id" | "variant" | "lightLabel" | "labelTrigger" | "plain"> & {}, _$vue.PublicProps>;
44
44
  //#endregion
45
45
  export { FieldTreeSelectProps, FieldTreeSelect as default };
@@ -745,7 +745,10 @@ const FieldTreeSelect = /* @__PURE__ */ defineComponent((props, { expose, attrs
745
745
  type: Number,
746
746
  required: false
747
747
  },
748
- request: { required: false },
748
+ request: {
749
+ type: Function,
750
+ required: false
751
+ },
749
752
  params: { required: false },
750
753
  defaultKeyWords: {
751
754
  type: String,