@panpanzhao/component-ui 0.0.1

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.
@@ -0,0 +1,659 @@
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 = 60);
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ 0:
91
+ /***/ (function(module, exports) {
92
+
93
+ module.exports = require("@vue/babel-helper-vue-jsx-merge-props");
94
+
95
+ /***/ }),
96
+
97
+ /***/ 1:
98
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
99
+
100
+ "use strict";
101
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
102
+ /* globals __VUE_SSR_CONTEXT__ */
103
+
104
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
105
+ // This module is a runtime utility for cleaner component module output and will
106
+ // be included in the final webpack user bundle.
107
+
108
+ function normalizeComponent(
109
+ scriptExports,
110
+ render,
111
+ staticRenderFns,
112
+ functionalTemplate,
113
+ injectStyles,
114
+ scopeId,
115
+ moduleIdentifier /* server only */,
116
+ shadowMode /* vue-cli only */
117
+ ) {
118
+ // Vue.extend constructor export interop
119
+ var options =
120
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
121
+
122
+ // render functions
123
+ if (render) {
124
+ options.render = render
125
+ options.staticRenderFns = staticRenderFns
126
+ options._compiled = true
127
+ }
128
+
129
+ // functional template
130
+ if (functionalTemplate) {
131
+ options.functional = true
132
+ }
133
+
134
+ // scopedId
135
+ if (scopeId) {
136
+ options._scopeId = 'data-v-' + scopeId
137
+ }
138
+
139
+ var hook
140
+ if (moduleIdentifier) {
141
+ // server build
142
+ hook = function (context) {
143
+ // 2.3 injection
144
+ context =
145
+ context || // cached call
146
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
147
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
148
+ // 2.2 with runInNewContext: true
149
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
150
+ context = __VUE_SSR_CONTEXT__
151
+ }
152
+ // inject component styles
153
+ if (injectStyles) {
154
+ injectStyles.call(this, context)
155
+ }
156
+ // register component module identifier for async chunk inferrence
157
+ if (context && context._registeredComponents) {
158
+ context._registeredComponents.add(moduleIdentifier)
159
+ }
160
+ }
161
+ // used by ssr in case component is cached and beforeCreate
162
+ // never gets called
163
+ options._ssrRegister = hook
164
+ } else if (injectStyles) {
165
+ hook = shadowMode
166
+ ? function () {
167
+ injectStyles.call(
168
+ this,
169
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
170
+ )
171
+ }
172
+ : injectStyles
173
+ }
174
+
175
+ if (hook) {
176
+ if (options.functional) {
177
+ // for template-only hot-reload because in that case the render fn doesn't
178
+ // go through the normalizer
179
+ options._injectStyles = hook
180
+ // register for functional component in vue file
181
+ var originalRender = options.render
182
+ options.render = function renderWithStyleInjection(h, context) {
183
+ hook.call(context)
184
+ return originalRender(h, context)
185
+ }
186
+ } else {
187
+ // inject component registration as beforeCreate hook
188
+ var existing = options.beforeCreate
189
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
190
+ }
191
+ }
192
+
193
+ return {
194
+ exports: scriptExports,
195
+ options: options
196
+ }
197
+ }
198
+
199
+
200
+ /***/ }),
201
+
202
+ /***/ 11:
203
+ /***/ (function(module, exports) {
204
+
205
+ module.exports = require("element-ui/lib/table-column");
206
+
207
+ /***/ }),
208
+
209
+ /***/ 2:
210
+ /***/ (function(module, exports) {
211
+
212
+ module.exports = require("component-ui/lib/utils/formula");
213
+
214
+ /***/ }),
215
+
216
+ /***/ 22:
217
+ /***/ (function(module, exports) {
218
+
219
+ module.exports = require("component-ui/lib/components/table-column");
220
+
221
+ /***/ }),
222
+
223
+ /***/ 24:
224
+ /***/ (function(module, exports) {
225
+
226
+ module.exports = require("element-ui/lib/table");
227
+
228
+ /***/ }),
229
+
230
+ /***/ 3:
231
+ /***/ (function(module, exports) {
232
+
233
+ module.exports = require("lodash");
234
+
235
+ /***/ }),
236
+
237
+ /***/ 4:
238
+ /***/ (function(module, exports) {
239
+
240
+ module.exports = require("element-ui/lib/button");
241
+
242
+ /***/ }),
243
+
244
+ /***/ 47:
245
+ /***/ (function(module, exports) {
246
+
247
+ module.exports = require("element-ui/lib/pagination");
248
+
249
+ /***/ }),
250
+
251
+ /***/ 60:
252
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
253
+
254
+ "use strict";
255
+ // ESM COMPAT FLAG
256
+ __webpack_require__.r(__webpack_exports__);
257
+
258
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./src/components/table/src/table.vue?vue&type=template&id=023195f2&
259
+ var tablevue_type_template_id_023195f2_render = function render() {
260
+ var _vm = this,
261
+ _c = _vm._self._c
262
+ return _c("div", { staticClass: "table" }, [
263
+ _c(
264
+ "div",
265
+ { staticClass: "table__tool" },
266
+ [
267
+ _vm._t(
268
+ "tools",
269
+ function () {
270
+ return [
271
+ _vm._l(_vm.tools, function (tool, index) {
272
+ return [
273
+ _c(
274
+ "Tool",
275
+ _vm._g(_vm._b({ key: index }, "Tool", tool, false), tool.on)
276
+ ),
277
+ ]
278
+ }),
279
+ ]
280
+ },
281
+ { selection: _vm.selection }
282
+ ),
283
+ ],
284
+ 2
285
+ ),
286
+ _c(
287
+ "div",
288
+ { staticClass: "table__body" },
289
+ [
290
+ _c(
291
+ "el-table",
292
+ _vm._g(
293
+ _vm._b({ ref: "table" }, "el-table", _vm.tableProps, false),
294
+ _vm.tableListeners
295
+ ),
296
+ [
297
+ _vm._l(_vm.columns, function (column) {
298
+ return [
299
+ _c(
300
+ "TableColumn",
301
+ _vm._g(
302
+ _vm._b(
303
+ { key: `${column.control}_${column.prop}` },
304
+ "TableColumn",
305
+ column,
306
+ false
307
+ ),
308
+ column.on
309
+ )
310
+ ),
311
+ ]
312
+ }),
313
+ ],
314
+ 2
315
+ ),
316
+ ],
317
+ 1
318
+ ),
319
+ _vm.pagination
320
+ ? _c(
321
+ "div",
322
+ { staticClass: "ad-table__pagination" },
323
+ [
324
+ _c(
325
+ "el-pagination",
326
+ _vm._g(
327
+ _vm._b({}, "el-pagination", _vm.paginationProps, false),
328
+ _vm.paginationListeners
329
+ )
330
+ ),
331
+ ],
332
+ 1
333
+ )
334
+ : _vm._e(),
335
+ ])
336
+ }
337
+ var staticRenderFns = []
338
+ tablevue_type_template_id_023195f2_render._withStripped = true
339
+
340
+
341
+ // CONCATENATED MODULE: ./src/components/table/src/table.vue?vue&type=template&id=023195f2&
342
+
343
+ // EXTERNAL MODULE: external "@vue/babel-helper-vue-jsx-merge-props"
344
+ var babel_helper_vue_jsx_merge_props_ = __webpack_require__(0);
345
+ var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props_);
346
+
347
+ // EXTERNAL MODULE: external "element-ui/lib/button"
348
+ var button_ = __webpack_require__(4);
349
+ var button_default = /*#__PURE__*/__webpack_require__.n(button_);
350
+
351
+ // EXTERNAL MODULE: external "element-ui/lib/table"
352
+ var table_ = __webpack_require__(24);
353
+ var table_default = /*#__PURE__*/__webpack_require__.n(table_);
354
+
355
+ // EXTERNAL MODULE: external "element-ui/lib/table-column"
356
+ var table_column_ = __webpack_require__(11);
357
+ var table_column_default = /*#__PURE__*/__webpack_require__.n(table_column_);
358
+
359
+ // EXTERNAL MODULE: external "element-ui/lib/pagination"
360
+ var pagination_ = __webpack_require__(47);
361
+ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
362
+
363
+ // EXTERNAL MODULE: external "component-ui/lib/components/table-column"
364
+ var components_table_column_ = __webpack_require__(22);
365
+ var components_table_column_default = /*#__PURE__*/__webpack_require__.n(components_table_column_);
366
+
367
+ // EXTERNAL MODULE: external "component-ui/lib/utils/formula"
368
+ var formula_ = __webpack_require__(2);
369
+
370
+ // EXTERNAL MODULE: external "lodash"
371
+ var external_lodash_ = __webpack_require__(3);
372
+
373
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/table/src/table.vue?vue&type=script&lang=js&
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ /* harmony default export */ var tablevue_type_script_lang_js_ = ({
383
+ name: "Table",
384
+ componentName: "Table",
385
+ components: {
386
+ elButton: button_default.a,
387
+ elTable: table_default.a,
388
+ elPagination: pagination_default.a,
389
+ elTableColumn: table_column_default.a,
390
+ TableColumn: components_table_column_default.a,
391
+ Tool: {
392
+ components: {
393
+ elButton: button_default.a
394
+ },
395
+ props: {
396
+ label: String,
397
+ show: {
398
+ type: [Boolean, Function],
399
+ default: true
400
+ },
401
+ on: Object,
402
+ render: Function
403
+ },
404
+ computed: {
405
+ attrs: function attrs() {
406
+ return Object.assign({
407
+ type: "primary",
408
+ size: "mini"
409
+ }, this.$attrs);
410
+ }
411
+ },
412
+ data: function data() {
413
+ return {
414
+ loading: this.$attrs.loading
415
+ };
416
+ },
417
+ render: function render(h) {
418
+ var _this = this;
419
+ if (this.show === false) {
420
+ return null;
421
+ }
422
+ if (typeof this.show === "function" && !this.show.call(this, this.$parent.selection, this)) {
423
+ return null;
424
+ }
425
+ if (typeof this.render === "function") {
426
+ return this.render(h, this.$parent.selection, this);
427
+ }
428
+ var param = {
429
+ attrs: this.attrs,
430
+ on: {
431
+ click: function click(event) {
432
+ if (typeof _this.$listeners.click === "function") {
433
+ _this.$listeners.click.call(event, _this.$parent.selection, _this);
434
+ }
435
+ }
436
+ }
437
+ };
438
+ return h("el-button", babel_helper_vue_jsx_merge_props_default()([{}, param, {
439
+ "attrs": {
440
+ "loading": this.loading
441
+ }
442
+ }]), [this.label]);
443
+ }
444
+ }
445
+ },
446
+ provide: function provide() {
447
+ return {
448
+ table: this
449
+ };
450
+ },
451
+ props: {
452
+ data: {
453
+ type: Array,
454
+ default: function _default() {
455
+ return null;
456
+ }
457
+ },
458
+ api: Object,
459
+ remoteProp: {
460
+ type: Object,
461
+ default: function _default() {
462
+ return {
463
+ data: "list",
464
+ currentPage: "page",
465
+ pageSize: "pageSize",
466
+ total: "total"
467
+ };
468
+ }
469
+ },
470
+ dataSource: Object,
471
+ columns: {
472
+ type: Array,
473
+ default: function _default() {
474
+ return [];
475
+ }
476
+ },
477
+ beforeSearch: Function,
478
+ pagination: {
479
+ type: [Boolean, Object],
480
+ default: function _default() {
481
+ return false;
482
+ }
483
+ },
484
+ tools: {
485
+ type: Array,
486
+ default: function _default() {
487
+ return [];
488
+ }
489
+ },
490
+ on: {
491
+ type: Object,
492
+ default: function _default() {
493
+ return {};
494
+ }
495
+ }
496
+ },
497
+ data: function data() {
498
+ return {
499
+ rowId: null,
500
+ selection: [],
501
+ remoteData: null,
502
+ currentPage: 1,
503
+ pageSize: 10,
504
+ total: 0
505
+ };
506
+ },
507
+ watch: {
508
+ remoteData: function remoteData() {
509
+ this.rowId = null;
510
+ this.selection = [];
511
+ }
512
+ },
513
+ computed: {
514
+ tableSource: function tableSource() {
515
+ return this.data || this.remoteData || [];
516
+ },
517
+ tableProps: function tableProps() {
518
+ return Object.assign({
519
+ highlightCurrentRow: true,
520
+ stripe: true,
521
+ defaultExpandAll: true,
522
+ size: "mini",
523
+ rowKey: "id"
524
+ }, this.$attrs, {
525
+ data: this.tableSource
526
+ });
527
+ },
528
+ tableListeners: function tableListeners() {
529
+ var _this2 = this;
530
+ return Object.assign({}, this.$listeners, {
531
+ "row-click": function rowClick(row) {
532
+ var selectColumns = _this2.columns.filter(function (item) {
533
+ return item.control === "Selection";
534
+ });
535
+ if (selectColumns && selectColumns.length > 0) {
536
+ var selectColumn = selectColumns[0];
537
+ if (selectColumn.type === "radio") {
538
+ var key = selectColumn.prop || _this2.tableProps.rowKey;
539
+ _this2.rowId = row[key];
540
+ _this2.selection = [row];
541
+ } else {
542
+ _this2.$refs.table.toggleRowSelection(row); // 点击选中
543
+ }
544
+ }
545
+
546
+ _this2.$emit("row-click", row);
547
+ },
548
+ "selection-change": function selectionChange(selection) {
549
+ _this2.selection = selection;
550
+ _this2.$emit("selection-change", selection);
551
+ }
552
+ });
553
+ },
554
+ paginationProps: function paginationProps() {
555
+ return Object.assign({
556
+ background: true,
557
+ // hideOnSinglePage: true,
558
+ align: "right",
559
+ size: "mini",
560
+ layout: "total, prev, pager, next, slot"
561
+ }, this.pagination, {
562
+ total: this.total,
563
+ pageSize: this.pageSize,
564
+ currentPage: this.currentPage
565
+ });
566
+ },
567
+ paginationListeners: function paginationListeners() {
568
+ var _this3 = this;
569
+ return Object.assign({}, this.pagination.on, {
570
+ "size-change": function sizeChange(pageSize) {
571
+ _this3.$emit("size-change", pageSize);
572
+ _this3.pageSize = pageSize;
573
+ _this3.$emit("pageChange", _this3.paginationProps.currentPage, pageSize);
574
+ _this3.search();
575
+ },
576
+ "current-change": function currentChange(currentPage) {
577
+ _this3.$emit("current-change", currentPage);
578
+ _this3.currentPage = currentPage;
579
+ _this3.$emit("pageChange", currentPage, _this3.paginationProps.pageSize);
580
+ _this3.search();
581
+ }
582
+ });
583
+ }
584
+ },
585
+ mounted: function mounted() {
586
+ //this.reset()
587
+ },
588
+ methods: {
589
+ reset: function reset() {
590
+ this.currentPage = 1;
591
+ this.search();
592
+ },
593
+ search: function search() {
594
+ var _this4 = this;
595
+ if (!(this.api && this.api.url && this.api.request)) {
596
+ return false;
597
+ }
598
+ var requestData = Object.assign({}, this.api.data);
599
+ if (this.pagination) {
600
+ Object(external_lodash_["set"])(requestData, this.remoteProp.currentPage, this.currentPage);
601
+ Object(external_lodash_["set"])(requestData, this.remoteProp.pageSize, this.pageSize);
602
+ }
603
+ if (typeof this.beforeSearch === "function") {
604
+ requestData = this.beforeSearch.call(this, requestData);
605
+ }
606
+ this.$emit("loadingChange", true);
607
+ this.api.request({
608
+ url: Object(formula_["evaluate"])(this.api.url, requestData),
609
+ method: this.api.method || "POST",
610
+ data: requestData
611
+ }).then(function (res) {
612
+ _this4.$emit("loadingChange", false);
613
+ _this4.remoteData = Object(external_lodash_["get"])(res, _this4.remoteProp.data, []);
614
+ if (_this4.pagination) {
615
+ _this4.total = Object(external_lodash_["get"])(res, _this4.remoteProp.total, []);
616
+ }
617
+ }).catch(function (error) {
618
+ _this4.$emit("loadingChange", false);
619
+ _this4.remoteData = [], _this4.total = 0;
620
+ });
621
+ }
622
+ }
623
+ });
624
+ // CONCATENATED MODULE: ./src/components/table/src/table.vue?vue&type=script&lang=js&
625
+ /* harmony default export */ var src_tablevue_type_script_lang_js_ = (tablevue_type_script_lang_js_);
626
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
627
+ var componentNormalizer = __webpack_require__(1);
628
+
629
+ // CONCATENATED MODULE: ./src/components/table/src/table.vue
630
+
631
+
632
+
633
+
634
+
635
+ /* normalize component */
636
+
637
+ var component = Object(componentNormalizer["a" /* default */])(
638
+ src_tablevue_type_script_lang_js_,
639
+ tablevue_type_template_id_023195f2_render,
640
+ staticRenderFns,
641
+ false,
642
+ null,
643
+ null,
644
+ null
645
+
646
+ )
647
+
648
+ /* harmony default export */ var table = (component.exports);
649
+ // CONCATENATED MODULE: ./src/components/table/index.js
650
+
651
+ /* istanbul ignore next */
652
+ table.install = function (Vue) {
653
+ Vue.component(table.name, table);
654
+ };
655
+ /* harmony default export */ var components_table = __webpack_exports__["default"] = (table);
656
+
657
+ /***/ })
658
+
659
+ /******/ });