officialblock 1.0.8 → 1.0.9

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.
Files changed (41) hide show
  1. package/dist/official-block.cjs.js +1 -1
  2. package/dist/official-block.es.js +43 -11
  3. package/dist/official-block.umd.js +1 -1
  4. package/dist/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/assets/icon-email.svg +3 -0
  7. package/src/components/ArticleList/setting.vue +316 -142
  8. package/src/components/BannerImageWithLink/index.ts +11 -0
  9. package/src/components/BannerImageWithLink/index.vue +323 -0
  10. package/src/components/BannerImageWithLink/setting.vue +344 -0
  11. package/src/components/BannerImageWithLink/type.ts +17 -0
  12. package/src/components/ContactUsList/index.ts +11 -0
  13. package/src/components/ContactUsList/index.vue +369 -0
  14. package/src/components/ContactUsList/setting.vue +497 -0
  15. package/src/components/ContactUsList/type.ts +17 -0
  16. package/src/components/CountDown/index.ts +11 -0
  17. package/src/components/CountDown/index.vue +315 -0
  18. package/src/components/CountDown/setting.vue +302 -0
  19. package/src/components/CountDown/type.ts +17 -0
  20. package/src/components/CustomIframe/index.ts +11 -0
  21. package/src/components/CustomIframe/index.vue +118 -0
  22. package/src/components/CustomIframe/setting.vue +323 -0
  23. package/src/components/CustomIframe/type.ts +17 -0
  24. package/src/components/Operate/index.vue +1 -2
  25. package/src/components/ScrollKeyInfo/index.ts +11 -0
  26. package/src/components/ScrollKeyInfo/index.vue +1345 -0
  27. package/src/components/ScrollKeyInfo/setting.vue +302 -0
  28. package/src/components/ScrollKeyInfo/type.ts +17 -0
  29. package/src/components/TabDefault/components/ComponentSelector/compsData.js +143 -0
  30. package/src/components/TabDefault/components/ComponentSelector/index.vue +188 -0
  31. package/src/components/TabDefault/components/PageContent.vue +207 -0
  32. package/src/components/TabDefault/index.vue +475 -0
  33. package/src/components/TabDefault/setting.vue +581 -0
  34. package/src/components/TabDefault/type.ts +17 -0
  35. package/src/components/TableTwo/index.ts +11 -0
  36. package/src/components/TableTwo/index.vue +232 -0
  37. package/src/components/TableTwo/setting.vue +558 -0
  38. package/src/components/TableTwo/type.ts +17 -0
  39. package/src/components/index.ts +17 -0
  40. package/src/styles/component-isolation.scss +2 -1
  41. package/src/views/components/ArticleListDemo.vue +50 -49
