ocpview-pro 0.1.2 → 0.1.4

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.1";
456
+ const version$2 = "0.1.3";
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 }
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-5c818735"]]);
23316
23352
  var billimport_vue_vue_type_style_index_0_lang = "";
23317
23353
  const _sfc_main$18 = {
23318
23354
  name: "billimport",
@@ -33770,6 +33806,19 @@ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
33770
33806
  });
33771
33807
  }
33772
33808
  var GridColSet = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$y], ["__scopeId", "data-v-926ea6aa"]]);
33809
+ const columnColorConfig = {
33810
+ billstatus: {
33811
+ A: "#FA8C16",
33812
+ N: "#1677FF",
33813
+ S: "#1677FF",
33814
+ Q: "#F5222D",
33815
+ T: "#F5222D",
33816
+ W: "#FA8C16",
33817
+ X: "#00875A",
33818
+ Y: "#52C41A",
33819
+ C: "#666666"
33820
+ }
33821
+ };
33773
33822
  const _sfc_main$A = {
33774
33823
  name: "mbillquerygrid",
33775
33824
  components: { QueryBar: querybar, GridColSet },
@@ -33828,6 +33877,7 @@ const _sfc_main$A = {
33828
33877
  if (el2.type === "ComboBox" && el2.codeWithName === void 0) {
33829
33878
  el2.codeWithName = this.OmdUrl.billQueryComboBoxCodeWithName !== void 0 ? this.OmdUrl.billQueryComboBoxCodeWithName : true;
33830
33879
  }
33880
+ this.injectColumnRender(el2);
33831
33881
  });
33832
33882
  if (this.myConfig.gridConfig.initRefresh !== void 0) {
33833
33883
  this.initRefresh = this.myConfig.gridConfig.initRefresh;
@@ -33878,6 +33928,23 @@ const _sfc_main$A = {
33878
33928
  this.setChangeGridConfig();
33879
33929
  },
33880
33930
  methods: {
33931
+ injectColumnRender(el2) {
33932
+ const colorMap = columnColorConfig[el2.name];
33933
+ if (!colorMap || el2.type !== "ComboBox" || el2.render !== void 0) {
33934
+ return;
33935
+ }
33936
+ const fieldName = el2.name;
33937
+ el2.render = (h10, params) => {
33938
+ const code = params.row[fieldName];
33939
+ const color2 = colorMap[code];
33940
+ const text = this.$Method.formatComboBox(code, params.column);
33941
+ if (color2) {
33942
+ return h10("span", { style: { color: color2 } }, text);
33943
+ }
33944
+ return h10("span", text);
33945
+ };
33946
+ el2._colorMap = colorMap;
33947
+ },
33881
33948
  initRowBtn() {
33882
33949
  if (this.enablePermissions) {
33883
33950
  let btns = [];
@@ -44199,6 +44266,19 @@ const _sfc_main$i = {
44199
44266
  RewriteTableCellDBlclick(params) {
44200
44267
  const { row } = params;
44201
44268
  this.dbclick(row);
44269
+ },
44270
+ cellStyleMethod({ row, column: column2 }) {
44271
+ const item = this.tableColumns.find(
44272
+ (c10) => c10.name === column2.field
44273
+ );
44274
+ if (item && item._colorMap) {
44275
+ const code = row[column2.field];
44276
+ const color2 = item._colorMap[code];
44277
+ if (color2) {
44278
+ return { color: color2 };
44279
+ }
44280
+ }
44281
+ return {};
44202
44282
  }
44203
44283
  },
44204
44284
  mounted() {
@@ -44273,6 +44353,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
44273
44353
  loading: _ctx.loading,
44274
44354
  "sort-config": { remote: true, trigger: "cell" },
44275
44355
  "seq-config": $options.seqConfig,
44356
+ "cell-style": $options.cellStyleMethod,
44276
44357
  onSortChange: $options.RewriteTableOnSortChange,
44277
44358
  onCellDblclick: $options.RewriteTableCellDBlclick
44278
44359
  }, createSlots({
@@ -44292,7 +44373,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
44292
44373
  ])
44293
44374
  };
44294
44375
  })
44295
- ]), 1032, ["columns", "data", "height", "max-height", "loading", "seq-config", "onSortChange", "onCellDblclick"])
44376
+ ]), 1032, ["columns", "data", "height", "max-height", "loading", "seq-config", "cell-style", "onSortChange", "onCellDblclick"])
44296
44377
  ]),
44297
44378
  _: 3
44298
44379
  }),