cnhis-design-vue 3.1.13-beta.1 → 3.1.13-beta.4

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 (61) hide show
  1. package/es/packages/big-table/src/BigTable.vue.d.ts +6 -16
  2. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +1 -1
  3. package/es/packages/big-table/style/index.css +5 -0
  4. package/es/packages/fabric-chart/src/hooks/useCenter.js +56 -10
  5. package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +1 -1
  6. package/es/packages/fabric-chart/src/hooks/useDraw.js +70 -7
  7. package/es/packages/fabric-chart/src/hooks/useTop.js +6 -4
  8. package/es/packages/fabric-chart/src/interface.d.ts +1 -0
  9. package/es/packages/form-render/index.d.ts +9 -0
  10. package/es/packages/form-render/src/FormRender.vue.d.ts +9 -0
  11. package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +2 -1
  12. package/es/packages/form-render/src/components/renderer/formItem.d.ts +8 -293
  13. package/es/packages/form-render/src/components/renderer/formItem.js +135 -2
  14. package/es/packages/form-render/src/components/renderer/input.js +3 -3
  15. package/es/packages/form-render/src/components/renderer/simpleComponent.js +2 -15
  16. package/es/packages/form-render/src/constants/index.d.ts +2 -1
  17. package/es/packages/form-render/src/constants/index.js +2 -1
  18. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +3 -1
  19. package/es/packages/form-render/src/hooks/useFormContext.d.ts +2 -1
  20. package/es/packages/form-render/src/hooks/useFormContext.js +13 -2
  21. package/es/packages/form-render/src/utils/index.d.ts +5 -2
  22. package/es/packages/form-render/src/utils/index.js +16 -2
  23. package/es/packages/form-render/style/index.css +23 -0
  24. package/es/packages/index.css +39 -0
  25. package/es/packages/index.d.ts +4 -1
  26. package/es/packages/index.js +9 -1
  27. package/es/packages/scale-view/src/hooks/scaleview-init.js +1 -5
  28. package/es/packages/scale-view/src/hooks/scaleview-submit.js +1 -6
  29. package/es/packages/scale-view/src/hooks/scaleview-validate.js +0 -3
  30. package/es/packages/shortcut-provider/index.d.ts +17 -0
  31. package/es/packages/shortcut-provider/index.js +13 -0
  32. package/es/packages/shortcut-provider/src/ShortcutProvider.js +4 -0
  33. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +15 -0
  34. package/es/packages/shortcut-provider/src/ShortcutProvider.vue_vue_type_script_setup_true_lang.js +32 -0
  35. package/es/packages/shortcut-provider/src/constants/index.d.ts +7 -0
  36. package/es/packages/shortcut-provider/src/constants/index.js +8 -0
  37. package/es/packages/shortcut-provider/src/hooks/index.d.ts +2 -0
  38. package/es/packages/shortcut-provider/src/hooks/index.js +2 -0
  39. package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.d.ts +4 -0
  40. package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.js +12 -0
  41. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +30 -0
  42. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +157 -0
  43. package/es/packages/shortcut-provider/src/types/index.d.ts +30 -0
  44. package/es/packages/shortcut-provider/src/types/index.js +1 -0
  45. package/es/packages/shortcut-provider/src/utils/index.d.ts +7 -0
  46. package/es/packages/shortcut-provider/src/utils/index.js +49 -0
  47. package/es/packages/shortcut-provider/style/index.css +3 -0
  48. package/es/packages/shortcut-setter/constant/index.d.ts +4 -0
  49. package/es/packages/shortcut-setter/constant/index.js +7 -0
  50. package/es/packages/shortcut-setter/index.d.ts +4258 -0
  51. package/es/packages/shortcut-setter/index.js +11 -0
  52. package/es/packages/shortcut-setter/src/ShortcutSetter.js +4 -0
  53. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +4258 -0
  54. package/es/packages/shortcut-setter/src/ShortcutSetter.vue_vue_type_script_setup_true_lang.js +38 -0
  55. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +4 -0
  56. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +4238 -0
  57. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue_vue_type_script_setup_true_lang.js +125 -0
  58. package/es/packages/shortcut-setter/style/index.css +8 -0
  59. package/es/src/types/index.d.ts +1 -0
  60. package/package.json +1 -1
  61. package/test.ts +0 -326
