@vunk/form 2.12.2 → 2.13.1

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 (99) hide show
  1. package/components/api-tables-select/src/ctx.d.ts +1 -1
  2. package/components/api-tables-select/src/index.vue.d.ts +5 -5
  3. package/components/api-tables-select/src/types.d.ts +2 -2
  4. package/components/button/index.cjs +1 -1
  5. package/components/button/index.mjs +1 -1
  6. package/components/button/src/ctx.d.ts +1 -6
  7. package/components/button/src/index.vue.d.ts +3 -12
  8. package/components/button/src/types.d.ts +2 -2
  9. package/components/card-input-collection/src/ctx.d.ts +1 -6
  10. package/components/card-input-collection/src/index.vue.d.ts +4 -18
  11. package/components/card-input-collection/src/types.d.ts +2 -2
  12. package/components/cascader/src/ctx.d.ts +2 -7
  13. package/components/cascader/src/index.vue.d.ts +3 -12
  14. package/components/cascader/src/types.d.ts +1 -1
  15. package/components/checkbox/src/ctx.d.ts +2 -7
  16. package/components/checkbox/src/index.vue.d.ts +3 -12
  17. package/components/checkbox/src/types.d.ts +1 -1
  18. package/components/color-picker/src/ctx.d.ts +1 -6
  19. package/components/color-picker/src/index.vue.d.ts +3 -12
  20. package/components/color-picker/src/types.d.ts +1 -1
  21. package/components/date-picker/src/ctx.d.ts +2 -7
  22. package/components/date-picker/src/index.vue.d.ts +3 -12
  23. package/components/date-picker/src/types.d.ts +2 -2
  24. package/components/date-picker-range/src/types.d.ts +3 -3
  25. package/components/dialog-input-collection/index.cjs +6 -2
  26. package/components/dialog-input-collection/index.mjs +6 -2
  27. package/components/dialog-input-collection/src/ctx.d.ts +1 -6
  28. package/components/dialog-input-collection/src/index.vue.d.ts +4 -18
  29. package/components/dialog-input-collection/src/types.d.ts +2 -2
  30. package/components/download-plus/src/ctx.d.ts +1 -6
  31. package/components/download-plus/src/index.vue.d.ts +3 -12
  32. package/components/editable-text/src/ctx.d.ts +1 -6
  33. package/components/editable-text/src/index.vue.d.ts +5 -19
  34. package/components/esri-input-geojson/src/ctx.d.ts +2 -7
  35. package/components/esri-input-geojson/src/index.vue.d.ts +4 -13
  36. package/components/esri-input-geojson/src/types.d.ts +2 -2
  37. package/components/form/src/types.d.ts +1 -1
  38. package/components/form-item/index.cjs +140 -144
  39. package/components/form-item/index.css +13 -16
  40. package/components/form-item/index.mjs +142 -146
  41. package/components/form-item/src/core.vue.d.ts +1847 -0
  42. package/components/form-item/src/ctx.d.ts +2 -7
  43. package/components/form-item/src/index.vue.d.ts +7 -757
  44. package/components/form-item/src/types.d.ts +1 -0
  45. package/components/information/src/types.d.ts +1 -1
  46. package/components/information-collection/src/ctx.d.ts +1 -6
  47. package/components/information-collection/src/index.vue.d.ts +3 -12
  48. package/components/input/src/ctx.d.ts +2 -7
  49. package/components/input/src/index.vue.d.ts +3 -12
  50. package/components/input/src/types.d.ts +2 -2
  51. package/components/input-collection/src/ctx.d.ts +1 -6
  52. package/components/input-collection/src/index.vue.d.ts +4 -18
  53. package/components/input-collection/src/types.d.ts +2 -2
  54. package/components/input-link/src/ctx.d.ts +1 -6
  55. package/components/input-link/src/index.vue.d.ts +3 -12
  56. package/components/input-link/src/types.d.ts +1 -1
  57. package/components/input-number/src/ctx.d.ts +2 -7
  58. package/components/input-number/src/index.vue.d.ts +3 -12
  59. package/components/input-number/src/types.d.ts +1 -1
  60. package/components/input-tag/src/ctx.d.ts +2 -7
  61. package/components/input-tag/src/index.vue.d.ts +3 -12
  62. package/components/input-tag/src/types.d.ts +2 -2
  63. package/components/monaco-editor/src/ctx.d.ts +1 -6
  64. package/components/monaco-editor/src/index.vue.d.ts +3 -12
  65. package/components/monaco-editor/src/types.d.ts +2 -2
  66. package/components/radio/src/ctx.d.ts +1 -6
  67. package/components/radio/src/index.vue.d.ts +3 -12
  68. package/components/radio/src/types.d.ts +1 -1
  69. package/components/select/src/ctx.d.ts +2 -7
  70. package/components/select/src/index.vue.d.ts +3 -12
  71. package/components/select/src/types.d.ts +1 -1
  72. package/components/slider/src/ctx.d.ts +1 -6
  73. package/components/slider/src/index.vue.d.ts +3 -12
  74. package/components/slider/src/types.d.ts +1 -1
  75. package/components/switch/src/ctx.d.ts +1 -6
  76. package/components/switch/src/index.vue.d.ts +3 -12
  77. package/components/switch/src/types.d.ts +1 -1
  78. package/components/tables-select/src/ctx.d.ts +1 -1
  79. package/components/tables-select/src/index.vue.d.ts +2 -2
  80. package/components/tables-select/src/types.d.ts +2 -2
  81. package/components/templates-default/src/types.d.ts +16 -16
  82. package/components/templates-esri/src/types.d.ts +1 -1
  83. package/components/templates-variant/src/types.d.ts +1 -1
  84. package/components/upload/src/ctx.d.ts +2 -7
  85. package/components/upload/src/index.vue.d.ts +3 -12
  86. package/components/upload/src/types.d.ts +1 -1
  87. package/components/upload-plus/src/ctx.d.ts +1 -6
  88. package/components/upload-plus/src/index.vue.d.ts +4 -18
  89. package/components/van-cascader/src/ctx.d.ts +1 -6
  90. package/components/van-cascader/src/index.vue.d.ts +3 -12
  91. package/components/var-datetime-picker/src/ctx.d.ts +1 -6
  92. package/components/var-datetime-picker/src/index.vue.d.ts +3 -12
  93. package/components/var-datetime-picker/src/types.d.ts +2 -2
  94. package/components/vditor/src/ctx.d.ts +1 -6
  95. package/components/vditor/src/index.vue.d.ts +3 -12
  96. package/components/vditor/src/types.d.ts +2 -2
  97. package/index.css +13 -16
  98. package/package.json +1 -1
  99. package/shared/types/source/index.d.ts +2 -2
