UNPKG

lh-chs-ui

Version:

A Component Library for Vue.js.

548 lines (496 loc) 15.9 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 4); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */, shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection(h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /* 1 */, /* 2 */, /* 3 */, /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/container/src/index.vue?vue&type=template&id=6f8330d2 var render = function render() { var _vm = this, _c = _vm._self._c return _c( "div", { staticClass: "container-full" }, [ _c( "div", { staticClass: "container-full-main" }, [ _vm.$slots.header ? [ _c( "div", { staticClass: "container-full-header" }, [_vm._t("header")], 2 ), _c("div", { staticClass: "container-full-margin" }), ] : _vm._e(), _c( "div", { ref: "body", staticClass: "container-full-body", style: _vm.bodyStyle, }, [ _vm._t("default"), _c( "div", { key: _vm.listKey }, [_vm._t("list", null, { listHeight: _vm.listHeight })], 2 ), ], 2 ), ], 2 ), _vm.$slots.footer ? [ _c( "div", { staticClass: "container-full-footer" }, [_vm._t("footer")], 2 ), ] : _vm._e(), _vm.$slots.detailFooter ? [ _c( "div", { staticClass: "container-full-detail-footer" }, [_vm._t("detailFooter")], 2 ), ] : _vm._e(), ], 2 ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/container/src/index.vue?vue&type=template&id=6f8330d2 // CONCATENATED MODULE: ./src/utils/container-debounce.js var FUNC_ERROR_TEXT = 'Expected a function'; var now = function now() { return new Date().getTime(); }; /* harmony default export */ var container_debounce = (function (func, wait) { var lastArgs; var lastThis; var maxWait; var result; var timerId; var lastCallTime; var lastInvokeTime = 0; var leading = false; var maxing = false; var trailing = true; if (typeof func !== 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = Number(wait) || 0; function invokeFunc(time) { var args = lastArgs; var thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime; var timeSinceLastInvoke = time - lastInvokeTime; var timeWaiting = wait - timeSinceLastCall; return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime; var timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(); var isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; }); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/container/src/index.vue?vue&type=script&lang=js /* harmony default export */ var srcvue_type_script_lang_js = ({ name: 'chs-container', props: { noPadding: { type: Boolean, default: false } }, data: function data() { return { listHeight: 0, listKey: 1, setTime: null, setNum: 0, hasCache: false }; }, provide: function provide() { return { refreshListHeight: this.refreshListHeight }; }, methods: { refreshListHeight: function refreshListHeight() { var _this = this; setTimeout(function () { if (_this.$refs.body.querySelector('.chs-d2-crud')) { _this.setListHeight(); } }, 0); }, setListHeight: function setListHeight() { var _this2 = this; var chsD2crud = this.$refs.body.querySelector('.chs-d2-crud'); var elTable = chsD2crud.querySelector('.el-table'); if (!elTable) { this.listHeight = 400; return; } var listContainer = chsD2crud.classList.contains('el-table') ? chsD2crud : elTable; var top = listContainer.offsetTop + chsD2crud.offsetTop; var bodyHeight = this.$refs.body.offsetHeight; if (top === 0 && bodyHeight === 0) { !this.setTime && (this.setTime = setInterval(function () { if (_this2.setNum > 100) { if (_this2.setTime) { clearInterval(_this2.setTime); _this2.setTime = null; _this2.setNum = 0; } return; } _this2.setNum = _this2.setNum + 1; _this2.setListHeight(); }, 100)); return; } if (this.setTime) { clearInterval(this.setTime); this.setTime = null; this.setNum = 0; } this.listHeight = bodyHeight - top - 1; this.listKey = this.listKey + 1; } }, computed: { bodyStyle: function bodyStyle() { if (this.noPadding) { return { paddingTop: 0 }; } return {}; } }, created: function created() { this.debounceRefreshListHeight = container_debounce(this.refreshListHeight, 300); }, activated: function activated() { this.hasCache = true; this.refreshListHeight(); window.addEventListener('resize', this.debounceRefreshListHeight); }, mounted: function mounted() { var _this3 = this; if (!this.hasCache) { this.$nextTick(function () { _this3.listHeight = 400; }); } }, deactivated: function deactivated() { if (this.setTime) { clearInterval(this.setTime); this.setTime = null; this.setNum = 0; } window.removeEventListener('resize', this.debounceRefreshListHeight); }, destroyed: function destroyed() { if (this.setTime) { clearInterval(this.setTime); this.setTime = null; this.setNum = 0; } window.removeEventListener('resize', this.debounceRefreshListHeight); } }); // CONCATENATED MODULE: ./packages/container/src/index.vue?vue&type=script&lang=js /* harmony default export */ var container_srcvue_type_script_lang_js = (srcvue_type_script_lang_js); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./packages/container/src/index.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( container_srcvue_type_script_lang_js, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var src = (component.exports); // CONCATENATED MODULE: ./packages/container/index.js /* istanbul ignore next */ src.install = function (Vue) { Vue.component(src.name, src); }; /* harmony default export */ var container = __webpack_exports__["default"] = (src); /***/ }) /******/ ]);