@@ -1,294 +1,9 @@
1
1
  export declare const FORM_ITEM: import("vue").DefineComponent<{
2
- readonly label: StringConstructor;
3
- readonly labelWidth: import("vue").PropType<string | number>;
4
- readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
5
- readonly labelAlign: import("vue").PropType<import("naive-ui/es/form/src/interface").LabelAlign>;
6
- readonly labelPlacement: import("vue").PropType<import("naive-ui/es/form/src/interface").LabelPlacement>;
7
- readonly path: StringConstructor;
8
- readonly first: BooleanConstructor;
9
- readonly rulePath: StringConstructor;
10
- readonly required: BooleanConstructor;
11
- readonly showRequireMark: {
12
- readonly type: import("vue").PropType<boolean | undefined>;
13
- readonly default: undefined;
14
- };
15
- readonly requireMarkPlacement: import("vue").PropType<"left" | "right" | "right-hanging">;
16
- readonly showFeedback: {
17
- readonly type: import("vue").PropType<boolean | undefined>;
18
- readonly default: undefined;
19
- };
20
- readonly rule: import("vue").PropType<import("naive-ui").FormItemRule | import("naive-ui").FormItemRule[]>;
21
- readonly size: import("vue").PropType<"small" | "medium" | "large">;
22
- readonly ignorePathChange: BooleanConstructor;
23
- readonly validationStatus: import("vue").PropType<"success" | "warning" | "error">;
24
- readonly feedback: StringConstructor;
25
- readonly showLabel: {
26
- readonly type: import("vue").PropType<boolean | undefined>;
27
- readonly default: undefined;
28
- };
29
- readonly labelProps: import("vue").PropType<import("vue").LabelHTMLAttributes>;
30
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Form", {
31
- blankHeightSmall: string;
32
- blankHeightMedium: string;
33
- blankHeightLarge: string;
34
- lineHeight: string;
35
- labelTextColor: string;
36
- asteriskColor: string;
37
- feedbackTextColorError: string;
38
- feedbackTextColorWarning: string;
39
- feedbackTextColor: string;
40
- feedbackPadding: string;
41
- feedbackHeightSmall: string;
42
- feedbackHeightMedium: string;
43
- feedbackHeightLarge: string;
44
- feedbackFontSizeSmall: string;
45
- feedbackFontSizeMedium: string;
46
- feedbackFontSizeLarge: string;
47
- labelFontSizeLeftSmall: string;
48
- labelFontSizeLeftMedium: string;
49
- labelFontSizeLeftLarge: string;
50
- labelFontSizeTopSmall: string;
51
- labelFontSizeTopMedium: string;
52
- labelFontSizeTopLarge: string;
53
- labelHeightSmall: string;
54
- labelHeightMedium: string;
55
- labelHeightLarge: string;
56
- labelPaddingVertical: string;
57
- labelPaddingHorizontal: string;
58
- labelTextAlignVertical: string;
59
- labelTextAlignHorizontal: string;
60
- }, any>>;
61
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
62
- blankHeightSmall: string;
63
- blankHeightMedium: string;
64
- blankHeightLarge: string;
65
- lineHeight: string;
66
- labelTextColor: string;
67
- asteriskColor: string;
68
- feedbackTextColorError: string;
69
- feedbackTextColorWarning: string;
70
- feedbackTextColor: string;
71
- feedbackPadding: string;
72
- feedbackHeightSmall: string;
73
- feedbackHeightMedium: string;
74
- feedbackHeightLarge: string;
75
- feedbackFontSizeSmall: string;
76
- feedbackFontSizeMedium: string;
77
- feedbackFontSizeLarge: string;
78
- labelFontSizeLeftSmall: string;
79
- labelFontSizeLeftMedium: string;
80
- labelFontSizeLeftLarge: string;
81
- labelFontSizeTopSmall: string;
82
- labelFontSizeTopMedium: string;
83
- labelFontSizeTopLarge: string;
84
- labelHeightSmall: string;
85
- labelHeightMedium: string;
86
- labelHeightLarge: string;
87
- labelPaddingVertical: string;
88
- labelPaddingHorizontal: string;
89
- labelTextAlignVertical: string;
90
- labelTextAlignHorizontal: string;
91
- }, any>>>;
92
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
93
- blankHeightSmall: string;
94
- blankHeightMedium: string;
95
- blankHeightLarge: string;
96
- lineHeight: string;
97
- labelTextColor: string;
98
- asteriskColor: string;
99
- feedbackTextColorError: string;
100
- feedbackTextColorWarning: string;
101
- feedbackTextColor: string;
102
- feedbackPadding: string;
103
- feedbackHeightSmall: string;
104
- feedbackHeightMedium: string;
105
- feedbackHeightLarge: string;
106
- feedbackFontSizeSmall: string;
107
- feedbackFontSizeMedium: string;
108
- feedbackFontSizeLarge: string;
109
- labelFontSizeLeftSmall: string;
110
- labelFontSizeLeftMedium: string;
111
- labelFontSizeLeftLarge: string;
112
- labelFontSizeTopSmall: string;
113
- labelFontSizeTopMedium: string;
114
- labelFontSizeTopLarge: string;
115
- labelHeightSmall: string;
116
- labelHeightMedium: string;
117
- labelHeightLarge: string;
118
- labelPaddingVertical: string;
119
- labelPaddingHorizontal: string;
120
- labelTextAlignVertical: string;
121
- labelTextAlignHorizontal: string;
122
- }, any>>>;
123
- }, {
124
- cssVars: import("vue").ComputedRef<{
125
- '--n-bezier': string;
126
- '--n-line-height': string;
127
- '--n-blank-height': string;
128
- '--n-label-font-size': string;
129
- '--n-label-text-align': string;
130
- '--n-label-height': string;
131
- '--n-label-padding': string;
132
- '--n-asterisk-color': string;
133
- '--n-label-text-color': string;
134
- '--n-feedback-padding': string;
135
- '--n-feedback-font-size': string;
136
- '--n-feedback-height': string;
137
- '--n-feedback-text-color': string;
138
- '--n-feedback-text-color-warning': string;
139
- '--n-feedback-text-color-error': string;
140
- }> | undefined;
141
- themeClass: import("vue").Ref<string>;
142
- onRender: () => void;
143
- validate: import("naive-ui/es/form/src/interface").FormItemValidate;
144
- restoreValidation: () => void;
145
- path?: string | undefined;
146
- internalValidate: import("naive-ui/es/form/src/interface").FormItemInternalValidate;
147
- mergedSize: import("vue").ComputedRef<import("naive-ui/es/form/src/interface").Size>;
148
- validationErrored: import("vue").Ref<boolean>;
149
- mergedLabelStyle: import("vue").ComputedRef<(import("vue").StyleValue | undefined)[]>;
150
- mergedLabelPlacement: import("vue").ComputedRef<import("naive-ui/es/form/src/interface").LabelPlacement>;
151
- mergedLabelAlign: import("vue").ComputedRef<import("naive-ui/es/form/src/interface").LabelAlign | undefined>;
152
- mergedShowRequireMark: import("vue").ComputedRef<boolean | undefined>;
153
- mergedRequireMarkPlacement: import("vue").ComputedRef<"left" | "right" | "right-hanging">;
154
- mergedValidationStatus: import("vue").ComputedRef<"success" | "warning" | "error" | undefined>;
155
- mergedShowFeedback: import("vue").ComputedRef<boolean>;
156
- mergedShowLabel: import("vue").ComputedRef<boolean>;
157
- labelElementRef: import("vue").Ref<HTMLLabelElement | null>;
158
- mergedClsPrefix: import("vue").ComputedRef<string>;
159
- mergedRequired: import("vue").ComputedRef<boolean>;
160
- feedbackId: import("vue").Ref<string>;
161
- renderExplains: import("vue").Ref<{
162
- key: string;
163
- render: () => import("vue").VNodeChild;
164
- }[]>;
165
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
166
- readonly label: StringConstructor;
167
- readonly labelWidth: import("vue").PropType<string | number>;
168
- readonly labelStyle: import("vue").PropType<string | import("vue").CSSProperties>;
169
- readonly labelAlign: import("vue").PropType<import("naive-ui/es/form/src/interface").LabelAlign>;
170
- readonly labelPlacement: import("vue").PropType<import("naive-ui/es/form/src/interface").LabelPlacement>;
171
- readonly path: StringConstructor;
172
- readonly first: BooleanConstructor;
173
- readonly rulePath: StringConstructor;
174
- readonly required: BooleanConstructor;
175
- readonly showRequireMark: {
176
- readonly type: import("vue").PropType<boolean | undefined>;
177
- readonly default: undefined;
178
- };
179
- readonly requireMarkPlacement: import("vue").PropType<"left" | "right" | "right-hanging">;
180
- readonly showFeedback: {
181
- readonly type: import("vue").PropType<boolean | undefined>;
182
- readonly default: undefined;
183
- };
184
- readonly rule: import("vue").PropType<import("naive-ui").FormItemRule | import("naive-ui").FormItemRule[]>;
185
- readonly size: import("vue").PropType<"small" | "medium" | "large">;
186
- readonly ignorePathChange: BooleanConstructor;
187
- readonly validationStatus: import("vue").PropType<"success" | "warning" | "error">;
188
- readonly feedback: StringConstructor;
189
- readonly showLabel: {
190
- readonly type: import("vue").PropType<boolean | undefined>;
191
- readonly default: undefined;
192
- };
193
- readonly labelProps: import("vue").PropType<import("vue").LabelHTMLAttributes>;
194
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Form", {
195
- blankHeightSmall: string;
196
- blankHeightMedium: string;
197
- blankHeightLarge: string;
198
- lineHeight: string;
199
- labelTextColor: string;
200
- asteriskColor: string;
201
- feedbackTextColorError: string;
202
- feedbackTextColorWarning: string;
203
- feedbackTextColor: string;
204
- feedbackPadding: string;
205
- feedbackHeightSmall: string;
206
- feedbackHeightMedium: string;
207
- feedbackHeightLarge: string;
208
- feedbackFontSizeSmall: string;
209
- feedbackFontSizeMedium: string;
210
- feedbackFontSizeLarge: string;
211
- labelFontSizeLeftSmall: string;
212
- labelFontSizeLeftMedium: string;
213
- labelFontSizeLeftLarge: string;
214
- labelFontSizeTopSmall: string;
215
- labelFontSizeTopMedium: string;
216
- labelFontSizeTopLarge: string;
217
- labelHeightSmall: string;
218
- labelHeightMedium: string;
219
- labelHeightLarge: string;
220
- labelPaddingVertical: string;
221
- labelPaddingHorizontal: string;
222
- labelTextAlignVertical: string;
223
- labelTextAlignHorizontal: string;
224
- }, any>>;
225
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
226
- blankHeightSmall: string;
227
- blankHeightMedium: string;
228
- blankHeightLarge: string;
229
- lineHeight: string;
230
- labelTextColor: string;
231
- asteriskColor: string;
232
- feedbackTextColorError: string;
233
- feedbackTextColorWarning: string;
234
- feedbackTextColor: string;
235
- feedbackPadding: string;
236
- feedbackHeightSmall: string;
237
- feedbackHeightMedium: string;
238
- feedbackHeightLarge: string;
239
- feedbackFontSizeSmall: string;
240
- feedbackFontSizeMedium: string;
241
- feedbackFontSizeLarge: string;
242
- labelFontSizeLeftSmall: string;
243
- labelFontSizeLeftMedium: string;
244
- labelFontSizeLeftLarge: string;
245
- labelFontSizeTopSmall: string;
246
- labelFontSizeTopMedium: string;
247
- labelFontSizeTopLarge: string;
248
- labelHeightSmall: string;
249
- labelHeightMedium: string;
250
- labelHeightLarge: string;
251
- labelPaddingVertical: string;
252
- labelPaddingHorizontal: string;
253
- labelTextAlignVertical: string;
254
- labelTextAlignHorizontal: string;
255
- }, any>>>;
256
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
257
- blankHeightSmall: string;
258
- blankHeightMedium: string;
259
- blankHeightLarge: string;
260
- lineHeight: string;
261
- labelTextColor: string;
262
- asteriskColor: string;
263
- feedbackTextColorError: string;
264
- feedbackTextColorWarning: string;
265
- feedbackTextColor: string;
266
- feedbackPadding: string;
267
- feedbackHeightSmall: string;
268
- feedbackHeightMedium: string;
269
- feedbackHeightLarge: string;
270
- feedbackFontSizeSmall: string;
271
- feedbackFontSizeMedium: string;
272
- feedbackFontSizeLarge: string;
273
- labelFontSizeLeftSmall: string;
274
- labelFontSizeLeftMedium: string;
275
- labelFontSizeLeftLarge: string;
276
- labelFontSizeTopSmall: string;
277
- labelFontSizeTopMedium: string;
278
- labelFontSizeTopLarge: string;
279
- labelHeightSmall: string;
280
- labelHeightMedium: string;
281
- labelHeightLarge: string;
282
- labelPaddingVertical: string;
283
- labelPaddingHorizontal: string;
284
- labelTextAlignVertical: string;
285
- labelTextAlignHorizontal: string;
286
- }, any>>>;
287
- }>>, {
288
- readonly required: boolean;
289
- readonly first: boolean;
290
- readonly showRequireMark: boolean | undefined;
291
- readonly showFeedback: boolean | undefined;
292
- readonly showLabel: boolean | undefined;
293
- readonly ignorePathChange: boolean;
294
- }>;
2
+ label: StringConstructor;
3
+ propertyKey: StringConstructor;
4
+ annotation: {};
5
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
6
+ label: StringConstructor;
7
+ propertyKey: StringConstructor;
8
+ annotation: {};
9
+ }>>, {}>;
@@ -1,8 +1,141 @@
1
+ import { defineComponent, inject, computed, ref, createVNode } from 'vue';
1
2
  import { isVoidField } from '@formily/core';
