ocpview-pro 0.1.3 → 0.1.5

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/index.js CHANGED
@@ -6,7 +6,7 @@ import md5 from "js-md5";
6
6
  import * as XLSX from "xlsx";
7
7
  import * as XLSXS from "xlsx-style-vite";
8
8
  import { saveAs } from "file-saver";
9
- import { watch, effectScope, reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, withDirectives, createTextVNode, toDisplayString, vShow, createCommentVNode, Fragment, createBlock, renderList, createElementVNode, withKeys, withModifiers, renderSlot, createSlots, normalizeClass, defineComponent, onMounted, onBeforeUnmount, ref, nextTick, h as h$1, toRaw, unref, resolveDynamicComponent, mergeProps, normalizeProps, guardReactiveProps, shallowRef, watchEffect, inject, createApp, Teleport, provide, onUnmounted, TransitionGroup, getCurrentInstance, onActivated, onDeactivated } from "vue";
9
+ import { watch, effectScope, reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, withDirectives, createTextVNode, toDisplayString, vShow, createCommentVNode, Fragment, createBlock, renderList, createElementVNode, withKeys, withModifiers, renderSlot, createSlots, normalizeClass, defineComponent, onMounted, onBeforeUnmount, ref, nextTick, h as h$1, toRaw, unref, resolveDynamicComponent, mergeProps, toHandlers, normalizeProps, guardReactiveProps, shallowRef, watchEffect, inject, createApp, Teleport, provide, onUnmounted, TransitionGroup, getCurrentInstance, onActivated, onDeactivated } from "vue";
10
10
  import elementResizeDetectorMaker from "element-resize-detector";
11
11
  import pako, { gzip } from "pako";
12
12
  import Viewer from "viewerjs";
@@ -453,7 +453,7 @@ common.initEview = function(ViewUI2) {
453
453
  common.initAnchor(ViewUI2.Anchor);
454
454
  };
455
455
  const name = "ocpview-pro";
456
- const version$2 = "0.1.3";
456
+ const version$2 = "0.1.4";
457
457
  const title = "ocpviewPlus";
458
458
  const description = "A high quality Service UI components Library with Vue.js";
459
459
  const homepage = "";
@@ -23191,15 +23191,15 @@ function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
23191
23191
  });
23192
23192
  }
23193
23193
  var FormCardBox2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1a, [["render", _sfc_render$13]]);
