@houaoran/designer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/components.es.js +11424 -0
- package/dist/components.umd.js +878 -0
- package/dist/index.es.js +39113 -0
- package/dist/index.umd.js +1187 -0
- package/package.json +96 -0
- package/src/components/DragBox.vue +49 -0
- package/src/components/DragTool.vue +235 -0
- package/src/components/EventConfig.vue +557 -0
- package/src/components/FcDesigner.vue +2569 -0
- package/src/components/FcTitle.vue +69 -0
- package/src/components/FetchConfig.vue +415 -0
- package/src/components/FieldInput.vue +371 -0
- package/src/components/FnConfig.vue +315 -0
- package/src/components/FnEditor.vue +327 -0
- package/src/components/FnInput.vue +103 -0
- package/src/components/FormLabel.vue +47 -0
- package/src/components/HtmlEditor.vue +125 -0
- package/src/components/JsonPreview.vue +146 -0
- package/src/components/OptionsTextInput.vue +151 -0
- package/src/components/PropsInput.vue +72 -0
- package/src/components/Required.vue +75 -0
- package/src/components/Row.vue +26 -0
- package/src/components/SignaturePad.vue +176 -0
- package/src/components/Struct.vue +153 -0
- package/src/components/StructEditor.vue +121 -0
- package/src/components/StructTree.vue +209 -0
- package/src/components/TableOptions.vue +164 -0
- package/src/components/TreeOptions.vue +167 -0
- package/src/components/TypeSelect.vue +144 -0
- package/src/components/Validate.vue +302 -0
- package/src/components/ValueInput.vue +89 -0
- package/src/components/Warning.vue +46 -0
- package/src/components/ai/AiPanel.vue +1122 -0
- package/src/components/ai/MarkdownRenderer.vue +548 -0
- package/src/components/language/LanguageConfig.vue +174 -0
- package/src/components/language/LanguageInput.vue +191 -0
- package/src/components/style/BackgroundInput.vue +315 -0
- package/src/components/style/BorderInput.vue +242 -0
- package/src/components/style/BoxSizeInput.vue +166 -0
- package/src/components/style/BoxSpaceInput.vue +269 -0
- package/src/components/style/ColorInput.vue +90 -0
- package/src/components/style/ConfigItem.vue +118 -0
- package/src/components/style/FontInput.vue +197 -0
- package/src/components/style/PositionInput.vue +146 -0
- package/src/components/style/RadiusInput.vue +164 -0
- package/src/components/style/ShadowContent.vue +335 -0
- package/src/components/style/ShadowInput.vue +91 -0
- package/src/components/style/SizeInput.vue +118 -0
- package/src/components/style/StyleConfig.vue +307 -0
- package/src/components/table/Table.vue +252 -0
- package/src/components/table/TableView.vue +1058 -0
- package/src/components/tableForm/TableForm.vue +471 -0
- package/src/components/tableForm/TableFormColumnView.vue +103 -0
- package/src/components/tableForm/TableFormView.vue +46 -0
- package/src/components/tree/FcTree.vue +713 -0
- package/src/components/tree/FcTreeNode.vue +216 -0
- package/src/config/base/field.js +43 -0
- package/src/config/base/form.js +132 -0
- package/src/config/base/style.js +26 -0
- package/src/config/base/validate.js +15 -0
- package/src/config/index.js +70 -0
- package/src/config/menu.js +24 -0
- package/src/config/rule/alert.js +45 -0
- package/src/config/rule/button.js +49 -0
- package/src/config/rule/card.js +40 -0
- package/src/config/rule/cascader.js +121 -0
- package/src/config/rule/checkbox.js +68 -0
- package/src/config/rule/col.js +86 -0
- package/src/config/rule/collapse.js +30 -0
- package/src/config/rule/collapseItem.js +36 -0
- package/src/config/rule/color.js +53 -0
- package/src/config/rule/date.js +66 -0
- package/src/config/rule/dateRange.js +60 -0
- package/src/config/rule/divider.js +31 -0
- package/src/config/rule/editor.js +31 -0
- package/src/config/rule/group.js +86 -0
- package/src/config/rule/html.js +43 -0
- package/src/config/rule/image.js +32 -0
- package/src/config/rule/input.js +62 -0
- package/src/config/rule/number.js +49 -0
- package/src/config/rule/password.js +52 -0
- package/src/config/rule/radio.js +43 -0
- package/src/config/rule/rate.js +44 -0
- package/src/config/rule/row.js +46 -0
- package/src/config/rule/select.js +70 -0
- package/src/config/rule/signaturePad.js +59 -0
- package/src/config/rule/slider.js +53 -0
- package/src/config/rule/space.js +44 -0
- package/src/config/rule/subForm.js +47 -0
- package/src/config/rule/switch.js +46 -0
- package/src/config/rule/tabPane.js +29 -0
- package/src/config/rule/table.js +37 -0
- package/src/config/rule/tableForm.js +115 -0
- package/src/config/rule/tableFormColumn.js +55 -0
- package/src/config/rule/tabs.js +38 -0
- package/src/config/rule/tag.js +69 -0
- package/src/config/rule/text.js +41 -0
- package/src/config/rule/textarea.js +63 -0
- package/src/config/rule/time.js +58 -0
- package/src/config/rule/timeRange.js +49 -0
- package/src/config/rule/title.js +37 -0
- package/src/config/rule/transfer.js +59 -0
- package/src/config/rule/tree.js +70 -0
- package/src/config/rule/treeSelect.js +77 -0
- package/src/config/rule/upload.js +107 -0
- package/src/form/index.js +19 -0
- package/src/index.js +173 -0
- package/src/locale/en.js +981 -0
- package/src/locale/zh-cn.js +983 -0
- package/src/style/fonts/fc-icons.woff +0 -0
- package/src/style/icon.css +1052 -0
- package/src/style/index.css +836 -0
- package/src/utils/form.js +9 -0
- package/src/utils/highlight/highlight.min.js +307 -0
- package/src/utils/highlight/javascript.min.js +80 -0
- package/src/utils/highlight/style.css +1 -0
- package/src/utils/highlight/xml.min.js +29 -0
- package/src/utils/hintStubs.js +120 -0
- package/src/utils/index.js +544 -0
- package/src/utils/jsonDiff.js +173 -0
- package/src/utils/locale.js +23 -0
- package/src/utils/message.js +19 -0
- package/src/utils/template.js +105 -0
- package/types/index.d.ts +575 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-style-config">
|
|
3
|
+
<BoxSpaceInput v-model="space" @change="onInput" style="margin-bottom: 10px;"></BoxSpaceInput>
|
|
4
|
+
<BoxSizeInput v-model="size" @change="onInput"></BoxSizeInput>
|
|
5
|
+
<ConfigItem :label="t('style.color')">
|
|
6
|
+
<ColorInput v-model="color" @change="onInput"></ColorInput>
|
|
7
|
+
</ConfigItem>
|
|
8
|
+
<BackgroundInput v-model="background" @change="onInput"></BackgroundInput>
|
|
9
|
+
<BorderInput v-model="border" @change="onInput"></BorderInput>
|
|
10
|
+
<RadiusInput v-model="radius" @change="onInput"/>
|
|
11
|
+
<FontInput v-model="font" @change="onInput"/>
|
|
12
|
+
<ShadowInput v-model="boxShadow" @change="onInput"></ShadowInput>
|
|
13
|
+
<PositionInput v-model="position" @change="onInput"></PositionInput>
|
|
14
|
+
<ConfigItem :label="t('style.opacity')" class="_fd-opacity-input">
|
|
15
|
+
<el-slider :show-tooltip="false" v-model="opacity"
|
|
16
|
+
@change="onInput"></el-slider>
|
|
17
|
+
<span>{{ opacity }}%</span>
|
|
18
|
+
</ConfigItem>
|
|
19
|
+
<ConfigItem :label="t('style.scale')" class="_fd-opacity-input">
|
|
20
|
+
<el-slider :min="80" :max="120" :show-tooltip="false" v-model="scale"
|
|
21
|
+
@change="onInput"></el-slider>
|
|
22
|
+
<span>{{ scale }}%</span>
|
|
23
|
+
</ConfigItem>
|
|
24
|
+
<ConfigItem :label="t('props.custom')" :info="Object.keys(formData).length > 0 ? t('struct.configured') : ''">
|
|
25
|
+
<template #append>
|
|
26
|
+
<TableOptions v-model="formData" @change="onInput" v-bind="{
|
|
27
|
+
column: [{label: t('props.key'), key: 'label'}, {label: t('props.value'), key: 'value'}],
|
|
28
|
+
valueType: 'object'
|
|
29
|
+
}"></TableOptions>
|
|
30
|
+
</template>
|
|
31
|
+
</ConfigItem>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import {defineComponent} from 'vue';
|
|
37
|
+
import BoxSizeInput from './BoxSizeInput.vue';
|
|
38
|
+
import BoxSpaceInput from './BoxSpaceInput.vue';
|
|
39
|
+
import BorderInput from './BorderInput.vue';
|
|
40
|
+
import RadiusInput from './RadiusInput.vue';
|
|
41
|
+
import FontInput from './FontInput.vue';
|
|
42
|
+
import ConfigItem from './ConfigItem.vue';
|
|
43
|
+
import ColorInput from './ColorInput.vue';
|
|
44
|
+
import ShadowInput from './ShadowInput.vue';
|
|
45
|
+
import {isNull} from '../../utils/index';
|
|
46
|
+
import TableOptions from '../TableOptions.vue';
|
|
47
|
+
import PositionInput from './PositionInput.vue';
|
|
48
|
+
import toLine from '@form-create/utils/lib/toline';
|
|
49
|
+
import toCase from "@form-create/utils/lib/tocase";
|
|
50
|
+
import BackgroundInput from './BackgroundInput.vue';
|
|
51
|
+
|
|
52
|
+
const fontKey = [
|
|
53
|
+
'fontFamily',
|
|
54
|
+
'fontSize',
|
|
55
|
+
'fontWeight',
|
|
56
|
+
'fontStyle',
|
|
57
|
+
'textDecoration',
|
|
58
|
+
'textAlign',
|
|
59
|
+
'lineHeight',
|
|
60
|
+
'letterSpacing',
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const positionKey = [
|
|
64
|
+
'position',
|
|
65
|
+
'top',
|
|
66
|
+
'left',
|
|
67
|
+
'bottom',
|
|
68
|
+
'right',
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const backgroundKey = ['backgroundColor', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat'];
|
|
72
|
+
|
|
73
|
+
const sizeKey = [
|
|
74
|
+
'height',
|
|
75
|
+
'width',
|
|
76
|
+
'minWidth',
|
|
77
|
+
'minHeight',
|
|
78
|
+
'maxWidth',
|
|
79
|
+
'maxHeight',
|
|
80
|
+
'overflow'
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const styleKey = [
|
|
84
|
+
'color',
|
|
85
|
+
'scale',
|
|
86
|
+
'borderRadius',
|
|
87
|
+
'boxShadow',
|
|
88
|
+
'marginTop',
|
|
89
|
+
'marginRight',
|
|
90
|
+
'marginBottom',
|
|
91
|
+
'marginLeft',
|
|
92
|
+
'paddingTop',
|
|
93
|
+
'paddingRight',
|
|
94
|
+
'paddingBottom',
|
|
95
|
+
'paddingLeft',
|
|
96
|
+
'margin',
|
|
97
|
+
'padding',
|
|
98
|
+
'opacity',
|
|
99
|
+
'borderStyle',
|
|
100
|
+
'borderColor',
|
|
101
|
+
'borderWidth',
|
|
102
|
+
'borderTopStyle',
|
|
103
|
+
'borderTopColor',
|
|
104
|
+
'borderTopWidth',
|
|
105
|
+
'borderLeftStyle',
|
|
106
|
+
'borderLeftColor',
|
|
107
|
+
'borderLeftWidth',
|
|
108
|
+
'borderBottomStyle',
|
|
109
|
+
'borderBottomColor',
|
|
110
|
+
'borderBottomWidth',
|
|
111
|
+
'borderRightStyle',
|
|
112
|
+
'borderRightColor',
|
|
113
|
+
'borderRightWidth',
|
|
114
|
+
...fontKey,
|
|
115
|
+
...sizeKey,
|
|
116
|
+
...positionKey,
|
|
117
|
+
...backgroundKey,
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
export default defineComponent({
|
|
121
|
+
name: 'StyleConfig',
|
|
122
|
+
inject: ['designer'],
|
|
123
|
+
emits: ['update:modelValue'],
|
|
124
|
+
components: {
|
|
125
|
+
PositionInput,
|
|
126
|
+
TableOptions,
|
|
127
|
+
ColorInput,
|
|
128
|
+
ConfigItem,
|
|
129
|
+
RadiusInput,
|
|
130
|
+
BoxSizeInput,
|
|
131
|
+
BoxSpaceInput,
|
|
132
|
+
BorderInput,
|
|
133
|
+
ShadowInput,
|
|
134
|
+
FontInput,
|
|
135
|
+
BackgroundInput,
|
|
136
|
+
},
|
|
137
|
+
props: {
|
|
138
|
+
modelValue: {
|
|
139
|
+
type: Object,
|
|
140
|
+
default: () => ({})
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
watch: {
|
|
144
|
+
modelValue() {
|
|
145
|
+
this.tidyStyle();
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
data() {
|
|
149
|
+
const t = this.designer.setupState.t;
|
|
150
|
+
return {
|
|
151
|
+
t,
|
|
152
|
+
formData: {},
|
|
153
|
+
size: {},
|
|
154
|
+
space: {},
|
|
155
|
+
border: {},
|
|
156
|
+
font: {},
|
|
157
|
+
position: {},
|
|
158
|
+
background: {},
|
|
159
|
+
radius: '',
|
|
160
|
+
color: '',
|
|
161
|
+
boxShadow: '',
|
|
162
|
+
opacity: 100,
|
|
163
|
+
scale: 100,
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
methods: {
|
|
167
|
+
tidyStyle() {
|
|
168
|
+
const style = {...this.modelValue || {}};
|
|
169
|
+
const space = {};
|
|
170
|
+
Object.keys(style).forEach(k => {
|
|
171
|
+
const key = toCase(k);
|
|
172
|
+
if (['margin', 'padding'].indexOf(k) > -1) {
|
|
173
|
+
space[key] = style[k];
|
|
174
|
+
} else if (k.indexOf('margin') > -1 || k.indexOf('padding') > -1) {
|
|
175
|
+
space[key] = style[k];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const size = {};
|
|
180
|
+
sizeKey.forEach(k => {
|
|
181
|
+
if (style[k]) {
|
|
182
|
+
size[k] = style[k];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const position = {};
|
|
187
|
+
positionKey.forEach(k => {
|
|
188
|
+
if (style[k]) {
|
|
189
|
+
position[k] = style[k];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
this.radius = style.borderRadius || '';
|
|
194
|
+
delete style.borderRadius;
|
|
195
|
+
|
|
196
|
+
const border = {};
|
|
197
|
+
Object.keys(style).forEach(k => {
|
|
198
|
+
if (k.indexOf('border') === 0) {
|
|
199
|
+
border[k] = style[k];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
let opacity = isNull(style.opacity) ? 100 : (parseFloat(style.opacity) || 0);
|
|
204
|
+
if (opacity && opacity < 1) {
|
|
205
|
+
opacity = opacity * 100;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let scale = style.scale;
|
|
209
|
+
if (isNull(style.scale)) {
|
|
210
|
+
scale = 100
|
|
211
|
+
} else if (isNaN(Number(scale))) {
|
|
212
|
+
scale = parseFloat(scale) || 100;
|
|
213
|
+
} else {
|
|
214
|
+
scale = scale > 0 ? scale * 100 : 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const font = {};
|
|
218
|
+
fontKey.forEach(k => {
|
|
219
|
+
if (style[k]) {
|
|
220
|
+
font[k] = style[k];
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const background = {};
|
|
225
|
+
backgroundKey.forEach(k => {
|
|
226
|
+
if (style[k]) {
|
|
227
|
+
background[k] = style[k];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
this.opacity = opacity;
|
|
231
|
+
this.scale = scale;
|
|
232
|
+
this.size = size;
|
|
233
|
+
this.position = position;
|
|
234
|
+
this.space = space;
|
|
235
|
+
this.border = border;
|
|
236
|
+
this.font = font;
|
|
237
|
+
this.background = background;
|
|
238
|
+
this.boxShadow = style.boxShadow || '';
|
|
239
|
+
this.color = style.color || '';
|
|
240
|
+
styleKey.forEach(k => {
|
|
241
|
+
delete style[k];
|
|
242
|
+
})
|
|
243
|
+
this.formData = style;
|
|
244
|
+
},
|
|
245
|
+
onInput() {
|
|
246
|
+
let temp = {...this.formData};
|
|
247
|
+
let overStyle = {};
|
|
248
|
+
styleKey.forEach(k => {
|
|
249
|
+
if (temp[k]) {
|
|
250
|
+
overStyle[k] = temp[k];
|
|
251
|
+
delete temp[k];
|
|
252
|
+
} else {
|
|
253
|
+
const v = toLine(k);
|
|
254
|
+
if (temp[v]) {
|
|
255
|
+
overStyle[k] = temp[v];
|
|
256
|
+
delete temp[v];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
const style = {
|
|
262
|
+
...temp,
|
|
263
|
+
color: this.color || '',
|
|
264
|
+
opacity: (this.opacity >= 0 && this.opacity < 100) ? (this.opacity + '%') : '',
|
|
265
|
+
borderRadius: this.radius || '',
|
|
266
|
+
boxShadow: this.boxShadow || '',
|
|
267
|
+
scale: (this.scale >= 0 && this.scale !== 100) ? (this.scale + '%') : '',
|
|
268
|
+
...this.space, ...this.size, ...this.border, ...this.font, ...this.position, ...this.background, ...overStyle
|
|
269
|
+
}
|
|
270
|
+
Object.keys(style).forEach(k => {
|
|
271
|
+
if (isNull(style[k])) {
|
|
272
|
+
delete style[k];
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
this.$emit('update:modelValue', style);
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
created() {
|
|
279
|
+
this.tidyStyle();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
});
|
|
283
|
+
</script>
|
|
284
|
+
|
|
285
|
+
<style>
|
|
286
|
+
._fd-style-config {
|
|
287
|
+
width: 100%;
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
._fd-opacity-input ._fd-ci-con {
|
|
293
|
+
display: flex;
|
|
294
|
+
justify-content: space-between;
|
|
295
|
+
width: 150px;
|
|
296
|
+
align-items: center;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
._fd-opacity-input ._fd-ci-con > span {
|
|
300
|
+
width: 32px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
._fd-opacity-input .el-slider {
|
|
304
|
+
flex: 1;
|
|
305
|
+
margin-right: 15px;
|
|
306
|
+
}
|
|
307
|
+
</style>
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-col :span="24">
|
|
3
|
+
<div class="_fc-table" :class="{ 'is-mini': mini, 'is-table-form': formStyle }">
|
|
4
|
+
<table border="1" cellspacing="0" cellpadding="0" :style="tableColor">
|
|
5
|
+
<template v-for="(_,pid) in rule.row" :key="pid">
|
|
6
|
+
<tr>
|
|
7
|
+
<template v-for="(_, idx) in rule.col" :key="`${pid}${idx}`">
|
|
8
|
+
<td v-if="lattice[pid][idx].show"
|
|
9
|
+
v-bind="lattice[pid][idx] ? {colspan:lattice[pid][idx].colspan, rowspan:lattice[pid][idx].rowspan} : {}"
|
|
10
|
+
valign="top"
|
|
11
|
+
:class="(tdClass && tdClass[`${pid}:${idx}`]) || ''"
|
|
12
|
+
:style="[tableColor, (tdStyle && tdStyle[`${pid}:${idx}`]) || {}]">
|
|
13
|
+
<slot :name="`${pid}:${idx}`"></slot>
|
|
14
|
+
<template v-for="slot in lattice[pid][idx].slot">
|
|
15
|
+
<slot :name="`${slot}`"></slot>
|
|
16
|
+
</template>
|
|
17
|
+
</td>
|
|
18
|
+
</template>
|
|
19
|
+
</tr>
|
|
20
|
+
</template>
|
|
21
|
+
</table>
|
|
22
|
+
</div>
|
|
23
|
+
</el-col>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'FcTable',
|
|
30
|
+
props: {
|
|
31
|
+
mini: Boolean,
|
|
32
|
+
formStyle: Boolean,
|
|
33
|
+
label: String,
|
|
34
|
+
width: [Number, String],
|
|
35
|
+
border: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true
|
|
38
|
+
},
|
|
39
|
+
borderWidth: String,
|
|
40
|
+
borderColor: String,
|
|
41
|
+
rule: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: () => ({row: 1, col: 1})
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
rule: {
|
|
48
|
+
handler() {
|
|
49
|
+
this.initRule();
|
|
50
|
+
this.loadRule();
|
|
51
|
+
this.tdStyle = this.rule.style || {};
|
|
52
|
+
this.tdClass = this.rule.class || {};
|
|
53
|
+
},
|
|
54
|
+
immediate: true,
|
|
55
|
+
deep: true,
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
tdStyle: {},
|
|
61
|
+
tdClass: {},
|
|
62
|
+
lattice: {},
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
tableColor() {
|
|
67
|
+
const border = {};
|
|
68
|
+
if (this.border === false) {
|
|
69
|
+
border['border'] = '0 none';
|
|
70
|
+
} else {
|
|
71
|
+
if (this.borderColor) {
|
|
72
|
+
border['borderColor'] = this.borderColor;
|
|
73
|
+
}
|
|
74
|
+
if (this.borderWidth) {
|
|
75
|
+
border['borderWidth'] = this.borderWidth;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return border;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
initRule() {
|
|
83
|
+
const rule = this.rule;
|
|
84
|
+
if (!rule.style) {
|
|
85
|
+
rule.style = {};
|
|
86
|
+
}
|
|
87
|
+
if (!rule.layout) {
|
|
88
|
+
rule.layout = [];
|
|
89
|
+
}
|
|
90
|
+
if (!rule.row) {
|
|
91
|
+
rule.row = 1;
|
|
92
|
+
}
|
|
93
|
+
if (!rule.col) {
|
|
94
|
+
rule.col = 1;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
loadRule() {
|
|
98
|
+
const lattice = [];
|
|
99
|
+
const rule = this.rule || {row: 1, col: 1};
|
|
100
|
+
for (let index = 0; index < rule.row; index++) {
|
|
101
|
+
const sub = [];
|
|
102
|
+
lattice.push(sub);
|
|
103
|
+
for (let idx = 0; idx < rule.col; idx++) {
|
|
104
|
+
sub.push({rowspan: 1, colspan: 1, slot: [], show: true});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
[...(rule.layout || [])].forEach((v, i) => {
|
|
108
|
+
if (((!v.row || v.row <= 0) && (!v.col || v.col <= 0)) || !lattice[v.top] || !lattice[v.top][v.left] || !lattice[v.top][v.left].show) {
|
|
109
|
+
rule.layout.splice(i, 1);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const data = lattice[v.top][v.left];
|
|
113
|
+
data.layout = v;
|
|
114
|
+
let col = 1;
|
|
115
|
+
let row = 1;
|
|
116
|
+
if (v.col) {
|
|
117
|
+
col = (v.col + v.left) > rule.col ? rule.col - v.left : v.col;
|
|
118
|
+
data.colspan = col;
|
|
119
|
+
}
|
|
120
|
+
if (v.row) {
|
|
121
|
+
row = (v.row + v.top) > rule.row ? rule.row - v.top : v.row;
|
|
122
|
+
data.rowspan = row;
|
|
123
|
+
}
|
|
124
|
+
if (row && col) {
|
|
125
|
+
for (let index = 0; index < row; index++) {
|
|
126
|
+
const row = lattice[v.top + index];
|
|
127
|
+
if (row) {
|
|
128
|
+
for (let idx = 0; idx < col; idx++) {
|
|
129
|
+
if (!idx && !index)
|
|
130
|
+
continue;
|
|
131
|
+
|
|
132
|
+
if (row[v.left + idx]) {
|
|
133
|
+
row[v.left + idx].show = false;
|
|
134
|
+
}
|
|
135
|
+
data.slot.push(`${v.top + index}:${v.left + idx}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const checkCol = (col) => {
|
|
143
|
+
return !!(!col || col.layout || !col.show);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
lattice.forEach((v, index) => {
|
|
147
|
+
v.forEach((item, idx) => {
|
|
148
|
+
let right = false;
|
|
149
|
+
let bottom = false;
|
|
150
|
+
if (item.layout) {
|
|
151
|
+
const col = item.layout.col || 1;
|
|
152
|
+
const row = item.layout.row || 1;
|
|
153
|
+
for (let i = 0; i < col; i++) {
|
|
154
|
+
if (!lattice[index + row] || checkCol(lattice[index + row][idx + i])) {
|
|
155
|
+
bottom = true;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
for (let i = 0; i < row; i++) {
|
|
160
|
+
if (!lattice[index + i] || checkCol(lattice[index + i][idx + col])) {
|
|
161
|
+
right = true;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
right = checkCol(v[idx + 1]);
|
|
167
|
+
bottom = lattice[index + 1] ? checkCol(lattice[index + 1][idx]) : true;
|
|
168
|
+
}
|
|
169
|
+
item.right = right;
|
|
170
|
+
item.bottom = bottom;
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
this.lattice = lattice;
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
</script>
|
|
178
|
+
|
|
179
|
+
<style>
|
|
180
|
+
|
|
181
|
+
._fc-table {
|
|
182
|
+
overflow: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
._fc-table > table {
|
|
186
|
+
width: 100%;
|
|
187
|
+
height: 100%;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
table-layout: fixed;
|
|
190
|
+
border: 1px solid #EBEEF5;
|
|
191
|
+
border-bottom: 0 none;
|
|
192
|
+
border-right: 0 none;
|
|
193
|
+
border-collapse: collapse;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
._fc-table tr {
|
|
197
|
+
min-height: 50px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
._fc-table td {
|
|
201
|
+
padding: 5px;
|
|
202
|
+
min-height: 50px;
|
|
203
|
+
min-width: 80px;
|
|
204
|
+
position: relative;
|
|
205
|
+
box-sizing: border-box;
|
|
206
|
+
overflow-wrap: break-word;
|
|
207
|
+
/*white-space: nowrap;*/
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
border: 0 none;
|
|
210
|
+
border-right: 1px solid #EBEEF5;
|
|
211
|
+
border-bottom: 1px solid #EBEEF5;
|
|
212
|
+
text-align: center;
|
|
213
|
+
vertical-align: middle;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
._fc-table.is-mini td {
|
|
217
|
+
padding: 0;
|
|
218
|
+
min-height: 12px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
._fc-table.is-mini .el-form-item {
|
|
222
|
+
padding: 0;
|
|
223
|
+
margin: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
._fc-table.is-table-form .el-form-item {
|
|
227
|
+
margin-bottom: 1px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
._fc-table.is-table-form .el-form-item.is-error {
|
|
231
|
+
margin-bottom: 22px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
._fc-table.is-table-form .el-form-item__label,
|
|
235
|
+
._fc-table.is-table-form .van-field__label {
|
|
236
|
+
display: none !important;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
._fc-table.is-table-form .el-form-item__content {
|
|
240
|
+
display: flex;
|
|
241
|
+
margin-left: 0 !important;
|
|
242
|
+
width: 100% !important;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
._fc-table.is-table-form .el-input-number,
|
|
246
|
+
._fc-table.is-table-form .el-select,
|
|
247
|
+
._fc-table.is-table-form .el-slider,
|
|
248
|
+
._fc-table.is-table-form .el-cascader,
|
|
249
|
+
._fc-table.is-table-form .el-date-editor {
|
|
250
|
+
width: 100%;
|
|
251
|
+
}
|
|
252
|
+
</style>
|