@idooel/components 0.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.
@@ -0,0 +1,1813 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('moment'), require('@idooel/shared')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'moment', '@idooel/shared'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.__ele__components__ = {}, global.moment, global.shared));
5
+ })(this, (function (exports, moment, shared) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
10
+
11
+ //
12
+ //
13
+ //
14
+ //
15
+ //
16
+ //
17
+
18
+ var script$b = {
19
+ name: 'ele-button',
20
+ props: {
21
+ type: {
22
+ type: String,
23
+ default: 'default'
24
+ },
25
+ icon: {
26
+ type: String
27
+ }
28
+ },
29
+ methods: {
30
+ handleClick() {
31
+ this.$emit('click');
32
+ }
33
+ }
34
+ };
35
+
36
+ function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
37
+ if (typeof shadowMode !== 'boolean') {
38
+ createInjectorSSR = createInjector;
39
+ createInjector = shadowMode;
40
+ shadowMode = false;
41
+ }
42
+ // Vue.extend constructor export interop.
43
+ const options = typeof script === 'function' ? script.options : script;
44
+ // render functions
45
+ if (template && template.render) {
46
+ options.render = template.render;
47
+ options.staticRenderFns = template.staticRenderFns;
48
+ options._compiled = true;
49
+ // functional template
50
+ if (isFunctionalTemplate) {
51
+ options.functional = true;
52
+ }
53
+ }
54
+ // scopedId
55
+ if (scopeId) {
56
+ options._scopeId = scopeId;
57
+ }
58
+ let hook;
59
+ if (moduleIdentifier) {
60
+ // server build
61
+ hook = function (context) {
62
+ // 2.3 injection
63
+ context = context ||
64
+ // cached call
65
+ this.$vnode && this.$vnode.ssrContext ||
66
+ // stateful
67
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
68
+ // 2.2 with runInNewContext: true
69
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
70
+ context = __VUE_SSR_CONTEXT__;
71
+ }
72
+ // inject component styles
73
+ if (style) {
74
+ style.call(this, createInjectorSSR(context));
75
+ }
76
+ // register component module identifier for async chunk inference
77
+ if (context && context._registeredComponents) {
78
+ context._registeredComponents.add(moduleIdentifier);
79
+ }
80
+ };
81
+ // used by ssr in case component is cached and beforeCreate
82
+ // never gets called
83
+ options._ssrRegister = hook;
84
+ } else if (style) {
85
+ hook = shadowMode ? function (context) {
86
+ style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
87
+ } : function (context) {
88
+ style.call(this, createInjector(context));
89
+ };
90
+ }
91
+ if (hook) {
92
+ if (options.functional) {
93
+ // register for functional component in vue file
94
+ const originalRender = options.render;
95
+ options.render = function renderWithStyleInjection(h, context) {
96
+ hook.call(context);
97
+ return originalRender(h, context);
98
+ };
99
+ } else {
100
+ // inject component registration as beforeCreate hook
101
+ const existing = options.beforeCreate;
102
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
103
+ }
104
+ }
105
+ return script;
106
+ }
107
+
108
+ /* script */
109
+ const __vue_script__$b = script$b;
110
+
111
+ /* template */
112
+ var __vue_render__$b = function () {
113
+ var _vm = this;
114
+ var _h = _vm.$createElement;
115
+ var _c = _vm._self._c || _h;
116
+ return _c(
117
+ "a-button",
118
+ {
119
+ attrs: { type: _vm.type, icon: _vm.icon },
120
+ on: { click: _vm.handleClick },
121
+ },
122
+ [_vm._t("default")],
123
+ 2
124
+ )
125
+ };
126
+ var __vue_staticRenderFns__$b = [];
127
+ __vue_render__$b._withStripped = true;
128
+
129
+ /* style */
130
+ const __vue_inject_styles__$b = undefined;
131
+ /* scoped */
132
+ const __vue_scope_id__$b = undefined;
133
+ /* module identifier */
134
+ const __vue_module_identifier__$b = undefined;
135
+ /* functional template */
136
+ const __vue_is_functional_template__$b = false;
137
+ /* style inject */
138
+
139
+ /* style inject SSR */
140
+
141
+ /* style inject shadow dom */
142
+
143
+
144
+
145
+ const __vue_component__$b = /*#__PURE__*/normalizeComponent(
146
+ { render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b },
147
+ __vue_inject_styles__$b,
148
+ __vue_script__$b,
149
+ __vue_scope_id__$b,
150
+ __vue_is_functional_template__$b,
151
+ __vue_module_identifier__$b,
152
+ false,
153
+ undefined,
154
+ undefined,
155
+ undefined
156
+ );
157
+
158
+ __vue_component__$b.install = Vue => Vue.component(__vue_component__$b.name, __vue_component__$b);
159
+
160
+ //
161
+ //
162
+ //
163
+ //
164
+ //
165
+ //
166
+ //
167
+ //
168
+ //
169
+ //
170
+ //
171
+ //
172
+
173
+ var script$a = {
174
+ name: 'ele-date',
175
+ props: {
176
+ value: {
177
+ type: Object
178
+ },
179
+ format: {
180
+ type: String,
181
+ default: 'YYYY/MM/DD'
182
+ }
183
+ },
184
+ data() {
185
+ return {
186
+ open: false
187
+ };
188
+ },
189
+ methods: {
190
+ onFocus() {
191
+ this.open = true;
192
+ },
193
+ onPanelChange(value, mode) {
194
+ this.$emit('input', value);
195
+ this.open = false;
196
+ }
197
+ }
198
+ };
199
+
200
+ /* script */
201
+ const __vue_script__$a = script$a;
202
+
203
+ /* template */
204
+ var __vue_render__$a = function () {
205
+ var _vm = this;
206
+ var _h = _vm.$createElement;
207
+ var _c = _vm._self._c || _h;
208
+ return _c("a-date-picker", {
209
+ staticStyle: { width: "100%" },
210
+ attrs: {
211
+ mode: "year",
212
+ open: _vm.open,
213
+ value: _vm.value,
214
+ format: _vm.format,
215
+ },
216
+ on: { focus: _vm.onFocus, panelChange: _vm.onPanelChange },
217
+ })
218
+ };
219
+ var __vue_staticRenderFns__$a = [];
220
+ __vue_render__$a._withStripped = true;
221
+
222
+ /* style */
223
+ const __vue_inject_styles__$a = undefined;
224
+ /* scoped */
225
+ const __vue_scope_id__$a = undefined;
226
+ /* module identifier */
227
+ const __vue_module_identifier__$a = undefined;
228
+ /* functional template */
229
+ const __vue_is_functional_template__$a = false;
230
+ /* style inject */
231
+
232
+ /* style inject SSR */
233
+
234
+ /* style inject shadow dom */
235
+
236
+
237
+
238
+ const __vue_component__$a = /*#__PURE__*/normalizeComponent(
239
+ { render: __vue_render__$a, staticRenderFns: __vue_staticRenderFns__$a },
240
+ __vue_inject_styles__$a,
241
+ __vue_script__$a,
242
+ __vue_scope_id__$a,
243
+ __vue_is_functional_template__$a,
244
+ __vue_module_identifier__$a,
245
+ false,
246
+ undefined,
247
+ undefined,
248
+ undefined
249
+ );
250
+
251
+ __vue_component__$a.install = Vue => Vue.component(__vue_component__$a.name, __vue_component__$a);
252
+
253
+ //
254
+ //
255
+ //
256
+ //
257
+
258
+ var script$9 = {
259
+ name: 'ele-input',
260
+ props: {
261
+ value: {
262
+ type: String
263
+ }
264
+ },
265
+ methods: {
266
+ onChange(e) {
267
+ this.$emit('change', e.target.value);
268
+ this.$emit('input', e.target.value);
269
+ }
270
+ }
271
+ };
272
+
273
+ const isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
274
+ function createInjector(context) {
275
+ return (id, style) => addStyle(id, style);
276
+ }
277
+ let HEAD;
278
+ const styles = {};
279
+ function addStyle(id, css) {
280
+ const group = isOldIE ? css.media || 'default' : id;
281
+ const style = styles[group] || (styles[group] = {
282
+ ids: new Set(),
283
+ styles: []
284
+ });
285
+ if (!style.ids.has(id)) {
286
+ style.ids.add(id);
287
+ let code = css.source;
288
+ if (css.map) {
289
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
290
+ // this makes source maps inside style tags work properly in Chrome
291
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
292
+ // http://stackoverflow.com/a/26603875
293
+ code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
294
+ }
295
+ if (!style.element) {
296
+ style.element = document.createElement('style');
297
+ style.element.type = 'text/css';
298
+ if (css.media) style.element.setAttribute('media', css.media);
299
+ if (HEAD === undefined) {
300
+ HEAD = document.head || document.getElementsByTagName('head')[0];
301
+ }
302
+ HEAD.appendChild(style.element);
303
+ }
304
+ if ('styleSheet' in style.element) {
305
+ style.styles.push(code);
306
+ style.element.styleSheet.cssText = style.styles.filter(Boolean).join('\n');
307
+ } else {
308
+ const index = style.ids.size - 1;
309
+ const textNode = document.createTextNode(code);
310
+ const nodes = style.element.childNodes;
311
+ if (nodes[index]) style.element.removeChild(nodes[index]);
312
+ if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
313
+ }
314
+ }
315
+ }
316
+
317
+ /* script */
318
+ const __vue_script__$9 = script$9;
319
+
320
+ /* template */
321
+ var __vue_render__$9 = function () {
322
+ var _vm = this;
323
+ var _h = _vm.$createElement;
324
+ var _c = _vm._self._c || _h;
325
+ return _c("a-input", {
326
+ attrs: { value: _vm.value },
327
+ on: { change: _vm.onChange },
328
+ })
329
+ };
330
+ var __vue_staticRenderFns__$9 = [];
331
+ __vue_render__$9._withStripped = true;
332
+
333
+ /* style */
334
+ const __vue_inject_styles__$9 = function (inject) {
335
+ if (!inject) return
336
+ inject("data-v-5fda0f1a_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: {"version":3,"sources":[],"names":[],"mappings":"","file":"index.vue"}, media: undefined });
337
+
338
+ };
339
+ /* scoped */
340
+ const __vue_scope_id__$9 = "data-v-5fda0f1a";
341
+ /* module identifier */
342
+ const __vue_module_identifier__$9 = undefined;
343
+ /* functional template */
344
+ const __vue_is_functional_template__$9 = false;
345
+ /* style inject SSR */
346
+
347
+ /* style inject shadow dom */
348
+
349
+
350
+
351
+ const __vue_component__$9 = /*#__PURE__*/normalizeComponent(
352
+ { render: __vue_render__$9, staticRenderFns: __vue_staticRenderFns__$9 },
353
+ __vue_inject_styles__$9,
354
+ __vue_script__$9,
355
+ __vue_scope_id__$9,
356
+ __vue_is_functional_template__$9,
357
+ __vue_module_identifier__$9,
358
+ false,
359
+ createInjector,
360
+ undefined,
361
+ undefined
362
+ );
363
+
364
+ __vue_component__$9.install = Vue => Vue.component(__vue_component__$9.name, __vue_component__$9);
365
+
366
+ //
367
+ //
368
+ //
369
+ //
370
+ //
371
+ //
372
+ //
373
+ //
374
+
375
+ var script$8 = {
376
+ name: 'ele-select',
377
+ props: {
378
+ value: {
379
+ type: [String, Array, Number]
380
+ },
381
+ defaultValue: {
382
+ type: [String, Array, Number]
383
+ },
384
+ dataSource: {
385
+ type: Array,
386
+ default: () => []
387
+ }
388
+ },
389
+ methods: {
390
+ onChange(value) {
391
+ this.$emit('change', value);
392
+ this.$emit('input', value);
393
+ }
394
+ }
395
+ };
396
+
397
+ /* script */
398
+ const __vue_script__$8 = script$8;
399
+
400
+ /* template */
401
+ var __vue_render__$8 = function () {
402
+ var _vm = this;
403
+ var _h = _vm.$createElement;
404
+ var _c = _vm._self._c || _h;
405
+ return _c(
406
+ "a-select",
407
+ {
408
+ staticStyle: { width: "100%" },
409
+ attrs: { value: _vm.value },
410
+ on: { change: _vm.onChange },
411
+ },
412
+ _vm._l(_vm.dataSource, function (item) {
413
+ return _c(
414
+ "a-select-option",
415
+ { key: item.value, attrs: { value: item.value } },
416
+ [_vm._v("\n " + _vm._s(item.label) + "\n ")]
417
+ )
418
+ }),
419
+ 1
420
+ )
421
+ };
422
+ var __vue_staticRenderFns__$8 = [];
423
+ __vue_render__$8._withStripped = true;
424
+
425
+ /* style */
426
+ const __vue_inject_styles__$8 = function (inject) {
427
+ if (!inject) return
428
+ inject("data-v-5e39810d_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
429
+
430
+ };
431
+ /* scoped */
432
+ const __vue_scope_id__$8 = "data-v-5e39810d";
433
+ /* module identifier */
434
+ const __vue_module_identifier__$8 = undefined;
435
+ /* functional template */
436
+ const __vue_is_functional_template__$8 = false;
437
+ /* style inject SSR */
438
+
439
+ /* style inject shadow dom */
440
+
441
+
442
+
443
+ const __vue_component__$8 = /*#__PURE__*/normalizeComponent(
444
+ { render: __vue_render__$8, staticRenderFns: __vue_staticRenderFns__$8 },
445
+ __vue_inject_styles__$8,
446
+ __vue_script__$8,
447
+ __vue_scope_id__$8,
448
+ __vue_is_functional_template__$8,
449
+ __vue_module_identifier__$8,
450
+ false,
451
+ createInjector,
452
+ undefined,
453
+ undefined
454
+ );
455
+
456
+ __vue_component__$8.install = Vue => Vue.component(__vue_component__$8.name, __vue_component__$8);
457
+
458
+ //
459
+ //
460
+ //
461
+ //
462
+ //
463
+ //
464
+ //
465
+ //
466
+ //
467
+ //
468
+
469
+ var script$7 = {
470
+ props: {
471
+ record: {
472
+ type: Object
473
+ },
474
+ dataSource: {
475
+ type: Array,
476
+ default: () => []
477
+ }
478
+ },
479
+ methods: {
480
+ handleClickText(props) {
481
+ const {
482
+ eventName,
483
+ key
484
+ } = props;
485
+ this.$emit(eventName, {
486
+ key,
487
+ record: this.record
488
+ });
489
+ }
490
+ }
491
+ };
492
+
493
+ /* script */
494
+ const __vue_script__$7 = script$7;
495
+
496
+ /* template */
497
+ var __vue_render__$7 = function () {
498
+ var _vm = this;
499
+ var _h = _vm.$createElement;
500
+ var _c = _vm._self._c || _h;
501
+ return _c(
502
+ "div",
503
+ { staticClass: "g-table__action" },
504
+ _vm._l(_vm.dataSource, function (item, idx) {
505
+ return _c(
506
+ "div",
507
+ { key: idx, staticClass: "table-action__item" },
508
+ [
509
+ item.type == "text"
510
+ ? [
511
+ _c(
512
+ "span",
513
+ {
514
+ on: {
515
+ click: function ($event) {
516
+ return _vm.handleClickText(item)
517
+ },
518
+ },
519
+ },
520
+ [_vm._v(_vm._s(item.label))]
521
+ ),
522
+ ]
523
+ : _vm._e(),
524
+ ],
525
+ 2
526
+ )
527
+ }),
528
+ 0
529
+ )
530
+ };
531
+ var __vue_staticRenderFns__$7 = [];
532
+ __vue_render__$7._withStripped = true;
533
+
534
+ /* style */
535
+ const __vue_inject_styles__$7 = function (inject) {
536
+ if (!inject) return
537
+ inject("data-v-bea55e74_0", { source: ".g-table__action[data-v-bea55e74] {\n display: flex;\n flex-direction: row;\n}\n.g-table__action .table-action__item[data-v-bea55e74] {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n}\n.g-table__action .table-action__item[data-v-bea55e74]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=action.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/table/src/action.vue","action.vue"],"names":[],"mappings":"AA+BA;EACA,aAAA;EACA,mBAAA;AC9BA;AD+BA;EACA,eAAA;EACA,cAAA;EACA,iBAAA;EACA,eAAA;AC7BA;AD8BA;EACA,cAAA;AC5BA;;AAEA,qCAAqC","file":"action.vue","sourcesContent":["<template>\n <div class=\"g-table__action\">\n <div class=\"table-action__item\" v-for=\"(item, idx) in dataSource\" :key=\"idx\">\n <template v-if=\"item.type == 'text'\">\n <span @click=\"handleClickText(item)\">{{ item.label }}</span>\n </template>\n </div>\n </div>\n</template>\n\n<script>\nexport default {\n props: {\n record: {\n type: Object\n },\n dataSource: {\n type: Array,\n default: () => []\n }\n },\n methods: {\n handleClickText (props) {\n const { eventName, key } = props\n this.$emit(eventName, { key, record: this.record })\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.g-table__action {\n display: flex;\n flex-direction: row;\n .table-action__item {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n &:first-child {\n margin-left: 0;\n }\n }\n}\n</style>",".g-table__action {\n display: flex;\n flex-direction: row;\n}\n.g-table__action .table-action__item {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n}\n.g-table__action .table-action__item:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=action.vue.map */"]}, media: undefined });
538
+
539
+ };
540
+ /* scoped */
541
+ const __vue_scope_id__$7 = "data-v-bea55e74";
542
+ /* module identifier */
543
+ const __vue_module_identifier__$7 = undefined;
544
+ /* functional template */
545
+ const __vue_is_functional_template__$7 = false;
546
+ /* style inject SSR */
547
+
548
+ /* style inject shadow dom */
549
+
550
+
551
+
552
+ const __vue_component__$7 = /*#__PURE__*/normalizeComponent(
553
+ { render: __vue_render__$7, staticRenderFns: __vue_staticRenderFns__$7 },
554
+ __vue_inject_styles__$7,
555
+ __vue_script__$7,
556
+ __vue_scope_id__$7,
557
+ __vue_is_functional_template__$7,
558
+ __vue_module_identifier__$7,
559
+ false,
560
+ createInjector,
561
+ undefined,
562
+ undefined
563
+ );
564
+
565
+ //
566
+ var script$6 = {
567
+ name: 'ele-table',
568
+ components: {
569
+ Actions: __vue_component__$7
570
+ },
571
+ props: {
572
+ actions: {
573
+ type: Array,
574
+ default: () => []
575
+ },
576
+ total: {
577
+ type: Number,
578
+ default: 0
579
+ },
580
+ loading: {
581
+ type: Boolean,
582
+ default: false
583
+ },
584
+ columns: {
585
+ type: Array,
586
+ default: () => []
587
+ },
588
+ dataSource: {
589
+ type: Array,
590
+ default: () => []
591
+ },
592
+ pageSize: {
593
+ type: Number,
594
+ default: 10
595
+ },
596
+ pageSizeOptions: {
597
+ type: Array,
598
+ default: () => ['10', '20', '30', '40']
599
+ }
600
+ },
601
+ methods: {
602
+ setRowClassName(record, idx) {
603
+ return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd';
604
+ },
605
+ onChangePagination(page, pagrSize) {
606
+ this.$emit('change-page', page, pagrSize);
607
+ }
608
+ }
609
+ };
610
+
611
+ /* script */
612
+ const __vue_script__$6 = script$6;
613
+
614
+ /* template */
615
+ var __vue_render__$6 = function () {
616
+ var _vm = this;
617
+ var _h = _vm.$createElement;
618
+ var _c = _vm._self._c || _h;
619
+ return _c(
620
+ "div",
621
+ { staticClass: "g-table__wrapper" },
622
+ [
623
+ _c("a-table", {
624
+ attrs: {
625
+ pagination: false,
626
+ loading: _vm.loading,
627
+ columns: _vm.columns,
628
+ "row-class-name": _vm.setRowClassName,
629
+ "data-source": _vm.dataSource,
630
+ scroll: { x: 1500, y: 500 },
631
+ },
632
+ scopedSlots: _vm._u([
633
+ {
634
+ key: "action",
635
+ fn: function (record) {
636
+ return [
637
+ _c(
638
+ "Actions",
639
+ _vm._g(
640
+ { attrs: { "data-source": _vm.actions, record: record } },
641
+ _vm.$listeners
642
+ )
643
+ ),
644
+ ]
645
+ },
646
+ },
647
+ ]),
648
+ }),
649
+ _vm._v(" "),
650
+ _c(
651
+ "div",
652
+ { staticClass: "g-table__pagination" },
653
+ [
654
+ _c("a-pagination", {
655
+ attrs: {
656
+ "show-total": function (total) {
657
+ return "共 " + total + " 条数据"
658
+ },
659
+ "show-size-changer": "",
660
+ "show-quick-jumper": "",
661
+ pageSize: _vm.pageSize,
662
+ pageSizeOptions: _vm.pageSizeOptions,
663
+ total: _vm.total,
664
+ },
665
+ on: { change: _vm.onChangePagination },
666
+ }),
667
+ ],
668
+ 1
669
+ ),
670
+ ],
671
+ 1
672
+ )
673
+ };
674
+ var __vue_staticRenderFns__$6 = [];
675
+ __vue_render__$6._withStripped = true;
676
+
677
+ /* style */
678
+ const __vue_inject_styles__$6 = function (inject) {
679
+ if (!inject) return
680
+ inject("data-v-baf82bc6_0", { source: ".g-table__wrapper[data-v-baf82bc6] {\n padding: 16px;\n padding-top: unset;\n}\n.g-table__wrapper .g-table__pagination[data-v-baf82bc6] {\n margin-top: 8px;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/table/src/index.vue","index.vue"],"names":[],"mappings":"AA4EA;EACA,aAAA;EACA,kBAAA;AC3EA;AD8EA;EACA,eAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;AC5EA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"g-table__wrapper\">\n <a-table\n :pagination=\"false\"\n :loading=\"loading\"\n :columns=\"columns\"\n :row-class-name=\"setRowClassName\"\n :data-source=\"dataSource\"\n :scroll=\"{ x: 1500, y: 500 }\">\n <template slot=\"action\" slot-scope=\"record\">\n <Actions v-on=\"$listeners\" :data-source=\"actions\" :record=\"record\"></Actions>\n </template>\n </a-table>\n <div class=\"g-table__pagination\">\n <a-pagination\n :show-total=\"total => `共 ${total} 条数据`\"\n show-size-changer \n show-quick-jumper\n :pageSize=\"pageSize\"\n :pageSizeOptions=\"pageSizeOptions\"\n @change=\"onChangePagination\" \n :total=\"total\">\n </a-pagination>\n </div>\n </div>\n</template>\n\n<script>\nimport Actions from './action.vue'\nexport default {\n name: 'ele-table',\n components: {\n Actions\n },\n props: {\n actions: {\n type: Array,\n default: () => []\n },\n total: {\n type: Number,\n default: 0\n },\n loading: {\n type: Boolean,\n default: false\n },\n columns: {\n type: Array,\n default: () => []\n },\n dataSource: {\n type: Array,\n default: () => []\n },\n pageSize: {\n type: Number,\n default: 10\n },\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '20', '30', '40']\n }\n },\n methods: {\n setRowClassName (record, idx) {\n return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd'\n },\n onChangePagination (page, pagrSize) {\n this.$emit('change-page', page, pagrSize)\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.g-table__wrapper {\n padding: 16px;\n padding-top: unset;\n .g-table__row--even {}\n .g-table__row--odd {}\n .g-table__pagination {\n margin-top: 8px;\n display: flex;\n flex-direction: row;\n justify-content: end;\n }\n}\n</style>",".g-table__wrapper {\n padding: 16px;\n padding-top: unset;\n}\n.g-table__wrapper .g-table__pagination {\n margin-top: 8px;\n display: flex;\n flex-direction: row;\n justify-content: end;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
681
+
682
+ };
683
+ /* scoped */
684
+ const __vue_scope_id__$6 = "data-v-baf82bc6";
685
+ /* module identifier */
686
+ const __vue_module_identifier__$6 = undefined;
687
+ /* functional template */
688
+ const __vue_is_functional_template__$6 = false;
689
+ /* style inject SSR */
690
+
691
+ /* style inject shadow dom */
692
+
693
+
694
+
695
+ const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
696
+ { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
697
+ __vue_inject_styles__$6,
698
+ __vue_script__$6,
699
+ __vue_scope_id__$6,
700
+ __vue_is_functional_template__$6,
701
+ __vue_module_identifier__$6,
702
+ false,
703
+ createInjector,
704
+ undefined,
705
+ undefined
706
+ );
707
+
708
+ __vue_component__$6.install = Vue => Vue.component(__vue_component__$6.name, __vue_component__$6);
709
+
710
+ //
711
+ //
712
+ //
713
+ //
714
+ //
715
+ //
716
+ //
717
+ //
718
+ //
719
+ //
720
+ //
721
+ //
722
+ //
723
+ //
724
+ //
725
+ //
726
+ //
727
+ //
728
+ //
729
+ //
730
+ //
731
+ //
732
+ //
733
+
734
+ var script$5 = {
735
+ name: 'ele-tree',
736
+ props: {
737
+ treeData: {
738
+ type: Array,
739
+ default: () => []
740
+ },
741
+ replaceFields: {
742
+ type: Object,
743
+ default: () => ({
744
+ title: 'title',
745
+ key: 'id',
746
+ children: 'children'
747
+ })
748
+ },
749
+ defaultExpandedKeys: {
750
+ type: Array
751
+ },
752
+ defaultSelectedKeys: {
753
+ type: Array
754
+ },
755
+ showIcon: {
756
+ type: Boolean,
757
+ default: true
758
+ }
759
+ },
760
+ data() {
761
+ return {};
762
+ },
763
+ computed: {
764
+ innerTreeData() {
765
+ return this.treeData;
766
+ // return [
767
+ // {
768
+ // title: 'parent 1',
769
+ // key: 1,
770
+ // scopedSlots: {
771
+ // icon: 'custom',
772
+ // iconName: 'smile-o'
773
+ // },
774
+ // children: [
775
+ // {
776
+ // title: '2',
777
+ // key: 2,
778
+ // scopedSlots: {
779
+ // icon: 'custom',
780
+ // iconName: 'frown-o'
781
+ // }
782
+ // }
783
+ // ]
784
+ // }
785
+ // ]
786
+ }
787
+ },
788
+ methods: {
789
+ refreshTreeStatus(props = {}) {},
790
+ selectTreeNode(selectedKeys, e) {
791
+ this.$emit('select', selectedKeys, e);
792
+ }
793
+ }
794
+ };
795
+
796
+ /* script */
797
+ const __vue_script__$5 = script$5;
798
+
799
+ /* template */
800
+ var __vue_render__$5 = function () {
801
+ var _vm = this;
802
+ var _h = _vm.$createElement;
803
+ var _c = _vm._self._c || _h;
804
+ return _c(
805
+ "div",
806
+ { staticClass: "g-tree__wrapper" },
807
+ [
808
+ _vm.innerTreeData.length
809
+ ? _c("a-tree", {
810
+ attrs: {
811
+ "tree-data": _vm.innerTreeData,
812
+ replaceFields: _vm.replaceFields,
813
+ "default-expanded-keys": _vm.defaultExpandedKeys,
814
+ "default-selected-keys": _vm.defaultSelectedKeys,
815
+ blockNode: "",
816
+ "show-icon": _vm.showIcon,
817
+ },
818
+ on: { select: _vm.selectTreeNode },
819
+ scopedSlots: _vm._u(
820
+ [
821
+ {
822
+ key: "title",
823
+ fn: function (ref) {
824
+ var title = ref.title;
825
+ return [
826
+ _c(
827
+ "span",
828
+ {
829
+ staticClass: "tree-node__title",
830
+ attrs: { title: title },
831
+ },
832
+ [_vm._v("\n " + _vm._s(title) + "\n ")]
833
+ ),
834
+ ]
835
+ },
836
+ },
837
+ {
838
+ key: "custom",
839
+ fn: function (ref) {
840
+ var scopedSlots = ref.scopedSlots;
841
+ return [
842
+ _c("a-icon", { attrs: { type: scopedSlots.iconName } }),
843
+ ]
844
+ },
845
+ },
846
+ ],
847
+ null,
848
+ false,
849
+ 729072655
850
+ ),
851
+ })
852
+ : _vm._e(),
853
+ ],
854
+ 1
855
+ )
856
+ };
857
+ var __vue_staticRenderFns__$5 = [];
858
+ __vue_render__$5._withStripped = true;
859
+
860
+ /* style */
861
+ const __vue_inject_styles__$5 = function (inject) {
862
+ if (!inject) return
863
+ inject("data-v-6969e1ac_0", { source: ".g-tree__wrapper[data-v-6969e1ac] {\n overflow: hidden;\n}\n.g-tree__wrapper[data-v-6969e1ac] .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/tree/src/index.vue","index.vue"],"names":[],"mappings":"AAwFA;EACA,gBAAA;ACvFA;ADwFA;EACA,uBAAA;EACA,gBAAA;EACA,mBAAA;ACtFA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"g-tree__wrapper\">\n <a-tree\n v-if=\"innerTreeData.length\"\n :tree-data=\"innerTreeData\"\n @select=\"selectTreeNode\"\n :replaceFields=\"replaceFields\"\n :default-expanded-keys=\"defaultExpandedKeys\"\n :default-selected-keys=\"defaultSelectedKeys\"\n blockNode \n :show-icon=\"showIcon\">\n <template #title=\"{ title }\">\n <span :title=\"title\" class=\"tree-node__title\">\n {{ title }}\n </span>\n </template>\n <template slot=\"custom\" slot-scope=\"{ scopedSlots }\">\n <a-icon :type=\"scopedSlots.iconName\"></a-icon>\n </template>\n </a-tree>\n </div>\n</template>\n\n<script>\nexport default {\n name: 'ele-tree',\n props: {\n treeData: {\n type: Array,\n default: () => []\n },\n replaceFields: {\n type: Object,\n default: () => ({\n title: 'title',\n key: 'id',\n children: 'children'\n })\n },\n defaultExpandedKeys: {\n type: Array\n },\n defaultSelectedKeys: {\n type: Array\n },\n showIcon: {\n type: Boolean,\n default: true\n }\n },\n data () {\n return {}\n },\n computed: {\n innerTreeData () {\n return this.treeData\n // return [\n // {\n // title: 'parent 1',\n // key: 1,\n // scopedSlots: {\n // icon: 'custom',\n // iconName: 'smile-o'\n // },\n // children: [\n // {\n // title: '2',\n // key: 2,\n // scopedSlots: {\n // icon: 'custom',\n // iconName: 'frown-o'\n // }\n // }\n // ]\n // }\n // ]\n }\n },\n methods: {\n refreshTreeStatus (props = {}) {},\n selectTreeNode (selectedKeys, e) {\n this.$emit('select', selectedKeys, e)\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.g-tree__wrapper {\n overflow: hidden;\n ::v-deep .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n}\n</style>",".g-tree__wrapper {\n overflow: hidden;\n}\n.g-tree__wrapper ::v-deep .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
864
+
865
+ };
866
+ /* scoped */
867
+ const __vue_scope_id__$5 = "data-v-6969e1ac";
868
+ /* module identifier */
869
+ const __vue_module_identifier__$5 = undefined;
870
+ /* functional template */
871
+ const __vue_is_functional_template__$5 = false;
872
+ /* style inject SSR */
873
+
874
+ /* style inject shadow dom */
875
+
876
+
877
+
878
+ const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
879
+ { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
880
+ __vue_inject_styles__$5,
881
+ __vue_script__$5,
882
+ __vue_scope_id__$5,
883
+ __vue_is_functional_template__$5,
884
+ __vue_module_identifier__$5,
885
+ false,
886
+ createInjector,
887
+ undefined,
888
+ undefined
889
+ );
890
+
891
+ __vue_component__$5.install = Vue => Vue.component(__vue_component__$5.name, __vue_component__$5);
892
+
893
+ //
894
+ //
895
+ //
896
+ //
897
+ //
898
+ //
899
+ //
900
+
901
+ var script$4 = {
902
+ props: {
903
+ label: {
904
+ type: String
905
+ }
906
+ }
907
+ };
908
+
909
+ /* script */
910
+ const __vue_script__$4 = script$4;
911
+
912
+ /* template */
913
+ var __vue_render__$4 = function () {
914
+ var _vm = this;
915
+ var _h = _vm.$createElement;
916
+ var _c = _vm._self._c || _h;
917
+ return _c("div", { staticClass: "g-search__label" }, [
918
+ _c("span", { staticClass: "label__title" }, [_vm._v(_vm._s(_vm.label))]),
919
+ _vm._v(" "),
920
+ _c("span", { staticClass: "label__suffix" }, [_vm._v(":")]),
921
+ ])
922
+ };
923
+ var __vue_staticRenderFns__$4 = [];
924
+ __vue_render__$4._withStripped = true;
925
+
926
+ /* style */
927
+ const __vue_inject_styles__$4 = function (inject) {
928
+ if (!inject) return
929
+ inject("data-v-07e596bf_0", { source: ".g-search__label[data-v-07e596bf] {\n /* width: 69px; */\n flex-basis: 69px;\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.g-search__label .label__title[data-v-07e596bf], .g-search__label .label__suffix[data-v-07e596bf] {\n font-size: 14px;\n color: rgba(0, 0, 0, 0.88);\n white-space: nowrap;\n}\n.g-search__label .label__suffix[data-v-07e596bf] {\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=label.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/composite-components/search-area/src/label.vue","label.vue"],"names":[],"mappings":"AAkBA;EACA,iBAAA;EACA,gBAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,8BAAA;ACjBA;ADkBA;EACA,eAAA;EACA,0BAAA;EACA,mBAAA;AChBA;ADkBA;EACA,gBAAA;AChBA;;AAEA,oCAAoC","file":"label.vue","sourcesContent":["<template>\n <div class=\"g-search__label\">\n <span class=\"label__title\">{{ label }}</span>\n <span class=\"label__suffix\">:</span>\n </div>\n</template>\n\n<script>\nexport default {\n props: {\n label: {\n type: String\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.g-search__label {\n /* width: 69px; */\n flex-basis: 69px;\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n .label__title, .label__suffix {\n font-size: 14px;\n color: rgba(0, 0, 0, 0.88);\n white-space: nowrap;\n }\n .label__suffix {\n margin-left: 4px;\n }\n}\n</style>",".g-search__label {\n /* width: 69px; */\n flex-basis: 69px;\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n.g-search__label .label__title, .g-search__label .label__suffix {\n font-size: 14px;\n color: rgba(0, 0, 0, 0.88);\n white-space: nowrap;\n}\n.g-search__label .label__suffix {\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=label.vue.map */"]}, media: undefined });
930
+
931
+ };
932
+ /* scoped */
933
+ const __vue_scope_id__$4 = "data-v-07e596bf";
934
+ /* module identifier */
935
+ const __vue_module_identifier__$4 = undefined;
936
+ /* functional template */
937
+ const __vue_is_functional_template__$4 = false;
938
+ /* style inject SSR */
939
+
940
+ /* style inject shadow dom */
941
+
942
+
943
+
944
+ const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
945
+ { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
946
+ __vue_inject_styles__$4,
947
+ __vue_script__$4,
948
+ __vue_scope_id__$4,
949
+ __vue_is_functional_template__$4,
950
+ __vue_module_identifier__$4,
951
+ false,
952
+ createInjector,
953
+ undefined,
954
+ undefined
955
+ );
956
+
957
+ //
958
+ var script$3 = {
959
+ name: 'ele-search-area',
960
+ components: {
961
+ EleInput: __vue_component__$9,
962
+ EleSelect: __vue_component__$8,
963
+ ELeButton: __vue_component__$b,
964
+ Label: __vue_component__$4,
965
+ EleDate: __vue_component__$a
966
+ },
967
+ props: {
968
+ gutter: {
969
+ type: [Number, Array, Object],
970
+ default: () => [16, 8]
971
+ },
972
+ span: {
973
+ type: Number,
974
+ default: 8
975
+ },
976
+ dataSource: {
977
+ type: Array,
978
+ required: true
979
+ }
980
+ },
981
+ computed: {
982
+ actionColOffset() {
983
+ return (24 / this.span - 1) * this.span;
984
+ },
985
+ innerDataSource() {
986
+ return [...this.dataSource, {
987
+ type: '_action'
988
+ }];
989
+ }
990
+ },
991
+ methods: {
992
+ handleClickSearch() {
993
+ const querys = this.extractValues();
994
+ this.$emit('search', querys);
995
+ },
996
+ extractValues() {
997
+ let ret = {};
998
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
999
+ switch (item.type) {
1000
+ case 'DatePicker':
1001
+ ret[item.name] = moment__default["default"](item._value).isValid() ? moment__default["default"](item._value).format(item.format) : null;
1002
+ break;
1003
+ default:
1004
+ ret[item.name] = item._value;
1005
+ break;
1006
+ }
1007
+ });
1008
+ return ret;
1009
+ },
1010
+ handleClickReset() {
1011
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
1012
+ switch (item.type) {
1013
+ case 'Select':
1014
+ this.$set(item, '_value', null);
1015
+ break;
1016
+ case 'DatePicker':
1017
+ this.$set(item, '_value', null);
1018
+ break;
1019
+ default:
1020
+ this.$set(item, '_value', null);
1021
+ break;
1022
+ }
1023
+ });
1024
+ //TODO defaultValue
1025
+ const querys = this.extractValues();
1026
+ this.$emit('search', querys);
1027
+ },
1028
+ onChangeSelect(value, props) {
1029
+ this.$set(props, '_value', value);
1030
+ }
1031
+ }
1032
+ };
1033
+
1034
+ /* script */
1035
+ const __vue_script__$3 = script$3;
1036
+
1037
+ /* template */
1038
+ var __vue_render__$3 = function () {
1039
+ var _vm = this;
1040
+ var _h = _vm.$createElement;
1041
+ var _c = _vm._self._c || _h;
1042
+ return _c(
1043
+ "div",
1044
+ { staticClass: "search-area__wrapper" },
1045
+ [
1046
+ _c(
1047
+ "a-row",
1048
+ { attrs: { gutter: _vm.gutter } },
1049
+ _vm._l(_vm.innerDataSource, function (item, idx) {
1050
+ return _c(
1051
+ "a-col",
1052
+ { key: idx, attrs: { span: item.span || _vm.span } },
1053
+ [
1054
+ item.type == "_action"
1055
+ ? _c(
1056
+ "div",
1057
+ { staticClass: "search-area__item search-area--action" },
1058
+ [
1059
+ _c(
1060
+ "ele-button",
1061
+ {
1062
+ attrs: { icon: "search", type: "primary" },
1063
+ on: { click: _vm.handleClickSearch },
1064
+ },
1065
+ [_vm._v("查询")]
1066
+ ),
1067
+ _vm._v(" "),
1068
+ _c(
1069
+ "ele-button",
1070
+ {
1071
+ staticStyle: { "margin-left": "8px" },
1072
+ attrs: { icon: "reload" },
1073
+ on: { click: _vm.handleClickReset },
1074
+ },
1075
+ [_vm._v("重置")]
1076
+ ),
1077
+ ],
1078
+ 1
1079
+ )
1080
+ : _c(
1081
+ "div",
1082
+ { staticClass: "search-area__item" },
1083
+ [
1084
+ item.type == "Input"
1085
+ ? [
1086
+ _c("Label", { attrs: { label: item.label } }),
1087
+ _vm._v(" "),
1088
+ _c("ele-input", {
1089
+ model: {
1090
+ value: item._value,
1091
+ callback: function ($$v) {
1092
+ _vm.$set(item, "_value", $$v);
1093
+ },
1094
+ expression: "item._value",
1095
+ },
1096
+ }),
1097
+ ]
1098
+ : item.type == "Select"
1099
+ ? [
1100
+ _c("Label", { attrs: { label: item.label } }),
1101
+ _vm._v(" "),
1102
+ _c("ele-select", {
1103
+ attrs: { "data-source": item.optionList },
1104
+ model: {
1105
+ value: item._value,
1106
+ callback: function ($$v) {
1107
+ _vm.$set(item, "_value", $$v);
1108
+ },
1109
+ expression: "item._value",
1110
+ },
1111
+ }),
1112
+ ]
1113
+ : item.type == "DatePicker"
1114
+ ? [
1115
+ _c("Label", { attrs: { label: item.label } }),
1116
+ _vm._v(" "),
1117
+ _c("ele-date", {
1118
+ attrs: { format: item.format },
1119
+ model: {
1120
+ value: item._value,
1121
+ callback: function ($$v) {
1122
+ _vm.$set(item, "_value", $$v);
1123
+ },
1124
+ expression: "item._value",
1125
+ },
1126
+ }),
1127
+ ]
1128
+ : _vm._e(),
1129
+ ],
1130
+ 2
1131
+ ),
1132
+ ]
1133
+ )
1134
+ }),
1135
+ 1
1136
+ ),
1137
+ ],
1138
+ 1
1139
+ )
1140
+ };
1141
+ var __vue_staticRenderFns__$3 = [];
1142
+ __vue_render__$3._withStripped = true;
1143
+
1144
+ /* style */
1145
+ const __vue_inject_styles__$3 = function (inject) {
1146
+ if (!inject) return
1147
+ inject("data-v-33e73d00_0", { source: ".search-area__wrapper[data-v-33e73d00] {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper[data-v-33e73d00] .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item[data-v-33e73d00] {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/composite-components/search-area/src/index.vue","index.vue"],"names":[],"mappings":"AAgHA;EACA,iBAAA;EACA,kBAAA;EACA,mBAAA;AC/GA;ADiHA;EACA,YAAA;AC/GA;ADkHA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;AChHA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"search-area__wrapper\">\n <a-row :gutter=\"gutter\">\n <a-col :span=\"item.span || span\" v-for=\"(item, idx) in innerDataSource\" :key=\"idx\">\n <div v-if=\"item.type == '_action'\" class=\"search-area__item search-area--action\">\n <ele-button icon=\"search\" type=\"primary\" @click=\"handleClickSearch\">查询</ele-button>\n <ele-button style=\"margin-left:8px;\" icon=\"reload\" @click=\"handleClickReset\">重置</ele-button>\n </div>\n <div v-else class=\"search-area__item\">\n <template v-if=\"item.type == 'Input'\">\n <Label :label=\"item.label\"></Label>\n <ele-input v-model=\"item._value\"></ele-input>\n </template>\n <template v-else-if=\"item.type == 'Select'\">\n <Label :label=\"item.label\"></Label>\n <ele-select v-model=\"item._value\" :data-source=\"item.optionList\"></ele-select>\n </template>\n <template v-else-if=\"item.type == 'DatePicker'\">\n <Label :label=\"item.label\"></Label>\n <ele-date v-model=\"item._value\" :format=\"item.format\"></ele-date>\n </template>\n </div>\n </a-col>\n </a-row>\n </div>\n</template>\n\n<script>\nimport EleInput from '../../../input/src/index.vue'\nimport EleSelect from '../../../select/src/index.vue'\nimport ELeButton from '../../../button/src/index.vue'\nimport EleDate from '../../../date/src/index.vue'\nimport Label from './label.vue'\nimport moment from 'moment'\nexport default {\n name: 'ele-search-area',\n components: {\n EleInput,\n EleSelect,\n ELeButton,\n Label,\n EleDate\n },\n props: {\n gutter: {\n type: [Number, Array, Object],\n default: () => ([\n 16, 8\n ])\n },\n span: {\n type: Number,\n default: 8\n },\n dataSource: {\n type: Array,\n required: true\n }\n },\n computed: {\n actionColOffset () {\n return ((24 / this.span) - 1) * this.span\n },\n innerDataSource () {\n return [...this.dataSource, { type: '_action' }]\n }\n },\n methods: {\n handleClickSearch () {\n const querys = this.extractValues()\n this.$emit('search', querys)\n },\n extractValues () {\n let ret = {}\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\n switch (item.type) {\n case 'DatePicker':\n ret[item.name] = moment(item._value).isValid() ? moment(item._value).format(item.format) : null\n break\n default:\n ret[item.name] = item._value\n break\n }\n })\n return ret\n },\n handleClickReset () {\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\n switch (item.type) {\n case 'Select':\n this.$set(item, '_value', null)\n break\n case 'DatePicker':\n this.$set(item, '_value', null)\n break\n default:\n this.$set(item, '_value', null)\n break\n }\n })\n //TODO defaultValue\n const querys = this.extractValues()\n this.$emit('search', querys)\n },\n onChangeSelect (value, props) {\n this.$set(props, '_value', value)\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.search-area__wrapper {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n ::v-deep .ant-col {\n &:last-child {\n float: right;\n }\n }\n .search-area__item {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n}\n</style>",".search-area__wrapper {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper ::v-deep .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
1148
+
1149
+ };
1150
+ /* scoped */
1151
+ const __vue_scope_id__$3 = "data-v-33e73d00";
1152
+ /* module identifier */
1153
+ const __vue_module_identifier__$3 = undefined;
1154
+ /* functional template */
1155
+ const __vue_is_functional_template__$3 = false;
1156
+ /* style inject SSR */
1157
+
1158
+ /* style inject shadow dom */
1159
+
1160
+
1161
+
1162
+ const __vue_component__$3 = /*#__PURE__*/normalizeComponent(
1163
+ { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
1164
+ __vue_inject_styles__$3,
1165
+ __vue_script__$3,
1166
+ __vue_scope_id__$3,
1167
+ __vue_is_functional_template__$3,
1168
+ __vue_module_identifier__$3,
1169
+ false,
1170
+ createInjector,
1171
+ undefined,
1172
+ undefined
1173
+ );
1174
+
1175
+ //
1176
+ var script$2 = {
1177
+ name: 'ele-button-group',
1178
+ components: {
1179
+ EleButton: __vue_component__$b
1180
+ },
1181
+ props: {
1182
+ dataSource: {
1183
+ type: Array,
1184
+ default: () => []
1185
+ }
1186
+ },
1187
+ methods: {
1188
+ handleClick(props) {
1189
+ this.$emit('click', props);
1190
+ }
1191
+ }
1192
+ };
1193
+
1194
+ /* script */
1195
+ const __vue_script__$2 = script$2;
1196
+
1197
+ /* template */
1198
+ var __vue_render__$2 = function () {
1199
+ var _vm = this;
1200
+ var _h = _vm.$createElement;
1201
+ var _c = _vm._self._c || _h;
1202
+ return _c(
1203
+ "div",
1204
+ { staticClass: "button-group__wrapper" },
1205
+ _vm._l(_vm.dataSource, function (item, idx) {
1206
+ return _c(
1207
+ "ele-button",
1208
+ {
1209
+ key: idx,
1210
+ attrs: { type: item.type, icon: item.icon },
1211
+ on: {
1212
+ click: function ($event) {
1213
+ return _vm.handleClick(item)
1214
+ },
1215
+ },
1216
+ },
1217
+ [_vm._v("\n " + _vm._s(item.label) + "\n ")]
1218
+ )
1219
+ }),
1220
+ 1
1221
+ )
1222
+ };
1223
+ var __vue_staticRenderFns__$2 = [];
1224
+ __vue_render__$2._withStripped = true;
1225
+
1226
+ /* style */
1227
+ const __vue_inject_styles__$2 = function (inject) {
1228
+ if (!inject) return
1229
+ inject("data-v-72ce5986_0", { source: ".button-group__wrapper[data-v-72ce5986] {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n}\n.button-group__wrapper .ant-btn[data-v-72ce5986] {\n margin-left: 8px;\n}\n.button-group__wrapper .ant-btn[data-v-72ce5986]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/composite-components/button-group/src/index.vue","index.vue"],"names":[],"mappings":"AAmCA;EACA,aAAA;EACA,kBAAA;EACA,mBAAA;AClCA;ADmCA;EACA,gBAAA;ACjCA;ADkCA;EACA,cAAA;AChCA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <div class=\"button-group__wrapper\">\n <ele-button \n v-for=\"(item, idx) in dataSource\" \n :type=\"item.type\"\n :icon=\"item.icon\"\n @click=\"handleClick(item)\" \n :key=\"idx\">\n {{ item.label }}\n </ele-button>\n </div>\n</template>\n\n<script>\nimport EleButton from '../../../button/src/index.vue'\nexport default {\n name: 'ele-button-group',\n components: {\n EleButton\n },\n props: {\n dataSource: {\n type: Array,\n default: () => []\n }\n },\n methods: {\n handleClick (props) {\n this.$emit('click', props)\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.button-group__wrapper {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n .ant-btn {\n margin-left: 8px;\n &:first-child {\n margin-left: 0;\n }\n }\n}\n</style>",".button-group__wrapper {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n}\n.button-group__wrapper .ant-btn {\n margin-left: 8px;\n}\n.button-group__wrapper .ant-btn:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
1230
+
1231
+ };
1232
+ /* scoped */
1233
+ const __vue_scope_id__$2 = "data-v-72ce5986";
1234
+ /* module identifier */
1235
+ const __vue_module_identifier__$2 = undefined;
1236
+ /* functional template */
1237
+ const __vue_is_functional_template__$2 = false;
1238
+ /* style inject SSR */
1239
+
1240
+ /* style inject shadow dom */
1241
+
1242
+
1243
+
1244
+ const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
1245
+ { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
1246
+ __vue_inject_styles__$2,
1247
+ __vue_script__$2,
1248
+ __vue_scope_id__$2,
1249
+ __vue_is_functional_template__$2,
1250
+ __vue_module_identifier__$2,
1251
+ false,
1252
+ createInjector,
1253
+ undefined,
1254
+ undefined
1255
+ );
1256
+
1257
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
1258
+ // require the crypto API and do not support built-in fallback to lower quality random number
1259
+ // generators (like Math.random()).
1260
+ let getRandomValues;
1261
+ const rnds8 = new Uint8Array(16);
1262
+ function rng() {
1263
+ // lazy load so that environments that need to polyfill have a chance to do so
1264
+ if (!getRandomValues) {
1265
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
1266
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
1267
+ if (!getRandomValues) {
1268
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
1269
+ }
1270
+ }
1271
+ return getRandomValues(rnds8);
1272
+ }
1273
+
1274
+ /**
1275
+ * Convert array of 16 byte values to UUID string format of the form:
1276
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
1277
+ */
1278
+
1279
+ const byteToHex = [];
1280
+ for (let i = 0; i < 256; ++i) {
1281
+ byteToHex.push((i + 0x100).toString(16).slice(1));
1282
+ }
1283
+ function unsafeStringify(arr, offset = 0) {
1284
+ // Note: Be careful editing this code! It's been tuned for performance
1285
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
1286
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
1287
+ }
1288
+
1289
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1290
+ var native = {
1291
+ randomUUID
1292
+ };
1293
+
1294
+ function v4(options, buf, offset) {
1295
+ if (native.randomUUID && !buf && !options) {
1296
+ return native.randomUUID();
1297
+ }
1298
+ options = options || {};
1299
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
1300
+
1301
+ rnds[6] = rnds[6] & 0x0f | 0x40;
1302
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
1303
+
1304
+ if (buf) {
1305
+ offset = offset || 0;
1306
+ for (let i = 0; i < 16; ++i) {
1307
+ buf[offset + i] = rnds[i];
1308
+ }
1309
+ return buf;
1310
+ }
1311
+ return unsafeStringify(rnds);
1312
+ }
1313
+
1314
+ //
1315
+ var script$1 = {
1316
+ name: 'ele-tree-table-model',
1317
+ components: {
1318
+ EleTree: __vue_component__$5,
1319
+ EleTable: __vue_component__$6,
1320
+ EleSearchArea: __vue_component__$3,
1321
+ EleButtonGroup: __vue_component__$2
1322
+ },
1323
+ props: {
1324
+ treeMeta: {
1325
+ type: Object,
1326
+ default: () => ({})
1327
+ },
1328
+ searchMeta: {
1329
+ type: Object,
1330
+ default: () => ({})
1331
+ },
1332
+ buttonGroupMeta: {
1333
+ typeof: Object,
1334
+ default: () => ({})
1335
+ },
1336
+ tableMeta: {
1337
+ type: Object,
1338
+ default: () => ({})
1339
+ }
1340
+ },
1341
+ data() {
1342
+ return {
1343
+ treeData: [],
1344
+ tableData: [],
1345
+ defaultExpandedKeys: [],
1346
+ defaultSelectedKeys: [],
1347
+ replaceFields: {
1348
+ title: 'title',
1349
+ children: 'children',
1350
+ key: 'id'
1351
+ },
1352
+ loading: false,
1353
+ total: 0,
1354
+ tableQuerys: {},
1355
+ resizeObserverModelTableWrapper: null,
1356
+ modelTableWrapperHeight: 0,
1357
+ currentTreeNodeData: {}
1358
+ };
1359
+ },
1360
+ computed: {
1361
+ buttonGroup() {
1362
+ return v4();
1363
+ },
1364
+ searchArea() {
1365
+ return v4();
1366
+ },
1367
+ modelTreeWrapper() {
1368
+ return v4();
1369
+ },
1370
+ modelTableWrapper() {
1371
+ return v4();
1372
+ },
1373
+ actions() {
1374
+ const {
1375
+ operations
1376
+ } = this.tableMeta;
1377
+ return operations.elements;
1378
+ },
1379
+ pageSize() {
1380
+ const {
1381
+ page = {}
1382
+ } = this.tableMeta;
1383
+ return page.pageSize || 10;
1384
+ },
1385
+ pageSizeOptions() {
1386
+ const {
1387
+ page = {}
1388
+ } = this.tableMeta;
1389
+ return page.pageSizeOptions || ['10', '20', '30', '40'];
1390
+ },
1391
+ columns() {
1392
+ const {
1393
+ columns,
1394
+ operations
1395
+ } = this.tableMeta;
1396
+ if (shared.type.get(columns) === 'array') {
1397
+ const columnsOptions = columns.map(item => {
1398
+ if (item.render) {
1399
+ return {
1400
+ title: item.title,
1401
+ dataIndex: item.dataIndex,
1402
+ width: item.width,
1403
+ align: item.align,
1404
+ fixed: item.fixed,
1405
+ customRender: (text, record, index) => {
1406
+ const {
1407
+ $createElement
1408
+ } = this;
1409
+ return item.render.call(this, {
1410
+ h: $createElement,
1411
+ ctx: this
1412
+ }, typeof text == 'string' ? text : text[item.dataIndex], record, index);
1413
+ }
1414
+ };
1415
+ }
1416
+ return {
1417
+ title: item.title,
1418
+ dataIndex: item.dataIndex,
1419
+ width: item.width,
1420
+ align: item.align,
1421
+ fixed: item.fixed
1422
+ };
1423
+ });
1424
+ if (operations) {
1425
+ return [...columnsOptions, {
1426
+ title: '操作',
1427
+ width: operations.width,
1428
+ key: 'action',
1429
+ fixed: 'right',
1430
+ scopedSlots: {
1431
+ customRender: 'action'
1432
+ }
1433
+ }];
1434
+ }
1435
+ return columnsOptions;
1436
+ } else {
1437
+ console.error('Error: columns is invalid, please check it');
1438
+ return [];
1439
+ }
1440
+ },
1441
+ getButtonGroupElements() {
1442
+ const {
1443
+ elements
1444
+ } = this.buttonGroupMeta;
1445
+ if (shared.type.get(elements) === 'function') {
1446
+ return elements.call(this);
1447
+ } else if (shared.type.get(elements) === 'array') {
1448
+ return elements;
1449
+ } else {
1450
+ return [];
1451
+ }
1452
+ }
1453
+ },
1454
+ async created() {
1455
+ this.treeData = await this.requestTreeData();
1456
+ const [defaultTreeNode = {}] = this.treeData;
1457
+ this.defaultExpandedKeys = [defaultTreeNode[this.replaceFields.key]];
1458
+ this.defaultSelectedKeys = [defaultTreeNode[this.replaceFields.key]];
1459
+ const {
1460
+ fieldMap
1461
+ } = this.tableMeta;
1462
+ this.currentTreeNodeData = defaultTreeNode;
1463
+ this.tableData = await this.requestTableData(this.execTableFieldMap(fieldMap, defaultTreeNode));
1464
+ },
1465
+ methods: {
1466
+ handleClickButtonGroup(props) {
1467
+ const {
1468
+ eventName
1469
+ } = props;
1470
+ this.$emit(eventName, {
1471
+ currentTreeNode: this.currentTreeNodeData
1472
+ });
1473
+ },
1474
+ watchViewPort() {
1475
+ const modelTableWrapper = this.$refs[this.modelTableWrapper];
1476
+ console.log(modelTableWrapper.getBoundingClientRect());
1477
+ const {
1478
+ top
1479
+ } = modelTableWrapper.getBoundingClientRect();
1480
+ this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`;
1481
+ },
1482
+ async onSearch(props) {
1483
+ this.tableQuerys = Object.assign(this.tableQuerys, props);
1484
+ this.tableData = await this.requestTableData();
1485
+ },
1486
+ execTableFieldMap(fieldMap = {}, props) {
1487
+ let ret = {};
1488
+ const keys = Object.keys(fieldMap);
1489
+ keys.forEach(key => {
1490
+ const field = fieldMap[key];
1491
+ ret[field] = props[key];
1492
+ });
1493
+ return ret;
1494
+ },
1495
+ async selectTreeNode(selectedKeys, e) {
1496
+ const {
1497
+ fieldMap
1498
+ } = this.tableMeta;
1499
+ this.currentTreeNodeData = e.node.$vnode.data.props.dataRef;
1500
+ const execFieldMapRet = this.execTableFieldMap(fieldMap, e.node.$vnode.data.props.dataRef);
1501
+ this.tableData = await this.requestTableData(execFieldMapRet);
1502
+ },
1503
+ async requestTreeData() {
1504
+ const {
1505
+ url,
1506
+ requestType
1507
+ } = this.treeMeta;
1508
+ const ret = await shared.net.get(url).then(resp => {
1509
+ const {
1510
+ data
1511
+ } = resp || {};
1512
+ return data;
1513
+ });
1514
+ return ret;
1515
+ },
1516
+ async onChangePage(page, pageSize) {
1517
+ this.tableData = await this.requestTableData({
1518
+ currentPage: page,
1519
+ pageSize
1520
+ });
1521
+ },
1522
+ async requestTableData(props = {}) {
1523
+ const {
1524
+ url,
1525
+ requestType,
1526
+ page = {}
1527
+ } = this.tableMeta;
1528
+ const {
1529
+ pageSize = 10
1530
+ } = page;
1531
+ this.tableQuerys = Object.assign(this.tableQuerys, {
1532
+ currentPage: 1,
1533
+ pageSize
1534
+ }, props);
1535
+ const ret = await shared.net.get(url, this.tableQuerys).then(resp => {
1536
+ const {
1537
+ data = [],
1538
+ count
1539
+ } = resp || {};
1540
+ this.total = count;
1541
+ return data.map(item => {
1542
+ return {
1543
+ key: v4(),
1544
+ ...item
1545
+ };
1546
+ });
1547
+ });
1548
+ return ret;
1549
+ },
1550
+ refreshTreeStatus(props = {}) {},
1551
+ refreshTableStatus(props = {}) {},
1552
+ getModelTableWrapperHeight() {},
1553
+ setModelTreeWrapperHeight(height) {
1554
+ this.$refs[this.modelTreeWrapper].style.height = height;
1555
+ },
1556
+ setModelTableWrapperHeight() {
1557
+ const {
1558
+ top
1559
+ } = this.$refs[this.modelTableWrapper].getBoundingClientRect();
1560
+ const height = `calc(100vh - ${top}px)`;
1561
+ this.$refs[this.modelTableWrapper].style.height = height;
1562
+ this.setModelTreeWrapperHeight(height);
1563
+ },
1564
+ getSearchAreaHeight() {
1565
+ return this.$refs[this.searchArea].$el.clientHeight;
1566
+ },
1567
+ getButtonGroupHeight() {
1568
+ return this.$refs[this.buttonGroup].$el.clientHeight;
1569
+ }
1570
+ },
1571
+ mounted() {
1572
+ //TODO
1573
+ // this.setModelTableWrapperHeight()
1574
+ // this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {
1575
+ // for (let entry of entries) {
1576
+ // this.modelTableWrapperHeight = entry.contentRect.height
1577
+ // console.log('this.modelTableWrapperHeight:', this.modelTableWrapperHeight)
1578
+ // console.log('getSearchAreaHeight', this.getSearchAreaHeight())
1579
+ // console.log('getButtonGroupHeight', this.getButtonGroupHeight())
1580
+ // const tableHeight = this.modelTableWrapperHeight - this.getSearchAreaHeight() - this.getButtonGroupHeight()
1581
+ // console.log('tableHeight', tableHeight)
1582
+ // }
1583
+ // })
1584
+ // this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])
1585
+ }
1586
+ };
1587
+
1588
+ /* script */
1589
+ const __vue_script__$1 = script$1;
1590
+
1591
+ /* template */
1592
+ var __vue_render__$1 = function () {
1593
+ var _vm = this;
1594
+ var _h = _vm.$createElement;
1595
+ var _c = _vm._self._c || _h;
1596
+ return _c("section", { staticClass: "model__tree-table" }, [
1597
+ _c(
1598
+ "section",
1599
+ { ref: _vm.modelTreeWrapper, staticClass: "model__tree--wrapper" },
1600
+ [
1601
+ _c("ele-tree", {
1602
+ attrs: {
1603
+ "tree-data": _vm.treeData,
1604
+ defaultExpandedKeys: _vm.defaultExpandedKeys,
1605
+ defaultSelectedKeys: _vm.defaultSelectedKeys,
1606
+ "replace-fields": _vm.treeMeta.replaceFields || _vm.replaceFields,
1607
+ },
1608
+ on: { select: _vm.selectTreeNode },
1609
+ }),
1610
+ ],
1611
+ 1
1612
+ ),
1613
+ _vm._v(" "),
1614
+ _c(
1615
+ "section",
1616
+ { ref: _vm.modelTableWrapper, staticClass: "model__table--wrapper" },
1617
+ [
1618
+ _c("ele-search-area", {
1619
+ ref: _vm.searchArea,
1620
+ attrs: { "data-source": _vm.searchMeta.elements },
1621
+ on: { search: _vm.onSearch },
1622
+ }),
1623
+ _vm._v(" "),
1624
+ _c("ele-button-group", {
1625
+ ref: _vm.buttonGroup,
1626
+ staticStyle: { "margin-top": "16px" },
1627
+ attrs: { "data-source": _vm.getButtonGroupElements },
1628
+ on: { click: _vm.handleClickButtonGroup },
1629
+ }),
1630
+ _vm._v(" "),
1631
+ _c(
1632
+ "ele-table",
1633
+ _vm._g(
1634
+ {
1635
+ staticStyle: { "margin-top": "8px" },
1636
+ attrs: {
1637
+ loading: _vm.loading,
1638
+ columns: _vm.columns,
1639
+ total: _vm.total,
1640
+ actions: _vm.actions,
1641
+ pageSize: _vm.pageSize,
1642
+ pageSizeOptions: _vm.pageSizeOptions,
1643
+ "data-source": _vm.tableData,
1644
+ },
1645
+ on: { "change-page": _vm.onChangePage },
1646
+ },
1647
+ _vm.$listeners
1648
+ )
1649
+ ),
1650
+ ],
1651
+ 1
1652
+ ),
1653
+ ])
1654
+ };
1655
+ var __vue_staticRenderFns__$1 = [];
1656
+ __vue_render__$1._withStripped = true;
1657
+
1658
+ /* style */
1659
+ const __vue_inject_styles__$1 = function (inject) {
1660
+ if (!inject) return
1661
+ inject("data-v-47f01802_0", { source: ".model__tree-table[data-v-47f01802] {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.model__tree-table .model__tree--wrapper[data-v-47f01802] {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.model__tree-table .model__table--wrapper[data-v-47f01802] {\n min-width: 0;\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["/Users/huangshan/Goldgov/front/ganjiao/base-elearning-frontend-model/packages/components/packages/tree-table-model/src/index.vue","index.vue"],"names":[],"mappings":"AA8QA;EACA,uBAAA;EACA,aAAA;EACA,mBAAA;EACA,WAAA;AC7QA;AD8QA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;EACA,aAAA;EACA,sBAAA;EACA,kBAAA;EACA,gBAAA;AC5QA;AD8QA;EACA,YAAA;EACA,gBAAA;AC5QA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\n <section class=\"model__tree-table\">\n <section :ref=\"modelTreeWrapper\" class=\"model__tree--wrapper\">\n <ele-tree \n :tree-data=\"treeData\"\n :defaultExpandedKeys=\"defaultExpandedKeys\"\n :defaultSelectedKeys=\"defaultSelectedKeys\"\n @select=\"selectTreeNode\"\n :replace-fields=\"treeMeta.replaceFields || replaceFields\">\n </ele-tree>\n </section>\n <section :ref=\"modelTableWrapper\" class=\"model__table--wrapper\">\n <ele-search-area :ref=\"searchArea\" @search=\"onSearch\" :data-source=\"searchMeta.elements\"></ele-search-area>\n <ele-button-group :ref=\"buttonGroup\" @click=\"handleClickButtonGroup\" style=\"margin-top: 16px\" :data-source=\"getButtonGroupElements\"></ele-button-group>\n <ele-table\n v-on=\"$listeners\"\n :loading=\"loading\" \n :columns=\"columns\"\n :total=\"total\"\n :actions=\"actions\"\n :pageSize=\"pageSize\"\n :pageSizeOptions=\"pageSizeOptions\"\n :data-source=\"tableData\"\n @change-page=\"onChangePage\" \n style=\"margin-top: 8px;\"\n ></ele-table>\n </section>\n </section>\n</template>\n\n<script>\nimport EleTree from '../../tree/src/index.vue'\nimport EleTable from '../../table/src/index.vue'\nimport EleSearchArea from '../../composite-components/search-area/src/index.vue'\nimport EleButtonGroup from '../../composite-components/button-group/src/index.vue'\nimport { type, net } from '@idooel/shared'\nimport { v4 as uuidv4 } from 'uuid'\nexport default {\n name: 'ele-tree-table-model',\n components: {\n EleTree,\n EleTable,\n EleSearchArea,\n EleButtonGroup\n },\n props: {\n treeMeta: {\n type: Object,\n default: () => ({})\n },\n searchMeta: {\n type: Object,\n default: () => ({})\n },\n buttonGroupMeta: {\n typeof: Object,\n default: () => ({})\n },\n tableMeta: {\n type: Object,\n default: () => ({})\n }\n },\n data () {\n return {\n treeData: [],\n tableData: [],\n defaultExpandedKeys: [],\n defaultSelectedKeys: [],\n replaceFields: {\n title: 'title',\n children: 'children',\n key: 'id'\n },\n loading: false,\n total: 0,\n tableQuerys: {},\n resizeObserverModelTableWrapper: null,\n modelTableWrapperHeight: 0,\n currentTreeNodeData: {}\n }\n },\n computed: {\n buttonGroup () {\n return uuidv4()\n },\n searchArea () {\n return uuidv4()\n },\n modelTreeWrapper () {\n return uuidv4()\n },\n modelTableWrapper () {\n return uuidv4()\n },\n actions () {\n const { operations } = this.tableMeta\n return operations.elements\n },\n pageSize () {\n const { page = {} } = this.tableMeta\n return page.pageSize || 10\n },\n pageSizeOptions () {\n const { page = {} } = this.tableMeta\n return page.pageSizeOptions || ['10', '20', '30', '40']\n },\n columns () {\n const { columns, operations } = this.tableMeta\n if (type.get(columns) === 'array') {\n const columnsOptions = columns.map(item => {\n if (item.render) {\n return {\n title: item.title,\n dataIndex: item.dataIndex,\n width: item.width,\n align: item.align,\n fixed: item.fixed,\n customRender: (text, record, index) => {\n const { $createElement } = this\n return item.render.call(this, { h: $createElement, ctx: this }, typeof text == 'string' ? text : text[item.dataIndex], record, index)\n }\n }\n }\n return {\n title: item.title,\n dataIndex: item.dataIndex,\n width: item.width,\n align: item.align,\n fixed: item.fixed\n }\n })\n if (operations) {\n return [\n ...columnsOptions,\n {\n title: '操作',\n width: operations.width,\n key: 'action',\n fixed: 'right',\n scopedSlots: { customRender: 'action' }\n }\n ]\n }\n return columnsOptions\n } else {\n console.error('Error: columns is invalid, please check it')\n return []\n }\n },\n getButtonGroupElements () {\n const { elements } = this.buttonGroupMeta\n if (type.get(elements) === 'function') {\n return elements.call(this)\n } else if (type.get(elements) === 'array') {\n return elements\n } else {\n return []\n }\n }\n },\n async created () {\n this.treeData = await this.requestTreeData()\n const [defaultTreeNode = {}] = this.treeData\n this.defaultExpandedKeys = [defaultTreeNode[this.replaceFields.key]]\n this.defaultSelectedKeys = [defaultTreeNode[this.replaceFields.key]]\n const { fieldMap } = this.tableMeta\n this.currentTreeNodeData = defaultTreeNode\n this.tableData = await this.requestTableData(this.execTableFieldMap(fieldMap, defaultTreeNode))\n },\n methods: {\n handleClickButtonGroup (props) {\n const { eventName } = props\n this.$emit(eventName, { currentTreeNode: this.currentTreeNodeData })\n },\n watchViewPort () {\n const modelTableWrapper = this.$refs[this.modelTableWrapper]\n console.log(modelTableWrapper.getBoundingClientRect())\n const { top } = modelTableWrapper.getBoundingClientRect()\n this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`\n },\n async onSearch (props) {\n this.tableQuerys = Object.assign(this.tableQuerys, props)\n this.tableData = await this.requestTableData()\n },\n execTableFieldMap (fieldMap = {}, props) {\n let ret = {}\n const keys = Object.keys(fieldMap)\n keys.forEach(key => {\n const field = fieldMap[key]\n ret[field] = props[key]\n })\n return ret\n },\n async selectTreeNode (selectedKeys, e) {\n const { fieldMap } = this.tableMeta\n this.currentTreeNodeData = e.node.$vnode.data.props.dataRef\n const execFieldMapRet = this.execTableFieldMap(fieldMap, e.node.$vnode.data.props.dataRef)\n this.tableData = await this.requestTableData(execFieldMapRet)\n },\n async requestTreeData () {\n const { url, requestType } = this.treeMeta\n const ret = await net.get(\n url\n ).then(resp => {\n const { data } = resp || {}\n return data\n })\n return ret\n },\n async onChangePage (page, pageSize) {\n this.tableData = await this.requestTableData({ currentPage: page, pageSize })\n },\n async requestTableData (props = {}) {\n const { url, requestType, page = {} } = this.tableMeta\n const { pageSize = 10 } = page\n this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: 1, pageSize }, props)\n const ret = await net.get(\n url,\n this.tableQuerys\n ).then(resp => {\n const { data = [], count } = resp || {}\n this.total = count\n return data.map(item => {\n return {\n key: uuidv4(),\n ...item\n }\n })\n })\n return ret\n },\n refreshTreeStatus (props = {}) {},\n refreshTableStatus (props = {}) {},\n getModelTableWrapperHeight () {},\n setModelTreeWrapperHeight (height) {\n this.$refs[this.modelTreeWrapper].style.height = height\n },\n setModelTableWrapperHeight () {\n const { top } = this.$refs[this.modelTableWrapper].getBoundingClientRect()\n const height = `calc(100vh - ${top}px)`\n this.$refs[this.modelTableWrapper].style.height = height\n this.setModelTreeWrapperHeight(height)\n },\n getSearchAreaHeight () {\n return this.$refs[this.searchArea].$el.clientHeight\n },\n getButtonGroupHeight () {\n return this.$refs[this.buttonGroup].$el.clientHeight\n }\n },\n mounted () {\n //TODO\n // this.setModelTableWrapperHeight()\n // this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {\n // for (let entry of entries) {\n // this.modelTableWrapperHeight = entry.contentRect.height\n // console.log('this.modelTableWrapperHeight:', this.modelTableWrapperHeight)\n // console.log('getSearchAreaHeight', this.getSearchAreaHeight())\n // console.log('getButtonGroupHeight', this.getButtonGroupHeight())\n // const tableHeight = this.modelTableWrapperHeight - this.getSearchAreaHeight() - this.getButtonGroupHeight()\n // console.log('tableHeight', tableHeight)\n // }\n // })\n // this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.model__tree-table {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n .model__tree--wrapper {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n }\n .model__table--wrapper {\n min-width: 0;\n background: #fff;\n }\n}\n</style>",".model__tree-table {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.model__tree-table .model__tree--wrapper {\n width: 240px;\n background: #fff;\n flex-shrink: 0;\n padding: 16px;\n box-sizing: border-box;\n margin-right: 16px;\n overflow-y: auto;\n}\n.model__tree-table .model__table--wrapper {\n min-width: 0;\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
1662
+
1663
+ };
1664
+ /* scoped */
1665
+ const __vue_scope_id__$1 = "data-v-47f01802";
1666
+ /* module identifier */
1667
+ const __vue_module_identifier__$1 = undefined;
1668
+ /* functional template */
1669
+ const __vue_is_functional_template__$1 = false;
1670
+ /* style inject SSR */
1671
+
1672
+ /* style inject shadow dom */
1673
+
1674
+
1675
+
1676
+ const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
1677
+ { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
1678
+ __vue_inject_styles__$1,
1679
+ __vue_script__$1,
1680
+ __vue_scope_id__$1,
1681
+ __vue_is_functional_template__$1,
1682
+ __vue_module_identifier__$1,
1683
+ false,
1684
+ createInjector,
1685
+ undefined,
1686
+ undefined
1687
+ );
1688
+
1689
+ //
1690
+ var script = {
1691
+ name: 'ele-tpl',
1692
+ props: {
1693
+ modelName: {
1694
+ type: String
1695
+ }
1696
+ },
1697
+ components: {
1698
+ [__vue_component__$1.name]: __vue_component__$1
1699
+ },
1700
+ computed: {
1701
+ genModelRef() {
1702
+ return v4();
1703
+ }
1704
+ },
1705
+ methods: {
1706
+ getModel() {
1707
+ return this.$refs[this.genModelRef];
1708
+ }
1709
+ }
1710
+ };
1711
+
1712
+ /* script */
1713
+ const __vue_script__ = script;
1714
+
1715
+ /* template */
1716
+ var __vue_render__ = function () {
1717
+ var _vm = this;
1718
+ var _h = _vm.$createElement;
1719
+ var _c = _vm._self._c || _h;
1720
+ return _vm.modelName
1721
+ ? _c(
1722
+ _vm.modelName,
1723
+ _vm._g(
1724
+ _vm._b(
1725
+ {
1726
+ ref: _vm.genModelRef,
1727
+ tag: "component",
1728
+ scopedSlots: _vm._u(
1729
+ [
1730
+ _vm._l(_vm.$scopedSlots, function (idx, name) {
1731
+ return {
1732
+ key: name,
1733
+ fn: function (data) {
1734
+ return [_vm._t(name, null, null, data)]
1735
+ },
1736
+ }
1737
+ }),
1738
+ ],
1739
+ null,
1740
+ true
1741
+ ),
1742
+ },
1743
+ "component",
1744
+ _vm.$attrs,
1745
+ false
1746
+ ),
1747
+ _vm.$listeners
1748
+ )
1749
+ )
1750
+ : _c("div", [_vm._v("未正确配置模版")])
1751
+ };
1752
+ var __vue_staticRenderFns__ = [];
1753
+ __vue_render__._withStripped = true;
1754
+
1755
+ /* style */
1756
+ const __vue_inject_styles__ = undefined;
1757
+ /* scoped */
1758
+ const __vue_scope_id__ = undefined;
1759
+ /* module identifier */
1760
+ const __vue_module_identifier__ = undefined;
1761
+ /* functional template */
1762
+ const __vue_is_functional_template__ = false;
1763
+ /* style inject */
1764
+
1765
+ /* style inject SSR */
1766
+
1767
+ /* style inject shadow dom */
1768
+
1769
+
1770
+
1771
+ const __vue_component__ = /*#__PURE__*/normalizeComponent(
1772
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
1773
+ __vue_inject_styles__,
1774
+ __vue_script__,
1775
+ __vue_scope_id__,
1776
+ __vue_is_functional_template__,
1777
+ __vue_module_identifier__,
1778
+ false,
1779
+ undefined,
1780
+ undefined,
1781
+ undefined
1782
+ );
1783
+
1784
+ __vue_component__.install = Vue => Vue.component(__vue_component__.name, __vue_component__);
1785
+
1786
+ __vue_component__$2.install = Vue => Vue.component(__vue_component__$2.name, __vue_component__$2);
1787
+
1788
+ __vue_component__$3.install = Vue => Vue.component(__vue_component__$3.name, __vue_component__$3);
1789
+
1790
+ __vue_component__$1.install = Vue => Vue.component(__vue_component__$1.name, __vue_component__$1);
1791
+
1792
+ const compositeComponents = [__vue_component__$2, __vue_component__$3];
1793
+ const models = [__vue_component__$1];
1794
+ const components = [__vue_component__$b, __vue_component__$a, __vue_component__$9, __vue_component__$8, __vue_component__$6, __vue_component__$5, __vue_component__, ...compositeComponents, ...models];
1795
+ const install = Vue => {
1796
+ if (install.installed) return;
1797
+ install.installed = true;
1798
+ components.forEach(component => {
1799
+ Vue.component(component.name, component);
1800
+ });
1801
+ };
1802
+
1803
+ exports.EleButton = __vue_component__$b;
1804
+ exports.EleDate = __vue_component__$a;
1805
+ exports.EleInput = __vue_component__$9;
1806
+ exports.EleSelect = __vue_component__$8;
1807
+ exports.EleTable = __vue_component__$6;
1808
+ exports.EleTree = __vue_component__$5;
1809
+ exports["default"] = install;
1810
+
1811
+ Object.defineProperty(exports, '__esModule', { value: true });
1812
+
1813
+ }));