@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.
Files changed (32) hide show
  1. package/dist/@idooel/components.esm.js +2634 -0
  2. package/dist/@idooel/components.umd.js +1019 -179
  3. package/package.json +44 -41
  4. package/packages/button/index.js +4 -4
  5. package/packages/button/src/index.vue +54 -24
  6. package/packages/composite-components/button-group/index.js +4 -4
  7. package/packages/composite-components/button-group/src/index.vue +50 -46
  8. package/packages/composite-components/search-area/index.js +4 -4
  9. package/packages/composite-components/search-area/src/index.vue +171 -128
  10. package/packages/composite-components/search-area/src/label.vue +35 -35
  11. package/packages/date/index.js +4 -4
  12. package/packages/date/src/index.vue +39 -39
  13. package/packages/index.js +50 -49
  14. package/packages/input/index.js +4 -4
  15. package/packages/input/src/index.vue +23 -23
  16. package/packages/select/index.js +4 -4
  17. package/packages/select/src/index.vue +34 -34
  18. package/packages/table/index.js +4 -4
  19. package/packages/table/src/action.vue +131 -44
  20. package/packages/table/src/index.vue +157 -88
  21. package/packages/theme/index.scss +12 -0
  22. package/packages/theme/variables.scss +34 -0
  23. package/packages/tpl/index.js +4 -4
  24. package/packages/tpl/src/index.vue +50 -39
  25. package/packages/tree/index.js +4 -4
  26. package/packages/tree/src/TreeNode.vue +29 -29
  27. package/packages/tree/src/index.vue +101 -96
  28. package/packages/tree-table-model/index.js +4 -4
  29. package/packages/tree-table-model/src/index.vue +306 -289
  30. package/scripts/rollup.config.js +35 -41
  31. package/scripts/rollup.esm.config.js +12 -0
  32. package/scripts/rollup.umd.config.js +14 -14