@@ -14,7 +14,7 @@ export type LayoutProps = {
14
14
  */
15
15
  templateLayout?: TemplateLayout;
16
16
  };
17
- export type FormItem<P extends string = string> = (__VkfTemplatesDefault.Source<P> | __VkfTemplatesLayout.ElRowSource<FormItem<P>> | __VkfTemplatesLayout.ElColSource<FormItem<P>> | __VkfTemplatesLayout.VkfFlexSource<FormItem<P>>) & LayoutProps;
17
+ export type FormItem<P = string> = (__VkfTemplatesDefault.Source<P> | __VkfTemplatesLayout.ElRowSource<FormItem<P>> | __VkfTemplatesLayout.ElColSource<FormItem<P>> | __VkfTemplatesLayout.VkfFlexSource<FormItem<P>>) & LayoutProps;
18
18
  export type ColItem = __VkfTemplatesLayout.ElColSource<FormItem>;
19
19
  export type RowItem = __VkfTemplatesLayout.ElRowSource<ColItem>;
20
20
  export interface TemplateLayout extends VueComponentPropsType<typeof ElCol> {
@@ -46,7 +46,8 @@ const _props = {
46
46
  information: {
47
47
  type: Boolean,
48
48
  default: false
49
- }
49
+ },
50
+ prop: null
50
51
  };