23194
+ var showtext_vue_vue_type_style_index_0_scoped_true_lang = "";
23194
23195
  const _sfc_main$19 = {
23195
23196
  name: "showText",
23196
23197
  data() {
23197
23198
  return {
23198
23199
  showTooltip: false,
23199
- labeltext: "",
23200
- showIcon: false,
23201
- iconWidth: 0,
23202
- textLink: false
23200
+ tooltipDisabled: true,
23201
+ tooltipTimer: null,
23202
+ hasOverflow: false
23203
23203
  };
23204
23204
  },
23205
23205
  props: {
@@ -23221,26 +23221,89 @@ const _sfc_main$19 = {
23221
23221
  },
23222
23222
  config: {
23223
23223
  type: Object,
23224
- default: () => {
23225
- }
23224
+ default: () => ({})
23226
23225
  },
23227
23226
  rowIndex: {
23228
23227
  type: [String, Number],
23229
23228
  default: ""
23230
23229
  }
23231
23230
  },
23232
- created() {
23233
- if (this.config && this.config.textLink !== void 0) {
23234
- this.textLink = this.config.textLink;
23231
+ computed: {
23232
+ labeltext() {
23233
+ return this.label;
23234
+ },
23235
+ textLink() {
23236
+ return !!(this.config && this.config.textLink);
23237
+ },
23238
+ displayText() {
23239
+ if (this.resetText) {
23240
+ return this.resetText(
23241
+ this.doSpecialSymbols(this.label),
23242
+ this.label
23243
+ );
23244
+ }
23245
+ return this.doSpecialSymbols(this.label);
23246
+ }
23247
+ },
23248
+ mounted() {
23249
+ this.$nextTick(() => {
23250
+ this.checkOverflow();
23251
+ this.setupResizeObserver();
23252
+ });
23253
+ },
23254
+ beforeUnmount() {
23255
+ if (this.tooltipTimer) {
23256
+ clearTimeout(this.tooltipTimer);
23257
+ this.tooltipTimer = null;
23258
+ }
23259
+ if (this.resizeObserver) {
23260
+ this.resizeObserver.disconnect();
23261
+ this.resizeObserver = null;
23262
+ }
23263
+ if (this.checkOverflowDebounced) {
23264
+ this.checkOverflowDebounced.cancel();
23265
+ this.checkOverflowDebounced = null;
23235
23266
  }
23236
23267
  },
23237
23268
  methods: {
23269
+ checkOverflow() {
23270
+ const content2 = this.$refs.content;
23271
+ this.hasOverflow = !!(content2 && content2.scrollWidth > content2.offsetWidth);
23272
+ },
23273
+ setupResizeObserver() {
23274
+ const content2 = this.$refs.content;
23275
+ if (!content2 || !window.ResizeObserver)
23276
+ return;
23277
+ this.checkOverflowDebounced = this.$utils.debounce(
23278
+ this.checkOverflow,
23279
+ 150
23280
+ );
23281
+ this.resizeObserver = new ResizeObserver(
23282
+ this.checkOverflowDebounced
23283
+ );
23284
+ this.resizeObserver.observe(content2.parentElement);
23285
+ },
23238
23286
  handleTooltipIn() {
23239
- const $content = this.$refs.content;
23240
- this.showTooltip = $content.scrollWidth > $content.offsetWidth;
23287
+ if (this.tooltipTimer) {
23288
+ clearTimeout(this.tooltipTimer);
23289
+ this.tooltipTimer = null;
23290
+ }
23291
+ this.showTooltip = true;
23292
+ this.tooltipTimer = setTimeout(() => {
23293
+ this.tooltipDisabled = false;
23294
+ this.tooltipTimer = null;
23295
+ }, 300);
23241
23296
  },
23242
23297
  handleTooltipOut() {
23243
- this.showTooltip = false;
23298
+ if (this.tooltipTimer) {
23299
+ clearTimeout(this.tooltipTimer);
23300
+ this.tooltipTimer = null;
23301
+ }
23302
+ this.tooltipDisabled = true;
23303
+ this.tooltipTimer = setTimeout(() => {
23304
+ this.showTooltip = false;
23305
+ this.tooltipTimer = null;
23306
+ }, 300);
23244
23307
  },
23245
23308
  doSpecialSymbols(str) {
23246
23309
  if (str) {
@@ -23252,67 +23315,40 @@ const _sfc_main$19 = {
23252
23315
  return str;
23253
23316
  },
23254
23317
  linkTo() {
23255
- if (this.config.onLinkTo) {
23318
+ if (this.config && this.config.onLinkTo) {
23256
23319
  let obj = this.$Method.copy(this.config);
23257
23320
  obj.rowIndex = this.rowIndex;
23258
23321
  this.config.onLinkTo(obj);
23259
23322
  }
23260
23323
  }
23261
- },
23262
- watch: {
23263
- label: {
23264
- handler(data) {
23265
- this.labeltext = data;
23266
- if (this.resetText) {
23267
- this.showText = this.resetText(this.doSpecialSymbols(data), data);
23268
- } else {
23269
- this.showText = this.doSpecialSymbols(data);
23270
- }
23271
- },
23272
- immediate: true
23273
- }
23274
23324
  }
23275
23325
  };
23276
- const _hoisted_1$P = ["innerHTML"];
23326
+ const _hoisted_1$P = { class: "showtext-tooltip-content" };
23277
23327
  const _hoisted_2$z = ["innerHTML"];
23278
23328
  function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
23279
- const _component_Tooltip = resolveComponent("Tooltip");
23280
- return openBlock(), createBlock(_component_Tooltip, {
23281
- transfer: "",
23282
- content: $data.labeltext,
23283
- disabled: !$data.showTooltip,
23284
- "max-width": $props.maxWidth,
23285
- class: "ivu-table-cell-tooltip"
23286
- }, {
23329
+ return openBlock(), createBlock(resolveDynamicComponent($data.showTooltip ? "Tooltip" : "div"), mergeProps($data.showTooltip ? { transfer: true, content: $options.labeltext, maxWidth: $props.maxWidth, disabled: $data.tooltipDisabled } : {}, { class: "ivu-table-cell-tooltip" }), createSlots({
23287
23330
  default: withCtx(() => [
23288
- $data.textLink ? (openBlock(), createElementBlock("a", {
23289
- key: 0,
23290
- href: "#",
23291
- style: { "text-decoration": "underline" },
23292
- onClick: _cache[2] || (_cache[2] = withModifiers((...args) => $options.linkTo && $options.linkTo(...args), ["prevent"]))
23293
- }, [
23294
- createElementVNode("span", {
23295
- ref: "content",
23296
- class: "ivu-table-cell-tooltip-content",
23297
- innerHTML: _ctx.showText,
23298
- style: normalizeStyle("text-align:" + $props.contentAlign),
23299
- onMouseenter: _cache[0] || (_cache[0] = (...args) => $options.handleTooltipIn && $options.handleTooltipIn(...args)),
23300
- onMouseleave: _cache[1] || (_cache[1] = (...args) => $options.handleTooltipOut && $options.handleTooltipOut(...args))
23301
- }, null, 44, _hoisted_1$P)
23302
- ])) : (openBlock(), createElementBlock("span", {
23303
- key: 1,
23331
+ createElementVNode("span", mergeProps({
23304
23332
  ref: "content",
23305
- class: "ivu-table-cell-tooltip-content",
23306
- innerHTML: _ctx.showText,
23307
- style: normalizeStyle("text-align:" + $props.contentAlign),
23308
- onMouseenter: _cache[3] || (_cache[3] = (...args) => $options.handleTooltipIn && $options.handleTooltipIn(...args)),
23309
- onMouseleave: _cache[4] || (_cache[4] = (...args) => $options.handleTooltipOut && $options.handleTooltipOut(...args))
23310
- }, null, 44, _hoisted_2$z))
23333
+ class: ["ivu-table-cell-tooltip-content", { "showtext-link": $options.textLink }],
23334
+ innerHTML: $options.displayText,
23335
+ style: { textAlign: $props.contentAlign, width: "100%" }
23336
+ }, toHandlers($data.hasOverflow ? { mouseenter: $options.handleTooltipIn, mouseleave: $options.handleTooltipOut } : {}, true), {
23337
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => $options.textLink && $options.linkTo(), ["prevent"]))
23338
+ }), null, 16, _hoisted_2$z)
23311
23339
  ]),
23312
- _: 1
23313
- }, 8, ["content", "disabled", "max-width"]);
23340
+ _: 2
23341
+ }, [
23342
+ $data.showTooltip ? {
23343
+ name: "content",
23344
+ fn: withCtx(() => [
23345
+ createElementVNode("span", _hoisted_1$P, toDisplayString($options.labeltext), 1)
23346
+ ]),
23347
+ key: "0"
23348
+ } : void 0
23349
+ ]), 1040);
23314
23350
  }
23315
- var ShowText = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["render", _sfc_render$12]]);
23351
+ var ShowText = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["render", _sfc_render$12], ["__scopeId", "data-v-98a304ae"]]);
23316
23352
  var billimport_vue_vue_type_style_index_0_lang = "";
23317
23353
  const _sfc_main$18 = {
23318
23354
  name: "billimport",