ocpview-pro 0.0.5 → 0.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-pro",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -59,6 +59,7 @@
59
59
  :dictData="dictData"
60
60
  :doAction="doAction"
61
61
  :dataInfo="dataInfo"
62
+ :readOnly="readOnly"
62
63
  ></slot>
63
64
  </div>
64
65
  </Card>
@@ -87,6 +88,7 @@ export default {
87
88
  showGrid: true,
88
89
  showTitle: true,
89
90
  dataInfo: {},
91
+ readOnly: false,
90
92
  };
91
93
  },
92
94
  computed: {},
@@ -118,9 +120,20 @@ export default {
118
120
  // break;
119
121
  // }
120
122
  },
123
+ getData() {
124
+ return this.dataInfo;
125
+ },
126
+ getChangeData() {
127
+ return this.dataInfo;
128
+ },
129
+ valueChanged(obj) {
130
+ // console.log("🚀 ~ valueChanged ~ obj:", obj)
131
+ return true;
132
+ },
121
133
  clearData() {},
122
134
  setReadOnly(value) {
123
- // console.log("🚀 ~ setReadOnly ~ value:", value);
135
+ // console.log("🚀 ~ setReadOnly ~ value:", value)
136
+ this.readOnly = value;
124
137
  },
125
138
  doAction(params) {
126
139
  this.$emit("doAction", params);
@@ -224,7 +224,10 @@ export default {
224
224
  getCurlAnchorData() {
225
225
  let tmp = [];
226
226
  this.anchorData.forEach(el => {
227
- if (el.visible) {
227
+ // if (el.visible) {
228
+ // tmp.push(el);
229
+ // }
230
+ if (el.visible && el.name) {
228
231
  tmp.push(el);
229
232
  }
230
233
  });
@@ -293,7 +296,7 @@ export default {
293
296
  }
294
297
  },
295
298
  setShowForm(value, name) {
296
- if (this.$refs[name] && this.$refs[name][0]) {
299
+ if (this.$refs[name] && this.$refs[name][0] && this.$refs[name][0].setShowForm) {
297
300
  this.$refs[name][0].setShowForm(value)
298
301
  }
299
302
  },
@@ -4,7 +4,7 @@
4
4
  <Input ref="condition" :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 100%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
5
5
  </div>
6
6
  <div class="customLayout" :style="style">
7
- <CompatTree ref="tree" v-show="showTree" :data="treeData" :class="myConfig.className" :show-checkbox="myConfig.showCheckBox" @on-select-change="onSelectChange" @on-check-change="onCheckChange" @on-toggle-expand="onToggleExpand" :load-data="loadData"/>
7
+ <CompatTree ref="tree" v-show="showTree" :data="treeData" :class="myConfig.className" @update:data="treeData = $event" :show-checkbox="myConfig.showCheckBox" @on-select-change="onSelectChange" @on-check-change="onCheckChange" @on-toggle-expand="onToggleExpand" :load-data="loadData"/>
8
8
  <SimpleViewGrid v-show="!showTree" v-if="gridReset" ref="grid" :config="gridConfig" :dictData="dictData" @dbclick="dbclick"/>
9
9
  </div>
10
10
  </Card>
package/src/index.js CHANGED
@@ -181,6 +181,8 @@ const components = {
181
181
  mListDetailsV3
182
182
  };
183
183
 
184
+ import { setupCopyFormatRestore } from './plugins/copyFormatRestore'
185
+
184
186
  const iview = {
185
187
  ...components
186
188
  };
@@ -190,6 +192,8 @@ const iview = {
190
192
  const install = function(app, opts = {}) {
191
193
  if (install.installed) return;
192
194
 
195
+ setupCopyFormatRestore()
196
+
193
197
  VXETable.install(app)
194
198
  app.config.globalProperties.$utils = XEUtils;
195
199
 
@@ -0,0 +1,41 @@
1
+ /**
2
+ * 千分位金额复制还原 - 全局监听
3
+ *
4
+ * 原理:监听 document 的 copy 事件,检测选中文本是否为千分位格式数字,
5
+ * 是则去除逗号后写入剪贴板,否则走浏览器默认行为。
6
+ */
7
+ export function setupCopyFormatRestore() {
8
+ document.addEventListener("copy", (e) => {
9
+ let selectedText = window.getSelection().toString();
10
+ // 去掉前后空格
11
+ selectedText = selectedText.trim();
12
+ // 不含逗号,无需处理
13
+ if (!selectedText.includes(",")) return;
14
+ // 严格匹配:完整千分位格式
15
+ // 匹配:1,234,567.89 / 3,000 / 123,456
16
+ const isFullFormatted = /^\d{1,3}(,\d{3})*(\.\d+)?$/.test(selectedText);
17
+ // 宽松匹配:包含千分位片段(部分选中场景)
18
+ // 匹配:1,23 / 3,000. / ,567 排除:中文逗号、非数字内容
19
+ const isPartialFormatted =
20
+ /\d+,\d{1,3}/.test(selectedText) && !/[^\d,.]/.test(selectedText);
21
+ // 不是千分位格式,走默认行为
22
+ if (!isFullFormatted && !isPartialFormatted) return;
23
+ // 去除逗号
24
+ e.preventDefault();
25
+ let stripped = selectedText.replace(/,/g, "");
26
+ // 末尾小数点,去掉(如 "3,000." → "3000")
27
+ if (stripped.endsWith(".")) {
28
+ stripped = stripped.slice(0, -1);
29
+ }
30
+ // 前置小数点,补零(如 ".89" → "0.89")
31
+ if (stripped.startsWith(".")) {
32
+ stripped = "0" + stripped;
33
+ }
34
+ // 去逗号后无有效数字,回退原文本
35
+ if (!stripped || !/\d/.test(stripped)) {
36
+ e.clipboardData.setData("text/plain", selectedText);
37
+ return;
38
+ }
39
+ e.clipboardData.setData("text/plain", stripped);
40
+ });
41
+ }