ci-plus 1.3.7 → 1.3.8

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.
@@ -0,0 +1,13 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+ export default defineComponent({
4
+ name: 'RenderComp',
5
+ props: {
6
+ render: Function,
7
+ form: Object
8
+ },
9
+ render(ctx) {
10
+ return ctx.render(ctx?.form)
11
+ }
12
+ })
13
+ </script>
@@ -0,0 +1,571 @@
1
+ CiSelect 下拉选择组件
2
+ 单选
3
+
4
+ ```ts
5
+ <template>
6
+ <t-layout-page>
7
+ <t-layout-page-item>
8
+ <ci-select
9
+ placeholder="请选择工序"
10
+ v-model="selectVlaue"
11
+ :optionSource="stepList"
12
+ valueCustom="label"
13
+ @change="selectChange"
14
+ width="200px"
15
+ />
16
+ </t-layout-page-item>
17
+ </t-layout-page>
18
+ </template>
19
+
20
+ <script setup lang="ts" name="Single">
21
+ import { ref } from 'vue'
22
+ const selectVlaue = ref<any>()
23
+ const stepList = [
24
+ { label: '开始' },
25
+ { label: 'POSUI' },
26
+ { label: '11' },
27
+ { label: 'GX123' },
28
+ { label: '烘干破碎' },
29
+ { label: '车间仓库' },
30
+ { label: 'ui3333' },
31
+ { label: 'hhh333' }
32
+ ]
33
+ const selectChange = (val: any) => {
34
+ console.log('selectChange', val, selectVlaue.value)
35
+ }
36
+ </script>
37
+ ```
38
+
39
+ 自定义显示下拉项label
40
+ 设置customLabel字符串表达式:${item.label}(${item.id});注意:表达式必须以item开头,且后面的属性必须存在optionSource中
41
+
42
+ ```vue
43
+ <template>
44
+ <t-layout-page>
45
+ <t-layout-page-item>
46
+ <ci-select
47
+ placeholder="自定义显示下拉项label"
48
+ v-model="selectVlaue"
49
+ :optionSource="stepList"
50
+ valueCustom="label"
51
+ customLabel="`${item.label}(${item.id})`"
52
+ @change="selectChange"
53
+ ></ci-select>
54
+ </t-layout-page-item>
55
+ </t-layout-page>
56
+ </template>
57
+ <script setup lang="ts">
58
+ import { ref } from 'vue'
59
+ const selectVlaue = ref<any>()
60
+ const stepList = ref([
61
+ { label: '开始', id: 1 },
62
+ { label: 'POSUI', id: 2 },
63
+ { label: '11', id: 3 },
64
+ { label: 'GX123', id: 4 },
65
+ { label: '烘干破碎', id: 5 },
66
+ { label: '车间仓库', id: 6 },
67
+ { label: 'ui3333', id: 7 },
68
+ { label: 'hhh333', id: 8 }
69
+ ])
70
+ const selectChange = (val: any) => {
71
+ console.log('selectChange', val, selectVlaue.value)
72
+ }
73
+ </script>
74
+ ```
75
+
76
+ 单选分页
77
+ 在组件中配置:isShowPagination 及 paginationOption
78
+
79
+ ```vue
80
+ <template>
81
+ <t-layout-page>
82
+ <t-layout-page-item>
83
+ <ci-select
84
+ placeholder="请选择工序(单选分页)"
85
+ v-model="selectVlaue"
86
+ :optionSource="stepList"
87
+ labelCustom="materialName"
88
+ valueCustom="id"
89
+ @current-change="currentChange"
90
+ @change="selectChange"
91
+ isShowPagination
92
+ :paginationOption="paginationOption"
93
+ />
94
+ </t-layout-page-item>
95
+ </t-layout-page>
96
+ </template>
97
+ <script setup lang="ts" name="Pagination">
98
+ import { onMounted, ref } from 'vue'
99
+ import data from './data.json'
100
+ import data1 from './data1.json'
101
+ const selectVlaue = ref<any>()
102
+ const stepList = ref([])
103
+ const paginationOption = ref({
104
+ pageSize: 6, // 每页显示条数
105
+ currentPage: 1, // 当前页
106
+ pagerCount: 7, // 按钮数,超过时会折叠
107
+ total: 0 // 总条数
108
+ })
109
+ onMounted(() => {
110
+ getList(1)
111
+ })
112
+ const getList = async (pageNum) => {
113
+ let res
114
+ if (pageNum === 1) {
115
+ res = await data
116
+ } else {
117
+ res = await data1
118
+ }
119
+ if (res.success) {
120
+ stepList.value = res.data.records
121
+ paginationOption.value.total = res.data.total
122
+ // console.log('获取数据', paginationOption.value)
123
+ }
124
+ }
125
+ // 切换分页
126
+ const currentChange = (val: any) => {
127
+ console.log('切换分页current-change事件', val)
128
+ getList(val)
129
+ }
130
+ const selectChange = (val: any) => {
131
+ console.log(`change返回值${val};v-model值${selectVlaue.value}`)
132
+ }
133
+ </script>
134
+ ```
135
+
136
+ 单选禁用
137
+ 在组件中数据源:optionSource 不满足条件时,新增disabled属性,设置为true即可
138
+
139
+ ```vue
140
+ <template>
141
+ <t-layout-page>
142
+ <t-layout-page-item>
143
+ <ci-select
144
+ placeholder="单选禁用"
145
+ v-model="selectVlaue"
146
+ :optionSource="stepList"
147
+ valueCustom="label"
148
+ @change="selectChange"
149
+ width="200px"
150
+ />
151
+ </t-layout-page-item>
152
+ </t-layout-page>
153
+ </template>
154
+ <script setup lang="ts" name="singleDisabled">
155
+ import { onMounted, ref } from 'vue'
156
+ const selectVlaue = ref<any>()
157
+ const stepList: any = ref([])
158
+ onMounted(() => {
159
+ getData()
160
+ })
161
+ const getData = () => {
162
+ let list = [
163
+ { label: '开始', id: 1 },
164
+ { label: 'POSUI', id: 2 },
165
+ { label: '11', id: 3 },
166
+ { label: 'GX123', id: 4 },
167
+ { label: '烘干破碎', id: 5 },
168
+ { label: '单选禁用项', id: undefined },
169
+ { label: '车间仓库', id: 6 },
170
+ { label: 'ui3333', id: 7 },
171
+ { label: 'hhh333', id: 8 }
172
+ ]
173
+ list.map((item: any) => {
174
+ if (item.id === undefined) {
175
+ item.disabled = true
176
+ }
177
+ })
178
+ stepList.value = list
179
+ }
180
+ // 选中值发生变化时触发
181
+ const selectChange = (val: any) => {
182
+ console.log('selectChange', val, selectVlaue.value)
183
+ }
184
+ </script>
185
+ ```
186
+
187
+ 多选禁用
188
+ 在组件中数据源:optionSource 不满足条件时,新增disabled属性,设置为true即可
189
+
190
+ ```vue
191
+ <template>
192
+ <t-layout-page>
193
+ <t-layout-page-item>
194
+ <ci-select
195
+ placeholder="多选禁用"
196
+ v-model="selectVlaue"
197
+ :optionSource="stepList"
198
+ valueCustom="label"
199
+ @change="selectChange"
200
+ multiple
201
+ />
202
+ </t-layout-page-item>
203
+ </t-layout-page>
204
+ </template>
205
+ <script setup lang="ts" name="Multiple">
206
+ import { ref, onMounted } from 'vue'
207
+ const selectVlaue = ref<any>()
208
+ const stepList: any = ref([])
209
+ onMounted(() => {
210
+ getData()
211
+ })
212
+ const getData = () => {
213
+ let list = [
214
+ { label: '开始', id: 1 },
215
+ { label: 'POSUI', id: 2 },
216
+ { label: '11', id: 3 },
217
+ { label: 'GX123', id: 4 },
218
+ { label: '烘干破碎', id: 5 },
219
+ { label: '单选禁用项1', id: undefined },
220
+ { label: '单选禁用项2', id: undefined },
221
+ { label: '车间仓库', id: 6 },
222
+ { label: 'ui3333', id: 7 },
223
+ { label: 'hhh333', id: 8 }
224
+ ]
225
+ list.map((item: any) => {
226
+ if (item.id === undefined) {
227
+ item.disabled = true
228
+ }
229
+ })
230
+ stepList.value = list
231
+ }
232
+ const selectChange = (val: any) => {
233
+ console.log('selectChange', val, selectVlaue.value)
234
+ }
235
+ </script>
236
+ ```
237
+
238
+ 多选
239
+
240
+ ```vue
241
+ <template>
242
+ <t-layout-page>
243
+ <t-layout-page-item>
244
+ <ci-select
245
+ placeholder="请选择工序"
246
+ v-model="selectVlaue"
247
+ :optionSource="stepList"
248
+ valueCustom="label"
249
+ @change="selectChange"
250
+ multiple
251
+ />
252
+ </t-layout-page-item>
253
+ </t-layout-page>
254
+ </template>
255
+ <script setup lang="ts" name="Multiple">
256
+ import { ref } from 'vue'
257
+ const selectVlaue = ref<any>()
258
+ const stepList = [
259
+ { label: '开始' },
260
+ { label: 'POSUI' },
261
+ { label: '11' },
262
+ { label: 'GX123' },
263
+ { label: '烘干破碎' },
264
+ { label: '车间仓库' },
265
+ { label: 'ui3333' },
266
+ { label: 'hhh333' }
267
+ ]
268
+ const selectChange = (val: any) => {
269
+ console.log('selectChange', val, selectVlaue.value)
270
+ }
271
+ </script>
272
+ ```
273
+
274
+ 多选--隐藏多余标签的多选
275
+ use collapse-tags
276
+ use collapse-tags-tooltip
277
+ use max-collapse-tags
278
+
279
+ ```vue
280
+ <template>
281
+ <t-layout-page>
282
+ <t-layout-page-item>
283
+ <div>use collapse-tags</div>
284
+ <ci-select
285
+ placeholder="请选择(多选)"
286
+ v-model="selectVlaue1"
287
+ :optionSource="stepList"
288
+ valueCustom="label"
289
+ collapse-tags
290
+ multiple
291
+ @change="selectChange($event, '1')"
292
+ />
293
+ </t-layout-page-item>
294
+ <t-layout-page-item>
295
+ <div>use collapse-tags-tooltip</div>
296
+ <ci-select
297
+ placeholder="请选择(多选)"
298
+ v-model="selectVlaue2"
299
+ :optionSource="stepList"
300
+ valueCustom="label"
301
+ collapse-tags
302
+ collapse-tags-tooltip
303
+ multiple
304
+ @change="selectChange($event, '2')"
305
+ />
306
+ </t-layout-page-item>
307
+ <t-layout-page-item>
308
+ <div>use max-collapse-tags</div>
309
+ <ci-select
310
+ placeholder="请选择(多选)"
311
+ v-model="selectVlaue3"
312
+ :optionSource="stepList"
313
+ valueCustom="label"
314
+ collapse-tags
315
+ collapse-tags-tooltip
316
+ :max-collapse-tags="3"
317
+ multiple
318
+ @change="selectChange($event, '3')"
319
+ />
320
+ </t-layout-page-item>
321
+ </t-layout-page>
322
+ </template>
323
+ <script setup lang="ts" name="multipleCollapseTags">
324
+ import { ref } from 'vue'
325
+ const selectVlaue1 = ref<any>()
326
+ const selectVlaue2 = ref<any>()
327
+ const selectVlaue3 = ref<any>()
328
+ const stepList = [
329
+ { label: '开始' },
330
+ { label: 'POSUI' },
331
+ { label: '11' },
332
+ { label: 'GX123' },
333
+ { label: '烘干破碎' },
334
+ { label: '车间仓库' },
335
+ { label: 'ui3333' },
336
+ { label: 'hhh333' }
337
+ ]
338
+ const selectChange = (val: any, type) => {
339
+ console.log(`selectChange--selectVlaue${type}`, val)
340
+ }
341
+ </script>
342
+ ```
343
+
344
+ 多选分页
345
+ 在组件中配置:isShowPagination 及 paginationOption;多选不支持翻页选中功能
346
+
347
+ ```vue
348
+ <template>
349
+ <t-layout-page>
350
+ <t-layout-page-item>
351
+ <ci-select
352
+ placeholder="请选择工序(多选分页)"
353
+ v-model="selectVlaue"
354
+ :optionSource="stepList"
355
+ labelCustom="materialName"
356
+ valueCustom="id"
357
+ @current-change="currentChange"
358
+ @change="selectChange"
359
+ isShowPagination
360
+ multiple
361
+ :paginationOption="paginationOption"
362
+ />
363
+ </t-layout-page-item>
364
+ </t-layout-page>
365
+ </template>
366
+ <script setup lang="ts" name="Pagination">
367
+ import { onMounted, ref } from 'vue'
368
+ import data from './data.json'
369
+ import data1 from './data1.json'
370
+ const selectVlaue = ref<any>()
371
+ const stepList = ref([])
372
+ const paginationOption = ref({
373
+ pageSize: 6, // 每页显示条数
374
+ currentPage: 1, // 当前页
375
+ pagerCount: 7, // 按钮数,超过时会折叠
376
+ total: 0 // 总条数
377
+ })
378
+ onMounted(() => {
379
+ getList(1)
380
+ })
381
+ const getList = async (pageNum) => {
382
+ let res
383
+ if (pageNum === 1) {
384
+ res = await data
385
+ } else {
386
+ res = await data1
387
+ }
388
+ if (res.success) {
389
+ stepList.value = res.data.records
390
+ paginationOption.value.total = res.data.total
391
+ // console.log('获取数据', paginationOption.value)
392
+ }
393
+ }
394
+ // 切换分页
395
+ const currentChange = (val: any) => {
396
+ console.log('切换分页current-change事件', val)
397
+ getList(val)
398
+ }
399
+ const selectChange = (val: any) => {
400
+ console.log(`change返回值${val};v-model值${selectVlaue.value}`)
401
+ }
402
+ </script>
403
+ ```
404
+
405
+ 虚拟列表--单选
406
+ 在组件中配置:use-virtual 即可
407
+
408
+ ```vue
409
+ <template>
410
+ <t-layout-page>
411
+ <t-layout-page-item>
412
+ <ci-select
413
+ placeholder="请选择(虚拟列表--单选)"
414
+ v-model="selectVlaue"
415
+ :optionSource="stepList"
416
+ useVirtual
417
+ @change="selectChange"
418
+ />
419
+ </t-layout-page-item>
420
+ </t-layout-page>
421
+ </template>
422
+ <script setup lang="ts" name="useVirtual">
423
+ import { ref } from 'vue'
424
+ const selectVlaue = ref<any>()
425
+ const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
426
+ const stepList = Array.from({ length: 1000 }).map((_, idx) => ({
427
+ value: `Option ${idx + 1}`,
428
+ label: `${initials[idx % 10]}${idx}`
429
+ }))
430
+ const selectChange = (val: any) => {
431
+ console.log('selectChange', val, selectVlaue.value)
432
+ }
433
+ </script>
434
+ ```
435
+
436
+ 虚拟列表--多选
437
+ 在组件中配置:use-virtual 即可
438
+
439
+ ```vue
440
+ <template>
441
+ <t-layout-page>
442
+ <t-layout-page-item>
443
+ <ci-select
444
+ placeholder="请选择(虚拟列表--多选)"
445
+ v-model="selectVlaue"
446
+ :optionSource="stepList"
447
+ useVirtual
448
+ multiple
449
+ @change="selectChange"
450
+ />
451
+ </t-layout-page-item>
452
+ </t-layout-page>
453
+ </template>
454
+ <script setup lang="ts" name="useVirtual">
455
+ import { ref } from 'vue'
456
+ const selectVlaue = ref<any>()
457
+ const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
458
+ const stepList = Array.from({ length: 1000 }).map((_, idx) => ({
459
+ value: `Option ${idx + 1}`,
460
+ label: `${initials[idx % 10]}${idx}`
461
+ }))
462
+ const selectChange = (val: any) => {
463
+ console.log('selectChange', val, selectVlaue.value)
464
+ }
465
+ </script>
466
+ ```
467
+
468
+ 虚拟列表--隐藏多余标签的多选
469
+ use collapse-tags
470
+ use collapse-tags-tooltip
471
+ use max-collapse-tags
472
+
473
+ ```vue
474
+ <template>
475
+ <t-layout-page>
476
+ <t-layout-page-item>
477
+ <div>use collapse-tags</div>
478
+ <ci-select
479
+ placeholder="请选择(虚拟列表--多选选)"
480
+ v-model="selectVlaue1"
481
+ :optionSource="stepList"
482
+ useVirtual
483
+ collapse-tags
484
+ multiple
485
+ @change="selectChange($event, '1')"
486
+ />
487
+ </t-layout-page-item>
488
+ <t-layout-page-item>
489
+ <div>use collapse-tags-tooltip</div>
490
+ <ci-select
491
+ placeholder="请选择(虚拟列表--多选选)"
492
+ v-model="selectVlaue2"
493
+ :optionSource="stepList"
494
+ useVirtual
495
+ collapse-tags
496
+ collapse-tags-tooltip
497
+ multiple
498
+ @change="selectChange($event, '2')"
499
+ />
500
+ </t-layout-page-item>
501
+ <t-layout-page-item>
502
+ <div>use max-collapse-tags</div>
503
+ <ci-select
504
+ placeholder="请选择(虚拟列表--多选选)"
505
+ v-model="selectVlaue3"
506
+ :optionSource="stepList"
507
+ useVirtual
508
+ collapse-tags
509
+ collapse-tags-tooltip
510
+ :max-collapse-tags="3"
511
+ multiple
512
+ @change="selectChange($event, '3')"
513
+ />
514
+ </t-layout-page-item>
515
+ </t-layout-page>
516
+ </template>
517
+
518
+ <script setup lang="ts" name="useVirtual">
519
+ import { ref } from 'vue'
520
+ const selectVlaue1 = ref<any>()
521
+ const selectVlaue2 = ref<any>()
522
+ const selectVlaue3 = ref<any>()
523
+ const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
524
+ const stepList = Array.from({ length: 1000 }).map((_, idx) => ({
525
+ value: `Option ${idx + 1}`,
526
+ label: `${initials[idx % 10]}${idx}`
527
+ }))
528
+ const selectChange = (val: any, type) => {
529
+ console.log(`selectChange--selectVlaue${type}`, val)
530
+ }
531
+ </script>
532
+ ```
533
+
534
+ CiSelect Attributes
535
+ 1、代码示例
536
+ 下拉选择组件————可实现单选多选(多选可使用全选功能)
537
+
538
+ ```html
539
+ <ci-select
540
+ placeholder="请选择工序"
541
+ v-model="selectVlaue"
542
+ :optionSource="state.stepList"
543
+ valueCustom="label"
544
+ @change="selectChange"
545
+ />
546
+ ```
547
+
548
+ 2、配置参数(Attributes)继承 el-select&el-select-v2 Attributes
549
+
550
+ 参数 说明 类型 默认值
551
+ v-model 绑定值 boolean / string / number/Array 无
552
+ multiple 是否多选 Boolean false
553
+ optionSource 下拉数据源 Array 无
554
+ customLabel 是否自定义设置下拉label String -
555
+ valueCustom 传入的 option 数组中,要作为最终选择项的键值 key String 'key'
556
+ labelCustom 传入的 option 数组中,要作为显示项的键值名称 String 'label'
557
+ useVirtual 是否开启虚拟列表(继承el-select-v2属性) Boolean false
558
+ isShowPagination 是否开启分页 Boolean false
559
+ paginationOption 分页配置 Object -
560
+
561
+ 2-1、paginationOption配置参数(Attributes)继承 el-pagination Attributes
562
+
563
+ 参数 说明 类型 默认值
564
+ currentPage 当前页数 number 1
565
+ pageSize 每页显示条目个数 number 6
566
+ pagerCount 设置最大页码按钮数。 页码按钮的数量,当总页数超过该值时会折叠 number 5
567
+ total 总条目数 number 0
568
+ layout 组件布局,子组件名用逗号分隔 string 'total, prev, pager, next, jumper'
569
+ bind el-pagination属性 Object -
570
+
571
+ 3、继承 el-select&el-pagination&el-select-v2 events
@@ -0,0 +1,4 @@
1
+ import _Select from './select.vue'
2
+ import { withInstall } from '../utils/index';
3
+ export const CiSelect = withInstall(_Select)
4
+ export default CiSelect