app模板、应用模板、组件模板、widget模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

471 lines
14 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 556);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 2:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () {
  152. injectStyles.call(
  153. this,
  154. (options.functional ? this.parent : this).$root.$options.shadowRoot
  155. )
  156. }
  157. : injectStyles
  158. }
  159. if (hook) {
  160. if (options.functional) {
  161. // for template-only hot-reload because in that case the render fn doesn't
  162. // go through the normalizer
  163. options._injectStyles = hook
  164. // register for functional component in vue file
  165. var originalRender = options.render
  166. options.render = function renderWithStyleInjection (h, context) {
  167. hook.call(context)
  168. return originalRender(h, context)
  169. }
  170. } else {
  171. // inject component registration as beforeCreate hook
  172. var existing = options.beforeCreate
  173. options.beforeCreate = existing
  174. ? [].concat(existing, hook)
  175. : [hook]
  176. }
  177. }
  178. return {
  179. exports: scriptExports,
  180. options: options
  181. }
  182. }
  183. /***/ }),
  184. /***/ 33:
  185. /***/ (function(module, exports) {
  186. module.exports = require("tis-ui/lib/utils/merge");
  187. /***/ }),
  188. /***/ 556:
  189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  190. "use strict";
  191. // ESM COMPAT FLAG
  192. __webpack_require__.r(__webpack_exports__);
  193. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form.vue?vue&type=template&id=a1b5ff34&
  194. var render = function() {
  195. var _vm = this
  196. var _h = _vm.$createElement
  197. var _c = _vm._self._c || _h
  198. return _c(
  199. "form",
  200. {
  201. staticClass: "el-form",
  202. class: [
  203. _vm.labelPosition ? "el-form--label-" + _vm.labelPosition : "",
  204. { "el-form--inline": _vm.inline }
  205. ]
  206. },
  207. [_vm._t("default")],
  208. 2
  209. )
  210. }
  211. var staticRenderFns = []
  212. render._withStripped = true
  213. // CONCATENATED MODULE: ./packages/form/src/form.vue?vue&type=template&id=a1b5ff34&
  214. // EXTERNAL MODULE: external "tis-ui/lib/utils/merge"
  215. var merge_ = __webpack_require__(33);
  216. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  217. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form.vue?vue&type=script&lang=js&
  218. //
  219. //
  220. //
  221. //
  222. //
  223. //
  224. //
  225. //
  226. /* harmony default export */ var formvue_type_script_lang_js_ = ({
  227. name: 'TisForm',
  228. componentName: 'TisForm',
  229. provide: function provide() {
  230. return {
  231. elForm: this
  232. };
  233. },
  234. props: {
  235. model: Object,
  236. rules: Object,
  237. labelPosition: String,
  238. labelWidth: String,
  239. labelSuffix: {
  240. type: String,
  241. default: ''
  242. },
  243. inline: Boolean,
  244. inlineMessage: Boolean,
  245. statusIcon: Boolean,
  246. showMessage: {
  247. type: Boolean,
  248. default: true
  249. },
  250. size: String,
  251. disabled: Boolean,
  252. validateOnRuleChange: {
  253. type: Boolean,
  254. default: true
  255. },
  256. hideRequiredAsterisk: {
  257. type: Boolean,
  258. default: false
  259. }
  260. },
  261. watch: {
  262. rules: function rules() {
  263. // remove then add event listeners on form-item after form rules change
  264. this.fields.forEach(function (field) {
  265. field.removeValidateEvents();
  266. field.addValidateEvents();
  267. });
  268. if (this.validateOnRuleChange) {
  269. this.validate(function () {});
  270. }
  271. }
  272. },
  273. computed: {
  274. autoLabelWidth: function autoLabelWidth() {
  275. if (!this.potentialLabelWidthArr.length) return 0;
  276. var max = Math.max.apply(Math, this.potentialLabelWidthArr);
  277. return max ? max + 'px' : '';
  278. }
  279. },
  280. data: function data() {
  281. return {
  282. fields: [],
  283. potentialLabelWidthArr: [] // use this array to calculate auto width
  284. };
  285. },
  286. created: function created() {
  287. var _this = this;
  288. this.$on('el.form.addField', function (field) {
  289. if (field) {
  290. _this.fields.push(field);
  291. }
  292. });
  293. /* istanbul ignore next */
  294. this.$on('el.form.removeField', function (field) {
  295. if (field.prop) {
  296. _this.fields.splice(_this.fields.indexOf(field), 1);
  297. }
  298. });
  299. },
  300. methods: {
  301. resetFields: function resetFields() {
  302. if (!this.model) {
  303. console.warn('[Tis Warn][Form]model is required for resetFields to work.');
  304. return;
  305. }
  306. this.fields.forEach(function (field) {
  307. field.resetField();
  308. });
  309. },
  310. clearValidate: function clearValidate() {
  311. var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  312. var fields = props.length ? typeof props === 'string' ? this.fields.filter(function (field) {
  313. return props === field.prop;
  314. }) : this.fields.filter(function (field) {
  315. return props.indexOf(field.prop) > -1;
  316. }) : this.fields;
  317. fields.forEach(function (field) {
  318. field.clearValidate();
  319. });
  320. },
  321. validate: function validate(callback) {
  322. var _this2 = this;
  323. if (!this.model) {
  324. console.warn('[Element Warn][Form]model is required for validate to work!');
  325. return;
  326. }
  327. var promise = void 0;
  328. // if no callback, return promise
  329. if (typeof callback !== 'function' && window.Promise) {
  330. promise = new window.Promise(function (resolve, reject) {
  331. /* eslint-disable */
  332. callback = function callback(valid) {
  333. valid ? resolve(valid) : reject(valid);
  334. };
  335. });
  336. }
  337. var valid = true;
  338. var count = 0;
  339. // 如果需要验证的fields为空,调用验证时立刻返回callback
  340. if (this.fields.length === 0 && callback) {
  341. callback(true);
  342. }
  343. var invalidFields = {};
  344. this.fields.forEach(function (field) {
  345. field.validate('', function (message, field) {
  346. if (message) {
  347. valid = false;
  348. }
  349. invalidFields = merge_default()({}, invalidFields, field);
  350. if (typeof callback === 'function' && ++count === _this2.fields.length) {
  351. callback(valid, invalidFields);
  352. }
  353. });
  354. });
  355. if (promise) {
  356. return promise;
  357. }
  358. },
  359. validateField: function validateField(props, cb) {
  360. props = [].concat(props);
  361. var fields = this.fields.filter(function (field) {
  362. return props.indexOf(field.prop) !== -1;
  363. });
  364. if (!fields.length) {
  365. console.warn('[Element Warn]please pass correct props!');
  366. return;
  367. }
  368. fields.forEach(function (field) {
  369. field.validate('', cb);
  370. });
  371. },
  372. getLabelWidthIndex: function getLabelWidthIndex(width) {
  373. var index = this.potentialLabelWidthArr.indexOf(width);
  374. // it's impossible
  375. if (index === -1) {
  376. throw new Error('[ElementForm]unpected width ', width);
  377. }
  378. return index;
  379. },
  380. registerLabelWidth: function registerLabelWidth(val, oldVal) {
  381. if (val && oldVal) {
  382. var index = this.getLabelWidthIndex(oldVal);
  383. this.potentialLabelWidthArr.splice(index, 1, val);
  384. } else if (val) {
  385. this.potentialLabelWidthArr.push(val);
  386. }
  387. },
  388. deregisterLabelWidth: function deregisterLabelWidth(val) {
  389. var index = this.getLabelWidthIndex(val);
  390. this.potentialLabelWidthArr.splice(index, 1);
  391. }
  392. }
  393. });
  394. // CONCATENATED MODULE: ./packages/form/src/form.vue?vue&type=script&lang=js&
  395. /* harmony default export */ var src_formvue_type_script_lang_js_ = (formvue_type_script_lang_js_);
  396. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  397. var componentNormalizer = __webpack_require__(2);
  398. // CONCATENATED MODULE: ./packages/form/src/form.vue
  399. /* normalize component */
  400. var component = Object(componentNormalizer["a" /* default */])(
  401. src_formvue_type_script_lang_js_,
  402. render,
  403. staticRenderFns,
  404. false,
  405. null,
  406. null,
  407. null
  408. )
  409. /* hot reload */
  410. if (false) { var api; }
  411. component.options.__file = "packages/form/src/form.vue"
  412. /* harmony default export */ var src_form = (component.exports);
  413. // CONCATENATED MODULE: ./packages/form/index.js
  414. /* istanbul ignore next */
  415. src_form.install = function (Vue) {
  416. Vue.component(src_form.name, src_form);
  417. };
  418. /* harmony default export */ var packages_form = __webpack_exports__["default"] = (src_form);
  419. /***/ })
  420. /******/ });