@vunk/form 2.9.3 → 2.10.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 (196) hide show
  1. package/components/editable-text/index.cjs +280 -0
  2. package/components/editable-text/index.css +6 -0
  3. package/components/editable-text/index.mjs +274 -0
  4. package/components/esri-input-geojson/index.mjs +1 -1
  5. package/components/form-item/index.cjs +3 -2
  6. package/components/form-item/index.mjs +4 -3
  7. package/components/index2.cjs +38 -0
  8. package/components/index2.mjs +37 -1
  9. package/components/input-collection/index.mjs +1 -1
  10. package/components/upload/index.mjs +1 -1
  11. package/components/upload-plus/index.mjs +1 -1
  12. package/index.css +7 -0
  13. package/package.json +9 -1
  14. package/shared/element-plus/ctx.d.ts +6 -6
  15. package/shared/element-plus/instances.d.ts +140 -28
  16. package/components/api-tables-select/index.d.ts +0 -4
  17. package/components/api-tables-select/src/ctx.d.ts +0 -337
  18. package/components/api-tables-select/src/index.vue.d.ts +0 -846
  19. package/components/api-tables-select/src/types.d.ts +0 -19
  20. package/components/button/index.d.ts +0 -4
  21. package/components/button/src/ctx.d.ts +0 -106
  22. package/components/button/src/index.vue.d.ts +0 -486
  23. package/components/button/src/types.d.ts +0 -13
  24. package/components/card-input-collection/index.d.ts +0 -4
  25. package/components/card-input-collection/src/ctx.d.ts +0 -84
  26. package/components/card-input-collection/src/index.vue.d.ts +0 -551
  27. package/components/card-input-collection/src/types.d.ts +0 -10
  28. package/components/cascader/index.d.ts +0 -6
  29. package/components/cascader/src/ctx.d.ts +0 -151
  30. package/components/cascader/src/index.vue.d.ts +0 -375
  31. package/components/cascader/src/types.d.ts +0 -19
  32. package/components/cascader/src/use.d.ts +0 -5
  33. package/components/checkbox/index.d.ts +0 -5
  34. package/components/checkbox/src/ctx.d.ts +0 -99
  35. package/components/checkbox/src/index.vue.d.ts +0 -1138
  36. package/components/checkbox/src/types.d.ts +0 -8
  37. package/components/color-picker/index.d.ts +0 -4
  38. package/components/color-picker/src/ctx.d.ts +0 -90
  39. package/components/color-picker/src/index.vue.d.ts +0 -215
  40. package/components/color-picker/src/types.d.ts +0 -7
  41. package/components/date-picker/index.d.ts +0 -5
  42. package/components/date-picker/src/ctx.d.ts +0 -176
  43. package/components/date-picker/src/index.vue.d.ts +0 -650
  44. package/components/date-picker/src/types.d.ts +0 -20
  45. package/components/date-picker-range/index.d.ts +0 -4
  46. package/components/date-picker-range/src/ctx.d.ts +0 -195
  47. package/components/date-picker-range/src/index.vue.d.ts +0 -452
  48. package/components/date-picker-range/src/types.d.ts +0 -12
  49. package/components/download-plus/index.d.ts +0 -4
  50. package/components/download-plus/src/api.d.ts +0 -13
  51. package/components/download-plus/src/const.d.ts +0 -9
  52. package/components/download-plus/src/ctx.d.ts +0 -94
  53. package/components/download-plus/src/index.vue.d.ts +0 -979
  54. package/components/download-plus/src/types.d.ts +0 -17
  55. package/components/esri-input-geojson/index.d.ts +0 -6
  56. package/components/esri-input-geojson/src/append.vue.d.ts +0 -828
  57. package/components/esri-input-geojson/src/const.d.ts +0 -12
  58. package/components/esri-input-geojson/src/ctx.d.ts +0 -239
  59. package/components/esri-input-geojson/src/default-view.vue.d.ts +0 -133
  60. package/components/esri-input-geojson/src/index.vue.d.ts +0 -1289
  61. package/components/esri-input-geojson/src/types.d.ts +0 -22
  62. package/components/esri-input-geojson/src/viewer.vue.d.ts +0 -427
  63. package/components/fieldset/index.d.ts +0 -4
  64. package/components/fieldset/src/ctx.d.ts +0 -12
  65. package/components/fieldset/src/index.vue.d.ts +0 -23
  66. package/components/fieldset/src/types.d.ts +0 -1
  67. package/components/fieldset/src/use.d.ts +0 -5
  68. package/components/form/index.d.ts +0 -5
  69. package/components/form/src/ctx.d.ts +0 -84
  70. package/components/form/src/index.vue.d.ts +0 -737
  71. package/components/form/src/types.d.ts +0 -25
  72. package/components/form/src/utils.d.ts +0 -15
  73. package/components/form-item/index.d.ts +0 -5
  74. package/components/form-item/src/ctx.d.ts +0 -72
  75. package/components/form-item/src/index.vue.d.ts +0 -618
  76. package/components/form-item/src/types.d.ts +0 -7
  77. package/components/form-item-renderer/index.d.ts +0 -4
  78. package/components/form-item-renderer/src/core.vue.d.ts +0 -38
  79. package/components/form-item-renderer/src/ctx.d.ts +0 -16
  80. package/components/form-item-renderer/src/index.vue.d.ts +0 -93
  81. package/components/form-item-renderer/src/types.d.ts +0 -5
  82. package/components/form-item-renderer/src/utils.d.ts +0 -5
  83. package/components/form-item-renderer-template/index.d.ts +0 -4
  84. package/components/form-item-renderer-template/src/ctx.d.ts +0 -7
  85. package/components/form-item-renderer-template/src/index.vue.d.ts +0 -16
  86. package/components/form-item-renderer-template/src/types.d.ts +0 -55
  87. package/components/information/index.d.ts +0 -4
  88. package/components/information/src/ctx.d.ts +0 -13
  89. package/components/information/src/index.vue.d.ts +0 -23
  90. package/components/information/src/types.d.ts +0 -3
  91. package/components/information-collection/index.d.ts +0 -4
  92. package/components/information-collection/src/ctx.d.ts +0 -112
  93. package/components/information-collection/src/index.vue.d.ts +0 -232
  94. package/components/information-collection/src/types.d.ts +0 -6
  95. package/components/information-tag/index.d.ts +0 -4
  96. package/components/information-tag/src/ctx.d.ts +0 -50
  97. package/components/information-tag/src/index.vue.d.ts +0 -106
  98. package/components/information-tag/src/types.d.ts +0 -1
  99. package/components/information-templates-default/index.d.ts +0 -4
  100. package/components/information-templates-default/src/ctx.d.ts +0 -2
  101. package/components/information-templates-default/src/index.vue.d.ts +0 -2
  102. package/components/information-templates-default/src/types.d.ts +0 -1
  103. package/components/input/index.d.ts +0 -5
  104. package/components/input/src/ctx.d.ts +0 -164
  105. package/components/input/src/index.vue.d.ts +0 -816
  106. package/components/input/src/types.d.ts +0 -13
  107. package/components/input-collection/index.d.ts +0 -4
  108. package/components/input-collection/src/ctx.d.ts +0 -102
  109. package/components/input-collection/src/index.vue.d.ts +0 -1176
  110. package/components/input-collection/src/types.d.ts +0 -29
  111. package/components/input-link/index.d.ts +0 -4
  112. package/components/input-link/src/ctx.d.ts +0 -195
  113. package/components/input-link/src/index.vue.d.ts +0 -421
  114. package/components/input-link/src/types.d.ts +0 -7
  115. package/components/input-number/index.d.ts +0 -4
  116. package/components/input-number/src/ctx.d.ts +0 -106
  117. package/components/input-number/src/index.vue.d.ts +0 -441
  118. package/components/input-number/src/types.d.ts +0 -12
  119. package/components/input-tag/index.d.ts +0 -5
  120. package/components/input-tag/src/ctx.d.ts +0 -123
  121. package/components/input-tag/src/index.vue.d.ts +0 -551
  122. package/components/input-tag/src/types.d.ts +0 -22
  123. package/components/monaco-editor/index.d.ts +0 -4
  124. package/components/monaco-editor/src/ctx.d.ts +0 -80
  125. package/components/monaco-editor/src/index.vue.d.ts +0 -233
  126. package/components/monaco-editor/src/types.d.ts +0 -7
  127. package/components/radio/index.d.ts +0 -4
  128. package/components/radio/src/ctx.d.ts +0 -92
  129. package/components/radio/src/index.vue.d.ts +0 -667
  130. package/components/radio/src/types.d.ts +0 -8
  131. package/components/renderer-data/index.d.ts +0 -4
  132. package/components/renderer-data/src/ctx.d.ts +0 -12
  133. package/components/renderer-data/src/index.vue.d.ts +0 -20
  134. package/components/renderer-data/src/types.d.ts +0 -1
  135. package/components/select/index.d.ts +0 -5
  136. package/components/select/src/ctx.d.ts +0 -175
  137. package/components/select/src/index.vue.d.ts +0 -602
  138. package/components/select/src/types.d.ts +0 -11
  139. package/components/slider/index.d.ts +0 -4
  140. package/components/slider/src/ctx.d.ts +0 -137
  141. package/components/slider/src/index.vue.d.ts +0 -363
  142. package/components/slider/src/types.d.ts +0 -7
  143. package/components/switch/index.d.ts +0 -4
  144. package/components/switch/src/ctx.d.ts +0 -124
  145. package/components/switch/src/index.vue.d.ts +0 -559
  146. package/components/switch/src/types.d.ts +0 -8
  147. package/components/tables-select/index.d.ts +0 -5
  148. package/components/tables-select/src/ctx.d.ts +0 -355
  149. package/components/tables-select/src/index.vue.d.ts +0 -4984
  150. package/components/tables-select/src/types.d.ts +0 -9
  151. package/components/template-instances-provider/index.d.ts +0 -3
  152. package/components/template-instances-provider/src/index.vue.d.ts +0 -6
  153. package/components/templates-default/index.d.ts +0 -4
  154. package/components/templates-default/src/ctx.d.ts +0 -19
  155. package/components/templates-default/src/index.vue.d.ts +0 -187
  156. package/components/templates-default/src/types.d.ts +0 -55
  157. package/components/templates-element-plus/index.d.ts +0 -4
  158. package/components/templates-element-plus/src/ctx.d.ts +0 -9
  159. package/components/templates-element-plus/src/index.vue.d.ts +0 -154
  160. package/components/templates-element-plus/src/types.d.ts +0 -13
  161. package/components/templates-esri/index.d.ts +0 -4
  162. package/components/templates-esri/src/ctx.d.ts +0 -11
  163. package/components/templates-esri/src/index.vue.d.ts +0 -43
  164. package/components/templates-esri/src/types.d.ts +0 -2
  165. package/components/templates-layout/index.d.ts +0 -4
  166. package/components/templates-layout/src/ctx.d.ts +0 -9
  167. package/components/templates-layout/src/index.vue.d.ts +0 -173
  168. package/components/templates-layout/src/types.d.ts +0 -32
  169. package/components/templates-variant/index.d.ts +0 -4
  170. package/components/templates-variant/src/ctx.d.ts +0 -11
  171. package/components/templates-variant/src/index.vue.d.ts +0 -43
  172. package/components/templates-variant/src/types.d.ts +0 -2
  173. package/components/upload/index.d.ts +0 -5
  174. package/components/upload/src/ctx.d.ts +0 -200
  175. package/components/upload/src/file.vue.d.ts +0 -306
  176. package/components/upload/src/index.vue.d.ts +0 -1321
  177. package/components/upload/src/types.d.ts +0 -13
  178. package/components/upload-plus/index.d.ts +0 -6
  179. package/components/upload-plus/src/api.d.ts +0 -38
  180. package/components/upload-plus/src/const.d.ts +0 -9
  181. package/components/upload-plus/src/ctx.d.ts +0 -113
  182. package/components/upload-plus/src/index.vue.d.ts +0 -1029
  183. package/components/upload-plus/src/types.d.ts +0 -32
  184. package/components/van-cascader/index.d.ts +0 -4
  185. package/components/van-cascader/src/ctx.d.ts +0 -147
  186. package/components/van-cascader/src/index.vue.d.ts +0 -908
  187. package/components/van-cascader/src/types.d.ts +0 -1
  188. package/components/var-datetime-picker/index.d.ts +0 -4
  189. package/components/var-datetime-picker/src/const.d.ts +0 -10
  190. package/components/var-datetime-picker/src/ctx.d.ts +0 -77
  191. package/components/var-datetime-picker/src/index.vue.d.ts +0 -740
  192. package/components/var-datetime-picker/src/types.d.ts +0 -22
  193. package/components/vditor/index.d.ts +0 -4
  194. package/components/vditor/src/ctx.d.ts +0 -87
  195. package/components/vditor/src/index.vue.d.ts +0 -348
  196. package/components/vditor/src/types.d.ts +0 -7
