提交 4bb9ccb2 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 44035a82
<template> <template>
<div :class="className"> <div :class="curClassName" :style="curStyle">
<template v-if="QRCodeConfig.url"> <template v-if="QRCodeConfig.url">
<ibiz-qr-code <ibiz-qr-code
:size="QRCodeConfig.size" :size="QRCodeConfig.size"
...@@ -40,13 +40,32 @@ export default class AppPresetQrCode extends Vue { ...@@ -40,13 +40,32 @@ export default class AppPresetQrCode extends Vue {
*/ */
@Prop() public name!: string; @Prop() public name!: string;
/**
* 布局模型详情
*
* @type {*}
* @memberof AppPresetQrCode
*/
@Prop() public layoutModelDetails: any;
/** /**
* 类名 * 类名
* *
* @memberof AppPresetQrCode * @memberof AppPresetQrCode
*/ */
get className(): string { get curClassName(){
return `app-preset-qrcode ${this.name}`; const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-qrcode ${this.name} ${layoutModel.sysCss}`;
}
/**
* 当前容器样式
*
* @memberof AppPresetQrCode
*/
get curStyle(){
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
} }
/** /**
......
<template> <template>
<el-switch :class="className" v-model="curValue" :disabled="disabled"></el-switch> <el-switch :class="curClassName" :style="curStyle" v-model="curValue" :disabled="disabled"></el-switch>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -24,20 +24,41 @@ export default class AppPresetSwitch extends Vue { ...@@ -24,20 +24,41 @@ export default class AppPresetSwitch extends Vue {
@Prop() public name!: string @Prop() public name!: string
/** /**
* 名称 * 布局模型详情
* *
* @type {*} * @type {*}
* @memberof AppPresetSwitch * @memberof AppPresetSwitch
*/ */
@Prop({default: false}) public disabled?: boolean @Prop() public layoutModelDetails: any;
/** /**
* 类名 * 类名
* *
* @memberof AppPresetSwitch * @memberof AppPresetSwitch
*/ */
get className(): string { get curClassName(){
return `app-preset-switch ${this.name}`; const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-switch ${this.name} ${layoutModel.sysCss}`;
}
/**
* 当前容器样式
*
* @memberof AppPresetSwitch
*/
get curStyle(){
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
}
/**
* 禁用
*
* @memberof AppPresetSwitch
*/
get disabled(){
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.disabled;
} }
/** /**
......
<template> <template>
<div :class="className"> <div :class="curClassName" :style="curStyle">
<el-input v-model="curValue" :placeholder="placeholder"></el-input> <el-input v-model="curValue" :placeholder="placeholder"></el-input>
</div> </div>
</template> </template>
...@@ -26,20 +26,52 @@ export default class AppPresetTextInput extends Vue { ...@@ -26,20 +26,52 @@ export default class AppPresetTextInput extends Vue {
@Prop() public name!: string; @Prop() public name!: string;
/** /**
* 禁用 * 布局模型详情
* *
* @type {boolean} * @type {*}
* @memberof AppPresetTextInput * @memberof AppPresetSwitch
*/ */
@Prop() public disabled?: boolean; @Prop() public layoutModelDetails: any;
/** /**
* 占位文本 * 类名
* *
* @type {string} * @memberof AppPresetSwitch
* @memberof AppPresetTextInput
*/ */
@Prop({default: ''}) public placeholder?: string; get curClassName() {
const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-text-input ${this.name} ${layoutModel.sysCss}`;
}
/**
* 禁用
*
* @memberof AppPresetSwitch
*/
get disabled() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.disabled;
}
/**
* 当前容器样式
*
* @memberof AppPresetSwitch
*/
get curStyle() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
}
/**
* 占位提示
*
* @memberof AppPresetSwitch
*/
get placeholder() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.placeholder || '';
}
/** /**
* 类名 * 类名
......
<template> <template>
<div :class="className"> <div :class="curClassName" :style="curStyle">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
...@@ -18,13 +18,32 @@ export default class AppPresetCaption extends Vue { ...@@ -18,13 +18,32 @@ export default class AppPresetCaption extends Vue {
*/ */
@Prop() public name!: string; @Prop() public name!: string;
/**
* 布局模型详情
*
* @type {*}
* @memberof AppPresetCaption
*/
@Prop() public layoutModelDetails: any;
/** /**
* 类名 * 类名
* *
* @memberof AppPresetText * @memberof AppPresetCaption
*/
get curClassName(){
const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-caption ${this.name} ${layoutModel.sysCss}`;
}
/**
* 当前容器样式
*
* @memberof AppPresetCaption
*/ */
get className(): string { get curStyle(){
return `app-preset-caption ${this.name}`; const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
} }
} }
</script> </script>
......
<template> <template>
<div :class="className"> <div :class="curClassName" :style="curStyle">
<!-- 直接内容类型 --> <!-- 直接内容类型 -->
<template v-if="Object.is(contentType, 'RAW')"> <template v-if="Object.is(contentType, 'RAW')">
<template v-if="Object.is(renderMode, 'TEXT')"> <template v-if="Object.is(renderMode, 'TEXT')">
<span :style="cssStyle">{{ content }}</span> <span :style="contentStyle">{{ content }}</span>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING1')"> <template v-else-if="Object.is(renderMode, 'HEADING1')">
<h1 :style="cssStyle">{{ content }}</h1> <h1 :style="contentStyle">{{ content }}</h1>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING2')"> <template v-else-if="Object.is(renderMode, 'HEADING2')">
<h2 :style="cssStyle">{{ content }}</h2> <h2 :style="contentStyle">{{ content }}</h2>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING3')"> <template v-else-if="Object.is(renderMode, 'HEADING3')">
<h3 :style="cssStyle">{{ content }}</h3> <h3 :style="contentStyle">{{ content }}</h3>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING4')"> <template v-else-if="Object.is(renderMode, 'HEADING4')">
<h4 :style="cssStyle">{{ content }}</h4> <h4 :style="contentStyle">{{ content }}</h4>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING5')"> <template v-else-if="Object.is(renderMode, 'HEADING5')">
<h5 :style="cssStyle">{{ content }}</h5> <h5 :style="contentStyle">{{ content }}</h5>
</template> </template>
<template v-else-if="Object.is(renderMode, 'HEADING6')"> <template v-else-if="Object.is(renderMode, 'HEADING6')">
<h6 :style="cssStyle">{{ content }}</h6> <h6 :style="contentStyle">{{ content }}</h6>
</template> </template>
<template v-else-if="Object.is(renderMode, 'PARAGRAPH')"> <template v-else-if="Object.is(renderMode, 'PARAGRAPH')">
<p :style="cssStyle">{{ content }}</p> <p :style="contentStyle">{{ content }}</p>
</template> </template>
</template> </template>
<!-- 图片类型 --> <!-- 图片类型 -->
<template v-else-if="Object.is(contentType, 'IMAGE')"> <template v-else-if="Object.is(contentType, 'IMAGE')">
<img :style="cssStyle" v-if="imgUrl" :src="imgUrl" /> <img :style="contentStyle" v-if="imagePath" :src="imagePath" />
<i :style="cssStyle" v-else :class="imageClass ? imageClass : ''"></i> <i :style="contentStyle" v-else :class="cssClass"></i>
</template> </template>
<!-- HTML类型 --> <!-- HTML类型 -->
<template v-else-if="Object.is(contentType, 'HTML')"> <template v-else-if="Object.is(contentType, 'HTML')">
<div :style="cssStyle" v-html="content" /> <div :style="contentStyle" v-html="content" />
</template> </template>
<!-- MARKDOWN类型 --> <!-- MARKDOWN类型 -->
<template v-else-if="Object.is(contentType, 'MARKDOWN')"> <template v-else-if="Object.is(contentType, 'MARKDOWN')">
MARKDOWN暂未支持 MARKDOWN暂未支持
<!-- <app-markdown-editor :style="cssStyle" mode="PREVIEWONLY" :itemValue="value"></app-markdown-editor> --> <!-- <app-markdown-editor :style="contentStyle" mode="PREVIEWONLY" :itemValue="value"></app-markdown-editor> -->
</template> </template>
</div> </div>
</template> </template>
...@@ -67,109 +67,111 @@ export default class AppPresetText extends Vue { ...@@ -67,109 +67,111 @@ export default class AppPresetText extends Vue {
@Prop() public name!: string; @Prop() public name!: string;
/** /**
* 内容类型 * 布局模型详情
* *
* @type {string} * @type {*}
* @memberof AppPresetText * @memberof AppPresetTitle
*/ */
@Prop({ default: 'RAW' }) public contentType!: 'RAW' | 'HTML' | 'IMAGE' | 'MARKDOWN'; @Prop() public layoutModelDetails: any;
/** /**
* 绘制模式 * 图标
* *
* @type {string}
* @memberof AppPresetText * @memberof AppPresetText
*/ */
@Prop({ default: 'TEXT' }) public renderMode!: 'TEXT' | 'HEADING1' | 'HEADING2' | 'HEADING3' | 'HEADING4' | 'HEADING5' | 'HEADING6' | 'PARAGRAPH'; @Prop() public imageClass?: string;
/** /**
* 内容样式 * 图片路径
* *
* @type {string}
* @memberof AppPresetText * @memberof AppPresetText
*/ */
@Prop() public contentStyle?: string; get imagePath() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.imagePath;
}
/** /**
* 预置类型 * 图标
* *
* @type {string} * @memberof AppPresetTitle
* @memberof AppPresetText
*/ */
@Prop({ default: 'STATIC_TEXT' }) public predefinedType!: 'FIELD_TEXT_DYNAMIC' | 'STATIC_LABEL' | 'STATIC_TEXT'; get cssClass() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.iconcls;
}
/** /**
* 图标 * 类名
* *
* @memberof AppPresetText * @memberof AppPresetTitle
*/ */
@Prop() public imageClass?: string; get curClassName() {
const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-text app-preset-text--${layoutModel.contentType.toLowerCase()} ${this.name} ${layoutModel.sysCss}`;
}
/** /**
* 图片路径 * 当前容器样式
* *
* @memberof AppPresetText * @memberof AppPresetTitle
*/ */
@Prop() public imgUrl?: string; get curStyle() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
}
/** /**
* * 绘制模
* *
* @memberof AppPresetText * @memberof AppPresetTitle
*/ */
protected cssStyle: string = ''; get renderMode() {
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.renderMode;
}
/** /**
* 内容 * 内容
* *
* @memberof AppPresetText * @memberof AppPresetText
*/ */
get content(): string { get content(): string {
const layoutModel = this.layoutModelDetails[this.name];
let content = this.value; let content = this.value;
if (this.contentType == 'HTML') { if (layoutModel.predefinedType !== 'FIELD_TEXT_DYNAMIC') {
const items = content.match(/\{{(.+?)\}}/g); if (layoutModel.contentType == 'ROW') {
if (items) { content = layoutModel.rawContent;
items.forEach((item: string) => { } else if (layoutModel.contentType == 'HTML') {
content = content.replace(/\{{(.+?)\}}/, eval(item.substring(2, item.length - 2))); content = layoutModel.htmlContent;
}); const items = content.match(/\{{(.+?)\}}/g);
if (items) {
items.forEach((item: string) => {
content = content.replace(/\{{(.+?)\}}/, eval(item.substring(2, item.length - 2)));
});
}
content = content.replaceAll('&lt;', '<');
content = content.replaceAll('&gt;', '>');
content = content.replaceAll('&amp;nbsp;', ' ');
content = content.replaceAll('&nbsp;', ' ');
} }
content = content.replaceAll('&lt;', '<');
content = content.replaceAll('&gt;', '>');
content = content.replaceAll('&amp;nbsp;', ' ');
content = content.replaceAll('&nbsp;', ' ');
} }
return content; return content;
} }
/** /**
* 类名 * 内容样式
*
* @memberof AppPresetText
*/
get className(): string {
return `app-preset-text app-preset-text--${this.contentType.toLowerCase()} ${this.name}`;
}
/**
* Vue生命周期 --- Created
*
* @memberof AppPresetText
*/
created() {
this.handleText();
}
/**
* 处理文本
* *
* @memberof AppPresetText * @memberof AppPresetText
*/ */
protected handleText() { get contentStyle(): string {
if (this.predefinedType === 'STATIC_LABEL') { const layoutModel = this.layoutModelDetails[this.name];
this.cssStyle += "white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"; let contentStyle = layoutModel.contentStyle;
if (layoutModel.predefinedType === 'STATIC_LABEL') {
contentStyle += "white-space: nowrap;overflow: hidden;text-overflow: ellipsis;";
} }
return contentStyle;
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
......
<template> <template>
<h1 :class="className">{{ curValue }}</h1> <h1 :class="curClassName" :style="curStyle">{{ curValue }}</h1>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -16,13 +16,32 @@ export default class AppPresetTitle extends Vue { ...@@ -16,13 +16,32 @@ export default class AppPresetTitle extends Vue {
*/ */
@Prop() public name!: string; @Prop() public name!: string;
/**
* 布局模型详情
*
* @type {*}
* @memberof AppPresetTitle
*/
@Prop() public layoutModelDetails: any;
/** /**
* 类名 * 类名
* *
* @memberof AppPresetTitle * @memberof AppPresetTitle
*/ */
get className(): string { get curClassName(){
return `app-preset-title ${this.name}`; const layoutModel = this.layoutModelDetails[this.name];
return `app-preset-title ${this.name} ${layoutModel.sysCss}`;
}
/**
* 当前容器样式
*
* @memberof AppPresetTitle
*/
get curStyle(){
const layoutModel = this.layoutModelDetails[this.name];
return layoutModel.getElementStyle();
} }
/** /**
......
...@@ -27,6 +27,48 @@ export class PanelRawitemModel extends PanelDetailModel { ...@@ -27,6 +27,48 @@ export class PanelRawitemModel extends PanelDetailModel {
*/ */
private readonly viewType: string; private readonly viewType: string;
/**
* 绘制模式
*
* @private
* @type {('TEXT' | 'HEADING1' | 'HEADING2' | 'HEADING3' | 'HEADING4' | 'HEADING5' | 'HEADING6' | 'PARAGRAPH')}
* @memberof PanelRawitemModel
*/
public renderMode: 'TEXT' | 'HEADING1' | 'HEADING2' | 'HEADING3' | 'HEADING4' | 'HEADING5' | 'HEADING6' | 'PARAGRAPH' = 'TEXT';
/**
* 内容类型
*
* @private
* @type {('RAW' | 'HTML' | 'IMAGE' | 'MARKDOWN')}
* @memberof PanelRawitemModel
*/
public contentType: 'RAW' | 'HTML' | 'IMAGE' | 'MARKDOWN' = 'RAW';
/**
* 内容样式
*
* @type {string}
* @memberof PanelRawitemModel
*/
public contentStyle!: string;
/**
* 直接内容
*
* @type {string}
* @memberof PanelRawitemModel
*/
public rawContent!: string;
/**
* html内容
*
* @type {string}
* @memberof PanelRawitemModel
*/
public htmlContent!: string;
/** /**
* Creates an instance of PanelRawitemModel. * Creates an instance of PanelRawitemModel.
* @param {*} [opts={}] * @param {*} [opts={}]
...@@ -35,6 +77,11 @@ export class PanelRawitemModel extends PanelDetailModel { ...@@ -35,6 +77,11 @@ export class PanelRawitemModel extends PanelDetailModel {
constructor(opts: any = {}) { constructor(opts: any = {}) {
super(opts); super(opts);
this.viewType = opts.viewType; this.viewType = opts.viewType;
this.renderMode = opts.renderMode ? opts.renderMode : 'TEXT';
this.contentType = opts.contentType ? opts.contentType : 'RAW';
this.contentStyle = opts.contentStyle;
this.rawContent = opts.rawContent;
this.htmlContent = opts.htmlContent;
} }
/** /**
...@@ -83,6 +130,4 @@ export class PanelRawitemModel extends PanelDetailModel { ...@@ -83,6 +130,4 @@ export class PanelRawitemModel extends PanelDetailModel {
} }
return false; return false;
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册