diff --git a/packages/form/package.json b/packages/form/package.json index 9db7bb28..7cdf994f 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -43,6 +43,7 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", + "@popperjs/core": "^2.11.8", "lodash-es": "^4.17.21", "sortablejs": "^1.15.2" }, @@ -61,8 +62,8 @@ "peerDependencies": { "@tmagic/design": "workspace:*", "@tmagic/utils": "workspace:*", - "vue": "^3.4.35", - "typescript": "*" + "typescript": "*", + "vue": "^3.4.35" }, "peerDependenciesMeta": { "typescript": { diff --git a/packages/form/src/fields/Text.vue b/packages/form/src/fields/Text.vue index 2906ad0b..933eec6a 100644 --- a/packages/form/src/fields/Text.vue +++ b/packages/form/src/fields/Text.vue @@ -1,43 +1,48 @@ diff --git a/packages/form/src/theme/text.scss b/packages/form/src/theme/text.scss index baddc5f4..acc31dbc 100644 --- a/packages/form/src/theme/text.scss +++ b/packages/form/src/theme/text.scss @@ -4,3 +4,59 @@ width: 100%; line-height: 1.4; } + +.tmagic-form-text-popper { + min-width: 150px; + line-height: 1.4; + background-color: #fff; + box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12); + color: #606266; + border: 1px solid #e4e7ed; + border-radius: 4px; + font-size: 14px; + overflow-wrap: break-word; + box-sizing: border-box; + padding: 10px; + + &:focus { + outline: none; + } +} + +.tmagic-form-text-popper[data-popper-placement^="top"] + > .tmagic-form-text-popper-arrow { + bottom: -4px; +} + +.tmagic-form-text-popper[data-popper-placement^="bottom"] + > .tmagic-form-text-popper-arrow { + top: -4px; +} + +.tmagic-form-text-popper[data-popper-placement^="left"] + > .tmagic-form-text-popper-arrow { + right: -4px; +} + +.tmagic-form-text-popper[data-popper-placement^="right"] + > .tmagic-form-text-popper-arrow { + left: -4px; +} + +.tmagic-form-text-popper-arrow, +.tmagic-form-text-popper-arrow::before { + position: absolute; + width: 8px; + height: 8px; + background: inherit; +} + +.tmagic-form-text-popper-arrow { + visibility: hidden; +} + +.tmagic-form-text-popper-arrow::before { + visibility: visible; + content: ""; + transform: rotate(45deg); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6275a6b..d5051c19 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -426,6 +426,9 @@ importers: '@element-plus/icons-vue': specifier: ^2.3.1 version: 2.3.1(vue@3.4.35(typescript@5.5.4)) + '@popperjs/core': + specifier: ^2.11.8 + version: 2.11.8 '@tmagic/design': specifier: workspace:* version: link:../design @@ -3932,6 +3935,7 @@ packages: eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true espree@9.6.1: