@vunk/form 2.2.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/components/api-tables-select/index.cjs +468 -0
  2. package/components/api-tables-select/index.d.ts +4 -0
  3. package/components/api-tables-select/index.mjs +462 -0
  4. package/components/api-tables-select/src/ctx.d.ts +340 -0
  5. package/components/api-tables-select/src/index.vue.d.ts +844 -0
  6. package/components/api-tables-select/src/types.d.ts +13 -0
  7. package/components/button/src/index.vue.d.ts +16 -16
  8. package/components/card-input-collection/index.cjs +1 -0
  9. package/components/card-input-collection/index.mjs +1 -0
  10. package/components/card-input-collection/src/index.vue.d.ts +3 -3
  11. package/components/cascader/src/ctx.d.ts +2 -2
  12. package/components/cascader/src/index.vue.d.ts +22 -22
  13. package/components/checkbox/src/ctx.d.ts +1 -1
  14. package/components/checkbox/src/index.vue.d.ts +8 -8
  15. package/components/cloneDeep.cjs +25 -180
  16. package/components/cloneDeep.mjs +1 -156
  17. package/components/color-picker/src/index.vue.d.ts +4 -4
  18. package/components/date-picker/src/ctx.d.ts +2 -2
  19. package/components/date-picker/src/index.vue.d.ts +18 -18
  20. package/components/date-picker-range/src/ctx.d.ts +21 -21
  21. package/components/date-picker-range/src/index.vue.d.ts +50 -50
  22. package/components/download-plus/src/index.vue.d.ts +1 -1
  23. package/components/esri-input-geojson/src/append.vue.d.ts +1 -1
  24. package/components/esri-input-geojson/src/ctx.d.ts +2 -2
  25. package/components/esri-input-geojson/src/index.vue.d.ts +18 -18
  26. package/components/form/src/ctx.d.ts +2 -2
  27. package/components/form/src/index.vue.d.ts +11 -11
  28. package/components/form-item/src/index.vue.d.ts +2 -2
  29. package/components/input/src/ctx.d.ts +2 -2
  30. package/components/input/src/index.vue.d.ts +13 -13
  31. package/components/input-collection/index.cjs +1 -0
  32. package/components/input-collection/index.mjs +1 -0
  33. package/components/input-collection/src/index.vue.d.ts +4 -4
  34. package/components/input-link/src/index.vue.d.ts +6 -6
  35. package/components/input-number/src/ctx.d.ts +2 -2
  36. package/components/input-number/src/index.vue.d.ts +9 -9
  37. package/components/isObject.cjs +165 -0
  38. package/components/isObject.mjs +158 -0
  39. package/components/monaco-editor/src/index.vue.d.ts +2 -2
  40. package/components/radio/src/index.vue.d.ts +7 -7
  41. package/components/select/src/ctx.d.ts +3 -3
  42. package/components/select/src/index.vue.d.ts +24 -24
  43. package/components/slider/src/index.vue.d.ts +11 -11
  44. package/components/switch/src/index.vue.d.ts +10 -10
  45. package/components/tables-select/index.cjs +29 -4
  46. package/components/tables-select/index.d.ts +1 -0
  47. package/components/tables-select/index.mjs +29 -5
  48. package/components/tables-select/src/ctx.d.ts +14 -5
  49. package/components/tables-select/src/index.vue.d.ts +122 -113
  50. package/components/tables-select/src/types.d.ts +2 -1
  51. package/components/upload/src/ctx.d.ts +1 -1
  52. package/components/upload/src/index.vue.d.ts +4 -4
  53. package/components/upload-plus/src/index.vue.d.ts +1 -1
  54. package/components/van-cascader/src/index.vue.d.ts +14 -14
  55. package/components/var-datetime-picker/src/index.vue.d.ts +2 -2
  56. package/components/vditor/src/index.vue.d.ts +2 -2
  57. package/package.json +6 -1