@@ -0,0 +1,581 @@
1
+ <template>
2
+ <a-drawer width="50%" :visible="show" :footer="false" @cancel="handleCancel" unmountOnClose>
3
+ <template #title> {{ data.type }}组件编辑 </template>
4
+
5
+ <div class="setting-content">
6
+ <!-- 组件自身属性 -->
7
+ <div class="setting-header flex items-center">
8
+ <span class="header-title">组件宽度</span>
9
+ <a-select v-model="data.width" placeholder="请选择" allow-clear>
10
+ <a-option value="default">默认</a-option>
11
+ <a-option value="small">小</a-option>
12
+ <a-option value="medium">中</a-option>
13
+ <a-option value="max">大</a-option>
14
+ </a-select>
15
+ </div>
16
+
17
+ <div class="setting-header flex items-center">
18
+ <span class="header-title">组件背景</span>
19
+ <a-select v-model="data.background" placeholder="请选择" allow-clear>
20
+ <a-option value="white">白色</a-option>
21
+ <a-option value="grey">灰色</a-option>
22
+ </a-select>
23
+ </div>
24
+
25
+ <div class="setting-header flex items-center">
26
+ <span class="header-title">居中</span>
27
+ <a-select v-model="data.isCenter" placeholder="请选择" allow-clear>
28
+ <a-option value="yes">是</a-option>
29
+ <a-option value="no">否</a-option>
30
+ </a-select>
31
+ </div>
32
+
33
+ <!-- 子组件属性 -->
34
+ <!-- 子组件属性 -->
35
+ <div class="setting-body">
36
+ <div class="setting-toolbar">
37
+ <h4>List</h4>
38
+ <div class="tools">
39
+ <a-button type="primary" @click="handleAdd('Video')">
40
+ <template #icon>
41
+ <icon-plus />
42
+ </template>
43
+ 添加 Tab
44
+ </a-button>
45
+ <a-button type="primary" @click="handleAdd('Video')">粘贴 Tab</a-button>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="setting-item">
50
+ <draggable
51
+ v-model="data.data"
52
+ :component-data="{
53
+ tag: 'div',
54
+ type: 'transition-group',
55
+ name: !drag ? 'flip-list' : null,
56
+ }"
57
+ v-bind="galleryDragOptions"
58
+ :disabled="!shouldShowDragHandle(data.data)"
59
+ @start="drag = true"
60
+ @end="drag = false"
61
+ item-key="id"
62
+ >
63
+ <template #item="{ element: gallery }">
64
+ <div
65
+ class="item-button draggable-item"
66
+ :class="{
67
+ 'sortable-disabled': !shouldShowDragHandle(data.data),
68
+ }"
69
+ :key="gallery.id"
70
+ >
71
+ <div class="item-header">
72
+ <div>
73
+ <h5>{{ gallery.name }}</h5>
74
+ <span>{{ gallery.key }}</span>
75
+ </div>
76
+
77
+ <div class="btn-group">
78
+ <div v-if="shouldShowDragHandle(data.data)" class="drag-handle">
79
+ <icon-drag-arrow class="drag-icon" />
80
+ </div>
81
+ <icon-delete class="btn-delete" @click="handleDelete(gallery.id)" />
82
+ <a-button size="mini" type="primary" @click="handleAdd('Video')">复制 Tab</a-button>
83
+ </div>
84
+ </div>
85
+
86
+ <p class="item-title">Tab名称</p>
87
+ <a-input v-model="gallery.name" placeholder="请输入标题" allow-clear />
88
+
89
+ <p class="item-title">Key</p>
90
+ <a-input v-model="gallery.key" placeholder="请输入key" allow-clear />
91
+
92
+ <p>components</p>
93
+ <div class="components-content">
94
+ <PageContent
95
+ v-bind:data="gallery.componentsDataJson"
96
+ @update="(val) => (gallery.componentsDataJson = val)"
97
+ />
98
+
99
+ <!-- <div v-if="gallery.componentsDataJson?.length">
100
+ <draggable
101
+ v-model="gallery.componentsDataJson"
102
+ :component-data="{
103
+ tag: 'div',
104
+ type: 'transition-group',
105
+ name: !drag ? 'flip-list' : null,
106
+ }"
107
+ v-bind="buttonDragOptions"
108
+ :disabled="!shouldShowDragHandle(gallery.componentsDataJson)"
109
+ @start="drag = true"
110
+ @end="drag = false"
111
+ item-key="id"
112
+ >
113
+ <template #item="{ element: compData }">
114
+ <div
115
+ class="item-button draggable-item"
116
+ :class="{ 'sortable-disabled': !shouldShowDragHandle(gallery.componentsDataJson) }"
117
+ :key="compData.id"
118
+ >
119
+ ceshi
120
+ </div>
121
+ </template>
122
+ </draggable>
123
+ </div>
124
+ <div v-else style="text-align: center">
125
+ <a-button type="primary" @click="handleAdd('Video')">添加组件</a-button>
126
+ </div> -->
127
+ </div>
128
+
129
+ <ProfileSetting
130
+ v-if="gallery.profile"
131
+ :data="gallery.profile"
132
+ :showLogo="false"
133
+ :canAddParagraph="true"
134
+ ></ProfileSetting>
135
+ </div>
136
+ </template>
137
+ </draggable>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </a-drawer>
142
+ </template>
143
+
144
+ <script lang="ts" setup>
145
+ import { ref, computed } from "vue";
146
+ import draggable from "vuedraggable";
147
+ import RichTextEditor from "@/components/RichTextEditor";
148
+ import { randomString } from "@/utils/common";
149
+ import PageContent from "./components/PageContent.vue";
150
+
151
+ // 拖拽相关状态
152
+ const drag = ref(false);
153
+
154
+ // 不同类型的拖拽配置选项
155
+ const galleryDragOptions = computed(() => ({
156
+ animation: 200,
157
+ group: "gallerys", // 链接专用分组
158
+ disabled: false,
159
+ ghostClass: "ghost",
160
+ }));
161
+
162
+ // 不同类型的拖拽配置选项
163
+ const dragOptions = computed(() => ({
164
+ animation: 200,
165
+ group: "item",
166
+ disabled: false,
167
+ ghostClass: "ghost",
168
+ }));
169
+
170
+ const buttonDragOptions = computed(() => ({
171
+ animation: 200,
172
+ group: "buttons", // 按钮专用分组
173
+ disabled: false,
174
+ ghostClass: "ghost",
175
+ }));
176
+
177
+ const linkDragOptions = computed(() => ({
178
+ animation: 200,
179
+ group: "links", // 链接专用分组
180
+ disabled: false,
181
+ ghostClass: "ghost",
182
+ }));
183
+
184
+ const categoryDragOptions = computed(() => ({
185
+ animation: 200,
186
+ group: "categories", // 分类专用分组
187
+ disabled: false,
188
+ ghostClass: "ghost",
189
+ }));
190
+
191
+ const imageDragOptions = computed(() => ({
192
+ animation: 200,
193
+ group: "images", // 图片专用分组
194
+ disabled: false,
195
+ ghostClass: "ghost",
196
+ }));
197
+
198
+ // 检查是否应该显示拖拽图标
199
+ const shouldShowDragHandle = (list: any[]) => {
200
+ return list && list.length > 1;
201
+ };
202
+
203
+ const props = defineProps({
204
+ show: {
205
+ type: Boolean,
206
+ default: false,
207
+ },
208
+ data: {
209
+ type: Object,
210
+ default: () => {},
211
+ },
212
+ });
213
+
214
+ const emit = defineEmits(["update:show"]);
215
+
216
+ const handleCancel = () => {
217
+ emit("update:show", false);
218
+ };
219
+
220
+ const handleAdd = (type: string) => {
221
+ const detail = props.data;
222
+
223
+ if (type === "Article") {
224
+ detail.data.push({
225
+ id: randomString(),
226
+ type: "Article",
227
+ title: "",
228
+ content: "",
229
+ buttonList: [],
230
+ linkList: [],
231
+ });
232
+ } else if (type === "Contact") {
233
+ detail.data.push({
234
+ id: randomString(),
235
+ type: "Contact",
236
+ title: "",
237
+ content: "",
238
+ categories: [],
239
+ linkList: [],
240
+ });
241
+ } else if (type === "Image") {
242
+ detail.data.push({
243
+ id: randomString(),
244
+ type: "Image",
245
+ imgSrc: "",
246
+ caption: "",
247
+ alt: "",
248
+ isRound: false,
249
+ });
250
+ } else if (type === "ImageList") {
251
+ detail.data.push({
252
+ id: randomString(),
253
+ type: "ImageList",
254
+ imageList: [],
255
+ });
256
+ } else if (type === "Video") {
257
+ detail.data.push({
258
+ id: randomString(),
259
+ type: "Video",
260
+ videoSrc: "",
261
+ imgSrc: "",
262
+ });
263
+ }
264
+ };
265
+
266
+ const handleDelete = (id: string) => {
267
+ props.data.data = props.data.data.filter((item: any) => item.id !== id);
268
+ };
269
+
270
+ const handleAddButton = (list: any[]) => {
271
+ list.push({
272
+ id: randomString(),
273
+ text: "查看更多",
274
+ url: undefined,
275
+ isExternal: false,
276
+ });
277
+ };
278
+
279
+ const handleDeleteButton = (list: any[], id: string) => {
280
+ list.splice(
281
+ list.findIndex((item) => item.id === id),
282
+ 1
283
+ );
284
+ };
285
+
286
+ const handleAddLink = (list: any[]) => {
287
+ list.push({
288
+ id: randomString(),
289
+ text: "查看更多",
290
+ url: undefined,
291
+ isExternal: false,
292
+ });
293
+ };
294
+
295
+ const handleDeleteLink = (list: any[], id: string) => {
296
+ list.splice(
297
+ list.findIndex((item) => item.id === id),
298
+ 1
299
+ );
300
+ };
301
+
302
+ const handleAddCategory = (list: any[]) => {
303
+ list.push({
304
+ id: randomString(),
305
+ text: "分类",
306
+ });
307
+ };
308
+
309
+ const handleDeleteCategory = (list: any[], id: string) => {
310
+ list.splice(
311
+ list.findIndex((item) => item.id === id),
312
+ 1
313
+ );
314
+ };
315
+
316
+ const handleAddImage = (list: any[]) => {
317
+ list.push({
318
+ id: randomString(),
319
+ src: "",
320
+ });
321
+ };
322
+
323
+ const handleDeleteImage = (list: any[], img: string) => {
324
+ list.splice(
325
+ list.findIndex((item) => item === img),
326
+ 1
327
+ );
328
+ };
329
+ </script>
330
+
331
+ <style lang="scss" scoped>
332
+ .setting-content {
333
+ .setting-header {
334
+ padding-bottom: 12px;
335
+
336
+ .header-title {
337
+ width: 120px;
338
+ padding-right: 12px;
339
+ text-align: right;
340
+ }
341
+ }
342
+
343
+ .setting-body {
344
+ margin-top: 12px;
345
+ background: #f0f2f5;
346
+ padding: 8px 12px 16px;
347
+ border-radius: 8px;
348
+
349
+ .setting-toolbar {
350
+ display: flex;
351
+ align-items: center;
352
+ justify-content: space-between;
353
+ padding-bottom: 8px;
354
+
355
+ button {
356
+ margin-left: 8px;
357
+ }
358
+ }
359
+
360
+ .setting-item {
361
+ position: relative;
362
+ margin-bottom: 20px;
363
+
364
+ .btn-group {
365
+ display: flex;
366
+ align-items: center;
367
+ padding: 4px;
368
+
369
+ .btn-delete {
370
+ padding: 4px;
371
+ font-size: 24px;
372
+ cursor: pointer;
373
+ }
374
+ }
375
+
376
+ .item-name {
377
+ font-size: 16px;
378
+ font-weight: 600;
379
+ padding-bottom: 10px;
380
+ border-bottom: 1px solid #fff;
381
+ }
382
+
383
+ .item-title {
384
+ padding: 12px 0 8px 0;
385
+ font-size: 14px;
386
+ }
387
+
388
+ .arco-input-wrapper {
389
+ background: #fff;
390
+ }
391
+
392
+ .item-button {
393
+ position: relative;
394
+ padding: 12px 8px 4px;
395
+ background: #fff;
396
+ border-radius: 4px;
397
+ margin: 4px 0;
398
+ transition: all 0.3s ease;
399
+
400
+ .item-header {
401
+ display: flex;
402
+ align-items: center;
403
+ justify-content: space-between;
404
+ }
405
+
406
+ &.draggable-item {
407
+ margin-bottom: 8px;
408
+ cursor: move;
409
+
410
+ &:hover {
411
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
412
+ transform: translateY(-1px);
413
+ }
414
+
415
+ // 当禁用拖拽时,不显示拖拽效果
416
+ &.sortable-disabled {
417
+ cursor: default;
418
+
419
+ &:hover {
420
+ box-shadow: none;
421
+ transform: none;
422
+ }
423
+ }
424
+
425
+ .components-content {
426
+ background: #f2f3f5;
427
+ padding: 8px;
428
+ border-radius: 4px;
429
+ }
430
+ }
431
+
432
+ .arco-input-wrapper {
433
+ background: #f2f3f5;
434
+ }
435
+ }
436
+
437
+ // 拖拽相关样式
438
+ .flip-list-move {
439
+ transition: transform 0.5s;
440
+ }
441
+
442
+ .no-move {
443
+ transition: transform 0s;
444
+ }
445
+
446
+ .ghost {
447
+ opacity: 0.5;
448
+ background: #c8ebfb;
449
+ }
450
+
451
+ .list-group {
452
+ min-height: 20px;
453
+ }
454
+
455
+ .list-group-item {
456
+ cursor: move;
457
+ }
458
+
459
+ .list-group-item i {
460
+ cursor: pointer;
461
+ }
462
+
463
+ .item-action {
464
+ padding: 10px 0;
465
+
466
+ .action-text {
467
+ width: 150px;
468
+ margin-right: 8px;
469
+ }
470
+ }
471
+
472
+ .item-add-btn {
473
+ display: inline-block;
474
+ padding: 2px 8px;
475
+ margin-top: 5px;
476
+ font-size: 11px;
477
+ color: #165dff;
478
+ border-radius: 4px;
479
+ font-weight: 600;
480
+ border: 1px solid #165dff;
481
+ cursor: pointer;
482
+ }
483
+
484
+ .item-img {
485
+ margin-top: 12px;
486
+ height: 160px;
487
+ }
488
+
489
+ .fit-content {
490
+ width: fit-content;
491
+ }
492
+
493
+ .item-img-list {
494
+ .img-list-item {
495
+ margin: 4px 0;
496
+ position: relative;
497
+ padding: 8px;
498
+ border-radius: 4px;
499
+ transition: all 0.3s ease;
500
+ background: #fff;
501
+ border-radius: 4px;
502
+
503
+ &.draggable-item {
504
+ cursor: move;
505
+
506
+ &:hover {
507
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
508
+ transform: translateY(-1px);
509
+ }
510
+
511
+ // 当禁用拖拽时,不显示拖拽效果
512
+ &.sortable-disabled {
513
+ cursor: default;
514
+
515
+ &:hover {
516
+ box-shadow: none;
517
+ transform: none;
518
+ }
519
+ }
520
+ }
521
+
522
+ .arco-input-wrapper {
523
+ background: #f2f3f5;
524
+ }
525
+
526
+ .img-drag-handle {
527
+ top: 0 !important;
528
+ }
529
+ }
530
+
531
+ .item-img-box {
532
+ margin-right: 12px;
533
+ position: relative;
534
+ width: 133px;
535
+ height: 100px;
536
+
537
+ .item-img-dlete {
538
+ position: absolute;
539
+ padding: 8px;
540
+ font-size: 32px;
541
+ top: -16px;
542
+ right: -16px;
543
+ color: red;
544
+ cursor: pointer;
545
+ }
546
+ }
547
+
548
+ .small-img {
549
+ margin: 0;
550
+ height: 100px;
551
+ object-fit: cover;
552
+ }
553
+
554
+ .item-right {
555
+ padding-top: 24px;
556
+ }
557
+ }
558
+ }
559
+ }
560
+
561
+ .drag-handle {
562
+ padding: 4px;
563
+ cursor: grab;
564
+ padding: 4px;
565
+ border-radius: 4px;
566
+
567
+ &:hover {
568
+ background-color: #f0f2f5;
569
+ }
570
+
571
+ &:active {
572
+ cursor: grabbing;
573
+ }
574
+
575
+ .drag-icon {
576
+ font-size: 16px;
577
+ color: #86909c;
578
+ }
579
+ }
580
+ }
581
+ </style>
@@ -0,0 +1,17 @@
1
+ export interface ArticleListProps {
2
+ /** 双向绑定的值 */
3
+ modelValue: any
4
+ }
5
+
6
+ export interface ArticleListEmits {
7
+ (e: 'update:modelValue', value: any): void
8
+ (e: 'handleDelete', value: string | number): void
9
+ (e: 'handleCopy', value: any): void
10
+ }
11
+
12
+ // export type ComponentSlots = {
13
+ // /** 默认插槽内容 */
14
+ // default?: (props: { value: string | number }) => VNode[]
15
+ // /** 头部内容 */
16
+ // header?: (props: { title: string }) => VNode[]
17
+ // }
@@ -0,0 +1,11 @@
1
+ import type { App, Plugin } from 'vue'
2
+ import TableTwo from './index.vue'
3
+
4
+ export default {
5
+ install: (app: App) => {
6
+ app.component('TableTwo', TableTwo)
7
+ },
8
+ } satisfies Plugin
9
+
10
+ export { default as TableTwo } from './index.vue'
11
+ export type { TableTwoProps, TableTwoEmits } from './type'