w-flow-vue 1.0.20 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,278 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>components/ui/Controls.vue - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-WFlowVue.html">WFlowVue</a></li></ul><h3>Global</h3><ul><li><a href="global.html#NODE_DEFAULTS">NODE_DEFAULTS</a></li><li><a href="global.html#buildRoundedPath">buildRoundedPath</a></li><li><a href="global.html#clampPosition">clampPosition</a></li><li><a href="global.html#fixSvgNs">fixSvgNs</a></li><li><a href="global.html#generateId">generateId</a></li><li><a href="global.html#getBezierPath">getBezierPath</a></li><li><a href="global.html#getControlOffset">getControlOffset</a></li><li><a href="global.html#getDiamondEdgePoint">getDiamondEdgePoint</a></li><li><a href="global.html#getEllipseEdgePoint">getEllipseEdgePoint</a></li><li><a href="global.html#getHandlePosition">getHandlePosition</a></li><li><a href="global.html#getOverlappingNodes">getOverlappingNodes</a></li><li><a href="global.html#getSmoothStepPath">getSmoothStepPath</a></li><li><a href="global.html#getStepPath">getStepPath</a></li><li><a href="global.html#getStraightPath">getStraightPath</a></li><li><a href="global.html#getTriangleEdgePoint">getTriangleEdgePoint</a></li><li><a href="global.html#isValidConnection">isValidConnection</a></li><li><a href="global.html#labelAtHalfLength">labelAtHalfLength</a></li><li><a href="global.html#lookupRoute">lookupRoute</a></li><li><a href="global.html#normalizeConnPoints">normalizeConnPoints</a></li><li><a href="global.html#orthogonalizeThroughPoints">orthogonalizeThroughPoints</a></li><li><a href="global.html#pickMenuValue">pickMenuValue</a></li><li><a href="global.html#rectsOverlap">rectsOverlap</a></li><li><a href="global.html#segmentFallback">segmentFallback</a></li><li><a href="global.html#snapPosition">snapPosition</a></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">components/ui/Controls.vue</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>&lt;template>
49
+ &lt;!-- 垂直選單: 改用w-threejs-vue同款組件WGroupIconCheck(:dir='vertical'), 最頂為設定鈕, 收合時僅顯示設定鈕, 展開才顯示其餘按鈕 -->
50
+ &lt;div
51
+ v-if="cfg.useMenu"
52
+ :class="['vue-flow__panel', `vue-flow__panel--${cfg.menuPosition}`]"
53
+ :style="panelStyle"
54
+ >
55
+ &lt;!-- 淺色系配色(w-flow-vue圖台為白底, 沿用原Controls之#fefefe白底/深灰icon風格; iconSize預設22, 按鈕寬=22+左右padding8=30px與w-threejs-vue選單一致) -->
56
+ &lt;!-- 全數為一般動作鈕(不用active態): 鎖頭點擊即切換上鎖/解鎖並換icon(比照fitView等), 不留固定灰底; value恆空故無任一鈕呈active, 故不開放*ColorActive類選項 -->
57
+ &lt;WGroupIconCheck
58
+ :items="useItems"
59
+ :dir="'vertical'"
60
+ :iconColor="cfg.menuIconColor"
61
+ :iconColorHover="cfg.menuIconColorHover"
62
+ :iconColorFocus="cfg.menuIconColorFocus"
63
+ :iconSize="cfg.menuIconSize"
64
+ :backgroundColor="cfg.menuBackgroundColor"
65
+ :backgroundColorHover="cfg.menuBackgroundColorHover"
66
+ :backgroundColorFocus="cfg.menuBackgroundColorFocus"
67
+ :seplineColor="cfg.menuSeparatorColor"
68
+ :shadow="cfg.menuShadow"
69
+ :tooltipTextColor="cfg.menuTooltipTextColor"
70
+ :tooltipTextFontSize="cfg.menuTooltipTextFontSize"
71
+ :tooltipBackgroundColor="cfg.menuTooltipBackgroundColor"
72
+ :value="[]"
73
+ @click="onClickItem"
74
+ >&lt;/WGroupIconCheck>
75
+ &lt;/div>
76
+ &lt;/template>
77
+
78
+ &lt;script>
79
+ import WGroupIconCheck from 'w-component-vue/src/components/WGroupIconCheck.vue'
80
+ import { mdiCogOutline, mdiMagnifyPlusOutline, mdiMagnifyMinusOutline, mdiFitToPageOutline, mdiLockOutline, mdiLockOpenVariantOutline } from '@mdi/js/mdi.js'
81
+
82
+ //menuDef, 選單各項之預設值, 未被opt覆寫者沿用之
83
+ //注意: menuIconSize, menuTooltipTextColor, menuTooltipBackgroundColor原為WGroupIconCheck之預設值,
84
+ //因w-component-vue為浮動相依(^2.5.2), 子套件改預設會靜默改變本套件外觀, 故於此明寫鎖住現值
85
+ let menuDef = {
86
+
87
+ //整體
88
+ useMenu: true,
89
+ menuPosition: 'top-left',
90
+ menuYShift: 0,
91
+ useSetting: true,
92
+
93
+ //設定鈕(收合/展開)
94
+ menuSettingIcon: mdiCogOutline,
95
+ menuSettingTooltip: 'Settings',
96
+
97
+ //放大
98
+ useMenuItemZoomIn: true,
99
+ menuZoomInIcon: mdiMagnifyPlusOutline,
100
+ menuZoomInTooltip: 'Zoom In',
101
+
102
+ //縮小
103
+ useMenuItemZoomOut: true,
104
+ menuZoomOutIcon: mdiMagnifyMinusOutline,
105
+ menuZoomOutTooltip: 'Zoom Out',
106
+
107
+ //全圖
108
+ useMenuItemFitView: true,
109
+ menuFitViewIcon: mdiFitToPageOutline,
110
+ menuFitViewTooltip: 'Fit View',
111
+
112
+ //鎖定(雙態: 無後綴為未鎖態, Locked後綴為已鎖態)
113
+ useMenuItemLock: true,
114
+ menuLockIcon: mdiLockOpenVariantOutline,
115
+ menuLockTooltip: 'Lock',
116
+ menuLockIconLocked: mdiLockOutline,
117
+ menuLockTooltipLocked: 'Unlock',
118
+
119
+ //樣式
120
+ menuIconColor: '#555',
121
+ menuIconColorHover: '#222',
122
+ menuIconColorFocus: '#222',
123
+ menuIconSize: 22,
124
+ menuBackgroundColor: '#fefefe',
125
+ menuBackgroundColorHover: '#f0f0f0',
126
+ menuBackgroundColorFocus: '#f0f0f0',
127
+ menuSeparatorColor: '#e6e6e6',
128
+ menuShadow: true,
129
+ menuTooltipTextColor: 'white',
130
+ menuTooltipTextFontSize: '0.7rem',
131
+ menuTooltipBackgroundColor: 'rgba(60,60,60,0.75)',
132
+
133
+ }
134
+
135
+ //menuPositions, menuPosition之允許值, 不在其中者回退預設
136
+ let menuPositions = ['top-left', 'top-right', 'bottom-left', 'bottom-right']
137
+
138
+ /**
139
+ * 取單項設定值, 型別與menuDef同型且有效才採用, 否則回退menuDef
140
+ */
141
+ function pickMenuValue(k, v) {
142
+ let d = menuDef[k]
143
+ if (typeof d === 'string') {
144
+ return (typeof v === 'string' &amp;&amp; v !== '') ? v : d
145
+ }
146
+ if (typeof d === 'boolean') {
147
+ return (typeof v === 'boolean') ? v : d
148
+ }
149
+ if (typeof d === 'number') {
150
+ return (typeof v === 'number' &amp;&amp; isFinite(v)) ? v : d
151
+ }
152
+ return d
153
+ }
154
+
155
+ export default {
156
+ name: 'FlowControls',
157
+ components: { WGroupIconCheck },
158
+ props: {
159
+ //選單設定物件, 鍵值同menuDef, 由WFlowVue自opt原樣取出後傳入; 各鍵未給或型別不符即回退menuDef
160
+ menu: { type: Object, default: () => ({}) },
161
+ locked: { type: Boolean, default: false },
162
+ },
163
+ data() {
164
+ return {
165
+ //設定鈕展開狀態(收合時僅顯示設定鈕, 展開才顯示其餘按鈕), 比照w-threejs-vue; 初值取menu.useSetting
166
+ useSetting: pickMenuValue('useSetting', (this.menu || {}).useSetting),
167
+ }
168
+ },
169
+ computed: {
170
+ cfg() {
171
+ let m = this.menu || {}
172
+ let r = {}
173
+ for (let k in menuDef) {
174
+ r[k] = pickMenuValue(k, m[k])
175
+ }
176
+ //menuPosition另檢核列舉值
177
+ if (menuPositions.indexOf(r.menuPosition) &lt; 0) {
178
+ r.menuPosition = menuDef.menuPosition
179
+ }
180
+ return r
181
+ },
182
+ allItems() {
183
+ let c = this.cfg
184
+ let rs = [
185
+ { id: 'setting', icon: c.menuSettingIcon, tooltip: c.menuSettingTooltip },
186
+ ]
187
+ if (c.useMenuItemZoomIn) {
188
+ rs.push({ id: 'zoomIn', icon: c.menuZoomInIcon, tooltip: c.menuZoomInTooltip })
189
+ }
190
+ if (c.useMenuItemZoomOut) {
191
+ rs.push({ id: 'zoomOut', icon: c.menuZoomOutIcon, tooltip: c.menuZoomOutTooltip })
192
+ }
193
+ if (c.useMenuItemFitView) {
194
+ rs.push({ id: 'fitView', icon: c.menuFitViewIcon, tooltip: c.menuFitViewTooltip })
195
+ }
196
+ if (c.useMenuItemLock) {
197
+ rs.push({ id: 'interactive', icon: this.locked ? c.menuLockIconLocked : c.menuLockIcon, tooltip: this.locked ? c.menuLockTooltipLocked : c.menuLockTooltip })
198
+ }
199
+ return rs
200
+ },
201
+ useItems() {
202
+ //設定鈕恆在最頂; 收合時僅顯示設定鈕
203
+ if (this.useSetting) {
204
+ return this.allItems
205
+ }
206
+ return [this.allItems[0]]
207
+ },
208
+ panelStyle() {
209
+ //向下偏移: top-*位置加margin-top, bottom-*位置加margin-bottom(margin於絕對定位元素上等同再位移該側)
210
+ //故menuYShift之語義為[正值使選單遠離其錨定邊]: top-*向下, bottom-*向上
211
+ let s = 'z-index:5;'
212
+ if (this.cfg.menuPosition.indexOf('bottom') >= 0) {
213
+ s += `margin-bottom:${this.cfg.menuYShift}px;`
214
+ }
215
+ else {
216
+ s += `margin-top:${this.cfg.menuYShift}px;`
217
+ }
218
+ return s
219
+ },
220
+ },
221
+ methods: {
222
+ onClickItem(item) {
223
+ let id = (item &amp;&amp; item.id) || ''
224
+ if (id === 'setting') {
225
+ this.useSetting = !this.useSetting
226
+ }
227
+ else if (id === 'zoomIn') {
228
+ this.$emit('zoom-in')
229
+ }
230
+ else if (id === 'zoomOut') {
231
+ this.$emit('zoom-out')
232
+ }
233
+ else if (id === 'fitView') {
234
+ this.$emit('fit-view')
235
+ }
236
+ else if (id === 'interactive') {
237
+ this.$emit('toggle-interactive')
238
+ }
239
+ },
240
+ },
241
+ }
242
+ &lt;/script>
243
+
244
+ &lt;style scoped>
245
+ .vue-flow__panel {
246
+ position: absolute;
247
+ z-index: 5;
248
+ }
249
+ .vue-flow__panel--top-left { top: 10px; left: 10px; }
250
+ .vue-flow__panel--top-right { top: 10px; right: 10px; }
251
+ .vue-flow__panel--bottom-left { bottom: 10px; left: 10px; }
252
+ .vue-flow__panel--bottom-right { bottom: 10px; right: 10px; }
253
+ &lt;/style>
254
+ </code></pre>
255
+ </article>
256
+ </section>
257
+
258
+
259
+
260
+
261
+
262
+
263
+ </div>
264
+
265
+ <br class="clear">
266
+
267
+ <footer>
268
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 22 2026 22:01:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
269
+ </footer>
270
+
271
+ <script>prettyPrint();</script>
272
+ <script src="scripts/polyfill.js"></script>
273
+ <script src="scripts/linenumber.js"></script>
274
+
275
+
276
+
277
+ </body>
278
+ </html>
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
  <!-- app -->
39
- <script src="app.umd.js?1787286348041"></script>
39
+ <script src="app.umd.js?1787407269095"></script>
40
40
 
41
41
  </head>
42
42
  <body style="font-family:'Microsoft JhengHei','Avenir','Helvetica'; padding:0px; margin:0px;">