+
+
{{ item.value }}
{{ item.value }}
+
+
@@ -90,7 +92,7 @@ const dataSources = computed(() => dataSourceService?.get('dataSources') || []);
const setDisplayState = () => {
displayState.value = [];
- const matches = state.value.matchAll(/\{\{([\s\S]+?)\}\}/g);
+ const matches = state.value.matchAll(/\$\{([\s\S]+?)\}/g);
let index = 0;
for (const match of matches) {
if (typeof match.index === 'undefined') break;
@@ -195,7 +197,7 @@ const getSelectionStart = () => {
* @param leftCurlyBracketIndex {字符索引
*/
const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex: number) =>
- leftCurlyBracketIndex > -1 && leftCurlyBracketIndex === getSelectionStart() - 1;
+ leftCurlyBracketIndex > 0 && leftCurlyBracketIndex === getSelectionStart() - 1;
/**
* 当前输入的是.
@@ -213,7 +215,7 @@ const dsQuerySearch = (queryString: string, leftCurlyBracketIndex: number, cb: (
if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
// 当前输入的是{
result = dataSources.value;
- } else if (leftCurlyBracketIndex > -1) {
+ } else if (leftCurlyBracketIndex > 0) {
// 当前输入的是{xx
const queryName = queryString.substring(leftCurlyBracketIndex + 1).toLowerCase();
result = dataSources.value.filter((ds) => ds.title?.toLowerCase().includes(queryName) || ds.id.includes(queryName));
@@ -299,7 +301,7 @@ const querySearch = (queryString: string, cb: (data: { value: string }[]) => voi
const curQueryString = queryString.substring(0, selectionStart);
const fieldKeyStringLastIndex = curQueryString.lastIndexOf('.');
- const dsKeyStringLastIndex = curQueryString.lastIndexOf('{');
+ const dsKeyStringLastIndex = curQueryString.lastIndexOf('${') + 1;
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
@@ -321,7 +323,7 @@ const selectHandler = async ({ value, type }: { value: string; type: 'dataSource
let startText = inputText.substring(0, selectionStart);
const dotIndex = startText.lastIndexOf('.');
- const leftCurlyBracketIndex = startText.lastIndexOf('{');
+ const leftCurlyBracketIndex = startText.lastIndexOf('${') + 1;
const endText = inputText.substring(selectionStart);
@@ -336,7 +338,6 @@ const selectHandler = async ({ value, type }: { value: string; type: 'dataSource
if (!isRightCurlyBracket(selectionStart + 1)) {
suggestText = `${suggestText}}`;
}
- suggestText = `{${suggestText}}`;
} else if (!curCharIsDot(dotIndex)) {
startText = startText.substring(0, dotIndex + 1);
}
@@ -345,10 +346,10 @@ const selectHandler = async ({ value, type }: { value: string; type: 'dataSource
await nextTick();
- // 由于选择数据源时会在后面补全}}, 所以光标要前移2位
+ // 由于选择数据源时会在后面补全}, 所以光标要前移2位
let newSelectionStart = 0;
if (isDataSource) {
- newSelectionStart = leftCurlyBracketIndex + suggestText.length - 1;
+ newSelectionStart = leftCurlyBracketIndex + suggestText.length;
} else {
newSelectionStart = dotIndex + suggestText.length + 1;
}
diff --git a/packages/editor/src/theme/data-source-input.scss b/packages/editor/src/theme/data-source-input.scss
new file mode 100644
index 00000000..9c39f1f7
--- /dev/null
+++ b/packages/editor/src/theme/data-source-input.scss
@@ -0,0 +1,18 @@
+.tmagic-data-source-input-text {
+ .el-input__wrapper.tmagic-data-source-input-text-wrapper {
+ overflow: hidden;
+ padding-right: 30px;
+ }
+
+ .el-input__inner {
+ display: flex;
+ align-items: center;
+ overflow: hidden;
+ white-space: nowrap;
+ }
+
+ .tmagic-data-source-input-icon {
+ position: absolute;
+ right: 7px;
+ }
+}
diff --git a/packages/editor/src/theme/theme.scss b/packages/editor/src/theme/theme.scss
index df06ccfc..fb9425ce 100644
--- a/packages/editor/src/theme/theme.scss
+++ b/packages/editor/src/theme/theme.scss
@@ -19,4 +19,5 @@
@import "./dep-list.scss";
@import "./data-source.scss";
@import "./data-source-fields.scss";
+@import "./data-source-input.scss";
@import "./key-value.scss";
diff --git a/packages/editor/src/utils/props.ts b/packages/editor/src/utils/props.ts
index c6c4405e..b88d47d4 100644
--- a/packages/editor/src/utils/props.ts
+++ b/packages/editor/src/utils/props.ts
@@ -112,6 +112,7 @@ export const fillConfig = (config: FormConfig = []) => [
{
name: 'borderWidth',
text: '宽度',
+ defaultValue: '0',
},
{
name: 'borderColor',
@@ -122,6 +123,7 @@ export const fillConfig = (config: FormConfig = []) => [
name: 'borderStyle',
text: '样式',
type: 'select',
+ defaultValue: 'none',
options: [
{ text: 'none', value: 'none' },
{ text: 'hidden', value: 'hidden' },
diff --git a/playground/src/configs/dsl.ts b/playground/src/configs/dsl.ts
index 3e057c38..44825977 100644
--- a/playground/src/configs/dsl.ts
+++ b/playground/src/configs/dsl.ts
@@ -208,7 +208,7 @@ export default {
fontWeight: '',
},
name: '按钮',
- text: '{{ds_b64c92b5.text}}',
+ text: '${ds_b64c92b5.text}',
multiple: true,
events: [
{