@qin-ui/antd-vue-pro 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/component-provider/{index-DtsWFG3s.js → index-BhdS_9jN.js} +1 -1
- package/es/component-provider/index.js +1 -1
- package/es/form/index.js +23 -12
- package/es/index.d.ts +9 -2
- package/es/index.js +2 -2
- package/es/table/index.js +2 -2
- package/es/vendor/utils/{lodash-es-Bu1KKNMo.js → lodash-es-B2uQdS28.js} +176 -41
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, provide, renderSlot } from "vue";
|
|
2
|
-
import { i as isPlainObject } from "../vendor/utils/lodash-es-
|
|
2
|
+
import { i as isPlainObject } from "../vendor/utils/lodash-es-B2uQdS28.js";
|
|
3
3
|
const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
|
|
4
4
|
const INJECT_CONFIG = {
|
|
5
5
|
"pro-table": {
|
package/es/form/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config
|
|
|
4
4
|
import { colProps } from "ant-design-vue/es/grid/Col";
|
|
5
5
|
import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
|
|
6
6
|
import { defineComponent, provide, inject, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, renderSlot, computed, toValue, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, reactive, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
|
|
7
|
-
import { I as INJECT_CONFIG, g as getObject } from "../component-provider/index-
|
|
8
|
-
import { i as isPlainObject, t as toPath, g as get, s as set, c as cloneDeep } from "../vendor/utils/lodash-es-
|
|
7
|
+
import { I as INJECT_CONFIG, g as getObject } from "../component-provider/index-BhdS_9jN.js";
|
|
8
|
+
import { i as isPlainObject, t as toPath, g as get, s as set, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-B2uQdS28.js";
|
|
9
9
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
10
10
|
...{ name: "ProForm", inheritAttrs: false },
|
|
11
11
|
__name: "index",
|
|
@@ -511,7 +511,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
511
511
|
setup(__props, { expose: __expose }) {
|
|
512
512
|
const props = __props;
|
|
513
513
|
const form = useForm(false);
|
|
514
|
-
const {
|
|
514
|
+
const { getFormData, setFormData } = form;
|
|
515
515
|
const componentRef = ref();
|
|
516
516
|
const formItemContext = useInjectFormItemContext();
|
|
517
517
|
const triggerFormItemChange = () => {
|
|
@@ -519,18 +519,28 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
519
519
|
formItemContext.onFieldChange();
|
|
520
520
|
};
|
|
521
521
|
const attrs = useAttrs();
|
|
522
|
+
const { valueFormatter } = attrs;
|
|
523
|
+
function getOldValue() {
|
|
524
|
+
return cloneDeep(getFormData == null ? void 0 : getFormData(props.path));
|
|
525
|
+
}
|
|
522
526
|
const value = computed({
|
|
523
527
|
get() {
|
|
524
|
-
|
|
528
|
+
let val = getFormData == null ? void 0 : getFormData(props.path);
|
|
529
|
+
if (typeof valueFormatter === "object" && typeof valueFormatter.get === "function") {
|
|
530
|
+
val = valueFormatter.get(val);
|
|
531
|
+
}
|
|
532
|
+
return val;
|
|
525
533
|
},
|
|
526
534
|
set(val) {
|
|
527
|
-
|
|
528
|
-
if (valueFormatter
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
535
|
+
let newVal = val;
|
|
536
|
+
if (valueFormatter) {
|
|
537
|
+
if (typeof valueFormatter === "function") {
|
|
538
|
+
newVal = valueFormatter(val, getOldValue());
|
|
539
|
+
} else if (typeof valueFormatter.set === "function") {
|
|
540
|
+
newVal = valueFormatter.set(val, getOldValue());
|
|
541
|
+
}
|
|
533
542
|
}
|
|
543
|
+
setFormData == null ? void 0 : setFormData(props.path, newVal);
|
|
534
544
|
triggerFormItemChange();
|
|
535
545
|
}
|
|
536
546
|
});
|
|
@@ -548,8 +558,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
548
558
|
{ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
|
|
549
559
|
{ modelName: attrs.modelName ?? initProps.modelName ?? "value" }
|
|
550
560
|
);
|
|
551
|
-
const { valueFormatter, modelName, slots, componentClassName, componentStyle, componentContainer, ...rest } = mergedProps;
|
|
552
|
-
|
|
561
|
+
const { valueFormatter: valueFormatter2, modelName, slots, componentClassName, componentStyle, componentContainer, ...rest } = mergedProps;
|
|
562
|
+
const bindAttrs = omit(rest, [modelName, `onUpdate:${modelName}`]);
|
|
563
|
+
return { attrs: bindAttrs, slots, componentContainer, modelName };
|
|
553
564
|
});
|
|
554
565
|
const teleportComponent = inject(
|
|
555
566
|
`${TeleportComponentNamePrefix}${props.path}`,
|
package/es/index.d.ts
CHANGED
|
@@ -165,10 +165,10 @@ export declare interface Base<D extends Data = Data> {
|
|
|
165
165
|
*/
|
|
166
166
|
componentContainer?: ContainerComponent;
|
|
167
167
|
/**
|
|
168
|
-
* @description 字段值处理函数,在onUpdateValue
|
|
168
|
+
* @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
|
|
169
169
|
* @example (val) => val?.trim()
|
|
170
170
|
*/
|
|
171
|
-
valueFormatter?:
|
|
171
|
+
valueFormatter?: ValueFormatter;
|
|
172
172
|
/**
|
|
173
173
|
* @description 组件v-model双向绑定更新属性名,默认'value'
|
|
174
174
|
*/
|
|
@@ -1024,6 +1024,13 @@ export declare const useTable: <D extends Data = Data, T extends object = Extend
|
|
|
1024
1024
|
searchFields?: Fields<D>;
|
|
1025
1025
|
}) => Table<D, T>;
|
|
1026
1026
|
|
|
1027
|
+
export declare type ValueFormatter = {
|
|
1028
|
+
(val: any, oldVal: any): any;
|
|
1029
|
+
} | {
|
|
1030
|
+
get?: (val: any) => any;
|
|
1031
|
+
set?: (val: any, oldVal: any) => any;
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1027
1034
|
export declare type VModelProps<T = any> = {
|
|
1028
1035
|
value?: T;
|
|
1029
1036
|
'onUpdate:value'?: (val: T) => void;
|
package/es/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import _sfc_main from "./form/index.js";
|
|
|
3
3
|
import { BaseField, BaseFormItem, COMPONENT_MAP, ContainerFragment, FORM, FORM_ITEM_SLOT_KEYS, PATH, SlotComponent, TeleportComponentNamePrefix, useFields, useForm, useFormData } from "./form/index.js";
|
|
4
4
|
import BaseTable from "./table/index.js";
|
|
5
5
|
import { useTable } from "./table/index.js";
|
|
6
|
-
import { _ as _sfc_main$1 } from "./component-provider/index-
|
|
7
|
-
import { I } from "./component-provider/index-
|
|
6
|
+
import { _ as _sfc_main$1 } from "./component-provider/index-BhdS_9jN.js";
|
|
7
|
+
import { I } from "./component-provider/index-BhdS_9jN.js";
|
|
8
8
|
const withInstall = (comp) => {
|
|
9
9
|
comp.install = (app) => {
|
|
10
10
|
app.component(comp.name, comp);
|
package/es/table/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, createCommentVNode, createTextVNode, toDisplayString, normalizeStyle, toValue, renderSlot, useAttrs, Fragment, renderList, withModifiers, inject, useSlots, onMounted, normalizeClass, isRef, createSlots, normalizeProps, guardReactiveProps, nextTick, reactive } from "vue";
|
|
2
|
-
import { I as INJECT_CONFIG, g as getObject } from "../component-provider/index-
|
|
2
|
+
import { I as INJECT_CONFIG, g as getObject } from "../component-provider/index-BhdS_9jN.js";
|
|
3
3
|
import _sfc_main$9, { ContainerFragment as _sfc_main$a, useForm } from "../form/index.js";
|
|
4
4
|
import { Space, Button, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
|
|
5
|
-
import { p as pick, c as cloneDeep } from "../vendor/utils/lodash-es-
|
|
5
|
+
import { p as pick, c as cloneDeep } from "../vendor/utils/lodash-es-B2uQdS28.js";
|
|
6
6
|
import { tableProps } from "ant-design-vue/es/table";
|
|
7
7
|
const _export_sfc = (sfc, props) => {
|
|
8
8
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -2,12 +2,12 @@ var freeGlobal = typeof global == "object" && global && global.Object === Object
|
|
|
2
2
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
3
3
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
4
4
|
var Symbol$1 = root.Symbol;
|
|
5
|
-
var objectProto$
|
|
6
|
-
var hasOwnProperty$
|
|
7
|
-
var nativeObjectToString$1 = objectProto$
|
|
5
|
+
var objectProto$d = Object.prototype;
|
|
6
|
+
var hasOwnProperty$a = objectProto$d.hasOwnProperty;
|
|
7
|
+
var nativeObjectToString$1 = objectProto$d.toString;
|
|
8
8
|
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
9
9
|
function getRawTag(value) {
|
|
10
|
-
var isOwn = hasOwnProperty$
|
|
10
|
+
var isOwn = hasOwnProperty$a.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
11
11
|
try {
|
|
12
12
|
value[symToStringTag$1] = void 0;
|
|
13
13
|
var unmasked = true;
|
|
@@ -23,8 +23,8 @@ function getRawTag(value) {
|
|
|
23
23
|
}
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
|
-
var objectProto$
|
|
27
|
-
var nativeObjectToString = objectProto$
|
|
26
|
+
var objectProto$c = Object.prototype;
|
|
27
|
+
var nativeObjectToString = objectProto$c.toString;
|
|
28
28
|
function objectToString(value) {
|
|
29
29
|
return nativeObjectToString.call(value);
|
|
30
30
|
}
|
|
@@ -105,11 +105,11 @@ function toSource(func) {
|
|
|
105
105
|
}
|
|
106
106
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
107
107
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
108
|
-
var funcProto$1 = Function.prototype, objectProto$
|
|
108
|
+
var funcProto$1 = Function.prototype, objectProto$b = Object.prototype;
|
|
109
109
|
var funcToString$1 = funcProto$1.toString;
|
|
110
|
-
var hasOwnProperty$
|
|
110
|
+
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
111
111
|
var reIsNative = RegExp(
|
|
112
|
-
"^" + funcToString$1.call(hasOwnProperty$
|
|
112
|
+
"^" + funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
113
113
|
);
|
|
114
114
|
function baseIsNative(value) {
|
|
115
115
|
if (!isObject(value) || isMasked(value)) {
|
|
@@ -234,14 +234,32 @@ function baseAssignValue(object, key, value) {
|
|
|
234
234
|
function eq(value, other) {
|
|
235
235
|
return value === other || value !== value && other !== other;
|
|
236
236
|
}
|
|
237
|
-
var objectProto$
|
|
238
|
-
var hasOwnProperty$
|
|
237
|
+
var objectProto$a = Object.prototype;
|
|
238
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
239
239
|
function assignValue(object, key, value) {
|
|
240
240
|
var objValue = object[key];
|
|
241
|
-
if (!(hasOwnProperty$
|
|
241
|
+
if (!(hasOwnProperty$8.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
242
242
|
baseAssignValue(object, key, value);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
function copyObject(source, props, object, customizer) {
|
|
246
|
+
var isNew = !object;
|
|
247
|
+
object || (object = {});
|
|
248
|
+
var index = -1, length = props.length;
|
|
249
|
+
while (++index < length) {
|
|
250
|
+
var key = props[index];
|
|
251
|
+
var newValue = void 0;
|
|
252
|
+
if (newValue === void 0) {
|
|
253
|
+
newValue = source[key];
|
|
254
|
+
}
|
|
255
|
+
if (isNew) {
|
|
256
|
+
baseAssignValue(object, key, newValue);
|
|
257
|
+
} else {
|
|
258
|
+
assignValue(object, key, newValue);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return object;
|
|
262
|
+
}
|
|
245
263
|
var nativeMax = Math.max;
|
|
246
264
|
function overRest(func, start, transform) {
|
|
247
265
|
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
@@ -266,9 +284,9 @@ function isLength(value) {
|
|
|
266
284
|
function isArrayLike(value) {
|
|
267
285
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
268
286
|
}
|
|
269
|
-
var objectProto$
|
|
287
|
+
var objectProto$9 = Object.prototype;
|
|
270
288
|
function isPrototype(value) {
|
|
271
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$
|
|
289
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$9;
|
|
272
290
|
return value === proto;
|
|
273
291
|
}
|
|
274
292
|
function baseTimes(n, iteratee) {
|
|
@@ -282,13 +300,13 @@ var argsTag$2 = "[object Arguments]";
|
|
|
282
300
|
function baseIsArguments(value) {
|
|
283
301
|
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
284
302
|
}
|
|
285
|
-
var objectProto$
|
|
286
|
-
var hasOwnProperty$
|
|
287
|
-
var propertyIsEnumerable$1 = objectProto$
|
|
303
|
+
var objectProto$8 = Object.prototype;
|
|
304
|
+
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
|
|
305
|
+
var propertyIsEnumerable$1 = objectProto$8.propertyIsEnumerable;
|
|
288
306
|
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
289
307
|
return arguments;
|
|
290
308
|
}()) ? baseIsArguments : function(value) {
|
|
291
|
-
return isObjectLike(value) && hasOwnProperty$
|
|
309
|
+
return isObjectLike(value) && hasOwnProperty$7.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
292
310
|
};
|
|
293
311
|
function stubFalse() {
|
|
294
312
|
return false;
|
|
@@ -328,12 +346,12 @@ var nodeUtil = function() {
|
|
|
328
346
|
}();
|
|
329
347
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
330
348
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
331
|
-
var objectProto$
|
|
332
|
-
var hasOwnProperty$
|
|
349
|
+
var objectProto$7 = Object.prototype;
|
|
350
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
333
351
|
function arrayLikeKeys(value, inherited) {
|
|
334
352
|
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
335
353
|
for (var key in value) {
|
|
336
|
-
if (hasOwnProperty$
|
|
354
|
+
if ((inherited || hasOwnProperty$6.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
337
355
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
338
356
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
339
357
|
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
@@ -349,15 +367,15 @@ function overArg(func, transform) {
|
|
|
349
367
|
};
|
|
350
368
|
}
|
|
351
369
|
var nativeKeys = overArg(Object.keys, Object);
|
|
352
|
-
var objectProto$
|
|
353
|
-
var hasOwnProperty$
|
|
370
|
+
var objectProto$6 = Object.prototype;
|
|
371
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
354
372
|
function baseKeys(object) {
|
|
355
373
|
if (!isPrototype(object)) {
|
|
356
374
|
return nativeKeys(object);
|
|
357
375
|
}
|
|
358
376
|
var result = [];
|
|
359
377
|
for (var key in Object(object)) {
|
|
360
|
-
if (hasOwnProperty$
|
|
378
|
+
if (hasOwnProperty$5.call(object, key) && key != "constructor") {
|
|
361
379
|
result.push(key);
|
|
362
380
|
}
|
|
363
381
|
}
|
|
@@ -366,6 +384,32 @@ function baseKeys(object) {
|
|
|
366
384
|
function keys(object) {
|
|
367
385
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
368
386
|
}
|
|
387
|
+
function nativeKeysIn(object) {
|
|
388
|
+
var result = [];
|
|
389
|
+
if (object != null) {
|
|
390
|
+
for (var key in Object(object)) {
|
|
391
|
+
result.push(key);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
var objectProto$5 = Object.prototype;
|
|
397
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
398
|
+
function baseKeysIn(object) {
|
|
399
|
+
if (!isObject(object)) {
|
|
400
|
+
return nativeKeysIn(object);
|
|
401
|
+
}
|
|
402
|
+
var isProto = isPrototype(object), result = [];
|
|
403
|
+
for (var key in object) {
|
|
404
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty$4.call(object, key)))) {
|
|
405
|
+
result.push(key);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return result;
|
|
409
|
+
}
|
|
410
|
+
function keysIn(object) {
|
|
411
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
412
|
+
}
|
|
369
413
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
370
414
|
function isKey(value, object) {
|
|
371
415
|
if (isArray(value)) {
|
|
@@ -650,6 +694,23 @@ function isPlainObject(value) {
|
|
|
650
694
|
var Ctor = hasOwnProperty$1.call(proto, "constructor") && proto.constructor;
|
|
651
695
|
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
652
696
|
}
|
|
697
|
+
function baseSlice(array, start, end) {
|
|
698
|
+
var index = -1, length = array.length;
|
|
699
|
+
if (start < 0) {
|
|
700
|
+
start = -start > length ? 0 : length + start;
|
|
701
|
+
}
|
|
702
|
+
end = end > length ? length : end;
|
|
703
|
+
if (end < 0) {
|
|
704
|
+
end += length;
|
|
705
|
+
}
|
|
706
|
+
length = start > end ? 0 : end - start >>> 0;
|
|
707
|
+
start >>>= 0;
|
|
708
|
+
var result = Array(length);
|
|
709
|
+
while (++index < length) {
|
|
710
|
+
result[index] = array[index + start];
|
|
711
|
+
}
|
|
712
|
+
return result;
|
|
713
|
+
}
|
|
653
714
|
function stackClear() {
|
|
654
715
|
this.__data__ = new ListCache();
|
|
655
716
|
this.size = 0;
|
|
@@ -690,15 +751,23 @@ Stack.prototype["delete"] = stackDelete;
|
|
|
690
751
|
Stack.prototype.get = stackGet;
|
|
691
752
|
Stack.prototype.has = stackHas;
|
|
692
753
|
Stack.prototype.set = stackSet;
|
|
754
|
+
function baseAssign(object, source) {
|
|
755
|
+
return object && copyObject(source, keys(source), object);
|
|
756
|
+
}
|
|
757
|
+
function baseAssignIn(object, source) {
|
|
758
|
+
return object && copyObject(source, keysIn(source), object);
|
|
759
|
+
}
|
|
693
760
|
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
694
761
|
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
695
762
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
696
|
-
var Buffer = moduleExports ? root.Buffer : void 0;
|
|
697
|
-
Buffer ? Buffer.allocUnsafe : void 0;
|
|
763
|
+
var Buffer = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
698
764
|
function cloneBuffer(buffer, isDeep) {
|
|
699
|
-
{
|
|
765
|
+
if (isDeep) {
|
|
700
766
|
return buffer.slice();
|
|
701
767
|
}
|
|
768
|
+
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
769
|
+
buffer.copy(result);
|
|
770
|
+
return result;
|
|
702
771
|
}
|
|
703
772
|
function arrayFilter(array, predicate) {
|
|
704
773
|
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
@@ -715,16 +784,31 @@ function stubArray() {
|
|
|
715
784
|
}
|
|
716
785
|
var objectProto$1 = Object.prototype;
|
|
717
786
|
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
718
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
719
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
787
|
+
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
788
|
+
var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
|
|
720
789
|
if (object == null) {
|
|
721
790
|
return [];
|
|
722
791
|
}
|
|
723
792
|
object = Object(object);
|
|
724
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
793
|
+
return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
|
|
725
794
|
return propertyIsEnumerable.call(object, symbol);
|
|
726
795
|
});
|
|
727
796
|
};
|
|
797
|
+
function copySymbols(source, object) {
|
|
798
|
+
return copyObject(source, getSymbols(source), object);
|
|
799
|
+
}
|
|
800
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
801
|
+
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
|
802
|
+
var result = [];
|
|
803
|
+
while (object) {
|
|
804
|
+
arrayPush(result, getSymbols(object));
|
|
805
|
+
object = getPrototype(object);
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
};
|
|
809
|
+
function copySymbolsIn(source, object) {
|
|
810
|
+
return copyObject(source, getSymbolsIn(source), object);
|
|
811
|
+
}
|
|
728
812
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
729
813
|
var result = keysFunc(object);
|
|
730
814
|
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
@@ -732,6 +816,9 @@ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
|
732
816
|
function getAllKeys(object) {
|
|
733
817
|
return baseGetAllKeys(object, keys, getSymbols);
|
|
734
818
|
}
|
|
819
|
+
function getAllKeysIn(object) {
|
|
820
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
821
|
+
}
|
|
735
822
|
var DataView = getNative(root, "DataView");
|
|
736
823
|
var Promise$1 = getNative(root, "Promise");
|
|
737
824
|
var Set = getNative(root, "Set");
|
|
@@ -776,7 +863,7 @@ function cloneArrayBuffer(arrayBuffer) {
|
|
|
776
863
|
return result;
|
|
777
864
|
}
|
|
778
865
|
function cloneDataView(dataView, isDeep) {
|
|
779
|
-
var buffer = cloneArrayBuffer(dataView.buffer);
|
|
866
|
+
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
780
867
|
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
781
868
|
}
|
|
782
869
|
var reFlags = /\w*$/;
|
|
@@ -790,7 +877,7 @@ function cloneSymbol(symbol) {
|
|
|
790
877
|
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
791
878
|
}
|
|
792
879
|
function cloneTypedArray(typedArray, isDeep) {
|
|
793
|
-
var buffer = cloneArrayBuffer(typedArray.buffer);
|
|
880
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
794
881
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
795
882
|
}
|
|
796
883
|
var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]";
|
|
@@ -804,7 +891,7 @@ function initCloneByTag(object, tag, isDeep) {
|
|
|
804
891
|
case dateTag$1:
|
|
805
892
|
return new Ctor(+object);
|
|
806
893
|
case dataViewTag$1:
|
|
807
|
-
return cloneDataView(object);
|
|
894
|
+
return cloneDataView(object, isDeep);
|
|
808
895
|
case float32Tag$1:
|
|
809
896
|
case float64Tag$1:
|
|
810
897
|
case int8Tag$1:
|
|
@@ -814,7 +901,7 @@ function initCloneByTag(object, tag, isDeep) {
|
|
|
814
901
|
case uint8ClampedTag$1:
|
|
815
902
|
case uint16Tag$1:
|
|
816
903
|
case uint32Tag$1:
|
|
817
|
-
return cloneTypedArray(object);
|
|
904
|
+
return cloneTypedArray(object, isDeep);
|
|
818
905
|
case mapTag$2:
|
|
819
906
|
return new Ctor();
|
|
820
907
|
case numberTag$1:
|
|
@@ -843,13 +930,17 @@ function baseIsSet(value) {
|
|
|
843
930
|
}
|
|
844
931
|
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
845
932
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
933
|
+
var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$2 = 4;
|
|
846
934
|
var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
847
935
|
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
848
936
|
var cloneableTags = {};
|
|
849
937
|
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
850
938
|
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
851
939
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
852
|
-
var result;
|
|
940
|
+
var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
|
|
941
|
+
if (customizer) {
|
|
942
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
943
|
+
}
|
|
853
944
|
if (result !== void 0) {
|
|
854
945
|
return result;
|
|
855
946
|
}
|
|
@@ -859,18 +950,24 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
|
859
950
|
var isArr = isArray(value);
|
|
860
951
|
if (isArr) {
|
|
861
952
|
result = initCloneArray(value);
|
|
953
|
+
if (!isDeep) {
|
|
954
|
+
return copyArray(value, result);
|
|
955
|
+
}
|
|
862
956
|
} else {
|
|
863
957
|
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
|
|
864
958
|
if (isBuffer(value)) {
|
|
865
|
-
return cloneBuffer(value);
|
|
959
|
+
return cloneBuffer(value, isDeep);
|
|
866
960
|
}
|
|
867
961
|
if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
|
868
|
-
result = isFunc ? {} : initCloneObject(value);
|
|
962
|
+
result = isFlat || isFunc ? {} : initCloneObject(value);
|
|
963
|
+
if (!isDeep) {
|
|
964
|
+
return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
|
965
|
+
}
|
|
869
966
|
} else {
|
|
870
967
|
if (!cloneableTags[tag]) {
|
|
871
968
|
return object ? value : {};
|
|
872
969
|
}
|
|
873
|
-
result = initCloneByTag(value, tag);
|
|
970
|
+
result = initCloneByTag(value, tag, isDeep);
|
|
874
971
|
}
|
|
875
972
|
}
|
|
876
973
|
stack || (stack = new Stack());
|
|
@@ -888,7 +985,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
|
888
985
|
result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
|
|
889
986
|
});
|
|
890
987
|
}
|
|
891
|
-
var keysFunc = getAllKeys;
|
|
988
|
+
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
|
|
892
989
|
var props = isArr ? void 0 : keysFunc(value);
|
|
893
990
|
arrayEach(props || value, function(subValue, key2) {
|
|
894
991
|
if (props) {
|
|
@@ -899,9 +996,9 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
|
899
996
|
});
|
|
900
997
|
return result;
|
|
901
998
|
}
|
|
902
|
-
var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
|
|
999
|
+
var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
|
|
903
1000
|
function cloneDeep(value) {
|
|
904
|
-
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
1001
|
+
return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
|
|
905
1002
|
}
|
|
906
1003
|
function baseHasIn(object, key) {
|
|
907
1004
|
return object != null && key in Object(object);
|
|
@@ -925,6 +1022,43 @@ function hasPath(object, path, hasFunc) {
|
|
|
925
1022
|
function hasIn(object, path) {
|
|
926
1023
|
return object != null && hasPath(object, path, baseHasIn);
|
|
927
1024
|
}
|
|
1025
|
+
function last(array) {
|
|
1026
|
+
var length = array == null ? 0 : array.length;
|
|
1027
|
+
return length ? array[length - 1] : void 0;
|
|
1028
|
+
}
|
|
1029
|
+
function parent(object, path) {
|
|
1030
|
+
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
|
|
1031
|
+
}
|
|
1032
|
+
function baseUnset(object, path) {
|
|
1033
|
+
path = castPath(path, object);
|
|
1034
|
+
object = parent(object, path);
|
|
1035
|
+
return object == null || delete object[toKey(last(path))];
|
|
1036
|
+
}
|
|
1037
|
+
function customOmitClone(value) {
|
|
1038
|
+
return isPlainObject(value) ? void 0 : value;
|
|
1039
|
+
}
|
|
1040
|
+
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
|
|
1041
|
+
var omit = flatRest(function(object, paths) {
|
|
1042
|
+
var result = {};
|
|
1043
|
+
if (object == null) {
|
|
1044
|
+
return result;
|
|
1045
|
+
}
|
|
1046
|
+
var isDeep = false;
|
|
1047
|
+
paths = arrayMap(paths, function(path) {
|
|
1048
|
+
path = castPath(path, object);
|
|
1049
|
+
isDeep || (isDeep = path.length > 1);
|
|
1050
|
+
return path;
|
|
1051
|
+
});
|
|
1052
|
+
copyObject(object, getAllKeysIn(object), result);
|
|
1053
|
+
if (isDeep) {
|
|
1054
|
+
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
|
1055
|
+
}
|
|
1056
|
+
var length = paths.length;
|
|
1057
|
+
while (length--) {
|
|
1058
|
+
baseUnset(result, paths[length]);
|
|
1059
|
+
}
|
|
1060
|
+
return result;
|
|
1061
|
+
});
|
|
928
1062
|
function baseSet(object, path, value, customizer) {
|
|
929
1063
|
if (!isObject(object)) {
|
|
930
1064
|
return object;
|
|
@@ -979,6 +1113,7 @@ export {
|
|
|
979
1113
|
cloneDeep as c,
|
|
980
1114
|
get as g,
|
|
981
1115
|
isPlainObject as i,
|
|
1116
|
+
omit as o,
|
|
982
1117
|
pick as p,
|
|
983
1118
|
set as s,
|
|
984
1119
|
toPath as t
|