2
3
  import { connect, mapProps } from '@formily/vue';
3
- import { NFormItem } from 'naive-ui';
4
+ import { FileTrayFull, FileTray } from '@vicons/ionicons5';
5
+ import { isBoolean } from 'lodash-es';
6
+ import { NFormItem, NPopover, NIcon, NInput } from 'naive-ui';
7
+ import { InjectionAnnotation } from '../../../../../packages/form-render/src/constants';
4
8
 
5
- const FORM_ITEM = connect(NFormItem, mapProps({
9
+ const script = defineComponent({
10
+ props: {
11
+ label: String,
12
+ propertyKey: String,
13
+ annotation: {}
14
+ },
15
+ setup(props, {
16
+ slots,
17
+ attrs
18
+ }) {
19
+ const annotation = inject(InjectionAnnotation);
20
+ const annotationContent = computed({
21
+ get() {
22
+ return annotation.value[props.propertyKey];
23
+ },
24
+ set(value) {
25
+ annotation.value = {
26
+ property: props.propertyKey,
27
+ value
28
+ };
29
+ }
30
+ });
31
+ function renderTextarea() {
32
+ return createVNode(NInput, {
33
+ "type": "textarea",
34
+ "value": annotationContent.value,
35
+ "onUpdate:value": ($event) => annotationContent.value = $event
36
+ }, null);
37
+ }
38
+ const __showPopper = ref(false);
39
+ const showPopper = computed({
40
+ get() {
41
+ return __showPopper.value;
42
+ },
43
+ async set(value) {
44
+ __showPopper.value = value;
45
+ if (!value && isEdit.value) {
46
+ await new Promise((resolve) => setTimeout(resolve, 200));
47
+ isEdit.value = false;
48
+ }
49
+ }
50
+ });
51
+ const isEdit = ref(false);
52
+ let clickTimer;
53
+ function iconClick() {
54
+ clearTimeout(clickTimer);
55
+ if (showPopper.value && isEdit.value) {
56
+ showPopper.value = false;
57
+ return;
58
+ }
59
+ clickTimer = setTimeout(() => {
60
+ if (!annotationContent.value) {
61
+ isEdit.value = showPopper.value = true;
62
+ }
63
+ }, 200);
64
+ }
65
+ function iconDbClick() {
66
+ clearTimeout(clickTimer);
67
+ if (!annotationContent.value)
68
+ return;
69
+ showPopper.value = true;
70
+ isEdit.value = true;
71
+ }
72
+ function iconMouseenter() {
73
+ if (!annotationContent.value)
74
+ return;
75
+ showPopper.value = true;
76
+ }
77
+ function iconMouseleave() {
78
+ if (!annotationContent.value || isEdit.value)
79
+ return;
80
+ showPopper.value = false;
81
+ }
82
+ function renderAnnotation() {
83
+ return createVNode("section", {
84
+ "class": ["form-render__formItemLabel--annotation", {
85
+ "is-active": !!annotationContent.value
86
+ }],
87
+ "style": {
88
+ "--icon-right": attrs.required ? "-30" : "-20"
89
+ },
90
+ "form-item-hover-show": !annotationContent.value && !isEdit.value
91
+ }, [createVNode(NPopover, {
92
+ "style": {
93
+ maxWidth: "200px",
94
+ wordBreak: "break-all"
95
+ },
96
+ "show": showPopper.value,
97
+ "onUpdate:show": ($event) => showPopper.value = $event,
98
+ "trigger": "manual",
99
+ "duration": 100
100
+ }, {
101
+ default: renderDefault,
102
+ trigger: renderTrigger
103
+ })]);
104
+ function renderText() {
105
+ return createVNode("span", null, [annotationContent.value]);
106
+ }
107
+ function renderDefault() {
108
+ return createVNode("div", null, [isEdit.value ? renderTextarea() : renderText()]);
109
+ }
110
+ function renderTrigger() {
111
+ return createVNode("div", {
112
+ "onMouseleave": iconMouseleave,
113
+ "onMouseenter": iconMouseenter,
114
+ "onDblclick": iconDbClick,
115
+ "onClick": iconClick
116
+ }, [createVNode(NIcon, {
117
+ "component": annotationContent.value ? FileTrayFull : FileTray
118
+ }, null)]);
119
+ }
120
+ }
121
+ const showAnnotation = computed(() => {
122
+ return annotation.value && (!isBoolean(props.annotation) || props.annotation);
123
+ });
124
+ const showLabel = computed(() => props.label && props.label !== " ");
125
+ function renderLabel() {
126
+ return showLabel.value ? createVNode("section", {
127
+ "class": "form-render__formItemLabel"
128
+ }, [createVNode("span", {
129
+ "class": "form-render__formItemLabel--text"
130
+ }, [props.label]), showAnnotation.value ? renderAnnotation() : null]) : null;
131
+ }
132
+ return () => createVNode(NFormItem, null, {
133
+ ...slots,
134
+ label: renderLabel
135
+ });
136
+ }
137
+ });
138
+ const FORM_ITEM = connect(script, mapProps({
6
139
  title: "label"
7
140
  }, (props, field) => {
8
141
  var _a;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createVNode, Fragment } from 'vue';
2
- import { assignUpdateValue } from '../../utils/index.js';
2
+ import { createSlot, assignUpdateValue } from '../../utils/index.js';
3
3
  import { connect, mapProps } from '@formily/vue';
4
4
  import { NInput } from 'naive-ui';
5
5
 
@@ -19,10 +19,10 @@ const script = defineComponent({
19
19
  const _slots = computed(() => {
20
20
  const res = {};
21
21
  if (props.prefix) {
22
- res.prefix = () => createVNode(Fragment, null, [props.prefix]);
22
+ res.prefix = () => createVNode(Fragment, null, [createSlot(props.prefix, props).default()]);
23
23
  }
24
24
  if (props.suffix) {
25
- res.suffix = () => createVNode(Fragment, null, [props.suffix]);
25
+ res.suffix = () => createVNode(Fragment, null, [createSlot(props.suffix, props).default()]);
26
26
  }
27
27
  return res;
28
28
  });
@@ -1,7 +1,8 @@
1
1
  import { createVNode, mergeProps, isVNode } from 'vue';
2
2
  import { connect, mapProps } from '@formily/vue';
3
- import { isObject, isFunction } from 'lodash-es';
3
+ import { isFunction } from 'lodash-es';
4
4
  import { NButton } from 'naive-ui';
5
+ import { createSlot } from '../../../../../packages/form-render/src/utils';
5
6
 
6
7
  function _isSlot(s) {
7
8
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -12,20 +13,6 @@ function createPropFor(props) {
12
13
  return (_a = props.fieldItem) == null ? void 0 : _a[property];
13
14
  };
14
15
  }
15
- function createSlot(renderer, props) {
16
- if (isObject(renderer)) {
17
- const result = {};
18
- Object.entries(renderer).forEach(([key, renderer2]) => {
19
- isFunction(renderer2) && (result[key] = () => renderer2(props));
20
- });
21
- return result;
22
- }
23
- return {
24
- default() {
25
- return isFunction(renderer) ? renderer(props) : renderer;
26
- }
27
- };
28
- }
29
16
  const textScript = (props) => {
30
17
  var _a, _b, _c;
31
18
  const propFor = createPropFor(props);
@@ -1,13 +1,14 @@
1
1
  import { ContextCollector } from '../../../../../es/packages/form-render/src/hooks/useChangeContext';
2
2
  import { BusinessCollector, FormItemDepsCollector } from '../hooks';
3
3
  import { FormAsyncQueue } from '../types';
4
- import { Component, InjectionKey } from 'vue';
4
+ import { Component, InjectionKey, WritableComputedRef } from 'vue';
5
5
  export declare const InjectAsyncQueue: InjectionKey<FormAsyncQueue>;
6
6
  export declare const InjectionSchemaField: InjectionKey<Component>;
7
7
  export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>;
8
8
  export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
9
9
  export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
10
10
  export declare const InjectionFormUUID: InjectionKey<string>;
11
+ export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<Record<string, string>>>;
11
12
  export declare const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
12
13
  export declare enum FIELD_BUSINESS_TYPE {
13
14
  PASSWORD = "password",
@@ -4,6 +4,7 @@ const InjectionBusinessCollector = Symbol("InjectionBusinessCollector");
4
4
  const InjectionChangeContextCollector = Symbol("InjectionChangeContextCollector");
5
5
  const InjectionFormItemDepsCollector = Symbol("InjectionFormItemDepsCollector");
6
6
  const InjectionFormUUID = Symbol("InjectionFormUUID");
7
+ const InjectionAnnotation = Symbol("InjectionAnnotation");
7
8
  const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
8
9
  var FIELD_BUSINESS_TYPE = /* @__PURE__ */ ((FIELD_BUSINESS_TYPE2) => {
9
10
  FIELD_BUSINESS_TYPE2["PASSWORD"] = "password";
@@ -37,4 +38,4 @@ var FIELD_AGE_UNIT = /* @__PURE__ */ ((FIELD_AGE_UNIT2) => {
37
38
  return FIELD_AGE_UNIT2;
38
39
  })(FIELD_AGE_UNIT || {});
39
40
 
40
- export { FIELD_AGE_UNIT, FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
41
+ export { FIELD_AGE_UNIT, FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionAnnotation, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
@@ -13,7 +13,7 @@ function useFieldListAdaptor(collector, uuid) {
13
13
  "x-component": item.html_type,
14
14
  "x-component-props": {
15
15
  placeholder: item.placeholder,
16
- clearable: item.is_empty === "1",
16
+ clearable: item.is_empty === "0",
17
17
  ...item.componentProps || {}
18
18
  },
19
19
  "x-display": item.is_show === "0" ? "hidden" : "visible",
@@ -28,6 +28,8 @@ function useFieldListAdaptor(collector, uuid) {
28
28
  "x-decorator-props": {
29
29
  span: item.elem_width,
30
30
  showLabel: item.hide_title !== "1",
31
+ propertyKey: item.val_key,
32
+ annotation: item.annotation,
31
33
  id: `${uuid}-${item.val_key}`,
32
34
  ...item.decoratorProps || {}
33
35
  }
@@ -1,5 +1,6 @@
1
+ import { ShallowReactive } from 'vue';
1
2
  import { AnyObject } from '../../../../../es/src/types';
2
- export declare function useFormContext(props: AnyObject): {
3
+ export declare function useFormContext(props: ShallowReactive<AnyObject>): {
3
4
  asyncQueue: import("../../../../../es/packages/form-render").FormAsyncQueue;
4
5
  SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
5
6
  businessCollector: import("../../../../../es/packages/form-render").BusinessCollector;
@@ -1,10 +1,11 @@
1
- import { provide } from 'vue';
1
+ import { isObject } from 'lodash-es';
2
+ import { provide, computed, readonly } from 'vue';
2
3
  import { createSchemaField } from '@formily/vue';
3
4
  import { useAsyncQueue, useBusinessBinding, useChangeContext, useFormItemDeps } from '../../../../packages/form-render';
4
5
  import * as components from '../../../../packages/form-render/src/components/renderer';
5
6
  import { usePresetScope } from '../../../../packages/form-render/src/hooks/usePresetScope';
6
7
  import { injectOrProvide, uuidGenerator } from '../../../../packages/form-render/src/utils';
7
- import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID } from '../../../../packages/form-render/src/constants';
8
+ import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionAnnotation } from '../../../../packages/form-render/src/constants';
8
9
 
9
10
  function useFormContext(props) {
10
11
  const asyncQueue = injectOrProvide(InjectAsyncQueue, () => useAsyncQueue().create(props.parallelism));
@@ -23,6 +24,16 @@ function useFormContext(props) {
23
24
  provide(InjectionFormItemDepsCollector, formItemDepsCollector);
24
25
  const formUUID = props.uuid || uuidGenerator();
25
26
  provide(InjectionFormUUID, formUUID);
27
+ provide(InjectionAnnotation, computed({
28
+ get() {
29
+ return props.annotation ? readonly(props.annotation) : null;
30
+ },
31
+ set(payload) {
32
+ if (!isObject(props.annotation))
33
+ return;
34
+ props.annotation[payload.property] = payload.value;
35
+ }
36
+ }));
26
37
  return {
27
38
  asyncQueue,
28
39
  SchemaField,
@@ -1,7 +1,7 @@
1
- import { AnyObject } from '../../../../../es/src/types';
1
+ import { AnyObject, ArrayAble } from '../../../../../es/src/types';
2
2
  import { ISchema } from '@formily/json-schema/esm/types';
3
3
  import { GeneralField } from '@formily/core';
4
- import { InjectionKey } from 'vue';
4
+ import { InjectionKey, VNode } from 'vue';
5
5
  import { AgeContext, IdCardParseInfo } from '../types';
6
6
  export declare function formRenderLog(message: string, type?: keyof Console): void;
7
7
  export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
@@ -17,3 +17,6 @@ export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () =>
17
17
  export declare function generateUrlParams(field: GeneralField, dependKeys?: string | string[]): AnyObject;
18
18
  export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema) => void): void;
19
19
  export declare function uuidGenerator(): string;
20
+ export declare function createSlot(renderer: unknown, props: any): Record<string, () => ArrayAble<VNode>> | {
21
+ default(): any;
22
+ };
@@ -1,4 +1,4 @@
1
- import { isObject } from 'lodash-es';
1
+ import { isObject, isFunction } from 'lodash-es';
2
2
  import { FIELD_SEX_VALUE } from '../constants/index.js';
3
3
  import { isField } from '@formily/core';
4
4
  import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
@@ -95,5 +95,19 @@ function uuidGenerator() {
95
95
  return v.toString(16);
96
96
  });
97
97
  }
98
+ function createSlot(renderer, props) {
99
+ if (isObject(renderer) && !isFunction(renderer)) {
100
+ const result = {};
101
+ Object.entries(renderer).forEach(([key, renderer2]) => {
102
+ isFunction(renderer2) && (result[key] = () => renderer2(props));
103
+ });
104
+ return result;
105
+ }
106
+ return {
107
+ default() {
108
+ return isFunction(renderer) ? renderer(props) : renderer;
109
+ }
110
+ };
111
+ }
98
112
 
99
- export { arrayed, assignUpdateValue, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
113
+ export { arrayed, assignUpdateValue, createSlot, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
@@ -12,6 +12,23 @@
12
12
  .form-render__formItem .n-date-picker {
13
13
  width: 100%;
14
14
  }
15
+ .form-render__formItemLabel {
16
+ position: relative;
17
+ display: flex;
18
+ align-items: center;
19
+ }
20
+ .form-render__formItemLabel--annotation {
21
+ position: absolute;
22
+ top: 0;
23
+ right: calc(var(--icon-right) * 1px);
24
+ cursor: pointer;
25
+ color: #0067ee;
26
+ font-size: 16px;
27
+ user-select: none;
28
+ }
29
+ .form-render__formItemLabel--annotation.is-active {
30
+ color: rgba(255, 152, 40);
31
+ }
15
32
  .form-render__linebar {
16
33
  grid-column: span var(--column) / span var(--column);
17
34
  }
@@ -97,3 +114,9 @@
97
114
  display: flex !important;
98
115
  gap: 0 8px;
99
116
  }
117
+ .form-render .n-form-item-label [form-item-hover-show='true'] {
118
+ visibility: hidden;
119
+ }
120
+ .form-render .n-form-item-label:hover [form-item-hover-show='true'] {
121
+ visibility: visible;
122
+ }