@@ -0,0 +1,280 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var formItem = require('@vunk/form/components/form-item');
7
+ var form = require('@vunk/form');
8
+ var composables = require('@vunk/core/composables');
9
+ var formItemRenderer = require('@vunk/form/components/form-item-renderer');
10
+ var templatesDefault = require('@vunk/form/components/templates-default');
11
+ var rendererData = require('@vunk/form/components/renderer-data');
12
+ var core = require('@vunk/core');
13
+ var avatar = require('@vunk/plus/components/avatar');
14
+ var index = require('../index2.cjs');
15
+ var text = require('@vunk/plus/components/text');
16
+ var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
17
+
18
+ const props = {
19
+ ...formItem._VkfFormItemCtx.props,
20
+ /**
21
+ * @description model;
22
+ */
23
+ modelValue: null,
24
+ iconSize: {
25
+ type: Number,
26
+ default: 22
27
+ },
28
+ readonly: {
29
+ type: Boolean,
30
+ default: void 0
31
+ },
32
+ /**
33
+ * @description model; Whether the text is editable.
34
+ * @default false
35
+ */
36
+ editable: {
37
+ type: Boolean,
38
+ default: void 0
39
+ },
40
+ /**
41
+ * @description 编辑主体
42
+ * @default __VkfInput.Source
43
+ */
44
+ edit: {
45
+ type: Object,
46
+ default: void 0
47
+ },
48
+ /**
49
+ * @description 文本属性
50
+ * @link https://element-plus.org/zh-CN/component/text.html
51
+ */
52
+ textProps: {
53
+ type: Object,
54
+ default: () => ({})
55
+ }
56
+ };
57
+ const emits = {
58
+ "update:editable": null,
59
+ "update:modelValue": null
60
+ };
61
+
62
+ var _sfc_main = /* @__PURE__ */vue.defineComponent({
63
+ ...{
64
+ name: "VkfEditableText"
65
+ },
66
+ __name: "index",
67
+ props: props,
68
+ emits,
69
+ setup(__props, {
70
+ expose: __expose,
71
+ emit: __emit
72
+ }) {
73
+ __expose();
74
+ const props = __props;
75
+ const emit = __emit;
76
+ const id = vue.useId();
77
+ const editable = composables.useModelComputed({
78
+ key: "editable",
79
+ default: false
80
+ }, props, emit);
81
+ const prop = vue.computed(() => {
82
+ return props.prop ?? id;
83
+ });
84
+ const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props, []);
85
+ const readonly = form.useComputedReadonly(props);
86
+ const formItemContainerRef = vue.ref();
87
+ const formItemRef = vue.ref();
88
+ const editSource = vue.computed(() => {
89
+ const source = {
90
+ templateType: "VkfInput",
91
+ ...formItemBindProps.value,
92
+ inline: true,
93
+ onBlur: handleCheck,
94
+ ...props.edit,
95
+ prop: prop.value,
96
+ elRef: e => {
97
+ props.edit?.elRef?.(e);
98
+ formItemRef.value = e;
99
+ }
100
+ };
101
+ return [source];
102
+ });
103
+ const rendererData$1 = vue.computed(() => {
104
+ const data = {};
105
+ core.setData(data, {
106
+ k: prop.value,
107
+ v: props.modelValue
108
+ });
109
+ return data;
110
+ });
111
+ const handleSetData = ({
112
+ v
113
+ }) => {
114
+ emit("update:modelValue", v);
115
+ };
116
+ const originValue = vue.ref(props.modelValue);
117
+ function handleEdit() {
118
+ originValue.value = props.modelValue;
119
+ editable.value = true;
120
+ vue.nextTick(() => {
121
+ const input = formItemContainerRef.value?.$el.querySelector("input, textarea");
122
+ if (input) {
123
+ input.focus();
124
+ }
125
+ });
126
+ }
127
+ function handleCheck() {
128
+ if (formItemRef.value?.validate) {
129
+ formItemRef.value.validate().then(() => {
130
+ editable.value = false;
131
+ }).catch(() => {
132
+ console.warn("Validation failed, editable text remains open.");
133
+ });
134
+ } else {
135
+ editable.value = false;
136
+ }
137
+ }
138
+ function handleCancel() {
139
+ emit("update:modelValue", originValue.value);
140
+ editable.value = false;
141
+ }
142
+ const __returned__ = {
143
+ props,
144
+ emit,
145
+ id,
146
+ editable,
147
+ prop,
148
+ formItemBindProps,
149
+ readonly,
150
+ formItemContainerRef,
151
+ formItemRef,
152
+ editSource,
153
+ rendererData: rendererData$1,
154
+ handleSetData,
155
+ originValue,
156
+ handleEdit,
157
+ handleCheck,
158
+ handleCancel,
159
+ get VkfFormItem() {
160
+ return formItem.VkfFormItem;
161
+ },
162
+ get VkfFormItemRenderer() {
163
+ return formItemRenderer.VkfFormItemRenderer;
164
+ },
165
+ get VkfTemplatesDefault() {
166
+ return templatesDefault.VkfTemplatesDefault;
167
+ },
168
+ get VkfRendererData() {
169
+ return rendererData.VkfRendererData;
170
+ },
171
+ get VkAvatar() {
172
+ return avatar.VkAvatar;
173
+ },
174
+ get CloseBold() {
175
+ return index.close_bold_default;
176
+ },
177
+ get Select() {
178
+ return index.select_default;
179
+ },
180
+ get VkText() {
181
+ return text.VkText;
182
+ }
183
+ };
184
+ Object.defineProperty(__returned__, "__isScriptSetup", {
185
+ enumerable: false,
186
+ value: true
187
+ });
188
+ return __returned__;
189
+ }
190
+ });
191
+
192
+ const _hoisted_1 = { class: "vkf-editable-text-actions" };
193
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
194
+ return $setup.readonly || !$setup.editable ? (vue.openBlock(), vue.createBlock(
195
+ $setup["VkfFormItem"],
196
+ vue.normalizeProps(vue.mergeProps({ key: 0 }, $setup.formItemBindProps)),
197
+ {
198
+ default: vue.withCtx(() => [
199
+ vue.renderSlot(_ctx.$slots, "text", { handleEdit: $setup.handleEdit }, () => [
200
+ vue.createVNode(
201
+ $setup["VkText"],
202
+ vue.mergeProps(_ctx.textProps, { onDblclick: $setup.handleEdit }),
203
+ {
204
+ default: vue.withCtx(() => [
205
+ vue.createTextVNode(
206
+ vue.toDisplayString(_ctx.modelValue),
207
+ 1
208
+ /* TEXT */
209
+ )
210
+ ]),
211
+ _: 1
212
+ /* STABLE */
213
+ },
214
+ 16
215
+ /* FULL_PROPS */
216
+ )
217
+ ])
218
+ ]),
219
+ _: 3
220
+ /* FORWARDED */
221
+ },
222
+ 16
223
+ /* FULL_PROPS */
224
+ )) : (vue.openBlock(), vue.createBlock($setup["VkfRendererData"], {
225
+ key: 1,
226
+ data: $setup.rendererData,
227
+ onSetData: $setup.handleSetData
228
+ }, {
229
+ default: vue.withCtx(() => [
230
+ vue.createVNode(
231
+ $setup["VkfFormItem"],
232
+ { ref: "formItemContainerRef" },
233
+ {
234
+ default: vue.withCtx(() => [
235
+ vue.createVNode($setup["VkfFormItemRenderer"], { source: $setup.editSource }, {
236
+ placeholder: vue.withCtx(() => [
237
+ vue.createVNode($setup["VkfTemplatesDefault"])
238
+ ]),
239
+ _: 1
240
+ /* STABLE */
241
+ }, 8, ["source"]),
242
+ vue.createElementVNode("div", _hoisted_1, [
243
+ vue.createVNode($setup["VkAvatar"], {
244
+ icon: $setup.Select,
245
+ size: _ctx.iconSize,
246
+ color: "var(--el-color-primary)",
247
+ onClick: $setup.handleCheck
248
+ }, null, 8, ["icon", "size"]),
249
+ vue.createVNode($setup["VkAvatar"], {
250
+ icon: $setup.CloseBold,
251
+ size: _ctx.iconSize,
252
+ color: "var(--el-color-danger)",
253
+ onClick: $setup.handleCancel
254
+ }, null, 8, ["icon", "size"])
255
+ ])
256
+ ]),
257
+ _: 1
258
+ /* STABLE */
259
+ },
260
+ 512
261
+ /* NEED_PATCH */
262
+ )
263
+ ]),
264
+ _: 1
265
+ /* STABLE */
266
+ }, 8, ["data"]));
267
+ }
268
+ var VkfEditableText = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/editable-text/src/index.vue"]]);
269
+
270
+ var types = /*#__PURE__*/Object.freeze({
271
+ __proto__: null
272
+ });
273
+
274
+ VkfEditableText.install = (app) => {
275
+ app.component(VkfEditableText.name || "VkfEditableText", VkfEditableText);
276
+ };
277
+
278
+ exports.VkfEditableText = VkfEditableText;
279
+ exports.__VkfEditableText = types;
280
+ exports.default = VkfEditableText;
@@ -0,0 +1,6 @@
1
+ .vkf-editable-text-actions{
2
+ display: flex;
3
+ }
4
+ .vkf-editable-text-actions .el-avatar {
5
+ cursor: pointer;
6
+ }
@@ -0,0 +1,274 @@
1
+ import { defineComponent, useId, computed, ref, nextTick, openBlock, createBlock, normalizeProps, mergeProps, withCtx, renderSlot, createVNode, createTextVNode, toDisplayString, createElementVNode } from 'vue';
2
+ import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
3
+ import { useComputedReadonly } from '@vunk/form';
4
+ import { useModelComputed } from '@vunk/core/composables';
5
+ import { VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer';
6
+ import { VkfTemplatesDefault } from '@vunk/form/components/templates-default';
7
+ import { VkfRendererData } from '@vunk/form/components/renderer-data';
8
+ import { setData } from '@vunk/core';
9
+ import { VkAvatar } from '@vunk/plus/components/avatar';
10
+ import { a as close_bold_default, s as select_default } from '../index2.mjs';
11
+ import { VkText } from '@vunk/plus/components/text';
12
+ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
13
+
14
+ const props = {
15
+ ..._VkfFormItemCtx.props,
16
+ /**
17
+ * @description model;
18
+ */
19
+ modelValue: null,
20
+ iconSize: {
21
+ type: Number,
22
+ default: 22
23
+ },
24
+ readonly: {
25
+ type: Boolean,
26
+ default: void 0
27
+ },
28
+ /**
29
+ * @description model; Whether the text is editable.
30
+ * @default false
31
+ */
32
+ editable: {
33
+ type: Boolean,
34
+ default: void 0
35
+ },
36
+ /**
37
+ * @description 编辑主体
38
+ * @default __VkfInput.Source
39
+ */
40
+ edit: {
41
+ type: Object,
42
+ default: void 0
43
+ },
44
+ /**
45
+ * @description 文本属性
46
+ * @link https://element-plus.org/zh-CN/component/text.html
47
+ */
48
+ textProps: {
49
+ type: Object,
50
+ default: () => ({})
51
+ }
52
+ };
53
+ const emits = {
54
+ "update:editable": null,
55
+ "update:modelValue": null
56
+ };
57
+
58
+ var _sfc_main = /* @__PURE__ */defineComponent({
59
+ ...{
60
+ name: "VkfEditableText"
61
+ },
62
+ __name: "index",
63
+ props: props,
64
+ emits,
65
+ setup(__props, {
66
+ expose: __expose,
67
+ emit: __emit
68
+ }) {
69
+ __expose();
70
+ const props = __props;
71
+ const emit = __emit;
72
+ const id = useId();
73
+ const editable = useModelComputed({
74
+ key: "editable",
75
+ default: false
76
+ }, props, emit);
77
+ const prop = computed(() => {
78
+ return props.prop ?? id;
79
+ });
80
+ const formItemBindProps = _VkfFormItemCtx.createBindProps(props, []);
81
+ const readonly = useComputedReadonly(props);
82
+ const formItemContainerRef = ref();
83
+ const formItemRef = ref();
84
+ const editSource = computed(() => {
85
+ const source = {
86
+ templateType: "VkfInput",
87
+ ...formItemBindProps.value,
88
+ inline: true,
89
+ onBlur: handleCheck,
90
+ ...props.edit,
91
+ prop: prop.value,
92
+ elRef: e => {
93
+ props.edit?.elRef?.(e);
94
+ formItemRef.value = e;
95
+ }
96
+ };
97
+ return [source];
98
+ });
99
+ const rendererData = computed(() => {
100
+ const data = {};
101
+ setData(data, {
102
+ k: prop.value,
103
+ v: props.modelValue
104
+ });
105
+ return data;
106
+ });
107
+ const handleSetData = ({
108
+ v
109
+ }) => {
110
+ emit("update:modelValue", v);
111
+ };
112
+ const originValue = ref(props.modelValue);
113
+ function handleEdit() {
114
+ originValue.value = props.modelValue;
115
+ editable.value = true;
116
+ nextTick(() => {
117
+ const input = formItemContainerRef.value?.$el.querySelector("input, textarea");
118
+ if (input) {
119
+ input.focus();
120
+ }
121
+ });
122
+ }
123
+ function handleCheck() {
124
+ if (formItemRef.value?.validate) {
125
+ formItemRef.value.validate().then(() => {
126
+ editable.value = false;
127
+ }).catch(() => {
128
+ console.warn("Validation failed, editable text remains open.");
129
+ });
130
+ } else {
131
+ editable.value = false;
132
+ }
133
+ }
134
+ function handleCancel() {
135
+ emit("update:modelValue", originValue.value);
136
+ editable.value = false;
137
+ }
138
+ const __returned__ = {
139
+ props,
140
+ emit,
141
+ id,
142
+ editable,
143
+ prop,
144
+ formItemBindProps,
145
+ readonly,
146
+ formItemContainerRef,
147
+ formItemRef,
148
+ editSource,
149
+ rendererData,
150
+ handleSetData,
151
+ originValue,
152
+ handleEdit,
153
+ handleCheck,
154
+ handleCancel,
155
+ get VkfFormItem() {
156
+ return VkfFormItem;
157
+ },
158
+ get VkfFormItemRenderer() {
159
+ return VkfFormItemRenderer;
160
+ },
161
+ get VkfTemplatesDefault() {
162
+ return VkfTemplatesDefault;
163
+ },
164
+ get VkfRendererData() {
165
+ return VkfRendererData;
166
+ },
167
+ get VkAvatar() {
168
+ return VkAvatar;
169
+ },
170
+ get CloseBold() {
171
+ return close_bold_default;
172
+ },
173
+ get Select() {
174
+ return select_default;
175
+ },
176
+ get VkText() {
177
+ return VkText;
178
+ }
179
+ };
180
+ Object.defineProperty(__returned__, "__isScriptSetup", {
181
+ enumerable: false,
182
+ value: true
183
+ });
184
+ return __returned__;
185
+ }
186
+ });
187
+
188
+ const _hoisted_1 = { class: "vkf-editable-text-actions" };
189
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
190
+ return $setup.readonly || !$setup.editable ? (openBlock(), createBlock(
191
+ $setup["VkfFormItem"],
192
+ normalizeProps(mergeProps({ key: 0 }, $setup.formItemBindProps)),
193
+ {
194
+ default: withCtx(() => [
195
+ renderSlot(_ctx.$slots, "text", { handleEdit: $setup.handleEdit }, () => [
196
+ createVNode(
197
+ $setup["VkText"],
198
+ mergeProps(_ctx.textProps, { onDblclick: $setup.handleEdit }),
199
+ {
200
+ default: withCtx(() => [
201
+ createTextVNode(
202
+ toDisplayString(_ctx.modelValue),
203
+ 1
204
+ /* TEXT */
205
+ )
206
+ ]),
207
+ _: 1
208
+ /* STABLE */
209
+ },
210
+ 16
211
+ /* FULL_PROPS */
212
+ )
213
+ ])
214
+ ]),
215
+ _: 3
216
+ /* FORWARDED */
217
+ },
218
+ 16
219
+ /* FULL_PROPS */
220
+ )) : (openBlock(), createBlock($setup["VkfRendererData"], {
221
+ key: 1,
222
+ data: $setup.rendererData,
223
+ onSetData: $setup.handleSetData
224
+ }, {
225
+ default: withCtx(() => [
226
+ createVNode(
227
+ $setup["VkfFormItem"],
228
+ { ref: "formItemContainerRef" },
229
+ {
230
+ default: withCtx(() => [
231
+ createVNode($setup["VkfFormItemRenderer"], { source: $setup.editSource }, {
232
+ placeholder: withCtx(() => [
233
+ createVNode($setup["VkfTemplatesDefault"])
234
+ ]),
235
+ _: 1
236
+ /* STABLE */
237
+ }, 8, ["source"]),
238
+ createElementVNode("div", _hoisted_1, [
239
+ createVNode($setup["VkAvatar"], {
240
+ icon: $setup.Select,
241
+ size: _ctx.iconSize,
242
+ color: "var(--el-color-primary)",
243
+ onClick: $setup.handleCheck
244
+ }, null, 8, ["icon", "size"]),
245
+ createVNode($setup["VkAvatar"], {
246
+ icon: $setup.CloseBold,
247
+ size: _ctx.iconSize,
248
+ color: "var(--el-color-danger)",
249
+ onClick: $setup.handleCancel
250
+ }, null, 8, ["icon", "size"])
251
+ ])
252
+ ]),
253
+ _: 1
254
+ /* STABLE */
255
+ },
256
+ 512
257
+ /* NEED_PATCH */
258
+ )
259
+ ]),
260
+ _: 1
261
+ /* STABLE */
262
+ }, 8, ["data"]));
263
+ }
264
+ var VkfEditableText = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/editable-text/src/index.vue"]]);
265
+
266
+ var types = /*#__PURE__*/Object.freeze({
267
+ __proto__: null
268
+ });
269
+
270
+ VkfEditableText.install = (app) => {
271
+ app.component(VkfEditableText.name || "VkfEditableText", VkfEditableText);
272
+ };
273
+
274
+ export { VkfEditableText, types as __VkfEditableText, VkfEditableText as default };
@@ -2,7 +2,7 @@ import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, cre
2
2
  import { _VkfInputCtx, VkfInput } from '@vunk/form/components/input';
