@jetlinks-web/components 2.6.29 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
42
  "onDesc": "setup-const"
43
43
  } */
44
44
  import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
45
- const _withScopeId = n => (_pushScopeId("data-v-1755154724514"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1755250733005"), n = n(), _popScopeId(), n);
46
46
  const _hoisted_1 = { class: "jetlinks-table-sort-content" };
47
47
  const _hoisted_2 = { class: "jetlinks-table-sort-title" };
48
48
  const _hoisted_3 = { class: "table-sort-body" };
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1755154722160"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1755250731518"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -23,7 +23,7 @@
23
23
  } */
24
24
  import { defineComponent as _defineComponent } from 'vue';
25
25
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
26
- const _withScopeId = n => (_pushScopeId("data-v-1755154724391"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1755250732879"), n = n(), _popScopeId(), n);
27
27
  const _hoisted_1 = {
28
28
  key: 0,
29
29
  style: { "width": "240px" }
package/es/Search/Item.js CHANGED
@@ -80,7 +80,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
80
80
  } */
81
81
  import { defineComponent as _defineComponent } from 'vue';
82
82
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
83
- const _withScopeId = n => (_pushScopeId("data-v-1755154723815"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1755250732041"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
package/es/components.js CHANGED
@@ -20,5 +20,4 @@ export { default as DragModal } from './DragModal';
20
20
  export { default as EditTable } from './EditTable';
21
21
  export { default as Markdown } from './Markdown';
22
22
  export { default as AutoComplete } from './AutoComplete';
23
- export { default as Title } from './Title';
24
- export { default as FlameGraph } from './FlameGraph';
23
+ export { default as Title } from './Title';
@@ -5195,46 +5195,3 @@ span.ant-radio + * {
5195
5195
  color: #fff;
5196
5196
  background-color: #1890ff;
5197
5197
  }
5198
- .j-flame-graph {
5199
- position: relative;
5200
- width: 100%;
5201
- height: 100%;
5202
- overflow: auto;
5203
- /* 修改矩形块样式 */
5204
- }
5205
- .j-flame-graph .actions {
5206
- position: sticky;
5207
- top: 0;
5208
- left: 0;
5209
- padding: 10px;
5210
- background: #fff;
5211
- }
5212
- .j-flame-graph .d3-flame-graph {
5213
- margin-top: 40px;
5214
- }
5215
- .j-flame-graph .d3-flame-graph rect {
5216
- stroke: #fff;
5217
- stroke-width: 1px;
5218
- }
5219
- .j-flame-graph .d3-flame-graph text {
5220
- font-size: 18px;
5221
- fill: #333;
5222
- }
5223
- .j-flame-graph .frame {
5224
- cursor: pointer;
5225
- }
5226
- .j-flame-graph .frame:hover {
5227
- fill: #E600E6;
5228
- }
5229
- .j-flame-graph .frame:hover rect {
5230
- fill: #ffffe0;
5231
- }
5232
- .j-flame-graph .frame div {
5233
- color: #000;
5234
- }
5235
- .j-flame-graph .j-flame-graph-search {
5236
- position: sticky;
5237
- top: 0;
5238
- left: 0;
5239
- width: 200px;
5240
- }
@@ -11,4 +11,3 @@
11
11
  @import '../Scrollbar/style/index.less';
12
12
  @import '../Title/style/index.less';
13
13
  @import '../RadioButton/style/index.less';
14
- @import '../FlameGraph/style/index.less';
package/es/style.js CHANGED
@@ -9,5 +9,4 @@ import './EditTable/style';
9
9
  import './MonacoEditor/style';
10
10
  import './Scrollbar/style';
11
11
  import './Title/style';
12
- import './RadioButton/style';
13
- import './FlameGraph/style';
12
+ import './RadioButton/style';
@@ -42,7 +42,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
42
  "onDesc": "setup-const"
43
43
  } */
44
44
  import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
45
- const _withScopeId = n => (_pushScopeId("data-v-1755154724497"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1755250733021"), n = n(), _popScopeId(), n);
46
46
  const _hoisted_1 = { class: "jetlinks-table-sort-content" };
47
47
  const _hoisted_2 = { class: "jetlinks-table-sort-title" };
48
48
  const _hoisted_3 = { class: "table-sort-body" };
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1755154721895"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1755250731524"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -23,7 +23,7 @@
23
23
  } */
24
24
  import { defineComponent as _defineComponent } from 'vue';
25
25
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
26
- const _withScopeId = n => (_pushScopeId("data-v-1755154724378"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1755250732890"), n = n(), _popScopeId(), n);
27
27
  const _hoisted_1 = {
28
28
  key: 0,
29
29
  style: { "width": "240px" }
@@ -80,7 +80,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
80
80
  } */
81
81
  import { defineComponent as _defineComponent } from 'vue';
82
82
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
83
- const _withScopeId = n => (_pushScopeId("data-v-1755154723758"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1755250732094"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
package/lib/components.js CHANGED
@@ -77,12 +77,6 @@ Object.defineProperty(exports, "Empty", {
77
77
  return _Empty.default;
78
78
  }
79
79
  });
80
- Object.defineProperty(exports, "FlameGraph", {
81
- enumerable: true,
82
- get: function get() {
83
- return _FlameGraph.default;
84
- }
85
- });
86
80
  Object.defineProperty(exports, "FullPage", {
87
81
  enumerable: true,
88
82
  get: function get() {
@@ -184,6 +178,5 @@ var _EditTable = _interopRequireDefault(require("./EditTable"));
184
178
  var _Markdown = _interopRequireDefault(require("./Markdown"));
185
179
  var _AutoComplete = _interopRequireDefault(require("./AutoComplete"));
186
180
  var _Title = _interopRequireDefault(require("./Title"));
187
- var _FlameGraph = _interopRequireDefault(require("./FlameGraph"));
188
181
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
189
182
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -3,7 +3,6 @@
3
3
  @import "../DragModal/style/index-pure.less";
4
4
  @import "../EditTable/style/index-pure.less";
5
5
  @import "../Ellipsis/style/index-pure.less";
6
- @import "../FlameGraph/style/index-pure.less";
7
6
  @import "../MonacoEditor/style/index-pure.less";
8
7
  @import "../RadioButton/style/index-pure.less";
9
8
  @import "../Scrollbar/style/index-pure.less";
@@ -5195,46 +5195,3 @@ span.ant-radio + * {
5195
5195
  color: #fff;
5196
5196
  background-color: #1890ff;
5197
5197
  }
5198
- .j-flame-graph {
5199
- position: relative;
5200
- width: 100%;
5201
- height: 100%;
5202
- overflow: auto;
5203
- /* 修改矩形块样式 */
5204
- }
5205
- .j-flame-graph .actions {
5206
- position: sticky;
5207
- top: 0;
5208
- left: 0;
5209
- padding: 10px;
5210
- background: #fff;
5211
- }
5212
- .j-flame-graph .d3-flame-graph {
5213
- margin-top: 40px;
5214
- }
5215
- .j-flame-graph .d3-flame-graph rect {
5216
- stroke: #fff;
5217
- stroke-width: 1px;
5218
- }
5219
- .j-flame-graph .d3-flame-graph text {
5220
- font-size: 18px;
5221
- fill: #333;
5222
- }
5223
- .j-flame-graph .frame {
5224
- cursor: pointer;
5225
- }
5226
- .j-flame-graph .frame:hover {
5227
- fill: #E600E6;
5228
- }
5229
- .j-flame-graph .frame:hover rect {
5230
- fill: #ffffe0;
5231
- }
5232
- .j-flame-graph .frame div {
5233
- color: #000;
5234
- }
5235
- .j-flame-graph .j-flame-graph-search {
5236
- position: sticky;
5237
- top: 0;
5238
- left: 0;
5239
- width: 200px;
5240
- }
@@ -11,4 +11,3 @@
11
11
  @import '../Scrollbar/style/index.less';
12
12
  @import '../Title/style/index.less';
13
13
  @import '../RadioButton/style/index.less';
14
- @import '../FlameGraph/style/index.less';
package/lib/style.js CHANGED
@@ -11,5 +11,4 @@ require("./EditTable/style");
11
11
  require("./MonacoEditor/style");
12
12
  require("./Scrollbar/style");
13
13
  require("./Title/style");
14
- require("./RadioButton/style");
15
- require("./FlameGraph/style");
14
+ require("./RadioButton/style");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.6.29",
3
+ "version": "2.7.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,8 +25,6 @@
25
25
  "@vueuse/core": "^10.2.1",
26
26
  "@vueuse/router": "^12.1.0",
27
27
  "async-validator": "^4.2.5",
28
- "d3": "^7.9.0",
29
- "d3-flame-graph": "^4.1.3",
30
28
  "echarts": "^5.4.3",
31
29
  "markdown-it": "^14.1.0",
32
30
  "markdown-it-abbr": "^2.0.0",
@@ -44,9 +42,9 @@
44
42
  "monaco-editor": "^0.51.0",
45
43
  "resize-observer-polyfill": "^1.5.1",
46
44
  "sortablejs": "^1.15.2",
47
- "@jetlinks-web/utils": "1.2.14",
48
45
  "@jetlinks-web/constants": "1.0.9",
49
- "@jetlinks-web/hooks": "1.0.31"
46
+ "@jetlinks-web/hooks": "1.0.31",
47
+ "@jetlinks-web/utils": "1.2.14"
50
48
  },
51
49
  "devDependencies": {
52
50
  "@babel/cli": "^7.8.4",
@@ -1,136 +0,0 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
- const op = ops[i];
3
- const fn = ops[i + 1];
4
- i += 2;
5
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
- return undefined;
7
- }
8
- if (op === 'access' || op === 'optionalAccess') {
9
- lastAccessLHS = value;
10
- value = fn(value);
11
- }
12
- else if (op === 'call' || op === 'optionalCall') {
13
- value = fn((...args) => value.call(lastAccessLHS, ...args));
14
- lastAccessLHS = undefined;
15
- }
16
- } return value; }
17
- /* Analyzed bindings: {
18
- "data": "props",
19
- "showSearch": "props",
20
- "showInvert": "props",
21
- "request": "props",
22
- "flamegraph": "setup-maybe-ref",
23
- "d3": "setup-const",
24
- "nextTick": "setup-const",
25
- "watch": "setup-const",
26
- "ref": "setup-const",
27
- "computed": "setup-const",
28
- "props": "setup-reactive-const",
29
- "flameGraphRef": "setup-ref",
30
- "inverted": "setup-ref",
31
- "chart": "setup-maybe-ref",
32
- "search": "setup-const",
33
- "formatData": "setup-ref",
34
- "invert": "setup-const"
35
- } */
36
- import { resolveComponent as _resolveComponent, createVNode as _createVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
37
- const _hoisted_1 = { class: "j-flame-graph" };
38
- const _hoisted_2 = { class: "actions" };
39
- import { flamegraph } from 'd3-flame-graph';
40
- import * as d3 from 'd3';
41
- import { nextTick, watch, ref, computed } from 'vue';
42
- const __sfc_main__ = Object.assign({
43
- name: 'JFlameGraph',
44
- }, {
45
- props: {
46
- data: {
47
- type: Object,
48
- },
49
- showSearch: {
50
- type: Boolean,
51
- default: true
52
- },
53
- showInvert: {
54
- type: Boolean,
55
- default: true
56
- },
57
- request: {
58
- type: Function,
59
- }
60
- },
61
- setup(__props) {
62
- const props = __props;
63
- const flameGraphRef = ref(null);
64
- const inverted = ref(false);
65
- const chart = flamegraph()
66
- .setColorMapper(function (d, originalColor) {
67
- return d.highlight ? "#E600E6" : originalColor;
68
- });
69
- const search = (val) => {
70
- chart.search(val);
71
- };
72
- const formatData = computed(() => {
73
- return (val) => {
74
- function formatDataFn(newVal) {
75
- _optionalChain([newVal, 'access', _2 => _2.children, 'optionalAccess', _3 => _3.forEach, 'call', _4 => _4(item => {
76
- formatDataFn(item);
77
- })]);
78
- }
79
- //格式化数据,增加根节点root
80
- const obj = {
81
- name: 'root',
82
- value: val.map(item => item.value).reduce((a, b) => a + b, 0),
83
- children: val
84
- };
85
- formatDataFn(obj);
86
- return obj;
87
- };
88
- });
89
- const invert = () => {
90
- inverted.value = !inverted.value;
91
- chart.inverted(inverted.value);
92
- d3.select(flameGraphRef.value)
93
- .datum(formatData.value(props.data))
94
- .call(chart);
95
- };
96
- watch(() => props.data, (newVal, oldVal) => {
97
- if (newVal) {
98
- nextTick(() => {
99
- d3.select(flameGraphRef.value)
100
- .datum(formatData.value(newVal))
101
- .call(chart);
102
- });
103
- }
104
- }, { immediate: true });
105
- return (_ctx, _cache) => {
106
- const _component_a_input_search = _resolveComponent("a-input-search");
107
- const _component_a_button = _resolveComponent("a-button");
108
- const _component_a_space = _resolveComponent("a-space");
109
- return (_openBlock(), _createElementBlock("div", _hoisted_1, [
110
- _createElementVNode("div", _hoisted_2, [
111
- _createVNode(_component_a_space, null, {
112
- default: _withCtx(() => [
113
- _createVNode(_component_a_input_search, {
114
- class: "j-flame-graph-search",
115
- placeholder: "请输入",
116
- onSearch: search
117
- }),
118
- _createVNode(_component_a_button, { onClick: invert }, {
119
- default: _withCtx(() => [
120
- _createTextVNode("反转")
121
- ]),
122
- _: 1 /* STABLE */
123
- })
124
- ]),
125
- _: 1 /* STABLE */
126
- })
127
- ]),
128
- _createElementVNode("div", {
129
- ref_key: "flameGraphRef",
130
- ref: flameGraphRef
131
- }, null, 512 /* NEED_PATCH */)
132
- ]));
133
- };
134
- }
135
- });
136
- export default __sfc_main__;
@@ -1,5 +0,0 @@
1
- import FlameGraph from './FlameGraph.js';
2
- FlameGraph.install = function (app) {
3
- app.component(FlameGraph.name, FlameGraph);
4
- };
5
- export default FlameGraph;
@@ -1,43 +0,0 @@
1
- .j-flame-graph {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- overflow: auto;
6
- /* 修改矩形块样式 */
7
- }
8
- .j-flame-graph .actions {
9
- position: sticky;
10
- top: 0;
11
- left: 0;
12
- padding: 10px;
13
- background: #fff;
14
- }
15
- .j-flame-graph .d3-flame-graph {
16
- margin-top: 40px;
17
- }
18
- .j-flame-graph .d3-flame-graph rect {
19
- stroke: #fff;
20
- stroke-width: 1px;
21
- }
22
- .j-flame-graph .d3-flame-graph text {
23
- font-size: 18px;
24
- fill: #333;
25
- }
26
- .j-flame-graph .frame {
27
- cursor: pointer;
28
- }
29
- .j-flame-graph .frame:hover {
30
- fill: #E600E6;
31
- }
32
- .j-flame-graph .frame:hover rect {
33
- fill: #ffffe0;
34
- }
35
- .j-flame-graph .frame div {
36
- color: #000;
37
- }
38
- .j-flame-graph .j-flame-graph-search {
39
- position: sticky;
40
- top: 0;
41
- left: 0;
42
- width: 200px;
43
- }
@@ -1 +0,0 @@
1
- import './index.less';
@@ -1,52 +0,0 @@
1
- .j-flame-graph {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- overflow: auto;
6
- .actions {
7
- position: sticky;
8
- top: 0;
9
- left: 0;
10
- padding: 10px;
11
- background: #fff;
12
- }
13
- .d3-flame-graph {
14
- margin-top: 40px;
15
- }
16
- /* 修改矩形块样式 */
17
- .d3-flame-graph {
18
- rect {
19
- stroke: #fff;
20
- stroke-width: 1px;
21
- }
22
-
23
- text {
24
- font-size: 18px;
25
- fill: #333;
26
- }
27
- }
28
-
29
- .frame {
30
- cursor: pointer;
31
- }
32
- .frame:hover {
33
- fill: #E600E6;
34
- }
35
- .frame:hover rect {
36
- fill: #ffffe0;
37
- }
38
- .frame div {
39
- color: #000
40
- }
41
-
42
- .j-flame-graph-search {
43
- position: sticky;
44
- top: 0;
45
- left: 0;
46
- width: 200px;
47
- }
48
- }
49
-
50
-
51
-
52
-
@@ -1,136 +0,0 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
- const op = ops[i];
3
- const fn = ops[i + 1];
4
- i += 2;
5
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
- return undefined;
7
- }
8
- if (op === 'access' || op === 'optionalAccess') {
9
- lastAccessLHS = value;
10
- value = fn(value);
11
- }
12
- else if (op === 'call' || op === 'optionalCall') {
13
- value = fn((...args) => value.call(lastAccessLHS, ...args));
14
- lastAccessLHS = undefined;
15
- }
16
- } return value; }
17
- /* Analyzed bindings: {
18
- "data": "props",
19
- "showSearch": "props",
20
- "showInvert": "props",
21
- "request": "props",
22
- "flamegraph": "setup-maybe-ref",
23
- "d3": "setup-const",
24
- "nextTick": "setup-const",
25
- "watch": "setup-const",
26
- "ref": "setup-const",
27
- "computed": "setup-const",
28
- "props": "setup-reactive-const",
29
- "flameGraphRef": "setup-ref",
30
- "inverted": "setup-ref",
31
- "chart": "setup-maybe-ref",
32
- "search": "setup-const",
33
- "formatData": "setup-ref",
34
- "invert": "setup-const"
35
- } */
36
- import { resolveComponent as _resolveComponent, createVNode as _createVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
37
- const _hoisted_1 = { class: "j-flame-graph" };
38
- const _hoisted_2 = { class: "actions" };
39
- import { flamegraph } from 'd3-flame-graph';
40
- import * as d3 from 'd3';
41
- import { nextTick, watch, ref, computed } from 'vue';
42
- const __sfc_main__ = Object.assign({
43
- name: 'JFlameGraph',
44
- }, {
45
- props: {
46
- data: {
47
- type: Object,
48
- },
49
- showSearch: {
50
- type: Boolean,
51
- default: true
52
- },
53
- showInvert: {
54
- type: Boolean,
55
- default: true
56
- },
57
- request: {
58
- type: Function,
59
- }
60
- },
61
- setup(__props) {
62
- const props = __props;
63
- const flameGraphRef = ref(null);
64
- const inverted = ref(false);
65
- const chart = flamegraph()
66
- .setColorMapper(function (d, originalColor) {
67
- return d.highlight ? "#E600E6" : originalColor;
68
- });
69
- const search = (val) => {
70
- chart.search(val);
71
- };
72
- const formatData = computed(() => {
73
- return (val) => {
74
- function formatDataFn(newVal) {
75
- _optionalChain([newVal, 'access', _2 => _2.children, 'optionalAccess', _3 => _3.forEach, 'call', _4 => _4(item => {
76
- formatDataFn(item);
77
- })]);
78
- }
79
- //格式化数据,增加根节点root
80
- const obj = {
81
- name: 'root',
82
- value: val.map(item => item.value).reduce((a, b) => a + b, 0),
83
- children: val
84
- };
85
- formatDataFn(obj);
86
- return obj;
87
- };
88
- });
89
- const invert = () => {
90
- inverted.value = !inverted.value;
91
- chart.inverted(inverted.value);
92
- d3.select(flameGraphRef.value)
93
- .datum(formatData.value(props.data))
94
- .call(chart);
95
- };
96
- watch(() => props.data, (newVal, oldVal) => {
97
- if (newVal) {
98
- nextTick(() => {
99
- d3.select(flameGraphRef.value)
100
- .datum(formatData.value(newVal))
101
- .call(chart);
102
- });
103
- }
104
- }, { immediate: true });
105
- return (_ctx, _cache) => {
106
- const _component_a_input_search = _resolveComponent("a-input-search");
107
- const _component_a_button = _resolveComponent("a-button");
108
- const _component_a_space = _resolveComponent("a-space");
109
- return (_openBlock(), _createElementBlock("div", _hoisted_1, [
110
- _createElementVNode("div", _hoisted_2, [
111
- _createVNode(_component_a_space, null, {
112
- default: _withCtx(() => [
113
- _createVNode(_component_a_input_search, {
114
- class: "j-flame-graph-search",
115
- placeholder: "请输入",
116
- onSearch: search
117
- }),
118
- _createVNode(_component_a_button, { onClick: invert }, {
119
- default: _withCtx(() => [
120
- _createTextVNode("反转")
121
- ]),
122
- _: 1 /* STABLE */
123
- })
124
- ]),
125
- _: 1 /* STABLE */
126
- })
127
- ]),
128
- _createElementVNode("div", {
129
- ref_key: "flameGraphRef",
130
- ref: flameGraphRef
131
- }, null, 512 /* NEED_PATCH */)
132
- ]));
133
- };
134
- }
135
- });
136
- export default __sfc_main__;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _FlameGraph = _interopRequireDefault(require("./FlameGraph.js"));
9
- _FlameGraph.default.install = function (app) {
10
- app.component(_FlameGraph.default.name, _FlameGraph.default);
11
- };
12
- var _default = exports.default = _FlameGraph.default;
@@ -1,43 +0,0 @@
1
- .j-flame-graph {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- overflow: auto;
6
- /* 修改矩形块样式 */
7
- }
8
- .j-flame-graph .actions {
9
- position: sticky;
10
- top: 0;
11
- left: 0;
12
- padding: 10px;
13
- background: #fff;
14
- }
15
- .j-flame-graph .d3-flame-graph {
16
- margin-top: 40px;
17
- }
18
- .j-flame-graph .d3-flame-graph rect {
19
- stroke: #fff;
20
- stroke-width: 1px;
21
- }
22
- .j-flame-graph .d3-flame-graph text {
23
- font-size: 18px;
24
- fill: #333;
25
- }
26
- .j-flame-graph .frame {
27
- cursor: pointer;
28
- }
29
- .j-flame-graph .frame:hover {
30
- fill: #E600E6;
31
- }
32
- .j-flame-graph .frame:hover rect {
33
- fill: #ffffe0;
34
- }
35
- .j-flame-graph .frame div {
36
- color: #000;
37
- }
38
- .j-flame-graph .j-flame-graph-search {
39
- position: sticky;
40
- top: 0;
41
- left: 0;
42
- width: 200px;
43
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
-
3
- require("./index.less");
@@ -1,52 +0,0 @@
1
- .j-flame-graph {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- overflow: auto;
6
- .actions {
7
- position: sticky;
8
- top: 0;
9
- left: 0;
10
- padding: 10px;
11
- background: #fff;
12
- }
13
- .d3-flame-graph {
14
- margin-top: 40px;
15
- }
16
- /* 修改矩形块样式 */
17
- .d3-flame-graph {
18
- rect {
19
- stroke: #fff;
20
- stroke-width: 1px;
21
- }
22
-
23
- text {
24
- font-size: 18px;
25
- fill: #333;
26
- }
27
- }
28
-
29
- .frame {
30
- cursor: pointer;
31
- }
32
- .frame:hover {
33
- fill: #E600E6;
34
- }
35
- .frame:hover rect {
36
- fill: #ffffe0;
37
- }
38
- .frame div {
39
- color: #000
40
- }
41
-
42
- .j-flame-graph-search {
43
- position: sticky;
44
- top: 0;
45
- left: 0;
46
- width: 200px;
47
- }
48
- }
49
-
50
-
51
-
52
-