@@ -0,0 +1,462 @@
1
+ import { _VkfTablesSelectCtx, VkfTablesSelect } from '@vunk/form/components/tables-select';
2
+ import { pickObject } from '@vunk/shared/object';
3
+ import { defineComponent, ref, reactive, watch, resolveComponent, openBlock, createBlock, mergeProps, toHandlers, withCtx, createVNode, renderSlot } from 'vue';
4
+ import { VkfForm } from '@vunk/form';
5
+ import { setData } from '@vunk/core';
6
+ import { i as isObjectLike, b as baseGetTag, a as isObject, r as root } from '../isObject.mjs';
7
+ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
8
+
9
+ const tablesSelectProps = pickObject(_VkfTablesSelectCtx.props, {
10
+ excludes: [
11
+ "currentPage",
12
+ "pageSize",
13
+ "total",
14
+ "data",
15
+ "start"
16
+ ]
17
+ });
18
+ const props = {
19
+ ...tablesSelectProps,
20
+ /**
21
+ * @description 读取数据的api
22
+ */
23
+ readApi: {
24
+ type: Function,
25
+ default: () => ({ rows: [], total: 0 })
26
+ },
27
+ /**
28
+ * @description 获取完整数据
29
+ * @default props.rApi({ ids: ids.join(',') })
30
+ */
31
+ getRows: {
32
+ type: Function,
33
+ default: void 0
34
+ },
35
+ /**
36
+ * query表单配置
37
+ */
38
+ queryItems: {
39
+ type: Array,
40
+ default: () => []
41
+ },
42
+ /**
43
+ * query表单是否继承父级模板
44
+ */
45
+ inheritTemplates: {
46
+ type: Boolean,
47
+ default: false
48
+ }
49
+ };
50
+ ({
51
+ ..._VkfTablesSelectCtx.emits
52
+ });
53
+
54
+ /** `Object#toString` result references. */
55
+ var symbolTag = '[object Symbol]';
56
+
57
+ /**
58
+ * Checks if `value` is classified as a `Symbol` primitive or object.
59
+ *
60
+ * @static
61
+ * @memberOf _
62
+ * @since 4.0.0
63
+ * @category Lang
64
+ * @param {*} value The value to check.
65
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
66
+ * @example
67
+ *
68
+ * _.isSymbol(Symbol.iterator);
69
+ * // => true
70
+ *
71
+ * _.isSymbol('abc');
72
+ * // => false
73
+ */
74
+ function isSymbol(value) {
75
+ return typeof value == 'symbol' ||
76
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
77
+ }
78
+
79
+ /** Used to match a single whitespace character. */
80
+ var reWhitespace = /\s/;
81
+
82
+ /**
83
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
84
+ * character of `string`.
85
+ *
86
+ * @private
87
+ * @param {string} string The string to inspect.
88
+ * @returns {number} Returns the index of the last non-whitespace character.
89
+ */
90
+ function trimmedEndIndex(string) {
91
+ var index = string.length;
92
+
93
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
94
+ return index;
95
+ }
96
+
97
+ /** Used to match leading whitespace. */
98
+ var reTrimStart = /^\s+/;
99
+
100
+ /**
101
+ * The base implementation of `_.trim`.
102
+ *
103
+ * @private
104
+ * @param {string} string The string to trim.
105
+ * @returns {string} Returns the trimmed string.
106
+ */
107
+ function baseTrim(string) {
108
+ return string
109
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
110
+ : string;
111
+ }
112
+
113
+ /** Used as references for various `Number` constants. */
114
+ var NAN = 0 / 0;
115
+
116
+ /** Used to detect bad signed hexadecimal string values. */
117
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
118
+
119
+ /** Used to detect binary string values. */
120
+ var reIsBinary = /^0b[01]+$/i;
121
+
122
+ /** Used to detect octal string values. */
123
+ var reIsOctal = /^0o[0-7]+$/i;
124
+
125
+ /** Built-in method references without a dependency on `root`. */
126
+ var freeParseInt = parseInt;
127
+
128
+ /**
129
+ * Converts `value` to a number.
130
+ *
131
+ * @static
132
+ * @memberOf _
133
+ * @since 4.0.0
134
+ * @category Lang
135
+ * @param {*} value The value to process.
136
+ * @returns {number} Returns the number.
137
+ * @example
138
+ *
139
+ * _.toNumber(3.2);
140
+ * // => 3.2
141
+ *
142
+ * _.toNumber(Number.MIN_VALUE);
143
+ * // => 5e-324
144
+ *
145
+ * _.toNumber(Infinity);
146
+ * // => Infinity
147
+ *
148
+ * _.toNumber('3.2');
149
+ * // => 3.2
150
+ */
151
+ function toNumber(value) {
152
+ if (typeof value == 'number') {
153
+ return value;
154
+ }
155
+ if (isSymbol(value)) {
156
+ return NAN;
157
+ }
158
+ if (isObject(value)) {
159
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
160
+ value = isObject(other) ? (other + '') : other;
161
+ }
162
+ if (typeof value != 'string') {
163
+ return value === 0 ? value : +value;
164
+ }
165
+ value = baseTrim(value);
166
+ var isBinary = reIsBinary.test(value);
167
+ return (isBinary || reIsOctal.test(value))
168
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
169
+ : (reIsBadHex.test(value) ? NAN : +value);
170
+ }
171
+
172
+ /**
173
+ * Gets the timestamp of the number of milliseconds that have elapsed since
174
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
175
+ *
176
+ * @static
177
+ * @memberOf _
178
+ * @since 2.4.0
179
+ * @category Date
180
+ * @returns {number} Returns the timestamp.
181
+ * @example
182
+ *
183
+ * _.defer(function(stamp) {
184
+ * console.log(_.now() - stamp);
185
+ * }, _.now());
186
+ * // => Logs the number of milliseconds it took for the deferred invocation.
187
+ */
188
+ var now = function() {
189
+ return root.Date.now();
190
+ };
191
+
192
+ /** Error message constants. */
193
+ var FUNC_ERROR_TEXT = 'Expected a function';
194
+
195
+ /* Built-in method references for those with the same name as other `lodash` methods. */
196
+ var nativeMax = Math.max,
197
+ nativeMin = Math.min;
198
+
199
+ /**
200
+ * Creates a debounced function that delays invoking `func` until after `wait`
201
+ * milliseconds have elapsed since the last time the debounced function was
202
+ * invoked. The debounced function comes with a `cancel` method to cancel
203
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
204
+ * Provide `options` to indicate whether `func` should be invoked on the
205
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
206
+ * with the last arguments provided to the debounced function. Subsequent
207
+ * calls to the debounced function return the result of the last `func`
208
+ * invocation.
209
+ *
210
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
211
+ * invoked on the trailing edge of the timeout only if the debounced function
212
+ * is invoked more than once during the `wait` timeout.
213
+ *
214
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
215
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
216
+ *
217
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
218
+ * for details over the differences between `_.debounce` and `_.throttle`.
219
+ *
220
+ * @static
221
+ * @memberOf _
222
+ * @since 0.1.0
223
+ * @category Function
224
+ * @param {Function} func The function to debounce.
225
+ * @param {number} [wait=0] The number of milliseconds to delay.
226
+ * @param {Object} [options={}] The options object.
227
+ * @param {boolean} [options.leading=false]
228
+ * Specify invoking on the leading edge of the timeout.
229
+ * @param {number} [options.maxWait]
230
+ * The maximum time `func` is allowed to be delayed before it's invoked.
231
+ * @param {boolean} [options.trailing=true]
232
+ * Specify invoking on the trailing edge of the timeout.
233
+ * @returns {Function} Returns the new debounced function.
234
+ * @example
235
+ *
236
+ * // Avoid costly calculations while the window size is in flux.
237
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
238
+ *
239
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
240
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
241
+ * 'leading': true,
242
+ * 'trailing': false
243
+ * }));
244
+ *
245
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
246
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
247
+ * var source = new EventSource('/stream');
248
+ * jQuery(source).on('message', debounced);
249
+ *
250
+ * // Cancel the trailing debounced invocation.
251
+ * jQuery(window).on('popstate', debounced.cancel);
252
+ */
253
+ function debounce(func, wait, options) {
254
+ var lastArgs,
255
+ lastThis,
256
+ maxWait,
257
+ result,
258
+ timerId,
259
+ lastCallTime,
260
+ lastInvokeTime = 0,
261
+ leading = false,
262
+ maxing = false,
263
+ trailing = true;
264
+
265
+ if (typeof func != 'function') {
266
+ throw new TypeError(FUNC_ERROR_TEXT);
267
+ }
268
+ wait = toNumber(wait) || 0;
269
+ if (isObject(options)) {
270
+ leading = !!options.leading;
271
+ maxing = 'maxWait' in options;
272
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
273
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
274
+ }
275
+
276
+ function invokeFunc(time) {
277
+ var args = lastArgs,
278
+ thisArg = lastThis;
279
+
280
+ lastArgs = lastThis = undefined;
281
+ lastInvokeTime = time;
282
+ result = func.apply(thisArg, args);
283
+ return result;
284
+ }
285
+
286
+ function leadingEdge(time) {
287
+ // Reset any `maxWait` timer.
288
+ lastInvokeTime = time;
289
+ // Start the timer for the trailing edge.
290
+ timerId = setTimeout(timerExpired, wait);
291
+ // Invoke the leading edge.
292
+ return leading ? invokeFunc(time) : result;
293
+ }
294
+
295
+ function remainingWait(time) {
296
+ var timeSinceLastCall = time - lastCallTime,
297
+ timeSinceLastInvoke = time - lastInvokeTime,
298
+ timeWaiting = wait - timeSinceLastCall;
299
+
300
+ return maxing
301
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
302
+ : timeWaiting;
303
+ }
304
+
305
+ function shouldInvoke(time) {
306
+ var timeSinceLastCall = time - lastCallTime,
307
+ timeSinceLastInvoke = time - lastInvokeTime;
308
+
309
+ // Either this is the first call, activity has stopped and we're at the
310
+ // trailing edge, the system time has gone backwards and we're treating
311
+ // it as the trailing edge, or we've hit the `maxWait` limit.
312
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
313
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
314
+ }
315
+
316
+ function timerExpired() {
317
+ var time = now();
318
+ if (shouldInvoke(time)) {
319
+ return trailingEdge(time);
320
+ }
321
+ // Restart the timer.
322
+ timerId = setTimeout(timerExpired, remainingWait(time));
323
+ }
324
+
325
+ function trailingEdge(time) {
326
+ timerId = undefined;
327
+
328
+ // Only invoke if we have `lastArgs` which means `func` has been
329
+ // debounced at least once.
330
+ if (trailing && lastArgs) {
331
+ return invokeFunc(time);
332
+ }
333
+ lastArgs = lastThis = undefined;
334
+ return result;
335
+ }
336
+
337
+ function cancel() {
338
+ if (timerId !== undefined) {
339
+ clearTimeout(timerId);
340
+ }
341
+ lastInvokeTime = 0;
342
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
343
+ }
344
+
345
+ function flush() {
346
+ return timerId === undefined ? result : trailingEdge(now());
347
+ }
348
+
349
+ function debounced() {
350
+ var time = now(),
351
+ isInvoking = shouldInvoke(time);
352
+
353
+ lastArgs = arguments;
354
+ lastThis = this;
355
+ lastCallTime = time;
356
+
357
+ if (isInvoking) {
358
+ if (timerId === undefined) {
359
+ return leadingEdge(lastCallTime);
360
+ }
361
+ if (maxing) {
362
+ // Handle invocations in a tight loop.
363
+ clearTimeout(timerId);
364
+ timerId = setTimeout(timerExpired, wait);
365
+ return invokeFunc(lastCallTime);
366
+ }
367
+ }
368
+ if (timerId === undefined) {
369
+ timerId = setTimeout(timerExpired, wait);
370
+ }
371
+ return result;
372
+ }
373
+ debounced.cancel = cancel;
374
+ debounced.flush = flush;
375
+ return debounced;
376
+ }
377
+
378
+ var _sfc_main = defineComponent({
379
+ name: "VkfApiTablesSelect",
380
+ components: {
381
+ VkfTablesSelect,
382
+ VkfForm
383
+ },
384
+ props,
385
+ setup(props2, { emit }) {
386
+ const debounceRead = debounce(read, 300);
387
+ const coreProps = _VkfTablesSelectCtx.createBindProps(props2, ["getRows"]);
388
+ const coreEmits = _VkfTablesSelectCtx.createOnEmits(emit);
389
+ const queryData = ref({});
390
+ const tableState = reactive({
391
+ data: [],
392
+ total: 0
393
+ });
394
+ const pagination = ref({
395
+ pageSize: 10,
396
+ start: 0
397
+ });
398
+ watch(pagination, debounceRead, { deep: true, immediate: true });
399
+ watch(queryData, debounceRead, { deep: true });
400
+ async function read() {
401
+ const res = await props2.readApi(queryData.value, {
402
+ ...pagination.value,
403
+ currentPage: pagination.value.start / pagination.value.pageSize + 1
404
+ });
405
+ tableState.data = res.rows;
406
+ tableState.total = res.total;
407
+ }
408
+ const defaultGetRows = async (ids) => {
409
+ const { rows } = await props2.readApi({
410
+ ids: ids.join(",")
411
+ });
412
+ return rows;
413
+ };
414
+ return {
415
+ pagination,
416
+ tableState,
417
+ setData,
418
+ queryData,
419
+ coreProps,
420
+ coreEmits,
421
+ defaultGetRows
422
+ };
423
+ }
424
+ });
425
+
426
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
427
+ const _component_VkfForm = resolveComponent("VkfForm");
428
+ const _component_VkfTablesSelect = resolveComponent("VkfTablesSelect");
429
+ return openBlock(), createBlock(_component_VkfTablesSelect, mergeProps({
430
+ start: _ctx.pagination.start,
431
+ "onUpdate:start": _cache[1] || (_cache[1] = ($event) => _ctx.pagination.start = $event),
432
+ "page-size": _ctx.pagination.pageSize,
433
+ "onUpdate:pageSize": _cache[2] || (_cache[2] = ($event) => _ctx.pagination.pageSize = $event),
434
+ data: _ctx.tableState.data,
435
+ total: _ctx.tableState.total,
436
+ "get-rows": _ctx.getRows || _ctx.defaultGetRows
437
+ }, _ctx.coreProps, toHandlers(_ctx.coreEmits)), {
438
+ dialog: withCtx(() => [
439
+ createVNode(_component_VkfForm, {
440
+ "form-items": _ctx.queryItems,
441
+ inline: true,
442
+ data: _ctx.queryData,
443
+ "inherit-templates": _ctx.inheritTemplates,
444
+ onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.setData(_ctx.queryData, $event))
445
+ }, null, 8, ["form-items", "data", "inherit-templates"]),
446
+ renderSlot(_ctx.$slots, "dialog")
447
+ ]),
448
+ _: 3
449
+ /* FORWARDED */
450
+ }, 16, ["start", "page-size", "data", "total", "get-rows"]);
451
+ }
452
+ var VkfApiTablesSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/api-tables-select/src/index.vue"]]);
453
+
454
+ var types = /*#__PURE__*/Object.freeze({
455
+ __proto__: null
456
+ });
457
+
458
+ VkfApiTablesSelect.install = (app) => {
459
+ app.component(VkfApiTablesSelect.name || "VkfApiTablesSelect", VkfApiTablesSelect);
460
+ };
461
+
462
+ export { VkfApiTablesSelect, types as __VkfApiTablesSelect, VkfApiTablesSelect as default };