diff --git a/CHANGELOG.md b/CHANGELOG.md index 6253c4f74ac458e15220907cd4bef3ea1d3b3f26..30446478e409514f4d7f98e6368a38cc8d8f9312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ ### 💐 同时自动更新 GitHub Pages 同步 Gitee; ### 💐 感谢各位贡献者的支持。 🔥 +## 0.0.57-beta23(2024-05-17) + 01. 🌈 新增支持 添加 selectElementsByField 属性,通过传入field的字符串数组选中文本类型的元素 + ## 0.0.57-beta22(2024-05-13)
diff --git a/src/demo/design/index.vue b/src/demo/design/index.vue index 8b6e4ddc07e7b0cf81e255088bff7270c1d44977..a6c683e3c4de9a616eafc41d201bc34d7f4bd1e1 100644 --- a/src/demo/design/index.vue +++ b/src/demo/design/index.vue @@ -113,6 +113,9 @@ 获取选中元素 + + 设置元素选中 + 选中元素字体12pt @@ -947,6 +950,9 @@ export default { let els = hiprintTemplate.getSelectEls(); console.log(els) }, + setEleSelectByField(){ + hiprintTemplate.selectElementsByField(['name']) + }, updateFontSize() { hiprintTemplate.updateOption('fontSize', 12); }, diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 631beb1387917fd757177cdcf9dae722f7e3438a..9da26c46ec18e9bb261e53de400a3e5a75b05152 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -10877,6 +10877,21 @@ var hiprint = function (t) { .call(designTarget, {}) }) }, + t.prototype.selectElementsByField = function (fieldsArray){ + var hiPrintEntity = this + var t = $ + hiPrintEntity.editingPanel.printElements.forEach((e, index) => { + if(fieldsArray && fieldsArray.includes(e.options.field)){ + let designTarget = e.designTarget + designTarget.children("div[panelindex]").addClass("selected") + designTarget.children().last().css({ + display: "block" + }) + designTarget = designTarget[0] + t.data(designTarget, "hidraggable").options.onBeforeSelectAllDrag.call(designTarget,{}) + } + }) + }, t.prototype.updateOption = function (option, v) { // 批量更新参数 var elements = this.getSelectEls(); if (elements && elements.length) {