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"
label="按钮颜色"
/>
<q-checkbox
class="q-mt-sm"
v-model="pslButtonModel.isSelfReset"
label="是否自复位"
@update:model-value="onUpdate"
/>
</q-form>
</template>

View File

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

View File

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

View File

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

View File

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