3
3
  import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
4
4
  import { ElButton, ElIcon, ElButtonGroup, ElUpload, ElMessage } from 'element-plus';
5
- import { u as upload_default, e as edit_default, m as map_location_default, a as document_checked_default } from '../index2.mjs';
5
+ import { u as upload_default, e as edit_default, m as map_location_default, b as document_checked_default } from '../index2.mjs';
6
6
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
7
7
  import { VaTdtBasemap, VaMapView, VaSketch, VaGraphicsLayer } from '@vuesri/core';
8
8
  import MapView from '@arcgis/core/views/MapView';
@@ -135,7 +135,7 @@ var _sfc_main = vue.defineComponent({
135
135
  const theSlots = {
136
136
  labelActions: slots?.labelActions ? () => slots.labelActions?.() : void 0
137
137
  };
138
- const keys = ["labelActions"];
138
+ const keys = ["labelActions", "after"];
139
139
  const formItemSlots = props2.formItemSlots;
140
140
  formItemSlots && Object.keys(formItemSlots).filter((key) => keys.includes(key)).forEach((key) => {
141
141
  const slot = formItemSlots?.[key];
@@ -180,10 +180,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
180
180
  }), vue.createSlots({
181
181
  default: vue.withCtx(() => [
182
182
  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),
183
184
  _ctx.formItemTip ? (vue.openBlock(), vue.createElementBlock(
184
185
  "div",
185
186
  {
186
- key: 0,
187
+ key: 1,
187
188
  class: vue.normalizeClass(["vkf-form-item__tip", _ctx.formItemTipClass])
188
189
  },
189
190
  [
@@ -1,6 +1,6 @@
1
1
  import { formItemProps, ElFormItem, ElIcon, ElTooltip, ElButton, useGlobalConfig } from 'element-plus';
2
2
  import { bindPropsFactory } from '@vunk/core/shared/utils-vue';
3
- import { defineComponent, computed, resolveComponent, openBlock, createBlock, mergeProps, createSlots, withCtx, renderSlot, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, createVNode, resolveDynamicComponent, renderList } from 'vue';
3
+ import { defineComponent, computed, resolveComponent, openBlock, createBlock, mergeProps, createSlots, withCtx, renderSlot, resolveDynamicComponent, createCommentVNode, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createVNode, renderList } from 'vue';
4
4
  import { createFormItemBindProps } from '@vunk/form/shared/element-plus';
5
5
  import { useComputedReadonly } from '@vunk/form/composables';
6
6
  import { isPlainObject } from '@vunk/core/shared/utils-object';
@@ -131,7 +131,7 @@ var _sfc_main = defineComponent({
131
131
  const theSlots = {
132
132
  labelActions: slots?.labelActions ? () => slots.labelActions?.() : void 0
133
133
  };
134
- const keys = ["labelActions"];
134
+ const keys = ["labelActions", "after"];
135
135
  const formItemSlots = props2.formItemSlots;
136
136
  formItemSlots && Object.keys(formItemSlots).filter((key) => keys.includes(key)).forEach((key) => {
137
137
  const slot = formItemSlots?.[key];
@@ -176,10 +176,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
176
176
  }), createSlots({
177
177
  default: withCtx(() => [
178
178
  renderSlot(_ctx.$slots, "default"),
179
+ _ctx.customSlots.after ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.customSlots.after), { key: 0 })) : createCommentVNode("v-if", true),
179
180
  _ctx.formItemTip ? (openBlock(), createElementBlock(
180
181
  "div",
181
182
  {
182
- key: 0,
183
+ key: 1,
183
184
  class: normalizeClass(["vkf-form-item__tip", _ctx.formItemTipClass])
184
185
  },
185
186
  [
@@ -62,6 +62,24 @@ var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE
62
62
 
63
63
  // src/components/circle-close-filled.vue
64
64
  var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
65
+ var close_bold_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
66
+ name: "CloseBold",
67
+ __name: "close-bold",
68
+ setup(__props) {
69
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
70
+ xmlns: "http://www.w3.org/2000/svg",
71
+ viewBox: "0 0 1024 1024"
72
+ }, [
73
+ vue.createElementVNode("path", {
74
+ fill: "currentColor",
75
+ d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"
76
+ })
77
+ ]));
78
+ }
79
+ });
80
+
81
+ // src/components/close-bold.vue
82
+ var close_bold_default = close_bold_vue_vue_type_script_setup_true_lang_default;
65
83
  var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
66
84
  name: "Close",
67
85
  __name: "close",
@@ -250,6 +268,24 @@ var right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defi
250
268
 
251
269
  // src/components/right.vue
252
270
  var right_default = right_vue_vue_type_script_setup_true_lang_default;
271
+ var select_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
272
+ name: "Select",
273
+ __name: "select",
274
+ setup(__props) {
275
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
276
+ xmlns: "http://www.w3.org/2000/svg",
277
+ viewBox: "0 0 1024 1024"
278
+ }, [
279
+ vue.createElementVNode("path", {
280
+ fill: "currentColor",
281
+ d: "M77.248 415.04a64 64 0 0 1 90.496 0l226.304 226.304L846.528 188.8a64 64 0 1 1 90.56 90.496l-543.04 543.04-316.8-316.8a64 64 0 0 1 0-90.496z"
282
+ })
283
+ ]));
284
+ }
285
+ });
286
+
287
+ // src/components/select.vue
288
+ var select_default = select_vue_vue_type_script_setup_true_lang_default;
253
289
  var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
254
290
  name: "SuccessFilled",
255
291
  __name: "success-filled",
@@ -344,6 +380,7 @@ var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
344
380
  exports.check_default = check_default;
345
381
  exports.circle_check_default = circle_check_default;
346
382
  exports.circle_close_filled_default = circle_close_filled_default;
383
+ exports.close_bold_default = close_bold_default;
347
384
  exports.close_default = close_default;
348
385
  exports.delete_default = delete_default;
349
386
  exports.document_checked_default = document_checked_default;
@@ -354,6 +391,7 @@ exports.map_location_default = map_location_default;
354
391
  exports.minus_default = minus_default;
355
392
  exports.plus_default = plus_default;
356
393
  exports.right_default = right_default;
394
+ exports.select_default = select_default;
357
395
  exports.success_filled_default = success_filled_default;
358
396
  exports.upload_default = upload_default;
359
397
  exports.upload_filled_default = upload_filled_default;