|
@@ -30,6 +30,7 @@ import {
|
|
} from "vue";
|
|
} from "vue";
|
|
import { any, bool, func, number, object, string } from "vue-types";
|
|
import { any, bool, func, number, object, string } from "vue-types";
|
|
import Slider from "../../formItems/Slider";
|
|
import Slider from "../../formItems/Slider";
|
|
|
|
+import NewColorPicker from "../../formItems/NewColorPicker";
|
|
interface ColumnItem {
|
|
interface ColumnItem {
|
|
label?: string;
|
|
label?: string;
|
|
component?: ((...args: any[]) => any) | Record<string, any>;
|
|
component?: ((...args: any[]) => any) | Record<string, any>;
|
|
@@ -45,8 +46,6 @@ export const TextColor = defineComponent({
|
|
},
|
|
},
|
|
emits: ["change"],
|
|
emits: ["change"],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
- let pickerRef = ref();
|
|
|
|
-
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
color: props.value,
|
|
color: props.value,
|
|
});
|
|
});
|
|
@@ -56,29 +55,17 @@ export const TextColor = defineComponent({
|
|
state.color = props.value;
|
|
state.color = props.value;
|
|
}
|
|
}
|
|
);
|
|
);
|
|
- const colorChange = (e: any) => {
|
|
|
|
- const hexa = e.target.value;
|
|
|
|
- emit("change", hexa);
|
|
|
|
- state.color = hexa;
|
|
|
|
|
|
+ const colorChange = (value: string) => {
|
|
|
|
+ emit("change", value);
|
|
|
|
+ state.color = value;
|
|
};
|
|
};
|
|
|
|
|
|
return () => (
|
|
return () => (
|
|
- <div
|
|
|
|
- class={ColorPicker}
|
|
|
|
- onClick={() => {
|
|
|
|
- pickerRef?.value.click();
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <div class="color_picker" style={{ backgroundColor: state.color }}>
|
|
|
|
- <input
|
|
|
|
- type="color"
|
|
|
|
- class="color_input"
|
|
|
|
- ref={pickerRef}
|
|
|
|
- value={state.color}
|
|
|
|
- onInput={_.debounce(colorChange, 300)}
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <NewColorPicker
|
|
|
|
+ value={state.color}
|
|
|
|
+ onChange={colorChange}
|
|
|
|
+ showGradient={false}
|
|
|
|
+ />
|
|
);
|
|
);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
@@ -333,7 +320,6 @@ export const TextStroke = defineComponent({
|
|
}
|
|
}
|
|
);
|
|
);
|
|
const formatVal = (value: any) => {
|
|
const formatVal = (value: any) => {
|
|
- debugger;
|
|
|
|
if (!value) {
|
|
if (!value) {
|
|
state.visible = false;
|
|
state.visible = false;
|
|
state.color = "#666666";
|
|
state.color = "#666666";
|
|
@@ -342,10 +328,20 @@ export const TextStroke = defineComponent({
|
|
}
|
|
}
|
|
state.visible = true;
|
|
state.visible = true;
|
|
const colorReg = /#[a-zA-Z0-9]{6}/g;
|
|
const colorReg = /#[a-zA-Z0-9]{6}/g;
|
|
- const color = value.match(colorReg)[0];
|
|
|
|
|
|
+ let color = value.match(colorReg);
|
|
|
|
+ if (color) {
|
|
|
|
+ color = color[0];
|
|
|
|
+ } else {
|
|
|
|
+ color = "#666666";
|
|
|
|
+ }
|
|
state.color = color;
|
|
state.color = color;
|
|
const widthReg = /\d+px/g;
|
|
const widthReg = /\d+px/g;
|
|
- const width = value.match(widthReg)[0];
|
|
|
|
|
|
+ let width = value.match(widthReg);
|
|
|
|
+ if (width) {
|
|
|
|
+ width = width[0];
|
|
|
|
+ } else {
|
|
|
|
+ width = 1;
|
|
|
|
+ }
|
|
state.width = parseInt(width);
|
|
state.width = parseInt(width);
|
|
};
|
|
};
|
|
const colorChange = (v: string) => {
|
|
const colorChange = (v: string) => {
|
|
@@ -357,7 +353,7 @@ export const TextStroke = defineComponent({
|
|
state.visible = checked;
|
|
state.visible = checked;
|
|
buildValueSub();
|
|
buildValueSub();
|
|
};
|
|
};
|
|
- const widthChange = (e: number) => {
|
|
|
|
|
|
+ const widthChange = (e: any) => {
|
|
state.width = e;
|
|
state.width = e;
|
|
buildValueSub();
|
|
buildValueSub();
|
|
};
|
|
};
|
|
@@ -378,17 +374,22 @@ export const TextStroke = defineComponent({
|
|
|
|
|
|
{state.visible && (
|
|
{state.visible && (
|
|
<div class={"flex-1 px-20px"}>
|
|
<div class={"flex-1 px-20px"}>
|
|
- <Slider
|
|
|
|
- min={1}
|
|
|
|
- max={5}
|
|
|
|
- value={state.width}
|
|
|
|
- step={1}
|
|
|
|
- onChange={widthChange}
|
|
|
|
- />
|
|
|
|
|
|
+ <Tooltip title={"描边宽度"} placement="top">
|
|
|
|
+ <InputNumber
|
|
|
|
+ class={StrokeStyle}
|
|
|
|
+ min={1}
|
|
|
|
+ max={5}
|
|
|
|
+ step={1}
|
|
|
|
+ value={state.width}
|
|
|
|
+ onChange={widthChange}
|
|
|
|
+ />
|
|
|
|
+ </Tooltip>
|
|
</div>
|
|
</div>
|
|
)}
|
|
)}
|
|
</div>
|
|
</div>
|
|
- <TextColor value={state.color} onChange={colorChange} />
|
|
|
|
|
|
+ <Tooltip title={"描边颜色"} placement="top">
|
|
|
|
+ <TextColor value={state.color} onChange={colorChange} />
|
|
|
|
+ </Tooltip>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
@@ -522,32 +523,9 @@ const currStyle = css`
|
|
color: @inf-primary-color;
|
|
color: @inf-primary-color;
|
|
}
|
|
}
|
|
`;
|
|
`;
|
|
-const ColorPicker = css`
|
|
|
|
- position: relative;
|
|
|
|
- width: 32px;
|
|
|
|
- height: 32px;
|
|
|
|
- border-radius: 2px;
|
|
|
|
- cursor: pointer;
|
|
|
|
- .color_picker {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 100%;
|
|
|
|
- border-radius: 2px;
|
|
|
|
- border: 1px solid transparent;
|
|
|
|
- &:focus,
|
|
|
|
- &:hover {
|
|
|
|
- border-color: @inf-primary-color;
|
|
|
|
- box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- .color_input {
|
|
|
|
- position: absolute;
|
|
|
|
- left: 0;
|
|
|
|
- bottom: 0;
|
|
|
|
- width: 100%;
|
|
|
|
- height: 0;
|
|
|
|
- padding: 0;
|
|
|
|
- border: none;
|
|
|
|
- visibility: hidden;
|
|
|
|
|
|
+const StrokeStyle = css`
|
|
|
|
+ input {
|
|
|
|
+ height: 28px;
|
|
}
|
|
}
|
|
`;
|
|
`;
|
|
|
|
|