@ibiz-template/vue3-components 0.5.7-alpha.0 → 0.5.7-alpha.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.
@@ -1,9 +1,9 @@
1
- import { ref, shallowRef, watch, onBeforeUnmount, onMounted, createTextVNode, createVNode, nextTick, resolveComponent, defineComponent } from 'vue';
1
+ import { ref, shallowRef, watch, onBeforeUnmount, onMounted, createTextVNode, createVNode, nextTick, onUnmounted, resolveComponent, defineComponent } from 'vue';
2
2
  import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
3
3
  import { getCookie } from 'qx-util';
4
4
  import { isNil } from 'ramda';
5
5
  import { getHtmlProps, getEditorEmits, useNamespace } from '@ibiz-template/vue3-util';
6
- import { CoreConst } from '@ibiz-template/core';
6
+ import { CoreConst, awaitTimeout } from '@ibiz-template/core';
7
7
  import { ElMessageBox } from 'element-plus';
8
8
  import './wang-editor.css';
9
9
 
@@ -214,20 +214,22 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
214
214
  });
215
215
  });
216
216
  const calcHtmlStyle = () => {
217
- if (htmlContent.value && toolbarRef.value) {
218
- const htmlContentHeight = htmlContent.value.offsetHeight;
219
- resizeObserver = new ResizeObserver((entries) => {
220
- const height = entries[0].contentRect.height;
221
- if (height !== lastToolbarHeight) {
222
- const tempCssVars = {
223
- height: "".concat(htmlContentHeight - entries[0].contentRect.height, "px")
224
- };
225
- cssVars.value = ns.cssVarBlock(tempCssVars);
226
- lastToolbarHeight = height;
227
- }
228
- });
229
- resizeObserver.observe(toolbarRef.value.selector);
230
- }
217
+ awaitTimeout(0, () => {
218
+ if (htmlContent.value && toolbarRef.value) {
219
+ const htmlContentHeight = htmlContent.value.offsetHeight;
220
+ resizeObserver = new ResizeObserver((entries) => {
221
+ const height = entries[0].contentRect.height;
222
+ if (height !== lastToolbarHeight) {
223
+ const tempCssVars = {
224
+ height: "".concat(htmlContentHeight - entries[0].contentRect.height, "px")
225
+ };
226
+ cssVars.value = ns.cssVarBlock(tempCssVars);
227
+ lastToolbarHeight = height;
228
+ }
229
+ });
230
+ resizeObserver.observe(toolbarRef.value.selector);
231
+ }
232
+ });
231
233
  };
232
234
  const moveToLastStr = () => {
233
235
  var _a, _b;
@@ -372,6 +374,11 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
372
374
  onMounted(() => {
373
375
  calcHtmlStyle();
374
376
  });
377
+ onUnmounted(() => {
378
+ if (resizeObserver) {
379
+ resizeObserver.disconnect();
380
+ }
381
+ });
375
382
  return {
376
383
  ns,
377
384
  editorRef,
@@ -184,6 +184,9 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
184
184
  });
185
185
  onUnmounted(() => {
186
186
  editor.value = null;
187
+ if (resizeObserver) {
188
+ resizeObserver.disconnect();
189
+ }
187
190
  });
188
191
  return {
189
192
  ns,
@@ -31,7 +31,7 @@ const UserMessage = /* @__PURE__ */ defineComponent({
31
31
  const hiddenPopover = () => {
32
32
  popoverRef.value.hide();
33
33
  };
34
- const noticeNum = ref(12);
34
+ const noticeNum = ref(0);
35
35
  return {
36
36
  ns,
37
37
  c,
@@ -218,20 +218,22 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
218
218
  });
219
219
  });
220
220
  const calcHtmlStyle = () => {
221
- if (htmlContent.value && toolbarRef.value) {
222
- const htmlContentHeight = htmlContent.value.offsetHeight;
223
- resizeObserver = new ResizeObserver((entries) => {
224
- const height = entries[0].contentRect.height;
225
- if (height !== lastToolbarHeight) {
226
- const tempCssVars = {
227
- height: "".concat(htmlContentHeight - entries[0].contentRect.height, "px")
228
- };
229
- cssVars.value = ns.cssVarBlock(tempCssVars);
230
- lastToolbarHeight = height;
231
- }
232
- });
233
- resizeObserver.observe(toolbarRef.value.selector);
234
- }
221
+ core.awaitTimeout(0, () => {
222
+ if (htmlContent.value && toolbarRef.value) {
223
+ const htmlContentHeight = htmlContent.value.offsetHeight;
224
+ resizeObserver = new ResizeObserver((entries) => {
225
+ const height = entries[0].contentRect.height;
226
+ if (height !== lastToolbarHeight) {
227
+ const tempCssVars = {
228
+ height: "".concat(htmlContentHeight - entries[0].contentRect.height, "px")
229
+ };
230
+ cssVars.value = ns.cssVarBlock(tempCssVars);
231
+ lastToolbarHeight = height;
232
+ }
233
+ });
234
+ resizeObserver.observe(toolbarRef.value.selector);
235
+ }
236
+ });
235
237
  };
236
238
  const moveToLastStr = () => {
237
239
  var _a, _b;
@@ -376,6 +378,11 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
376
378
  vue.onMounted(() => {
377
379
  calcHtmlStyle();
378
380
  });
381
+ vue.onUnmounted(() => {
382
+ if (resizeObserver) {
383
+ resizeObserver.disconnect();
384
+ }
385
+ });
379
386
  return {
380
387
  ns,
381
388
  editorRef,
@@ -188,6 +188,9 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
188
188
  });
189
189
  vue.onUnmounted(() => {
190
190
  editor.value = null;
191
+ if (resizeObserver) {
192
+ resizeObserver.disconnect();
193
+ }
191
194
  });
192
195
  return {
193
196
  ns,
@@ -33,7 +33,7 @@ const UserMessage = /* @__PURE__ */ vue.defineComponent({
33
33
  const hiddenPopover = () => {
34
34
  popoverRef.value.hide();
35
35
  };
36
- const noticeNum = vue.ref(12);
36
+ const noticeNum = vue.ref(0);
37
37
  return {
38
38
  ns,
39
39
  c,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.5.7-alpha.0",
3
+ "version": "0.5.7-alpha.1",
4
4
  "description": "使用 rollup 编译 vue 组件或者 jsx",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -28,10 +28,10 @@
28
28
  "@ibiz-template-plugin/ai-chat": "^0.0.1",
29
29
  "@ibiz-template-plugin/gantt": "0.1.1",
30
30
  "@ibiz-template/core": "^0.5.7-alpha.0",
31
- "@ibiz-template/model-helper": "^0.5.7-alpha.0",
32
- "@ibiz-template/runtime": "^0.5.7-alpha.0",
31
+ "@ibiz-template/model-helper": "^0.5.7-alpha.1",
32
+ "@ibiz-template/runtime": "^0.5.7-alpha.1",
33
33
  "@ibiz-template/theme": "^0.5.0",
34
- "@ibiz-template/vue3-util": "^0.5.7-alpha.0",
34
+ "@ibiz-template/vue3-util": "^0.5.7-alpha.1",
35
35
  "@ibiz/model-core": "^0.1.6",
36
36
  "@imengyu/vue3-context-menu": "^1.3.5",
37
37
  "@monaco-editor/loader": "^1.4.0",