51
52
  Reflect.deleteProperty(_props, "size");
52
53
  const props = _props;
@@ -58,140 +59,65 @@ var ctx = /*#__PURE__*/Object.freeze({
58
59
  props: props
59
60
  });
60
61
 
61
- var _sfc_main = vue.defineComponent({
62
- name: "VkfFormItem",
63
- components: {
64
- ElFormItem: elementPlus.ElFormItem,
65
- ElIcon: elementPlus.ElIcon,
66
- ElTooltip: elementPlus.ElTooltip,
67
- Warning: index.warning_default,
68
- ElButton: elementPlus.ElButton
62
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
63
+ ...{
64
+ inheritAttrs: false
69
65
  },
70
- props,
71
- setup(props2, { slots }) {
72
- const formItemBindProps = elementPlus$1.createFormItemBindProps(props2, ["rules"]);
73
- const readonly = composables.useComputedReadonly(props2);
74
- const globalConfig = elementPlus.useGlobalConfig();
75
- const localeName = vue.computed(() => {
76
- return globalConfig.value?.locale?.name;
77
- });
78
- const requiredMessage = `${props2.label || "\u8BE5\u5B57\u6BB5"}\u4E0D\u80FD\u4E3A\u7A7A`;
79
- const setDefaultMessage = (rule) => {
80
- if (localeName.value === "zh-cn") {
81
- if (rule.message) return;
82
- if (rule.required) {
83
- rule.message = requiredMessage;
84
- }
85
- const ruleInfo = rules.PATTERN_OPTIONS.find((i) => i.value === rule.pattern);
86
- if (ruleInfo) {
87
- rule.message = `\u8F93\u5165 ${props2.label || "\u8BE5\u5B57\u6BB5"} ${ruleInfo.title}`;
88
- }
89
- }
90
- };
91
- const rules$1 = vue.computed(() => {
92
- let data = [];
93
- if (!props2.rules && props2.required) {
94
- data.push({
95
- required: true
96
- });
97
- }
98
- if (utilsObject.isPlainObject(props2.rules)) {
99
- data = [props2.rules];
100
- }
101
- if (Array.isArray(props2.rules)) {
102
- data = props2.rules;
103
- if (props2.required && !props2.rules.find((item) => item.required)) {
104
- data.push({
105
- required: true
106
- });
107
- }
108
- }
109
- data = data.filter((rule) => {
110
- if (!rule) return;
111
- if (utilsObject.isPlainObject(rule)) {
112
- const enableKeys = Object.keys(rule).filter((key) => !key.startsWith("data-"));
113
- return enableKeys.length > 0;
114
- }
115
- });
116
- data.forEach((rule) => {
117
- setDefaultMessage(rule);
118
- });
119
- return data;
120
- });
121
- const elFormItemSlots = vue.computed(() => {
122
- const slots2 = {};
123
- const keys = ["label", "default", "error"];
124
- const formItemSlots = props2.formItemSlots;
125
- if (formItemSlots) {
126
- Object.keys(formItemSlots).forEach((key) => {
127
- if (keys.includes(key)) {
128
- slots2[key] = formItemSlots?.[key];
129
- }
130
- });
131
- }
132
- return slots2;
133
- });
134
- const customSlots = vue.computed(() => {
135
- const theSlots = {
136
- labelActions: slots?.labelActions ? () => slots.labelActions?.() : void 0
137
- };
138
- const keys = ["labelActions", "after"];
139
- const formItemSlots = props2.formItemSlots;
140
- formItemSlots && Object.keys(formItemSlots).filter((key) => keys.includes(key)).forEach((key) => {
141
- const slot = formItemSlots?.[key];
142
- if (slot) {
143
- theSlots[key] = slot;
144
- }
145
- });
146
- return theSlots;
147
- });
148
- return {
149
- formItemBindProps,
150
- readonly,
151
- rules: rules$1,
152
- localeName,
153
- elFormItemSlots,
154
- customSlots
155
- };
66
+ __name: "core",
67
+ props: {
68
+ labelTip: {
69
+ type: String,
70
+ default: ""
71
+ },
72
+ formItemTip: {
73
+ type: String,
74
+ default: ""
75
+ },
76
+ formItemTipClass: null
77
+ },
78
+ setup(__props, { expose: __expose }) {
79
+ __expose();
80
+ const __returned__ = { get ElFormItem() {
81
+ return elementPlus.ElFormItem;
82
+ }, get ElTooltip() {
83
+ return elementPlus.ElTooltip;
84
+ }, get ElIcon() {
85
+ return elementPlus.ElIcon;
86
+ }, get ElButton() {
87
+ return elementPlus.ElButton;
88
+ }, get Warning() {
89
+ return index.warning_default;
90
+ } };
91
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
92
+ return __returned__;
156
93
  }
157
94
  });
158
95
 
159
96
  const _hoisted_1 = {
160
97
  key: 1,
161
- class: "vk-form-item-label__actions"
98
+ class: "vkf-form-item-label__actions"
162
99
  };
163
100
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
164
- const _component_Warning = vue.resolveComponent("Warning");
165
- const _component_ElIcon = vue.resolveComponent("ElIcon");
166
- const _component_ElButton = vue.resolveComponent("ElButton");
167
- const _component_ElTooltip = vue.resolveComponent("ElTooltip");
168
- const _component_ElFormItem = vue.resolveComponent("ElFormItem");
169
- return vue.openBlock(), vue.createBlock(_component_ElFormItem, vue.mergeProps(_ctx.formItemBindProps, {
170
- ref: _ctx.elRef,
101
+ return vue.openBlock(), vue.createBlock($setup["ElFormItem"], vue.mergeProps(_ctx.$attrs, {
171
102
  class: ["vkf-form-item", {
172
- "is-readonly": _ctx.readonly,
173
- "vkf-form-item--inline": _ctx.inline,
174
- "is-empty-label": !_ctx.label,
175
- "is-information": _ctx.information,
176
- "has-label-actions": _ctx.customSlots.labelActions
177
- }],
178
- size: _ctx.formItemSize,
179
- rules: _ctx.rules
180
- }), vue.createSlots({
103
+ "has-label-actions": _ctx.$slots.labelActions
104
+ }]
105
+ }), {
181
106
  default: vue.withCtx(() => [
107
+ vue.renderSlot(_ctx.$slots, "before"),
182
108
  vue.renderSlot(_ctx.$slots, "default"),
183
- _ctx.customSlots.after ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.customSlots.after), { key: 0 })) : vue.createCommentVNode("v-if", true),
184
- _ctx.formItemTip ? (vue.openBlock(), vue.createElementBlock(
109
+ vue.renderSlot(_ctx.$slots, "after"),
110
+ $props.formItemTip ? (vue.openBlock(), vue.createElementBlock(
185
111
  "div",
186
112
  {
187
- key: 1,
188
- class: vue.normalizeClass(["vkf-form-item__tip", _ctx.formItemTipClass])
113
+ key: 0,
114
+ class: vue.normalizeClass(["vkf-form-item__tip", $props.formItemTipClass])
189
115
  },
190
116
  [
191
117
  vue.createElementVNode(
192
118
  "span",
193
119
  null,
194
- vue.toDisplayString(_ctx.formItemTip),
120
+ vue.toDisplayString($props.formItemTip),
195
121
  1
196
122
  /* TEXT */
197
123
  )
@@ -200,32 +126,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
200
126
  /* CLASS */
201
127
  )) : vue.createCommentVNode("v-if", true)
202
128
  ]),
203
- _: 2
204
- /* DYNAMIC */
205
- }, [
206
- !_ctx.formItemSlots?.label && (_ctx.label || _ctx.labelTip) ? {
207
- name: "label",
208
- fn: vue.withCtx(() => [
129
+ label: vue.withCtx((e) => [
130
+ vue.renderSlot(_ctx.$slots, "label", vue.normalizeProps(vue.guardReactiveProps(e)), () => [
209
131
  vue.createElementVNode(
210
132
  "span",
211
133
  null,
212
- vue.toDisplayString(_ctx.label),
134
+ vue.toDisplayString(e.label),
213
135
  1
214
136
  /* TEXT */
215
137
  ),
216
- _ctx.labelTip ? (vue.openBlock(), vue.createBlock(_component_ElTooltip, {
138
+ $props.labelTip ? (vue.openBlock(), vue.createBlock($setup["ElTooltip"], {
217
139
  key: 0,
218
- content: _ctx.labelTip
140
+ content: $props.labelTip
219
141
  }, {
220
142
  default: vue.withCtx(() => [
221
- vue.createVNode(_component_ElButton, {
143
+ vue.createVNode($setup["ElButton"], {
222
144
  text: "",
223
145
  class: "vkf-form-item-label-tip-button"
224
146
  }, {
225
147
  default: vue.withCtx(() => [
226
- vue.createVNode(_component_ElIcon, null, {
148
+ vue.createVNode($setup["ElIcon"], null, {
227
149
  default: vue.withCtx(() => [
228
- vue.createVNode(_component_Warning)
150
+ vue.createVNode($setup["Warning"])
229
151
  ]),
230
152
  _: 1
231
153
  /* STABLE */
@@ -238,23 +160,97 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
238
160
  _: 1
239
161
  /* STABLE */
240
162
  }, 8, ["content"])) : vue.createCommentVNode("v-if", true),
241
- _ctx.customSlots.labelActions ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
242
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.customSlots.labelActions)))
163
+ _ctx.$slots.labelActions ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
164
+ vue.renderSlot(_ctx.$slots, "labelActions")
243
165
  ])) : vue.createCommentVNode("v-if", true)
244
- ]),
245
- key: "0"
246
- } : void 0,
247
- vue.renderList(_ctx.elFormItemSlots, (item, key) => {
248
- return {
249
- name: key,
250
- fn: vue.withCtx((e) => [
251
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item?.(e))))
252
- ])
253
- };
254
- })
255
- ]), 1040, ["class", "size", "rules"]);
166
+ ])
167
+ ]),
168
+ error: vue.withCtx((e) => [
169
+ vue.renderSlot(_ctx.$slots, "error", vue.normalizeProps(vue.guardReactiveProps(e)))
170
+ ]),
171
+ _: 3
172
+ /* FORWARDED */
173
+ }, 16, ["class"]);
256
174
  }
257
- var VkfFormItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/index.vue"]]);
175
+ var FormItemCore = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/core.vue"]]);
176
+
177
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
178
+ name: "VkfFormItem",
179
+ props,
180
+ setup(props2, {
181
+ slots
182
+ }) {
183
+ const formItemBindProps = elementPlus$1.createFormItemBindProps(props2, ["rules"]);
184
+ const readonly = composables.useComputedReadonly(props2);
185
+ const globalConfig = elementPlus.useGlobalConfig();
186
+ const localeName = vue.computed(() => {
187
+ return globalConfig.value?.locale?.name;
188
+ });
189
+ const requiredMessage = `${props2.label || "\u8BE5\u5B57\u6BB5"}\u4E0D\u80FD\u4E3A\u7A7A`;
190
+ const setDefaultMessage = rule => {
191
+ if (localeName.value === "zh-cn") {
192
+ if (rule.message) return;
193
+ if (rule.required) {
194
+ rule.message = requiredMessage;
195
+ }
196
+ const ruleInfo = rules.PATTERN_OPTIONS.find(i => i.value === rule.pattern);
197
+ if (ruleInfo) {
198
+ rule.message = `\u8F93\u5165 ${props2.label || "\u8BE5\u5B57\u6BB5"} ${ruleInfo.title}`;
199
+ }
200
+ }
201
+ };
202
+ const rules$1 = vue.computed(() => {
203
+ let data = [];
204
+ if (!props2.rules && props2.required) {
205
+ data.push({
206
+ required: true
207
+ });
208
+ }
209
+ if (utilsObject.isPlainObject(props2.rules)) {
210
+ data = [props2.rules];
211
+ }
212
+ if (Array.isArray(props2.rules)) {
213
+ data = props2.rules;
214
+ if (props2.required && !props2.rules.find(item => item.required)) {
215
+ data.push({
216
+ required: true
217
+ });
218
+ }
219
+ }
220
+ data = data.filter(rule => {
221
+ if (!rule) return;
222
+ if (utilsObject.isPlainObject(rule)) {
223
+ const enableKeys = Object.keys(rule).filter(key => !key.startsWith("data-"));
224
+ return enableKeys.length > 0;
225
+ }
226
+ });
227
+ data.forEach(rule => {
228
+ setDefaultMessage(rule);
229
+ });
230
+ return data;
231
+ });
232
+ return () => vue.h(FormItemCore, {
233
+ ...formItemBindProps.value,
234
+ ref: props2.elRef,
235
+ class: {
236
+ "is-readonly": readonly.value,
237
+ "vkf-form-item--inline": props2.inline,
238
+ "is-empty-label": !props2.label,
239
+ "is-information": props2.information
240
+ },
241
+ size: props2.formItemSize,
242
+ rules: rules$1.value,
243
+ formItemTip: props2.formItemTip,
244
+ formItemTipClass: props2.formItemTipClass,
245
+ labelTip: props2.labelTip
246
+ }, {
247
+ ...slots,
248
+ ...props2.formItemSlots
249
+ });
250
+ }
251
+ });
252
+
253
+ var VkfFormItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/index.vue"]]);
258
254
 
259
255
  var types = /*#__PURE__*/Object.freeze({
260
256
  __proto__: null
@@ -1,12 +1,3 @@
1
- .vkf-form-item.is-information{
2
- margin-bottom: 0;
3
- }
4
- .vkf-form-item--inline{
5
- display: inline-flex;
6
- }
7
- .vkf-form-item__tip {
8
- color: var(--el-text-color-secondary);
9
- }
10
1
  .vkf-form-item-label-tip-button:hover .el-icon {
11
2
  color: var(--el-color-primary);
12
3
  }
@@ -17,19 +8,25 @@
17
8
  margin-left: 4px;
18
9
  padding: 4px;
19
10
  }
20
- .vkf-form-item.is-empty-label .el-form-item__label:before{
21
- display: none;
22
- }
23
- .vkf-form-item.has-label-actions > .el-form-item__label {
11
+ .el-form-item--label-top.vkf-form-item.has-label-actions > .el-form-item__label {
24
12
  width: 100%;
25
13
  padding-right: 0;
26
14
  }
27
- .vk-form-item-label__actions {
15
+ .vkf-form-item__tip {
16
+ color: var(--el-text-color-secondary);
17
+ }
18
+ .vkf-form-item-label__actions {
28
19
  float: right;
29
20
  align-items: center;
30
- display: none;
21
+ display: inline-flex;
31
22
  height: 1.8em;
32
23
  }
33
- .el-form-item--label-top .vk-form-item-label__actions {
24
+ .vkf-form-item.is-information{
25
+ margin-bottom: 0;
26
+ }
27
+ .vkf-form-item--inline{
34
28
  display: inline-flex;
35
29
  }
30
+ .vkf-form-item.is-empty-label .el-form-item__label:before{
31
+ display: none;
32
+ }