|
@@ -1,17 +1,19 @@
|
|
|
import {
|
|
|
+ IconLineHeight,
|
|
|
IconTextCenter,
|
|
|
IconTextJustify,
|
|
|
IconTextLeft,
|
|
|
IconTextRight,
|
|
|
- IconLineHeight,
|
|
|
} from "@/assets/icons";
|
|
|
import { css } from "@linaria/core";
|
|
|
-import { Button, Dropdown, Menu, Tooltip } from "ant-design-vue";
|
|
|
+import { Button, Dropdown, InputNumber, Menu, Tooltip } from "ant-design-vue";
|
|
|
|
|
|
-import { defineComponent, onMounted } from "vue";
|
|
|
-import { string } from "vue-types";
|
|
|
import Pickr from "@simonwep/pickr";
|
|
|
import "@simonwep/pickr/dist/themes/nano.min.css";
|
|
|
+import { defineComponent, onMounted, reactive } from "vue";
|
|
|
+import { any, string } from "vue-types";
|
|
|
+import Select from "@queenjs-modules/queditor/components/FormUI/Items/Select";
|
|
|
+
|
|
|
export const TextColor = defineComponent({
|
|
|
props: {
|
|
|
value: string().def("#666666"),
|
|
@@ -19,7 +21,6 @@ export const TextColor = defineComponent({
|
|
|
emits: ["change"],
|
|
|
setup(props, { emit }) {
|
|
|
let picker: any = null;
|
|
|
-
|
|
|
function initPicker() {
|
|
|
picker = Pickr.create({
|
|
|
el: ".color_picker",
|
|
@@ -68,54 +69,7 @@ export const TextColor = defineComponent({
|
|
|
);
|
|
|
},
|
|
|
});
|
|
|
-const ColorPicker = css`
|
|
|
- position: relative;
|
|
|
- width: 32px;
|
|
|
- height: 32px;
|
|
|
- border-radius: 2px;
|
|
|
- cursor: pointer;
|
|
|
- .pickr {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
|
|
|
- .pcr-button {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- border: 1px solid transparent;
|
|
|
- }
|
|
|
- border-radius: 2px;
|
|
|
- input {
|
|
|
- &:focus,
|
|
|
- &.pcr-active {
|
|
|
- border-color: @inf-primary-color;
|
|
|
- box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
- }
|
|
|
- }
|
|
|
- button {
|
|
|
- &:focus,
|
|
|
- &.pcr-active {
|
|
|
- border-color: @inf-primary-color;
|
|
|
- box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- .pcr-app {
|
|
|
- input {
|
|
|
- &:focus,
|
|
|
- &.pcr-active {
|
|
|
- border-color: @inf-primary-color;
|
|
|
- box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
- }
|
|
|
- }
|
|
|
- button {
|
|
|
- &:focus,
|
|
|
- &.pcr-active {
|
|
|
- border-color: @inf-primary-color;
|
|
|
- box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-`;
|
|
|
export const AlignComp = defineComponent({
|
|
|
props: {
|
|
|
value: string<"left" | "right" | "center" | "justify">().def("left"),
|
|
@@ -213,6 +167,127 @@ export const LineHeightComp = defineComponent({
|
|
|
);
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+export const FontStyleComp = defineComponent({
|
|
|
+ props: {
|
|
|
+ icon: any(),
|
|
|
+ value: any(),
|
|
|
+ },
|
|
|
+ emits: ["change"],
|
|
|
+ setup(props, { emit }) {
|
|
|
+ const state = reactive({
|
|
|
+ isOn: props.value || false,
|
|
|
+ });
|
|
|
+ const triggerStyle = () => {
|
|
|
+ state.isOn = !state.isOn;
|
|
|
+ emit("change", state.isOn);
|
|
|
+ };
|
|
|
+ return () => (
|
|
|
+ <Button
|
|
|
+ type="text"
|
|
|
+ class={state.isOn ? currStyle : null}
|
|
|
+ icon={props.icon}
|
|
|
+ onClick={triggerStyle}
|
|
|
+ ></Button>
|
|
|
+ );
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+export const FontFamily = defineComponent({
|
|
|
+ props: {
|
|
|
+ value: any(),
|
|
|
+ },
|
|
|
+ emits: ["change"],
|
|
|
+ setup(props, { emit }) {
|
|
|
+ const options = [
|
|
|
+ { label: "默认字体", value: "" },
|
|
|
+ { label: "宋体", value: "宋体,Songti,STSong,serif" },
|
|
|
+ { label: "黑体", value: "黑体,Heiti,STHeiti,sans-serif" },
|
|
|
+ { label: "仿宋", value: "仿宋,FangSong,STFangsong,serif" },
|
|
|
+ { label: "楷体", value: "楷体,KaiTi,STKaiti,sans-serif" },
|
|
|
+ ];
|
|
|
+ return () => (
|
|
|
+ <Select
|
|
|
+ options={options}
|
|
|
+ value={props.value || ""}
|
|
|
+ onChange={(v) => {
|
|
|
+ emit("change", v);
|
|
|
+ }}
|
|
|
+ ></Select>
|
|
|
+ );
|
|
|
+ },
|
|
|
+});
|
|
|
+export const FontSize = defineComponent({
|
|
|
+ props: {
|
|
|
+ value: any(),
|
|
|
+ },
|
|
|
+ emits: ["change"],
|
|
|
+ setup(props, { emit }) {
|
|
|
+ return () => (
|
|
|
+ <InputNumber
|
|
|
+ defaultValue={12}
|
|
|
+ min={12}
|
|
|
+ max={60}
|
|
|
+ value={parseInt(props.value) || 12}
|
|
|
+ onChange={(value: any) => {
|
|
|
+ emit("change", value + "px");
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ },
|
|
|
+});
|
|
|
const currStyle = css`
|
|
|
color: @inf-primary-color;
|
|
|
+ &:hover,
|
|
|
+ &:focus {
|
|
|
+ color: @inf-primary-color;
|
|
|
+ }
|
|
|
+`;
|
|
|
+const ColorPicker = css`
|
|
|
+ position: relative;
|
|
|
+ width: 32px;
|
|
|
+ height: 32px;
|
|
|
+ border-radius: 2px;
|
|
|
+ cursor: pointer;
|
|
|
+ .pickr {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .pcr-button {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ border: 1px solid transparent;
|
|
|
+ }
|
|
|
+ border-radius: 2px;
|
|
|
+ input {
|
|
|
+ &:focus,
|
|
|
+ &.pcr-active {
|
|
|
+ border-color: @inf-primary-color;
|
|
|
+ box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ button {
|
|
|
+ &:focus,
|
|
|
+ &.pcr-active {
|
|
|
+ border-color: @inf-primary-color;
|
|
|
+ box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pcr-app {
|
|
|
+ input {
|
|
|
+ &:focus,
|
|
|
+ &.pcr-active {
|
|
|
+ border-color: @inf-primary-color;
|
|
|
+ box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ button {
|
|
|
+ &:focus,
|
|
|
+ &.pcr-active {
|
|
|
+ border-color: @inf-primary-color;
|
|
|
+ box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
`;
|