index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/ // Check if module is in cache
  8. /******/ if(installedModules[moduleId])
  9. /******/ return installedModules[moduleId].exports;
  10. /******/ // Create a new module (and put it into the cache)
  11. /******/ var module = installedModules[moduleId] = {
  12. /******/ i: moduleId,
  13. /******/ l: false,
  14. /******/ exports: {}
  15. /******/ };
  16. /******/ // Execute the module function
  17. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  18. /******/ // Flag the module as loaded
  19. /******/ module.l = true;
  20. /******/ // Return the exports of the module
  21. /******/ return module.exports;
  22. /******/ }
  23. /******/ // expose the modules object (__webpack_modules__)
  24. /******/ __webpack_require__.m = modules;
  25. /******/ // expose the module cache
  26. /******/ __webpack_require__.c = installedModules;
  27. /******/ // identity function for calling harmony imports with the correct context
  28. /******/ __webpack_require__.i = function(value) { return value; };
  29. /******/ // define getter function for harmony exports
  30. /******/ __webpack_require__.d = function(exports, name, getter) {
  31. /******/ if(!__webpack_require__.o(exports, name)) {
  32. /******/ Object.defineProperty(exports, name, {
  33. /******/ configurable: false,
  34. /******/ enumerable: true,
  35. /******/ get: getter
  36. /******/ });
  37. /******/ }
  38. /******/ };
  39. /******/ // getDefaultExport function for compatibility with non-harmony modules
  40. /******/ __webpack_require__.n = function(module) {
  41. /******/ var getter = module && module.__esModule ?
  42. /******/ function getDefault() { return module['default']; } :
  43. /******/ function getModuleExports() { return module; };
  44. /******/ __webpack_require__.d(getter, 'a', getter);
  45. /******/ return getter;
  46. /******/ };
  47. /******/ // Object.prototype.hasOwnProperty.call
  48. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  49. /******/ // __webpack_public_path__
  50. /******/ __webpack_require__.p = "";
  51. /******/ // Load entry module and return exports
  52. /******/ return __webpack_require__(__webpack_require__.s = 216);
  53. /******/ })
  54. /************************************************************************/
  55. /******/ ({
  56. /***/ 0:
  57. /***/ function(module, exports) {
  58. /* globals __VUE_SSR_CONTEXT__ */
  59. // this module is a runtime utility for cleaner component module output and will
  60. // be included in the final webpack user bundle
  61. module.exports = function normalizeComponent (
  62. rawScriptExports,
  63. compiledTemplate,
  64. injectStyles,
  65. scopeId,
  66. moduleIdentifier /* server only */
  67. ) {
  68. var esModule
  69. var scriptExports = rawScriptExports = rawScriptExports || {}
  70. // ES6 modules interop
  71. var type = typeof rawScriptExports.default
  72. if (type === 'object' || type === 'function') {
  73. esModule = rawScriptExports
  74. scriptExports = rawScriptExports.default
  75. }
  76. // Vue.extend constructor export interop
  77. var options = typeof scriptExports === 'function'
  78. ? scriptExports.options
  79. : scriptExports
  80. // render functions
  81. if (compiledTemplate) {
  82. options.render = compiledTemplate.render
  83. options.staticRenderFns = compiledTemplate.staticRenderFns
  84. }
  85. // scopedId
  86. if (scopeId) {
  87. options._scopeId = scopeId
  88. }
  89. var hook
  90. if (moduleIdentifier) { // server build
  91. hook = function (context) {
  92. // 2.3 injection
  93. context =
  94. context || // cached call
  95. (this.$vnode && this.$vnode.ssrContext) || // stateful
  96. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  97. // 2.2 with runInNewContext: true
  98. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  99. context = __VUE_SSR_CONTEXT__
  100. }
  101. // inject component styles
  102. if (injectStyles) {
  103. injectStyles.call(this, context)
  104. }
  105. // register component module identifier for async chunk inferrence
  106. if (context && context._registeredComponents) {
  107. context._registeredComponents.add(moduleIdentifier)
  108. }
  109. }
  110. // used by ssr in case component is cached and beforeCreate
  111. // never gets called
  112. options._ssrRegister = hook
  113. } else if (injectStyles) {
  114. hook = injectStyles
  115. }
  116. if (hook) {
  117. var functional = options.functional
  118. var existing = functional
  119. ? options.render
  120. : options.beforeCreate
  121. if (!functional) {
  122. // inject component registration as beforeCreate hook
  123. options.beforeCreate = existing
  124. ? [].concat(existing, hook)
  125. : [hook]
  126. } else {
  127. // register for functioal component in vue file
  128. options.render = function renderWithStyleInjection (h, context) {
  129. hook.call(context)
  130. return existing(h, context)
  131. }
  132. }
  133. }
  134. return {
  135. esModule: esModule,
  136. exports: scriptExports,
  137. options: options
  138. }
  139. }
  140. /***/ },
  141. /***/ 119:
  142. /***/ function(module, exports) {
  143. // removed by extract-text-webpack-plugin
  144. /***/ },
  145. /***/ 12:
  146. /***/ function(module, exports, __webpack_require__) {
  147. "use strict";
  148. /**
  149. * v-clickoutside
  150. * @desc 点击元素外面才会触发的事件
  151. * @example
  152. * ```vue
  153. * <div v-element-clickoutside="handleClose">
  154. * ```
  155. */
  156. var clickoutsideContext = '@@clickoutsideContext';
  157. /* harmony default export */ exports["a"] = {
  158. bind: function bind(el, binding, vnode) {
  159. var documentHandler = function(e) {
  160. if (vnode.context && !el.contains(e.target)) {
  161. vnode.context[el[clickoutsideContext].methodName]();
  162. }
  163. };
  164. el[clickoutsideContext] = {
  165. documentHandler: documentHandler,
  166. methodName: binding.expression,
  167. arg: binding.arg || 'click'
  168. };
  169. document.addEventListener(el[clickoutsideContext].arg, documentHandler);
  170. },
  171. update: function update(el, binding) {
  172. el[clickoutsideContext].methodName = binding.expression;
  173. },
  174. unbind: function unbind(el) {
  175. document.removeEventListener(
  176. el[clickoutsideContext].arg,
  177. el[clickoutsideContext].documentHandler);
  178. },
  179. install: function install(Vue) {
  180. Vue.directive('clickoutside', {
  181. bind: this.bind,
  182. unbind: this.unbind
  183. });
  184. }
  185. };
  186. /***/ },
  187. /***/ 137:
  188. /***/ function(module, exports, __webpack_require__) {
  189. function injectStyle (ssrContext) {
  190. __webpack_require__(119)
  191. }
  192. var Component = __webpack_require__(0)(
  193. /* script */
  194. __webpack_require__(59),
  195. /* template */
  196. __webpack_require__(188),
  197. /* styles */
  198. injectStyle,
  199. /* scopeId */
  200. null,
  201. /* moduleIdentifier (server only) */
  202. null
  203. )
  204. module.exports = Component.exports
  205. /***/ },
  206. /***/ 188:
  207. /***/ function(module, exports) {
  208. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  209. return _c('x-cell', {
  210. directives: [{
  211. name: "clickoutside",
  212. rawName: "v-clickoutside",
  213. value: (_vm.doCloseActive),
  214. expression: "doCloseActive"
  215. }],
  216. staticClass: "mint-field",
  217. class: [{
  218. 'is-textarea': _vm.type === 'textarea',
  219. 'is-nolabel': !_vm.label
  220. }],
  221. attrs: {
  222. "title": _vm.label
  223. }
  224. }, [(_vm.type === 'textarea') ? _c('textarea', {
  225. directives: [{
  226. name: "model",
  227. rawName: "v-model",
  228. value: (_vm.currentValue),
  229. expression: "currentValue"
  230. }],
  231. ref: "textarea",
  232. staticClass: "mint-field-core",
  233. attrs: {
  234. "placeholder": _vm.placeholder,
  235. "rows": _vm.rows,
  236. "disabled": _vm.disabled,
  237. "readonly": _vm.readonly
  238. },
  239. domProps: {
  240. "value": (_vm.currentValue)
  241. },
  242. on: {
  243. "change": function($event) {
  244. _vm.$emit('change', _vm.currentValue)
  245. },
  246. "input": function($event) {
  247. if ($event.target.composing) { return; }
  248. _vm.currentValue = $event.target.value
  249. }
  250. }
  251. }) : _c('input', {
  252. ref: "input",
  253. staticClass: "mint-field-core",
  254. attrs: {
  255. "placeholder": _vm.placeholder,
  256. "number": _vm.type === 'number',
  257. "type": _vm.type,
  258. "disabled": _vm.disabled,
  259. "readonly": _vm.readonly
  260. },
  261. domProps: {
  262. "value": _vm.currentValue
  263. },
  264. on: {
  265. "change": function($event) {
  266. _vm.$emit('change', _vm.currentValue)
  267. },
  268. "focus": function($event) {
  269. _vm.active = true
  270. },
  271. "input": _vm.handleInput
  272. }
  273. }), _vm._v(" "), (!_vm.disableClear) ? _c('div', {
  274. directives: [{
  275. name: "show",
  276. rawName: "v-show",
  277. value: (_vm.currentValue && _vm.type !== 'textarea' && _vm.active),
  278. expression: "currentValue && type !== 'textarea' && active"
  279. }],
  280. staticClass: "mint-field-clear",
  281. on: {
  282. "click": _vm.handleClear
  283. }
  284. }, [_c('i', {
  285. staticClass: "mintui mintui-field-error"
  286. })]) : _vm._e(), _vm._v(" "), (_vm.state) ? _c('span', {
  287. staticClass: "mint-field-state",
  288. class: ['is-' + _vm.state]
  289. }, [_c('i', {
  290. staticClass: "mintui",
  291. class: ['mintui-field-' + _vm.state]
  292. })]) : _vm._e(), _vm._v(" "), _c('div', {
  293. staticClass: "mint-field-other"
  294. }, [_vm._t("default")], 2)])
  295. },staticRenderFns: []}
  296. /***/ },
  297. /***/ 216:
  298. /***/ function(module, exports, __webpack_require__) {
  299. module.exports = __webpack_require__(25);
  300. /***/ },
  301. /***/ 25:
  302. /***/ function(module, exports, __webpack_require__) {
  303. "use strict";
  304. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_field_vue__ = __webpack_require__(137);
  305. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_field_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_field_vue__);
  306. Object.defineProperty(exports, "__esModule", { value: true });
  307. /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_field_vue___default.a; });
  308. /***/ },
  309. /***/ 3:
  310. /***/ function(module, exports) {
  311. module.exports = require("mint-ui/lib/cell");
  312. /***/ },
  313. /***/ 4:
  314. /***/ function(module, exports) {
  315. module.exports = require("mint-ui/lib/cell/style.css");
  316. /***/ },
  317. /***/ 59:
  318. /***/ function(module, exports, __webpack_require__) {
  319. "use strict";
  320. Object.defineProperty(exports, "__esModule", { value: true });
  321. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_packages_cell_index_js__ = __webpack_require__(3);
  322. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_packages_cell_index_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_mint_ui_packages_cell_index_js__);
  323. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_clickoutside__ = __webpack_require__(12);
  324. //
  325. //
  326. //
  327. //
  328. //
  329. //
  330. //
  331. //
  332. //
  333. //
  334. //
  335. //
  336. //
  337. //
  338. //
  339. //
  340. //
  341. //
  342. //
  343. //
  344. //
  345. //
  346. //
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //
  353. //
  354. //
  355. //
  356. //
  357. //
  358. //
  359. //
  360. //
  361. //
  362. //
  363. //
  364. //
  365. //
  366. //
  367. //
  368. //
  369. //
  370. //
  371. //
  372. //
  373. if (true) {
  374. __webpack_require__(4);
  375. }
  376. /**
  377. * mt-field
  378. * @desc 编辑器,依赖 cell
  379. * @module components/field
  380. *
  381. * @param {string} [type=text] - field 类型,接受 text, textarea 等
  382. * @param {string} [label] - 标签
  383. * @param {string} [rows] - textarea 的 rows
  384. * @param {string} [placeholder] - placeholder
  385. * @param {string} [disabled] - disabled
  386. * @param {string} [readonly] - readonly
  387. * @param {string} [state] - 表单校验状态样式,接受 error, warning, success
  388. *
  389. * @example
  390. * <mt-field v-model="value" label="用户名"></mt-field>
  391. * <mt-field v-model="value" label="密码" placeholder="请输入密码"></mt-field>
  392. * <mt-field v-model="value" label="自我介绍" placeholder="自我介绍" type="textarea" rows="4"></mt-field>
  393. * <mt-field v-model="value" label="邮箱" placeholder="成功状态" state="success"></mt-field>
  394. */
  395. /* harmony default export */ exports["default"] = {
  396. name: 'mt-field',
  397. data: function data() {
  398. return {
  399. active: false,
  400. currentValue: this.value
  401. };
  402. },
  403. directives: {
  404. Clickoutside: __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_clickoutside__["a" /* default */]
  405. },
  406. props: {
  407. type: {
  408. type: String,
  409. default: 'text'
  410. },
  411. rows: String,
  412. label: String,
  413. placeholder: String,
  414. readonly: Boolean,
  415. disabled: Boolean,
  416. disableClear: Boolean,
  417. state: {
  418. type: String,
  419. default: 'default'
  420. },
  421. value: {},
  422. attr: Object
  423. },
  424. components: { XCell: __WEBPACK_IMPORTED_MODULE_0_mint_ui_packages_cell_index_js___default.a },
  425. methods: {
  426. doCloseActive: function doCloseActive() {
  427. this.active = false;
  428. },
  429. handleInput: function handleInput(evt) {
  430. this.currentValue = evt.target.value;
  431. },
  432. handleClear: function handleClear() {
  433. if (this.disabled || this.readonly) return;
  434. this.currentValue = '';
  435. }
  436. },
  437. watch: {
  438. value: function value(val) {
  439. this.currentValue = val;
  440. },
  441. currentValue: function currentValue(val) {
  442. this.$emit('input', val);
  443. },
  444. attr: {
  445. immediate: true,
  446. handler: function handler(attrs) {
  447. var this$1 = this;
  448. this.$nextTick(function () {
  449. var target = [this$1.$refs.input, this$1.$refs.textarea];
  450. target.forEach(function (el) {
  451. if (!el || !attrs) return;
  452. Object.keys(attrs).map(function (name) { return el.setAttribute(name, attrs[name]); });
  453. });
  454. });
  455. }
  456. }
  457. }
  458. };
  459. /***/ }
  460. /******/ });