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