agilebuilder-ui 1.1.13 → 1.1.14
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/lib/401-8eb9481a.js +11 -0
- package/lib/404-9fca116f.js +8 -0
- package/lib/authredirect-294d14ef.js +7 -0
- package/lib/iframe-page-fadda1f8.js +12 -0
- package/lib/index-1cc4db24.js +8 -0
- package/lib/index-42d5d61b.js +72070 -0
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +39 -67693
- package/lib/super-ui.umd.cjs +121 -83
- package/lib/tab-content-iframe-index-12527a41.js +12 -0
- package/lib/tab-content-index-56d7113b.js +115 -0
- package/lib/tache-subprocess-history-b289d758.js +12 -0
- package/package.json +6 -2
- package/packages/fs-preview/src/fs-preview.vue +24 -36
- package/packages/super-grid/src/apis.js +46 -3
- package/packages/super-grid/src/components/mobile-table-card.jsx +463 -0
- package/packages/super-grid/src/dynamic-input.vue +1 -1
- package/packages/super-grid/src/normal-column-content.vue +6 -2
- package/packages/super-grid/src/super-grid.vue +247 -143
- package/packages/super-grid/src/utils.js +1 -1
- package/src/components/Card/index.jsx +155 -0
- package/src/components/Scrollbar/index.vue +197 -0
- package/src/mixins/resizeMixin.js +49 -0
- package/src/store/getters.js +3 -0
- package/src/store/modules/app.js +41 -0
- package/src/styles/display-layout.scss +252 -0
- package/src/styles/index.scss +1 -0
- package/src/utils/guid.js +13 -0
- package/src/views/layout/tab-content-index.vue +1 -1
- package/vite.config.js +10 -6
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/** @jsxImportSource vue */
|
|
2
|
+
import { defineComponent, ref, computed, watch, onMounted } from 'vue';
|
|
3
|
+
import { ElCard, ElTag, ElButton, ElIcon, ElCheckbox } from 'element-plus';
|
|
4
|
+
import { Bottom, Tickets } from '@element-plus/icons-vue';
|
|
5
|
+
import Scrollbar from '../Scrollbar';
|
|
6
|
+
// import { $emit, $off, $on } from '@/utils/gogocodeTransfer'
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'CardView',
|
|
10
|
+
components: {
|
|
11
|
+
Scrollbar
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
// 当前行数据
|
|
15
|
+
form: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => {}
|
|
18
|
+
},
|
|
19
|
+
// 当前序号
|
|
20
|
+
no: {
|
|
21
|
+
type: [Number, String,undefined],
|
|
22
|
+
default: () => undefined
|
|
23
|
+
},
|
|
24
|
+
// 是否选中
|
|
25
|
+
isChecked: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: () => false
|
|
28
|
+
},
|
|
29
|
+
// 是否展示多选
|
|
30
|
+
isCheck: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: () => false
|
|
33
|
+
},
|
|
34
|
+
// 是否展示子表按钮
|
|
35
|
+
isSubTable: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: () => false
|
|
38
|
+
},
|
|
39
|
+
// 是否展示更多按钮
|
|
40
|
+
isShowDetailsMore: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: () => false
|
|
43
|
+
},
|
|
44
|
+
// 是否收起
|
|
45
|
+
isMore: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: () => true
|
|
48
|
+
},
|
|
49
|
+
setMaxHeight: {
|
|
50
|
+
type: [Function, undefined],
|
|
51
|
+
default: () => undefined
|
|
52
|
+
},
|
|
53
|
+
setHeight: {
|
|
54
|
+
type: [Function, undefined],
|
|
55
|
+
default: () => undefined
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
setup(props, { attrs, emit, slots }) {
|
|
59
|
+
console.log('*card-view.jsx**********************************************=>', props, attrs, slots)
|
|
60
|
+
const isMore = ref(props.isShowDetailsMore)
|
|
61
|
+
|
|
62
|
+
const scrollHeight = ref(undefined);
|
|
63
|
+
|
|
64
|
+
const scrollbarRef = ref(null);
|
|
65
|
+
|
|
66
|
+
// 点击了卡片事件
|
|
67
|
+
const onChecked = () => {
|
|
68
|
+
emit('checked')
|
|
69
|
+
}
|
|
70
|
+
const getSlotHtml = (slotFun) => {
|
|
71
|
+
const datas = {...props, isMore: isMore.value }
|
|
72
|
+
return ['function'].includes(typeof slotFun) ? slotFun(datas) : slotFun
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const footerSlot = computed(() => {
|
|
76
|
+
return getSlotHtml(slots.footerSlot).filter(item => item?.children) ?? []
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const setMaxHeight = data => {
|
|
80
|
+
if (props.setMaxHeight) return props.setMaxHeight(data)
|
|
81
|
+
if (data?.windowHeight) {
|
|
82
|
+
// const height = data?.windowHeight - 200
|
|
83
|
+
if (data.windowHeight * 0.4 <= scrollHeight.value) return 300
|
|
84
|
+
return scrollHeight.value && scrollHeight.value >= 300 ? scrollHeight : 300
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
watch(() => props.isShowDetailsMore, (newValue) => {
|
|
89
|
+
isMore.value = newValue
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
watch(() => props.isMore, (newValue) => {
|
|
93
|
+
isMore.value = newValue
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
const scrollElement = scrollbarRef.value?.$el?.querySelector?.('.el-scrollbar__view');
|
|
98
|
+
if (scrollElement) {
|
|
99
|
+
scrollHeight.value = scrollElement.clientHeight
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
// 点击事件
|
|
104
|
+
const onClick = (event) => {
|
|
105
|
+
onChecked()
|
|
106
|
+
emit('rowClick', event)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 双击事件
|
|
110
|
+
const onDblclick = (event) => {
|
|
111
|
+
emit('rowDblclick', event)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return () => (
|
|
116
|
+
<ElCard key={`card_${props.form?.$rowDataGuId || `${props.form?.id}_${props.no}`}`} header-padding body-padding shadow="hover" class={{ 'yx-card-main': true, 'is-checked': props.isChecked}} v-slots={{
|
|
117
|
+
header: () => (
|
|
118
|
+
<div class="yx-flex-wrap" justify='space-between' align='center' onClick={onClick} onDblclick={onDblclick}>
|
|
119
|
+
<div class="yx-flex-wrap" align='center' style={{gap: '10px' , flex: '1 1 auto',maxWidth: 'calc(100% - 80px)'}}>
|
|
120
|
+
{ props.no && <ElTag type="primary" size='small'>{props.no}</ElTag>}
|
|
121
|
+
<div layout-title class='ellipsis'>{ getSlotHtml(slots.titleSlot) }</div>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="yx-flex-wrap" align='center' style={{gap: '10px'}}>
|
|
124
|
+
{ getSlotHtml(slots.headerRightSlot) }
|
|
125
|
+
{ props.isSubTable && <ElButton text icon={<ElIcon><Tickets /></ElIcon>} onClick={event => {
|
|
126
|
+
event.stopPropagation()
|
|
127
|
+
emit('showSubTable', props.form)
|
|
128
|
+
}} /> }
|
|
129
|
+
{ props.isCheck && <ElCheckbox model-value={props.isChecked} disabled={!!props.form.$editing} style="height: auto;" onClick={(event) => {
|
|
130
|
+
event.stopPropagation()
|
|
131
|
+
}} onChange={onChecked} /> }
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
),
|
|
135
|
+
...(footerSlot.value.length > 0 ? {
|
|
136
|
+
footer: footerSlot.value
|
|
137
|
+
} : {})
|
|
138
|
+
}}>
|
|
139
|
+
<div class="yx-flex-wrap" vertical style={{gap: '0', height: '100%'}} onClick={onClick} onDblclick={onDblclick}>
|
|
140
|
+
<Scrollbar ref={scrollbarRef} scrollable-main max-height={!isMore.value ? '50vh' : '100%'} set-max-height={setMaxHeight} set-height={props.setHeight}>
|
|
141
|
+
<div class='yx-card-body'>
|
|
142
|
+
{ getSlotHtml(slots.children) }
|
|
143
|
+
</div>
|
|
144
|
+
</Scrollbar>
|
|
145
|
+
{
|
|
146
|
+
props.isShowDetailsMore && (<ElButton text icon={<ElIcon>{!isMore.value ? <Top /> : <Bottom /> }</ElIcon>} onClick={(event) => {
|
|
147
|
+
event.stopPropagation()
|
|
148
|
+
isMore.value = !isMore.value
|
|
149
|
+
}}>{ !isMore.value ? 'Less' : 'More'}</ElButton>)
|
|
150
|
+
}
|
|
151
|
+
</div>
|
|
152
|
+
</ElCard>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-scrollbar v-bind="mergedAttrs" ref="scrollbarRef">
|
|
3
|
+
<slot />
|
|
4
|
+
</el-scrollbar>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { ElScrollbar } from 'element-plus';
|
|
9
|
+
// import { useStore } from 'vuex';
|
|
10
|
+
import store from '../../store';
|
|
11
|
+
import { toRefs, reactive, mergeProps, ref, onMounted, watch, useAttrs, computed, defineEmits, useSlots } from 'vue';
|
|
12
|
+
|
|
13
|
+
const slots = useSlots();
|
|
14
|
+
|
|
15
|
+
// const store = useStore();
|
|
16
|
+
|
|
17
|
+
store?.dispatch?.('startListeningToResize');
|
|
18
|
+
|
|
19
|
+
const scrollbarRef = ref(null);
|
|
20
|
+
|
|
21
|
+
const scrollToEmitValue = ref(undefined)
|
|
22
|
+
|
|
23
|
+
const emits = defineEmits(['scrollToTop', 'scrollToBottom']);
|
|
24
|
+
|
|
25
|
+
const resizeProps = computed(() => ({
|
|
26
|
+
// 宽度
|
|
27
|
+
windowWidth: store.getters.windowWidth,
|
|
28
|
+
// 高度
|
|
29
|
+
windowHeight: store.getters.windowHeight,
|
|
30
|
+
// 是否移动端
|
|
31
|
+
isMobileResize: store.getters.isMobileResize,
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
// 定义初始化参数
|
|
35
|
+
const defaultAttrs = reactive({
|
|
36
|
+
always: false, // 滚动条是否总是显示
|
|
37
|
+
// wrapStyle: 'height: 100%', // 滚动区域的样式
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
// 是否开启滚动距离阴影
|
|
42
|
+
showScrollShadow: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
triggerDistance: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0
|
|
49
|
+
},
|
|
50
|
+
// 动态计算 max-height
|
|
51
|
+
setMaxHeight: {
|
|
52
|
+
type: [Function, undefined],
|
|
53
|
+
default: () => undefined
|
|
54
|
+
},
|
|
55
|
+
// 动态计算 height
|
|
56
|
+
setHeight: {
|
|
57
|
+
type: [Function, undefined],
|
|
58
|
+
default: () => undefined
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const { attrs } = useAttrs();
|
|
63
|
+
|
|
64
|
+
// 统一写入
|
|
65
|
+
const setHeightFun = (fun) => {
|
|
66
|
+
try {
|
|
67
|
+
return fun?.(resizeProps.value)
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error(error)
|
|
70
|
+
}
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 合并初始化参数和传入的属性
|
|
75
|
+
const mergedAttrs = computed(() => {
|
|
76
|
+
const attrsData = mergeProps(defaultAttrs, attrs)
|
|
77
|
+
return {
|
|
78
|
+
...({
|
|
79
|
+
// 绑定 setMaxHeight 事件 返回 最大高度
|
|
80
|
+
...(props.setMaxHeight ? { maxHeight: setHeightFun(props.setMaxHeight) } : {}),
|
|
81
|
+
// 绑定 setHeight 事件 返回 高度
|
|
82
|
+
...(props.setHeight ? { height: setHeightFun(props.setHeight) } : {}),
|
|
83
|
+
}),
|
|
84
|
+
...attrsData
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// 滚动距离回调事件
|
|
89
|
+
const scrollToEmits = (scrollElement) => {
|
|
90
|
+
if (!scrollElement) return
|
|
91
|
+
const isAtTop = scrollElement.scrollTop <= props.triggerDistance;
|
|
92
|
+
const isAtBottom = scrollElement.scrollTop + scrollElement.clientHeight >= (scrollElement.scrollHeight - props.triggerDistance);
|
|
93
|
+
if (isAtBottom) {
|
|
94
|
+
// scrollToEmitValue 校验确保只执行一次
|
|
95
|
+
// 底部事件
|
|
96
|
+
!['at-bottom'].includes(scrollToEmitValue.value) && emits('scrollToBottom');
|
|
97
|
+
scrollToEmitValue.value = 'at-bottom'
|
|
98
|
+
} else if (isAtTop) {
|
|
99
|
+
// 顶部事件
|
|
100
|
+
!['at-top'].includes(scrollToEmitValue.value) && emits('scrollToTop');
|
|
101
|
+
scrollToEmitValue.value = 'at-top'
|
|
102
|
+
} else {
|
|
103
|
+
scrollToEmitValue.value = undefined
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 滚动阴影事件
|
|
108
|
+
const handleScroll = () => {
|
|
109
|
+
const scrollElement = scrollbarRef.value?.$el.querySelector('.el-scrollbar__wrap');
|
|
110
|
+
if (scrollElement) {
|
|
111
|
+
const isAtTop = scrollElement.scrollTop === 0;
|
|
112
|
+
const isAtBottom = scrollElement.scrollTop + scrollElement.clientHeight === scrollElement.scrollHeight;
|
|
113
|
+
if (props.showScrollShadow) {
|
|
114
|
+
if (!isAtTop) {
|
|
115
|
+
scrollbarRef.value.$el.classList.add('scroll-top-shadow');
|
|
116
|
+
} else {
|
|
117
|
+
scrollbarRef.value.$el.classList.remove('scroll-top-shadow');
|
|
118
|
+
}
|
|
119
|
+
if (!isAtBottom) {
|
|
120
|
+
scrollbarRef.value.$el.classList.add('scroll-bottom-shadow');
|
|
121
|
+
} else {
|
|
122
|
+
scrollbarRef.value.$el.classList.remove('scroll-bottom-shadow');
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
scrollbarRef.value.$el.classList.remove('scroll-top-shadow', 'scroll-bottom-shadow');
|
|
126
|
+
}
|
|
127
|
+
scrollToEmits(scrollElement);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
onMounted(() => {
|
|
132
|
+
const scrollElement = scrollbarRef.value.$el.querySelector('.el-scrollbar__wrap');
|
|
133
|
+
if (scrollElement) {
|
|
134
|
+
scrollElement.addEventListener('scroll', handleScroll);
|
|
135
|
+
handleScroll();
|
|
136
|
+
scrollToEmits(scrollElement);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
watch(() => props.showScrollShadow, () => {
|
|
141
|
+
handleScroll();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
watch(() => mergedAttrs?.maxHeight, () => {
|
|
145
|
+
setTimeout(handleScroll, 500);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
watch(() => mergedAttrs?.height, () => {
|
|
149
|
+
setTimeout(handleScroll, 500);
|
|
150
|
+
});
|
|
151
|
+
watch(
|
|
152
|
+
() => slots.default?.(),
|
|
153
|
+
(newValue, oldValue) => {
|
|
154
|
+
if (newValue !== oldValue) {
|
|
155
|
+
setTimeout(handleScroll, 500);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{ deep: true }
|
|
159
|
+
);
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<style lang="scss" scoped>
|
|
163
|
+
.el-scrollbar ::v-deep {
|
|
164
|
+
position: relative;
|
|
165
|
+
|
|
166
|
+
&.scroll-top-shadow {
|
|
167
|
+
&::before {
|
|
168
|
+
content: ' ';
|
|
169
|
+
position: absolute;
|
|
170
|
+
top: 0;
|
|
171
|
+
left: 0;
|
|
172
|
+
right: 0;
|
|
173
|
+
height: 8px;
|
|
174
|
+
box-shadow: inset 0 8px 8px -8px rgba(0, 0, 0, 0.2);
|
|
175
|
+
z-index: 2;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&.scroll-bottom-shadow {
|
|
180
|
+
&::after {
|
|
181
|
+
content: ' ';
|
|
182
|
+
position: absolute;
|
|
183
|
+
bottom: 0;
|
|
184
|
+
left: 0;
|
|
185
|
+
right: 0;
|
|
186
|
+
height: 8px;
|
|
187
|
+
box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.2);
|
|
188
|
+
z-index: 2;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&>.el-scrollbar__wrap {
|
|
193
|
+
position: relative;
|
|
194
|
+
z-index: 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
data() {
|
|
3
|
+
const element = document.querySelector('.amb-design-board');
|
|
4
|
+
let designObserver
|
|
5
|
+
if (element) {
|
|
6
|
+
this.designObserver = new ResizeObserver(entries => {
|
|
7
|
+
for (const entry of entries) {
|
|
8
|
+
console.log(entry);
|
|
9
|
+
this.handleDesignResize(entry?.['target'])
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
designObserver.observe(element);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
windowWidth: designObserver ? element.clientWidth : window.innerWidth,
|
|
16
|
+
windowHeight: designObserver ? element.clientHeight : window.innerHeight,
|
|
17
|
+
designObserver
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
isMobileResize() {
|
|
22
|
+
return (this.windowWidth ?? 0) <= 768
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
mounted() {
|
|
26
|
+
if (!this.designObserver) {
|
|
27
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
beforeDestroy() {
|
|
31
|
+
if (this.designObserver) {
|
|
32
|
+
this.designObserver.disconnect();
|
|
33
|
+
} else {
|
|
34
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
handleWindowResize() {
|
|
39
|
+
this.windowWidth = window.innerWidth;
|
|
40
|
+
this.windowHeight = window.innerHeight;
|
|
41
|
+
},
|
|
42
|
+
handleDesignResize(element) {
|
|
43
|
+
if (element) {
|
|
44
|
+
this.windowWidth = element.clientWidth;
|
|
45
|
+
this.windowHeight = element.clientHeight;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
package/src/store/getters.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const getters = {
|
|
2
2
|
sidebar: (state) => state.app.sidebar,
|
|
3
3
|
device: (state) => state.app.device,
|
|
4
|
+
windowWidth: (state) => state.app.windowWidth,
|
|
5
|
+
windowHeight: (state) => state.app.windowHeight,
|
|
6
|
+
isMobileResize: (state) => state.app.isMobileResize,
|
|
4
7
|
token: (state) => state.user.token,
|
|
5
8
|
name: (state) => state.user.name,
|
|
6
9
|
// routers: state => state.permission.routers,
|
package/src/store/modules/app.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import System from "@zxing/library/esm/core/util/System"
|
|
2
|
+
|
|
1
3
|
const app = {
|
|
2
4
|
state: {
|
|
3
5
|
sidebar: {
|
|
@@ -7,8 +9,18 @@ const app = {
|
|
|
7
9
|
device: 'desktop',
|
|
8
10
|
preventReclick: false,
|
|
9
11
|
whiteList: [],
|
|
12
|
+
systemWidth: [],
|
|
13
|
+
windowWidth: null, // 网页宽度
|
|
14
|
+
windowHeight: null, // 网页高度
|
|
15
|
+
isMobileResize: false, // 是否移动端
|
|
10
16
|
},
|
|
11
17
|
mutations: {
|
|
18
|
+
// 写入网页 高度 宽度 是否移动端
|
|
19
|
+
updateWindowSize(state, { width, height }) {
|
|
20
|
+
state.windowWidth = width;
|
|
21
|
+
state.windowHeight = height;
|
|
22
|
+
state.isMobileResize = !!width && width <= 768
|
|
23
|
+
},
|
|
12
24
|
toggleSidebar: (state) => {
|
|
13
25
|
if (state.sidebar.opened) {
|
|
14
26
|
window.sessionStorage.setItem('sidebarStatus', 1)
|
|
@@ -36,6 +48,35 @@ const app = {
|
|
|
36
48
|
},
|
|
37
49
|
},
|
|
38
50
|
actions: {
|
|
51
|
+
startListeningToResize({ state, commit }) {
|
|
52
|
+
const handleResize = (data) => {
|
|
53
|
+
commit('updateWindowSize', {
|
|
54
|
+
width: data?.width ?? window.innerWidth,
|
|
55
|
+
height: data?.height ?? window.innerHeight,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
if (!state.windowWidth && !state.windowHeight) {
|
|
59
|
+
const element = document.querySelector('.amb-design-board');
|
|
60
|
+
if (element) {
|
|
61
|
+
handleResize({
|
|
62
|
+
width: element.clientWidth,
|
|
63
|
+
height: element.clientHeight,
|
|
64
|
+
});
|
|
65
|
+
const designObserver = new ResizeObserver(entries => {
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
handleResize({
|
|
68
|
+
width: entry?.['target']?.clientWidth,
|
|
69
|
+
height: entry?.['target']?.clientHeight,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
designObserver.observe(element);
|
|
74
|
+
} else {
|
|
75
|
+
window.addEventListener('resize', handleResize);
|
|
76
|
+
handleResize();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
39
80
|
toggleSidebar: ({ commit }) => {
|
|
40
81
|
commit('toggleSidebar')
|
|
41
82
|
},
|