@idooel/components 0.0.0 → 0.0.1-beta.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.
- package/dist/@idooel/components.esm.js +2634 -0
- package/dist/@idooel/components.umd.js +1019 -179
- package/package.json +44 -41
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +54 -24
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +50 -46
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +171 -128
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +39 -39
- package/packages/index.js +50 -49
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +23 -23
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +34 -34
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +131 -44
- package/packages/table/src/index.vue +157 -88
- package/packages/theme/index.scss +12 -0
- package/packages/theme/variables.scss +34 -0
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +50 -39
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -96
- package/packages/tree-table-model/index.js +4 -4
- package/packages/tree-table-model/src/index.vue +306 -289
- package/scripts/rollup.config.js +35 -41
- package/scripts/rollup.esm.config.js +12 -0
- package/scripts/rollup.umd.config.js +14 -14
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@idooel/shared'), require('moment')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@idooel/shared', 'moment'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.__ele__umd__components__ = {}, global.shared, global.moment));
|
|
5
|
+
})(this, (function (exports, shared, moment) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
10
10
|
|
|
11
|
+
//
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
//
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
//
|
|
21
|
+
//
|
|
11
22
|
//
|
|
12
23
|
//
|
|
13
24
|
//
|
|
@@ -18,6 +29,19 @@
|
|
|
18
29
|
var script$b = {
|
|
19
30
|
name: 'ele-button',
|
|
20
31
|
props: {
|
|
32
|
+
record: {
|
|
33
|
+
type: Object
|
|
34
|
+
},
|
|
35
|
+
eventName: {
|
|
36
|
+
type: String
|
|
37
|
+
},
|
|
38
|
+
mode: {
|
|
39
|
+
type: String
|
|
40
|
+
},
|
|
41
|
+
dataSource: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: () => []
|
|
44
|
+
},
|
|
21
45
|
type: {
|
|
22
46
|
type: String,
|
|
23
47
|
default: 'default'
|
|
@@ -27,8 +51,22 @@
|
|
|
27
51
|
}
|
|
28
52
|
},
|
|
29
53
|
methods: {
|
|
54
|
+
handleMenuClick(props) {
|
|
55
|
+
const {
|
|
56
|
+
key
|
|
57
|
+
} = props;
|
|
58
|
+
const currentClickTarget = this.dataSource.find(item => item.value === key);
|
|
59
|
+
const {
|
|
60
|
+
eventName
|
|
61
|
+
} = currentClickTarget;
|
|
62
|
+
eventName && this.$emit(eventName, {
|
|
63
|
+
...currentClickTarget
|
|
64
|
+
});
|
|
65
|
+
},
|
|
30
66
|
handleClick() {
|
|
31
|
-
this.$emit('click'
|
|
67
|
+
this.$emit(this.eventName || 'click', {
|
|
68
|
+
...this.record
|
|
69
|
+
});
|
|
32
70
|
}
|
|
33
71
|
}
|
|
34
72
|
};
|
|
@@ -113,15 +151,47 @@
|
|
|
113
151
|
var _vm = this;
|
|
114
152
|
var _h = _vm.$createElement;
|
|
115
153
|
var _c = _vm._self._c || _h;
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
154
|
+
return _vm.mode == "dropdown"
|
|
155
|
+
? _c(
|
|
156
|
+
"a-dropdown",
|
|
157
|
+
[
|
|
158
|
+
_c(
|
|
159
|
+
"a-menu",
|
|
160
|
+
{
|
|
161
|
+
attrs: { slot: "overlay" },
|
|
162
|
+
on: { click: _vm.handleMenuClick },
|
|
163
|
+
slot: "overlay",
|
|
164
|
+
},
|
|
165
|
+
_vm._l(_vm.dataSource, function (opt) {
|
|
166
|
+
return _c("a-menu-item", { key: opt.value }, [
|
|
167
|
+
_vm._v("\n " + _vm._s(opt.label) + "\n "),
|
|
168
|
+
])
|
|
169
|
+
}),
|
|
170
|
+
1
|
|
171
|
+
),
|
|
172
|
+
_vm._v(" "),
|
|
173
|
+
_c(
|
|
174
|
+
"a-button",
|
|
175
|
+
{ attrs: { type: _vm.type } },
|
|
176
|
+
[
|
|
177
|
+
_vm._t("default"),
|
|
178
|
+
_vm._v(" "),
|
|
179
|
+
_c("a-icon", { attrs: { type: _vm.icon } }),
|
|
180
|
+
],
|
|
181
|
+
2
|
|
182
|
+
),
|
|
183
|
+
],
|
|
184
|
+
1
|
|
185
|
+
)
|
|
186
|
+
: _c(
|
|
187
|
+
"a-button",
|
|
188
|
+
{
|
|
189
|
+
attrs: { type: _vm.type, icon: _vm.icon },
|
|
190
|
+
on: { click: _vm.handleClick },
|
|
191
|
+
},
|
|
192
|
+
[_vm._t("default")],
|
|
193
|
+
2
|
|
194
|
+
)
|
|
125
195
|
};
|
|
126
196
|
var __vue_staticRenderFns__$b = [];
|
|
127
197
|
__vue_render__$b._withStripped = true;
|
|
@@ -333,11 +403,11 @@
|
|
|
333
403
|
/* style */
|
|
334
404
|
const __vue_inject_styles__$9 = function (inject) {
|
|
335
405
|
if (!inject) return
|
|
336
|
-
inject("data-v-
|
|
406
|
+
inject("data-v-560c97a2_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
407
|
|
|
338
408
|
};
|
|
339
409
|
/* scoped */
|
|
340
|
-
const __vue_scope_id__$9 = "data-v-
|
|
410
|
+
const __vue_scope_id__$9 = "data-v-560c97a2";
|
|
341
411
|
/* module identifier */
|
|
342
412
|
const __vue_module_identifier__$9 = undefined;
|
|
343
413
|
/* functional template */
|
|
@@ -425,11 +495,11 @@
|
|
|
425
495
|
/* style */
|
|
426
496
|
const __vue_inject_styles__$8 = function (inject) {
|
|
427
497
|
if (!inject) return
|
|
428
|
-
inject("data-v-
|
|
498
|
+
inject("data-v-499435e8_0", { source: "\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":";;AAEA,oCAAoC","file":"index.vue"}, media: undefined });
|
|
429
499
|
|
|
430
500
|
};
|
|
431
501
|
/* scoped */
|
|
432
|
-
const __vue_scope_id__$8 = "data-v-
|
|
502
|
+
const __vue_scope_id__$8 = "data-v-499435e8";
|
|
433
503
|
/* module identifier */
|
|
434
504
|
const __vue_module_identifier__$8 = undefined;
|
|
435
505
|
/* functional template */
|
|
@@ -455,17 +525,638 @@
|
|
|
455
525
|
|
|
456
526
|
__vue_component__$8.install = Vue => Vue.component(__vue_component__$8.name, __vue_component__$8);
|
|
457
527
|
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
528
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
529
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
530
|
+
// generators (like Math.random()).
|
|
531
|
+
let getRandomValues;
|
|
532
|
+
const rnds8 = new Uint8Array(16);
|
|
533
|
+
function rng() {
|
|
534
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
535
|
+
if (!getRandomValues) {
|
|
536
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
537
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
538
|
+
if (!getRandomValues) {
|
|
539
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return getRandomValues(rnds8);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
546
|
+
|
|
547
|
+
function validate(uuid) {
|
|
548
|
+
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
553
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
const byteToHex = [];
|
|
557
|
+
for (let i = 0; i < 256; ++i) {
|
|
558
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
559
|
+
}
|
|
560
|
+
function unsafeStringify(arr, offset = 0) {
|
|
561
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
562
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
563
|
+
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]];
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function parse$1(uuid) {
|
|
567
|
+
if (!validate(uuid)) {
|
|
568
|
+
throw TypeError('Invalid UUID');
|
|
569
|
+
}
|
|
570
|
+
let v;
|
|
571
|
+
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
572
|
+
|
|
573
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
574
|
+
arr[1] = v >>> 16 & 0xff;
|
|
575
|
+
arr[2] = v >>> 8 & 0xff;
|
|
576
|
+
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
577
|
+
|
|
578
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
579
|
+
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
580
|
+
|
|
581
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
582
|
+
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
583
|
+
|
|
584
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
585
|
+
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
586
|
+
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
587
|
+
|
|
588
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
589
|
+
arr[11] = v / 0x100000000 & 0xff;
|
|
590
|
+
arr[12] = v >>> 24 & 0xff;
|
|
591
|
+
arr[13] = v >>> 16 & 0xff;
|
|
592
|
+
arr[14] = v >>> 8 & 0xff;
|
|
593
|
+
arr[15] = v & 0xff;
|
|
594
|
+
return arr;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function stringToBytes(str) {
|
|
598
|
+
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
599
|
+
|
|
600
|
+
const bytes = [];
|
|
601
|
+
for (let i = 0; i < str.length; ++i) {
|
|
602
|
+
bytes.push(str.charCodeAt(i));
|
|
603
|
+
}
|
|
604
|
+
return bytes;
|
|
605
|
+
}
|
|
606
|
+
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
607
|
+
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
608
|
+
function v35(name, version, hashfunc) {
|
|
609
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
610
|
+
var _namespace;
|
|
611
|
+
if (typeof value === 'string') {
|
|
612
|
+
value = stringToBytes(value);
|
|
613
|
+
}
|
|
614
|
+
if (typeof namespace === 'string') {
|
|
615
|
+
namespace = parse$1(namespace);
|
|
616
|
+
}
|
|
617
|
+
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
618
|
+
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
619
|
+
} // Compute hash of namespace and value, Per 4.3
|
|
620
|
+
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
621
|
+
// hashfunc([...namespace, ... value])`
|
|
622
|
+
|
|
623
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
624
|
+
bytes.set(namespace);
|
|
625
|
+
bytes.set(value, namespace.length);
|
|
626
|
+
bytes = hashfunc(bytes);
|
|
627
|
+
bytes[6] = bytes[6] & 0x0f | version;
|
|
628
|
+
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
629
|
+
if (buf) {
|
|
630
|
+
offset = offset || 0;
|
|
631
|
+
for (let i = 0; i < 16; ++i) {
|
|
632
|
+
buf[offset + i] = bytes[i];
|
|
633
|
+
}
|
|
634
|
+
return buf;
|
|
635
|
+
}
|
|
636
|
+
return unsafeStringify(bytes);
|
|
637
|
+
} // Function#name is not settable on some platforms (#270)
|
|
638
|
+
|
|
639
|
+
try {
|
|
640
|
+
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
641
|
+
} catch (err) {} // For CommonJS default export support
|
|
642
|
+
|
|
643
|
+
generateUUID.DNS = DNS;
|
|
644
|
+
generateUUID.URL = URL;
|
|
645
|
+
return generateUUID;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
649
|
+
var native = {
|
|
650
|
+
randomUUID
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
function v4(options, buf, offset) {
|
|
654
|
+
if (native.randomUUID && !buf && !options) {
|
|
655
|
+
return native.randomUUID();
|
|
656
|
+
}
|
|
657
|
+
options = options || {};
|
|
658
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
659
|
+
|
|
660
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
661
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
662
|
+
|
|
663
|
+
if (buf) {
|
|
664
|
+
offset = offset || 0;
|
|
665
|
+
for (let i = 0; i < 16; ++i) {
|
|
666
|
+
buf[offset + i] = rnds[i];
|
|
667
|
+
}
|
|
668
|
+
return buf;
|
|
669
|
+
}
|
|
670
|
+
return unsafeStringify(rnds);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Adapted from Chris Veness' SHA1 code at
|
|
674
|
+
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
675
|
+
function f(s, x, y, z) {
|
|
676
|
+
switch (s) {
|
|
677
|
+
case 0:
|
|
678
|
+
return x & y ^ ~x & z;
|
|
679
|
+
case 1:
|
|
680
|
+
return x ^ y ^ z;
|
|
681
|
+
case 2:
|
|
682
|
+
return x & y ^ x & z ^ y & z;
|
|
683
|
+
case 3:
|
|
684
|
+
return x ^ y ^ z;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
function ROTL(x, n) {
|
|
688
|
+
return x << n | x >>> 32 - n;
|
|
689
|
+
}
|
|
690
|
+
function sha1(bytes) {
|
|
691
|
+
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
692
|
+
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
693
|
+
if (typeof bytes === 'string') {
|
|
694
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
695
|
+
|
|
696
|
+
bytes = [];
|
|
697
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
698
|
+
bytes.push(msg.charCodeAt(i));
|
|
699
|
+
}
|
|
700
|
+
} else if (!Array.isArray(bytes)) {
|
|
701
|
+
// Convert Array-like to Array
|
|
702
|
+
bytes = Array.prototype.slice.call(bytes);
|
|
703
|
+
}
|
|
704
|
+
bytes.push(0x80);
|
|
705
|
+
const l = bytes.length / 4 + 2;
|
|
706
|
+
const N = Math.ceil(l / 16);
|
|
707
|
+
const M = new Array(N);
|
|
708
|
+
for (let i = 0; i < N; ++i) {
|
|
709
|
+
const arr = new Uint32Array(16);
|
|
710
|
+
for (let j = 0; j < 16; ++j) {
|
|
711
|
+
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
712
|
+
}
|
|
713
|
+
M[i] = arr;
|
|
714
|
+
}
|
|
715
|
+
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
716
|
+
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
717
|
+
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
718
|
+
for (let i = 0; i < N; ++i) {
|
|
719
|
+
const W = new Uint32Array(80);
|
|
720
|
+
for (let t = 0; t < 16; ++t) {
|
|
721
|
+
W[t] = M[i][t];
|
|
722
|
+
}
|
|
723
|
+
for (let t = 16; t < 80; ++t) {
|
|
724
|
+
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
725
|
+
}
|
|
726
|
+
let a = H[0];
|
|
727
|
+
let b = H[1];
|
|
728
|
+
let c = H[2];
|
|
729
|
+
let d = H[3];
|
|
730
|
+
let e = H[4];
|
|
731
|
+
for (let t = 0; t < 80; ++t) {
|
|
732
|
+
const s = Math.floor(t / 20);
|
|
733
|
+
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
734
|
+
e = d;
|
|
735
|
+
d = c;
|
|
736
|
+
c = ROTL(b, 30) >>> 0;
|
|
737
|
+
b = a;
|
|
738
|
+
a = T;
|
|
739
|
+
}
|
|
740
|
+
H[0] = H[0] + a >>> 0;
|
|
741
|
+
H[1] = H[1] + b >>> 0;
|
|
742
|
+
H[2] = H[2] + c >>> 0;
|
|
743
|
+
H[3] = H[3] + d >>> 0;
|
|
744
|
+
H[4] = H[4] + e >>> 0;
|
|
745
|
+
}
|
|
746
|
+
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const v5 = v35('v5', 0x50, sha1);
|
|
750
|
+
var uuidv5 = v5;
|
|
751
|
+
|
|
752
|
+
const ESCAPE = {
|
|
753
|
+
"n": "\n",
|
|
754
|
+
"f": "\f",
|
|
755
|
+
"r": "\r",
|
|
756
|
+
"t": " ",
|
|
757
|
+
"v": "\v"
|
|
758
|
+
};
|
|
759
|
+
const CONSTANTS = {
|
|
760
|
+
"null": data => null,
|
|
761
|
+
"true": data => true,
|
|
762
|
+
"false": data => false,
|
|
763
|
+
"undefined": data => void 0
|
|
764
|
+
};
|
|
765
|
+
const OPERATORS = {
|
|
766
|
+
"+": (data, a, b) => a(data) + b(data),
|
|
767
|
+
"-": (data, a, b) => a(data) - b(data),
|
|
768
|
+
"*": (data, a, b) => a(data) * b(data),
|
|
769
|
+
"/": (data, a, b) => a(data) / b(data),
|
|
770
|
+
"%": (data, a, b) => a(data) % b(data),
|
|
771
|
+
"===": (data, a, b) => a(data) === b(data),
|
|
772
|
+
"!==": (data, a, b) => a(data) !== b(data),
|
|
773
|
+
"==": (data, a, b) => a(data) == b(data),
|
|
774
|
+
"!=": (data, a, b) => a(data) != b(data),
|
|
775
|
+
"<": (data, a, b) => a(data) < b(data),
|
|
776
|
+
">": (data, a, b) => a(data) > b(data),
|
|
777
|
+
"<=": (data, a, b) => a(data) <= b(data),
|
|
778
|
+
">=": (data, a, b) => a(data) >= b(data),
|
|
779
|
+
"&&": (data, a, b) => a(data) && b(data),
|
|
780
|
+
"||": (data, a, b) => a(data) || b(data),
|
|
781
|
+
"!": (data, a) => !a(data)
|
|
782
|
+
};
|
|
783
|
+
function isNumber(char) {
|
|
784
|
+
return char >= "0" && char <= "9" && typeof char === "string";
|
|
785
|
+
}
|
|
786
|
+
function isExpOperator(char) {
|
|
787
|
+
return char === "-" || char === "+" || isNumber(char);
|
|
788
|
+
}
|
|
789
|
+
function isIdent(char) {
|
|
790
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
791
|
+
}
|
|
792
|
+
class Expression {
|
|
793
|
+
constructor(content) {
|
|
794
|
+
if (!content) throw new Error("invalid expression");
|
|
795
|
+
this.content = content;
|
|
796
|
+
}
|
|
797
|
+
lex() {
|
|
798
|
+
let content = this.content;
|
|
799
|
+
let length = content.length;
|
|
800
|
+
let index = 0;
|
|
801
|
+
let tokens = [];
|
|
802
|
+
while (index < length) {
|
|
803
|
+
let char = content.charAt(index);
|
|
804
|
+
if (char === '"' || char === "'") {
|
|
805
|
+
let start = ++index;
|
|
806
|
+
let escape = false;
|
|
807
|
+
let value = "";
|
|
808
|
+
let token;
|
|
809
|
+
while (index < length) {
|
|
810
|
+
let c = content.charAt(index);
|
|
811
|
+
if (escape) {
|
|
812
|
+
if (c === "u") {
|
|
813
|
+
let hex = content.substring(index + 1, index + 5);
|
|
814
|
+
if (!hex.match(/[\da-f]{4}/i)) {
|
|
815
|
+
throw new Error(`invalid expression: ${content}, invalid unicode escape [\\u${hex}]`);
|
|
816
|
+
}
|
|
817
|
+
index += 4;
|
|
818
|
+
value += String.fromCharCode(parseInt(hex, 16));
|
|
819
|
+
} else {
|
|
820
|
+
let rep = ESCAPE[c];
|
|
821
|
+
value = value + (rep || c);
|
|
822
|
+
}
|
|
823
|
+
escape = false;
|
|
824
|
+
} else if (c === "\\") {
|
|
825
|
+
escape = true;
|
|
826
|
+
} else if (c === char) {
|
|
827
|
+
index++;
|
|
828
|
+
token = {
|
|
829
|
+
index: start,
|
|
830
|
+
constant: true,
|
|
831
|
+
text: char + value + char,
|
|
832
|
+
value
|
|
833
|
+
};
|
|
834
|
+
break;
|
|
835
|
+
} else {
|
|
836
|
+
value += c;
|
|
837
|
+
}
|
|
838
|
+
index++;
|
|
839
|
+
}
|
|
840
|
+
if (!token) {
|
|
841
|
+
throw new Error(`invalid expression: ${content}`);
|
|
842
|
+
} else {
|
|
843
|
+
tokens.push(token);
|
|
844
|
+
}
|
|
845
|
+
} else if (isNumber(char) || char === "." && isNumber(content.charAt(index + 1))) {
|
|
846
|
+
let start = index;
|
|
847
|
+
let value = "";
|
|
848
|
+
while (index < length) {
|
|
849
|
+
let c = content.charAt(index).toLowerCase();
|
|
850
|
+
if (c === "." || isNumber(c)) {
|
|
851
|
+
value += c;
|
|
852
|
+
} else {
|
|
853
|
+
let c2 = content.charAt(index + 1);
|
|
854
|
+
if (c === "e" && isExpOperator(c2)) {
|
|
855
|
+
value += c;
|
|
856
|
+
} else if (isExpOperator(c) && c2 && isNumber(c2) && value.charAt(value.length - 1) === "e") {
|
|
857
|
+
value += c;
|
|
858
|
+
} else if (isExpOperator(c) && (!c2 || !isNumber(c2)) && value.charAt(value.length - 1) == "e") {
|
|
859
|
+
throw new Error(`invalid expression: ${content}`);
|
|
860
|
+
} else {
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
index++;
|
|
865
|
+
}
|
|
866
|
+
tokens.push({
|
|
867
|
+
index: start,
|
|
868
|
+
constant: true,
|
|
869
|
+
text: value,
|
|
870
|
+
value: Number(value)
|
|
871
|
+
});
|
|
872
|
+
} else if (isIdent(char)) {
|
|
873
|
+
let start = index;
|
|
874
|
+
while (index < length) {
|
|
875
|
+
let c = content.charAt(index);
|
|
876
|
+
if (!(isIdent(c) || isNumber(c))) {
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
index++;
|
|
880
|
+
}
|
|
881
|
+
tokens.push({
|
|
882
|
+
index: start,
|
|
883
|
+
text: content.slice(start, index),
|
|
884
|
+
identifier: true
|
|
885
|
+
});
|
|
886
|
+
} else if ("(){}[].,:?".indexOf(char) >= 0) {
|
|
887
|
+
tokens.push({
|
|
888
|
+
index,
|
|
889
|
+
text: char
|
|
890
|
+
});
|
|
891
|
+
index++;
|
|
892
|
+
} else if (char === " " || char === "\r" || char === " " || char === "\n" || char === "\v" || char === "\xA0") {
|
|
893
|
+
index++;
|
|
894
|
+
} else {
|
|
895
|
+
let char2 = char + content.charAt(index + 1);
|
|
896
|
+
let char3 = char2 + content.charAt(index + 2);
|
|
897
|
+
let op1 = OPERATORS[char];
|
|
898
|
+
let op2 = OPERATORS[char2];
|
|
899
|
+
let op3 = OPERATORS[char3];
|
|
900
|
+
if (op1 || op2 || op3) {
|
|
901
|
+
let text = op3 ? char3 : op2 ? char2 : char;
|
|
902
|
+
tokens.push({
|
|
903
|
+
index,
|
|
904
|
+
text,
|
|
905
|
+
operator: true
|
|
906
|
+
});
|
|
907
|
+
index += text.length;
|
|
908
|
+
} else {
|
|
909
|
+
throw new Error(`invalid expression: ${content}`);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
this.tokens = tokens;
|
|
914
|
+
return tokens;
|
|
915
|
+
}
|
|
916
|
+
parse() {
|
|
917
|
+
let tokens = this.lex();
|
|
918
|
+
let func;
|
|
919
|
+
let token = tokens[0];
|
|
920
|
+
let text = token.text;
|
|
921
|
+
if (tokens.length > 0 && text !== "}" && text !== ")" && text !== "]") {
|
|
922
|
+
func = this.expression();
|
|
923
|
+
}
|
|
924
|
+
return data => func && func(data);
|
|
925
|
+
}
|
|
926
|
+
expect(text) {
|
|
927
|
+
let tokens = this.tokens;
|
|
928
|
+
let token = tokens[0];
|
|
929
|
+
if (!text || text === (token && token.text)) {
|
|
930
|
+
return tokens.shift();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
consume(text) {
|
|
934
|
+
if (!this.tokens.length) throw new Error(`parse expression error: ${this.content}`);
|
|
935
|
+
let token = this.expect(text);
|
|
936
|
+
if (!token) throw new Error(`parse expression error: ${this.content}`);
|
|
937
|
+
return token;
|
|
938
|
+
}
|
|
939
|
+
expression() {
|
|
940
|
+
return this.ternary();
|
|
941
|
+
}
|
|
942
|
+
ternary() {
|
|
943
|
+
let left = this.logicalOR();
|
|
944
|
+
if (this.expect("?")) {
|
|
945
|
+
let middle = this.expression();
|
|
946
|
+
this.consume(":");
|
|
947
|
+
let right = this.expression();
|
|
948
|
+
return data => left(data) ? middle(data) : right(data);
|
|
949
|
+
}
|
|
950
|
+
return left;
|
|
951
|
+
}
|
|
952
|
+
binary(left, op, right) {
|
|
953
|
+
let fn = OPERATORS[op];
|
|
954
|
+
return data => fn(data, left, right);
|
|
955
|
+
}
|
|
956
|
+
unary() {
|
|
957
|
+
let token;
|
|
958
|
+
if (this.expect("+")) {
|
|
959
|
+
return this.primary();
|
|
960
|
+
} else if (token = this.expect("-")) {
|
|
961
|
+
return this.binary(data => 0, token.text, this.unary());
|
|
962
|
+
} else if (token = this.expect("!")) {
|
|
963
|
+
let fn = OPERATORS[token.text];
|
|
964
|
+
let right = this.unary();
|
|
965
|
+
return data => fn(data, right);
|
|
966
|
+
} else {
|
|
967
|
+
return this.primary();
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
logicalOR() {
|
|
971
|
+
let left = this.logicalAND();
|
|
972
|
+
let token;
|
|
973
|
+
while (token = this.expect("||")) {
|
|
974
|
+
left = this.binary(left, token.text, this.logicalAND());
|
|
975
|
+
}
|
|
976
|
+
return left;
|
|
977
|
+
}
|
|
978
|
+
logicalAND() {
|
|
979
|
+
let left = this.equality();
|
|
980
|
+
let token;
|
|
981
|
+
while (token = this.expect("&&")) {
|
|
982
|
+
left = this.binary(left, token.text, this.equality());
|
|
983
|
+
}
|
|
984
|
+
return left;
|
|
985
|
+
}
|
|
986
|
+
equality() {
|
|
987
|
+
let left = this.relational();
|
|
988
|
+
let token;
|
|
989
|
+
while (token = this.expect("==") || this.expect("!=") || this.expect("===") || this.expect("!==")) {
|
|
990
|
+
left = this.binary(left, token.text, this.relational());
|
|
991
|
+
}
|
|
992
|
+
return left;
|
|
993
|
+
}
|
|
994
|
+
relational() {
|
|
995
|
+
let left = this.additive();
|
|
996
|
+
let token;
|
|
997
|
+
while (token = this.expect("<") || this.expect(">") || this.expect("<=") || this.expect(">=")) {
|
|
998
|
+
left = this.binary(left, token.text, this.additive());
|
|
999
|
+
}
|
|
1000
|
+
return left;
|
|
1001
|
+
}
|
|
1002
|
+
additive() {
|
|
1003
|
+
let left = this.multiplicative();
|
|
1004
|
+
let token;
|
|
1005
|
+
while (token = this.expect("+") || this.expect("-")) {
|
|
1006
|
+
left = this.binary(left, token.text, this.multiplicative());
|
|
1007
|
+
}
|
|
1008
|
+
return left;
|
|
1009
|
+
}
|
|
1010
|
+
multiplicative() {
|
|
1011
|
+
let left = this.unary();
|
|
1012
|
+
let token;
|
|
1013
|
+
while (token = this.expect("*") || this.expect("/") || this.expect("%")) {
|
|
1014
|
+
left = this.binary(left, token.text, this.unary());
|
|
1015
|
+
}
|
|
1016
|
+
return left;
|
|
1017
|
+
}
|
|
1018
|
+
primary() {
|
|
1019
|
+
let token = this.tokens[0];
|
|
1020
|
+
let primary;
|
|
1021
|
+
if (this.expect("(")) {
|
|
1022
|
+
primary = this.expression();
|
|
1023
|
+
this.consume(")");
|
|
1024
|
+
} else if (this.expect("[")) {
|
|
1025
|
+
primary = this.array();
|
|
1026
|
+
} else if (this.expect("{")) {
|
|
1027
|
+
primary = this.object();
|
|
1028
|
+
} else if (token.identifier && token.text in CONSTANTS) {
|
|
1029
|
+
primary = CONSTANTS[this.consume().text];
|
|
1030
|
+
} else if (token.identifier) {
|
|
1031
|
+
primary = this.identifier();
|
|
1032
|
+
} else if (token.constant) {
|
|
1033
|
+
primary = this.constant();
|
|
1034
|
+
} else {
|
|
1035
|
+
throw new Error(`parse expression error: ${this.content}`);
|
|
1036
|
+
}
|
|
1037
|
+
let next;
|
|
1038
|
+
let context;
|
|
1039
|
+
while (next = this.expect("(") || this.expect("[") || this.expect(".")) {
|
|
1040
|
+
if (next.text === "(") {
|
|
1041
|
+
primary = this.functionCall(primary, context);
|
|
1042
|
+
context = null;
|
|
1043
|
+
} else if (next.text === "[") {
|
|
1044
|
+
context = primary;
|
|
1045
|
+
primary = this.objectIndex(primary);
|
|
1046
|
+
} else {
|
|
1047
|
+
context = primary;
|
|
1048
|
+
primary = this.fieldAccess(primary);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
return primary;
|
|
1052
|
+
}
|
|
1053
|
+
fieldAccess(object) {
|
|
1054
|
+
let getter = this.identifier();
|
|
1055
|
+
return data => {
|
|
1056
|
+
let o = object(data);
|
|
1057
|
+
return o && getter(o);
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
objectIndex(object) {
|
|
1061
|
+
let indexFn = this.expression();
|
|
1062
|
+
this.consume("]");
|
|
1063
|
+
return data => {
|
|
1064
|
+
let o = object(data);
|
|
1065
|
+
let key = indexFn(data) + "";
|
|
1066
|
+
return o && o[key];
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
functionCall(func, context) {
|
|
1070
|
+
let args = [];
|
|
1071
|
+
if (this.tokens[0].text !== ")") {
|
|
1072
|
+
do {
|
|
1073
|
+
args.push(this.expression());
|
|
1074
|
+
} while (this.expect(","));
|
|
1075
|
+
}
|
|
1076
|
+
this.consume(")");
|
|
1077
|
+
return data => {
|
|
1078
|
+
let callContext = context && context(data);
|
|
1079
|
+
let fn = func(data, callContext);
|
|
1080
|
+
return fn && fn.apply(callContext, args.length ? args.map(arg => arg(data)) : null);
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
array() {
|
|
1084
|
+
let elements = [];
|
|
1085
|
+
let token = this.tokens[0];
|
|
1086
|
+
if (token.text !== "]") {
|
|
1087
|
+
do {
|
|
1088
|
+
if (this.tokens[0].text === "]") break;
|
|
1089
|
+
elements.push(this.expression());
|
|
1090
|
+
} while (this.expect(","));
|
|
1091
|
+
}
|
|
1092
|
+
this.consume("]");
|
|
1093
|
+
return data => elements.map(element => element(data));
|
|
1094
|
+
}
|
|
1095
|
+
object() {
|
|
1096
|
+
let keys = [];
|
|
1097
|
+
let values = [];
|
|
1098
|
+
let token = this.tokens[0];
|
|
1099
|
+
if (token.text !== "}") {
|
|
1100
|
+
do {
|
|
1101
|
+
token = this.tokens[0];
|
|
1102
|
+
if (token.text === "}") break;
|
|
1103
|
+
token = this.consume();
|
|
1104
|
+
if (token.constant) {
|
|
1105
|
+
keys.push(token.value);
|
|
1106
|
+
} else if (token.identifier) {
|
|
1107
|
+
keys.push(token.text);
|
|
1108
|
+
} else {
|
|
1109
|
+
throw new Error(`parse expression error: ${this.content}`);
|
|
1110
|
+
}
|
|
1111
|
+
this.consume(":");
|
|
1112
|
+
values.push(this.expression());
|
|
1113
|
+
} while (this.expect(","));
|
|
1114
|
+
}
|
|
1115
|
+
this.consume("}");
|
|
1116
|
+
return data => {
|
|
1117
|
+
let object = {};
|
|
1118
|
+
for (let i = 0, length = values.length; i < length; i++) {
|
|
1119
|
+
object[keys[i]] = values[i](data);
|
|
1120
|
+
}
|
|
1121
|
+
return object;
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
identifier() {
|
|
1125
|
+
let id = this.consume().text;
|
|
1126
|
+
let token = this.tokens[0];
|
|
1127
|
+
let token2 = this.tokens[1];
|
|
1128
|
+
let token3 = this.tokens[2];
|
|
1129
|
+
while (token && token.text === "." && token2 && token2.identifier && token3 && token3.text !== "(") {
|
|
1130
|
+
id += this.consume().text + this.consume().text;
|
|
1131
|
+
token = this.tokens[0];
|
|
1132
|
+
token2 = this.tokens[1];
|
|
1133
|
+
token3 = this.tokens[2];
|
|
1134
|
+
}
|
|
1135
|
+
return data => {
|
|
1136
|
+
let elements = id.split(".");
|
|
1137
|
+
let key;
|
|
1138
|
+
for (let i = 0; elements.length > 1; i++) {
|
|
1139
|
+
key = elements.shift();
|
|
1140
|
+
data = data[key];
|
|
1141
|
+
if (!data) break;
|
|
1142
|
+
}
|
|
1143
|
+
key = elements.shift();
|
|
1144
|
+
return data && data[key];
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
constant() {
|
|
1148
|
+
let value = this.consume().value;
|
|
1149
|
+
return data => value;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
const parse = (expression, props = {}) => {
|
|
1153
|
+
if (!expression) throw new Error("expression is required");
|
|
1154
|
+
const execParse = new Expression(expression).parse();
|
|
1155
|
+
return execParse(props);
|
|
1156
|
+
};
|
|
468
1157
|
|
|
1158
|
+
//
|
|
1159
|
+
const MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002';
|
|
469
1160
|
var script$7 = {
|
|
470
1161
|
props: {
|
|
471
1162
|
record: {
|
|
@@ -476,7 +1167,79 @@
|
|
|
476
1167
|
default: () => []
|
|
477
1168
|
}
|
|
478
1169
|
},
|
|
1170
|
+
inject: {
|
|
1171
|
+
requestTreeData: {
|
|
1172
|
+
default: void 0
|
|
1173
|
+
},
|
|
1174
|
+
requestTableData: {
|
|
1175
|
+
default: void 0
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
computed: {
|
|
1179
|
+
menuKeyDelimiter() {
|
|
1180
|
+
return uuidv5('_', MENU_KEY_NAMESPACE);
|
|
1181
|
+
},
|
|
1182
|
+
builtInMethods() {
|
|
1183
|
+
return {
|
|
1184
|
+
requestTreeData: this.requestTreeData,
|
|
1185
|
+
requestTableData: this.requestTableData
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
479
1189
|
methods: {
|
|
1190
|
+
execOperationExpression(dataSource = []) {
|
|
1191
|
+
const ret = dataSource.map(item => {
|
|
1192
|
+
const {
|
|
1193
|
+
show
|
|
1194
|
+
} = item;
|
|
1195
|
+
if (shared.type.isUndefined(show)) {
|
|
1196
|
+
return item;
|
|
1197
|
+
} else if (shared.type.isBool(show)) {
|
|
1198
|
+
if (show) return item;
|
|
1199
|
+
} else if (shared.type.isStr(show)) {
|
|
1200
|
+
const parseRet = parse(show, {
|
|
1201
|
+
...this.record,
|
|
1202
|
+
_route: shared.route.searchToQueryParams(window.location.search)
|
|
1203
|
+
});
|
|
1204
|
+
if (parseRet) return item;
|
|
1205
|
+
}
|
|
1206
|
+
}).filter(item => item);
|
|
1207
|
+
return ret;
|
|
1208
|
+
},
|
|
1209
|
+
handleClickConfirm(props) {
|
|
1210
|
+
//TODO generate event by special rule
|
|
1211
|
+
const {
|
|
1212
|
+
eventName,
|
|
1213
|
+
value
|
|
1214
|
+
} = props;
|
|
1215
|
+
this.$emit(eventName, {
|
|
1216
|
+
key: value,
|
|
1217
|
+
record: this.record,
|
|
1218
|
+
builtInMethods: this.builtInMethods
|
|
1219
|
+
});
|
|
1220
|
+
},
|
|
1221
|
+
handleDropdownClick(props) {
|
|
1222
|
+
const {
|
|
1223
|
+
key
|
|
1224
|
+
} = props;
|
|
1225
|
+
const [parent, child] = key.split(this.menuKeyDelimiter);
|
|
1226
|
+
if (!parent || !child) {
|
|
1227
|
+
throw new Error('key is required');
|
|
1228
|
+
}
|
|
1229
|
+
const currentDropdown = this.dataSource.find(item => item.key === parent);
|
|
1230
|
+
const currentClickTarget = currentDropdown.optionList.find(item => item.value === child);
|
|
1231
|
+
const {
|
|
1232
|
+
eventName,
|
|
1233
|
+
type
|
|
1234
|
+
} = currentClickTarget;
|
|
1235
|
+
//TODO generate event by special rule
|
|
1236
|
+
if (type === 'confirm') return;
|
|
1237
|
+
this.$emit(eventName, {
|
|
1238
|
+
key: child,
|
|
1239
|
+
record: this.record,
|
|
1240
|
+
builtInMethods: this.builtInMethods
|
|
1241
|
+
});
|
|
1242
|
+
},
|
|
480
1243
|
handleClickText(props) {
|
|
481
1244
|
const {
|
|
482
1245
|
eventName,
|
|
@@ -484,7 +1247,8 @@
|
|
|
484
1247
|
} = props;
|
|
485
1248
|
this.$emit(eventName, {
|
|
486
1249
|
key,
|
|
487
|
-
record: this.record
|
|
1250
|
+
record: this.record,
|
|
1251
|
+
builtInMethods: this.builtInMethods
|
|
488
1252
|
});
|
|
489
1253
|
}
|
|
490
1254
|
}
|
|
@@ -501,23 +1265,77 @@
|
|
|
501
1265
|
return _c(
|
|
502
1266
|
"div",
|
|
503
1267
|
{ staticClass: "g-table__action" },
|
|
504
|
-
_vm._l(_vm.dataSource, function (item, idx) {
|
|
1268
|
+
_vm._l(_vm.execOperationExpression(_vm.dataSource), function (item, idx) {
|
|
505
1269
|
return _c(
|
|
506
1270
|
"div",
|
|
507
1271
|
{ key: idx, staticClass: "table-action__item" },
|
|
508
1272
|
[
|
|
509
1273
|
item.type == "text"
|
|
1274
|
+
? [_c("span", [_vm._v(_vm._s(item.label))])]
|
|
1275
|
+
: item.type == "dropdown"
|
|
510
1276
|
? [
|
|
511
1277
|
_c(
|
|
512
|
-
"
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
1278
|
+
"a-dropdown",
|
|
1279
|
+
[
|
|
1280
|
+
_c(
|
|
1281
|
+
"a-menu",
|
|
1282
|
+
{
|
|
1283
|
+
attrs: { slot: "overlay" },
|
|
1284
|
+
on: { click: _vm.handleDropdownClick },
|
|
1285
|
+
slot: "overlay",
|
|
517
1286
|
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
1287
|
+
_vm._l(
|
|
1288
|
+
_vm.execOperationExpression(item.optionList),
|
|
1289
|
+
function (opt) {
|
|
1290
|
+
return _c(
|
|
1291
|
+
"a-menu-item",
|
|
1292
|
+
{
|
|
1293
|
+
key:
|
|
1294
|
+
"" +
|
|
1295
|
+
(item.key || "") +
|
|
1296
|
+
_vm.menuKeyDelimiter +
|
|
1297
|
+
(opt.value || ""),
|
|
1298
|
+
},
|
|
1299
|
+
[
|
|
1300
|
+
opt.type == "confirm"
|
|
1301
|
+
? [
|
|
1302
|
+
_c(
|
|
1303
|
+
"a-popconfirm",
|
|
1304
|
+
{
|
|
1305
|
+
attrs: { title: opt.message },
|
|
1306
|
+
on: {
|
|
1307
|
+
confirm: function ($event) {
|
|
1308
|
+
return _vm.handleClickConfirm(opt)
|
|
1309
|
+
},
|
|
1310
|
+
},
|
|
1311
|
+
},
|
|
1312
|
+
[
|
|
1313
|
+
_vm._v(
|
|
1314
|
+
"\n " +
|
|
1315
|
+
_vm._s(opt.label) +
|
|
1316
|
+
"\n "
|
|
1317
|
+
),
|
|
1318
|
+
]
|
|
1319
|
+
),
|
|
1320
|
+
]
|
|
1321
|
+
: [
|
|
1322
|
+
_vm._v(
|
|
1323
|
+
"\n " +
|
|
1324
|
+
_vm._s(opt.label) +
|
|
1325
|
+
"\n "
|
|
1326
|
+
),
|
|
1327
|
+
],
|
|
1328
|
+
],
|
|
1329
|
+
2
|
|
1330
|
+
)
|
|
1331
|
+
}
|
|
1332
|
+
),
|
|
1333
|
+
1
|
|
1334
|
+
),
|
|
1335
|
+
_vm._v(" "),
|
|
1336
|
+
_c("span", [_vm._v(_vm._s(item.label))]),
|
|
1337
|
+
],
|
|
1338
|
+
1
|
|
521
1339
|
),
|
|
522
1340
|
]
|
|
523
1341
|
: _vm._e(),
|
|
@@ -534,11 +1352,11 @@
|
|
|
534
1352
|
/* style */
|
|
535
1353
|
const __vue_inject_styles__$7 = function (inject) {
|
|
536
1354
|
if (!inject) return
|
|
537
|
-
inject("data-v-
|
|
1355
|
+
inject("data-v-2708b08a_0", { source: ".g-table__action[data-v-2708b08a] {\n display: flex;\n flex-direction: row;\n}\n.g-table__action .table-action__item[data-v-2708b08a] {\n font-size: 14px;\n color: #409EFF;\n margin-left: 16px;\n cursor: pointer;\n}\n.g-table__action .table-action__item[data-v-2708b08a]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=action.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\table\\src\\action.vue","action.vue"],"names":[],"mappings":"AAsHA;EACA,aAAA;EACA,mBAAA;ACrHA;ADsHA;EACA,eAAA;EACA,cAAA;EACA,iBAAA;EACA,eAAA;ACpHA;ADqHA;EACA,cAAA;ACnHA;;AAEA,qCAAqC","file":"action.vue","sourcesContent":["<template>\r\n <div class=\"g-table__action\">\r\n <div class=\"table-action__item\" v-for=\"(item, idx) in execOperationExpression(dataSource)\" :key=\"idx\">\r\n <template v-if=\"item.type == 'text'\">\r\n <span>{{ item.label }}</span>\r\n </template>\r\n <template v-else-if=\"item.type == 'dropdown'\">\r\n <a-dropdown>\r\n <a-menu slot=\"overlay\" @click=\"handleDropdownClick\">\r\n <a-menu-item :key=\"`${item.key || ''}${menuKeyDelimiter}${opt.value || ''}`\" v-for=\"opt in execOperationExpression(item.optionList)\">\r\n <template v-if=\"opt.type == 'confirm'\">\r\n <a-popconfirm :title=\"opt.message\" @confirm=\"handleClickConfirm(opt)\">\r\n {{ opt.label }}\r\n </a-popconfirm>\r\n </template>\r\n <template v-else>\r\n {{ opt.label }}\r\n </template>\r\n </a-menu-item>\r\n </a-menu>\r\n <span>{{ item.label }}</span>\r\n </a-dropdown>\r\n </template>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { v5 as uuidv5 } from 'uuid'\r\nimport { type, route } from '@idooel/shared'\r\nimport { parse } from '@idooel/expression'\r\nconst MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002'\r\nexport default {\r\n props: {\r\n record: {\r\n type: Object\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n inject: {\r\n requestTreeData: {\r\n default: void 0\r\n },\r\n requestTableData: {\r\n default: void 0\r\n }\r\n },\r\n computed: {\r\n menuKeyDelimiter () {\r\n return uuidv5('_', MENU_KEY_NAMESPACE)\r\n },\r\n builtInMethods () {\r\n return { \r\n requestTreeData: this.requestTreeData, \r\n requestTableData: this.requestTableData \r\n }\r\n }\r\n },\r\n methods: {\r\n execOperationExpression (dataSource = []) {\r\n const ret = dataSource.map(item => {\r\n const { show } = item\r\n if (type.isUndefined(show)) {\r\n return item\r\n } else if (type.isBool(show)) {\r\n if (show) return item\r\n } else if (type.isStr(show)) {\r\n const parseRet = parse(show, { \r\n ...this.record, \r\n _route: route.searchToQueryParams(window.location.search) \r\n })\r\n if (parseRet) return item\r\n }\r\n }).filter(item => item)\r\n return ret\r\n },\r\n handleClickConfirm (props) {\r\n //TODO generate event by special rule\r\n const { eventName, value } = props\r\n this.$emit(eventName, { \r\n key: value, \r\n record: this.record,\r\n builtInMethods: this.builtInMethods \r\n })\r\n },\r\n handleDropdownClick (props) {\r\n const { key } = props\r\n const [parent, child] = key.split(this.menuKeyDelimiter)\r\n if (!parent || !child) {\r\n throw new Error('key is required')\r\n }\r\n const currentDropdown = this.dataSource.find(item => item.key === parent)\r\n const currentClickTarget = currentDropdown.optionList.find(item => item.value === child)\r\n const { eventName, type } = currentClickTarget\r\n //TODO generate event by special rule\r\n if (type === 'confirm') return\r\n this.$emit(eventName, { \r\n key: child, \r\n record: this.record, \r\n builtInMethods: this.builtInMethods \r\n })\r\n },\r\n handleClickText (props) {\r\n const { eventName, key } = props\r\n this.$emit(eventName, { \r\n key, \r\n record: this.record, \r\n builtInMethods: this.builtInMethods \r\n })\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-table__action {\r\n display: flex;\r\n flex-direction: row;\r\n .table-action__item {\r\n font-size: 14px;\r\n color: #409EFF;\r\n margin-left: 16px;\r\n cursor: pointer;\r\n &:first-child {\r\n margin-left: 0;\r\n }\r\n }\r\n}\r\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
1356
|
|
|
539
1357
|
};
|
|
540
1358
|
/* scoped */
|
|
541
|
-
const __vue_scope_id__$7 = "data-v-
|
|
1359
|
+
const __vue_scope_id__$7 = "data-v-2708b08a";
|
|
542
1360
|
/* module identifier */
|
|
543
1361
|
const __vue_module_identifier__$7 = undefined;
|
|
544
1362
|
/* functional template */
|
|
@@ -677,11 +1495,11 @@
|
|
|
677
1495
|
/* style */
|
|
678
1496
|
const __vue_inject_styles__$6 = function (inject) {
|
|
679
1497
|
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 });
|
|
1498
|
+
inject("data-v-6f3faf52_0", { source: ".g-table__wrapper[data-v-6f3faf52] {\n padding: 16px;\n padding-top: unset;\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table {\n border-width: calc(var(--idooel-border-width) * 1px);\n border-style: solid;\n border-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-header .ant-table-fixed {\n /* border-bottom: 2px solid #53a8ff !important; */\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-tbody tr td {\n border-color: var(--idooel-column-border-color);\n border-width: calc(var(--idooel-column-border-width) * 1px);\n border-style: solid;\n border-top: unset;\n border-left: unset;\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-body {\n border-top-width: calc(var(--idooel-border-width) * 1px);\n border-top-style: solid;\n border-top-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-left {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-left .ant-table-header {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-left .ant-table-body-inner {\n border-right-width: calc(var(--idooel-border-width) * 1px);\n border-right-style: solid;\n border-right-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-left .ant-table-fixed {\n border-right-width: calc(var(--idooel-border-width) * 1px);\n border-right-color: var(--idooel-border-color);\n border-right-style: solid;\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-right {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-right .ant-table-header {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-color: var(--idooel-border-color);\n border-bottom-style: solid;\n}\n.g-table__wrapper[data-v-6f3faf52] .ant-table-wrapper .ant-table-fixed-right .ant-table-fixed {\n border-left-width: calc(var(--idooel-border-width) * 1px);\n border-left-style: solid;\n border-left-color: var(--idooel-border-color);\n}\n.g-table__wrapper .g-table__pagination[data-v-6f3faf52] {\n /* margin-top: 8px; */\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-width: calc(var(--idooel-border-width) * 1px);\n border-color: var(--idooel-border-color);\n border-style: solid;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\table\\src\\index.vue","index.vue"],"names":[],"mappings":"AA4EA;EAgEA,aAAA;EACA,kBAAA;AC1IA;AD2EA;EACA,oDAAA;EACA,mBAAA;EACA,wCAAA;ACzEA;AD4EA;EACA,iDAAA;AC1EA;AD+EA;EACA,+CAAA;EACA,2DAAA;EACA,mBAAA;EACA,iBAAA;EACA,kBAAA;AC7EA;ADiFA;EACA,wDAAA;EACA,uBAAA;EACA,4CAAA;AC/EA;ADiFA;EACA,2DAAA;EACA,0BAAA;EACA,+CAAA;AC/EA;ADgFA;EACA,2DAAA;EACA,0BAAA;EACA,+CAAA;AC9EA;ADgFA;EACA,0DAAA;EACA,yBAAA;EACA,8CAAA;AC9EA;ADgFA;EACA,0DAAA;EACA,8CAAA;EACA,yBAAA;AC9EA;ADiFA;EAMA,2DAAA;EACA,0BAAA;EACA,+CAAA;ACpFA;AD6EA;EACA,2DAAA;EACA,+CAAA;EACA,0BAAA;AC3EA;ADgFA;EACA,yDAAA;EACA,wBAAA;EACA,6CAAA;AC9EA;ADsFA;EACA,qBAAA;EACA,aAAA;EACA,mBAAA;EACA,oBAAA;EACA,oDAAA;EACA,wCAAA;EACA,mBAAA;EACA,iBAAA;EACA,gBAAA;EACA,mBAAA;ACpFA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"g-table__wrapper\">\r\n <a-table\r\n :pagination=\"false\"\r\n :loading=\"loading\"\r\n :columns=\"columns\"\r\n :row-class-name=\"setRowClassName\"\r\n :data-source=\"dataSource\"\r\n :scroll=\"{ x: 1500, y: 500 }\">\r\n <template slot=\"action\" slot-scope=\"record\">\r\n <Actions v-on=\"$listeners\" :data-source=\"actions\" :record=\"record\"></Actions>\r\n </template>\r\n </a-table>\r\n <div class=\"g-table__pagination\">\r\n <a-pagination\r\n :show-total=\"total => `共 ${total} 条数据`\"\r\n show-size-changer \r\n show-quick-jumper\r\n :pageSize=\"pageSize\"\r\n :pageSizeOptions=\"pageSizeOptions\"\r\n @change=\"onChangePagination\" \r\n :total=\"total\">\r\n </a-pagination>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport Actions from './action.vue'\r\nexport default {\r\n name: 'ele-table',\r\n components: {\r\n Actions\r\n },\r\n props: {\r\n actions: {\r\n type: Array,\r\n default: () => []\r\n },\r\n total: {\r\n type: Number,\r\n default: 0\r\n },\r\n loading: {\r\n type: Boolean,\r\n default: false\r\n },\r\n columns: {\r\n type: Array,\r\n default: () => []\r\n },\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n },\r\n pageSize: {\r\n type: Number,\r\n default: 10\r\n },\r\n pageSizeOptions: {\r\n type: Array,\r\n default: () => ['10', '20', '30', '40']\r\n }\r\n },\r\n methods: {\r\n setRowClassName (record, idx) {\r\n return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd'\r\n },\r\n onChangePagination (page, pagrSize) {\r\n this.$emit('change-page', page, pagrSize)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-table__wrapper {\r\n ::v-deep .ant-table-wrapper {\r\n .ant-table {\r\n border-width: calc(var(--idooel-border-width) * 1px);\r\n border-style: solid;\r\n border-color: var(--idooel-border-color);\r\n }\r\n .ant-table-header {\r\n .ant-table-fixed {\r\n /* border-bottom: 2px solid #53a8ff !important; */\r\n }\r\n }\r\n .ant-table-tbody {\r\n tr {\r\n td {\r\n border-color: var(--idooel-column-border-color);\r\n border-width: calc(var(--idooel-column-border-width) * 1px);;\r\n border-style: solid;\r\n border-top: unset;\r\n border-left: unset;\r\n }\r\n }\r\n }\r\n .ant-table-body {\r\n border-top-width: calc(var(--idooel-border-width) * 1px);\r\n border-top-style: solid;\r\n border-top-color: var(--idooel-border-color);\r\n }\r\n .ant-table-fixed-left {\r\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\r\n border-bottom-style: solid;\r\n border-bottom-color: var(--idooel-border-color);\r\n .ant-table-header {\r\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\r\n border-bottom-style: solid;\r\n border-bottom-color: var(--idooel-border-color);\r\n }\r\n .ant-table-body-inner {\r\n border-right-width: calc(var(--idooel-border-width) * 1px);\r\n border-right-style: solid;\r\n border-right-color: var(--idooel-border-color);\r\n }\r\n .ant-table-fixed {\r\n border-right-width: calc(var(--idooel-border-width) * 1px);\r\n border-right-color: var(--idooel-border-color);\r\n border-right-style: solid;\r\n }\r\n }\r\n .ant-table-fixed-right {\r\n .ant-table-header {\r\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\r\n border-bottom-color: var(--idooel-border-color);\r\n border-bottom-style: solid;\r\n }\r\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\r\n border-bottom-style: solid;\r\n border-bottom-color: var(--idooel-border-color);\r\n .ant-table-fixed {\r\n border-left-width: calc(var(--idooel-border-width) * 1px);\r\n border-left-style: solid;\r\n border-left-color: var(--idooel-border-color);\r\n }\r\n }\r\n }\r\n padding: 16px;\r\n padding-top: unset;\r\n .g-table__row--even {}\r\n .g-table__row--odd {}\r\n .g-table__pagination {\r\n /* margin-top: 8px; */\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: end;\r\n border-width: calc(var(--idooel-border-width) * 1px);\r\n border-color: var(--idooel-border-color);\r\n border-style: solid;\r\n border-top: unset;\r\n padding-top: 8px;\r\n padding-bottom: 8px;\r\n }\r\n}\r\n</style>",".g-table__wrapper {\n padding: 16px;\n padding-top: unset;\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table {\n border-width: calc(var(--idooel-border-width) * 1px);\n border-style: solid;\n border-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-header .ant-table-fixed {\n /* border-bottom: 2px solid #53a8ff !important; */\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-tbody tr td {\n border-color: var(--idooel-column-border-color);\n border-width: calc(var(--idooel-column-border-width) * 1px);\n border-style: solid;\n border-top: unset;\n border-left: unset;\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-body {\n border-top-width: calc(var(--idooel-border-width) * 1px);\n border-top-style: solid;\n border-top-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-left {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-left .ant-table-header {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-left .ant-table-body-inner {\n border-right-width: calc(var(--idooel-border-width) * 1px);\n border-right-style: solid;\n border-right-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-left .ant-table-fixed {\n border-right-width: calc(var(--idooel-border-width) * 1px);\n border-right-color: var(--idooel-border-color);\n border-right-style: solid;\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-right {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-style: solid;\n border-bottom-color: var(--idooel-border-color);\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-right .ant-table-header {\n border-bottom-width: calc(var(--idooel-border-width) * 1px);\n border-bottom-color: var(--idooel-border-color);\n border-bottom-style: solid;\n}\n.g-table__wrapper ::v-deep .ant-table-wrapper .ant-table-fixed-right .ant-table-fixed {\n border-left-width: calc(var(--idooel-border-width) * 1px);\n border-left-style: solid;\n border-left-color: var(--idooel-border-color);\n}\n.g-table__wrapper .g-table__pagination {\n /* margin-top: 8px; */\n display: flex;\n flex-direction: row;\n justify-content: end;\n border-width: calc(var(--idooel-border-width) * 1px);\n border-color: var(--idooel-border-color);\n border-style: solid;\n border-top: unset;\n padding-top: 8px;\n padding-bottom: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
681
1499
|
|
|
682
1500
|
};
|
|
683
1501
|
/* scoped */
|
|
684
|
-
const __vue_scope_id__$6 = "data-v-
|
|
1502
|
+
const __vue_scope_id__$6 = "data-v-6f3faf52";
|
|
685
1503
|
/* module identifier */
|
|
686
1504
|
const __vue_module_identifier__$6 = undefined;
|
|
687
1505
|
/* functional template */
|
|
@@ -860,11 +1678,11 @@
|
|
|
860
1678
|
/* style */
|
|
861
1679
|
const __vue_inject_styles__$5 = function (inject) {
|
|
862
1680
|
if (!inject) return
|
|
863
|
-
inject("data-v-
|
|
1681
|
+
inject("data-v-cc99bbf0_0", { source: ".g-tree__wrapper[data-v-cc99bbf0] {\n overflow: hidden;\n}\n.g-tree__wrapper[data-v-cc99bbf0] .ant-tree .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n.g-tree__wrapper[data-v-cc99bbf0] .ant-tree .ant-tree-node-selected {\n color: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\tree\\src\\index.vue","index.vue"],"names":[],"mappings":"AAwFA;EACA,gBAAA;ACvFA;ADyFA;EACA,uBAAA;EACA,gBAAA;EACA,mBAAA;ACvFA;ADyFA;EACA,WAAA;ACvFA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"g-tree__wrapper\">\r\n <a-tree\r\n v-if=\"innerTreeData.length\"\r\n :tree-data=\"innerTreeData\"\r\n @select=\"selectTreeNode\"\r\n :replaceFields=\"replaceFields\"\r\n :default-expanded-keys=\"defaultExpandedKeys\"\r\n :default-selected-keys=\"defaultSelectedKeys\"\r\n blockNode \r\n :show-icon=\"showIcon\">\r\n <template #title=\"{ title }\">\r\n <span :title=\"title\" class=\"tree-node__title\">\r\n {{ title }}\r\n </span>\r\n </template>\r\n <template slot=\"custom\" slot-scope=\"{ scopedSlots }\">\r\n <a-icon :type=\"scopedSlots.iconName\"></a-icon>\r\n </template>\r\n </a-tree>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ele-tree',\r\n props: {\r\n treeData: {\r\n type: Array,\r\n default: () => []\r\n },\r\n replaceFields: {\r\n type: Object,\r\n default: () => ({\r\n title: 'title',\r\n key: 'id',\r\n children: 'children'\r\n })\r\n },\r\n defaultExpandedKeys: {\r\n type: Array\r\n },\r\n defaultSelectedKeys: {\r\n type: Array\r\n },\r\n showIcon: {\r\n type: Boolean,\r\n default: true\r\n }\r\n },\r\n data () {\r\n return {}\r\n },\r\n computed: {\r\n innerTreeData () {\r\n return this.treeData\r\n // return [\r\n // {\r\n // title: 'parent 1',\r\n // key: 1,\r\n // scopedSlots: {\r\n // icon: 'custom',\r\n // iconName: 'smile-o'\r\n // },\r\n // children: [\r\n // {\r\n // title: '2',\r\n // key: 2,\r\n // scopedSlots: {\r\n // icon: 'custom',\r\n // iconName: 'frown-o'\r\n // }\r\n // }\r\n // ]\r\n // }\r\n // ]\r\n }\r\n },\r\n methods: {\r\n refreshTreeStatus (props = {}) {},\r\n selectTreeNode (selectedKeys, e) {\r\n this.$emit('select', selectedKeys, e)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-tree__wrapper {\r\n overflow: hidden;\r\n ::v-deep .ant-tree {\r\n .ant-tree-node-content-wrapper {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n }\r\n .ant-tree-node-selected {\r\n color: #fff;\r\n }\r\n }\r\n}\r\n</style>",".g-tree__wrapper {\n overflow: hidden;\n}\n.g-tree__wrapper ::v-deep .ant-tree .ant-tree-node-content-wrapper {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n.g-tree__wrapper ::v-deep .ant-tree .ant-tree-node-selected {\n color: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
864
1682
|
|
|
865
1683
|
};
|
|
866
1684
|
/* scoped */
|
|
867
|
-
const __vue_scope_id__$5 = "data-v-
|
|
1685
|
+
const __vue_scope_id__$5 = "data-v-cc99bbf0";
|
|
868
1686
|
/* module identifier */
|
|
869
1687
|
const __vue_module_identifier__$5 = undefined;
|
|
870
1688
|
/* functional template */
|
|
@@ -926,11 +1744,11 @@
|
|
|
926
1744
|
/* style */
|
|
927
1745
|
const __vue_inject_styles__$4 = function (inject) {
|
|
928
1746
|
if (!inject) return
|
|
929
|
-
inject("data-v-
|
|
1747
|
+
inject("data-v-40e71716_0", { source: ".g-search__label[data-v-40e71716] {\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-40e71716], .g-search__label .label__suffix[data-v-40e71716] {\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-40e71716] {\n margin-left: 4px;\n}\n\n/*# sourceMappingURL=label.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\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>\r\n <div class=\"g-search__label\">\r\n <span class=\"label__title\">{{ label }}</span>\r\n <span class=\"label__suffix\">:</span>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n props: {\r\n label: {\r\n type: String\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.g-search__label {\r\n /* width: 69px; */\r\n flex-basis: 69px;\r\n height: 32px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n .label__title, .label__suffix {\r\n font-size: 14px;\r\n color: rgba(0, 0, 0, 0.88);\r\n white-space: nowrap;\r\n }\r\n .label__suffix {\r\n margin-left: 4px;\r\n }\r\n}\r\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
1748
|
|
|
931
1749
|
};
|
|
932
1750
|
/* scoped */
|
|
933
|
-
const __vue_scope_id__$4 = "data-v-
|
|
1751
|
+
const __vue_scope_id__$4 = "data-v-40e71716";
|
|
934
1752
|
/* module identifier */
|
|
935
1753
|
const __vue_module_identifier__$4 = undefined;
|
|
936
1754
|
/* functional template */
|
|
@@ -978,17 +1796,34 @@
|
|
|
978
1796
|
required: true
|
|
979
1797
|
}
|
|
980
1798
|
},
|
|
1799
|
+
data() {
|
|
1800
|
+
return {
|
|
1801
|
+
isExpand: false,
|
|
1802
|
+
collapseDataSource: []
|
|
1803
|
+
};
|
|
1804
|
+
},
|
|
981
1805
|
computed: {
|
|
982
1806
|
actionColOffset() {
|
|
983
1807
|
return (24 / this.span - 1) * this.span;
|
|
984
1808
|
},
|
|
985
1809
|
innerDataSource() {
|
|
986
|
-
return [...this.dataSource, {
|
|
1810
|
+
return this.isExpand ? [...this.dataSource, {
|
|
1811
|
+
type: '_action'
|
|
1812
|
+
}] : [...this.collapseDataSource, {
|
|
987
1813
|
type: '_action'
|
|
988
1814
|
}];
|
|
989
1815
|
}
|
|
990
1816
|
},
|
|
1817
|
+
created() {
|
|
1818
|
+
this.collapseDataSource = this.dataSource.slice(0, 24 / this.span - 1);
|
|
1819
|
+
},
|
|
991
1820
|
methods: {
|
|
1821
|
+
handleClickExpandCollapse() {
|
|
1822
|
+
if (!this.isExpand) {
|
|
1823
|
+
this.collapseDataSource = this.dataSource.slice(0, 24 / this.span - 1);
|
|
1824
|
+
}
|
|
1825
|
+
this.isExpand = !this.isExpand;
|
|
1826
|
+
},
|
|
992
1827
|
handleClickSearch() {
|
|
993
1828
|
const querys = this.extractValues();
|
|
994
1829
|
this.$emit('search', querys);
|
|
@@ -998,7 +1833,7 @@
|
|
|
998
1833
|
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
999
1834
|
switch (item.type) {
|
|
1000
1835
|
case 'DatePicker':
|
|
1001
|
-
ret[item.name] =
|
|
1836
|
+
ret[item.name] = typeof item._value == 'undefined' ? undefined : moment__default["default"](item._value).format(item.format);
|
|
1002
1837
|
break;
|
|
1003
1838
|
default:
|
|
1004
1839
|
ret[item.name] = item._value;
|
|
@@ -1014,7 +1849,7 @@
|
|
|
1014
1849
|
this.$set(item, '_value', null);
|
|
1015
1850
|
break;
|
|
1016
1851
|
case 'DatePicker':
|
|
1017
|
-
this.$set(item, '_value',
|
|
1852
|
+
this.$set(item, '_value', undefined);
|
|
1018
1853
|
break;
|
|
1019
1854
|
default:
|
|
1020
1855
|
this.$set(item, '_value', null);
|
|
@@ -1074,6 +1909,30 @@
|
|
|
1074
1909
|
},
|
|
1075
1910
|
[_vm._v("重置")]
|
|
1076
1911
|
),
|
|
1912
|
+
_vm._v(" "),
|
|
1913
|
+
_c(
|
|
1914
|
+
"div",
|
|
1915
|
+
{
|
|
1916
|
+
staticClass: "expand-collapse",
|
|
1917
|
+
on: { click: _vm.handleClickExpandCollapse },
|
|
1918
|
+
},
|
|
1919
|
+
[
|
|
1920
|
+
_c("span", { staticClass: "expand-collapse__text" }, [
|
|
1921
|
+
_vm._v(_vm._s(_vm.isExpand ? "收起" : "展开")),
|
|
1922
|
+
]),
|
|
1923
|
+
_vm._v(" "),
|
|
1924
|
+
_c(
|
|
1925
|
+
"span",
|
|
1926
|
+
{ staticClass: "expand-collapse__icon" },
|
|
1927
|
+
[
|
|
1928
|
+
_vm.isExpand
|
|
1929
|
+
? _c("a-icon", { attrs: { type: "up" } })
|
|
1930
|
+
: _c("a-icon", { attrs: { type: "down" } }),
|
|
1931
|
+
],
|
|
1932
|
+
1
|
|
1933
|
+
),
|
|
1934
|
+
]
|
|
1935
|
+
),
|
|
1077
1936
|
],
|
|
1078
1937
|
1
|
|
1079
1938
|
)
|
|
@@ -1144,11 +2003,11 @@
|
|
|
1144
2003
|
/* style */
|
|
1145
2004
|
const __vue_inject_styles__$3 = function (inject) {
|
|
1146
2005
|
if (!inject) return
|
|
1147
|
-
inject("data-v-
|
|
2006
|
+
inject("data-v-33290002_0", { source: ".search-area__wrapper[data-v-33290002] {\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n}\n.search-area__wrapper[data-v-33290002] .ant-col:last-child {\n float: right;\n}\n.search-area__wrapper .search-area__item[data-v-33290002] {\n height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.search-area__wrapper .search-area__item.search-area--action[data-v-33290002] {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse[data-v-33290002] {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text[data-v-33290002] {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon[data-v-33290002] {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\composite-components\\search-area\\src\\index.vue","index.vue"],"names":[],"mappings":"AAsIA;EACA,iBAAA;EACA,kBAAA;EACA,mBAAA;ACrIA;ADuIA;EACA,YAAA;ACrIA;ADwIA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;ACtIA;ADuIA;EACA,oBAAA;ACrIA;ADuIA;EACA,gBAAA;EACA,YAAA;EACA,iBAAA;EACA,kCAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,uBAAA;EACA,eAAA;ACrIA;ADsIA;EACA,eAAA;ACpIA;ADsIA;EACA,eAAA;EACA,gBAAA;ACpIA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"search-area__wrapper\">\r\n <a-row :gutter=\"gutter\">\r\n <a-col :span=\"item.span || span\" v-for=\"(item, idx) in innerDataSource\" :key=\"idx\">\r\n <div v-if=\"item.type == '_action'\" class=\"search-area__item search-area--action\">\r\n <ele-button icon=\"search\" type=\"primary\" @click=\"handleClickSearch\">查询</ele-button>\r\n <ele-button style=\"margin-left:8px;\" icon=\"reload\" @click=\"handleClickReset\">重置</ele-button>\r\n <div class=\"expand-collapse\" @click=\"handleClickExpandCollapse\">\r\n <span class=\"expand-collapse__text\">{{ isExpand ? '收起' : '展开' }}</span>\r\n <span class=\"expand-collapse__icon\">\r\n <a-icon v-if=\"isExpand\" type=\"up\" />\r\n <a-icon v-else type=\"down\" />\r\n </span>\r\n </div>\r\n </div>\r\n <div v-else class=\"search-area__item\">\r\n <template v-if=\"item.type == 'Input'\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-input v-model=\"item._value\"></ele-input>\r\n </template>\r\n <template v-else-if=\"item.type == 'Select'\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-select v-model=\"item._value\" :data-source=\"item.optionList\"></ele-select>\r\n </template>\r\n <template v-else-if=\"item.type == 'DatePicker'\">\r\n <Label :label=\"item.label\"></Label>\r\n <ele-date v-model=\"item._value\" :format=\"item.format\"></ele-date>\r\n </template>\r\n </div>\r\n </a-col>\r\n </a-row>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport EleInput from '../../../input/src/index.vue'\r\nimport EleSelect from '../../../select/src/index.vue'\r\nimport ELeButton from '../../../button/src/index.vue'\r\nimport EleDate from '../../../date/src/index.vue'\r\nimport Label from './label.vue'\r\nimport moment from 'moment'\r\nexport default {\r\n name: 'ele-search-area',\r\n components: {\r\n EleInput,\r\n EleSelect,\r\n ELeButton,\r\n Label,\r\n EleDate\r\n },\r\n props: {\r\n gutter: {\r\n type: [Number, Array, Object],\r\n default: () => ([\r\n 16, 8\r\n ])\r\n },\r\n span: {\r\n type: Number,\r\n default: 8\r\n },\r\n dataSource: {\r\n type: Array,\r\n required: true\r\n }\r\n },\r\n data() {\r\n return {\r\n isExpand: false,\r\n collapseDataSource: []\r\n }\r\n },\r\n computed: {\r\n actionColOffset () {\r\n return ((24 / this.span) - 1) * this.span\r\n },\r\n innerDataSource () {\r\n return this.isExpand ? [ ...this.dataSource, { type: '_action' }] : [ ...this.collapseDataSource, { type: '_action' }]\r\n }\r\n },\r\n created() {\r\n this.collapseDataSource = this.dataSource.slice(0, (24 / this.span - 1))\r\n },\r\n methods: {\r\n handleClickExpandCollapse () {\r\n if (!this.isExpand) {\r\n this.collapseDataSource = this.dataSource.slice(0, (24 / this.span - 1))\r\n }\r\n this.isExpand = !this.isExpand\r\n },\r\n handleClickSearch () {\r\n const querys = this.extractValues()\r\n this.$emit('search', querys)\r\n },\r\n extractValues () {\r\n let ret = {}\r\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\r\n switch (item.type) {\r\n case 'DatePicker':\r\n ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)\r\n break\r\n default:\r\n ret[item.name] = item._value\r\n break\r\n }\r\n })\r\n return ret\r\n },\r\n handleClickReset () {\r\n this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {\r\n switch (item.type) {\r\n case 'Select':\r\n this.$set(item, '_value', null)\r\n break\r\n case 'DatePicker':\r\n this.$set(item, '_value', undefined)\r\n break\r\n default:\r\n this.$set(item, '_value', null)\r\n break\r\n }\r\n })\r\n //TODO defaultValue\r\n const querys = this.extractValues()\r\n this.$emit('search', querys)\r\n },\r\n onChangeSelect (value, props) {\r\n this.$set(props, '_value', value)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.search-area__wrapper {\r\n padding-top: 16px;\r\n padding-left: 16px;\r\n padding-right: 16px;\r\n ::v-deep .ant-col {\r\n &:last-child {\r\n float: right;\r\n }\r\n }\r\n .search-area__item {\r\n height: 32px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n &.search-area--action {\r\n justify-content: end;\r\n }\r\n .expand-collapse {\r\n margin-left: 8px;\r\n height: 32px;\r\n padding: 4px 16px;\r\n color: var(--idooel-primary-color);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: pointer;\r\n .expand-collapse__text {\r\n font-size: 14px;\r\n }\r\n .expand-collapse__icon {\r\n font-size: 16px;\r\n margin-left: 8px;\r\n }\r\n }\r\n }\r\n}\r\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.search-area__wrapper .search-area__item.search-area--action {\n justify-content: end;\n}\n.search-area__wrapper .search-area__item .expand-collapse {\n margin-left: 8px;\n height: 32px;\n padding: 4px 16px;\n color: var(--idooel-primary-color);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__text {\n font-size: 14px;\n}\n.search-area__wrapper .search-area__item .expand-collapse .expand-collapse__icon {\n font-size: 16px;\n margin-left: 8px;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
1148
2007
|
|
|
1149
2008
|
};
|
|
1150
2009
|
/* scoped */
|
|
1151
|
-
const __vue_scope_id__$3 = "data-v-
|
|
2010
|
+
const __vue_scope_id__$3 = "data-v-33290002";
|
|
1152
2011
|
/* module identifier */
|
|
1153
2012
|
const __vue_module_identifier__$3 = undefined;
|
|
1154
2013
|
/* functional template */
|
|
@@ -1205,15 +2064,20 @@
|
|
|
1205
2064
|
_vm._l(_vm.dataSource, function (item, idx) {
|
|
1206
2065
|
return _c(
|
|
1207
2066
|
"ele-button",
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
2067
|
+
_vm._g(
|
|
2068
|
+
{
|
|
2069
|
+
key: idx,
|
|
2070
|
+
attrs: {
|
|
2071
|
+
type: item.type,
|
|
2072
|
+
icon: item.icon,
|
|
2073
|
+
mode: item.mode,
|
|
2074
|
+
"data-source": item.optionList,
|
|
2075
|
+
"event-name": item.eventName,
|
|
2076
|
+
record: item,
|
|
1214
2077
|
},
|
|
1215
2078
|
},
|
|
1216
|
-
|
|
2079
|
+
_vm.$listeners
|
|
2080
|
+
),
|
|
1217
2081
|
[_vm._v("\n " + _vm._s(item.label) + "\n ")]
|
|
1218
2082
|
)
|
|
1219
2083
|
}),
|
|
@@ -1226,11 +2090,11 @@
|
|
|
1226
2090
|
/* style */
|
|
1227
2091
|
const __vue_inject_styles__$2 = function (inject) {
|
|
1228
2092
|
if (!inject) return
|
|
1229
|
-
inject("data-v-
|
|
2093
|
+
inject("data-v-106e8dd5_0", { source: ".button-group__wrapper[data-v-106e8dd5] {\n display: flex;\n padding-left: 16px;\n padding-right: 16px;\n}\n.button-group__wrapper .ant-btn[data-v-106e8dd5] {\n margin-left: 8px;\n}\n.button-group__wrapper .ant-btn[data-v-106e8dd5]:first-child {\n margin-left: 0;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\composite-components\\button-group\\src\\index.vue","index.vue"],"names":[],"mappings":"AAuCA;EACA,aAAA;EACA,kBAAA;EACA,mBAAA;ACtCA;ADuCA;EACA,gBAAA;ACrCA;ADsCA;EACA,cAAA;ACpCA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <div class=\"button-group__wrapper\">\r\n <ele-button \r\n v-for=\"(item, idx) in dataSource\" \r\n :type=\"item.type\"\r\n :icon=\"item.icon\"\r\n :mode=\"item.mode\"\r\n :data-source=\"item.optionList\"\r\n :event-name=\"item.eventName\"\r\n :record=\"item\"\r\n v-on=\"$listeners\"\r\n :key=\"idx\">\r\n {{ item.label }}\r\n </ele-button>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport EleButton from '../../../button/src/index.vue'\r\nexport default {\r\n name: 'ele-button-group',\r\n components: {\r\n EleButton\r\n },\r\n props: {\r\n dataSource: {\r\n type: Array,\r\n default: () => []\r\n }\r\n },\r\n methods: {\r\n handleClick (props) {\r\n this.$emit('click', props)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.button-group__wrapper {\r\n display: flex;\r\n padding-left: 16px;\r\n padding-right: 16px;\r\n .ant-btn {\r\n margin-left: 8px;\r\n &:first-child {\r\n margin-left: 0;\r\n }\r\n }\r\n}\r\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
2094
|
|
|
1231
2095
|
};
|
|
1232
2096
|
/* scoped */
|
|
1233
|
-
const __vue_scope_id__$2 = "data-v-
|
|
2097
|
+
const __vue_scope_id__$2 = "data-v-106e8dd5";
|
|
1234
2098
|
/* module identifier */
|
|
1235
2099
|
const __vue_module_identifier__$2 = undefined;
|
|
1236
2100
|
/* functional template */
|
|
@@ -1254,63 +2118,6 @@
|
|
|
1254
2118
|
undefined
|
|
1255
2119
|
);
|
|
1256
2120
|
|
|
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
2121
|
//
|
|
1315
2122
|
var script$1 = {
|
|
1316
2123
|
name: 'ele-tree-table-model',
|
|
@@ -1338,6 +2145,12 @@
|
|
|
1338
2145
|
default: () => ({})
|
|
1339
2146
|
}
|
|
1340
2147
|
},
|
|
2148
|
+
provide() {
|
|
2149
|
+
return {
|
|
2150
|
+
requestTreeData: this.requestTreeData,
|
|
2151
|
+
requestTableData: this.requestTableData
|
|
2152
|
+
};
|
|
2153
|
+
},
|
|
1341
2154
|
data() {
|
|
1342
2155
|
return {
|
|
1343
2156
|
treeData: [],
|
|
@@ -1594,62 +2407,76 @@
|
|
|
1594
2407
|
var _h = _vm.$createElement;
|
|
1595
2408
|
var _c = _vm._self._c || _h;
|
|
1596
2409
|
return _c("section", { staticClass: "model__tree-table" }, [
|
|
1597
|
-
_c(
|
|
1598
|
-
"
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
2410
|
+
_c("section", { staticClass: "model__tree-table--container" }, [
|
|
2411
|
+
_c("div", { staticClass: "model__tree--title" }),
|
|
2412
|
+
_vm._v(" "),
|
|
2413
|
+
_c(
|
|
2414
|
+
"section",
|
|
2415
|
+
{ ref: _vm.modelTreeWrapper, staticClass: "model__tree--wrapper" },
|
|
2416
|
+
[
|
|
2417
|
+
_c("ele-tree", {
|
|
2418
|
+
attrs: {
|
|
2419
|
+
"tree-data": _vm.treeData,
|
|
2420
|
+
defaultExpandedKeys: _vm.defaultExpandedKeys,
|
|
2421
|
+
defaultSelectedKeys: _vm.defaultSelectedKeys,
|
|
2422
|
+
"replace-fields": _vm.treeMeta.replaceFields || _vm.replaceFields,
|
|
2423
|
+
},
|
|
2424
|
+
on: { select: _vm.selectTreeNode },
|
|
2425
|
+
}),
|
|
2426
|
+
],
|
|
2427
|
+
1
|
|
2428
|
+
),
|
|
2429
|
+
]),
|
|
1613
2430
|
_vm._v(" "),
|
|
1614
|
-
_c(
|
|
1615
|
-
"
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
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,
|
|
2431
|
+
_c("section", { staticClass: "model__table--container" }, [
|
|
2432
|
+
_c("div", { staticClass: "model__table--title" }),
|
|
2433
|
+
_vm._v(" "),
|
|
2434
|
+
_c(
|
|
2435
|
+
"section",
|
|
2436
|
+
{ ref: _vm.modelTableWrapper, staticClass: "model__table--wrapper" },
|
|
2437
|
+
[
|
|
2438
|
+
_c("ele-search-area", {
|
|
2439
|
+
ref: _vm.searchArea,
|
|
2440
|
+
attrs: { "data-source": _vm.searchMeta.elements },
|
|
2441
|
+
on: { search: _vm.onSearch },
|
|
2442
|
+
}),
|
|
2443
|
+
_vm._v(" "),
|
|
2444
|
+
_c(
|
|
2445
|
+
"ele-button-group",
|
|
2446
|
+
_vm._g(
|
|
2447
|
+
{
|
|
2448
|
+
ref: _vm.buttonGroup,
|
|
2449
|
+
staticStyle: { "margin-top": "16px" },
|
|
2450
|
+
attrs: { "data-source": _vm.getButtonGroupElements },
|
|
2451
|
+
on: { click: _vm.handleClickButtonGroup },
|
|
1644
2452
|
},
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
)
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
2453
|
+
_vm.$listeners
|
|
2454
|
+
)
|
|
2455
|
+
),
|
|
2456
|
+
_vm._v(" "),
|
|
2457
|
+
_c(
|
|
2458
|
+
"ele-table",
|
|
2459
|
+
_vm._g(
|
|
2460
|
+
{
|
|
2461
|
+
staticStyle: { "margin-top": "8px" },
|
|
2462
|
+
attrs: {
|
|
2463
|
+
loading: _vm.loading,
|
|
2464
|
+
columns: _vm.columns,
|
|
2465
|
+
total: _vm.total,
|
|
2466
|
+
actions: _vm.actions,
|
|
2467
|
+
pageSize: _vm.pageSize,
|
|
2468
|
+
pageSizeOptions: _vm.pageSizeOptions,
|
|
2469
|
+
"data-source": _vm.tableData,
|
|
2470
|
+
},
|
|
2471
|
+
on: { "change-page": _vm.onChangePage },
|
|
2472
|
+
},
|
|
2473
|
+
_vm.$listeners
|
|
2474
|
+
)
|
|
2475
|
+
),
|
|
2476
|
+
],
|
|
2477
|
+
1
|
|
2478
|
+
),
|
|
2479
|
+
]),
|
|
1653
2480
|
])
|
|
1654
2481
|
};
|
|
1655
2482
|
var __vue_staticRenderFns__$1 = [];
|
|
@@ -1658,11 +2485,11 @@
|
|
|
1658
2485
|
/* style */
|
|
1659
2486
|
const __vue_inject_styles__$1 = function (inject) {
|
|
1660
2487
|
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 });
|
|
2488
|
+
inject("data-v-37846a00_0", { source: ".model__tree-table[data-v-37846a00] {\n background: transparent;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.model__tree-table .model__tree-table--container .model__tree--wrapper[data-v-37846a00] {\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--container[data-v-37846a00] {\n min-width: 0;\n background: #fff;\n}\n.model__tree-table .model__table--container .model__table--wrapper[data-v-37846a00] {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["E:\\work\\code\\ganjiao\\ganjian-monorepo\\packages\\components\\packages\\tree-table-model\\src\\index.vue","index.vue"],"names":[],"mappings":"AA0RA;EACA,uBAAA;EACA,aAAA;EACA,mBAAA;EACA,WAAA;ACzRA;AD2RA;EACA,YAAA;EACA,gBAAA;EACA,cAAA;EACA,aAAA;EACA,sBAAA;EACA,kBAAA;EACA,gBAAA;ACzRA;AD4RA;EACA,YAAA;EACA,gBAAA;AC1RA;AD2RA;EACA,gBAAA;ACzRA;;AAEA,oCAAoC","file":"index.vue","sourcesContent":["<template>\r\n <section class=\"model__tree-table\">\r\n <section class=\"model__tree-table--container\">\r\n <div class=\"model__tree--title\"></div>\r\n <section :ref=\"modelTreeWrapper\" class=\"model__tree--wrapper\">\r\n <ele-tree \r\n :tree-data=\"treeData\"\r\n :defaultExpandedKeys=\"defaultExpandedKeys\"\r\n :defaultSelectedKeys=\"defaultSelectedKeys\"\r\n @select=\"selectTreeNode\"\r\n :replace-fields=\"treeMeta.replaceFields || replaceFields\">\r\n </ele-tree>\r\n </section>\r\n </section>\r\n <section class=\"model__table--container\">\r\n <div class=\"model__table--title\"></div>\r\n <section :ref=\"modelTableWrapper\" class=\"model__table--wrapper\">\r\n <ele-search-area :ref=\"searchArea\" @search=\"onSearch\" :data-source=\"searchMeta.elements\"></ele-search-area>\r\n <ele-button-group v-on=\"$listeners\" :ref=\"buttonGroup\" @click=\"handleClickButtonGroup\" style=\"margin-top: 16px\" :data-source=\"getButtonGroupElements\"></ele-button-group>\r\n <ele-table\r\n v-on=\"$listeners\"\r\n :loading=\"loading\" \r\n :columns=\"columns\"\r\n :total=\"total\"\r\n :actions=\"actions\"\r\n :pageSize=\"pageSize\"\r\n :pageSizeOptions=\"pageSizeOptions\"\r\n :data-source=\"tableData\"\r\n @change-page=\"onChangePage\" \r\n style=\"margin-top: 8px;\"\r\n ></ele-table>\r\n </section>\r\n </section>\r\n </section>\r\n</template>\r\n\r\n<script>\r\nimport EleTree from '../../tree/src/index.vue'\r\nimport EleTable from '../../table/src/index.vue'\r\nimport EleSearchArea from '../../composite-components/search-area/src/index.vue'\r\nimport EleButtonGroup from '../../composite-components/button-group/src/index.vue'\r\nimport { type, net } from '@idooel/shared'\r\nimport { v4 as uuidv4 } from 'uuid'\r\nexport default {\r\n name: 'ele-tree-table-model',\r\n components: {\r\n EleTree,\r\n EleTable,\r\n EleSearchArea,\r\n EleButtonGroup\r\n },\r\n props: {\r\n treeMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n searchMeta: {\r\n type: Object,\r\n default: () => ({})\r\n },\r\n buttonGroupMeta: {\r\n typeof: Object,\r\n default: () => ({})\r\n },\r\n tableMeta: {\r\n type: Object,\r\n default: () => ({})\r\n }\r\n },\r\n provide () {\r\n return {\r\n requestTreeData: this.requestTreeData,\r\n requestTableData: this.requestTableData\r\n }\r\n },\r\n data () {\r\n return {\r\n treeData: [],\r\n tableData: [],\r\n defaultExpandedKeys: [],\r\n defaultSelectedKeys: [],\r\n replaceFields: {\r\n title: 'title',\r\n children: 'children',\r\n key: 'id'\r\n },\r\n loading: false,\r\n total: 0,\r\n tableQuerys: {},\r\n resizeObserverModelTableWrapper: null,\r\n modelTableWrapperHeight: 0,\r\n currentTreeNodeData: {}\r\n }\r\n },\r\n computed: {\r\n buttonGroup () {\r\n return uuidv4()\r\n },\r\n searchArea () {\r\n return uuidv4()\r\n },\r\n modelTreeWrapper () {\r\n return uuidv4()\r\n },\r\n modelTableWrapper () {\r\n return uuidv4()\r\n },\r\n actions () {\r\n const { operations } = this.tableMeta\r\n return operations.elements\r\n },\r\n pageSize () {\r\n const { page = {} } = this.tableMeta\r\n return page.pageSize || 10\r\n },\r\n pageSizeOptions () {\r\n const { page = {} } = this.tableMeta\r\n return page.pageSizeOptions || ['10', '20', '30', '40']\r\n },\r\n columns () {\r\n const { columns, operations } = this.tableMeta\r\n if (type.get(columns) === 'array') {\r\n const columnsOptions = columns.map(item => {\r\n if (item.render) {\r\n return {\r\n title: item.title,\r\n dataIndex: item.dataIndex,\r\n width: item.width,\r\n align: item.align,\r\n fixed: item.fixed,\r\n customRender: (text, record, index) => {\r\n const { $createElement } = this\r\n return item.render.call(this, { h: $createElement, ctx: this }, typeof text == 'string' ? text : text[item.dataIndex], record, index)\r\n }\r\n }\r\n }\r\n return {\r\n title: item.title,\r\n dataIndex: item.dataIndex,\r\n width: item.width,\r\n align: item.align,\r\n fixed: item.fixed\r\n }\r\n })\r\n if (operations) {\r\n return [\r\n ...columnsOptions,\r\n {\r\n title: '操作',\r\n width: operations.width,\r\n key: 'action',\r\n fixed: 'right',\r\n scopedSlots: { customRender: 'action' }\r\n }\r\n ]\r\n }\r\n return columnsOptions\r\n } else {\r\n console.error('Error: columns is invalid, please check it')\r\n return []\r\n }\r\n },\r\n getButtonGroupElements () {\r\n const { elements } = this.buttonGroupMeta\r\n if (type.get(elements) === 'function') {\r\n return elements.call(this)\r\n } else if (type.get(elements) === 'array') {\r\n return elements\r\n } else {\r\n return []\r\n }\r\n }\r\n },\r\n async created () {\r\n this.treeData = await this.requestTreeData()\r\n const [defaultTreeNode = {}] = this.treeData\r\n this.defaultExpandedKeys = [defaultTreeNode[this.replaceFields.key]]\r\n this.defaultSelectedKeys = [defaultTreeNode[this.replaceFields.key]]\r\n const { fieldMap } = this.tableMeta\r\n this.currentTreeNodeData = defaultTreeNode\r\n this.tableData = await this.requestTableData(this.execTableFieldMap(fieldMap, defaultTreeNode))\r\n },\r\n methods: {\r\n handleClickButtonGroup (props) {\r\n const { eventName } = props\r\n this.$emit(eventName, { currentTreeNode: this.currentTreeNodeData })\r\n },\r\n watchViewPort () {\r\n const modelTableWrapper = this.$refs[this.modelTableWrapper]\r\n console.log(modelTableWrapper.getBoundingClientRect())\r\n const { top } = modelTableWrapper.getBoundingClientRect()\r\n this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`\r\n },\r\n async onSearch (props) {\r\n this.tableQuerys = Object.assign(this.tableQuerys, props)\r\n this.tableData = await this.requestTableData()\r\n },\r\n execTableFieldMap (fieldMap = {}, props) {\r\n let ret = {}\r\n const keys = Object.keys(fieldMap)\r\n keys.forEach(key => {\r\n const field = fieldMap[key]\r\n ret[field] = props[key]\r\n })\r\n return ret\r\n },\r\n async selectTreeNode (selectedKeys, e) {\r\n const { fieldMap } = this.tableMeta\r\n this.currentTreeNodeData = e.node.$vnode.data.props.dataRef\r\n const execFieldMapRet = this.execTableFieldMap(fieldMap, e.node.$vnode.data.props.dataRef)\r\n this.tableData = await this.requestTableData(execFieldMapRet)\r\n },\r\n async requestTreeData () {\r\n const { url, requestType } = this.treeMeta\r\n const ret = await net.get(\r\n url\r\n ).then(resp => {\r\n const { data } = resp || {}\r\n return data\r\n })\r\n return ret\r\n },\r\n async onChangePage (page, pageSize) {\r\n this.tableData = await this.requestTableData({ currentPage: page, pageSize })\r\n },\r\n async requestTableData (props = {}) {\r\n const { url, requestType, page = {} } = this.tableMeta\r\n const { pageSize = 10 } = page\r\n this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: 1, pageSize }, props)\r\n const ret = await net.get(\r\n url,\r\n this.tableQuerys\r\n ).then(resp => {\r\n const { data = [], count } = resp || {}\r\n this.total = count\r\n return data.map(item => {\r\n return {\r\n key: uuidv4(),\r\n ...item\r\n }\r\n })\r\n })\r\n return ret\r\n },\r\n refreshTreeStatus (props = {}) {},\r\n refreshTableStatus (props = {}) {},\r\n getModelTableWrapperHeight () {},\r\n setModelTreeWrapperHeight (height) {\r\n this.$refs[this.modelTreeWrapper].style.height = height\r\n },\r\n setModelTableWrapperHeight () {\r\n const { top } = this.$refs[this.modelTableWrapper].getBoundingClientRect()\r\n const height = `calc(100vh - ${top}px)`\r\n this.$refs[this.modelTableWrapper].style.height = height\r\n this.setModelTreeWrapperHeight(height)\r\n },\r\n getSearchAreaHeight () {\r\n return this.$refs[this.searchArea].$el.clientHeight\r\n },\r\n getButtonGroupHeight () {\r\n return this.$refs[this.buttonGroup].$el.clientHeight\r\n }\r\n },\r\n mounted () {\r\n //TODO\r\n // this.setModelTableWrapperHeight()\r\n // this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {\r\n // for (let entry of entries) {\r\n // this.modelTableWrapperHeight = entry.contentRect.height\r\n // console.log('this.modelTableWrapperHeight:', this.modelTableWrapperHeight)\r\n // console.log('getSearchAreaHeight', this.getSearchAreaHeight())\r\n // console.log('getButtonGroupHeight', this.getButtonGroupHeight())\r\n // const tableHeight = this.modelTableWrapperHeight - this.getSearchAreaHeight() - this.getButtonGroupHeight()\r\n // console.log('tableHeight', tableHeight)\r\n // }\r\n // })\r\n // this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.model__tree-table {\r\n background: transparent;\r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n .model__tree-table--container {\r\n .model__tree--wrapper {\r\n width: 240px;\r\n background: #fff;\r\n flex-shrink: 0;\r\n padding: 16px;\r\n box-sizing: border-box;\r\n margin-right: 16px;\r\n overflow-y: auto;\r\n }\r\n }\r\n .model__table--container {\r\n min-width: 0;\r\n background: #fff;\r\n .model__table--wrapper {\r\n background: #fff;\r\n }\r\n }\r\n}\r\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-table--container .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--container {\n min-width: 0;\n background: #fff;\n}\n.model__tree-table .model__table--container .model__table--wrapper {\n background: #fff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
1662
2489
|
|
|
1663
2490
|
};
|
|
1664
2491
|
/* scoped */
|
|
1665
|
-
const __vue_scope_id__$1 = "data-v-
|
|
2492
|
+
const __vue_scope_id__$1 = "data-v-37846a00";
|
|
1666
2493
|
/* module identifier */
|
|
1667
2494
|
const __vue_module_identifier__$1 = undefined;
|
|
1668
2495
|
/* functional template */
|
|
@@ -1698,6 +2525,13 @@
|
|
|
1698
2525
|
[__vue_component__$1.name]: __vue_component__$1
|
|
1699
2526
|
},
|
|
1700
2527
|
computed: {
|
|
2528
|
+
modelNameValidator() {
|
|
2529
|
+
const target = models.find(model => model.name === this.modelName);
|
|
2530
|
+
return {
|
|
2531
|
+
existed: !!target,
|
|
2532
|
+
message: !!target ? '' : `Model <span style="color:red;">${this.modelName}</span> not found`
|
|
2533
|
+
};
|
|
2534
|
+
},
|
|
1701
2535
|
genModelRef() {
|
|
1702
2536
|
return v4();
|
|
1703
2537
|
}
|
|
@@ -1717,7 +2551,7 @@
|
|
|
1717
2551
|
var _vm = this;
|
|
1718
2552
|
var _h = _vm.$createElement;
|
|
1719
2553
|
var _c = _vm._self._c || _h;
|
|
1720
|
-
return _vm.
|
|
2554
|
+
return _vm.modelNameValidator.existed
|
|
1721
2555
|
? _c(
|
|
1722
2556
|
_vm.modelName,
|
|
1723
2557
|
_vm._g(
|
|
@@ -1747,21 +2581,25 @@
|
|
|
1747
2581
|
_vm.$listeners
|
|
1748
2582
|
)
|
|
1749
2583
|
)
|
|
1750
|
-
: _c("div",
|
|
2584
|
+
: _c("div", {
|
|
2585
|
+
domProps: { innerHTML: _vm._s(_vm.modelNameValidator.message) },
|
|
2586
|
+
})
|
|
1751
2587
|
};
|
|
1752
2588
|
var __vue_staticRenderFns__ = [];
|
|
1753
2589
|
__vue_render__._withStripped = true;
|
|
1754
2590
|
|
|
1755
2591
|
/* style */
|
|
1756
|
-
const __vue_inject_styles__ =
|
|
2592
|
+
const __vue_inject_styles__ = function (inject) {
|
|
2593
|
+
if (!inject) return
|
|
2594
|
+
inject("data-v-7b13873a_0", { source: ":root {\n --idooel-primary-color: #1890FF;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n}\n\n/*# sourceMappingURL=index.vue.map */", map: {"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,+BAA+B;EAC/B,wBAAwB;EACxB,8BAA8B;EAC9B,+BAA+B;EAC/B,qCAAqC;AACvC;;AAEA,oCAAoC","file":"index.vue","sourcesContent":[":root {\n --idooel-primary-color: #1890FF;\n --idooel-border-width: 2;\n --idooel-border-color: #53a8ff;\n --idooel-column-border-width: 1;\n --idooel-column-border-color: #d9ecff;\n}\n\n/*# sourceMappingURL=index.vue.map */"]}, media: undefined });
|
|
2595
|
+
|
|
2596
|
+
};
|
|
1757
2597
|
/* scoped */
|
|
1758
2598
|
const __vue_scope_id__ = undefined;
|
|
1759
2599
|
/* module identifier */
|
|
1760
2600
|
const __vue_module_identifier__ = undefined;
|
|
1761
2601
|
/* functional template */
|
|
1762
2602
|
const __vue_is_functional_template__ = false;
|
|
1763
|
-
/* style inject */
|
|
1764
|
-
|
|
1765
2603
|
/* style inject SSR */
|
|
1766
2604
|
|
|
1767
2605
|
/* style inject shadow dom */
|
|
@@ -1776,7 +2614,7 @@
|
|
|
1776
2614
|
__vue_is_functional_template__,
|
|
1777
2615
|
__vue_module_identifier__,
|
|
1778
2616
|
false,
|
|
1779
|
-
|
|
2617
|
+
createInjector,
|
|
1780
2618
|
undefined,
|
|
1781
2619
|
undefined
|
|
1782
2620
|
);
|
|
@@ -1805,8 +2643,10 @@
|
|
|
1805
2643
|
exports.EleInput = __vue_component__$9;
|
|
1806
2644
|
exports.EleSelect = __vue_component__$8;
|
|
1807
2645
|
exports.EleTable = __vue_component__$6;
|
|
2646
|
+
exports.EleTpl = __vue_component__;
|
|
1808
2647
|
exports.EleTree = __vue_component__$5;
|
|
1809
2648
|
exports["default"] = install;
|
|
2649
|
+
exports.models = models;
|
|
1810
2650
|
|
|
1811
2651
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1812
2652
|
|