@@ -0,0 +1,2634 @@
1
+ import { type, route, net } from '@idooel/shared';
2
+ import moment from 'moment';
3
+
4
+ //
5
+ //
6
+ //
7
+ //
8
+ //
9
+ //
10
+ //
11
+ //
12
+ //
13
+ //
14
+ //
15
+ //
16
+ //
17
+ //
18
+ //
19
+ //
20
+ //
21
+
22
+ var script$b = {
23
+ name: 'ele-button',
24
+ props: {
25
+ record: {
26
+ type: Object
27
+ },
28
+ eventName: {
29
+ type: String
30
+ },
31
+ mode: {
32
+ type: String
33
+ },
34
+ dataSource: {
35
+ type: Array,
36
+ default: () => []
37
+ },
38
+ type: {
39
+ type: String,
40
+ default: 'default'
41
+ },
42
+ icon: {
43
+ type: String
44
+ }
45
+ },
46
+ methods: {
47
+ handleMenuClick(props) {
48
+ const {
49
+ key
50
+ } = props;
51
+ const currentClickTarget = this.dataSource.find(item => item.value === key);
52
+ const {
53
+ eventName
54
+ } = currentClickTarget;
55
+ eventName && this.$emit(eventName, {
56
+ ...currentClickTarget
57
+ });
58
+ },
59
+ handleClick() {
60
+ this.$emit(this.eventName || 'click', {
61
+ ...this.record
62
+ });
63
+ }
64
+ }
65
+ };
66
+
67
+ function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
68
+ if (typeof shadowMode !== 'boolean') {
69
+ createInjectorSSR = createInjector;
70
+ createInjector = shadowMode;
71
+ shadowMode = false;
72
+ }
73
+ // Vue.extend constructor export interop.
74
+ const options = typeof script === 'function' ? script.options : script;
75
+ // render functions
76
+ if (template && template.render) {
77
+ options.render = template.render;
78
+ options.staticRenderFns = template.staticRenderFns;
79
+ options._compiled = true;
80
+ // functional template
81
+ if (isFunctionalTemplate) {
82
+ options.functional = true;
83
+ }
84
+ }
85
+ // scopedId
86
+ if (scopeId) {
87
+ options._scopeId = scopeId;
88
+ }
89
+ let hook;
90
+ if (moduleIdentifier) {
91
+ // server build
92
+ hook = function (context) {
93
+ // 2.3 injection
94
+ context = context ||
95
+ // cached call
96
+ this.$vnode && this.$vnode.ssrContext ||
97
+ // stateful
98
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
99
+ // 2.2 with runInNewContext: true
100
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
101
+ context = __VUE_SSR_CONTEXT__;
102
+ }
103
+ // inject component styles
104
+ if (style) {
105
+ style.call(this, createInjectorSSR(context));
106
+ }
107
+ // register component module identifier for async chunk inference
108
+ if (context && context._registeredComponents) {
109
+ context._registeredComponents.add(moduleIdentifier);
110
+ }
111
+ };
112
+ // used by ssr in case component is cached and beforeCreate
113
+ // never gets called
114
+ options._ssrRegister = hook;
115
+ } else if (style) {
116
+ hook = shadowMode ? function (context) {
117
+ style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
118
+ } : function (context) {
119
+ style.call(this, createInjector(context));
120
+ };
121
+ }
122
+ if (hook) {
123
+ if (options.functional) {
124
+ // register for functional component in vue file
125
+ const originalRender = options.render;
126
+ options.render = function renderWithStyleInjection(h, context) {
127
+ hook.call(context);
128
+ return originalRender(h, context);
129
+ };
130
+ } else {
131
+ // inject component registration as beforeCreate hook
132
+ const existing = options.beforeCreate;
133
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
134
+ }
135
+ }
136
+ return script;
137
+ }
138
+
139
+ /* script */
140
+ const __vue_script__$b = script$b;
141
+
142
+ /* template */
143
+ var __vue_render__$b = function () {
144
+ var _vm = this;
145
+ var _h = _vm.$createElement;
146
+ var _c = _vm._self._c || _h;
147
+ return _vm.mode == "dropdown"
148
+ ? _c(
149
+ "a-dropdown",
150
+ [
151
+ _c(
152
+ "a-menu",
153
+ {
154
+ attrs: { slot: "overlay" },
155
+ on: { click: _vm.handleMenuClick },
156
+ slot: "overlay",
157
+ },
158
+ _vm._l(_vm.dataSource, function (opt) {
159
+ return _c("a-menu-item", { key: opt.value }, [
160
+ _vm._v("\n " + _vm._s(opt.label) + "\n "),
161
+ ])
162
+ }),
163
+ 1
164
+ ),
165
+ _vm._v(" "),
166
+ _c(
167
+ "a-button",
168
+ { attrs: { type: _vm.type } },
169
+ [
170
+ _vm._t("default"),
171
+ _vm._v(" "),
172
+ _c("a-icon", { attrs: { type: _vm.icon } }),
173
+ ],
174
+ 2
175
+ ),
176
+ ],
177
+ 1
178
+ )
179
+ : _c(
180
+ "a-button",
181
+ {
182
+ attrs: { type: _vm.type, icon: _vm.icon },
183
+ on: { click: _vm.handleClick },
184
+ },
185
+ [_vm._t("default")],
186
+ 2
187
+ )
188
+ };
189
+ var __vue_staticRenderFns__$b = [];
190
+ __vue_render__$b._withStripped = true;
191
+
192
+ /* style */
193
+ const __vue_inject_styles__$b = undefined;
194
+ /* scoped */
195
+ const __vue_scope_id__$b = undefined;
196
+ /* module identifier */
197
+ const __vue_module_identifier__$b = undefined;
198
+ /* functional template */
199
+ const __vue_is_functional_template__$b = false;
200
+ /* style inject */
201
+
202
+ /* style inject SSR */
203
+
204
+ /* style inject shadow dom */
205
+
206
+
207
+
208
+ const __vue_component__$b = /*#__PURE__*/normalizeComponent(
209
+ { render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b },
210
+ __vue_inject_styles__$b,
211
+ __vue_script__$b,
212
+ __vue_scope_id__$b,
213
+ __vue_is_functional_template__$b,
214
+ __vue_module_identifier__$b,
215
+ false,
216
+ undefined,
217
+ undefined,
218
+ undefined
219
+ );
220
+
221
+ __vue_component__$b.install = Vue => Vue.component(__vue_component__$b.name, __vue_component__$b);
222
+
223
+ //
224
+ //
225
+ //
226
+ //
227
+ //
228
+ //
229
+ //
230
+ //
231
+ //
232
+ //
233
+ //
234
+ //
235
+
236
+ var script$a = {
237
+ name: 'ele-date',
238
+ props: {
239
+ value: {
240
+ type: Object
241
+ },
242
+ format: {
243
+ type: String,
244
+ default: 'YYYY/MM/DD'
245
+ }
246
+ },
247
+ data() {
248
+ return {
249
+ open: false
250
+ };
251
+ },
252
+ methods: {
253
+ onFocus() {
254
+ this.open = true;
255
+ },
256
+ onPanelChange(value, mode) {
257
+ this.$emit('input', value);
258
+ this.open = false;
259
+ }
260
+ }
261
+ };
262
+
263
+ /* script */
264
+ const __vue_script__$a = script$a;
265
+
266
+ /* template */
267
+ var __vue_render__$a = function () {
268
+ var _vm = this;
269
+ var _h = _vm.$createElement;
270
+ var _c = _vm._self._c || _h;
271
+ return _c("a-date-picker", {
272
+ staticStyle: { width: "100%" },
273
+ attrs: {
274
+ mode: "year",
275
+ open: _vm.open,
276
+ value: _vm.value,
277
+ format: _vm.format,
278
+ },
279
+ on: { focus: _vm.onFocus, panelChange: _vm.onPanelChange },
280
+ })
281
+ };
282
+ var __vue_staticRenderFns__$a = [];
283
+ __vue_render__$a._withStripped = true;
284
+
285
+ /* style */
286
+ const __vue_inject_styles__$a = undefined;
287
+ /* scoped */
288
+ const __vue_scope_id__$a = undefined;
289
+ /* module identifier */
290
+ const __vue_module_identifier__$a = undefined;
291
+ /* functional template */
292
+ const __vue_is_functional_template__$a = false;
293
+ /* style inject */
294
+
295
+ /* style inject SSR */
296
+
297
+ /* style inject shadow dom */
298
+
299
+
300
+
301
+ const __vue_component__$a = /*#__PURE__*/normalizeComponent(
302
+ { render: __vue_render__$a, staticRenderFns: __vue_staticRenderFns__$a },
303
+ __vue_inject_styles__$a,
304
+ __vue_script__$a,
305
+ __vue_scope_id__$a,
306
+ __vue_is_functional_template__$a,
307
+ __vue_module_identifier__$a,
308
+ false,
309
+ undefined,
310
+ undefined,
311
+ undefined
312
+ );
313
+
314
+ __vue_component__$a.install = Vue => Vue.component(__vue_component__$a.name, __vue_component__$a);
315
+
316
+ //
317
+ //
318
+ //
319
+ //
320
+
321
+ var script$9 = {
322
+ name: 'ele-input',
323
+ props: {
324
+ value: {
325
+ type: String
326
+ }
327
+ },
328
+ methods: {
329
+ onChange(e) {
330
+ this.$emit('change', e.target.value);
331
+ this.$emit('input', e.target.value);
332
+ }
333
+ }
334
+ };
335
+
336
+ const isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
337
+ function createInjector(context) {
338
+ return (id, style) => addStyle(id, style);
339
+ }
340
+ let HEAD;
341
+ const styles = {};
342
+ function addStyle(id, css) {
343
+ const group = isOldIE ? css.media || 'default' : id;
344
+ const style = styles[group] || (styles[group] = {
345
+ ids: new Set(),
346
+ styles: []
347
+ });
348
+ if (!style.ids.has(id)) {
349
+ style.ids.add(id);
350
+ let code = css.source;
351
+ if (css.map) {
352
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
353
+ // this makes source maps inside style tags work properly in Chrome
354
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
355
+ // http://stackoverflow.com/a/26603875
356
+ code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
357
+ }
358
+ if (!style.element) {
359
+ style.element = document.createElement('style');
360
+ style.element.type = 'text/css';
361
+ if (css.media) style.element.setAttribute('media', css.media);
362
+ if (HEAD === undefined) {
363
+ HEAD = document.head || document.getElementsByTagName('head')[0];
364
+ }
365
+ HEAD.appendChild(style.element);
366
+ }
367
+ if ('styleSheet' in style.element) {
368
+ style.styles.push(code);
369
+ style.element.styleSheet.cssText = style.styles.filter(Boolean).join('\n');
370
+ } else {
371
+ const index = style.ids.size - 1;
372
+ const textNode = document.createTextNode(code);
373
+ const nodes = style.element.childNodes;
374
+ if (nodes[index]) style.element.removeChild(nodes[index]);
375
+ if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
376
+ }
377
+ }
378
+ }
379
+
380
+ /* script */
381
+ const __vue_script__$9 = script$9;
382
+
383
+ /* template */
384
+ var __vue_render__$9 = function () {
385
+ var _vm = this;
386
+ var _h = _vm.$createElement;
387
+ var _c = _vm._self._c || _h;
388
+ return _c("a-input", {
389
+ attrs: { value: _vm.value },
390
+ on: { change: _vm.onChange },
391
+ })
392
+ };
393
+ var __vue_staticRenderFns__$9 = [];
394
+ __vue_render__$9._withStripped = true;
395
+
396
+ /* style */
397
+ const __vue_inject_styles__$9 = function (inject) {
398
+ if (!inject) return
399
+ 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 });
400
+
401
+ };
402
+ /* scoped */
403
+ const __vue_scope_id__$9 = "data-v-560c97a2";
404
+ /* module identifier */
405
+ const __vue_module_identifier__$9 = undefined;
406
+ /* functional template */
407
+ const __vue_is_functional_template__$9 = false;
408
+ /* style inject SSR */
409
+
410
+ /* style inject shadow dom */
411
+
412
+
413
+
414
+ const __vue_component__$9 = /*#__PURE__*/normalizeComponent(
415
+ { render: __vue_render__$9, staticRenderFns: __vue_staticRenderFns__$9 },
416
+ __vue_inject_styles__$9,
417
+ __vue_script__$9,
418
+ __vue_scope_id__$9,
419
+ __vue_is_functional_template__$9,
420
+ __vue_module_identifier__$9,
421
+ false,
422
+ createInjector,
423
+ undefined,
424
+ undefined
425
+ );
426
+
427
+ __vue_component__$9.install = Vue => Vue.component(__vue_component__$9.name, __vue_component__$9);
428
+
429
+ //
430
+ //
431
+ //
432
+ //
433
+ //
434
+ //
435
+ //
436
+ //
437
+
438
+ var script$8 = {
439
+ name: 'ele-select',
440
+ props: {
441
+ value: {
442
+ type: [String, Array, Number]
443
+ },
444
+ defaultValue: {
445
+ type: [String, Array, Number]
446
+ },
447
+ dataSource: {
448
+ type: Array,
449
+ default: () => []
450
+ }
451
+ },
452
+ methods: {
453
+ onChange(value) {
454
+ this.$emit('change', value);
455
+ this.$emit('input', value);
456
+ }
457
+ }
458
+ };
459
+
460
+ /* script */
461
+ const __vue_script__$8 = script$8;
462
+
463
+ /* template */
464
+ var __vue_render__$8 = function () {
465
+ var _vm = this;
466
+ var _h = _vm.$createElement;
467
+ var _c = _vm._self._c || _h;
468
+ return _c(
469
+ "a-select",
470
+ {
471
+ staticStyle: { width: "100%" },
472
+ attrs: { value: _vm.value },
473
+ on: { change: _vm.onChange },
474
+ },
475
+ _vm._l(_vm.dataSource, function (item) {
476
+ return _c(
477
+ "a-select-option",
478
+ { key: item.value, attrs: { value: item.value } },
479
+ [_vm._v("\n " + _vm._s(item.label) + "\n ")]
480
+ )
481
+ }),
482
+ 1
483
+ )
484
+ };
485
+ var __vue_staticRenderFns__$8 = [];
486
+ __vue_render__$8._withStripped = true;
487
+
488
+ /* style */
489
+ const __vue_inject_styles__$8 = function (inject) {
490
+ if (!inject) return
491
+ 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 });
492
+
493
+ };
494
+ /* scoped */
495
+ const __vue_scope_id__$8 = "data-v-499435e8";
496
+ /* module identifier */
497
+ const __vue_module_identifier__$8 = undefined;
498
+ /* functional template */
499
+ const __vue_is_functional_template__$8 = false;
500
+ /* style inject SSR */
501
+
502
+ /* style inject shadow dom */
503
+
504
+
505
+
506
+ const __vue_component__$8 = /*#__PURE__*/normalizeComponent(
507
+ { render: __vue_render__$8, staticRenderFns: __vue_staticRenderFns__$8 },
508
+ __vue_inject_styles__$8,
509
+ __vue_script__$8,
510
+ __vue_scope_id__$8,
511
+ __vue_is_functional_template__$8,
512
+ __vue_module_identifier__$8,
513
+ false,
514
+ createInjector,
515
+ undefined,
516
+ undefined
517
+ );
518
+
519
+ __vue_component__$8.install = Vue => Vue.component(__vue_component__$8.name, __vue_component__$8);
520
+
521
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
522
+ // require the crypto API and do not support built-in fallback to lower quality random number
523
+ // generators (like Math.random()).
524
+ let getRandomValues;
525
+ const rnds8 = new Uint8Array(16);
526
+ function rng() {
527
+ // lazy load so that environments that need to polyfill have a chance to do so
528
+ if (!getRandomValues) {
529
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
530
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
531
+ if (!getRandomValues) {
532
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
533
+ }
534
+ }
535
+ return getRandomValues(rnds8);
536
+ }
537
+
538
+ 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;
539
+
540
+ function validate(uuid) {
541
+ return typeof uuid === 'string' && REGEX.test(uuid);
542
+ }
543
+
544
+ /**
545
+ * Convert array of 16 byte values to UUID string format of the form:
546
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
547
+ */
548
+
549
+ const byteToHex = [];
550
+ for (let i = 0; i < 256; ++i) {
551
+ byteToHex.push((i + 0x100).toString(16).slice(1));
552
+ }
553
+ function unsafeStringify(arr, offset = 0) {
554
+ // Note: Be careful editing this code! It's been tuned for performance
555
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
556
+ 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]];
557
+ }
558
+
559
+ function parse$1(uuid) {
560
+ if (!validate(uuid)) {
561
+ throw TypeError('Invalid UUID');
562
+ }
563
+ let v;
564
+ const arr = new Uint8Array(16); // Parse ########-....-....-....-............
565
+
566
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
567
+ arr[1] = v >>> 16 & 0xff;
568
+ arr[2] = v >>> 8 & 0xff;
569
+ arr[3] = v & 0xff; // Parse ........-####-....-....-............
570
+
571
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
572
+ arr[5] = v & 0xff; // Parse ........-....-####-....-............
573
+
574
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
575
+ arr[7] = v & 0xff; // Parse ........-....-....-####-............
576
+
577
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
578
+ arr[9] = v & 0xff; // Parse ........-....-....-....-############
579
+ // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
580
+
581
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
582
+ arr[11] = v / 0x100000000 & 0xff;
583
+ arr[12] = v >>> 24 & 0xff;
584
+ arr[13] = v >>> 16 & 0xff;
585
+ arr[14] = v >>> 8 & 0xff;
586
+ arr[15] = v & 0xff;
587
+ return arr;
588
+ }
589
+
590
+ function stringToBytes(str) {
591
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
592
+
593
+ const bytes = [];
594
+ for (let i = 0; i < str.length; ++i) {
595
+ bytes.push(str.charCodeAt(i));
596
+ }
597
+ return bytes;
598
+ }
599
+ const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
600
+ const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
601
+ function v35(name, version, hashfunc) {
602
+ function generateUUID(value, namespace, buf, offset) {
603
+ var _namespace;
604
+ if (typeof value === 'string') {
605
+ value = stringToBytes(value);
606
+ }
607
+ if (typeof namespace === 'string') {
608
+ namespace = parse$1(namespace);
609
+ }
610
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
611
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
612
+ } // Compute hash of namespace and value, Per 4.3
613
+ // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
614
+ // hashfunc([...namespace, ... value])`
615
+
616
+ let bytes = new Uint8Array(16 + value.length);
617
+ bytes.set(namespace);
618
+ bytes.set(value, namespace.length);
619
+ bytes = hashfunc(bytes);
620
+ bytes[6] = bytes[6] & 0x0f | version;
621
+ bytes[8] = bytes[8] & 0x3f | 0x80;
622
+ if (buf) {
623
+ offset = offset || 0;
624
+ for (let i = 0; i < 16; ++i) {
625
+ buf[offset + i] = bytes[i];
626
+ }
627
+ return buf;
628
+ }
629
+ return unsafeStringify(bytes);
630
+ } // Function#name is not settable on some platforms (#270)
631
+
632
+ try {
633
+ generateUUID.name = name; // eslint-disable-next-line no-empty
634
+ } catch (err) {} // For CommonJS default export support
635
+
636
+ generateUUID.DNS = DNS;
637
+ generateUUID.URL = URL;
638
+ return generateUUID;
639
+ }
640
+
641
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
642
+ var native = {
643
+ randomUUID
644
+ };
645
+
646
+ function v4(options, buf, offset) {
647
+ if (native.randomUUID && !buf && !options) {
648
+ return native.randomUUID();
649
+ }
650
+ options = options || {};
651
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
652
+
653
+ rnds[6] = rnds[6] & 0x0f | 0x40;
654
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
655
+
656
+ if (buf) {
657
+ offset = offset || 0;
658
+ for (let i = 0; i < 16; ++i) {
659
+ buf[offset + i] = rnds[i];
660
+ }
661
+ return buf;
662
+ }
663
+ return unsafeStringify(rnds);
664
+ }
665
+
666
+ // Adapted from Chris Veness' SHA1 code at
667
+ // http://www.movable-type.co.uk/scripts/sha1.html
668
+ function f(s, x, y, z) {
669
+ switch (s) {
670
+ case 0:
671
+ return x & y ^ ~x & z;
672
+ case 1:
673
+ return x ^ y ^ z;
674
+ case 2:
675
+ return x & y ^ x & z ^ y & z;
676
+ case 3:
677
+ return x ^ y ^ z;
678
+ }
679
+ }
680
+ function ROTL(x, n) {
681
+ return x << n | x >>> 32 - n;
682
+ }
683
+ function sha1(bytes) {
684
+ const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
685
+ const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
686
+ if (typeof bytes === 'string') {
687
+ const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
688
+
689
+ bytes = [];
690
+ for (let i = 0; i < msg.length; ++i) {
691
+ bytes.push(msg.charCodeAt(i));
692
+ }
693
+ } else if (!Array.isArray(bytes)) {
694
+ // Convert Array-like to Array
695
+ bytes = Array.prototype.slice.call(bytes);
696
+ }
697
+ bytes.push(0x80);
698
+ const l = bytes.length / 4 + 2;
699
+ const N = Math.ceil(l / 16);
700
+ const M = new Array(N);
701
+ for (let i = 0; i < N; ++i) {
702
+ const arr = new Uint32Array(16);
703
+ for (let j = 0; j < 16; ++j) {
704
+ 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];
705
+ }
706
+ M[i] = arr;
707
+ }
708
+ M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
709
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
710
+ M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
711
+ for (let i = 0; i < N; ++i) {
712
+ const W = new Uint32Array(80);
713
+ for (let t = 0; t < 16; ++t) {
714
+ W[t] = M[i][t];
715
+ }
716
+ for (let t = 16; t < 80; ++t) {
717
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
718
+ }
719
+ let a = H[0];
720
+ let b = H[1];
721
+ let c = H[2];
722
+ let d = H[3];
723
+ let e = H[4];
724
+ for (let t = 0; t < 80; ++t) {
725
+ const s = Math.floor(t / 20);
726
+ const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
727
+ e = d;
728
+ d = c;
729
+ c = ROTL(b, 30) >>> 0;
730
+ b = a;
731
+ a = T;
732
+ }
733
+ H[0] = H[0] + a >>> 0;
734
+ H[1] = H[1] + b >>> 0;
735
+ H[2] = H[2] + c >>> 0;
736
+ H[3] = H[3] + d >>> 0;
737
+ H[4] = H[4] + e >>> 0;
738
+ }
739
+ 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];
740
+ }
741
+
742
+ const v5 = v35('v5', 0x50, sha1);
743
+ var uuidv5 = v5;
744
+
745
+ const ESCAPE = {
746
+ "n": "\n",
747
+ "f": "\f",
748
+ "r": "\r",
749
+ "t": " ",
750
+ "v": "\v"
751
+ };
752
+ const CONSTANTS = {
753
+ "null": data => null,
754
+ "true": data => true,
755
+ "false": data => false,
756
+ "undefined": data => void 0
757
+ };
758
+ const OPERATORS = {
759
+ "+": (data, a, b) => a(data) + b(data),
760
+ "-": (data, a, b) => a(data) - b(data),
761
+ "*": (data, a, b) => a(data) * b(data),
762
+ "/": (data, a, b) => a(data) / b(data),
763
+ "%": (data, a, b) => a(data) % b(data),
764
+ "===": (data, a, b) => a(data) === b(data),
765
+ "!==": (data, a, b) => a(data) !== b(data),
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) => !a(data)
775
+ };
776
+ function isNumber(char) {
777
+ return char >= "0" && char <= "9" && typeof char === "string";
778
+ }
779
+ function isExpOperator(char) {
780
+ return char === "-" || char === "+" || isNumber(char);
781
+ }
782
+ function isIdent(char) {
783
+ return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
784
+ }
785
+ class Expression {
786
+ constructor(content) {
787
+ if (!content) throw new Error("invalid expression");
788
+ this.content = content;
789
+ }
790
+ lex() {
791
+ let content = this.content;
792
+ let length = content.length;
793
+ let index = 0;
794
+ let tokens = [];
795
+ while (index < length) {
796
+ let char = content.charAt(index);
797
+ if (char === '"' || char === "'") {
798
+ let start = ++index;
799
+ let escape = false;
800
+ let value = "";
801
+ let token;
802
+ while (index < length) {
803
+ let c = content.charAt(index);
804
+ if (escape) {
805
+ if (c === "u") {
806
+ let hex = content.substring(index + 1, index + 5);
807
+ if (!hex.match(/[\da-f]{4}/i)) {
808
+ throw new Error(`invalid expression: ${content}, invalid unicode escape [\\u${hex}]`);
809
+ }
810
+ index += 4;
811
+ value += String.fromCharCode(parseInt(hex, 16));
812
+ } else {
813
+ let rep = ESCAPE[c];
814
+ value = value + (rep || c);
815
+ }
816
+ escape = false;
817
+ } else if (c === "\\") {
818
+ escape = true;
819
+ } else if (c === char) {
820
+ index++;
821
+ token = {
822
+ index: start,
823
+ constant: true,
824
+ text: char + value + char,
825
+ value
826
+ };
827
+ break;
828
+ } else {
829
+ value += c;
830
+ }
831
+ index++;
832
+ }
833
+ if (!token) {
834
+ throw new Error(`invalid expression: ${content}`);
835
+ } else {
836
+ tokens.push(token);
837
+ }
838
+ } else if (isNumber(char) || char === "." && isNumber(content.charAt(index + 1))) {
839
+ let start = index;
840
+ let value = "";
841
+ while (index < length) {
842
+ let c = content.charAt(index).toLowerCase();
843
+ if (c === "." || isNumber(c)) {
844
+ value += c;
845
+ } else {
846
+ let c2 = content.charAt(index + 1);
847
+ if (c === "e" && isExpOperator(c2)) {
848
+ value += c;
849
+ } else if (isExpOperator(c) && c2 && isNumber(c2) && value.charAt(value.length - 1) === "e") {
850
+ value += c;
851
+ } else if (isExpOperator(c) && (!c2 || !isNumber(c2)) && value.charAt(value.length - 1) == "e") {
852
+ throw new Error(`invalid expression: ${content}`);
853
+ } else {
854
+ break;
855
+ }
856
+ }
857
+ index++;
858
+ }
859
+ tokens.push({
860
+ index: start,
861
+ constant: true,
862
+ text: value,
863
+ value: Number(value)
864
+ });
865
+ } else if (isIdent(char)) {
866
+ let start = index;
867
+ while (index < length) {
868
+ let c = content.charAt(index);
869
+ if (!(isIdent(c) || isNumber(c))) {
870
+ break;
871
+ }
872
+ index++;
873
+ }
874
+ tokens.push({
875
+ index: start,
876
+ text: content.slice(start, index),
877
+ identifier: true
878
+ });
879
+ } else if ("(){}[].,:?".indexOf(char) >= 0) {
880
+ tokens.push({
881
+ index,
882
+ text: char
883
+ });
884
+ index++;
885
+ } else if (char === " " || char === "\r" || char === " " || char === "\n" || char === "\v" || char === "\xA0") {
886
+ index++;
887
+ } else {
888
+ let char2 = char + content.charAt(index + 1);
889
+ let char3 = char2 + content.charAt(index + 2);
890
+ let op1 = OPERATORS[char];
891
+ let op2 = OPERATORS[char2];
892
+ let op3 = OPERATORS[char3];
893
+ if (op1 || op2 || op3) {
894
+ let text = op3 ? char3 : op2 ? char2 : char;
895
+ tokens.push({
896
+ index,
897
+ text,
898
+ operator: true
899
+ });
900
+ index += text.length;
901
+ } else {
902
+ throw new Error(`invalid expression: ${content}`);
903
+ }
904
+ }
905
+ }
906
+ this.tokens = tokens;
907
+ return tokens;
908
+ }
909
+ parse() {
910
+ let tokens = this.lex();
911
+ let func;
912
+ let token = tokens[0];
913
+ let text = token.text;
914
+ if (tokens.length > 0 && text !== "}" && text !== ")" && text !== "]") {
915
+ func = this.expression();
916
+ }
917
+ return data => func && func(data);
918
+ }
919
+ expect(text) {
920
+ let tokens = this.tokens;
921
+ let token = tokens[0];
922
+ if (!text || text === (token && token.text)) {
923
+ return tokens.shift();
924
+ }
925
+ }
926
+ consume(text) {
927
+ if (!this.tokens.length) throw new Error(`parse expression error: ${this.content}`);
928
+ let token = this.expect(text);
929
+ if (!token) throw new Error(`parse expression error: ${this.content}`);
930
+ return token;
931
+ }
932
+ expression() {
933
+ return this.ternary();
934
+ }
935
+ ternary() {
936
+ let left = this.logicalOR();
937
+ if (this.expect("?")) {
938
+ let middle = this.expression();
939
+ this.consume(":");
940
+ let right = this.expression();
941
+ return data => left(data) ? middle(data) : right(data);
942
+ }
943
+ return left;
944
+ }
945
+ binary(left, op, right) {
946
+ let fn = OPERATORS[op];
947
+ return data => fn(data, left, right);
948
+ }
949
+ unary() {
950
+ let token;
951
+ if (this.expect("+")) {
952
+ return this.primary();
953
+ } else if (token = this.expect("-")) {
954
+ return this.binary(data => 0, token.text, this.unary());
955
+ } else if (token = this.expect("!")) {
956
+ let fn = OPERATORS[token.text];
957
+ let right = this.unary();
958
+ return data => fn(data, right);
959
+ } else {
960
+ return this.primary();
961
+ }
962
+ }
963
+ logicalOR() {
964
+ let left = this.logicalAND();
965
+ let token;
966
+ while (token = this.expect("||")) {
967
+ left = this.binary(left, token.text, this.logicalAND());
968
+ }
969
+ return left;
970
+ }
971
+ logicalAND() {
972
+ let left = this.equality();
973
+ let token;
974
+ while (token = this.expect("&&")) {
975
+ left = this.binary(left, token.text, this.equality());
976
+ }
977
+ return left;
978
+ }
979
+ equality() {
980
+ let left = this.relational();
981
+ let token;
982
+ while (token = this.expect("==") || this.expect("!=") || this.expect("===") || this.expect("!==")) {
983
+ left = this.binary(left, token.text, this.relational());
984
+ }
985
+ return left;
986
+ }
987
+ relational() {
988
+ let left = this.additive();
989
+ let token;
990
+ while (token = this.expect("<") || this.expect(">") || this.expect("<=") || this.expect(">=")) {
991
+ left = this.binary(left, token.text, this.additive());
992
+ }
993
+ return left;
994
+ }
995
+ additive() {
996
+ let left = this.multiplicative();
997
+ let token;
998
+ while (token = this.expect("+") || this.expect("-")) {
999
+ left = this.binary(left, token.text, this.multiplicative());
1000
+ }
1001
+ return left;
1002
+ }
1003
+ multiplicative() {
1004
+ let left = this.unary();
1005
+ let token;
1006
+ while (token = this.expect("*") || this.expect("/") || this.expect("%")) {
1007
+ left = this.binary(left, token.text, this.unary());
1008
+ }
1009
+ return left;
1010
+ }
1011
+ primary() {
1012
+ let token = this.tokens[0];
1013
+ let primary;
1014
+ if (this.expect("(")) {
1015
+ primary = this.expression();
1016
+ this.consume(")");
1017
+ } else if (this.expect("[")) {
1018
+ primary = this.array();
1019
+ } else if (this.expect("{")) {
1020
+ primary = this.object();
1021
+ } else if (token.identifier && token.text in CONSTANTS) {
1022
+ primary = CONSTANTS[this.consume().text];
1023
+ } else if (token.identifier) {
1024
+ primary = this.identifier();
1025
+ } else if (token.constant) {
1026
+ primary = this.constant();
1027
+ } else {
1028
+ throw new Error(`parse expression error: ${this.content}`);
1029
+ }
1030
+ let next;
1031
+ let context;
1032
+ while (next = this.expect("(") || this.expect("[") || this.expect(".")) {
1033
+ if (next.text === "(") {
1034
+ primary = this.functionCall(primary, context);
1035
+ context = null;
1036
+ } else if (next.text === "[") {
1037
+ context = primary;
1038
+ primary = this.objectIndex(primary);
1039
+ } else {
1040
+ context = primary;
1041
+ primary = this.fieldAccess(primary);
1042
+ }
1043
+ }
1044
+ return primary;
1045
+ }
1046
+ fieldAccess(object) {
1047
+ let getter = this.identifier();
1048
+ return data => {
1049
+ let o = object(data);
1050
+ return o && getter(o);
1051
+ };
1052
+ }
1053
+ objectIndex(object) {
1054
+ let indexFn = this.expression();
1055
+ this.consume("]");
1056
+ return data => {
1057
+ let o = object(data);
1058
+ let key = indexFn(data) + "";
1059
+ return o && o[key];
1060
+ };
1061
+ }
1062
+ functionCall(func, context) {
1063
+ let args = [];
1064
+ if (this.tokens[0].text !== ")") {
1065
+ do {
1066
+ args.push(this.expression());
1067
+ } while (this.expect(","));
1068
+ }
1069
+ this.consume(")");
1070
+ return data => {
1071
+ let callContext = context && context(data);
1072
+ let fn = func(data, callContext);
1073
+ return fn && fn.apply(callContext, args.length ? args.map(arg => arg(data)) : null);
1074
+ };
1075
+ }
1076
+ array() {
1077
+ let elements = [];
1078
+ let token = this.tokens[0];
1079
+ if (token.text !== "]") {
1080
+ do {
1081
+ if (this.tokens[0].text === "]") break;
1082
+ elements.push(this.expression());
1083
+ } while (this.expect(","));
1084
+ }
1085
+ this.consume("]");
1086
+ return data => elements.map(element => element(data));
1087
+ }
1088
+ object() {
1089
+ let keys = [];
1090
+ let values = [];
1091
+ let token = this.tokens[0];
1092
+ if (token.text !== "}") {
1093
+ do {
1094
+ token = this.tokens[0];
1095
+ if (token.text === "}") break;
1096
+ token = this.consume();
1097
+ if (token.constant) {
1098
+ keys.push(token.value);
1099
+ } else if (token.identifier) {
1100
+ keys.push(token.text);
1101
+ } else {
1102
+ throw new Error(`parse expression error: ${this.content}`);
1103
+ }
1104
+ this.consume(":");
1105
+ values.push(this.expression());
1106
+ } while (this.expect(","));
1107
+ }
1108
+ this.consume("}");
1109
+ return data => {
1110
+ let object = {};
1111
+ for (let i = 0, length = values.length; i < length; i++) {
1112
+ object[keys[i]] = values[i](data);
1113
+ }
1114
+ return object;
1115
+ };
1116
+ }
1117
+ identifier() {
1118
+ let id = this.consume().text;
1119
+ let token = this.tokens[0];
1120
+ let token2 = this.tokens[1];
1121
+ let token3 = this.tokens[2];
1122
+ while (token && token.text === "." && token2 && token2.identifier && token3 && token3.text !== "(") {
1123
+ id += this.consume().text + this.consume().text;
1124
+ token = this.tokens[0];
1125
+ token2 = this.tokens[1];
1126
+ token3 = this.tokens[2];
1127
+ }
1128
+ return data => {
1129
+ let elements = id.split(".");
1130
+ let key;
1131
+ for (let i = 0; elements.length > 1; i++) {
1132
+ key = elements.shift();
1133
+ data = data[key];
1134
+ if (!data) break;
1135
+ }
1136
+ key = elements.shift();
1137
+ return data && data[key];
1138
+ };
1139
+ }
1140
+ constant() {
1141
+ let value = this.consume().value;
1142
+ return data => value;
1143
+ }
1144
+ }
1145
+ const parse = (expression, props = {}) => {
1146
+ if (!expression) throw new Error("expression is required");
1147
+ const execParse = new Expression(expression).parse();
1148
+ return execParse(props);
1149
+ };
1150
+
1151
+ //
1152
+ const MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002';
1153
+ var script$7 = {
1154
+ props: {
1155
+ record: {
1156
+ type: Object
1157
+ },
1158
+ dataSource: {
1159
+ type: Array,
1160
+ default: () => []
1161
+ }
1162
+ },
1163
+ inject: {
1164
+ requestTreeData: {
1165
+ default: void 0
1166
+ },
1167
+ requestTableData: {
1168
+ default: void 0
1169
+ }
1170
+ },
1171
+ computed: {
1172
+ menuKeyDelimiter() {
1173
+ return uuidv5('_', MENU_KEY_NAMESPACE);
1174
+ },
1175
+ builtInMethods() {
1176
+ return {
1177
+ requestTreeData: this.requestTreeData,
1178
+ requestTableData: this.requestTableData
1179
+ };
1180
+ }
1181
+ },
1182
+ methods: {
1183
+ execOperationExpression(dataSource = []) {
1184
+ const ret = dataSource.map(item => {
1185
+ const {
1186
+ show
1187
+ } = item;
1188
+ if (type.isUndefined(show)) {
1189
+ return item;
1190
+ } else if (type.isBool(show)) {
1191
+ if (show) return item;
1192
+ } else if (type.isStr(show)) {
1193
+ const parseRet = parse(show, {
1194
+ ...this.record,
1195
+ _route: route.searchToQueryParams(window.location.search)
1196
+ });
1197
+ if (parseRet) return item;
1198
+ }
1199
+ }).filter(item => item);
1200
+ return ret;
1201
+ },
1202
+ handleClickConfirm(props) {
1203
+ //TODO generate event by special rule
1204
+ const {
1205
+ eventName,
1206
+ value
1207
+ } = props;
1208
+ this.$emit(eventName, {
1209
+ key: value,
1210
+ record: this.record,
1211
+ builtInMethods: this.builtInMethods
1212
+ });
1213
+ },
1214
+ handleDropdownClick(props) {
1215
+ const {
1216
+ key
1217
+ } = props;
1218
+ const [parent, child] = key.split(this.menuKeyDelimiter);
1219
+ if (!parent || !child) {
1220
+ throw new Error('key is required');
1221
+ }
1222
+ const currentDropdown = this.dataSource.find(item => item.key === parent);
1223
+ const currentClickTarget = currentDropdown.optionList.find(item => item.value === child);
1224
+ const {
1225
+ eventName,
1226
+ type
1227
+ } = currentClickTarget;
1228
+ //TODO generate event by special rule
1229
+ if (type === 'confirm') return;
1230
+ this.$emit(eventName, {
1231
+ key: child,
1232
+ record: this.record,
1233
+ builtInMethods: this.builtInMethods
1234
+ });
1235
+ },
1236
+ handleClickText(props) {
1237
+ const {
1238
+ eventName,
1239
+ key
1240
+ } = props;
1241
+ this.$emit(eventName, {
1242
+ key,
1243
+ record: this.record,
1244
+ builtInMethods: this.builtInMethods
1245
+ });
1246
+ }
1247
+ }
1248
+ };
1249
+
1250
+ /* script */
1251
+ const __vue_script__$7 = script$7;
1252
+
1253
+ /* template */
1254
+ var __vue_render__$7 = function () {
1255
+ var _vm = this;
1256
+ var _h = _vm.$createElement;
1257
+ var _c = _vm._self._c || _h;
1258
+ return _c(
1259
+ "div",
1260
+ { staticClass: "g-table__action" },
1261
+ _vm._l(_vm.execOperationExpression(_vm.dataSource), function (item, idx) {
1262
+ return _c(
1263
+ "div",
1264
+ { key: idx, staticClass: "table-action__item" },
1265
+ [
1266
+ item.type == "text"
1267
+ ? [_c("span", [_vm._v(_vm._s(item.label))])]
1268
+ : item.type == "dropdown"
1269
+ ? [
1270
+ _c(
1271
+ "a-dropdown",
1272
+ [
1273
+ _c(
1274
+ "a-menu",
1275
+ {
1276
+ attrs: { slot: "overlay" },
1277
+ on: { click: _vm.handleDropdownClick },
1278
+ slot: "overlay",
1279
+ },
1280
+ _vm._l(
1281
+ _vm.execOperationExpression(item.optionList),
1282
+ function (opt) {
1283
+ return _c(
1284
+ "a-menu-item",
1285
+ {
1286
+ key:
1287
+ "" +
1288
+ (item.key || "") +
1289
+ _vm.menuKeyDelimiter +
1290
+ (opt.value || ""),
1291
+ },
1292
+ [
1293
+ opt.type == "confirm"
1294
+ ? [
1295
+ _c(
1296
+ "a-popconfirm",
1297
+ {
1298
+ attrs: { title: opt.message },
1299
+ on: {
1300
+ confirm: function ($event) {
1301
+ return _vm.handleClickConfirm(opt)
1302
+ },
1303
+ },
1304
+ },
1305
+ [
1306
+ _vm._v(
1307
+ "\n " +
1308
+ _vm._s(opt.label) +
1309
+ "\n "
1310
+ ),
1311
+ ]
1312
+ ),
1313
+ ]
1314
+ : [
1315
+ _vm._v(
1316
+ "\n " +
1317
+ _vm._s(opt.label) +
1318
+ "\n "
1319
+ ),
1320
+ ],
1321
+ ],
1322
+ 2
1323
+ )
1324
+ }
1325
+ ),
1326
+ 1
1327
+ ),
1328
+ _vm._v(" "),
1329
+ _c("span", [_vm._v(_vm._s(item.label))]),
1330
+ ],
1331
+ 1
1332
+ ),
1333
+ ]
1334
+ : _vm._e(),
1335
+ ],
1336
+ 2
1337
+ )
1338
+ }),
1339
+ 0
1340
+ )
1341
+ };
1342
+ var __vue_staticRenderFns__$7 = [];
1343
+ __vue_render__$7._withStripped = true;
1344
+
1345
+ /* style */
1346
+ const __vue_inject_styles__$7 = function (inject) {
1347
+ if (!inject) return
1348
+ 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 });
1349
+
1350
+ };
1351
+ /* scoped */
1352
+ const __vue_scope_id__$7 = "data-v-2708b08a";
1353
+ /* module identifier */
1354
+ const __vue_module_identifier__$7 = undefined;
1355
+ /* functional template */
1356
+ const __vue_is_functional_template__$7 = false;
1357
+ /* style inject SSR */
1358
+
1359
+ /* style inject shadow dom */
1360
+
1361
+
1362
+
1363
+ const __vue_component__$7 = /*#__PURE__*/normalizeComponent(
1364
+ { render: __vue_render__$7, staticRenderFns: __vue_staticRenderFns__$7 },
1365
+ __vue_inject_styles__$7,
1366
+ __vue_script__$7,
1367
+ __vue_scope_id__$7,
1368
+ __vue_is_functional_template__$7,
1369
+ __vue_module_identifier__$7,
1370
+ false,
1371
+ createInjector,
1372
+ undefined,
1373
+ undefined
1374
+ );
1375
+
1376
+ //
1377
+ var script$6 = {
1378
+ name: 'ele-table',
1379
+ components: {
1380
+ Actions: __vue_component__$7
1381
+ },
1382
+ props: {
1383
+ actions: {
1384
+ type: Array,
1385
+ default: () => []
1386
+ },
1387
+ total: {
1388
+ type: Number,
1389
+ default: 0
1390
+ },
1391
+ loading: {
1392
+ type: Boolean,
1393
+ default: false
1394
+ },
1395
+ columns: {
1396
+ type: Array,
1397
+ default: () => []
1398
+ },
1399
+ dataSource: {
1400
+ type: Array,
1401
+ default: () => []
1402
+ },
1403
+ pageSize: {
1404
+ type: Number,
1405
+ default: 10
1406
+ },
1407
+ pageSizeOptions: {
1408
+ type: Array,
1409
+ default: () => ['10', '20', '30', '40']
1410
+ }
1411
+ },
1412
+ methods: {
1413
+ setRowClassName(record, idx) {
1414
+ return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd';
1415
+ },
1416
+ onChangePagination(page, pagrSize) {
1417
+ this.$emit('change-page', page, pagrSize);
1418
+ }
1419
+ }
1420
+ };
1421
+
1422
+ /* script */
1423
+ const __vue_script__$6 = script$6;
1424
+
1425
+ /* template */
1426
+ var __vue_render__$6 = function () {
1427
+ var _vm = this;
1428
+ var _h = _vm.$createElement;
1429
+ var _c = _vm._self._c || _h;
1430
+ return _c(
1431
+ "div",
1432
+ { staticClass: "g-table__wrapper" },
1433
+ [
1434
+ _c("a-table", {
1435
+ attrs: {
1436
+ pagination: false,
1437
+ loading: _vm.loading,
1438
+ columns: _vm.columns,
1439
+ "row-class-name": _vm.setRowClassName,
1440
+ "data-source": _vm.dataSource,
1441
+ scroll: { x: 1500, y: 500 },
1442
+ },
1443
+ scopedSlots: _vm._u([
1444
+ {
1445
+ key: "action",
1446
+ fn: function (record) {
1447
+ return [
1448
+ _c(
1449
+ "Actions",
1450
+ _vm._g(
1451
+ { attrs: { "data-source": _vm.actions, record: record } },
1452
+ _vm.$listeners
1453
+ )
1454
+ ),
1455
+ ]
1456
+ },
1457
+ },
1458
+ ]),
1459
+ }),
1460
+ _vm._v(" "),
1461
+ _c(
1462
+ "div",
1463
+ { staticClass: "g-table__pagination" },
1464
+ [
1465
+ _c("a-pagination", {
1466
+ attrs: {
1467
+ "show-total": function (total) {
1468
+ return "共 " + total + " 条数据"
1469
+ },
1470
+ "show-size-changer": "",
1471
+ "show-quick-jumper": "",
1472
+ pageSize: _vm.pageSize,
1473
+ pageSizeOptions: _vm.pageSizeOptions,
1474
+ total: _vm.total,
1475
+ },
1476
+ on: { change: _vm.onChangePagination },
1477
+ }),
1478
+ ],
1479
+ 1
1480
+ ),
1481
+ ],
1482
+ 1
1483
+ )
1484
+ };
1485
+ var __vue_staticRenderFns__$6 = [];
1486
+ __vue_render__$6._withStripped = true;
1487
+
1488
+ /* style */
1489
+ const __vue_inject_styles__$6 = function (inject) {
1490
+ if (!inject) return
1491
+ 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 });
1492
+
1493
+ };
1494
+ /* scoped */
1495
+ const __vue_scope_id__$6 = "data-v-6f3faf52";
1496
+ /* module identifier */
1497
+ const __vue_module_identifier__$6 = undefined;
1498
+ /* functional template */
1499
+ const __vue_is_functional_template__$6 = false;
1500
+ /* style inject SSR */
1501
+
1502
+ /* style inject shadow dom */
1503
+
1504
+
1505
+
1506
+ const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
1507
+ { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
1508
+ __vue_inject_styles__$6,
1509
+ __vue_script__$6,
1510
+ __vue_scope_id__$6,
1511
+ __vue_is_functional_template__$6,
1512
+ __vue_module_identifier__$6,
1513
+ false,
1514
+ createInjector,
1515
+ undefined,
1516
+ undefined
1517
+ );
1518
+
1519
+ __vue_component__$6.install = Vue => Vue.component(__vue_component__$6.name, __vue_component__$6);
1520
+
1521
+ //
1522
+ //
1523
+ //
1524
+ //
1525
+ //
1526
+ //
1527
+ //
1528
+ //
1529
+ //
1530
+ //
1531
+ //
1532
+ //
1533
+ //
1534
+ //
1535
+ //
1536
+ //
1537
+ //
1538
+ //
1539
+ //
1540
+ //
1541
+ //
1542
+ //
1543
+ //
1544
+
1545
+ var script$5 = {
1546
+ name: 'ele-tree',
1547
+ props: {
1548
+ treeData: {
1549
+ type: Array,
1550
+ default: () => []
1551
+ },
1552
+ replaceFields: {
1553
+ type: Object,
1554
+ default: () => ({
1555
+ title: 'title',
1556
+ key: 'id',
1557
+ children: 'children'
1558
+ })
1559
+ },
1560
+ defaultExpandedKeys: {
1561
+ type: Array
1562
+ },
1563
+ defaultSelectedKeys: {
1564
+ type: Array
1565
+ },
1566
+ showIcon: {
1567
+ type: Boolean,
1568
+ default: true
1569
+ }
1570
+ },
1571
+ data() {
1572
+ return {};
1573
+ },
1574
+ computed: {
1575
+ innerTreeData() {
1576
+ return this.treeData;
1577
+ // return [
1578
+ // {
1579
+ // title: 'parent 1',
1580
+ // key: 1,
1581
+ // scopedSlots: {
1582
+ // icon: 'custom',
1583
+ // iconName: 'smile-o'
1584
+ // },
1585
+ // children: [
1586
+ // {
1587
+ // title: '2',
1588
+ // key: 2,
1589
+ // scopedSlots: {
1590
+ // icon: 'custom',
1591
+ // iconName: 'frown-o'
1592
+ // }
1593
+ // }
1594
+ // ]
1595
+ // }
1596
+ // ]
1597
+ }
1598
+ },
1599
+ methods: {
1600
+ refreshTreeStatus(props = {}) {},
1601
+ selectTreeNode(selectedKeys, e) {
1602
+ this.$emit('select', selectedKeys, e);
1603
+ }
1604
+ }
1605
+ };
1606
+
1607
+ /* script */
1608
+ const __vue_script__$5 = script$5;
1609
+
1610
+ /* template */
1611
+ var __vue_render__$5 = function () {
1612
+ var _vm = this;
1613
+ var _h = _vm.$createElement;
1614
+ var _c = _vm._self._c || _h;
1615
+ return _c(
1616
+ "div",
1617
+ { staticClass: "g-tree__wrapper" },
1618
+ [
1619
+ _vm.innerTreeData.length
1620
+ ? _c("a-tree", {
1621
+ attrs: {
1622
+ "tree-data": _vm.innerTreeData,
1623
+ replaceFields: _vm.replaceFields,
1624
+ "default-expanded-keys": _vm.defaultExpandedKeys,
1625
+ "default-selected-keys": _vm.defaultSelectedKeys,
1626
+ blockNode: "",
1627
+ "show-icon": _vm.showIcon,
1628
+ },
1629
+ on: { select: _vm.selectTreeNode },
1630
+ scopedSlots: _vm._u(
1631
+ [
1632
+ {
1633
+ key: "title",
1634
+ fn: function (ref) {
1635
+ var title = ref.title;
1636
+ return [
1637
+ _c(
1638
+ "span",
1639
+ {
1640
+ staticClass: "tree-node__title",
1641
+ attrs: { title: title },
1642
+ },
1643
+ [_vm._v("\n " + _vm._s(title) + "\n ")]
1644
+ ),
1645
+ ]
1646
+ },
1647
+ },
1648
+ {
1649
+ key: "custom",
1650
+ fn: function (ref) {
1651
+ var scopedSlots = ref.scopedSlots;
1652
+ return [
1653
+ _c("a-icon", { attrs: { type: scopedSlots.iconName } }),
1654
+ ]
1655
+ },
1656
+ },
1657
+ ],
1658
+ null,
1659
+ false,
1660
+ 729072655
1661
+ ),
1662
+ })
1663
+ : _vm._e(),
1664
+ ],
1665
+ 1
1666
+ )
1667
+ };
1668
+ var __vue_staticRenderFns__$5 = [];
1669
+ __vue_render__$5._withStripped = true;
1670
+
1671
+ /* style */
1672
+ const __vue_inject_styles__$5 = function (inject) {
1673
+ if (!inject) return
1674
+ 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 });
1675
+
1676
+ };
1677
+ /* scoped */
1678
+ const __vue_scope_id__$5 = "data-v-cc99bbf0";
1679
+ /* module identifier */
1680
+ const __vue_module_identifier__$5 = undefined;
1681
+ /* functional template */
1682
+ const __vue_is_functional_template__$5 = false;
1683
+ /* style inject SSR */
1684
+
1685
+ /* style inject shadow dom */
1686
+
1687
+
1688
+
1689
+ const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
1690
+ { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
1691
+ __vue_inject_styles__$5,
1692
+ __vue_script__$5,
1693
+ __vue_scope_id__$5,
1694
+ __vue_is_functional_template__$5,
1695
+ __vue_module_identifier__$5,
1696
+ false,
1697
+ createInjector,
1698
+ undefined,
1699
+ undefined
1700
+ );
1701
+
1702
+ __vue_component__$5.install = Vue => Vue.component(__vue_component__$5.name, __vue_component__$5);
1703
+
1704
+ //
1705
+ //
1706
+ //
1707
+ //
1708
+ //
1709
+ //
1710
+ //
1711
+
1712
+ var script$4 = {
1713
+ props: {
1714
+ label: {
1715
+ type: String
1716
+ }
1717
+ }
1718
+ };
1719
+
1720
+ /* script */
1721
+ const __vue_script__$4 = script$4;
1722
+
1723
+ /* template */
1724
+ var __vue_render__$4 = function () {
1725
+ var _vm = this;
1726
+ var _h = _vm.$createElement;
1727
+ var _c = _vm._self._c || _h;
1728
+ return _c("div", { staticClass: "g-search__label" }, [
1729
+ _c("span", { staticClass: "label__title" }, [_vm._v(_vm._s(_vm.label))]),
1730
+ _vm._v(" "),
1731
+ _c("span", { staticClass: "label__suffix" }, [_vm._v(":")]),
1732
+ ])
1733
+ };
1734
+ var __vue_staticRenderFns__$4 = [];
1735
+ __vue_render__$4._withStripped = true;
1736
+
1737
+ /* style */
1738
+ const __vue_inject_styles__$4 = function (inject) {
1739
+ if (!inject) return
1740
+ 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 });
1741
+
1742
+ };
1743
+ /* scoped */
1744
+ const __vue_scope_id__$4 = "data-v-40e71716";
1745
+ /* module identifier */
1746
+ const __vue_module_identifier__$4 = undefined;
1747
+ /* functional template */
1748
+ const __vue_is_functional_template__$4 = false;
1749
+ /* style inject SSR */
1750
+
1751
+ /* style inject shadow dom */
1752
+
1753
+
1754
+
1755
+ const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
1756
+ { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
1757
+ __vue_inject_styles__$4,
1758
+ __vue_script__$4,
1759
+ __vue_scope_id__$4,
1760
+ __vue_is_functional_template__$4,
1761
+ __vue_module_identifier__$4,
1762
+ false,
1763
+ createInjector,
1764
+ undefined,
1765
+ undefined
1766
+ );
1767
+
1768
+ //
1769
+ var script$3 = {
1770
+ name: 'ele-search-area',
1771
+ components: {
1772
+ EleInput: __vue_component__$9,
1773
+ EleSelect: __vue_component__$8,
1774
+ ELeButton: __vue_component__$b,
1775
+ Label: __vue_component__$4,
1776
+ EleDate: __vue_component__$a
1777
+ },
1778
+ props: {
1779
+ gutter: {
1780
+ type: [Number, Array, Object],
1781
+ default: () => [16, 8]
1782
+ },
1783
+ span: {
1784
+ type: Number,
1785
+ default: 8
1786
+ },
1787
+ dataSource: {
1788
+ type: Array,
1789
+ required: true
1790
+ }
1791
+ },
1792
+ data() {
1793
+ return {
1794
+ isExpand: false,
1795
+ collapseDataSource: []
1796
+ };
1797
+ },
1798
+ computed: {
1799
+ actionColOffset() {
1800
+ return (24 / this.span - 1) * this.span;
1801
+ },
1802
+ innerDataSource() {
1803
+ return this.isExpand ? [...this.dataSource, {
1804
+ type: '_action'
1805
+ }] : [...this.collapseDataSource, {
1806
+ type: '_action'
1807
+ }];
1808
+ }
1809
+ },
1810
+ created() {
1811
+ this.collapseDataSource = this.dataSource.slice(0, 24 / this.span - 1);
1812
+ },
1813
+ methods: {
1814
+ handleClickExpandCollapse() {
1815
+ if (!this.isExpand) {
1816
+ this.collapseDataSource = this.dataSource.slice(0, 24 / this.span - 1);
1817
+ }
1818
+ this.isExpand = !this.isExpand;
1819
+ },
1820
+ handleClickSearch() {
1821
+ const querys = this.extractValues();
1822
+ this.$emit('search', querys);
1823
+ },
1824
+ extractValues() {
1825
+ let ret = {};
1826
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
1827
+ switch (item.type) {
1828
+ case 'DatePicker':
1829
+ ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format);
1830
+ break;
1831
+ default:
1832
+ ret[item.name] = item._value;
1833
+ break;
1834
+ }
1835
+ });
1836
+ return ret;
1837
+ },
1838
+ handleClickReset() {
1839
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
1840
+ switch (item.type) {
1841
+ case 'Select':
1842
+ this.$set(item, '_value', null);
1843
+ break;
1844
+ case 'DatePicker':
1845
+ this.$set(item, '_value', undefined);
1846
+ break;
1847
+ default:
1848
+ this.$set(item, '_value', null);
1849
+ break;
1850
+ }
1851
+ });
1852
+ //TODO defaultValue
1853
+ const querys = this.extractValues();
1854
+ this.$emit('search', querys);
1855
+ },
1856
+ onChangeSelect(value, props) {
1857
+ this.$set(props, '_value', value);
1858
+ }
1859
+ }
1860
+ };
1861
+
1862
+ /* script */
1863
+ const __vue_script__$3 = script$3;
1864
+
1865
+ /* template */
1866
+ var __vue_render__$3 = function () {
1867
+ var _vm = this;
1868
+ var _h = _vm.$createElement;
1869
+ var _c = _vm._self._c || _h;
1870
+ return _c(
1871
+ "div",
1872
+ { staticClass: "search-area__wrapper" },
1873
+ [
1874
+ _c(
1875
+ "a-row",
1876
+ { attrs: { gutter: _vm.gutter } },
1877
+ _vm._l(_vm.innerDataSource, function (item, idx) {
1878
+ return _c(
1879
+ "a-col",
1880
+ { key: idx, attrs: { span: item.span || _vm.span } },
1881
+ [
1882
+ item.type == "_action"
1883
+ ? _c(
1884
+ "div",
1885
+ { staticClass: "search-area__item search-area--action" },
1886
+ [
1887
+ _c(
1888
+ "ele-button",
1889
+ {
1890
+ attrs: { icon: "search", type: "primary" },
1891
+ on: { click: _vm.handleClickSearch },
1892
+ },
1893
+ [_vm._v("查询")]
1894
+ ),
1895
+ _vm._v(" "),
1896
+ _c(
1897
+ "ele-button",
1898
+ {
1899
+ staticStyle: { "margin-left": "8px" },
1900
+ attrs: { icon: "reload" },
1901
+ on: { click: _vm.handleClickReset },
1902
+ },
1903
+ [_vm._v("重置")]
1904
+ ),
1905
+ _vm._v(" "),
1906
+ _c(
1907
+ "div",
1908
+ {
1909
+ staticClass: "expand-collapse",
1910
+ on: { click: _vm.handleClickExpandCollapse },
1911
+ },
1912
+ [
1913
+ _c("span", { staticClass: "expand-collapse__text" }, [
1914
+ _vm._v(_vm._s(_vm.isExpand ? "收起" : "展开")),
1915
+ ]),
1916
+ _vm._v(" "),
1917
+ _c(
1918
+ "span",
1919
+ { staticClass: "expand-collapse__icon" },
1920
+ [
1921
+ _vm.isExpand
1922
+ ? _c("a-icon", { attrs: { type: "up" } })
1923
+ : _c("a-icon", { attrs: { type: "down" } }),
1924
+ ],
1925
+ 1
1926
+ ),
1927
+ ]
1928
+ ),
1929
+ ],
1930
+ 1
1931
+ )
1932
+ : _c(
1933
+ "div",
1934
+ { staticClass: "search-area__item" },
1935
+ [
1936
+ item.type == "Input"
1937
+ ? [
1938
+ _c("Label", { attrs: { label: item.label } }),
1939
+ _vm._v(" "),
1940
+ _c("ele-input", {
1941
+ model: {
1942
+ value: item._value,
1943
+ callback: function ($$v) {
1944
+ _vm.$set(item, "_value", $$v);
1945
+ },
1946
+ expression: "item._value",
1947
+ },
1948
+ }),
1949
+ ]
1950
+ : item.type == "Select"
1951
+ ? [
1952
+ _c("Label", { attrs: { label: item.label } }),
1953
+ _vm._v(" "),
1954
+ _c("ele-select", {
1955
+ attrs: { "data-source": item.optionList },
1956
+ model: {
1957
+ value: item._value,
1958
+ callback: function ($$v) {
1959
+ _vm.$set(item, "_value", $$v);
1960
+ },
1961
+ expression: "item._value",
1962
+ },
1963
+ }),
1964
+ ]
1965
+ : item.type == "DatePicker"
1966
+ ? [
1967
+ _c("Label", { attrs: { label: item.label } }),
1968
+ _vm._v(" "),
1969
+ _c("ele-date", {
1970
+ attrs: { format: item.format },
1971
+ model: {
1972
+ value: item._value,
1973
+ callback: function ($$v) {
1974
+ _vm.$set(item, "_value", $$v);
1975
+ },
1976
+ expression: "item._value",
1977
+ },
1978
+ }),
1979
+ ]
1980
+ : _vm._e(),
1981
+ ],
1982
+ 2
1983
+ ),
1984
+ ]
1985
+ )
1986
+ }),
1987
+ 1
1988
+ ),
1989
+ ],
1990
+ 1
1991
+ )
1992
+ };
1993
+ var __vue_staticRenderFns__$3 = [];
1994
+ __vue_render__$3._withStripped = true;
1995
+
1996
+ /* style */
1997
+ const __vue_inject_styles__$3 = function (inject) {
1998
+ if (!inject) return
1999
+ 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 });
2000
+
2001
+ };
2002
+ /* scoped */
2003
+ const __vue_scope_id__$3 = "data-v-33290002";
2004
+ /* module identifier */
2005
+ const __vue_module_identifier__$3 = undefined;
2006
+ /* functional template */
2007
+ const __vue_is_functional_template__$3 = false;
2008
+ /* style inject SSR */
2009
+
2010
+ /* style inject shadow dom */
2011
+
2012
+
2013
+
2014
+ const __vue_component__$3 = /*#__PURE__*/normalizeComponent(
2015
+ { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
2016
+ __vue_inject_styles__$3,
2017
+ __vue_script__$3,
2018
+ __vue_scope_id__$3,
2019
+ __vue_is_functional_template__$3,
2020
+ __vue_module_identifier__$3,
2021
+ false,
2022
+ createInjector,
2023
+ undefined,
2024
+ undefined
2025
+ );
2026
+
2027
+ //
2028
+ var script$2 = {
2029
+ name: 'ele-button-group',
2030
+ components: {
2031
+ EleButton: __vue_component__$b
2032
+ },
2033
+ props: {
2034
+ dataSource: {
2035
+ type: Array,
2036
+ default: () => []
2037
+ }
2038
+ },
2039
+ methods: {
2040
+ handleClick(props) {
2041
+ this.$emit('click', props);
2042
+ }
2043
+ }
2044
+ };
2045
+
2046
+ /* script */
2047
+ const __vue_script__$2 = script$2;
2048
+
2049
+ /* template */
2050
+ var __vue_render__$2 = function () {
2051
+ var _vm = this;
2052
+ var _h = _vm.$createElement;
2053
+ var _c = _vm._self._c || _h;
2054
+ return _c(
2055
+ "div",
2056
+ { staticClass: "button-group__wrapper" },
2057
+ _vm._l(_vm.dataSource, function (item, idx) {
2058
+ return _c(
2059
+ "ele-button",
2060
+ _vm._g(
2061
+ {
2062
+ key: idx,
2063
+ attrs: {
2064
+ type: item.type,
2065
+ icon: item.icon,
2066
+ mode: item.mode,
2067
+ "data-source": item.optionList,
2068
+ "event-name": item.eventName,
2069
+ record: item,
2070
+ },
2071
+ },
2072
+ _vm.$listeners
2073
+ ),
2074
+ [_vm._v("\n " + _vm._s(item.label) + "\n ")]
2075
+ )
2076
+ }),
2077
+ 1
2078
+ )
2079
+ };
2080
+ var __vue_staticRenderFns__$2 = [];
2081
+ __vue_render__$2._withStripped = true;
2082
+
2083
+ /* style */
2084
+ const __vue_inject_styles__$2 = function (inject) {
2085
+ if (!inject) return
2086
+ 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 });
2087
+
2088
+ };
2089
+ /* scoped */
2090
+ const __vue_scope_id__$2 = "data-v-106e8dd5";
2091
+ /* module identifier */
2092
+ const __vue_module_identifier__$2 = undefined;
2093
+ /* functional template */
2094
+ const __vue_is_functional_template__$2 = false;
2095
+ /* style inject SSR */
2096
+
2097
+ /* style inject shadow dom */
2098
+
2099
+
2100
+
2101
+ const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
2102
+ { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
2103
+ __vue_inject_styles__$2,
2104
+ __vue_script__$2,
2105
+ __vue_scope_id__$2,
2106
+ __vue_is_functional_template__$2,
2107
+ __vue_module_identifier__$2,
2108
+ false,
2109
+ createInjector,
2110
+ undefined,
2111
+ undefined
2112
+ );
2113
+
2114
+ //
2115
+ var script$1 = {
2116
+ name: 'ele-tree-table-model',
2117
+ components: {
2118
+ EleTree: __vue_component__$5,
2119
+ EleTable: __vue_component__$6,
2120
+ EleSearchArea: __vue_component__$3,
2121
+ EleButtonGroup: __vue_component__$2
2122
+ },
2123
+ props: {
2124
+ treeMeta: {
2125
+ type: Object,
2126
+ default: () => ({})
2127
+ },
2128
+ searchMeta: {
2129
+ type: Object,
2130
+ default: () => ({})
2131
+ },
2132
+ buttonGroupMeta: {
2133
+ typeof: Object,
2134
+ default: () => ({})
2135
+ },
2136
+ tableMeta: {
2137
+ type: Object,
2138
+ default: () => ({})
2139
+ }
2140
+ },
2141
+ provide() {
2142
+ return {
2143
+ requestTreeData: this.requestTreeData,
2144
+ requestTableData: this.requestTableData
2145
+ };
2146
+ },
2147
+ data() {
2148
+ return {
2149
+ treeData: [],
2150
+ tableData: [],
2151
+ defaultExpandedKeys: [],
2152
+ defaultSelectedKeys: [],
2153
+ replaceFields: {
2154
+ title: 'title',
2155
+ children: 'children',
2156
+ key: 'id'
2157
+ },
2158
+ loading: false,
2159
+ total: 0,
2160
+ tableQuerys: {},
2161
+ resizeObserverModelTableWrapper: null,
2162
+ modelTableWrapperHeight: 0,
2163
+ currentTreeNodeData: {}
2164
+ };
2165
+ },
2166
+ computed: {
2167
+ buttonGroup() {
2168
+ return v4();
2169
+ },
2170
+ searchArea() {
2171
+ return v4();
2172
+ },
2173
+ modelTreeWrapper() {
2174
+ return v4();
2175
+ },
2176
+ modelTableWrapper() {
2177
+ return v4();
2178
+ },
2179
+ actions() {
2180
+ const {
2181
+ operations
2182
+ } = this.tableMeta;
2183
+ return operations.elements;
2184
+ },
2185
+ pageSize() {
2186
+ const {
2187
+ page = {}
2188
+ } = this.tableMeta;
2189
+ return page.pageSize || 10;
2190
+ },
2191
+ pageSizeOptions() {
2192
+ const {
2193
+ page = {}
2194
+ } = this.tableMeta;
2195
+ return page.pageSizeOptions || ['10', '20', '30', '40'];
2196
+ },
2197
+ columns() {
2198
+ const {
2199
+ columns,
2200
+ operations
2201
+ } = this.tableMeta;
2202
+ if (type.get(columns) === 'array') {
2203
+ const columnsOptions = columns.map(item => {
2204
+ if (item.render) {
2205
+ return {
2206
+ title: item.title,
2207
+ dataIndex: item.dataIndex,
2208
+ width: item.width,
2209
+ align: item.align,
2210
+ fixed: item.fixed,
2211
+ customRender: (text, record, index) => {
2212
+ const {
2213
+ $createElement
2214
+ } = this;
2215
+ return item.render.call(this, {
2216
+ h: $createElement,
2217
+ ctx: this
2218
+ }, typeof text == 'string' ? text : text[item.dataIndex], record, index);
2219
+ }
2220
+ };
2221
+ }
2222
+ return {
2223
+ title: item.title,
2224
+ dataIndex: item.dataIndex,
2225
+ width: item.width,
2226
+ align: item.align,
2227
+ fixed: item.fixed
2228
+ };
2229
+ });
2230
+ if (operations) {
2231
+ return [...columnsOptions, {
2232
+ title: '操作',
2233
+ width: operations.width,
2234
+ key: 'action',
2235
+ fixed: 'right',
2236
+ scopedSlots: {
2237
+ customRender: 'action'
2238
+ }
2239
+ }];
2240
+ }
2241
+ return columnsOptions;
2242
+ } else {
2243
+ console.error('Error: columns is invalid, please check it');
2244
+ return [];
2245
+ }
2246
+ },
2247
+ getButtonGroupElements() {
2248
+ const {
2249
+ elements
2250
+ } = this.buttonGroupMeta;
2251
+ if (type.get(elements) === 'function') {
2252
+ return elements.call(this);
2253
+ } else if (type.get(elements) === 'array') {
2254
+ return elements;
2255
+ } else {
2256
+ return [];
2257
+ }
2258
+ }
2259
+ },
2260
+ async created() {
2261
+ this.treeData = await this.requestTreeData();
2262
+ const [defaultTreeNode = {}] = this.treeData;
2263
+ this.defaultExpandedKeys = [defaultTreeNode[this.replaceFields.key]];
2264
+ this.defaultSelectedKeys = [defaultTreeNode[this.replaceFields.key]];
2265
+ const {
2266
+ fieldMap
2267
+ } = this.tableMeta;
2268
+ this.currentTreeNodeData = defaultTreeNode;
2269
+ this.tableData = await this.requestTableData(this.execTableFieldMap(fieldMap, defaultTreeNode));
2270
+ },
2271
+ methods: {
2272
+ handleClickButtonGroup(props) {
2273
+ const {
2274
+ eventName
2275
+ } = props;
2276
+ this.$emit(eventName, {
2277
+ currentTreeNode: this.currentTreeNodeData
2278
+ });
2279
+ },
2280
+ watchViewPort() {
2281
+ const modelTableWrapper = this.$refs[this.modelTableWrapper];
2282
+ console.log(modelTableWrapper.getBoundingClientRect());
2283
+ const {
2284
+ top
2285
+ } = modelTableWrapper.getBoundingClientRect();
2286
+ this.$refs[this.modelTreeWrapper].style.height = `calc(100vh - ${top}px)`;
2287
+ },
2288
+ async onSearch(props) {
2289
+ this.tableQuerys = Object.assign(this.tableQuerys, props);
2290
+ this.tableData = await this.requestTableData();
2291
+ },
2292
+ execTableFieldMap(fieldMap = {}, props) {
2293
+ let ret = {};
2294
+ const keys = Object.keys(fieldMap);
2295
+ keys.forEach(key => {
2296
+ const field = fieldMap[key];
2297
+ ret[field] = props[key];
2298
+ });
2299
+ return ret;
2300
+ },
2301
+ async selectTreeNode(selectedKeys, e) {
2302
+ const {
2303
+ fieldMap
2304
+ } = this.tableMeta;
2305
+ this.currentTreeNodeData = e.node.$vnode.data.props.dataRef;
2306
+ const execFieldMapRet = this.execTableFieldMap(fieldMap, e.node.$vnode.data.props.dataRef);
2307
+ this.tableData = await this.requestTableData(execFieldMapRet);
2308
+ },
2309
+ async requestTreeData() {
2310
+ const {
2311
+ url,
2312
+ requestType
2313
+ } = this.treeMeta;
2314
+ const ret = await net.get(url).then(resp => {
2315
+ const {
2316
+ data
2317
+ } = resp || {};
2318
+ return data;
2319
+ });
2320
+ return ret;
2321
+ },
2322
+ async onChangePage(page, pageSize) {
2323
+ this.tableData = await this.requestTableData({
2324
+ currentPage: page,
2325
+ pageSize
2326
+ });
2327
+ },
2328
+ async requestTableData(props = {}) {
2329
+ const {
2330
+ url,
2331
+ requestType,
2332
+ page = {}
2333
+ } = this.tableMeta;
2334
+ const {
2335
+ pageSize = 10
2336
+ } = page;
2337
+ this.tableQuerys = Object.assign(this.tableQuerys, {
2338
+ currentPage: 1,
2339
+ pageSize
2340
+ }, props);
2341
+ const ret = await net.get(url, this.tableQuerys).then(resp => {
2342
+ const {
2343
+ data = [],
2344
+ count
2345
+ } = resp || {};
2346
+ this.total = count;
2347
+ return data.map(item => {
2348
+ return {
2349
+ key: v4(),
2350
+ ...item
2351
+ };
2352
+ });
2353
+ });
2354
+ return ret;
2355
+ },
2356
+ refreshTreeStatus(props = {}) {},
2357
+ refreshTableStatus(props = {}) {},
2358
+ getModelTableWrapperHeight() {},
2359
+ setModelTreeWrapperHeight(height) {
2360
+ this.$refs[this.modelTreeWrapper].style.height = height;
2361
+ },
2362
+ setModelTableWrapperHeight() {
2363
+ const {
2364
+ top
2365
+ } = this.$refs[this.modelTableWrapper].getBoundingClientRect();
2366
+ const height = `calc(100vh - ${top}px)`;
2367
+ this.$refs[this.modelTableWrapper].style.height = height;
2368
+ this.setModelTreeWrapperHeight(height);
2369
+ },
2370
+ getSearchAreaHeight() {
2371
+ return this.$refs[this.searchArea].$el.clientHeight;
2372
+ },
2373
+ getButtonGroupHeight() {
2374
+ return this.$refs[this.buttonGroup].$el.clientHeight;
2375
+ }
2376
+ },
2377
+ mounted() {
2378
+ //TODO
2379
+ // this.setModelTableWrapperHeight()
2380
+ // this.resizeObserverModelTableWrapper = new ResizeObserver(entries => {
2381
+ // for (let entry of entries) {
2382
+ // this.modelTableWrapperHeight = entry.contentRect.height
2383
+ // console.log('this.modelTableWrapperHeight:', this.modelTableWrapperHeight)
2384
+ // console.log('getSearchAreaHeight', this.getSearchAreaHeight())
2385
+ // console.log('getButtonGroupHeight', this.getButtonGroupHeight())
2386
+ // const tableHeight = this.modelTableWrapperHeight - this.getSearchAreaHeight() - this.getButtonGroupHeight()
2387
+ // console.log('tableHeight', tableHeight)
2388
+ // }
2389
+ // })
2390
+ // this.resizeObserverModelTableWrapper.observe(this.$refs[this.modelTableWrapper])
2391
+ }
2392
+ };
2393
+
2394
+ /* script */
2395
+ const __vue_script__$1 = script$1;
2396
+
2397
+ /* template */
2398
+ var __vue_render__$1 = function () {
2399
+ var _vm = this;
2400
+ var _h = _vm.$createElement;
2401
+ var _c = _vm._self._c || _h;
2402
+ return _c("section", { staticClass: "model__tree-table" }, [
2403
+ _c("section", { staticClass: "model__tree-table--container" }, [
2404
+ _c("div", { staticClass: "model__tree--title" }),
2405
+ _vm._v(" "),
2406
+ _c(
2407
+ "section",
2408
+ { ref: _vm.modelTreeWrapper, staticClass: "model__tree--wrapper" },
2409
+ [
2410
+ _c("ele-tree", {
2411
+ attrs: {
2412
+ "tree-data": _vm.treeData,
2413
+ defaultExpandedKeys: _vm.defaultExpandedKeys,
2414
+ defaultSelectedKeys: _vm.defaultSelectedKeys,
2415
+ "replace-fields": _vm.treeMeta.replaceFields || _vm.replaceFields,
2416
+ },
2417
+ on: { select: _vm.selectTreeNode },
2418
+ }),
2419
+ ],
2420
+ 1
2421
+ ),
2422
+ ]),
2423
+ _vm._v(" "),
2424
+ _c("section", { staticClass: "model__table--container" }, [
2425
+ _c("div", { staticClass: "model__table--title" }),
2426
+ _vm._v(" "),
2427
+ _c(
2428
+ "section",
2429
+ { ref: _vm.modelTableWrapper, staticClass: "model__table--wrapper" },
2430
+ [
2431
+ _c("ele-search-area", {
2432
+ ref: _vm.searchArea,
2433
+ attrs: { "data-source": _vm.searchMeta.elements },
2434
+ on: { search: _vm.onSearch },
2435
+ }),
2436
+ _vm._v(" "),
2437
+ _c(
2438
+ "ele-button-group",
2439
+ _vm._g(
2440
+ {
2441
+ ref: _vm.buttonGroup,
2442
+ staticStyle: { "margin-top": "16px" },
2443
+ attrs: { "data-source": _vm.getButtonGroupElements },
2444
+ on: { click: _vm.handleClickButtonGroup },
2445
+ },
2446
+ _vm.$listeners
2447
+ )
2448
+ ),
2449
+ _vm._v(" "),
2450
+ _c(
2451
+ "ele-table",
2452
+ _vm._g(
2453
+ {
2454
+ staticStyle: { "margin-top": "8px" },
2455
+ attrs: {
2456
+ loading: _vm.loading,
2457
+ columns: _vm.columns,
2458
+ total: _vm.total,
2459
+ actions: _vm.actions,
2460
+ pageSize: _vm.pageSize,
2461
+ pageSizeOptions: _vm.pageSizeOptions,
2462
+ "data-source": _vm.tableData,
2463
+ },
2464
+ on: { "change-page": _vm.onChangePage },
2465
+ },
2466
+ _vm.$listeners
2467
+ )
2468
+ ),
2469
+ ],
2470
+ 1
2471
+ ),
2472
+ ]),
2473
+ ])
2474
+ };
2475
+ var __vue_staticRenderFns__$1 = [];
2476
+ __vue_render__$1._withStripped = true;
2477
+
2478
+ /* style */
2479
+ const __vue_inject_styles__$1 = function (inject) {
2480
+ if (!inject) return
2481
+ 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 });
2482
+
2483
+ };
2484
+ /* scoped */
2485
+ const __vue_scope_id__$1 = "data-v-37846a00";
2486
+ /* module identifier */
2487
+ const __vue_module_identifier__$1 = undefined;
2488
+ /* functional template */
2489
+ const __vue_is_functional_template__$1 = false;
2490
+ /* style inject SSR */
2491
+
2492
+ /* style inject shadow dom */
2493
+
2494
+
2495
+
2496
+ const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
2497
+ { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
2498
+ __vue_inject_styles__$1,
2499
+ __vue_script__$1,
2500
+ __vue_scope_id__$1,
2501
+ __vue_is_functional_template__$1,
2502
+ __vue_module_identifier__$1,
2503
+ false,
2504
+ createInjector,
2505
+ undefined,
2506
+ undefined
2507
+ );
2508
+
2509
+ //
2510
+ var script = {
2511
+ name: 'ele-tpl',
2512
+ props: {
2513
+ modelName: {
2514
+ type: String
2515
+ }
2516
+ },
2517
+ components: {
2518
+ [__vue_component__$1.name]: __vue_component__$1
2519
+ },
2520
+ computed: {
2521
+ modelNameValidator() {
2522
+ const target = models.find(model => model.name === this.modelName);
2523
+ return {
2524
+ existed: !!target,
2525
+ message: !!target ? '' : `Model <span style="color:red;">${this.modelName}</span> not found`
2526
+ };
2527
+ },
2528
+ genModelRef() {
2529
+ return v4();
2530
+ }
2531
+ },
2532
+ methods: {
2533
+ getModel() {
2534
+ return this.$refs[this.genModelRef];
2535
+ }
2536
+ }
2537
+ };
2538
+
2539
+ /* script */
2540
+ const __vue_script__ = script;
2541
+
2542
+ /* template */
2543
+ var __vue_render__ = function () {
2544
+ var _vm = this;
2545
+ var _h = _vm.$createElement;
2546
+ var _c = _vm._self._c || _h;
2547
+ return _vm.modelNameValidator.existed
2548
+ ? _c(
2549
+ _vm.modelName,
2550
+ _vm._g(
2551
+ _vm._b(
2552
+ {
2553
+ ref: _vm.genModelRef,
2554
+ tag: "component",
2555
+ scopedSlots: _vm._u(
2556
+ [
2557
+ _vm._l(_vm.$scopedSlots, function (idx, name) {
2558
+ return {
2559
+ key: name,
2560
+ fn: function (data) {
2561
+ return [_vm._t(name, null, null, data)]
2562
+ },
2563
+ }
2564
+ }),
2565
+ ],
2566
+ null,
2567
+ true
2568
+ ),
2569
+ },
2570
+ "component",
2571
+ _vm.$attrs,
2572
+ false
2573
+ ),
2574
+ _vm.$listeners
2575
+ )
2576
+ )
2577
+ : _c("div", {
2578
+ domProps: { innerHTML: _vm._s(_vm.modelNameValidator.message) },
2579
+ })
2580
+ };
2581
+ var __vue_staticRenderFns__ = [];
2582
+ __vue_render__._withStripped = true;
2583
+
2584
+ /* style */
2585
+ const __vue_inject_styles__ = function (inject) {
2586
+ if (!inject) return
2587
+ 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 });
2588
+
2589
+ };
2590
+ /* scoped */
2591
+ const __vue_scope_id__ = undefined;
2592
+ /* module identifier */
2593
+ const __vue_module_identifier__ = undefined;
2594
+ /* functional template */
2595
+ const __vue_is_functional_template__ = false;
2596
+ /* style inject SSR */
2597
+
2598
+ /* style inject shadow dom */
2599
+
2600
+
2601
+
2602
+ const __vue_component__ = /*#__PURE__*/normalizeComponent(
2603
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
2604
+ __vue_inject_styles__,
2605
+ __vue_script__,
2606
+ __vue_scope_id__,
2607
+ __vue_is_functional_template__,
2608
+ __vue_module_identifier__,
2609
+ false,
2610
+ createInjector,
2611
+ undefined,
2612
+ undefined
2613
+ );
2614
+
2615
+ __vue_component__.install = Vue => Vue.component(__vue_component__.name, __vue_component__);
2616
+
2617
+ __vue_component__$2.install = Vue => Vue.component(__vue_component__$2.name, __vue_component__$2);
2618
+
2619
+ __vue_component__$3.install = Vue => Vue.component(__vue_component__$3.name, __vue_component__$3);
2620
+
2621
+ __vue_component__$1.install = Vue => Vue.component(__vue_component__$1.name, __vue_component__$1);
2622
+
2623
+ const compositeComponents = [__vue_component__$2, __vue_component__$3];
2624
+ const models = [__vue_component__$1];
2625
+ const components = [__vue_component__$b, __vue_component__$a, __vue_component__$9, __vue_component__$8, __vue_component__$6, __vue_component__$5, __vue_component__, ...compositeComponents, ...models];
2626
+ const install = Vue => {
2627
+ if (install.installed) return;
2628
+ install.installed = true;
2629
+ components.forEach(component => {
2630
+ Vue.component(component.name, component);
2631
+ });
2632
+ };
2633
+
2634
+ export { __vue_component__$b as EleButton, __vue_component__$a as EleDate, __vue_component__$9 as EleInput, __vue_component__$8 as EleSelect, __vue_component__$6 as EleTable, __vue_component__ as EleTpl, __vue_component__$5 as EleTree, install as default, models };