pslButton按钮数据调整

This commit is contained in:
fan 2023-10-18 14:42:00 +08:00
parent 3e414e0d8a
commit edd5a97872
6 changed files with 39 additions and 2 deletions

@ -1 +1 @@
Subproject commit 6ca28f502f039fbb5d8b76d9ec42ff96ba7cb2be Subproject commit df8a26fc7f63149b402a16f7c12a7331f7ad6152

View File

@ -18,6 +18,12 @@
@update:model-value="onUpdate" @update:model-value="onUpdate"
label="按钮颜色" label="按钮颜色"
/> />
<q-checkbox
class="q-mt-sm"
v-model="pslButtonModel.isSelfReset"
label="是否自复位"
@update:model-value="onUpdate"
/>
</q-form> </q-form>
</template> </template>

View File

@ -37,6 +37,12 @@ export class PslButtonData extends GraphicDataBase implements IPslButtonData {
set buttonColor(v: pslGraphicData.PslElementColor) { set buttonColor(v: pslGraphicData.PslElementColor) {
this.data.buttonColor = v; this.data.buttonColor = v;
} }
get isSelfReset(): boolean {
return this.data.isSelfReset;
}
set isSelfReset(v: boolean) {
this.data.isSelfReset = v;
}
clone(): PslButtonData { clone(): PslButtonData {
return new PslButtonData(this.data.cloneMessage()); return new PslButtonData(this.data.cloneMessage());
} }

View File

@ -22,6 +22,8 @@ export interface IPslButtonData extends GraphicData {
set code(v: string); set code(v: string);
get buttonColor(): pslGraphicData.PslElementColor; get buttonColor(): pslGraphicData.PslElementColor;
set buttonColor(v: pslGraphicData.PslElementColor); set buttonColor(v: pslGraphicData.PslElementColor);
get isSelfReset(): boolean;
set isSelfReset(v: boolean);
} }
export interface IPslButtonState extends GraphicState { export interface IPslButtonState extends GraphicState {

View File

@ -91,7 +91,7 @@
></relate-device-config> ></relate-device-config>
</q-drawer> </q-drawer>
<q-page-container> <q-page-container style="overflow: hidden">
<div id="draw-app-container"></div> <div id="draw-app-container"></div>
</q-page-container> </q-page-container>

View File

@ -318,6 +318,7 @@ export namespace pslGraphicData {
common?: dependency_1.graphicData.CommonInfo; common?: dependency_1.graphicData.CommonInfo;
code?: string; code?: string;
buttonColor?: PslElementColor; buttonColor?: PslElementColor;
isSelfReset?: boolean;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -331,6 +332,9 @@ export namespace pslGraphicData {
if ("buttonColor" in data && data.buttonColor != undefined) { if ("buttonColor" in data && data.buttonColor != undefined) {
this.buttonColor = data.buttonColor; this.buttonColor = data.buttonColor;
} }
if ("isSelfReset" in data && data.isSelfReset != undefined) {
this.isSelfReset = data.isSelfReset;
}
} }
} }
get common() { get common() {
@ -354,10 +358,17 @@ export namespace pslGraphicData {
set buttonColor(value: PslElementColor) { set buttonColor(value: PslElementColor) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get isSelfReset() {
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
}
set isSelfReset(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>; common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string; code?: string;
buttonColor?: PslElementColor; buttonColor?: PslElementColor;
isSelfReset?: boolean;
}): PslButton { }): PslButton {
const message = new PslButton({}); const message = new PslButton({});
if (data.common != null) { if (data.common != null) {
@ -369,6 +380,9 @@ export namespace pslGraphicData {
if (data.buttonColor != null) { if (data.buttonColor != null) {
message.buttonColor = data.buttonColor; message.buttonColor = data.buttonColor;
} }
if (data.isSelfReset != null) {
message.isSelfReset = data.isSelfReset;
}
return message; return message;
} }
toObject() { toObject() {
@ -376,6 +390,7 @@ export namespace pslGraphicData {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>; common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string; code?: string;
buttonColor?: PslElementColor; buttonColor?: PslElementColor;
isSelfReset?: boolean;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -386,6 +401,9 @@ export namespace pslGraphicData {
if (this.buttonColor != null) { if (this.buttonColor != null) {
data.buttonColor = this.buttonColor; data.buttonColor = this.buttonColor;
} }
if (this.isSelfReset != null) {
data.isSelfReset = this.isSelfReset;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -398,6 +416,8 @@ export namespace pslGraphicData {
writer.writeString(2, this.code); writer.writeString(2, this.code);
if (this.buttonColor != PslElementColor.red) if (this.buttonColor != PslElementColor.red)
writer.writeEnum(4, this.buttonColor); writer.writeEnum(4, this.buttonColor);
if (this.isSelfReset != false)
writer.writeBool(5, this.isSelfReset);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -416,6 +436,9 @@ export namespace pslGraphicData {
case 4: case 4:
message.buttonColor = reader.readEnum(); message.buttonColor = reader.readEnum();
break; break;
case 5:
message.isSelfReset = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }