easy-elplus 1.0.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.
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/index.full.js +4431 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/index.mjs +35 -0
- package/es/node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs +13 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.mjs +7 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Hash.mjs +32 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.mjs +32 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Map.mjs +7 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.mjs +32 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.mjs +7 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.mjs +7 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Stack.mjs +27 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.mjs +6 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.mjs +6 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.mjs +7 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_apply.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.mjs +22 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.mjs +25 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.mjs +42 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.mjs +28 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.mjs +25 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.mjs +140 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.mjs +35 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.mjs +24 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.mjs +28 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.mjs +47 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.mjs +60 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.mjs +33 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.mjs +22 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSlice.mjs +31 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.mjs +34 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.mjs +14 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnset.mjs +65 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castPath.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.mjs +30 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.mjs +17 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.mjs +38 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.mjs +6 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_customOmitClone.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.mjs +11 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.mjs +4 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.mjs +17 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getNative.mjs +17 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.mjs +6 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.mjs +46 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.mjs +30 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.mjs +25 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.mjs +58 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getValue.mjs +13 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.mjs +15 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.mjs +17 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.mjs +30 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.mjs +23 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.mjs +23 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.mjs +77 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.mjs +25 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKey.mjs +29 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.mjs +15 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.mjs +13 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.mjs +35 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.mjs +19 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.mjs +22 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.mjs +6 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.mjs +30 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.mjs +22 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overArg.mjs +15 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overRest.mjs +36 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_parent.mjs +16 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.mjs +9 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToString.mjs +14 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.mjs +37 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.mjs +15 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.mjs +14 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.mjs +14 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.mjs +34 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.mjs +27 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toKey.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/constant.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/eq.mjs +37 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.mjs +22 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.mjs +21 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArguments.mjs +36 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.mjs +26 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.mjs +33 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.mjs +38 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.mjs +37 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isLength.mjs +35 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.mjs +27 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.mjs +31 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.mjs +29 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.mjs +62 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.mjs +27 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.mjs +29 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.mjs +27 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keysIn.mjs +32 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.mjs +20 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/memoize.mjs +73 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.mjs +57 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.mjs +23 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.mjs +18 -0
- package/es/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toString.mjs +28 -0
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +28 -0
- package/es/packages/components/FileUpload/index.mjs +6 -0
- package/es/packages/components/FileUpload/src/FileUpload.vue.mjs +332 -0
- package/es/packages/components/FileUpload/src/FileUpload.vue2.mjs +4 -0
- package/es/packages/components/ImageUpload/index.mjs +6 -0
- package/es/packages/components/ImageUpload/src/ImageUpload.vue.mjs +258 -0
- package/es/packages/components/ImageUpload/src/ImageUpload.vue2.mjs +4 -0
- package/es/packages/components/button/index.mjs +10 -0
- package/es/packages/components/button/src/button.vue.mjs +42 -0
- package/es/packages/components/descriptions/index.mjs +10 -0
- package/es/packages/components/descriptions/src/comp.vue.mjs +51 -0
- package/es/packages/components/descriptions/src/descriptions.vue.mjs +178 -0
- package/es/packages/components/dialog/index.mjs +11 -0
- package/es/packages/components/dialog/src/appContext.mjs +25 -0
- package/es/packages/components/dialog/src/dialog.mjs +130 -0
- package/es/packages/components/dialog/src/useDialog.mjs +183 -0
- package/es/packages/components/table/index.mjs +10 -0
- package/es/packages/components/table/src/scrollTo.mjs +69 -0
- package/es/packages/components/table/src/table.vue.mjs +357 -0
- package/es/packages/components/table/src/table.vue2.mjs +4 -0
- package/es/packages/components/table/src/tableColumn.vue.mjs +72 -0
- package/es/packages/constants/event.mjs +3 -0
- package/es/packages/hooks/src/useDynamicComponent.mjs +53 -0
- package/es/packages/utils/type.mjs +5 -0
- package/es/packages/utils/vue/appContext.mjs +25 -0
- package/es/packages/utils/vue/install.mjs +22 -0
- package/lib/_virtual/_plugin-vue_export-helper.js +13 -0
- package/lib/index.js +46 -0
- package/lib/node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js +16 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +11 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +36 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +36 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +11 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +36 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +11 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +11 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +31 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +10 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +10 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +11 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +26 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +29 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +46 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +32 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +29 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +144 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js +39 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +28 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +32 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +51 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +64 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +37 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +26 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSlice.js +35 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +38 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +18 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnset.js +69 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +34 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +21 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +42 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +10 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_customOmitClone.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +15 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +8 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +21 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +21 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +10 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +50 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +34 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +29 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +60 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +17 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +19 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +21 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +34 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +27 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +27 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +81 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +29 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +33 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +19 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +17 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +39 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +23 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +26 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +10 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +34 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +26 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +19 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +40 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_parent.js +20 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js +13 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +18 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +41 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +19 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +18 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +18 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +38 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +31 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/constant.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/eq.js +41 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.js +26 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.js +25 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +40 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +30 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +37 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +42 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +41 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +39 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +31 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +35 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +33 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +66 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +31 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +33 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +31 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +36 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.js +24 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +77 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.js +61 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +27 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +22 -0
- package/lib/node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toString.js +32 -0
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +32 -0
- package/lib/packages/components/FileUpload/index.js +11 -0
- package/lib/packages/components/FileUpload/src/FileUpload.vue.js +336 -0
- package/lib/packages/components/FileUpload/src/FileUpload.vue2.js +6 -0
- package/lib/packages/components/ImageUpload/index.js +11 -0
- package/lib/packages/components/ImageUpload/src/ImageUpload.vue.js +262 -0
- package/lib/packages/components/ImageUpload/src/ImageUpload.vue2.js +6 -0
- package/lib/packages/components/button/index.js +15 -0
- package/lib/packages/components/button/src/button.vue.js +46 -0
- package/lib/packages/components/descriptions/index.js +15 -0
- package/lib/packages/components/descriptions/src/comp.vue.js +55 -0
- package/lib/packages/components/descriptions/src/descriptions.vue.js +182 -0
- package/lib/packages/components/dialog/index.js +14 -0
- package/lib/packages/components/dialog/src/appContext.js +28 -0
- package/lib/packages/components/dialog/src/dialog.js +132 -0
- package/lib/packages/components/dialog/src/useDialog.js +185 -0
- package/lib/packages/components/table/index.js +15 -0
- package/lib/packages/components/table/src/scrollTo.js +71 -0
- package/lib/packages/components/table/src/table.vue.js +361 -0
- package/lib/packages/components/table/src/table.vue2.js +6 -0
- package/lib/packages/components/table/src/tableColumn.vue.js +76 -0
- package/lib/packages/constants/event.js +5 -0
- package/lib/packages/hooks/src/useDynamicComponent.js +55 -0
- package/lib/packages/utils/type.js +9 -0
- package/lib/packages/utils/vue/appContext.js +28 -0
- package/lib/packages/utils/vue/install.js +24 -0
- package/package.json +62 -0
- package/public/qq.jpg +0 -0
|
@@ -0,0 +1,4431 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('@element-plus/icons-vue')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus', '@element-plus/icons-vue'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyElPlus = {}, global.Vue, global.ElementPlus, global.ElementPlusIconsVue));
|
|
5
|
+
})(this, (function (exports, vue, elementPlus, iconsVue) { 'use strict';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @vue/shared v3.5.27
|
|
9
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
10
|
+
* @license MIT
|
|
11
|
+
**/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
15
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
16
|
+
const isFunction$1 = (val) => typeof val === "function";
|
|
17
|
+
const isObject$1 = (val) => val !== null && typeof val === "object";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 给组件添加 install 方法,支持主组件 + 附加组件
|
|
21
|
+
* @param {Object} main 主组件
|
|
22
|
+
* @param {Object} [extra] 附加组件集合
|
|
23
|
+
*/
|
|
24
|
+
const withInstall = (main, extra) => {
|
|
25
|
+
main.install = app => {
|
|
26
|
+
const components = [main, ...([])];
|
|
27
|
+
|
|
28
|
+
for (const comp of components) {
|
|
29
|
+
if (comp.name) {
|
|
30
|
+
app.component(comp.name, comp);
|
|
31
|
+
} else {
|
|
32
|
+
console.warn("Component missing name:", comp);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return main
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 全局应用上下文管理
|
|
42
|
+
* 用于在非组件上下文中访问主应用的配置、插件和全局组件
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
let globalAppContext = null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 设置全局应用上下文
|
|
49
|
+
* 应该在主应用初始化时调用(通常在 app.use() 中)
|
|
50
|
+
* @param {AppContext} context - Vue 应用上下文
|
|
51
|
+
*/
|
|
52
|
+
function setGlobalAppContext(context) {
|
|
53
|
+
globalAppContext = context;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 获取全局应用上下文
|
|
58
|
+
* @returns {AppContext | null}
|
|
59
|
+
*/
|
|
60
|
+
function getGlobalAppContext() {
|
|
61
|
+
return globalAppContext
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const isUndefined = val => typeof val === "undefined";
|
|
65
|
+
const isNumber = val => typeof val === "number";
|
|
66
|
+
const isString = val => typeof val === "string";
|
|
67
|
+
|
|
68
|
+
/** Detect free variable `global` from Node.js. */
|
|
69
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
70
|
+
|
|
71
|
+
/** Detect free variable `self`. */
|
|
72
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
73
|
+
|
|
74
|
+
/** Used as a reference to the global object. */
|
|
75
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
76
|
+
|
|
77
|
+
/** Built-in value references. */
|
|
78
|
+
var Symbol$1 = root.Symbol;
|
|
79
|
+
|
|
80
|
+
/** Used for built-in method references. */
|
|
81
|
+
var objectProto$c = Object.prototype;
|
|
82
|
+
|
|
83
|
+
/** Used to check objects for own properties. */
|
|
84
|
+
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Used to resolve the
|
|
88
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
89
|
+
* of values.
|
|
90
|
+
*/
|
|
91
|
+
var nativeObjectToString$1 = objectProto$c.toString;
|
|
92
|
+
|
|
93
|
+
/** Built-in value references. */
|
|
94
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
* @param {*} value The value to query.
|
|
101
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
102
|
+
*/
|
|
103
|
+
function getRawTag(value) {
|
|
104
|
+
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
105
|
+
tag = value[symToStringTag$1];
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
value[symToStringTag$1] = undefined;
|
|
109
|
+
var unmasked = true;
|
|
110
|
+
} catch (e) {}
|
|
111
|
+
|
|
112
|
+
var result = nativeObjectToString$1.call(value);
|
|
113
|
+
if (unmasked) {
|
|
114
|
+
if (isOwn) {
|
|
115
|
+
value[symToStringTag$1] = tag;
|
|
116
|
+
} else {
|
|
117
|
+
delete value[symToStringTag$1];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Used for built-in method references. */
|
|
124
|
+
var objectProto$b = Object.prototype;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Used to resolve the
|
|
128
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
129
|
+
* of values.
|
|
130
|
+
*/
|
|
131
|
+
var nativeObjectToString = objectProto$b.toString;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
135
|
+
*
|
|
136
|
+
* @private
|
|
137
|
+
* @param {*} value The value to convert.
|
|
138
|
+
* @returns {string} Returns the converted string.
|
|
139
|
+
*/
|
|
140
|
+
function objectToString(value) {
|
|
141
|
+
return nativeObjectToString.call(value);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** `Object#toString` result references. */
|
|
145
|
+
var nullTag = '[object Null]',
|
|
146
|
+
undefinedTag = '[object Undefined]';
|
|
147
|
+
|
|
148
|
+
/** Built-in value references. */
|
|
149
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
153
|
+
*
|
|
154
|
+
* @private
|
|
155
|
+
* @param {*} value The value to query.
|
|
156
|
+
* @returns {string} Returns the `toStringTag`.
|
|
157
|
+
*/
|
|
158
|
+
function baseGetTag(value) {
|
|
159
|
+
if (value == null) {
|
|
160
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
161
|
+
}
|
|
162
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
163
|
+
? getRawTag(value)
|
|
164
|
+
: objectToString(value);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
169
|
+
* and has a `typeof` result of "object".
|
|
170
|
+
*
|
|
171
|
+
* @static
|
|
172
|
+
* @memberOf _
|
|
173
|
+
* @since 4.0.0
|
|
174
|
+
* @category Lang
|
|
175
|
+
* @param {*} value The value to check.
|
|
176
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
177
|
+
* @example
|
|
178
|
+
*
|
|
179
|
+
* _.isObjectLike({});
|
|
180
|
+
* // => true
|
|
181
|
+
*
|
|
182
|
+
* _.isObjectLike([1, 2, 3]);
|
|
183
|
+
* // => true
|
|
184
|
+
*
|
|
185
|
+
* _.isObjectLike(_.noop);
|
|
186
|
+
* // => false
|
|
187
|
+
*
|
|
188
|
+
* _.isObjectLike(null);
|
|
189
|
+
* // => false
|
|
190
|
+
*/
|
|
191
|
+
function isObjectLike(value) {
|
|
192
|
+
return value != null && typeof value == 'object';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** `Object#toString` result references. */
|
|
196
|
+
var symbolTag$2 = '[object Symbol]';
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
200
|
+
*
|
|
201
|
+
* @static
|
|
202
|
+
* @memberOf _
|
|
203
|
+
* @since 4.0.0
|
|
204
|
+
* @category Lang
|
|
205
|
+
* @param {*} value The value to check.
|
|
206
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
207
|
+
* @example
|
|
208
|
+
*
|
|
209
|
+
* _.isSymbol(Symbol.iterator);
|
|
210
|
+
* // => true
|
|
211
|
+
*
|
|
212
|
+
* _.isSymbol('abc');
|
|
213
|
+
* // => false
|
|
214
|
+
*/
|
|
215
|
+
function isSymbol(value) {
|
|
216
|
+
return typeof value == 'symbol' ||
|
|
217
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag$2);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
222
|
+
* shorthands.
|
|
223
|
+
*
|
|
224
|
+
* @private
|
|
225
|
+
* @param {Array} [array] The array to iterate over.
|
|
226
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
227
|
+
* @returns {Array} Returns the new mapped array.
|
|
228
|
+
*/
|
|
229
|
+
function arrayMap(array, iteratee) {
|
|
230
|
+
var index = -1,
|
|
231
|
+
length = array == null ? 0 : array.length,
|
|
232
|
+
result = Array(length);
|
|
233
|
+
|
|
234
|
+
while (++index < length) {
|
|
235
|
+
result[index] = iteratee(array[index], index, array);
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Checks if `value` is classified as an `Array` object.
|
|
242
|
+
*
|
|
243
|
+
* @static
|
|
244
|
+
* @memberOf _
|
|
245
|
+
* @since 0.1.0
|
|
246
|
+
* @category Lang
|
|
247
|
+
* @param {*} value The value to check.
|
|
248
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
249
|
+
* @example
|
|
250
|
+
*
|
|
251
|
+
* _.isArray([1, 2, 3]);
|
|
252
|
+
* // => true
|
|
253
|
+
*
|
|
254
|
+
* _.isArray(document.body.children);
|
|
255
|
+
* // => false
|
|
256
|
+
*
|
|
257
|
+
* _.isArray('abc');
|
|
258
|
+
* // => false
|
|
259
|
+
*
|
|
260
|
+
* _.isArray(_.noop);
|
|
261
|
+
* // => false
|
|
262
|
+
*/
|
|
263
|
+
var isArray = Array.isArray;
|
|
264
|
+
|
|
265
|
+
/** Used to convert symbols to primitives and strings. */
|
|
266
|
+
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
267
|
+
symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
271
|
+
* values to empty strings.
|
|
272
|
+
*
|
|
273
|
+
* @private
|
|
274
|
+
* @param {*} value The value to process.
|
|
275
|
+
* @returns {string} Returns the string.
|
|
276
|
+
*/
|
|
277
|
+
function baseToString(value) {
|
|
278
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
279
|
+
if (typeof value == 'string') {
|
|
280
|
+
return value;
|
|
281
|
+
}
|
|
282
|
+
if (isArray(value)) {
|
|
283
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
284
|
+
return arrayMap(value, baseToString) + '';
|
|
285
|
+
}
|
|
286
|
+
if (isSymbol(value)) {
|
|
287
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
288
|
+
}
|
|
289
|
+
var result = (value + '');
|
|
290
|
+
return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Checks if `value` is the
|
|
295
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
296
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
297
|
+
*
|
|
298
|
+
* @static
|
|
299
|
+
* @memberOf _
|
|
300
|
+
* @since 0.1.0
|
|
301
|
+
* @category Lang
|
|
302
|
+
* @param {*} value The value to check.
|
|
303
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
304
|
+
* @example
|
|
305
|
+
*
|
|
306
|
+
* _.isObject({});
|
|
307
|
+
* // => true
|
|
308
|
+
*
|
|
309
|
+
* _.isObject([1, 2, 3]);
|
|
310
|
+
* // => true
|
|
311
|
+
*
|
|
312
|
+
* _.isObject(_.noop);
|
|
313
|
+
* // => true
|
|
314
|
+
*
|
|
315
|
+
* _.isObject(null);
|
|
316
|
+
* // => false
|
|
317
|
+
*/
|
|
318
|
+
function isObject(value) {
|
|
319
|
+
var type = typeof value;
|
|
320
|
+
return value != null && (type == 'object' || type == 'function');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* This method returns the first argument it receives.
|
|
325
|
+
*
|
|
326
|
+
* @static
|
|
327
|
+
* @since 0.1.0
|
|
328
|
+
* @memberOf _
|
|
329
|
+
* @category Util
|
|
330
|
+
* @param {*} value Any value.
|
|
331
|
+
* @returns {*} Returns `value`.
|
|
332
|
+
* @example
|
|
333
|
+
*
|
|
334
|
+
* var object = { 'a': 1 };
|
|
335
|
+
*
|
|
336
|
+
* console.log(_.identity(object) === object);
|
|
337
|
+
* // => true
|
|
338
|
+
*/
|
|
339
|
+
function identity(value) {
|
|
340
|
+
return value;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** `Object#toString` result references. */
|
|
344
|
+
var asyncTag = '[object AsyncFunction]',
|
|
345
|
+
funcTag$2 = '[object Function]',
|
|
346
|
+
genTag$1 = '[object GeneratorFunction]',
|
|
347
|
+
proxyTag = '[object Proxy]';
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Checks if `value` is classified as a `Function` object.
|
|
351
|
+
*
|
|
352
|
+
* @static
|
|
353
|
+
* @memberOf _
|
|
354
|
+
* @since 0.1.0
|
|
355
|
+
* @category Lang
|
|
356
|
+
* @param {*} value The value to check.
|
|
357
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
358
|
+
* @example
|
|
359
|
+
*
|
|
360
|
+
* _.isFunction(_);
|
|
361
|
+
* // => true
|
|
362
|
+
*
|
|
363
|
+
* _.isFunction(/abc/);
|
|
364
|
+
* // => false
|
|
365
|
+
*/
|
|
366
|
+
function isFunction(value) {
|
|
367
|
+
if (!isObject(value)) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
371
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
372
|
+
var tag = baseGetTag(value);
|
|
373
|
+
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** Used to detect overreaching core-js shims. */
|
|
377
|
+
var coreJsData = root['__core-js_shared__'];
|
|
378
|
+
|
|
379
|
+
/** Used to detect methods masquerading as native. */
|
|
380
|
+
var maskSrcKey = (function() {
|
|
381
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
382
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
383
|
+
}());
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Checks if `func` has its source masked.
|
|
387
|
+
*
|
|
388
|
+
* @private
|
|
389
|
+
* @param {Function} func The function to check.
|
|
390
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
391
|
+
*/
|
|
392
|
+
function isMasked(func) {
|
|
393
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Used for built-in method references. */
|
|
397
|
+
var funcProto$2 = Function.prototype;
|
|
398
|
+
|
|
399
|
+
/** Used to resolve the decompiled source of functions. */
|
|
400
|
+
var funcToString$2 = funcProto$2.toString;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Converts `func` to its source code.
|
|
404
|
+
*
|
|
405
|
+
* @private
|
|
406
|
+
* @param {Function} func The function to convert.
|
|
407
|
+
* @returns {string} Returns the source code.
|
|
408
|
+
*/
|
|
409
|
+
function toSource(func) {
|
|
410
|
+
if (func != null) {
|
|
411
|
+
try {
|
|
412
|
+
return funcToString$2.call(func);
|
|
413
|
+
} catch (e) {}
|
|
414
|
+
try {
|
|
415
|
+
return (func + '');
|
|
416
|
+
} catch (e) {}
|
|
417
|
+
}
|
|
418
|
+
return '';
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Used to match `RegExp`
|
|
423
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
424
|
+
*/
|
|
425
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
426
|
+
|
|
427
|
+
/** Used to detect host constructors (Safari). */
|
|
428
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
429
|
+
|
|
430
|
+
/** Used for built-in method references. */
|
|
431
|
+
var funcProto$1 = Function.prototype,
|
|
432
|
+
objectProto$a = Object.prototype;
|
|
433
|
+
|
|
434
|
+
/** Used to resolve the decompiled source of functions. */
|
|
435
|
+
var funcToString$1 = funcProto$1.toString;
|
|
436
|
+
|
|
437
|
+
/** Used to check objects for own properties. */
|
|
438
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
439
|
+
|
|
440
|
+
/** Used to detect if a method is native. */
|
|
441
|
+
var reIsNative = RegExp('^' +
|
|
442
|
+
funcToString$1.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
|
|
443
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
444
|
+
);
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
448
|
+
*
|
|
449
|
+
* @private
|
|
450
|
+
* @param {*} value The value to check.
|
|
451
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
452
|
+
* else `false`.
|
|
453
|
+
*/
|
|
454
|
+
function baseIsNative(value) {
|
|
455
|
+
if (!isObject(value) || isMasked(value)) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
459
|
+
return pattern.test(toSource(value));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Gets the value at `key` of `object`.
|
|
464
|
+
*
|
|
465
|
+
* @private
|
|
466
|
+
* @param {Object} [object] The object to query.
|
|
467
|
+
* @param {string} key The key of the property to get.
|
|
468
|
+
* @returns {*} Returns the property value.
|
|
469
|
+
*/
|
|
470
|
+
function getValue(object, key) {
|
|
471
|
+
return object == null ? undefined : object[key];
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Gets the native function at `key` of `object`.
|
|
476
|
+
*
|
|
477
|
+
* @private
|
|
478
|
+
* @param {Object} object The object to query.
|
|
479
|
+
* @param {string} key The key of the method to get.
|
|
480
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
481
|
+
*/
|
|
482
|
+
function getNative(object, key) {
|
|
483
|
+
var value = getValue(object, key);
|
|
484
|
+
return baseIsNative(value) ? value : undefined;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/* Built-in method references that are verified to be native. */
|
|
488
|
+
var WeakMap = getNative(root, 'WeakMap');
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
492
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
493
|
+
*
|
|
494
|
+
* @private
|
|
495
|
+
* @param {Function} func The function to invoke.
|
|
496
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
497
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
498
|
+
* @returns {*} Returns the result of `func`.
|
|
499
|
+
*/
|
|
500
|
+
function apply(func, thisArg, args) {
|
|
501
|
+
switch (args.length) {
|
|
502
|
+
case 0: return func.call(thisArg);
|
|
503
|
+
case 1: return func.call(thisArg, args[0]);
|
|
504
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
505
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
506
|
+
}
|
|
507
|
+
return func.apply(thisArg, args);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
511
|
+
var HOT_COUNT = 800,
|
|
512
|
+
HOT_SPAN = 16;
|
|
513
|
+
|
|
514
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
515
|
+
var nativeNow = Date.now;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
519
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
520
|
+
* milliseconds.
|
|
521
|
+
*
|
|
522
|
+
* @private
|
|
523
|
+
* @param {Function} func The function to restrict.
|
|
524
|
+
* @returns {Function} Returns the new shortable function.
|
|
525
|
+
*/
|
|
526
|
+
function shortOut(func) {
|
|
527
|
+
var count = 0,
|
|
528
|
+
lastCalled = 0;
|
|
529
|
+
|
|
530
|
+
return function() {
|
|
531
|
+
var stamp = nativeNow(),
|
|
532
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
533
|
+
|
|
534
|
+
lastCalled = stamp;
|
|
535
|
+
if (remaining > 0) {
|
|
536
|
+
if (++count >= HOT_COUNT) {
|
|
537
|
+
return arguments[0];
|
|
538
|
+
}
|
|
539
|
+
} else {
|
|
540
|
+
count = 0;
|
|
541
|
+
}
|
|
542
|
+
return func.apply(undefined, arguments);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Creates a function that returns `value`.
|
|
548
|
+
*
|
|
549
|
+
* @static
|
|
550
|
+
* @memberOf _
|
|
551
|
+
* @since 2.4.0
|
|
552
|
+
* @category Util
|
|
553
|
+
* @param {*} value The value to return from the new function.
|
|
554
|
+
* @returns {Function} Returns the new constant function.
|
|
555
|
+
* @example
|
|
556
|
+
*
|
|
557
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
558
|
+
*
|
|
559
|
+
* console.log(objects);
|
|
560
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
561
|
+
*
|
|
562
|
+
* console.log(objects[0] === objects[1]);
|
|
563
|
+
* // => true
|
|
564
|
+
*/
|
|
565
|
+
function constant(value) {
|
|
566
|
+
return function() {
|
|
567
|
+
return value;
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
var defineProperty = (function() {
|
|
572
|
+
try {
|
|
573
|
+
var func = getNative(Object, 'defineProperty');
|
|
574
|
+
func({}, '', {});
|
|
575
|
+
return func;
|
|
576
|
+
} catch (e) {}
|
|
577
|
+
}());
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
581
|
+
*
|
|
582
|
+
* @private
|
|
583
|
+
* @param {Function} func The function to modify.
|
|
584
|
+
* @param {Function} string The `toString` result.
|
|
585
|
+
* @returns {Function} Returns `func`.
|
|
586
|
+
*/
|
|
587
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
588
|
+
return defineProperty(func, 'toString', {
|
|
589
|
+
'configurable': true,
|
|
590
|
+
'enumerable': false,
|
|
591
|
+
'value': constant(string),
|
|
592
|
+
'writable': true
|
|
593
|
+
});
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
598
|
+
*
|
|
599
|
+
* @private
|
|
600
|
+
* @param {Function} func The function to modify.
|
|
601
|
+
* @param {Function} string The `toString` result.
|
|
602
|
+
* @returns {Function} Returns `func`.
|
|
603
|
+
*/
|
|
604
|
+
var setToString = shortOut(baseSetToString);
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* A specialized version of `_.forEach` for arrays without support for
|
|
608
|
+
* iteratee shorthands.
|
|
609
|
+
*
|
|
610
|
+
* @private
|
|
611
|
+
* @param {Array} [array] The array to iterate over.
|
|
612
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
613
|
+
* @returns {Array} Returns `array`.
|
|
614
|
+
*/
|
|
615
|
+
function arrayEach(array, iteratee) {
|
|
616
|
+
var index = -1,
|
|
617
|
+
length = array == null ? 0 : array.length;
|
|
618
|
+
|
|
619
|
+
while (++index < length) {
|
|
620
|
+
if (iteratee(array[index], index, array) === false) {
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return array;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
/** Used as references for various `Number` constants. */
|
|
628
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
629
|
+
|
|
630
|
+
/** Used to detect unsigned integer values. */
|
|
631
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Checks if `value` is a valid array-like index.
|
|
635
|
+
*
|
|
636
|
+
* @private
|
|
637
|
+
* @param {*} value The value to check.
|
|
638
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
639
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
640
|
+
*/
|
|
641
|
+
function isIndex(value, length) {
|
|
642
|
+
var type = typeof value;
|
|
643
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
644
|
+
|
|
645
|
+
return !!length &&
|
|
646
|
+
(type == 'number' ||
|
|
647
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
648
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
653
|
+
* value checks.
|
|
654
|
+
*
|
|
655
|
+
* @private
|
|
656
|
+
* @param {Object} object The object to modify.
|
|
657
|
+
* @param {string} key The key of the property to assign.
|
|
658
|
+
* @param {*} value The value to assign.
|
|
659
|
+
*/
|
|
660
|
+
function baseAssignValue(object, key, value) {
|
|
661
|
+
if (key == '__proto__' && defineProperty) {
|
|
662
|
+
defineProperty(object, key, {
|
|
663
|
+
'configurable': true,
|
|
664
|
+
'enumerable': true,
|
|
665
|
+
'value': value,
|
|
666
|
+
'writable': true
|
|
667
|
+
});
|
|
668
|
+
} else {
|
|
669
|
+
object[key] = value;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Performs a
|
|
675
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
676
|
+
* comparison between two values to determine if they are equivalent.
|
|
677
|
+
*
|
|
678
|
+
* @static
|
|
679
|
+
* @memberOf _
|
|
680
|
+
* @since 4.0.0
|
|
681
|
+
* @category Lang
|
|
682
|
+
* @param {*} value The value to compare.
|
|
683
|
+
* @param {*} other The other value to compare.
|
|
684
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
685
|
+
* @example
|
|
686
|
+
*
|
|
687
|
+
* var object = { 'a': 1 };
|
|
688
|
+
* var other = { 'a': 1 };
|
|
689
|
+
*
|
|
690
|
+
* _.eq(object, object);
|
|
691
|
+
* // => true
|
|
692
|
+
*
|
|
693
|
+
* _.eq(object, other);
|
|
694
|
+
* // => false
|
|
695
|
+
*
|
|
696
|
+
* _.eq('a', 'a');
|
|
697
|
+
* // => true
|
|
698
|
+
*
|
|
699
|
+
* _.eq('a', Object('a'));
|
|
700
|
+
* // => false
|
|
701
|
+
*
|
|
702
|
+
* _.eq(NaN, NaN);
|
|
703
|
+
* // => true
|
|
704
|
+
*/
|
|
705
|
+
function eq(value, other) {
|
|
706
|
+
return value === other || (value !== value && other !== other);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/** Used for built-in method references. */
|
|
710
|
+
var objectProto$9 = Object.prototype;
|
|
711
|
+
|
|
712
|
+
/** Used to check objects for own properties. */
|
|
713
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
717
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
718
|
+
* for equality comparisons.
|
|
719
|
+
*
|
|
720
|
+
* @private
|
|
721
|
+
* @param {Object} object The object to modify.
|
|
722
|
+
* @param {string} key The key of the property to assign.
|
|
723
|
+
* @param {*} value The value to assign.
|
|
724
|
+
*/
|
|
725
|
+
function assignValue(object, key, value) {
|
|
726
|
+
var objValue = object[key];
|
|
727
|
+
if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) ||
|
|
728
|
+
(value === undefined && !(key in object))) {
|
|
729
|
+
baseAssignValue(object, key, value);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Copies properties of `source` to `object`.
|
|
735
|
+
*
|
|
736
|
+
* @private
|
|
737
|
+
* @param {Object} source The object to copy properties from.
|
|
738
|
+
* @param {Array} props The property identifiers to copy.
|
|
739
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
740
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
741
|
+
* @returns {Object} Returns `object`.
|
|
742
|
+
*/
|
|
743
|
+
function copyObject(source, props, object, customizer) {
|
|
744
|
+
var isNew = !object;
|
|
745
|
+
object || (object = {});
|
|
746
|
+
|
|
747
|
+
var index = -1,
|
|
748
|
+
length = props.length;
|
|
749
|
+
|
|
750
|
+
while (++index < length) {
|
|
751
|
+
var key = props[index];
|
|
752
|
+
|
|
753
|
+
var newValue = undefined;
|
|
754
|
+
|
|
755
|
+
if (newValue === undefined) {
|
|
756
|
+
newValue = source[key];
|
|
757
|
+
}
|
|
758
|
+
if (isNew) {
|
|
759
|
+
baseAssignValue(object, key, newValue);
|
|
760
|
+
} else {
|
|
761
|
+
assignValue(object, key, newValue);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return object;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
768
|
+
var nativeMax = Math.max;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
772
|
+
*
|
|
773
|
+
* @private
|
|
774
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
775
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
776
|
+
* @param {Function} transform The rest array transform.
|
|
777
|
+
* @returns {Function} Returns the new function.
|
|
778
|
+
*/
|
|
779
|
+
function overRest(func, start, transform) {
|
|
780
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
781
|
+
return function() {
|
|
782
|
+
var args = arguments,
|
|
783
|
+
index = -1,
|
|
784
|
+
length = nativeMax(args.length - start, 0),
|
|
785
|
+
array = Array(length);
|
|
786
|
+
|
|
787
|
+
while (++index < length) {
|
|
788
|
+
array[index] = args[start + index];
|
|
789
|
+
}
|
|
790
|
+
index = -1;
|
|
791
|
+
var otherArgs = Array(start + 1);
|
|
792
|
+
while (++index < start) {
|
|
793
|
+
otherArgs[index] = args[index];
|
|
794
|
+
}
|
|
795
|
+
otherArgs[start] = transform(array);
|
|
796
|
+
return apply(func, this, otherArgs);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/** Used as references for various `Number` constants. */
|
|
801
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Checks if `value` is a valid array-like length.
|
|
805
|
+
*
|
|
806
|
+
* **Note:** This method is loosely based on
|
|
807
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
808
|
+
*
|
|
809
|
+
* @static
|
|
810
|
+
* @memberOf _
|
|
811
|
+
* @since 4.0.0
|
|
812
|
+
* @category Lang
|
|
813
|
+
* @param {*} value The value to check.
|
|
814
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
815
|
+
* @example
|
|
816
|
+
*
|
|
817
|
+
* _.isLength(3);
|
|
818
|
+
* // => true
|
|
819
|
+
*
|
|
820
|
+
* _.isLength(Number.MIN_VALUE);
|
|
821
|
+
* // => false
|
|
822
|
+
*
|
|
823
|
+
* _.isLength(Infinity);
|
|
824
|
+
* // => false
|
|
825
|
+
*
|
|
826
|
+
* _.isLength('3');
|
|
827
|
+
* // => false
|
|
828
|
+
*/
|
|
829
|
+
function isLength(value) {
|
|
830
|
+
return typeof value == 'number' &&
|
|
831
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
836
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
837
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
838
|
+
*
|
|
839
|
+
* @static
|
|
840
|
+
* @memberOf _
|
|
841
|
+
* @since 4.0.0
|
|
842
|
+
* @category Lang
|
|
843
|
+
* @param {*} value The value to check.
|
|
844
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
845
|
+
* @example
|
|
846
|
+
*
|
|
847
|
+
* _.isArrayLike([1, 2, 3]);
|
|
848
|
+
* // => true
|
|
849
|
+
*
|
|
850
|
+
* _.isArrayLike(document.body.children);
|
|
851
|
+
* // => true
|
|
852
|
+
*
|
|
853
|
+
* _.isArrayLike('abc');
|
|
854
|
+
* // => true
|
|
855
|
+
*
|
|
856
|
+
* _.isArrayLike(_.noop);
|
|
857
|
+
* // => false
|
|
858
|
+
*/
|
|
859
|
+
function isArrayLike(value) {
|
|
860
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/** Used for built-in method references. */
|
|
864
|
+
var objectProto$8 = Object.prototype;
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Checks if `value` is likely a prototype object.
|
|
868
|
+
*
|
|
869
|
+
* @private
|
|
870
|
+
* @param {*} value The value to check.
|
|
871
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
872
|
+
*/
|
|
873
|
+
function isPrototype(value) {
|
|
874
|
+
var Ctor = value && value.constructor,
|
|
875
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
|
|
876
|
+
|
|
877
|
+
return value === proto;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
882
|
+
* or max array length checks.
|
|
883
|
+
*
|
|
884
|
+
* @private
|
|
885
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
886
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
887
|
+
* @returns {Array} Returns the array of results.
|
|
888
|
+
*/
|
|
889
|
+
function baseTimes(n, iteratee) {
|
|
890
|
+
var index = -1,
|
|
891
|
+
result = Array(n);
|
|
892
|
+
|
|
893
|
+
while (++index < n) {
|
|
894
|
+
result[index] = iteratee(index);
|
|
895
|
+
}
|
|
896
|
+
return result;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/** `Object#toString` result references. */
|
|
900
|
+
var argsTag$2 = '[object Arguments]';
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* The base implementation of `_.isArguments`.
|
|
904
|
+
*
|
|
905
|
+
* @private
|
|
906
|
+
* @param {*} value The value to check.
|
|
907
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
908
|
+
*/
|
|
909
|
+
function baseIsArguments(value) {
|
|
910
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** Used for built-in method references. */
|
|
914
|
+
var objectProto$7 = Object.prototype;
|
|
915
|
+
|
|
916
|
+
/** Used to check objects for own properties. */
|
|
917
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
918
|
+
|
|
919
|
+
/** Built-in value references. */
|
|
920
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Checks if `value` is likely an `arguments` object.
|
|
924
|
+
*
|
|
925
|
+
* @static
|
|
926
|
+
* @memberOf _
|
|
927
|
+
* @since 0.1.0
|
|
928
|
+
* @category Lang
|
|
929
|
+
* @param {*} value The value to check.
|
|
930
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
931
|
+
* else `false`.
|
|
932
|
+
* @example
|
|
933
|
+
*
|
|
934
|
+
* _.isArguments(function() { return arguments; }());
|
|
935
|
+
* // => true
|
|
936
|
+
*
|
|
937
|
+
* _.isArguments([1, 2, 3]);
|
|
938
|
+
* // => false
|
|
939
|
+
*/
|
|
940
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
941
|
+
return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
|
|
942
|
+
!propertyIsEnumerable$1.call(value, 'callee');
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* This method returns `false`.
|
|
947
|
+
*
|
|
948
|
+
* @static
|
|
949
|
+
* @memberOf _
|
|
950
|
+
* @since 4.13.0
|
|
951
|
+
* @category Util
|
|
952
|
+
* @returns {boolean} Returns `false`.
|
|
953
|
+
* @example
|
|
954
|
+
*
|
|
955
|
+
* _.times(2, _.stubFalse);
|
|
956
|
+
* // => [false, false]
|
|
957
|
+
*/
|
|
958
|
+
function stubFalse() {
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Detect free variable `exports`. */
|
|
963
|
+
var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
964
|
+
|
|
965
|
+
/** Detect free variable `module`. */
|
|
966
|
+
var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
|
|
967
|
+
|
|
968
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
969
|
+
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
970
|
+
|
|
971
|
+
/** Built-in value references. */
|
|
972
|
+
var Buffer$1 = moduleExports$2 ? root.Buffer : undefined;
|
|
973
|
+
|
|
974
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
975
|
+
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Checks if `value` is a buffer.
|
|
979
|
+
*
|
|
980
|
+
* @static
|
|
981
|
+
* @memberOf _
|
|
982
|
+
* @since 4.3.0
|
|
983
|
+
* @category Lang
|
|
984
|
+
* @param {*} value The value to check.
|
|
985
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
986
|
+
* @example
|
|
987
|
+
*
|
|
988
|
+
* _.isBuffer(new Buffer(2));
|
|
989
|
+
* // => true
|
|
990
|
+
*
|
|
991
|
+
* _.isBuffer(new Uint8Array(2));
|
|
992
|
+
* // => false
|
|
993
|
+
*/
|
|
994
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
995
|
+
|
|
996
|
+
/** `Object#toString` result references. */
|
|
997
|
+
var argsTag$1 = '[object Arguments]',
|
|
998
|
+
arrayTag$1 = '[object Array]',
|
|
999
|
+
boolTag$2 = '[object Boolean]',
|
|
1000
|
+
dateTag$2 = '[object Date]',
|
|
1001
|
+
errorTag$1 = '[object Error]',
|
|
1002
|
+
funcTag$1 = '[object Function]',
|
|
1003
|
+
mapTag$4 = '[object Map]',
|
|
1004
|
+
numberTag$2 = '[object Number]',
|
|
1005
|
+
objectTag$3 = '[object Object]',
|
|
1006
|
+
regexpTag$2 = '[object RegExp]',
|
|
1007
|
+
setTag$4 = '[object Set]',
|
|
1008
|
+
stringTag$2 = '[object String]',
|
|
1009
|
+
weakMapTag$2 = '[object WeakMap]';
|
|
1010
|
+
|
|
1011
|
+
var arrayBufferTag$2 = '[object ArrayBuffer]',
|
|
1012
|
+
dataViewTag$3 = '[object DataView]',
|
|
1013
|
+
float32Tag$2 = '[object Float32Array]',
|
|
1014
|
+
float64Tag$2 = '[object Float64Array]',
|
|
1015
|
+
int8Tag$2 = '[object Int8Array]',
|
|
1016
|
+
int16Tag$2 = '[object Int16Array]',
|
|
1017
|
+
int32Tag$2 = '[object Int32Array]',
|
|
1018
|
+
uint8Tag$2 = '[object Uint8Array]',
|
|
1019
|
+
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
|
|
1020
|
+
uint16Tag$2 = '[object Uint16Array]',
|
|
1021
|
+
uint32Tag$2 = '[object Uint32Array]';
|
|
1022
|
+
|
|
1023
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1024
|
+
var typedArrayTags = {};
|
|
1025
|
+
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
|
|
1026
|
+
typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
|
|
1027
|
+
typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
|
|
1028
|
+
typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
|
|
1029
|
+
typedArrayTags[uint32Tag$2] = true;
|
|
1030
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1031
|
+
typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
|
|
1032
|
+
typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
|
|
1033
|
+
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
|
|
1034
|
+
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
|
|
1035
|
+
typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] =
|
|
1036
|
+
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
|
|
1037
|
+
typedArrayTags[weakMapTag$2] = false;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1041
|
+
*
|
|
1042
|
+
* @private
|
|
1043
|
+
* @param {*} value The value to check.
|
|
1044
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1045
|
+
*/
|
|
1046
|
+
function baseIsTypedArray(value) {
|
|
1047
|
+
return isObjectLike(value) &&
|
|
1048
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1053
|
+
*
|
|
1054
|
+
* @private
|
|
1055
|
+
* @param {Function} func The function to cap arguments for.
|
|
1056
|
+
* @returns {Function} Returns the new capped function.
|
|
1057
|
+
*/
|
|
1058
|
+
function baseUnary(func) {
|
|
1059
|
+
return function(value) {
|
|
1060
|
+
return func(value);
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/** Detect free variable `exports`. */
|
|
1065
|
+
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1066
|
+
|
|
1067
|
+
/** Detect free variable `module`. */
|
|
1068
|
+
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
1069
|
+
|
|
1070
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1071
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
1072
|
+
|
|
1073
|
+
/** Detect free variable `process` from Node.js. */
|
|
1074
|
+
var freeProcess = moduleExports$1 && freeGlobal.process;
|
|
1075
|
+
|
|
1076
|
+
/** Used to access faster Node.js helpers. */
|
|
1077
|
+
var nodeUtil = (function() {
|
|
1078
|
+
try {
|
|
1079
|
+
// Use `util.types` for Node.js 10+.
|
|
1080
|
+
var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
|
|
1081
|
+
|
|
1082
|
+
if (types) {
|
|
1083
|
+
return types;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1087
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1088
|
+
} catch (e) {}
|
|
1089
|
+
}());
|
|
1090
|
+
|
|
1091
|
+
/* Node.js helper references. */
|
|
1092
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Checks if `value` is classified as a typed array.
|
|
1096
|
+
*
|
|
1097
|
+
* @static
|
|
1098
|
+
* @memberOf _
|
|
1099
|
+
* @since 3.0.0
|
|
1100
|
+
* @category Lang
|
|
1101
|
+
* @param {*} value The value to check.
|
|
1102
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1103
|
+
* @example
|
|
1104
|
+
*
|
|
1105
|
+
* _.isTypedArray(new Uint8Array);
|
|
1106
|
+
* // => true
|
|
1107
|
+
*
|
|
1108
|
+
* _.isTypedArray([]);
|
|
1109
|
+
* // => false
|
|
1110
|
+
*/
|
|
1111
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1115
|
+
*
|
|
1116
|
+
* @private
|
|
1117
|
+
* @param {*} value The value to query.
|
|
1118
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1119
|
+
* @returns {Array} Returns the array of property names.
|
|
1120
|
+
*/
|
|
1121
|
+
function arrayLikeKeys(value, inherited) {
|
|
1122
|
+
var isArr = isArray(value),
|
|
1123
|
+
isArg = !isArr && isArguments(value),
|
|
1124
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1125
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1126
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1127
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1128
|
+
length = result.length;
|
|
1129
|
+
|
|
1130
|
+
for (var key in value) {
|
|
1131
|
+
if (!(skipIndexes && (
|
|
1132
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1133
|
+
key == 'length' ||
|
|
1134
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1135
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1136
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1137
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1138
|
+
// Skip index properties.
|
|
1139
|
+
isIndex(key, length)
|
|
1140
|
+
))) {
|
|
1141
|
+
result.push(key);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
return result;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1149
|
+
*
|
|
1150
|
+
* @private
|
|
1151
|
+
* @param {Function} func The function to wrap.
|
|
1152
|
+
* @param {Function} transform The argument transform.
|
|
1153
|
+
* @returns {Function} Returns the new function.
|
|
1154
|
+
*/
|
|
1155
|
+
function overArg(func, transform) {
|
|
1156
|
+
return function(arg) {
|
|
1157
|
+
return func(transform(arg));
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* This function is like
|
|
1163
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1164
|
+
* except that it includes inherited enumerable properties.
|
|
1165
|
+
*
|
|
1166
|
+
* @private
|
|
1167
|
+
* @param {Object} object The object to query.
|
|
1168
|
+
* @returns {Array} Returns the array of property names.
|
|
1169
|
+
*/
|
|
1170
|
+
function nativeKeysIn(object) {
|
|
1171
|
+
var result = [];
|
|
1172
|
+
if (object != null) {
|
|
1173
|
+
for (var key in Object(object)) {
|
|
1174
|
+
result.push(key);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
return result;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/** Used for built-in method references. */
|
|
1181
|
+
var objectProto$6 = Object.prototype;
|
|
1182
|
+
|
|
1183
|
+
/** Used to check objects for own properties. */
|
|
1184
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
1188
|
+
*
|
|
1189
|
+
* @private
|
|
1190
|
+
* @param {Object} object The object to query.
|
|
1191
|
+
* @returns {Array} Returns the array of property names.
|
|
1192
|
+
*/
|
|
1193
|
+
function baseKeysIn(object) {
|
|
1194
|
+
if (!isObject(object)) {
|
|
1195
|
+
return nativeKeysIn(object);
|
|
1196
|
+
}
|
|
1197
|
+
var isProto = isPrototype(object),
|
|
1198
|
+
result = [];
|
|
1199
|
+
|
|
1200
|
+
for (var key in object) {
|
|
1201
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty$5.call(object, key)))) {
|
|
1202
|
+
result.push(key);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return result;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
1210
|
+
*
|
|
1211
|
+
* **Note:** Non-object values are coerced to objects.
|
|
1212
|
+
*
|
|
1213
|
+
* @static
|
|
1214
|
+
* @memberOf _
|
|
1215
|
+
* @since 3.0.0
|
|
1216
|
+
* @category Object
|
|
1217
|
+
* @param {Object} object The object to query.
|
|
1218
|
+
* @returns {Array} Returns the array of property names.
|
|
1219
|
+
* @example
|
|
1220
|
+
*
|
|
1221
|
+
* function Foo() {
|
|
1222
|
+
* this.a = 1;
|
|
1223
|
+
* this.b = 2;
|
|
1224
|
+
* }
|
|
1225
|
+
*
|
|
1226
|
+
* Foo.prototype.c = 3;
|
|
1227
|
+
*
|
|
1228
|
+
* _.keysIn(new Foo);
|
|
1229
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
1230
|
+
*/
|
|
1231
|
+
function keysIn(object) {
|
|
1232
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeysIn(object);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/** Used to match property names within property paths. */
|
|
1236
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1237
|
+
reIsPlainProp = /^\w*$/;
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Checks if `value` is a property name and not a property path.
|
|
1241
|
+
*
|
|
1242
|
+
* @private
|
|
1243
|
+
* @param {*} value The value to check.
|
|
1244
|
+
* @param {Object} [object] The object to query keys on.
|
|
1245
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
1246
|
+
*/
|
|
1247
|
+
function isKey(value, object) {
|
|
1248
|
+
if (isArray(value)) {
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
var type = typeof value;
|
|
1252
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
1253
|
+
value == null || isSymbol(value)) {
|
|
1254
|
+
return true;
|
|
1255
|
+
}
|
|
1256
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
1257
|
+
(object != null && value in Object(object));
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/* Built-in method references that are verified to be native. */
|
|
1261
|
+
var nativeCreate = getNative(Object, 'create');
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Removes all key-value entries from the hash.
|
|
1265
|
+
*
|
|
1266
|
+
* @private
|
|
1267
|
+
* @name clear
|
|
1268
|
+
* @memberOf Hash
|
|
1269
|
+
*/
|
|
1270
|
+
function hashClear() {
|
|
1271
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1272
|
+
this.size = 0;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Removes `key` and its value from the hash.
|
|
1277
|
+
*
|
|
1278
|
+
* @private
|
|
1279
|
+
* @name delete
|
|
1280
|
+
* @memberOf Hash
|
|
1281
|
+
* @param {Object} hash The hash to modify.
|
|
1282
|
+
* @param {string} key The key of the value to remove.
|
|
1283
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1284
|
+
*/
|
|
1285
|
+
function hashDelete(key) {
|
|
1286
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1287
|
+
this.size -= result ? 1 : 0;
|
|
1288
|
+
return result;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1292
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1293
|
+
|
|
1294
|
+
/** Used for built-in method references. */
|
|
1295
|
+
var objectProto$5 = Object.prototype;
|
|
1296
|
+
|
|
1297
|
+
/** Used to check objects for own properties. */
|
|
1298
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Gets the hash value for `key`.
|
|
1302
|
+
*
|
|
1303
|
+
* @private
|
|
1304
|
+
* @name get
|
|
1305
|
+
* @memberOf Hash
|
|
1306
|
+
* @param {string} key The key of the value to get.
|
|
1307
|
+
* @returns {*} Returns the entry value.
|
|
1308
|
+
*/
|
|
1309
|
+
function hashGet(key) {
|
|
1310
|
+
var data = this.__data__;
|
|
1311
|
+
if (nativeCreate) {
|
|
1312
|
+
var result = data[key];
|
|
1313
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1314
|
+
}
|
|
1315
|
+
return hasOwnProperty$4.call(data, key) ? data[key] : undefined;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/** Used for built-in method references. */
|
|
1319
|
+
var objectProto$4 = Object.prototype;
|
|
1320
|
+
|
|
1321
|
+
/** Used to check objects for own properties. */
|
|
1322
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* Checks if a hash value for `key` exists.
|
|
1326
|
+
*
|
|
1327
|
+
* @private
|
|
1328
|
+
* @name has
|
|
1329
|
+
* @memberOf Hash
|
|
1330
|
+
* @param {string} key The key of the entry to check.
|
|
1331
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1332
|
+
*/
|
|
1333
|
+
function hashHas(key) {
|
|
1334
|
+
var data = this.__data__;
|
|
1335
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1339
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Sets the hash `key` to `value`.
|
|
1343
|
+
*
|
|
1344
|
+
* @private
|
|
1345
|
+
* @name set
|
|
1346
|
+
* @memberOf Hash
|
|
1347
|
+
* @param {string} key The key of the value to set.
|
|
1348
|
+
* @param {*} value The value to set.
|
|
1349
|
+
* @returns {Object} Returns the hash instance.
|
|
1350
|
+
*/
|
|
1351
|
+
function hashSet(key, value) {
|
|
1352
|
+
var data = this.__data__;
|
|
1353
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1354
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1355
|
+
return this;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Creates a hash object.
|
|
1360
|
+
*
|
|
1361
|
+
* @private
|
|
1362
|
+
* @constructor
|
|
1363
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1364
|
+
*/
|
|
1365
|
+
function Hash(entries) {
|
|
1366
|
+
var index = -1,
|
|
1367
|
+
length = entries == null ? 0 : entries.length;
|
|
1368
|
+
|
|
1369
|
+
this.clear();
|
|
1370
|
+
while (++index < length) {
|
|
1371
|
+
var entry = entries[index];
|
|
1372
|
+
this.set(entry[0], entry[1]);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// Add methods to `Hash`.
|
|
1377
|
+
Hash.prototype.clear = hashClear;
|
|
1378
|
+
Hash.prototype['delete'] = hashDelete;
|
|
1379
|
+
Hash.prototype.get = hashGet;
|
|
1380
|
+
Hash.prototype.has = hashHas;
|
|
1381
|
+
Hash.prototype.set = hashSet;
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Removes all key-value entries from the list cache.
|
|
1385
|
+
*
|
|
1386
|
+
* @private
|
|
1387
|
+
* @name clear
|
|
1388
|
+
* @memberOf ListCache
|
|
1389
|
+
*/
|
|
1390
|
+
function listCacheClear() {
|
|
1391
|
+
this.__data__ = [];
|
|
1392
|
+
this.size = 0;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1397
|
+
*
|
|
1398
|
+
* @private
|
|
1399
|
+
* @param {Array} array The array to inspect.
|
|
1400
|
+
* @param {*} key The key to search for.
|
|
1401
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1402
|
+
*/
|
|
1403
|
+
function assocIndexOf(array, key) {
|
|
1404
|
+
var length = array.length;
|
|
1405
|
+
while (length--) {
|
|
1406
|
+
if (eq(array[length][0], key)) {
|
|
1407
|
+
return length;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
return -1;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/** Used for built-in method references. */
|
|
1414
|
+
var arrayProto = Array.prototype;
|
|
1415
|
+
|
|
1416
|
+
/** Built-in value references. */
|
|
1417
|
+
var splice = arrayProto.splice;
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* Removes `key` and its value from the list cache.
|
|
1421
|
+
*
|
|
1422
|
+
* @private
|
|
1423
|
+
* @name delete
|
|
1424
|
+
* @memberOf ListCache
|
|
1425
|
+
* @param {string} key The key of the value to remove.
|
|
1426
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1427
|
+
*/
|
|
1428
|
+
function listCacheDelete(key) {
|
|
1429
|
+
var data = this.__data__,
|
|
1430
|
+
index = assocIndexOf(data, key);
|
|
1431
|
+
|
|
1432
|
+
if (index < 0) {
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1435
|
+
var lastIndex = data.length - 1;
|
|
1436
|
+
if (index == lastIndex) {
|
|
1437
|
+
data.pop();
|
|
1438
|
+
} else {
|
|
1439
|
+
splice.call(data, index, 1);
|
|
1440
|
+
}
|
|
1441
|
+
--this.size;
|
|
1442
|
+
return true;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Gets the list cache value for `key`.
|
|
1447
|
+
*
|
|
1448
|
+
* @private
|
|
1449
|
+
* @name get
|
|
1450
|
+
* @memberOf ListCache
|
|
1451
|
+
* @param {string} key The key of the value to get.
|
|
1452
|
+
* @returns {*} Returns the entry value.
|
|
1453
|
+
*/
|
|
1454
|
+
function listCacheGet(key) {
|
|
1455
|
+
var data = this.__data__,
|
|
1456
|
+
index = assocIndexOf(data, key);
|
|
1457
|
+
|
|
1458
|
+
return index < 0 ? undefined : data[index][1];
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Checks if a list cache value for `key` exists.
|
|
1463
|
+
*
|
|
1464
|
+
* @private
|
|
1465
|
+
* @name has
|
|
1466
|
+
* @memberOf ListCache
|
|
1467
|
+
* @param {string} key The key of the entry to check.
|
|
1468
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1469
|
+
*/
|
|
1470
|
+
function listCacheHas(key) {
|
|
1471
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* Sets the list cache `key` to `value`.
|
|
1476
|
+
*
|
|
1477
|
+
* @private
|
|
1478
|
+
* @name set
|
|
1479
|
+
* @memberOf ListCache
|
|
1480
|
+
* @param {string} key The key of the value to set.
|
|
1481
|
+
* @param {*} value The value to set.
|
|
1482
|
+
* @returns {Object} Returns the list cache instance.
|
|
1483
|
+
*/
|
|
1484
|
+
function listCacheSet(key, value) {
|
|
1485
|
+
var data = this.__data__,
|
|
1486
|
+
index = assocIndexOf(data, key);
|
|
1487
|
+
|
|
1488
|
+
if (index < 0) {
|
|
1489
|
+
++this.size;
|
|
1490
|
+
data.push([key, value]);
|
|
1491
|
+
} else {
|
|
1492
|
+
data[index][1] = value;
|
|
1493
|
+
}
|
|
1494
|
+
return this;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Creates an list cache object.
|
|
1499
|
+
*
|
|
1500
|
+
* @private
|
|
1501
|
+
* @constructor
|
|
1502
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1503
|
+
*/
|
|
1504
|
+
function ListCache(entries) {
|
|
1505
|
+
var index = -1,
|
|
1506
|
+
length = entries == null ? 0 : entries.length;
|
|
1507
|
+
|
|
1508
|
+
this.clear();
|
|
1509
|
+
while (++index < length) {
|
|
1510
|
+
var entry = entries[index];
|
|
1511
|
+
this.set(entry[0], entry[1]);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// Add methods to `ListCache`.
|
|
1516
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1517
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1518
|
+
ListCache.prototype.get = listCacheGet;
|
|
1519
|
+
ListCache.prototype.has = listCacheHas;
|
|
1520
|
+
ListCache.prototype.set = listCacheSet;
|
|
1521
|
+
|
|
1522
|
+
/* Built-in method references that are verified to be native. */
|
|
1523
|
+
var Map = getNative(root, 'Map');
|
|
1524
|
+
|
|
1525
|
+
/**
|
|
1526
|
+
* Removes all key-value entries from the map.
|
|
1527
|
+
*
|
|
1528
|
+
* @private
|
|
1529
|
+
* @name clear
|
|
1530
|
+
* @memberOf MapCache
|
|
1531
|
+
*/
|
|
1532
|
+
function mapCacheClear() {
|
|
1533
|
+
this.size = 0;
|
|
1534
|
+
this.__data__ = {
|
|
1535
|
+
'hash': new Hash,
|
|
1536
|
+
'map': new (Map || ListCache),
|
|
1537
|
+
'string': new Hash
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1543
|
+
*
|
|
1544
|
+
* @private
|
|
1545
|
+
* @param {*} value The value to check.
|
|
1546
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1547
|
+
*/
|
|
1548
|
+
function isKeyable(value) {
|
|
1549
|
+
var type = typeof value;
|
|
1550
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1551
|
+
? (value !== '__proto__')
|
|
1552
|
+
: (value === null);
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Gets the data for `map`.
|
|
1557
|
+
*
|
|
1558
|
+
* @private
|
|
1559
|
+
* @param {Object} map The map to query.
|
|
1560
|
+
* @param {string} key The reference key.
|
|
1561
|
+
* @returns {*} Returns the map data.
|
|
1562
|
+
*/
|
|
1563
|
+
function getMapData(map, key) {
|
|
1564
|
+
var data = map.__data__;
|
|
1565
|
+
return isKeyable(key)
|
|
1566
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1567
|
+
: data.map;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* Removes `key` and its value from the map.
|
|
1572
|
+
*
|
|
1573
|
+
* @private
|
|
1574
|
+
* @name delete
|
|
1575
|
+
* @memberOf MapCache
|
|
1576
|
+
* @param {string} key The key of the value to remove.
|
|
1577
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1578
|
+
*/
|
|
1579
|
+
function mapCacheDelete(key) {
|
|
1580
|
+
var result = getMapData(this, key)['delete'](key);
|
|
1581
|
+
this.size -= result ? 1 : 0;
|
|
1582
|
+
return result;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Gets the map value for `key`.
|
|
1587
|
+
*
|
|
1588
|
+
* @private
|
|
1589
|
+
* @name get
|
|
1590
|
+
* @memberOf MapCache
|
|
1591
|
+
* @param {string} key The key of the value to get.
|
|
1592
|
+
* @returns {*} Returns the entry value.
|
|
1593
|
+
*/
|
|
1594
|
+
function mapCacheGet(key) {
|
|
1595
|
+
return getMapData(this, key).get(key);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
* Checks if a map value for `key` exists.
|
|
1600
|
+
*
|
|
1601
|
+
* @private
|
|
1602
|
+
* @name has
|
|
1603
|
+
* @memberOf MapCache
|
|
1604
|
+
* @param {string} key The key of the entry to check.
|
|
1605
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1606
|
+
*/
|
|
1607
|
+
function mapCacheHas(key) {
|
|
1608
|
+
return getMapData(this, key).has(key);
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Sets the map `key` to `value`.
|
|
1613
|
+
*
|
|
1614
|
+
* @private
|
|
1615
|
+
* @name set
|
|
1616
|
+
* @memberOf MapCache
|
|
1617
|
+
* @param {string} key The key of the value to set.
|
|
1618
|
+
* @param {*} value The value to set.
|
|
1619
|
+
* @returns {Object} Returns the map cache instance.
|
|
1620
|
+
*/
|
|
1621
|
+
function mapCacheSet(key, value) {
|
|
1622
|
+
var data = getMapData(this, key),
|
|
1623
|
+
size = data.size;
|
|
1624
|
+
|
|
1625
|
+
data.set(key, value);
|
|
1626
|
+
this.size += data.size == size ? 0 : 1;
|
|
1627
|
+
return this;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Creates a map cache object to store key-value pairs.
|
|
1632
|
+
*
|
|
1633
|
+
* @private
|
|
1634
|
+
* @constructor
|
|
1635
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1636
|
+
*/
|
|
1637
|
+
function MapCache(entries) {
|
|
1638
|
+
var index = -1,
|
|
1639
|
+
length = entries == null ? 0 : entries.length;
|
|
1640
|
+
|
|
1641
|
+
this.clear();
|
|
1642
|
+
while (++index < length) {
|
|
1643
|
+
var entry = entries[index];
|
|
1644
|
+
this.set(entry[0], entry[1]);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
// Add methods to `MapCache`.
|
|
1649
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1650
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1651
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1652
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1653
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1654
|
+
|
|
1655
|
+
/** Error message constants. */
|
|
1656
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1660
|
+
* provided, it determines the cache key for storing the result based on the
|
|
1661
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
1662
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
1663
|
+
* is invoked with the `this` binding of the memoized function.
|
|
1664
|
+
*
|
|
1665
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1666
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1667
|
+
* constructor with one whose instances implement the
|
|
1668
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1669
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1670
|
+
*
|
|
1671
|
+
* @static
|
|
1672
|
+
* @memberOf _
|
|
1673
|
+
* @since 0.1.0
|
|
1674
|
+
* @category Function
|
|
1675
|
+
* @param {Function} func The function to have its output memoized.
|
|
1676
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1677
|
+
* @returns {Function} Returns the new memoized function.
|
|
1678
|
+
* @example
|
|
1679
|
+
*
|
|
1680
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
1681
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
1682
|
+
*
|
|
1683
|
+
* var values = _.memoize(_.values);
|
|
1684
|
+
* values(object);
|
|
1685
|
+
* // => [1, 2]
|
|
1686
|
+
*
|
|
1687
|
+
* values(other);
|
|
1688
|
+
* // => [3, 4]
|
|
1689
|
+
*
|
|
1690
|
+
* object.a = 2;
|
|
1691
|
+
* values(object);
|
|
1692
|
+
* // => [1, 2]
|
|
1693
|
+
*
|
|
1694
|
+
* // Modify the result cache.
|
|
1695
|
+
* values.cache.set(object, ['a', 'b']);
|
|
1696
|
+
* values(object);
|
|
1697
|
+
* // => ['a', 'b']
|
|
1698
|
+
*
|
|
1699
|
+
* // Replace `_.memoize.Cache`.
|
|
1700
|
+
* _.memoize.Cache = WeakMap;
|
|
1701
|
+
*/
|
|
1702
|
+
function memoize(func, resolver) {
|
|
1703
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1704
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1705
|
+
}
|
|
1706
|
+
var memoized = function() {
|
|
1707
|
+
var args = arguments,
|
|
1708
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1709
|
+
cache = memoized.cache;
|
|
1710
|
+
|
|
1711
|
+
if (cache.has(key)) {
|
|
1712
|
+
return cache.get(key);
|
|
1713
|
+
}
|
|
1714
|
+
var result = func.apply(this, args);
|
|
1715
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
1716
|
+
return result;
|
|
1717
|
+
};
|
|
1718
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
1719
|
+
return memoized;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
// Expose `MapCache`.
|
|
1723
|
+
memoize.Cache = MapCache;
|
|
1724
|
+
|
|
1725
|
+
/** Used as the maximum memoize cache size. */
|
|
1726
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1730
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1731
|
+
*
|
|
1732
|
+
* @private
|
|
1733
|
+
* @param {Function} func The function to have its output memoized.
|
|
1734
|
+
* @returns {Function} Returns the new memoized function.
|
|
1735
|
+
*/
|
|
1736
|
+
function memoizeCapped(func) {
|
|
1737
|
+
var result = memoize(func, function(key) {
|
|
1738
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1739
|
+
cache.clear();
|
|
1740
|
+
}
|
|
1741
|
+
return key;
|
|
1742
|
+
});
|
|
1743
|
+
|
|
1744
|
+
var cache = result.cache;
|
|
1745
|
+
return result;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/** Used to match property names within property paths. */
|
|
1749
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1750
|
+
|
|
1751
|
+
/** Used to match backslashes in property paths. */
|
|
1752
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* Converts `string` to a property path array.
|
|
1756
|
+
*
|
|
1757
|
+
* @private
|
|
1758
|
+
* @param {string} string The string to convert.
|
|
1759
|
+
* @returns {Array} Returns the property path array.
|
|
1760
|
+
*/
|
|
1761
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
1762
|
+
var result = [];
|
|
1763
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1764
|
+
result.push('');
|
|
1765
|
+
}
|
|
1766
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1767
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1768
|
+
});
|
|
1769
|
+
return result;
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
1774
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
1775
|
+
*
|
|
1776
|
+
* @static
|
|
1777
|
+
* @memberOf _
|
|
1778
|
+
* @since 4.0.0
|
|
1779
|
+
* @category Lang
|
|
1780
|
+
* @param {*} value The value to convert.
|
|
1781
|
+
* @returns {string} Returns the converted string.
|
|
1782
|
+
* @example
|
|
1783
|
+
*
|
|
1784
|
+
* _.toString(null);
|
|
1785
|
+
* // => ''
|
|
1786
|
+
*
|
|
1787
|
+
* _.toString(-0);
|
|
1788
|
+
* // => '-0'
|
|
1789
|
+
*
|
|
1790
|
+
* _.toString([1, 2, 3]);
|
|
1791
|
+
* // => '1,2,3'
|
|
1792
|
+
*/
|
|
1793
|
+
function toString(value) {
|
|
1794
|
+
return value == null ? '' : baseToString(value);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Casts `value` to a path array if it's not one.
|
|
1799
|
+
*
|
|
1800
|
+
* @private
|
|
1801
|
+
* @param {*} value The value to inspect.
|
|
1802
|
+
* @param {Object} [object] The object to query keys on.
|
|
1803
|
+
* @returns {Array} Returns the cast property path array.
|
|
1804
|
+
*/
|
|
1805
|
+
function castPath(value, object) {
|
|
1806
|
+
if (isArray(value)) {
|
|
1807
|
+
return value;
|
|
1808
|
+
}
|
|
1809
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
1814
|
+
*
|
|
1815
|
+
* @private
|
|
1816
|
+
* @param {*} value The value to inspect.
|
|
1817
|
+
* @returns {string|symbol} Returns the key.
|
|
1818
|
+
*/
|
|
1819
|
+
function toKey(value) {
|
|
1820
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
1821
|
+
return value;
|
|
1822
|
+
}
|
|
1823
|
+
var result = (value + '');
|
|
1824
|
+
return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* The base implementation of `_.get` without support for default values.
|
|
1829
|
+
*
|
|
1830
|
+
* @private
|
|
1831
|
+
* @param {Object} object The object to query.
|
|
1832
|
+
* @param {Array|string} path The path of the property to get.
|
|
1833
|
+
* @returns {*} Returns the resolved value.
|
|
1834
|
+
*/
|
|
1835
|
+
function baseGet(object, path) {
|
|
1836
|
+
path = castPath(path, object);
|
|
1837
|
+
|
|
1838
|
+
var index = 0,
|
|
1839
|
+
length = path.length;
|
|
1840
|
+
|
|
1841
|
+
while (object != null && index < length) {
|
|
1842
|
+
object = object[toKey(path[index++])];
|
|
1843
|
+
}
|
|
1844
|
+
return (index && index == length) ? object : undefined;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* Appends the elements of `values` to `array`.
|
|
1849
|
+
*
|
|
1850
|
+
* @private
|
|
1851
|
+
* @param {Array} array The array to modify.
|
|
1852
|
+
* @param {Array} values The values to append.
|
|
1853
|
+
* @returns {Array} Returns `array`.
|
|
1854
|
+
*/
|
|
1855
|
+
function arrayPush(array, values) {
|
|
1856
|
+
var index = -1,
|
|
1857
|
+
length = values.length,
|
|
1858
|
+
offset = array.length;
|
|
1859
|
+
|
|
1860
|
+
while (++index < length) {
|
|
1861
|
+
array[offset + index] = values[index];
|
|
1862
|
+
}
|
|
1863
|
+
return array;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
/** Built-in value references. */
|
|
1867
|
+
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
1871
|
+
*
|
|
1872
|
+
* @private
|
|
1873
|
+
* @param {*} value The value to check.
|
|
1874
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
1875
|
+
*/
|
|
1876
|
+
function isFlattenable(value) {
|
|
1877
|
+
return isArray(value) || isArguments(value) ||
|
|
1878
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
1883
|
+
*
|
|
1884
|
+
* @private
|
|
1885
|
+
* @param {Array} array The array to flatten.
|
|
1886
|
+
* @param {number} depth The maximum recursion depth.
|
|
1887
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
1888
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
1889
|
+
* @param {Array} [result=[]] The initial result value.
|
|
1890
|
+
* @returns {Array} Returns the new flattened array.
|
|
1891
|
+
*/
|
|
1892
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
1893
|
+
var index = -1,
|
|
1894
|
+
length = array.length;
|
|
1895
|
+
|
|
1896
|
+
predicate || (predicate = isFlattenable);
|
|
1897
|
+
result || (result = []);
|
|
1898
|
+
|
|
1899
|
+
while (++index < length) {
|
|
1900
|
+
var value = array[index];
|
|
1901
|
+
if (predicate(value)) {
|
|
1902
|
+
{
|
|
1903
|
+
arrayPush(result, value);
|
|
1904
|
+
}
|
|
1905
|
+
} else {
|
|
1906
|
+
result[result.length] = value;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return result;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* Flattens `array` a single level deep.
|
|
1914
|
+
*
|
|
1915
|
+
* @static
|
|
1916
|
+
* @memberOf _
|
|
1917
|
+
* @since 0.1.0
|
|
1918
|
+
* @category Array
|
|
1919
|
+
* @param {Array} array The array to flatten.
|
|
1920
|
+
* @returns {Array} Returns the new flattened array.
|
|
1921
|
+
* @example
|
|
1922
|
+
*
|
|
1923
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
1924
|
+
* // => [1, 2, [3, [4]], 5]
|
|
1925
|
+
*/
|
|
1926
|
+
function flatten(array) {
|
|
1927
|
+
var length = array == null ? 0 : array.length;
|
|
1928
|
+
return length ? baseFlatten(array) : [];
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* A specialized version of `baseRest` which flattens the rest array.
|
|
1933
|
+
*
|
|
1934
|
+
* @private
|
|
1935
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
1936
|
+
* @returns {Function} Returns the new function.
|
|
1937
|
+
*/
|
|
1938
|
+
function flatRest(func) {
|
|
1939
|
+
return setToString(overRest(func, undefined, flatten), func + '');
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/** Built-in value references. */
|
|
1943
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
1944
|
+
|
|
1945
|
+
/** `Object#toString` result references. */
|
|
1946
|
+
var objectTag$2 = '[object Object]';
|
|
1947
|
+
|
|
1948
|
+
/** Used for built-in method references. */
|
|
1949
|
+
var funcProto = Function.prototype,
|
|
1950
|
+
objectProto$3 = Object.prototype;
|
|
1951
|
+
|
|
1952
|
+
/** Used to resolve the decompiled source of functions. */
|
|
1953
|
+
var funcToString = funcProto.toString;
|
|
1954
|
+
|
|
1955
|
+
/** Used to check objects for own properties. */
|
|
1956
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
1957
|
+
|
|
1958
|
+
/** Used to infer the `Object` constructor. */
|
|
1959
|
+
var objectCtorString = funcToString.call(Object);
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
1963
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
1964
|
+
*
|
|
1965
|
+
* @static
|
|
1966
|
+
* @memberOf _
|
|
1967
|
+
* @since 0.8.0
|
|
1968
|
+
* @category Lang
|
|
1969
|
+
* @param {*} value The value to check.
|
|
1970
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
1971
|
+
* @example
|
|
1972
|
+
*
|
|
1973
|
+
* function Foo() {
|
|
1974
|
+
* this.a = 1;
|
|
1975
|
+
* }
|
|
1976
|
+
*
|
|
1977
|
+
* _.isPlainObject(new Foo);
|
|
1978
|
+
* // => false
|
|
1979
|
+
*
|
|
1980
|
+
* _.isPlainObject([1, 2, 3]);
|
|
1981
|
+
* // => false
|
|
1982
|
+
*
|
|
1983
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
1984
|
+
* // => true
|
|
1985
|
+
*
|
|
1986
|
+
* _.isPlainObject(Object.create(null));
|
|
1987
|
+
* // => true
|
|
1988
|
+
*/
|
|
1989
|
+
function isPlainObject(value) {
|
|
1990
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag$2) {
|
|
1991
|
+
return false;
|
|
1992
|
+
}
|
|
1993
|
+
var proto = getPrototype(value);
|
|
1994
|
+
if (proto === null) {
|
|
1995
|
+
return true;
|
|
1996
|
+
}
|
|
1997
|
+
var Ctor = hasOwnProperty$2.call(proto, 'constructor') && proto.constructor;
|
|
1998
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
1999
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
2004
|
+
*
|
|
2005
|
+
* @private
|
|
2006
|
+
* @param {Array} array The array to slice.
|
|
2007
|
+
* @param {number} [start=0] The start position.
|
|
2008
|
+
* @param {number} [end=array.length] The end position.
|
|
2009
|
+
* @returns {Array} Returns the slice of `array`.
|
|
2010
|
+
*/
|
|
2011
|
+
function baseSlice(array, start, end) {
|
|
2012
|
+
var index = -1,
|
|
2013
|
+
length = array.length;
|
|
2014
|
+
|
|
2015
|
+
if (start < 0) {
|
|
2016
|
+
start = -start > length ? 0 : (length + start);
|
|
2017
|
+
}
|
|
2018
|
+
end = end > length ? length : end;
|
|
2019
|
+
if (end < 0) {
|
|
2020
|
+
end += length;
|
|
2021
|
+
}
|
|
2022
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
2023
|
+
start >>>= 0;
|
|
2024
|
+
|
|
2025
|
+
var result = Array(length);
|
|
2026
|
+
while (++index < length) {
|
|
2027
|
+
result[index] = array[index + start];
|
|
2028
|
+
}
|
|
2029
|
+
return result;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Removes all key-value entries from the stack.
|
|
2034
|
+
*
|
|
2035
|
+
* @private
|
|
2036
|
+
* @name clear
|
|
2037
|
+
* @memberOf Stack
|
|
2038
|
+
*/
|
|
2039
|
+
function stackClear() {
|
|
2040
|
+
this.__data__ = new ListCache;
|
|
2041
|
+
this.size = 0;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Removes `key` and its value from the stack.
|
|
2046
|
+
*
|
|
2047
|
+
* @private
|
|
2048
|
+
* @name delete
|
|
2049
|
+
* @memberOf Stack
|
|
2050
|
+
* @param {string} key The key of the value to remove.
|
|
2051
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
2052
|
+
*/
|
|
2053
|
+
function stackDelete(key) {
|
|
2054
|
+
var data = this.__data__,
|
|
2055
|
+
result = data['delete'](key);
|
|
2056
|
+
|
|
2057
|
+
this.size = data.size;
|
|
2058
|
+
return result;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Gets the stack value for `key`.
|
|
2063
|
+
*
|
|
2064
|
+
* @private
|
|
2065
|
+
* @name get
|
|
2066
|
+
* @memberOf Stack
|
|
2067
|
+
* @param {string} key The key of the value to get.
|
|
2068
|
+
* @returns {*} Returns the entry value.
|
|
2069
|
+
*/
|
|
2070
|
+
function stackGet(key) {
|
|
2071
|
+
return this.__data__.get(key);
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Checks if a stack value for `key` exists.
|
|
2076
|
+
*
|
|
2077
|
+
* @private
|
|
2078
|
+
* @name has
|
|
2079
|
+
* @memberOf Stack
|
|
2080
|
+
* @param {string} key The key of the entry to check.
|
|
2081
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2082
|
+
*/
|
|
2083
|
+
function stackHas(key) {
|
|
2084
|
+
return this.__data__.has(key);
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/** Used as the size to enable large array optimizations. */
|
|
2088
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Sets the stack `key` to `value`.
|
|
2092
|
+
*
|
|
2093
|
+
* @private
|
|
2094
|
+
* @name set
|
|
2095
|
+
* @memberOf Stack
|
|
2096
|
+
* @param {string} key The key of the value to set.
|
|
2097
|
+
* @param {*} value The value to set.
|
|
2098
|
+
* @returns {Object} Returns the stack cache instance.
|
|
2099
|
+
*/
|
|
2100
|
+
function stackSet(key, value) {
|
|
2101
|
+
var data = this.__data__;
|
|
2102
|
+
if (data instanceof ListCache) {
|
|
2103
|
+
var pairs = data.__data__;
|
|
2104
|
+
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
2105
|
+
pairs.push([key, value]);
|
|
2106
|
+
this.size = ++data.size;
|
|
2107
|
+
return this;
|
|
2108
|
+
}
|
|
2109
|
+
data = this.__data__ = new MapCache(pairs);
|
|
2110
|
+
}
|
|
2111
|
+
data.set(key, value);
|
|
2112
|
+
this.size = data.size;
|
|
2113
|
+
return this;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
/**
|
|
2117
|
+
* Creates a stack cache object to store key-value pairs.
|
|
2118
|
+
*
|
|
2119
|
+
* @private
|
|
2120
|
+
* @constructor
|
|
2121
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
2122
|
+
*/
|
|
2123
|
+
function Stack(entries) {
|
|
2124
|
+
var data = this.__data__ = new ListCache(entries);
|
|
2125
|
+
this.size = data.size;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
// Add methods to `Stack`.
|
|
2129
|
+
Stack.prototype.clear = stackClear;
|
|
2130
|
+
Stack.prototype['delete'] = stackDelete;
|
|
2131
|
+
Stack.prototype.get = stackGet;
|
|
2132
|
+
Stack.prototype.has = stackHas;
|
|
2133
|
+
Stack.prototype.set = stackSet;
|
|
2134
|
+
|
|
2135
|
+
/** Detect free variable `exports`. */
|
|
2136
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
2137
|
+
|
|
2138
|
+
/** Detect free variable `module`. */
|
|
2139
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
2140
|
+
|
|
2141
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2142
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2143
|
+
|
|
2144
|
+
/** Built-in value references. */
|
|
2145
|
+
var Buffer = moduleExports ? root.Buffer : undefined;
|
|
2146
|
+
Buffer ? Buffer.allocUnsafe : undefined;
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* Creates a clone of `buffer`.
|
|
2150
|
+
*
|
|
2151
|
+
* @private
|
|
2152
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
2153
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2154
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
2155
|
+
*/
|
|
2156
|
+
function cloneBuffer(buffer, isDeep) {
|
|
2157
|
+
{
|
|
2158
|
+
return buffer.slice();
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
2164
|
+
* iteratee shorthands.
|
|
2165
|
+
*
|
|
2166
|
+
* @private
|
|
2167
|
+
* @param {Array} [array] The array to iterate over.
|
|
2168
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
2169
|
+
* @returns {Array} Returns the new filtered array.
|
|
2170
|
+
*/
|
|
2171
|
+
function arrayFilter(array, predicate) {
|
|
2172
|
+
var index = -1,
|
|
2173
|
+
length = array == null ? 0 : array.length,
|
|
2174
|
+
resIndex = 0,
|
|
2175
|
+
result = [];
|
|
2176
|
+
|
|
2177
|
+
while (++index < length) {
|
|
2178
|
+
var value = array[index];
|
|
2179
|
+
if (predicate(value, index, array)) {
|
|
2180
|
+
result[resIndex++] = value;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
return result;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* This method returns a new empty array.
|
|
2188
|
+
*
|
|
2189
|
+
* @static
|
|
2190
|
+
* @memberOf _
|
|
2191
|
+
* @since 4.13.0
|
|
2192
|
+
* @category Util
|
|
2193
|
+
* @returns {Array} Returns the new empty array.
|
|
2194
|
+
* @example
|
|
2195
|
+
*
|
|
2196
|
+
* var arrays = _.times(2, _.stubArray);
|
|
2197
|
+
*
|
|
2198
|
+
* console.log(arrays);
|
|
2199
|
+
* // => [[], []]
|
|
2200
|
+
*
|
|
2201
|
+
* console.log(arrays[0] === arrays[1]);
|
|
2202
|
+
* // => false
|
|
2203
|
+
*/
|
|
2204
|
+
function stubArray() {
|
|
2205
|
+
return [];
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
/** Used for built-in method references. */
|
|
2209
|
+
var objectProto$2 = Object.prototype;
|
|
2210
|
+
|
|
2211
|
+
/** Built-in value references. */
|
|
2212
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
2213
|
+
|
|
2214
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2215
|
+
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
2219
|
+
*
|
|
2220
|
+
* @private
|
|
2221
|
+
* @param {Object} object The object to query.
|
|
2222
|
+
* @returns {Array} Returns the array of symbols.
|
|
2223
|
+
*/
|
|
2224
|
+
var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
|
|
2225
|
+
if (object == null) {
|
|
2226
|
+
return [];
|
|
2227
|
+
}
|
|
2228
|
+
object = Object(object);
|
|
2229
|
+
return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
|
|
2230
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
2231
|
+
});
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2235
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
2239
|
+
*
|
|
2240
|
+
* @private
|
|
2241
|
+
* @param {Object} object The object to query.
|
|
2242
|
+
* @returns {Array} Returns the array of symbols.
|
|
2243
|
+
*/
|
|
2244
|
+
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
|
2245
|
+
var result = [];
|
|
2246
|
+
while (object) {
|
|
2247
|
+
arrayPush(result, getSymbols(object));
|
|
2248
|
+
object = getPrototype(object);
|
|
2249
|
+
}
|
|
2250
|
+
return result;
|
|
2251
|
+
};
|
|
2252
|
+
|
|
2253
|
+
/**
|
|
2254
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
2255
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
2256
|
+
* symbols of `object`.
|
|
2257
|
+
*
|
|
2258
|
+
* @private
|
|
2259
|
+
* @param {Object} object The object to query.
|
|
2260
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
2261
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
2262
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2263
|
+
*/
|
|
2264
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
2265
|
+
var result = keysFunc(object);
|
|
2266
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Creates an array of own and inherited enumerable property names and
|
|
2271
|
+
* symbols of `object`.
|
|
2272
|
+
*
|
|
2273
|
+
* @private
|
|
2274
|
+
* @param {Object} object The object to query.
|
|
2275
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2276
|
+
*/
|
|
2277
|
+
function getAllKeysIn(object) {
|
|
2278
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/* Built-in method references that are verified to be native. */
|
|
2282
|
+
var DataView = getNative(root, 'DataView');
|
|
2283
|
+
|
|
2284
|
+
/* Built-in method references that are verified to be native. */
|
|
2285
|
+
var Promise$1 = getNative(root, 'Promise');
|
|
2286
|
+
|
|
2287
|
+
/* Built-in method references that are verified to be native. */
|
|
2288
|
+
var Set = getNative(root, 'Set');
|
|
2289
|
+
|
|
2290
|
+
/** `Object#toString` result references. */
|
|
2291
|
+
var mapTag$3 = '[object Map]',
|
|
2292
|
+
objectTag$1 = '[object Object]',
|
|
2293
|
+
promiseTag = '[object Promise]',
|
|
2294
|
+
setTag$3 = '[object Set]',
|
|
2295
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
2296
|
+
|
|
2297
|
+
var dataViewTag$2 = '[object DataView]';
|
|
2298
|
+
|
|
2299
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
2300
|
+
var dataViewCtorString = toSource(DataView),
|
|
2301
|
+
mapCtorString = toSource(Map),
|
|
2302
|
+
promiseCtorString = toSource(Promise$1),
|
|
2303
|
+
setCtorString = toSource(Set),
|
|
2304
|
+
weakMapCtorString = toSource(WeakMap);
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* Gets the `toStringTag` of `value`.
|
|
2308
|
+
*
|
|
2309
|
+
* @private
|
|
2310
|
+
* @param {*} value The value to query.
|
|
2311
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2312
|
+
*/
|
|
2313
|
+
var getTag = baseGetTag;
|
|
2314
|
+
|
|
2315
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2316
|
+
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
2317
|
+
(Map && getTag(new Map) != mapTag$3) ||
|
|
2318
|
+
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
2319
|
+
(Set && getTag(new Set) != setTag$3) ||
|
|
2320
|
+
(WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
|
|
2321
|
+
getTag = function(value) {
|
|
2322
|
+
var result = baseGetTag(value),
|
|
2323
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
2324
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
2325
|
+
|
|
2326
|
+
if (ctorString) {
|
|
2327
|
+
switch (ctorString) {
|
|
2328
|
+
case dataViewCtorString: return dataViewTag$2;
|
|
2329
|
+
case mapCtorString: return mapTag$3;
|
|
2330
|
+
case promiseCtorString: return promiseTag;
|
|
2331
|
+
case setCtorString: return setTag$3;
|
|
2332
|
+
case weakMapCtorString: return weakMapTag$1;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
return result;
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
/** Used for built-in method references. */
|
|
2340
|
+
var objectProto$1 = Object.prototype;
|
|
2341
|
+
|
|
2342
|
+
/** Used to check objects for own properties. */
|
|
2343
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2344
|
+
|
|
2345
|
+
/**
|
|
2346
|
+
* Initializes an array clone.
|
|
2347
|
+
*
|
|
2348
|
+
* @private
|
|
2349
|
+
* @param {Array} array The array to clone.
|
|
2350
|
+
* @returns {Array} Returns the initialized clone.
|
|
2351
|
+
*/
|
|
2352
|
+
function initCloneArray(array) {
|
|
2353
|
+
var length = array.length,
|
|
2354
|
+
result = new array.constructor(length);
|
|
2355
|
+
|
|
2356
|
+
// Add properties assigned by `RegExp#exec`.
|
|
2357
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {
|
|
2358
|
+
result.index = array.index;
|
|
2359
|
+
result.input = array.input;
|
|
2360
|
+
}
|
|
2361
|
+
return result;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
/** Built-in value references. */
|
|
2365
|
+
var Uint8Array = root.Uint8Array;
|
|
2366
|
+
|
|
2367
|
+
/**
|
|
2368
|
+
* Creates a clone of `arrayBuffer`.
|
|
2369
|
+
*
|
|
2370
|
+
* @private
|
|
2371
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
2372
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
2373
|
+
*/
|
|
2374
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2375
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2376
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
2377
|
+
return result;
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
/**
|
|
2381
|
+
* Creates a clone of `dataView`.
|
|
2382
|
+
*
|
|
2383
|
+
* @private
|
|
2384
|
+
* @param {Object} dataView The data view to clone.
|
|
2385
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2386
|
+
* @returns {Object} Returns the cloned data view.
|
|
2387
|
+
*/
|
|
2388
|
+
function cloneDataView(dataView, isDeep) {
|
|
2389
|
+
var buffer = cloneArrayBuffer(dataView.buffer) ;
|
|
2390
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
2394
|
+
var reFlags = /\w*$/;
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* Creates a clone of `regexp`.
|
|
2398
|
+
*
|
|
2399
|
+
* @private
|
|
2400
|
+
* @param {Object} regexp The regexp to clone.
|
|
2401
|
+
* @returns {Object} Returns the cloned regexp.
|
|
2402
|
+
*/
|
|
2403
|
+
function cloneRegExp(regexp) {
|
|
2404
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2405
|
+
result.lastIndex = regexp.lastIndex;
|
|
2406
|
+
return result;
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2410
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
2411
|
+
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
2412
|
+
|
|
2413
|
+
/**
|
|
2414
|
+
* Creates a clone of the `symbol` object.
|
|
2415
|
+
*
|
|
2416
|
+
* @private
|
|
2417
|
+
* @param {Object} symbol The symbol object to clone.
|
|
2418
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
2419
|
+
*/
|
|
2420
|
+
function cloneSymbol(symbol) {
|
|
2421
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Creates a clone of `typedArray`.
|
|
2426
|
+
*
|
|
2427
|
+
* @private
|
|
2428
|
+
* @param {Object} typedArray The typed array to clone.
|
|
2429
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2430
|
+
* @returns {Object} Returns the cloned typed array.
|
|
2431
|
+
*/
|
|
2432
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2433
|
+
var buffer = cloneArrayBuffer(typedArray.buffer) ;
|
|
2434
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
/** `Object#toString` result references. */
|
|
2438
|
+
var boolTag$1 = '[object Boolean]',
|
|
2439
|
+
dateTag$1 = '[object Date]',
|
|
2440
|
+
mapTag$2 = '[object Map]',
|
|
2441
|
+
numberTag$1 = '[object Number]',
|
|
2442
|
+
regexpTag$1 = '[object RegExp]',
|
|
2443
|
+
setTag$2 = '[object Set]',
|
|
2444
|
+
stringTag$1 = '[object String]',
|
|
2445
|
+
symbolTag$1 = '[object Symbol]';
|
|
2446
|
+
|
|
2447
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
2448
|
+
dataViewTag$1 = '[object DataView]',
|
|
2449
|
+
float32Tag$1 = '[object Float32Array]',
|
|
2450
|
+
float64Tag$1 = '[object Float64Array]',
|
|
2451
|
+
int8Tag$1 = '[object Int8Array]',
|
|
2452
|
+
int16Tag$1 = '[object Int16Array]',
|
|
2453
|
+
int32Tag$1 = '[object Int32Array]',
|
|
2454
|
+
uint8Tag$1 = '[object Uint8Array]',
|
|
2455
|
+
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
|
|
2456
|
+
uint16Tag$1 = '[object Uint16Array]',
|
|
2457
|
+
uint32Tag$1 = '[object Uint32Array]';
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
2461
|
+
*
|
|
2462
|
+
* **Note:** This function only supports cloning values with tags of
|
|
2463
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
2464
|
+
*
|
|
2465
|
+
* @private
|
|
2466
|
+
* @param {Object} object The object to clone.
|
|
2467
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
2468
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2469
|
+
* @returns {Object} Returns the initialized clone.
|
|
2470
|
+
*/
|
|
2471
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
2472
|
+
var Ctor = object.constructor;
|
|
2473
|
+
switch (tag) {
|
|
2474
|
+
case arrayBufferTag$1:
|
|
2475
|
+
return cloneArrayBuffer(object);
|
|
2476
|
+
|
|
2477
|
+
case boolTag$1:
|
|
2478
|
+
case dateTag$1:
|
|
2479
|
+
return new Ctor(+object);
|
|
2480
|
+
|
|
2481
|
+
case dataViewTag$1:
|
|
2482
|
+
return cloneDataView(object);
|
|
2483
|
+
|
|
2484
|
+
case float32Tag$1: case float64Tag$1:
|
|
2485
|
+
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2486
|
+
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2487
|
+
return cloneTypedArray(object);
|
|
2488
|
+
|
|
2489
|
+
case mapTag$2:
|
|
2490
|
+
return new Ctor;
|
|
2491
|
+
|
|
2492
|
+
case numberTag$1:
|
|
2493
|
+
case stringTag$1:
|
|
2494
|
+
return new Ctor(object);
|
|
2495
|
+
|
|
2496
|
+
case regexpTag$1:
|
|
2497
|
+
return cloneRegExp(object);
|
|
2498
|
+
|
|
2499
|
+
case setTag$2:
|
|
2500
|
+
return new Ctor;
|
|
2501
|
+
|
|
2502
|
+
case symbolTag$1:
|
|
2503
|
+
return cloneSymbol(object);
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
/** `Object#toString` result references. */
|
|
2508
|
+
var mapTag$1 = '[object Map]';
|
|
2509
|
+
|
|
2510
|
+
/**
|
|
2511
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
2512
|
+
*
|
|
2513
|
+
* @private
|
|
2514
|
+
* @param {*} value The value to check.
|
|
2515
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2516
|
+
*/
|
|
2517
|
+
function baseIsMap(value) {
|
|
2518
|
+
return isObjectLike(value) && getTag(value) == mapTag$1;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/* Node.js helper references. */
|
|
2522
|
+
var nodeIsMap = nodeUtil && nodeUtil.isMap;
|
|
2523
|
+
|
|
2524
|
+
/**
|
|
2525
|
+
* Checks if `value` is classified as a `Map` object.
|
|
2526
|
+
*
|
|
2527
|
+
* @static
|
|
2528
|
+
* @memberOf _
|
|
2529
|
+
* @since 4.3.0
|
|
2530
|
+
* @category Lang
|
|
2531
|
+
* @param {*} value The value to check.
|
|
2532
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2533
|
+
* @example
|
|
2534
|
+
*
|
|
2535
|
+
* _.isMap(new Map);
|
|
2536
|
+
* // => true
|
|
2537
|
+
*
|
|
2538
|
+
* _.isMap(new WeakMap);
|
|
2539
|
+
* // => false
|
|
2540
|
+
*/
|
|
2541
|
+
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
2542
|
+
|
|
2543
|
+
/** `Object#toString` result references. */
|
|
2544
|
+
var setTag$1 = '[object Set]';
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2548
|
+
*
|
|
2549
|
+
* @private
|
|
2550
|
+
* @param {*} value The value to check.
|
|
2551
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2552
|
+
*/
|
|
2553
|
+
function baseIsSet(value) {
|
|
2554
|
+
return isObjectLike(value) && getTag(value) == setTag$1;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
/* Node.js helper references. */
|
|
2558
|
+
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
2559
|
+
|
|
2560
|
+
/**
|
|
2561
|
+
* Checks if `value` is classified as a `Set` object.
|
|
2562
|
+
*
|
|
2563
|
+
* @static
|
|
2564
|
+
* @memberOf _
|
|
2565
|
+
* @since 4.3.0
|
|
2566
|
+
* @category Lang
|
|
2567
|
+
* @param {*} value The value to check.
|
|
2568
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2569
|
+
* @example
|
|
2570
|
+
*
|
|
2571
|
+
* _.isSet(new Set);
|
|
2572
|
+
* // => true
|
|
2573
|
+
*
|
|
2574
|
+
* _.isSet(new WeakSet);
|
|
2575
|
+
* // => false
|
|
2576
|
+
*/
|
|
2577
|
+
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
2578
|
+
|
|
2579
|
+
/** `Object#toString` result references. */
|
|
2580
|
+
var argsTag = '[object Arguments]',
|
|
2581
|
+
arrayTag = '[object Array]',
|
|
2582
|
+
boolTag = '[object Boolean]',
|
|
2583
|
+
dateTag = '[object Date]',
|
|
2584
|
+
errorTag = '[object Error]',
|
|
2585
|
+
funcTag = '[object Function]',
|
|
2586
|
+
genTag = '[object GeneratorFunction]',
|
|
2587
|
+
mapTag = '[object Map]',
|
|
2588
|
+
numberTag = '[object Number]',
|
|
2589
|
+
objectTag = '[object Object]',
|
|
2590
|
+
regexpTag = '[object RegExp]',
|
|
2591
|
+
setTag = '[object Set]',
|
|
2592
|
+
stringTag = '[object String]',
|
|
2593
|
+
symbolTag = '[object Symbol]',
|
|
2594
|
+
weakMapTag = '[object WeakMap]';
|
|
2595
|
+
|
|
2596
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2597
|
+
dataViewTag = '[object DataView]',
|
|
2598
|
+
float32Tag = '[object Float32Array]',
|
|
2599
|
+
float64Tag = '[object Float64Array]',
|
|
2600
|
+
int8Tag = '[object Int8Array]',
|
|
2601
|
+
int16Tag = '[object Int16Array]',
|
|
2602
|
+
int32Tag = '[object Int32Array]',
|
|
2603
|
+
uint8Tag = '[object Uint8Array]',
|
|
2604
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2605
|
+
uint16Tag = '[object Uint16Array]',
|
|
2606
|
+
uint32Tag = '[object Uint32Array]';
|
|
2607
|
+
|
|
2608
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2609
|
+
var cloneableTags = {};
|
|
2610
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
2611
|
+
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
2612
|
+
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
2613
|
+
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
2614
|
+
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
2615
|
+
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
2616
|
+
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
2617
|
+
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
2618
|
+
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
2619
|
+
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
2620
|
+
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2621
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
2622
|
+
cloneableTags[weakMapTag] = false;
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2626
|
+
* traversed objects.
|
|
2627
|
+
*
|
|
2628
|
+
* @private
|
|
2629
|
+
* @param {*} value The value to clone.
|
|
2630
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2631
|
+
* 1 - Deep clone
|
|
2632
|
+
* 2 - Flatten inherited properties
|
|
2633
|
+
* 4 - Clone symbols
|
|
2634
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2635
|
+
* @param {string} [key] The key of `value`.
|
|
2636
|
+
* @param {Object} [object] The parent object of `value`.
|
|
2637
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2638
|
+
* @returns {*} Returns the cloned value.
|
|
2639
|
+
*/
|
|
2640
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2641
|
+
var result;
|
|
2642
|
+
|
|
2643
|
+
if (customizer) {
|
|
2644
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2645
|
+
}
|
|
2646
|
+
if (result !== undefined) {
|
|
2647
|
+
return result;
|
|
2648
|
+
}
|
|
2649
|
+
if (!isObject(value)) {
|
|
2650
|
+
return value;
|
|
2651
|
+
}
|
|
2652
|
+
var isArr = isArray(value);
|
|
2653
|
+
if (isArr) {
|
|
2654
|
+
result = initCloneArray(value);
|
|
2655
|
+
} else {
|
|
2656
|
+
var tag = getTag(value),
|
|
2657
|
+
isFunc = tag == funcTag || tag == genTag;
|
|
2658
|
+
|
|
2659
|
+
if (isBuffer(value)) {
|
|
2660
|
+
return cloneBuffer(value);
|
|
2661
|
+
}
|
|
2662
|
+
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
2663
|
+
result = {} ;
|
|
2664
|
+
} else {
|
|
2665
|
+
if (!cloneableTags[tag]) {
|
|
2666
|
+
return object ? value : {};
|
|
2667
|
+
}
|
|
2668
|
+
result = initCloneByTag(value, tag);
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
// Check for circular references and return its corresponding clone.
|
|
2672
|
+
stack || (stack = new Stack);
|
|
2673
|
+
var stacked = stack.get(value);
|
|
2674
|
+
if (stacked) {
|
|
2675
|
+
return stacked;
|
|
2676
|
+
}
|
|
2677
|
+
stack.set(value, result);
|
|
2678
|
+
|
|
2679
|
+
if (isSet(value)) {
|
|
2680
|
+
value.forEach(function(subValue) {
|
|
2681
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2682
|
+
});
|
|
2683
|
+
} else if (isMap(value)) {
|
|
2684
|
+
value.forEach(function(subValue, key) {
|
|
2685
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
var keysFunc = (getAllKeysIn )
|
|
2690
|
+
;
|
|
2691
|
+
|
|
2692
|
+
var props = isArr ? undefined : keysFunc(value);
|
|
2693
|
+
arrayEach(props || value, function(subValue, key) {
|
|
2694
|
+
if (props) {
|
|
2695
|
+
key = subValue;
|
|
2696
|
+
subValue = value[key];
|
|
2697
|
+
}
|
|
2698
|
+
// Recursively populate clone (susceptible to call stack limits).
|
|
2699
|
+
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2700
|
+
});
|
|
2701
|
+
return result;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
/**
|
|
2705
|
+
* Gets the last element of `array`.
|
|
2706
|
+
*
|
|
2707
|
+
* @static
|
|
2708
|
+
* @memberOf _
|
|
2709
|
+
* @since 0.1.0
|
|
2710
|
+
* @category Array
|
|
2711
|
+
* @param {Array} array The array to query.
|
|
2712
|
+
* @returns {*} Returns the last element of `array`.
|
|
2713
|
+
* @example
|
|
2714
|
+
*
|
|
2715
|
+
* _.last([1, 2, 3]);
|
|
2716
|
+
* // => 3
|
|
2717
|
+
*/
|
|
2718
|
+
function last(array) {
|
|
2719
|
+
var length = array == null ? 0 : array.length;
|
|
2720
|
+
return length ? array[length - 1] : undefined;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
/**
|
|
2724
|
+
* Gets the parent value at `path` of `object`.
|
|
2725
|
+
*
|
|
2726
|
+
* @private
|
|
2727
|
+
* @param {Object} object The object to query.
|
|
2728
|
+
* @param {Array} path The path to get the parent value of.
|
|
2729
|
+
* @returns {*} Returns the parent value.
|
|
2730
|
+
*/
|
|
2731
|
+
function parent(object, path) {
|
|
2732
|
+
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
/** Used for built-in method references. */
|
|
2736
|
+
var objectProto = Object.prototype;
|
|
2737
|
+
|
|
2738
|
+
/** Used to check objects for own properties. */
|
|
2739
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* The base implementation of `_.unset`.
|
|
2743
|
+
*
|
|
2744
|
+
* @private
|
|
2745
|
+
* @param {Object} object The object to modify.
|
|
2746
|
+
* @param {Array|string} path The property path to unset.
|
|
2747
|
+
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
2748
|
+
*/
|
|
2749
|
+
function baseUnset(object, path) {
|
|
2750
|
+
path = castPath(path, object);
|
|
2751
|
+
|
|
2752
|
+
// Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
|
|
2753
|
+
var index = -1,
|
|
2754
|
+
length = path.length;
|
|
2755
|
+
|
|
2756
|
+
if (!length) {
|
|
2757
|
+
return true;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
|
|
2761
|
+
|
|
2762
|
+
while (++index < length) {
|
|
2763
|
+
var key = path[index];
|
|
2764
|
+
|
|
2765
|
+
// skip non-string keys (e.g., Symbols, numbers)
|
|
2766
|
+
if (typeof key !== 'string') {
|
|
2767
|
+
continue;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
// Always block "__proto__" anywhere in the path if it's not expected
|
|
2771
|
+
if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
|
|
2772
|
+
return false;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
// Block "constructor.prototype" chains
|
|
2776
|
+
if (key === 'constructor' &&
|
|
2777
|
+
(index + 1) < length &&
|
|
2778
|
+
typeof path[index + 1] === 'string' &&
|
|
2779
|
+
path[index + 1] === 'prototype') {
|
|
2780
|
+
|
|
2781
|
+
// Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
|
|
2782
|
+
if (isRootPrimitive && index === 0) {
|
|
2783
|
+
continue;
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
return false;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
var obj = parent(object, path);
|
|
2791
|
+
return obj == null || delete obj[toKey(last(path))];
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
/**
|
|
2795
|
+
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
2796
|
+
* objects.
|
|
2797
|
+
*
|
|
2798
|
+
* @private
|
|
2799
|
+
* @param {*} value The value to inspect.
|
|
2800
|
+
* @param {string} key The key of the property to inspect.
|
|
2801
|
+
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
2802
|
+
*/
|
|
2803
|
+
function customOmitClone(value) {
|
|
2804
|
+
return isPlainObject(value) ? undefined : value;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
/** Used to compose bitmasks for cloning. */
|
|
2808
|
+
var CLONE_DEEP_FLAG = 1,
|
|
2809
|
+
CLONE_FLAT_FLAG = 2,
|
|
2810
|
+
CLONE_SYMBOLS_FLAG = 4;
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* The opposite of `_.pick`; this method creates an object composed of the
|
|
2814
|
+
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
2815
|
+
*
|
|
2816
|
+
* **Note:** This method is considerably slower than `_.pick`.
|
|
2817
|
+
*
|
|
2818
|
+
* @static
|
|
2819
|
+
* @since 0.1.0
|
|
2820
|
+
* @memberOf _
|
|
2821
|
+
* @category Object
|
|
2822
|
+
* @param {Object} object The source object.
|
|
2823
|
+
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
2824
|
+
* @returns {Object} Returns the new object.
|
|
2825
|
+
* @example
|
|
2826
|
+
*
|
|
2827
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
2828
|
+
*
|
|
2829
|
+
* _.omit(object, ['a', 'c']);
|
|
2830
|
+
* // => { 'b': '2' }
|
|
2831
|
+
*/
|
|
2832
|
+
var omit = flatRest(function(object, paths) {
|
|
2833
|
+
var result = {};
|
|
2834
|
+
if (object == null) {
|
|
2835
|
+
return result;
|
|
2836
|
+
}
|
|
2837
|
+
var isDeep = false;
|
|
2838
|
+
paths = arrayMap(paths, function(path) {
|
|
2839
|
+
path = castPath(path, object);
|
|
2840
|
+
isDeep || (isDeep = path.length > 1);
|
|
2841
|
+
return path;
|
|
2842
|
+
});
|
|
2843
|
+
copyObject(object, getAllKeysIn(object), result);
|
|
2844
|
+
if (isDeep) {
|
|
2845
|
+
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
|
2846
|
+
}
|
|
2847
|
+
var length = paths.length;
|
|
2848
|
+
while (length--) {
|
|
2849
|
+
baseUnset(result, paths[length]);
|
|
2850
|
+
}
|
|
2851
|
+
return result;
|
|
2852
|
+
});
|
|
2853
|
+
|
|
2854
|
+
const _sfc_main$5 = /*@__PURE__*/Object.assign({
|
|
2855
|
+
inheritAttrs: false,
|
|
2856
|
+
name: "EasyButton"
|
|
2857
|
+
}, {
|
|
2858
|
+
__name: 'button',
|
|
2859
|
+
setup(__props) {
|
|
2860
|
+
|
|
2861
|
+
|
|
2862
|
+
|
|
2863
|
+
const loading = vue.ref(false);
|
|
2864
|
+
|
|
2865
|
+
const attrs = vue.useAttrs();
|
|
2866
|
+
const onClick = async () => {
|
|
2867
|
+
try {
|
|
2868
|
+
loading.value = true;
|
|
2869
|
+
|
|
2870
|
+
if (isFunction$1(attrs.onClick)) {
|
|
2871
|
+
await attrs.onClick();
|
|
2872
|
+
}
|
|
2873
|
+
} finally {
|
|
2874
|
+
loading.value = false;
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
return (_ctx, _cache) => {
|
|
2879
|
+
return (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), vue.mergeProps({ loading: loading.value }, vue.unref(omit)(vue.unref(attrs), 'onClick'), { onClick: onClick }), {
|
|
2880
|
+
default: vue.withCtx(() => [
|
|
2881
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
2882
|
+
]),
|
|
2883
|
+
_: 3 /* FORWARDED */
|
|
2884
|
+
}, 16 /* FULL_PROPS */, ["loading"]))
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
});
|
|
2889
|
+
|
|
2890
|
+
// 用来整合组件的,最终实现导出组件
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
// 通过 withInstall 方法给 button 添加了一个 Vue3 插件所需的 install 方法
|
|
2894
|
+
const EasyButton = withInstall(_sfc_main$5);
|
|
2895
|
+
|
|
2896
|
+
function useDynamicComponent() {
|
|
2897
|
+
/**
|
|
2898
|
+
*
|
|
2899
|
+
* @param {string | number | Component | Function} type 组件名称
|
|
2900
|
+
* @param {Object} scope 作用域
|
|
2901
|
+
* @returns {Component}
|
|
2902
|
+
*/
|
|
2903
|
+
const getComponent = (type, scope) => {
|
|
2904
|
+
// 非 string / number,说明是组件对象或渲染函数
|
|
2905
|
+
if (type && !isString(type) && !isNumber(type)) {
|
|
2906
|
+
return isFunction$1(type) ? type(scope) : type
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
const componentKey = type;
|
|
2910
|
+
let dynamicComponent;
|
|
2911
|
+
|
|
2912
|
+
// 只解析 el- 前缀的组件
|
|
2913
|
+
if (isString(componentKey) && componentKey.startsWith("el-")) {
|
|
2914
|
+
dynamicComponent = vue.resolveComponent(componentKey);
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
// 成功解析到组件(resolveComponent 失败会返回字符串)
|
|
2918
|
+
if (dynamicComponent && !isString(dynamicComponent)) {
|
|
2919
|
+
return dynamicComponent
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
// fallback:文本组件
|
|
2923
|
+
return {
|
|
2924
|
+
name: "DynamicText",
|
|
2925
|
+
props: ["modelValue"],
|
|
2926
|
+
render() {
|
|
2927
|
+
if (!scope) {
|
|
2928
|
+
return vue.h("span", {}, componentKey)
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
// 否则是 value,判断是否为空(null 或空字符串)
|
|
2932
|
+
const isEmpty = this.modelValue === null || this.modelValue === "" || this.modelValue === undefined;
|
|
2933
|
+
const displayValue = isEmpty ? "--" : this.modelValue;
|
|
2934
|
+
return vue.h("span", {}, displayValue)
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
|
|
2939
|
+
return {
|
|
2940
|
+
getComponent
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
const _sfc_main$4 = /*@__PURE__*/Object.assign({
|
|
2945
|
+
name: "EasyDescriptionsComp"
|
|
2946
|
+
}, {
|
|
2947
|
+
__name: 'comp',
|
|
2948
|
+
props: /*@__PURE__*/vue.mergeModels({
|
|
2949
|
+
id: {
|
|
2950
|
+
type: String,
|
|
2951
|
+
default: ""
|
|
2952
|
+
},
|
|
2953
|
+
components: {
|
|
2954
|
+
type: [String, Number, Function, Object],
|
|
2955
|
+
default: ""
|
|
2956
|
+
},
|
|
2957
|
+
props: {
|
|
2958
|
+
type: Object,
|
|
2959
|
+
default: () => ({})
|
|
2960
|
+
}
|
|
2961
|
+
}, {
|
|
2962
|
+
"modelValue": {},
|
|
2963
|
+
"modelModifiers": {},
|
|
2964
|
+
}),
|
|
2965
|
+
emits: ["update:modelValue"],
|
|
2966
|
+
setup(__props) {
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
const descriptionsData = vue.useModel(__props, "modelValue");
|
|
2973
|
+
|
|
2974
|
+
const { getComponent } = useDynamicComponent();
|
|
2975
|
+
|
|
2976
|
+
return (_ctx, _cache) => {
|
|
2977
|
+
return vue.renderSlot(_ctx.$slots, __props.components, {}, () => [
|
|
2978
|
+
(__props.id)
|
|
2979
|
+
? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components, descriptionsData.value)), vue.mergeProps({
|
|
2980
|
+
key: 0,
|
|
2981
|
+
modelValue: descriptionsData.value[__props.id],
|
|
2982
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((descriptionsData.value[__props.id]) = $event))
|
|
2983
|
+
}, __props.props), null, 16 /* FULL_PROPS */, ["modelValue"]))
|
|
2984
|
+
: (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components)), vue.normalizeProps(vue.mergeProps({ key: 1 }, __props.props)), null, 16 /* FULL_PROPS */))
|
|
2985
|
+
])
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
});
|
|
2990
|
+
|
|
2991
|
+
const _hoisted_1$3 = { class: "epl-descriptions" };
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
const _sfc_main$3 = /*@__PURE__*/Object.assign({
|
|
2995
|
+
name: "EasyDescriptions"
|
|
2996
|
+
}, {
|
|
2997
|
+
__name: 'descriptions',
|
|
2998
|
+
props: /*@__PURE__*/vue.mergeModels({
|
|
2999
|
+
items: {
|
|
3000
|
+
type: Array,
|
|
3001
|
+
default: () => []
|
|
3002
|
+
}
|
|
3003
|
+
}, {
|
|
3004
|
+
"modelValue": {},
|
|
3005
|
+
"modelModifiers": {},
|
|
3006
|
+
}),
|
|
3007
|
+
emits: ["update:modelValue"],
|
|
3008
|
+
setup(__props, { expose: __expose }) {
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
const props = __props;
|
|
3013
|
+
|
|
3014
|
+
const descriptionsData = vue.useModel(__props, "modelValue");
|
|
3015
|
+
|
|
3016
|
+
// 内部处理单个列表的函数
|
|
3017
|
+
const normalizeItems = list => {
|
|
3018
|
+
return list.reduce((prev, item) => {
|
|
3019
|
+
const isHidden = isFunction$1(item.hidden) ? item.hidden(descriptionsData.value) : item.hidden;
|
|
3020
|
+
|
|
3021
|
+
if (isHidden) return prev
|
|
3022
|
+
|
|
3023
|
+
prev.push({
|
|
3024
|
+
...item,
|
|
3025
|
+
label: isObject$1(item.label)
|
|
3026
|
+
? item.label
|
|
3027
|
+
: {
|
|
3028
|
+
components: item.label
|
|
3029
|
+
},
|
|
3030
|
+
value: isObject$1(item.value)
|
|
3031
|
+
? item.value
|
|
3032
|
+
: {
|
|
3033
|
+
id: item.value,
|
|
3034
|
+
components: item.value
|
|
3035
|
+
}
|
|
3036
|
+
});
|
|
3037
|
+
|
|
3038
|
+
return prev
|
|
3039
|
+
}, [])
|
|
3040
|
+
};
|
|
3041
|
+
|
|
3042
|
+
const renderList = vue.computed(() => {
|
|
3043
|
+
if (!props.items || props.items.length === 0) return []
|
|
3044
|
+
|
|
3045
|
+
// 判断是否为分组模式:第一项包含 items 字段且是一个数组
|
|
3046
|
+
// 为了兼容性更好,这里假设如果 item 内部有 items 属性,则认为是分组
|
|
3047
|
+
const isGroup = props.items.some(item => item.items && Array.isArray(item.items));
|
|
3048
|
+
|
|
3049
|
+
if (isGroup) {
|
|
3050
|
+
// 分组模式
|
|
3051
|
+
return props.items
|
|
3052
|
+
.filter(group => {
|
|
3053
|
+
const isHidden = isFunction$1(group.hidden) ? group.hidden(descriptionsData.value) : group.hidden;
|
|
3054
|
+
return !isHidden
|
|
3055
|
+
})
|
|
3056
|
+
.map(group => {
|
|
3057
|
+
// 分离出内部使用的属性,其他的属性放入 bindProps 透传给 el-descriptions
|
|
3058
|
+
// eslint-disable-next-line no-unused-vars
|
|
3059
|
+
const { extra, items, hidden, ...rest } = group;
|
|
3060
|
+
return {
|
|
3061
|
+
...group,
|
|
3062
|
+
rows: normalizeItems(group.items),
|
|
3063
|
+
bindProps: rest
|
|
3064
|
+
}
|
|
3065
|
+
})
|
|
3066
|
+
} else {
|
|
3067
|
+
// 单组模式:包装成一个默认分组
|
|
3068
|
+
return [
|
|
3069
|
+
{
|
|
3070
|
+
rows: normalizeItems(props.items),
|
|
3071
|
+
bindProps: {}
|
|
3072
|
+
}
|
|
3073
|
+
]
|
|
3074
|
+
}
|
|
3075
|
+
});
|
|
3076
|
+
|
|
3077
|
+
__expose({});
|
|
3078
|
+
|
|
3079
|
+
return (_ctx, _cache) => {
|
|
3080
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
3081
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(renderList.value, (group, index) => {
|
|
3082
|
+
return (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDescriptions), vue.mergeProps({
|
|
3083
|
+
key: index,
|
|
3084
|
+
ref_for: true
|
|
3085
|
+
}, { ..._ctx.$attrs, ...group.bindProps }, { style: {"margin-bottom":"20px"} }), vue.createSlots({
|
|
3086
|
+
default: vue.withCtx(() => [
|
|
3087
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.rows, (item) => {
|
|
3088
|
+
return (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDescriptionsItem), vue.mergeProps({
|
|
3089
|
+
key: item.label
|
|
3090
|
+
}, { ref_for: true }, item), {
|
|
3091
|
+
label: vue.withCtx(() => [
|
|
3092
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(
|
|
3093
|
+
vue.h(
|
|
3094
|
+
_sfc_main$4,
|
|
3095
|
+
{
|
|
3096
|
+
modelValue: descriptionsData.value,
|
|
3097
|
+
...item.label
|
|
3098
|
+
},
|
|
3099
|
+
_ctx.$slots
|
|
3100
|
+
)
|
|
3101
|
+
)))
|
|
3102
|
+
]),
|
|
3103
|
+
default: vue.withCtx(() => [
|
|
3104
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(
|
|
3105
|
+
vue.h(
|
|
3106
|
+
_sfc_main$4,
|
|
3107
|
+
{
|
|
3108
|
+
modelValue: descriptionsData.value,
|
|
3109
|
+
...item.value
|
|
3110
|
+
},
|
|
3111
|
+
_ctx.$slots
|
|
3112
|
+
)
|
|
3113
|
+
)))
|
|
3114
|
+
]),
|
|
3115
|
+
_: 2 /* DYNAMIC */
|
|
3116
|
+
}, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
|
|
3117
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
3118
|
+
]),
|
|
3119
|
+
_: 2 /* DYNAMIC */
|
|
3120
|
+
}, [
|
|
3121
|
+
(group.title || _ctx.$slots.title)
|
|
3122
|
+
? {
|
|
3123
|
+
name: "title",
|
|
3124
|
+
fn: vue.withCtx(() => [
|
|
3125
|
+
(group.title)
|
|
3126
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
3127
|
+
vue.createTextVNode(vue.toDisplayString(group.title), 1 /* TEXT */)
|
|
3128
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3129
|
+
: vue.renderSlot(_ctx.$slots, "title", {
|
|
3130
|
+
key: 1,
|
|
3131
|
+
group: group,
|
|
3132
|
+
index: index
|
|
3133
|
+
})
|
|
3134
|
+
]),
|
|
3135
|
+
key: "0"
|
|
3136
|
+
}
|
|
3137
|
+
: undefined,
|
|
3138
|
+
(group.extra || _ctx.$slots.extra)
|
|
3139
|
+
? {
|
|
3140
|
+
name: "extra",
|
|
3141
|
+
fn: vue.withCtx(() => [
|
|
3142
|
+
(group.extra)
|
|
3143
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
3144
|
+
vue.createTextVNode(vue.toDisplayString(group.extra), 1 /* TEXT */)
|
|
3145
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3146
|
+
: vue.renderSlot(_ctx.$slots, "extra", {
|
|
3147
|
+
key: 1,
|
|
3148
|
+
group: group,
|
|
3149
|
+
index: index
|
|
3150
|
+
})
|
|
3151
|
+
]),
|
|
3152
|
+
key: "1"
|
|
3153
|
+
}
|
|
3154
|
+
: undefined
|
|
3155
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
|
|
3156
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
3157
|
+
]))
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
});
|
|
3162
|
+
|
|
3163
|
+
// 用来整合组件的,最终实现导出组件
|
|
3164
|
+
|
|
3165
|
+
|
|
3166
|
+
// 通过 withInstall 方法给 button 添加了一个 Vue3 插件所需的 install 方法
|
|
3167
|
+
const EasyDescriptions = withInstall(_sfc_main$3);
|
|
3168
|
+
|
|
3169
|
+
Math.easeInOutQuad = function (t, b, c, d) {
|
|
3170
|
+
t /= d / 2;
|
|
3171
|
+
if (t < 1) {
|
|
3172
|
+
return (c / 2) * t * t + b
|
|
3173
|
+
}
|
|
3174
|
+
t--;
|
|
3175
|
+
return (-c / 2) * (t * (t - 2) - 1) + b
|
|
3176
|
+
};
|
|
3177
|
+
|
|
3178
|
+
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
|
3179
|
+
var requestAnimFrame = (function () {
|
|
3180
|
+
if (typeof window === "undefined") {
|
|
3181
|
+
return function (callback) {
|
|
3182
|
+
setTimeout(callback, 1000 / 60);
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
return (
|
|
3186
|
+
window.requestAnimationFrame ||
|
|
3187
|
+
window.webkitRequestAnimationFrame ||
|
|
3188
|
+
window.mozRequestAnimationFrame ||
|
|
3189
|
+
function (callback) {
|
|
3190
|
+
window.setTimeout(callback, 1000 / 60);
|
|
3191
|
+
}
|
|
3192
|
+
)
|
|
3193
|
+
})();
|
|
3194
|
+
|
|
3195
|
+
/**
|
|
3196
|
+
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
|
3197
|
+
* @param {number} amount
|
|
3198
|
+
*/
|
|
3199
|
+
function move(amount) {
|
|
3200
|
+
document.documentElement.scrollTop = amount;
|
|
3201
|
+
document.body.parentNode.scrollTop = amount;
|
|
3202
|
+
document.body.scrollTop = amount;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
function position() {
|
|
3206
|
+
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
/**
|
|
3210
|
+
* @param {number} to
|
|
3211
|
+
* @param {number} duration
|
|
3212
|
+
* @param {Function} callback
|
|
3213
|
+
*/
|
|
3214
|
+
function scrollTo(to, duration, callback) {
|
|
3215
|
+
const start = position();
|
|
3216
|
+
const change = to - start;
|
|
3217
|
+
const increment = 20;
|
|
3218
|
+
let currentTime = 0;
|
|
3219
|
+
duration = isUndefined(duration) ? 500 : duration;
|
|
3220
|
+
var animateScroll = function () {
|
|
3221
|
+
// increment the time
|
|
3222
|
+
currentTime += increment;
|
|
3223
|
+
// find the value with the quadratic in-out easing function
|
|
3224
|
+
var val = Math.easeInOutQuad(currentTime, start, change, duration);
|
|
3225
|
+
// move the document.body
|
|
3226
|
+
move(val);
|
|
3227
|
+
// do the animation unless its over
|
|
3228
|
+
if (currentTime < duration) {
|
|
3229
|
+
requestAnimFrame(animateScroll);
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
animateScroll();
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
function styleInject(css, ref) {
|
|
3236
|
+
if ( ref === void 0 ) ref = {};
|
|
3237
|
+
var insertAt = ref.insertAt;
|
|
3238
|
+
|
|
3239
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
3240
|
+
|
|
3241
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
3242
|
+
var style = document.createElement('style');
|
|
3243
|
+
style.type = 'text/css';
|
|
3244
|
+
|
|
3245
|
+
if (insertAt === 'top') {
|
|
3246
|
+
if (head.firstChild) {
|
|
3247
|
+
head.insertBefore(style, head.firstChild);
|
|
3248
|
+
} else {
|
|
3249
|
+
head.appendChild(style);
|
|
3250
|
+
}
|
|
3251
|
+
} else {
|
|
3252
|
+
head.appendChild(style);
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
if (style.styleSheet) {
|
|
3256
|
+
style.styleSheet.cssText = css;
|
|
3257
|
+
} else {
|
|
3258
|
+
style.appendChild(document.createTextNode(css));
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
var css_248z$2 = ".table-container[data-v-d1947650] {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 400px;\n}\n.table-container .table[data-v-d1947650] {\n flex: 1;\n position: relative;\n}\n.table-container .table [data-v-d1947650] .el-table {\n position: absolute;\n height: 100%;\n}\n\n.pagination-container[data-v-d1947650] {\n padding: 16px 0;\n display: flex;\n}\n\n.operate-group[data-v-d1947650] {\n display: flex;\n align-items: center;\n}\n.operate-group .el-button + .el-button[data-v-d1947650],\n.operate-group .el-button + .custom-dropdown[data-v-d1947650] {\n margin-left: 16px;\n position: relative;\n}\n.operate-group .el-button + .el-button[data-v-d1947650]::before,\n.operate-group .el-button + .custom-dropdown[data-v-d1947650]::before {\n content: \"\";\n position: absolute;\n left: -8px;\n top: 50%;\n transform: translateY(-50%);\n width: 1px;\n height: 12px;\n background-color: #dcdfe6;\n}\n.operate-group [data-v-d1947650] .custom-text {\n color: #606266;\n padding: 0;\n}\n.operate-group [data-v-d1947650] .custom-text:hover {\n color: #409eff;\n}";
|
|
3263
|
+
styleInject(css_248z$2);
|
|
3264
|
+
|
|
3265
|
+
var _export_sfc = (sfc, props) => {
|
|
3266
|
+
const target = sfc.__vccOpts || sfc;
|
|
3267
|
+
for (const [key, val] of props) {
|
|
3268
|
+
target[key] = val;
|
|
3269
|
+
}
|
|
3270
|
+
return target;
|
|
3271
|
+
};
|
|
3272
|
+
|
|
3273
|
+
const _hoisted_1$2 = { class: "table-container" };
|
|
3274
|
+
const _hoisted_2$2 = { class: "table" };
|
|
3275
|
+
const _hoisted_3$2 = { key: 0 };
|
|
3276
|
+
const _hoisted_4$2 = ["innerHTML"];
|
|
3277
|
+
const _hoisted_5$2 = ["innerHTML"];
|
|
3278
|
+
const _hoisted_6 = { class: "operate-group" };
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
const _sfc_main$2 = /*@__PURE__*/Object.assign({ name: "EasyTable" }, {
|
|
3282
|
+
__name: 'table',
|
|
3283
|
+
props: {
|
|
3284
|
+
columns: { type: Array, default: () => [] },
|
|
3285
|
+
tableData: { type: Array, default: () => [] },
|
|
3286
|
+
total: { type: Number, default: 0 },
|
|
3287
|
+
page: { type: Number, default: 1 },
|
|
3288
|
+
options: {
|
|
3289
|
+
type: Object,
|
|
3290
|
+
default: () => ({ stripe: false, highlightCurrentRow: false, border: true })
|
|
3291
|
+
},
|
|
3292
|
+
limit: { type: Number, default: 20 },
|
|
3293
|
+
pageSizes: { type: Array, default: () => [10, 20, 30, 50] },
|
|
3294
|
+
pagerCount: {
|
|
3295
|
+
type: Number,
|
|
3296
|
+
default: () => (typeof document !== "undefined" && document.body.clientWidth < 992 ? 5 : 7)
|
|
3297
|
+
},
|
|
3298
|
+
layout: { type: String, default: "total, sizes, prev, pager, next, jumper" },
|
|
3299
|
+
background: { type: Boolean, default: true },
|
|
3300
|
+
autoScroll: { type: Boolean, default: true },
|
|
3301
|
+
hidden: { type: Boolean, default: false },
|
|
3302
|
+
operates: { type: Object, default: () => ({ list: [] }) },
|
|
3303
|
+
paginationPosition: { type: String, default: "right" }
|
|
3304
|
+
},
|
|
3305
|
+
emits: ["update:page", "update:limit", "pagination", "sortChange", "handleSelectionChange"],
|
|
3306
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
const props = __props;
|
|
3311
|
+
|
|
3312
|
+
const emit = __emit;
|
|
3313
|
+
|
|
3314
|
+
const slots = vue.useSlots();
|
|
3315
|
+
const iTableRef = vue.ref(null);
|
|
3316
|
+
const processedHeaders = vue.ref([]);
|
|
3317
|
+
|
|
3318
|
+
/** 1. 逻辑优化:使用 watch 监听 columns 变化,避免在 onBeforeUpdate 中过度计算 **/
|
|
3319
|
+
vue.watch(
|
|
3320
|
+
() => [props.columns, slots],
|
|
3321
|
+
() => {
|
|
3322
|
+
processedHeaders.value = props.columns.map(column => {
|
|
3323
|
+
const col = { ...column };
|
|
3324
|
+
if (!col.key) col.key = col.prop;
|
|
3325
|
+
|
|
3326
|
+
// 匹配插槽逻辑保持不变
|
|
3327
|
+
Object.keys(slots).forEach(key => {
|
|
3328
|
+
const res = key.match(/^(\S+)-(\S+)/);
|
|
3329
|
+
|
|
3330
|
+
if (res && res[2] === col.key) {
|
|
3331
|
+
col.slot = { ...col.slot, [res[1]]: res[0] };
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3334
|
+
|
|
3335
|
+
return col
|
|
3336
|
+
});
|
|
3337
|
+
},
|
|
3338
|
+
{ immediate: true, deep: true }
|
|
3339
|
+
);
|
|
3340
|
+
|
|
3341
|
+
/** 2. 工具函数 **/
|
|
3342
|
+
|
|
3343
|
+
// 计算表头宽度
|
|
3344
|
+
const headSpanFit = column => {
|
|
3345
|
+
const labelLen = column?.label?.length || 0;
|
|
3346
|
+
return Math.max(labelLen * 20, 100)
|
|
3347
|
+
};
|
|
3348
|
+
|
|
3349
|
+
// 判断列是否显示
|
|
3350
|
+
const isColumnVisible = column => {
|
|
3351
|
+
if (isFunction$1(column.show)) return column.show()
|
|
3352
|
+
return column.show !== false
|
|
3353
|
+
};
|
|
3354
|
+
|
|
3355
|
+
// 获取渲染内容
|
|
3356
|
+
const getRenderContent = (column, scope) => {
|
|
3357
|
+
return isFunction$1(column.render) ? column.render(scope) : column.render
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3360
|
+
// 获取可见按钮
|
|
3361
|
+
const getVisibleButtons = row => {
|
|
3362
|
+
const list = (props.operates?.list || []).filter(item => {
|
|
3363
|
+
return isFunction$1(item.show) ? item.show(row) : item.show !== false
|
|
3364
|
+
});
|
|
3365
|
+
return list.length > 3
|
|
3366
|
+
? {
|
|
3367
|
+
outside: list.slice(0, 2),
|
|
3368
|
+
inside: list.slice(2)
|
|
3369
|
+
}
|
|
3370
|
+
: {
|
|
3371
|
+
outside: list,
|
|
3372
|
+
inside: []
|
|
3373
|
+
}
|
|
3374
|
+
};
|
|
3375
|
+
|
|
3376
|
+
/** 3. 分页计算属性 **/
|
|
3377
|
+
// 当前页码
|
|
3378
|
+
const currentPage = vue.computed({
|
|
3379
|
+
get: () => props.page,
|
|
3380
|
+
set: val => emit("update:page", val)
|
|
3381
|
+
});
|
|
3382
|
+
|
|
3383
|
+
// 每页条数
|
|
3384
|
+
const pageSize = vue.computed({
|
|
3385
|
+
get: () => props.limit,
|
|
3386
|
+
set: val => emit("update:limit", val)
|
|
3387
|
+
});
|
|
3388
|
+
|
|
3389
|
+
// 分页对齐方式
|
|
3390
|
+
const paginationJustify = vue.computed(() => {
|
|
3391
|
+
const map = { left: "flex-start", center: "center", right: "flex-end" };
|
|
3392
|
+
return map[props.paginationPosition] || "flex-end"
|
|
3393
|
+
});
|
|
3394
|
+
|
|
3395
|
+
/** 4. 事件处理 **/
|
|
3396
|
+
// 改变每页条数
|
|
3397
|
+
const handleSizeChange = val => {
|
|
3398
|
+
if (currentPage.value * val > props.total) currentPage.value = 1;
|
|
3399
|
+
emit("pagination", { page: currentPage.value, limit: val });
|
|
3400
|
+
if (props.autoScroll) scrollTo(0, 800);
|
|
3401
|
+
};
|
|
3402
|
+
|
|
3403
|
+
// 改变当前页
|
|
3404
|
+
const handleCurrentChange = val => {
|
|
3405
|
+
emit("pagination", { page: val, limit: pageSize.value });
|
|
3406
|
+
if (props.autoScroll) scrollTo(0, 800);
|
|
3407
|
+
};
|
|
3408
|
+
|
|
3409
|
+
// 改变排序
|
|
3410
|
+
const sortChange = args => emit("sortChange", args);
|
|
3411
|
+
|
|
3412
|
+
// 改变选择
|
|
3413
|
+
const handleSelectionChange = val => emit("handleSelectionChange", val);
|
|
3414
|
+
|
|
3415
|
+
__expose({ iTableRef });
|
|
3416
|
+
|
|
3417
|
+
return (_ctx, _cache) => {
|
|
3418
|
+
const _component_el_table_column = vue.resolveComponent("el-table-column");
|
|
3419
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
3420
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
3421
|
+
const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
|
|
3422
|
+
const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
|
|
3423
|
+
const _component_el_dropdown = vue.resolveComponent("el-dropdown");
|
|
3424
|
+
const _component_el_table = vue.resolveComponent("el-table");
|
|
3425
|
+
const _component_el_pagination = vue.resolveComponent("el-pagination");
|
|
3426
|
+
|
|
3427
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
3428
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
3429
|
+
vue.createVNode(_component_el_table, vue.mergeProps({
|
|
3430
|
+
id: "iTable",
|
|
3431
|
+
ref_key: "iTableRef",
|
|
3432
|
+
ref: iTableRef,
|
|
3433
|
+
data: __props.tableData
|
|
3434
|
+
}, __props.options, {
|
|
3435
|
+
height: "100%",
|
|
3436
|
+
style: {"width":"100%"},
|
|
3437
|
+
onSortChange: sortChange,
|
|
3438
|
+
onSelectionChange: handleSelectionChange
|
|
3439
|
+
}), {
|
|
3440
|
+
default: vue.withCtx(() => [
|
|
3441
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(processedHeaders.value, (column, index) => {
|
|
3442
|
+
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
3443
|
+
key: index + (column.prop || '')
|
|
3444
|
+
}, [
|
|
3445
|
+
(isColumnVisible(column))
|
|
3446
|
+
? (vue.openBlock(), vue.createBlock(_component_el_table_column, vue.mergeProps({
|
|
3447
|
+
key: 0,
|
|
3448
|
+
"min-width": headSpanFit(column)
|
|
3449
|
+
}, { ref_for: true }, column), vue.createSlots({ _: 2 /* DYNAMIC */ }, [
|
|
3450
|
+
vue.renderList(column.slot, (value, key) => {
|
|
3451
|
+
return {
|
|
3452
|
+
name: key,
|
|
3453
|
+
fn: vue.withCtx((scope) => [
|
|
3454
|
+
vue.renderSlot(_ctx.$slots, value, vue.mergeProps({ ref_for: true }, scope), undefined, true)
|
|
3455
|
+
])
|
|
3456
|
+
}
|
|
3457
|
+
}),
|
|
3458
|
+
(!column.slot)
|
|
3459
|
+
? {
|
|
3460
|
+
name: "default",
|
|
3461
|
+
fn: vue.withCtx((scope) => [
|
|
3462
|
+
vue.createCommentVNode(" 渲染render "),
|
|
3463
|
+
(column.render)
|
|
3464
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
3465
|
+
vue.createCommentVNode(" 如果render返回的是字符串 "),
|
|
3466
|
+
(vue.unref(isString)(getRenderContent(column, scope)))
|
|
3467
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
|
|
3468
|
+
vue.createElementVNode("div", {
|
|
3469
|
+
innerHTML: getRenderContent(column, scope)
|
|
3470
|
+
}, null, 8 /* PROPS */, _hoisted_4$2)
|
|
3471
|
+
]))
|
|
3472
|
+
: (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
3473
|
+
vue.createCommentVNode(" 如果render返回的是组件 "),
|
|
3474
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(column.render), vue.mergeProps({ ref_for: true }, scope, {
|
|
3475
|
+
row: scope.row,
|
|
3476
|
+
index: scope.$index
|
|
3477
|
+
}), null, 16 /* FULL_PROPS */, ["row", "index"]))
|
|
3478
|
+
], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))
|
|
3479
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3480
|
+
: (column.formatter)
|
|
3481
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
3482
|
+
vue.createCommentVNode(" 渲染formatter "),
|
|
3483
|
+
vue.createElementVNode("span", {
|
|
3484
|
+
innerHTML: column.formatter(scope.row, column)
|
|
3485
|
+
}, null, 8 /* PROPS */, _hoisted_5$2)
|
|
3486
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3487
|
+
: (!column.type)
|
|
3488
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
3489
|
+
vue.createCommentVNode(" 渲染默认内容 "),
|
|
3490
|
+
vue.createElementVNode("span", null, vue.toDisplayString(scope.row[column.prop] ?? "--"), 1 /* TEXT */)
|
|
3491
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3492
|
+
: vue.createCommentVNode("v-if", true)
|
|
3493
|
+
]),
|
|
3494
|
+
key: "0"
|
|
3495
|
+
}
|
|
3496
|
+
: undefined
|
|
3497
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["min-width"]))
|
|
3498
|
+
: vue.createCommentVNode("v-if", true)
|
|
3499
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3500
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
3501
|
+
vue.createCommentVNode(" 操作列 "),
|
|
3502
|
+
(__props.operates.list?.length)
|
|
3503
|
+
? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
|
|
3504
|
+
key: 0,
|
|
3505
|
+
label: "操作",
|
|
3506
|
+
align: "left",
|
|
3507
|
+
width: __props.operates.width,
|
|
3508
|
+
fixed: __props.operates.fixed
|
|
3509
|
+
}, {
|
|
3510
|
+
default: vue.withCtx((scope) => [
|
|
3511
|
+
vue.createElementVNode("div", _hoisted_6, [
|
|
3512
|
+
vue.createCommentVNode(" 渲染外部按钮 "),
|
|
3513
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getVisibleButtons(scope.row).outside, (item, idx) => {
|
|
3514
|
+
return (vue.openBlock(), vue.createBlock(_component_el_button, vue.mergeProps({
|
|
3515
|
+
key: idx,
|
|
3516
|
+
ref_for: true
|
|
3517
|
+
}, item, {
|
|
3518
|
+
type: item.type || 'primary',
|
|
3519
|
+
size: item.size || 'small',
|
|
3520
|
+
onClick: vue.withModifiers($event => (item.method(scope.row, scope.$index)), ["stop"])
|
|
3521
|
+
}), {
|
|
3522
|
+
default: vue.withCtx(() => [
|
|
3523
|
+
vue.createTextVNode(vue.toDisplayString(item.label) + " ", 1 /* TEXT */),
|
|
3524
|
+
(item.icon)
|
|
3525
|
+
? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
3526
|
+
key: 0,
|
|
3527
|
+
class: "el-icon--right"
|
|
3528
|
+
}, {
|
|
3529
|
+
default: vue.withCtx(() => [
|
|
3530
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.icon)))
|
|
3531
|
+
]),
|
|
3532
|
+
_: 2 /* DYNAMIC */
|
|
3533
|
+
}, 1024 /* DYNAMIC_SLOTS */))
|
|
3534
|
+
: vue.createCommentVNode("v-if", true)
|
|
3535
|
+
]),
|
|
3536
|
+
_: 2 /* DYNAMIC */
|
|
3537
|
+
}, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["type", "size", "onClick"]))
|
|
3538
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
3539
|
+
vue.createCommentVNode(" 渲染下拉按钮 "),
|
|
3540
|
+
(getVisibleButtons(scope.row).inside.length)
|
|
3541
|
+
? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
|
|
3542
|
+
key: 0,
|
|
3543
|
+
class: "custom-dropdown",
|
|
3544
|
+
trigger: "click"
|
|
3545
|
+
}, {
|
|
3546
|
+
dropdown: vue.withCtx(() => [
|
|
3547
|
+
vue.createVNode(_component_el_dropdown_menu, null, {
|
|
3548
|
+
default: vue.withCtx(() => [
|
|
3549
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getVisibleButtons(scope.row).inside, (item, idx) => {
|
|
3550
|
+
return (vue.openBlock(), vue.createBlock(_component_el_dropdown_item, vue.mergeProps({ key: idx }, { ref_for: true }, item, {
|
|
3551
|
+
onClick: $event => (item.method(scope.row, scope.$index))
|
|
3552
|
+
}), {
|
|
3553
|
+
default: vue.withCtx(() => [
|
|
3554
|
+
vue.createTextVNode(vue.toDisplayString(item.label), 1 /* TEXT */)
|
|
3555
|
+
]),
|
|
3556
|
+
_: 2 /* DYNAMIC */
|
|
3557
|
+
}, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["onClick"]))
|
|
3558
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
3559
|
+
]),
|
|
3560
|
+
_: 2 /* DYNAMIC */
|
|
3561
|
+
}, 1024 /* DYNAMIC_SLOTS */)
|
|
3562
|
+
]),
|
|
3563
|
+
default: vue.withCtx(() => [
|
|
3564
|
+
vue.createVNode(_component_el_button, {
|
|
3565
|
+
link: "",
|
|
3566
|
+
size: "small",
|
|
3567
|
+
class: "custom-text"
|
|
3568
|
+
}, {
|
|
3569
|
+
default: vue.withCtx(() => [
|
|
3570
|
+
vue.createVNode(_component_el_icon, { size: 18 }, {
|
|
3571
|
+
default: vue.withCtx(() => [
|
|
3572
|
+
vue.createVNode(vue.unref(iconsVue.MoreFilled))
|
|
3573
|
+
]),
|
|
3574
|
+
_: 1 /* STABLE */
|
|
3575
|
+
})
|
|
3576
|
+
]),
|
|
3577
|
+
_: 1 /* STABLE */
|
|
3578
|
+
})
|
|
3579
|
+
]),
|
|
3580
|
+
_: 2 /* DYNAMIC */
|
|
3581
|
+
}, 1024 /* DYNAMIC_SLOTS */))
|
|
3582
|
+
: vue.createCommentVNode("v-if", true)
|
|
3583
|
+
])
|
|
3584
|
+
]),
|
|
3585
|
+
_: 1 /* STABLE */
|
|
3586
|
+
}, 8 /* PROPS */, ["width", "fixed"]))
|
|
3587
|
+
: vue.createCommentVNode("v-if", true)
|
|
3588
|
+
]),
|
|
3589
|
+
_: 3 /* FORWARDED */
|
|
3590
|
+
}, 16 /* FULL_PROPS */, ["data"])
|
|
3591
|
+
]),
|
|
3592
|
+
vue.createCommentVNode(" 分页 "),
|
|
3593
|
+
(!__props.hidden)
|
|
3594
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3595
|
+
key: 0,
|
|
3596
|
+
class: "pagination-container",
|
|
3597
|
+
style: vue.normalizeStyle({ justifyContent: paginationJustify.value })
|
|
3598
|
+
}, [
|
|
3599
|
+
vue.createVNode(_component_el_pagination, {
|
|
3600
|
+
"current-page": currentPage.value,
|
|
3601
|
+
"onUpdate:currentPage": _cache[0] || (_cache[0] = $event => ((currentPage).value = $event)),
|
|
3602
|
+
"page-size": pageSize.value,
|
|
3603
|
+
"onUpdate:pageSize": _cache[1] || (_cache[1] = $event => ((pageSize).value = $event)),
|
|
3604
|
+
background: __props.background,
|
|
3605
|
+
layout: __props.layout,
|
|
3606
|
+
"page-sizes": __props.pageSizes,
|
|
3607
|
+
"pager-count": __props.pagerCount,
|
|
3608
|
+
total: __props.total,
|
|
3609
|
+
onSizeChange: handleSizeChange,
|
|
3610
|
+
onCurrentChange: handleCurrentChange
|
|
3611
|
+
}, null, 8 /* PROPS */, ["current-page", "page-size", "background", "layout", "page-sizes", "pager-count", "total"])
|
|
3612
|
+
], 4 /* STYLE */))
|
|
3613
|
+
: vue.createCommentVNode("v-if", true)
|
|
3614
|
+
]))
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
});
|
|
3619
|
+
var table = /*#__PURE__*/_export_sfc(_sfc_main$2, [['__scopeId',"data-v-d1947650"]]);
|
|
3620
|
+
|
|
3621
|
+
// 用来整合组件的,最终实现导出组件
|
|
3622
|
+
|
|
3623
|
+
|
|
3624
|
+
// 通过 withInstall 方法给 button 添加了一个 Vue3 插件所需的 install 方法
|
|
3625
|
+
const EasyTable = withInstall(table);
|
|
3626
|
+
|
|
3627
|
+
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
3628
|
+
|
|
3629
|
+
var css_248z$1 = "\n/* 保持原有样式 */\n.component-upload-image[data-v-9ac7dd1b] .el-upload--picture-card {\n width: 100px;\n height: 100px;\n line-height: 110px;\n}\n.component-upload-image[data-v-9ac7dd1b] .el-upload-list--picture-card .el-upload-list__item {\n width: 100px;\n height: 100px;\n}\n.component-upload-image[data-v-9ac7dd1b] .hide .el-upload--picture-card {\n display: none;\n}\n";
|
|
3630
|
+
styleInject(css_248z$1);
|
|
3631
|
+
|
|
3632
|
+
const _hoisted_1$1 = { class: "component-upload-image" };
|
|
3633
|
+
const _hoisted_2$1 = {
|
|
3634
|
+
key: 0,
|
|
3635
|
+
class: "el-upload__tip"
|
|
3636
|
+
};
|
|
3637
|
+
const _hoisted_3$1 = { style: {"color":"#f56c6c"} };
|
|
3638
|
+
const _hoisted_4$1 = { style: {"color":"#f56c6c"} };
|
|
3639
|
+
const _hoisted_5$1 = ["src"];
|
|
3640
|
+
|
|
3641
|
+
|
|
3642
|
+
const _sfc_main$1 = /*@__PURE__*/Object.assign({ name: "EasyImageUpload" }, {
|
|
3643
|
+
__name: 'ImageUpload',
|
|
3644
|
+
props: {
|
|
3645
|
+
modelValue: [String, Object, Array],
|
|
3646
|
+
limit: { type: Number, default: 5 },
|
|
3647
|
+
fileSize: { type: Number, default: 5 },
|
|
3648
|
+
fileType: { type: Array, default: () => ["png", "jpg", "jpeg"] },
|
|
3649
|
+
isShowTip: { type: Boolean, default: true },
|
|
3650
|
+
action: { type: String, required: true },
|
|
3651
|
+
headers: { type: Object, default: () => ({}) },
|
|
3652
|
+
baseUrl: { type: String, default: "" },
|
|
3653
|
+
|
|
3654
|
+
checkSuccess: {
|
|
3655
|
+
type: Function,
|
|
3656
|
+
default: res => res.code === 200 || res.success === true
|
|
3657
|
+
},
|
|
3658
|
+
// 自定义提取图片地址的路径,支持 "data.url" 这种深层嵌套
|
|
3659
|
+
responsePath: {
|
|
3660
|
+
type: String,
|
|
3661
|
+
default: "data"
|
|
3662
|
+
},
|
|
3663
|
+
// 错误消息提取字段
|
|
3664
|
+
errorField: {
|
|
3665
|
+
type: String,
|
|
3666
|
+
default: "msg"
|
|
3667
|
+
}
|
|
3668
|
+
},
|
|
3669
|
+
emits: [UPDATE_MODEL_EVENT],
|
|
3670
|
+
setup(__props, { emit: __emit }) {
|
|
3671
|
+
|
|
3672
|
+
|
|
3673
|
+
|
|
3674
|
+
const props = __props;
|
|
3675
|
+
|
|
3676
|
+
const emit = __emit;
|
|
3677
|
+
|
|
3678
|
+
const number = vue.ref(0);
|
|
3679
|
+
const uploadList = vue.ref([]);
|
|
3680
|
+
const dialogImageUrl = vue.ref("");
|
|
3681
|
+
const dialogVisible = vue.ref(false);
|
|
3682
|
+
const fileList = vue.ref([]);
|
|
3683
|
+
const imageUploadRef = vue.ref(null);
|
|
3684
|
+
|
|
3685
|
+
const showTip = vue.computed(() => props.isShowTip && (props.fileType || props.fileSize));
|
|
3686
|
+
|
|
3687
|
+
// 深度解析对象属性 (例如把 res["data.imgUrl"] 转为 res.data.imgUrl)
|
|
3688
|
+
const getDeepValue = (obj, path) => {
|
|
3689
|
+
if (!path) return obj
|
|
3690
|
+
return path.split(".").reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), obj)
|
|
3691
|
+
};
|
|
3692
|
+
|
|
3693
|
+
vue.watch(
|
|
3694
|
+
() => props.modelValue,
|
|
3695
|
+
val => {
|
|
3696
|
+
if (val) {
|
|
3697
|
+
const list = Array.isArray(val) ? val : val.split(",");
|
|
3698
|
+
fileList.value = list.map(item => {
|
|
3699
|
+
if (isString(item)) {
|
|
3700
|
+
let url = item;
|
|
3701
|
+
if (!/^https?:\/\//.test(url) && props.baseUrl) {
|
|
3702
|
+
url = props.baseUrl + item;
|
|
3703
|
+
}
|
|
3704
|
+
item = { name: getFileName(item), url: url };
|
|
3705
|
+
}
|
|
3706
|
+
return item
|
|
3707
|
+
});
|
|
3708
|
+
} else {
|
|
3709
|
+
fileList.value = [];
|
|
3710
|
+
}
|
|
3711
|
+
},
|
|
3712
|
+
{ deep: true, immediate: true }
|
|
3713
|
+
);
|
|
3714
|
+
|
|
3715
|
+
function handleBeforeUpload(file) {
|
|
3716
|
+
let isImg = false;
|
|
3717
|
+
if (props.fileType.length) {
|
|
3718
|
+
const fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1).toLowerCase();
|
|
3719
|
+
isImg = props.fileType.map(t => t.toLowerCase()).includes(fileExtension);
|
|
3720
|
+
} else {
|
|
3721
|
+
isImg = file.type.indexOf("image") > -1;
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
if (!isImg) {
|
|
3725
|
+
elementPlus.ElMessage.error(`格式不正确, 请上传${props.fileType.join("/")}图片!`);
|
|
3726
|
+
return false
|
|
3727
|
+
}
|
|
3728
|
+
if (props.fileSize && file.size / 1024 / 1024 > props.fileSize) {
|
|
3729
|
+
elementPlus.ElMessage.error(`大小不能超过 ${props.fileSize} MB!`);
|
|
3730
|
+
return false
|
|
3731
|
+
}
|
|
3732
|
+
number.value++;
|
|
3733
|
+
return true
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
function handleExceed() {
|
|
3737
|
+
elementPlus.ElMessage.error(`上传数量不能超过 ${props.limit} 个!`);
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
// 修改后的核心逻辑
|
|
3741
|
+
function handleUploadSuccess(res, file) {
|
|
3742
|
+
// 1. 使用传入的校验函数
|
|
3743
|
+
if (props.checkSuccess(res)) {
|
|
3744
|
+
// 2. 动态提取 URL
|
|
3745
|
+
const url = getDeepValue(res, props.responsePath);
|
|
3746
|
+
|
|
3747
|
+
if (url) {
|
|
3748
|
+
uploadList.value.push({ name: getFileName(url), url: url });
|
|
3749
|
+
uploadedSuccessfully();
|
|
3750
|
+
} else {
|
|
3751
|
+
handleUploadError(`无法从响应中解析图片路径: ${props.responsePath}`);
|
|
3752
|
+
}
|
|
3753
|
+
} else {
|
|
3754
|
+
number.value--;
|
|
3755
|
+
const errorMsg = getDeepValue(res, props.errorField) || "上传失败";
|
|
3756
|
+
elementPlus.ElMessage.error(errorMsg);
|
|
3757
|
+
imageUploadRef.value.handleRemove(file);
|
|
3758
|
+
uploadedSuccessfully();
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
|
|
3762
|
+
function handleRemove(file) {
|
|
3763
|
+
const findex = fileList.value.findIndex(f => f.name === file.name);
|
|
3764
|
+
if (findex > -1) {
|
|
3765
|
+
fileList.value.splice(findex, 1);
|
|
3766
|
+
emit(UPDATE_MODEL_EVENT, listToString(fileList.value));
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
|
|
3770
|
+
function uploadedSuccessfully() {
|
|
3771
|
+
if (number.value > 0 && uploadList.value.length === number.value) {
|
|
3772
|
+
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
|
3773
|
+
uploadList.value = [];
|
|
3774
|
+
number.value = 0;
|
|
3775
|
+
emit(UPDATE_MODEL_EVENT, listToString(fileList.value));
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
function handleUploadError(msg) {
|
|
3780
|
+
elementPlus.ElMessage.error(isString(msg) ? msg : "上传图片失败");
|
|
3781
|
+
number.value--;
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
function handlePictureCardPreview(file) {
|
|
3785
|
+
dialogImageUrl.value = file.url;
|
|
3786
|
+
dialogVisible.value = true;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
function getFileName(name) {
|
|
3790
|
+
if (!isString(name)) return ""
|
|
3791
|
+
return name.slice(name.lastIndexOf("/") + 1)
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
function listToString(list, separator = ",") {
|
|
3795
|
+
return list
|
|
3796
|
+
.filter(item => item.url && item.url.indexOf("blob:") !== 0)
|
|
3797
|
+
.map(item => {
|
|
3798
|
+
let url = item.url;
|
|
3799
|
+
if (props.baseUrl && url.indexOf(props.baseUrl) === 0) {
|
|
3800
|
+
url = url.replace(props.baseUrl, "");
|
|
3801
|
+
}
|
|
3802
|
+
return url
|
|
3803
|
+
})
|
|
3804
|
+
.join(separator)
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
return (_ctx, _cache) => {
|
|
3808
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
3809
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
3810
|
+
const _component_el_dialog = vue.resolveComponent("el-dialog");
|
|
3811
|
+
|
|
3812
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
3813
|
+
vue.createVNode(_component_el_upload, {
|
|
3814
|
+
ref_key: "imageUploadRef",
|
|
3815
|
+
ref: imageUploadRef,
|
|
3816
|
+
multiple: "",
|
|
3817
|
+
action: __props.action,
|
|
3818
|
+
"list-type": "picture-card",
|
|
3819
|
+
"on-success": handleUploadSuccess,
|
|
3820
|
+
"before-upload": handleBeforeUpload,
|
|
3821
|
+
limit: __props.limit,
|
|
3822
|
+
"on-error": handleUploadError,
|
|
3823
|
+
"on-exceed": handleExceed,
|
|
3824
|
+
"on-remove": handleRemove,
|
|
3825
|
+
"show-file-list": true,
|
|
3826
|
+
headers: __props.headers,
|
|
3827
|
+
"file-list": fileList.value,
|
|
3828
|
+
"on-preview": handlePictureCardPreview,
|
|
3829
|
+
class: vue.normalizeClass({ hide: fileList.value.length >= __props.limit })
|
|
3830
|
+
}, {
|
|
3831
|
+
default: vue.withCtx(() => [
|
|
3832
|
+
vue.createVNode(_component_el_icon, { class: "avatar-uploader-icon" }, {
|
|
3833
|
+
default: vue.withCtx(() => [
|
|
3834
|
+
vue.createVNode(vue.unref(iconsVue.Plus))
|
|
3835
|
+
]),
|
|
3836
|
+
_: 1 /* STABLE */
|
|
3837
|
+
})
|
|
3838
|
+
]),
|
|
3839
|
+
_: 1 /* STABLE */
|
|
3840
|
+
}, 8 /* PROPS */, ["action", "limit", "headers", "file-list", "class"]),
|
|
3841
|
+
(showTip.value)
|
|
3842
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
|
|
3843
|
+
_cache[3] || (_cache[3] = vue.createTextVNode(" 请上传 ", -1 /* CACHED */)),
|
|
3844
|
+
(__props.fileSize)
|
|
3845
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
3846
|
+
_cache[1] || (_cache[1] = vue.createTextVNode(" 大小不超过 ", -1 /* CACHED */)),
|
|
3847
|
+
vue.createElementVNode("b", _hoisted_3$1, vue.toDisplayString(__props.fileSize) + "MB", 1 /* TEXT */)
|
|
3848
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3849
|
+
: vue.createCommentVNode("v-if", true),
|
|
3850
|
+
(__props.fileType)
|
|
3851
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
3852
|
+
_cache[2] || (_cache[2] = vue.createTextVNode(" 格式为 ", -1 /* CACHED */)),
|
|
3853
|
+
vue.createElementVNode("b", _hoisted_4$1, vue.toDisplayString(__props.fileType.join("/")), 1 /* TEXT */)
|
|
3854
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3855
|
+
: vue.createCommentVNode("v-if", true),
|
|
3856
|
+
_cache[4] || (_cache[4] = vue.createTextVNode(" 的文件 ", -1 /* CACHED */))
|
|
3857
|
+
]))
|
|
3858
|
+
: vue.createCommentVNode("v-if", true),
|
|
3859
|
+
vue.createVNode(_component_el_dialog, {
|
|
3860
|
+
modelValue: dialogVisible.value,
|
|
3861
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((dialogVisible).value = $event)),
|
|
3862
|
+
title: "预览",
|
|
3863
|
+
width: "800px",
|
|
3864
|
+
"append-to-body": ""
|
|
3865
|
+
}, {
|
|
3866
|
+
default: vue.withCtx(() => [
|
|
3867
|
+
vue.createElementVNode("img", {
|
|
3868
|
+
src: dialogImageUrl.value,
|
|
3869
|
+
style: {"display":"block","max-width":"100%","margin":"0 auto"}
|
|
3870
|
+
}, null, 8 /* PROPS */, _hoisted_5$1)
|
|
3871
|
+
]),
|
|
3872
|
+
_: 1 /* STABLE */
|
|
3873
|
+
}, 8 /* PROPS */, ["modelValue"])
|
|
3874
|
+
]))
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
});
|
|
3879
|
+
var ImageUpload = /*#__PURE__*/_export_sfc(_sfc_main$1, [['__scopeId',"data-v-9ac7dd1b"]]);
|
|
3880
|
+
|
|
3881
|
+
const EasyImageUpload = withInstall(ImageUpload);
|
|
3882
|
+
|
|
3883
|
+
var css_248z = ".component-upload-file .upload-file-uploader[data-v-cc8b9b13] {\n margin-bottom: 5px;\n}\n.component-upload-file .el-upload__tip[data-v-cc8b9b13] {\n font-size: 12px;\n color: #606266;\n margin-top: 7px;\n}\n.component-upload-file .upload-file-list[data-v-cc8b9b13] {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.component-upload-file .upload-file-list .el-upload-list__item[data-v-cc8b9b13] {\n border: 1px solid #e4e7ed;\n line-height: 2;\n margin-bottom: 10px;\n position: relative;\n border-radius: 4px;\n padding: 8px 10px;\n transition: all 0.3s;\n}\n.component-upload-file .upload-file-list .el-upload-list__item[data-v-cc8b9b13]:hover {\n background-color: #f5f7fa;\n}\n.component-upload-file .upload-file-list .ele-upload-list__item-content[data-v-cc8b9b13] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: inherit;\n}\n.component-upload-file .upload-file-list .ele-upload-list__item-content .el-link[data-v-cc8b9b13] {\n flex: 1;\n margin-right: 10px;\n}\n.component-upload-file .upload-file-list .ele-upload-list__item-content-action .el-link[data-v-cc8b9b13] {\n margin-right: 10px;\n}";
|
|
3884
|
+
styleInject(css_248z);
|
|
3885
|
+
|
|
3886
|
+
const _hoisted_1 = { class: "component-upload-file" };
|
|
3887
|
+
const _hoisted_2 = {
|
|
3888
|
+
key: 0,
|
|
3889
|
+
class: "el-upload__tip"
|
|
3890
|
+
};
|
|
3891
|
+
const _hoisted_3 = { style: {"color":"#f56c6c"} };
|
|
3892
|
+
const _hoisted_4 = { style: {"color":"#f56c6c"} };
|
|
3893
|
+
const _hoisted_5 = { class: "ele-upload-list__item-content-action" };
|
|
3894
|
+
|
|
3895
|
+
|
|
3896
|
+
const _sfc_main = /*@__PURE__*/Object.assign({ name: "EasyFileUpload" }, {
|
|
3897
|
+
__name: 'FileUpload',
|
|
3898
|
+
props: {
|
|
3899
|
+
modelValue: [String, Object, Array],
|
|
3900
|
+
// 数量限制
|
|
3901
|
+
limit: {
|
|
3902
|
+
type: Number,
|
|
3903
|
+
default: 5
|
|
3904
|
+
},
|
|
3905
|
+
// 大小限制(MB)
|
|
3906
|
+
fileSize: {
|
|
3907
|
+
type: Number,
|
|
3908
|
+
default: 5
|
|
3909
|
+
},
|
|
3910
|
+
// 文件类型, 例如['doc', 'xls', 'ppt', 'txt', 'pdf']
|
|
3911
|
+
fileType: {
|
|
3912
|
+
type: Array,
|
|
3913
|
+
default: () => ["doc", "xls", "ppt", "txt", "pdf"]
|
|
3914
|
+
},
|
|
3915
|
+
// 是否显示提示
|
|
3916
|
+
isShowTip: {
|
|
3917
|
+
type: Boolean,
|
|
3918
|
+
default: true
|
|
3919
|
+
},
|
|
3920
|
+
// 上传地址
|
|
3921
|
+
action: {
|
|
3922
|
+
type: String,
|
|
3923
|
+
required: true
|
|
3924
|
+
},
|
|
3925
|
+
// 请求头
|
|
3926
|
+
headers: {
|
|
3927
|
+
type: Object,
|
|
3928
|
+
default: () => ({})
|
|
3929
|
+
},
|
|
3930
|
+
// 基础路径
|
|
3931
|
+
baseUrl: {
|
|
3932
|
+
type: String,
|
|
3933
|
+
default: ""
|
|
3934
|
+
},
|
|
3935
|
+
// 自定义成功校验函数
|
|
3936
|
+
checkSuccess: {
|
|
3937
|
+
type: Function,
|
|
3938
|
+
default: res => res.code === 200 || res.success === true
|
|
3939
|
+
},
|
|
3940
|
+
// 自定义提取文件地址的路径,支持 "data.url" 这种深层嵌套
|
|
3941
|
+
responsePath: {
|
|
3942
|
+
type: String,
|
|
3943
|
+
default: "data"
|
|
3944
|
+
},
|
|
3945
|
+
// 错误消息提取字段
|
|
3946
|
+
errorField: {
|
|
3947
|
+
type: String,
|
|
3948
|
+
default: "msg"
|
|
3949
|
+
}
|
|
3950
|
+
},
|
|
3951
|
+
emits: [UPDATE_MODEL_EVENT],
|
|
3952
|
+
setup(__props, { emit: __emit }) {
|
|
3953
|
+
|
|
3954
|
+
|
|
3955
|
+
|
|
3956
|
+
const props = __props;
|
|
3957
|
+
|
|
3958
|
+
const emit = __emit;
|
|
3959
|
+
|
|
3960
|
+
const number = vue.ref(0);
|
|
3961
|
+
const uploadList = vue.ref([]);
|
|
3962
|
+
const fileList = vue.ref([]);
|
|
3963
|
+
const fileUploadRef = vue.ref(null);
|
|
3964
|
+
|
|
3965
|
+
const showTip = vue.computed(() => props.isShowTip && (props.fileType || props.fileSize));
|
|
3966
|
+
|
|
3967
|
+
// 深度解析对象属性 (例如把 res["data.url"] 转为 res.data.url)
|
|
3968
|
+
const getDeepValue = (obj, path) => {
|
|
3969
|
+
if (!path) return obj
|
|
3970
|
+
return path.split(".").reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), obj)
|
|
3971
|
+
};
|
|
3972
|
+
|
|
3973
|
+
vue.watch(
|
|
3974
|
+
() => props.modelValue,
|
|
3975
|
+
val => {
|
|
3976
|
+
if (val) {
|
|
3977
|
+
const list = Array.isArray(val) ? val : val.split(",");
|
|
3978
|
+
fileList.value = list.map((item, index) => {
|
|
3979
|
+
if (isString(item)) {
|
|
3980
|
+
item = { name: getFileName(item), url: item, uid: new Date().getTime() + index };
|
|
3981
|
+
}
|
|
3982
|
+
return item
|
|
3983
|
+
});
|
|
3984
|
+
} else {
|
|
3985
|
+
fileList.value = [];
|
|
3986
|
+
}
|
|
3987
|
+
},
|
|
3988
|
+
{ deep: true, immediate: true }
|
|
3989
|
+
);
|
|
3990
|
+
|
|
3991
|
+
// 上传前校检格式和大小
|
|
3992
|
+
function handleBeforeUpload(file) {
|
|
3993
|
+
// 校检文件类型
|
|
3994
|
+
if (props.fileType && props.fileType.length) {
|
|
3995
|
+
const fileName = file.name.split(".");
|
|
3996
|
+
const fileExt = fileName[fileName.length - 1].toLowerCase();
|
|
3997
|
+
const isTypeOk = props.fileType.map(t => t.toLowerCase()).includes(fileExt);
|
|
3998
|
+
if (!isTypeOk) {
|
|
3999
|
+
elementPlus.ElMessage.error(`文件格式不正确, 请上传${props.fileType.join("/")}格式文件!`);
|
|
4000
|
+
return false
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
// 校检文件大小
|
|
4004
|
+
if (props.fileSize && file.size / 1024 / 1024 > props.fileSize) {
|
|
4005
|
+
elementPlus.ElMessage.error(`上传文件大小不能超过 ${props.fileSize} MB!`);
|
|
4006
|
+
return false
|
|
4007
|
+
}
|
|
4008
|
+
number.value++;
|
|
4009
|
+
return true
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
// 文件个数超出
|
|
4013
|
+
function handleExceed() {
|
|
4014
|
+
elementPlus.ElMessage.error(`上传文件数量不能超过 ${props.limit} 个!`);
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
// 上传失败
|
|
4018
|
+
function handleUploadError(err) {
|
|
4019
|
+
number.value--;
|
|
4020
|
+
elementPlus.ElMessage.error(isString(err) ? err : "上传文件失败");
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
// 上传成功回调
|
|
4024
|
+
function handleUploadSuccess(res, file) {
|
|
4025
|
+
// 使用传入的校验函数
|
|
4026
|
+
if (props.checkSuccess(res)) {
|
|
4027
|
+
// 动态提取 URL
|
|
4028
|
+
const url = getDeepValue(res, props.responsePath);
|
|
4029
|
+
|
|
4030
|
+
if (url) {
|
|
4031
|
+
uploadList.value.push({ name: getFileName(url), url: url, uid: file.uid });
|
|
4032
|
+
uploadedSuccessfully();
|
|
4033
|
+
} else {
|
|
4034
|
+
handleUploadError(`无法从响应中解析文件路径: ${props.responsePath}`);
|
|
4035
|
+
}
|
|
4036
|
+
} else {
|
|
4037
|
+
number.value--;
|
|
4038
|
+
const errorMsg = getDeepValue(res, props.errorField) || "上传失败";
|
|
4039
|
+
elementPlus.ElMessage.error(errorMsg);
|
|
4040
|
+
fileUploadRef.value?.handleRemove(file);
|
|
4041
|
+
uploadedSuccessfully();
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
// 删除文件
|
|
4046
|
+
function handleDelete(index) {
|
|
4047
|
+
fileList.value.splice(index, 1);
|
|
4048
|
+
emit(UPDATE_MODEL_EVENT, listToString(fileList.value));
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
// 移除文件
|
|
4052
|
+
function handleRemove(file) {
|
|
4053
|
+
const findex = fileList.value.findIndex(f => f.uid === file.uid);
|
|
4054
|
+
if (findex > -1) {
|
|
4055
|
+
fileList.value.splice(findex, 1);
|
|
4056
|
+
emit(UPDATE_MODEL_EVENT, listToString(fileList.value));
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
// 上传结束处理
|
|
4061
|
+
function uploadedSuccessfully() {
|
|
4062
|
+
if (number.value > 0 && uploadList.value.length === number.value) {
|
|
4063
|
+
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
|
4064
|
+
uploadList.value = [];
|
|
4065
|
+
number.value = 0;
|
|
4066
|
+
emit(UPDATE_MODEL_EVENT, listToString(fileList.value));
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
// 获取文件名称
|
|
4071
|
+
function getFileName(name) {
|
|
4072
|
+
if (!isString(name)) return ""
|
|
4073
|
+
return name.slice(name.lastIndexOf("/") + 1)
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
// 获取文件完整 URL
|
|
4077
|
+
function getFileUrl(url) {
|
|
4078
|
+
if (!url) return ""
|
|
4079
|
+
if (/^https?:\/\//.test(url)) return url
|
|
4080
|
+
return props.baseUrl ? props.baseUrl + url : url
|
|
4081
|
+
}
|
|
4082
|
+
|
|
4083
|
+
// 对象转成指定字符串分隔
|
|
4084
|
+
function listToString(list, separator = ",") {
|
|
4085
|
+
return list
|
|
4086
|
+
.filter(item => item.url && item.url.indexOf("blob:") !== 0)
|
|
4087
|
+
.map(item => {
|
|
4088
|
+
let url = item.url;
|
|
4089
|
+
// 如果设置了 baseUrl,保存时去除它
|
|
4090
|
+
if (props.baseUrl && url.indexOf(props.baseUrl) === 0) {
|
|
4091
|
+
url = url.replace(props.baseUrl, "");
|
|
4092
|
+
}
|
|
4093
|
+
return url
|
|
4094
|
+
})
|
|
4095
|
+
.join(separator)
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
return (_ctx, _cache) => {
|
|
4099
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
4100
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
4101
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
4102
|
+
const _component_el_link = vue.resolveComponent("el-link");
|
|
4103
|
+
|
|
4104
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
4105
|
+
vue.createVNode(_component_el_upload, {
|
|
4106
|
+
ref_key: "fileUploadRef",
|
|
4107
|
+
ref: fileUploadRef,
|
|
4108
|
+
multiple: "",
|
|
4109
|
+
action: __props.action,
|
|
4110
|
+
"before-upload": handleBeforeUpload,
|
|
4111
|
+
"file-list": fileList.value,
|
|
4112
|
+
limit: __props.limit,
|
|
4113
|
+
"on-error": handleUploadError,
|
|
4114
|
+
"on-exceed": handleExceed,
|
|
4115
|
+
"on-success": handleUploadSuccess,
|
|
4116
|
+
"on-remove": handleRemove,
|
|
4117
|
+
"show-file-list": false,
|
|
4118
|
+
headers: __props.headers,
|
|
4119
|
+
class: "upload-file-uploader"
|
|
4120
|
+
}, {
|
|
4121
|
+
default: vue.withCtx(() => [
|
|
4122
|
+
vue.createCommentVNode(" 上传按钮 "),
|
|
4123
|
+
vue.createVNode(_component_el_button, { type: "primary" }, {
|
|
4124
|
+
default: vue.withCtx(() => [
|
|
4125
|
+
vue.createVNode(_component_el_icon, { class: "el-icon--left" }, {
|
|
4126
|
+
default: vue.withCtx(() => [
|
|
4127
|
+
vue.createVNode(vue.unref(iconsVue.Upload))
|
|
4128
|
+
]),
|
|
4129
|
+
_: 1 /* STABLE */
|
|
4130
|
+
}),
|
|
4131
|
+
_cache[0] || (_cache[0] = vue.createTextVNode(" 选取文件 ", -1 /* CACHED */))
|
|
4132
|
+
]),
|
|
4133
|
+
_: 1 /* STABLE */
|
|
4134
|
+
})
|
|
4135
|
+
]),
|
|
4136
|
+
_: 1 /* STABLE */
|
|
4137
|
+
}, 8 /* PROPS */, ["action", "file-list", "limit", "headers"]),
|
|
4138
|
+
vue.createCommentVNode(" 上传提示 "),
|
|
4139
|
+
(showTip.value)
|
|
4140
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
4141
|
+
_cache[3] || (_cache[3] = vue.createTextVNode(" 请上传 ", -1 /* CACHED */)),
|
|
4142
|
+
(__props.fileSize)
|
|
4143
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
4144
|
+
_cache[1] || (_cache[1] = vue.createTextVNode(" 大小不超过 ", -1 /* CACHED */)),
|
|
4145
|
+
vue.createElementVNode("b", _hoisted_3, vue.toDisplayString(__props.fileSize) + "MB", 1 /* TEXT */)
|
|
4146
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
4147
|
+
: vue.createCommentVNode("v-if", true),
|
|
4148
|
+
(__props.fileType && __props.fileType.length)
|
|
4149
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
4150
|
+
_cache[2] || (_cache[2] = vue.createTextVNode(" 格式为 ", -1 /* CACHED */)),
|
|
4151
|
+
vue.createElementVNode("b", _hoisted_4, vue.toDisplayString(__props.fileType.join("/")), 1 /* TEXT */)
|
|
4152
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
4153
|
+
: vue.createCommentVNode("v-if", true),
|
|
4154
|
+
_cache[4] || (_cache[4] = vue.createTextVNode(" 的文件 ", -1 /* CACHED */))
|
|
4155
|
+
]))
|
|
4156
|
+
: vue.createCommentVNode("v-if", true),
|
|
4157
|
+
vue.createCommentVNode(" 文件列表 "),
|
|
4158
|
+
vue.createVNode(vue.TransitionGroup, {
|
|
4159
|
+
class: "upload-file-list el-upload-list el-upload-list--text",
|
|
4160
|
+
name: "el-fade-in-linear",
|
|
4161
|
+
tag: "ul"
|
|
4162
|
+
}, {
|
|
4163
|
+
default: vue.withCtx(() => [
|
|
4164
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fileList.value, (file, index) => {
|
|
4165
|
+
return (vue.openBlock(), vue.createElementBlock("li", {
|
|
4166
|
+
key: file.uid || index,
|
|
4167
|
+
class: "el-upload-list__item ele-upload-list__item-content"
|
|
4168
|
+
}, [
|
|
4169
|
+
vue.createVNode(_component_el_link, {
|
|
4170
|
+
href: getFileUrl(file.url),
|
|
4171
|
+
underline: "never",
|
|
4172
|
+
target: "_blank"
|
|
4173
|
+
}, {
|
|
4174
|
+
default: vue.withCtx(() => [
|
|
4175
|
+
vue.createVNode(_component_el_icon, { class: "el-icon--left" }, {
|
|
4176
|
+
default: vue.withCtx(() => [
|
|
4177
|
+
vue.createVNode(vue.unref(iconsVue.Document))
|
|
4178
|
+
]),
|
|
4179
|
+
_: 1 /* STABLE */
|
|
4180
|
+
}),
|
|
4181
|
+
vue.createElementVNode("span", null, vue.toDisplayString(getFileName(file.name)), 1 /* TEXT */)
|
|
4182
|
+
]),
|
|
4183
|
+
_: 2 /* DYNAMIC */
|
|
4184
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["href"]),
|
|
4185
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
4186
|
+
vue.createVNode(_component_el_link, {
|
|
4187
|
+
underline: "never",
|
|
4188
|
+
onClick: $event => (handleDelete(index)),
|
|
4189
|
+
type: "danger"
|
|
4190
|
+
}, {
|
|
4191
|
+
default: vue.withCtx(() => [...(_cache[5] || (_cache[5] = [
|
|
4192
|
+
vue.createTextVNode("删除", -1 /* CACHED */)
|
|
4193
|
+
]))]),
|
|
4194
|
+
_: 1 /* STABLE */
|
|
4195
|
+
}, 8 /* PROPS */, ["onClick"])
|
|
4196
|
+
])
|
|
4197
|
+
]))
|
|
4198
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
4199
|
+
]),
|
|
4200
|
+
_: 1 /* STABLE */
|
|
4201
|
+
})
|
|
4202
|
+
]))
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
});
|
|
4207
|
+
var FileUpload = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-cc8b9b13"]]);
|
|
4208
|
+
|
|
4209
|
+
const EasyFileUpload = withInstall(FileUpload);
|
|
4210
|
+
|
|
4211
|
+
/**
|
|
4212
|
+
*
|
|
4213
|
+
* @param {*} component 组件
|
|
4214
|
+
* @param {*} componentProps 组件属性
|
|
4215
|
+
* @param {*} modalProps 对话框属性
|
|
4216
|
+
* @param {*} context 上下文
|
|
4217
|
+
* @returns Promise
|
|
4218
|
+
*/
|
|
4219
|
+
const useDialog = (component, componentProps = {}, modalProps = {}, context = null) => {
|
|
4220
|
+
// 如果 component 是字符串,转换为渲染函数
|
|
4221
|
+
const contentComponent = isString(component) ? { render: () => vue.h("div", component) } : vue.markRaw(component);
|
|
4222
|
+
|
|
4223
|
+
const {
|
|
4224
|
+
title = "提示",
|
|
4225
|
+
confirmButtonText = "确 认",
|
|
4226
|
+
cancelButtonText = "取 消",
|
|
4227
|
+
showConfirmButton = true,
|
|
4228
|
+
showCancelButton = true,
|
|
4229
|
+
methodKey = "submit",
|
|
4230
|
+
beforeClose,
|
|
4231
|
+
onConfirm,
|
|
4232
|
+
onCancel,
|
|
4233
|
+
footer,
|
|
4234
|
+
draggable = true,
|
|
4235
|
+
...dialogProps
|
|
4236
|
+
} = modalProps;
|
|
4237
|
+
|
|
4238
|
+
const visible = vue.ref(true);
|
|
4239
|
+
const loading = vue.ref(false);
|
|
4240
|
+
const componentRef = vue.ref(null);
|
|
4241
|
+
|
|
4242
|
+
const appContext = context || getGlobalAppContext();
|
|
4243
|
+
|
|
4244
|
+
const div = document.createElement("div");
|
|
4245
|
+
document.body.appendChild(div);
|
|
4246
|
+
|
|
4247
|
+
return new Promise((resolve, reject) => {
|
|
4248
|
+
let app = null;
|
|
4249
|
+
let isSettled = false; // 标记 Promise 是否已完成,防止重复触发
|
|
4250
|
+
|
|
4251
|
+
// 销毁
|
|
4252
|
+
const destroy = () => {
|
|
4253
|
+
if (app) {
|
|
4254
|
+
app.unmount();
|
|
4255
|
+
app = null;
|
|
4256
|
+
}
|
|
4257
|
+
if (div.parentNode) {
|
|
4258
|
+
div.parentNode.removeChild(div);
|
|
4259
|
+
}
|
|
4260
|
+
};
|
|
4261
|
+
|
|
4262
|
+
// 关闭
|
|
4263
|
+
const close = () => {
|
|
4264
|
+
visible.value = false;
|
|
4265
|
+
};
|
|
4266
|
+
|
|
4267
|
+
// 统一处理 Promise 结束逻辑
|
|
4268
|
+
const handleAction = async (action, data) => {
|
|
4269
|
+
if (isSettled) return
|
|
4270
|
+
isSettled = true;
|
|
4271
|
+
if (action === "resolve") resolve(data);
|
|
4272
|
+
else reject(data);
|
|
4273
|
+
close();
|
|
4274
|
+
};
|
|
4275
|
+
|
|
4276
|
+
// 确认
|
|
4277
|
+
const handleConfirm = async () => {
|
|
4278
|
+
loading.value = true;
|
|
4279
|
+
try {
|
|
4280
|
+
const target = componentRef.value;
|
|
4281
|
+
// 调用组件方法
|
|
4282
|
+
if (target && methodKey && isFunction$1(target[methodKey])) {
|
|
4283
|
+
await target[methodKey]();
|
|
4284
|
+
}
|
|
4285
|
+
// 调用 onConfirm
|
|
4286
|
+
if (isFunction$1(onConfirm)) {
|
|
4287
|
+
await onConfirm(target);
|
|
4288
|
+
}
|
|
4289
|
+
// 返回 resolve
|
|
4290
|
+
await handleAction("resolve", target);
|
|
4291
|
+
} catch (e) {
|
|
4292
|
+
isSettled = false; // 失败时不沉淀状态,允许用户修正后重试
|
|
4293
|
+
reject(e);
|
|
4294
|
+
} finally {
|
|
4295
|
+
loading.value = false;
|
|
4296
|
+
}
|
|
4297
|
+
};
|
|
4298
|
+
|
|
4299
|
+
// 取消
|
|
4300
|
+
const handleCancel = () => {
|
|
4301
|
+
if (isFunction$1(onCancel)) onCancel();
|
|
4302
|
+
handleAction("reject", "closed");
|
|
4303
|
+
};
|
|
4304
|
+
|
|
4305
|
+
// DialogApp
|
|
4306
|
+
const DialogApp = {
|
|
4307
|
+
setup() {
|
|
4308
|
+
return () =>
|
|
4309
|
+
vue.h(
|
|
4310
|
+
elementPlus.ElDialog,
|
|
4311
|
+
{
|
|
4312
|
+
...dialogProps,
|
|
4313
|
+
modelValue: visible.value,
|
|
4314
|
+
"onUpdate:modelValue": val => {
|
|
4315
|
+
visible.value = val;
|
|
4316
|
+
if (!val && !isSettled) handleAction("reject", "closed");
|
|
4317
|
+
},
|
|
4318
|
+
title,
|
|
4319
|
+
draggable,
|
|
4320
|
+
destroyOnClose: true,
|
|
4321
|
+
onClosed: destroy, // 动画结束后彻底回收
|
|
4322
|
+
// 拦截右上角 X 和遮罩层点击
|
|
4323
|
+
beforeClose: done => {
|
|
4324
|
+
if (beforeClose) {
|
|
4325
|
+
beforeClose(() => {
|
|
4326
|
+
if (!isSettled) handleAction("reject", "closed");
|
|
4327
|
+
done();
|
|
4328
|
+
});
|
|
4329
|
+
} else {
|
|
4330
|
+
if (!isSettled) handleAction("reject", "closed");
|
|
4331
|
+
done();
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
},
|
|
4335
|
+
{
|
|
4336
|
+
// 默认内容 渲染组件
|
|
4337
|
+
default: () => vue.h(contentComponent, { ...componentProps, ref: componentRef }),
|
|
4338
|
+
|
|
4339
|
+
// 底部内容
|
|
4340
|
+
footer: () => {
|
|
4341
|
+
// 自定义 footer
|
|
4342
|
+
if (footer) {
|
|
4343
|
+
return isFunction$1(footer)
|
|
4344
|
+
? footer({ close: handleCancel, confirm: handleConfirm, loading: loading.value })
|
|
4345
|
+
: footer
|
|
4346
|
+
}
|
|
4347
|
+
return vue.h("div", { class: "dialog-footer" }, [
|
|
4348
|
+
// 取消按钮
|
|
4349
|
+
showCancelButton && vue.h(elementPlus.ElButton, { onClick: handleCancel }, () => cancelButtonText),
|
|
4350
|
+
// 确认按钮
|
|
4351
|
+
showConfirmButton &&
|
|
4352
|
+
vue.h(
|
|
4353
|
+
elementPlus.ElButton,
|
|
4354
|
+
{
|
|
4355
|
+
type: "primary",
|
|
4356
|
+
loading: loading.value,
|
|
4357
|
+
onClick: handleConfirm
|
|
4358
|
+
},
|
|
4359
|
+
() => confirmButtonText
|
|
4360
|
+
)
|
|
4361
|
+
])
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
)
|
|
4365
|
+
}
|
|
4366
|
+
};
|
|
4367
|
+
|
|
4368
|
+
app = vue.createApp(DialogApp);
|
|
4369
|
+
|
|
4370
|
+
// 优化:上下文继承
|
|
4371
|
+
if (appContext) {
|
|
4372
|
+
// 核心插件继承 (避免直接操作 _context 私有属性的风险)
|
|
4373
|
+
// 如果你的 getGlobalAppContext 已经拿到了真实的 context,可以这样同步
|
|
4374
|
+
Object.assign(app._context, {
|
|
4375
|
+
...appContext,
|
|
4376
|
+
reload: app._context.reload // 保留新应用的 reload 方法
|
|
4377
|
+
});
|
|
4378
|
+
|
|
4379
|
+
// 必须手动同步 provides 以确保 inject 可用
|
|
4380
|
+
app._context.provides = { ...(appContext.provides || {}), ...app._context.provides };
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4383
|
+
app.mount(div);
|
|
4384
|
+
})
|
|
4385
|
+
};
|
|
4386
|
+
|
|
4387
|
+
// Dialog 是一个命令式 API(函数式调用),而非 Vue 组件
|
|
4388
|
+
// 用法: const dialog = useDialog(component, props, options)
|
|
4389
|
+
// 或者: import { EasyDialog } from "@easy-elplus"; EasyDialog(...)
|
|
4390
|
+
|
|
4391
|
+
|
|
4392
|
+
// 导出命名函数,保持与其他组件命名一致性
|
|
4393
|
+
const EasyDialog = useDialog;
|
|
4394
|
+
|
|
4395
|
+
// 组件列表
|
|
4396
|
+
const components = [EasyButton, EasyDescriptions, EasyTable, EasyImageUpload, EasyFileUpload];
|
|
4397
|
+
|
|
4398
|
+
// 是否已安装标识(防止重复 install)
|
|
4399
|
+
const INSTALLED_KEY = Symbol("INSTALLED_KEY");
|
|
4400
|
+
|
|
4401
|
+
// 组件库插件
|
|
4402
|
+
const EasyElementPlus = {
|
|
4403
|
+
install(app) {
|
|
4404
|
+
// 防止重复安装
|
|
4405
|
+
if (app[INSTALLED_KEY]) return
|
|
4406
|
+
|
|
4407
|
+
app[INSTALLED_KEY] = true;
|
|
4408
|
+
|
|
4409
|
+
// 保存全局应用上下文,供 EasyDialog 等工具使用
|
|
4410
|
+
// 这样即使在非组件上下文中调用,也能访问到主应用的插件和全局组件
|
|
4411
|
+
setGlobalAppContext(app._context);
|
|
4412
|
+
|
|
4413
|
+
// 逐个安装组件
|
|
4414
|
+
components.forEach(component => {
|
|
4415
|
+
app.use(component);
|
|
4416
|
+
});
|
|
4417
|
+
}
|
|
4418
|
+
};
|
|
4419
|
+
|
|
4420
|
+
exports.EasyButton = EasyButton;
|
|
4421
|
+
exports.EasyDescriptions = EasyDescriptions;
|
|
4422
|
+
exports.EasyDialog = EasyDialog;
|
|
4423
|
+
exports.EasyFileUpload = EasyFileUpload;
|
|
4424
|
+
exports.EasyImageUpload = EasyImageUpload;
|
|
4425
|
+
exports.EasyTable = EasyTable;
|
|
4426
|
+
exports.default = EasyElementPlus;
|
|
4427
|
+
exports.useDialog = useDialog;
|
|
4428
|
+
|
|
4429
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4430
|
+
|
|
4431
|
+
}));
|