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