@a2simcode/ui 0.0.306 → 0.0.308

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.
@@ -1,81 +1,81 @@
1
- export default {
2
- "props": [
3
- {
4
- "name": "list",
5
- "description": "按钮数据",
6
- "type": "(Array as PropType<ButtonCompType[]>) ||\r\n(Object as PropType<Record<string, ButtonCompType[]>>)",
7
- "default": "() => []"
8
- },
9
- {
10
- "name": "size",
11
- "description": "设置按钮大小",
12
- "type": "'large' | 'default' | 'small'",
13
- "default": "'default'"
14
- },
15
- {
16
- "name": "isLink",
17
- "description": "是否是链接按钮",
18
- "type": "boolean"
19
- },
20
- {
21
- "name": "readonly",
22
- "description": "按钮组是否为禁用状态",
23
- "type": "boolean"
24
- }
25
- ],
26
- "events": [],
27
- "slots": [],
28
- "methods": [],
29
- "types": [
30
- {
31
- "name": "ButtonClickScope",
32
- "properties": [
33
- {
34
- "name": "data",
35
- "type": "Record<string, any>",
36
- "description": ""
37
- },
38
- {
39
- "name": "openLayer",
40
- "type": "(options: LayerParamType) => void",
41
- "description": ""
42
- }
43
- ]
44
- },
45
- {
46
- "name": "ButtonCompActionType",
47
- "properties": [
48
- {
49
- "name": "config",
50
- "type": "ButtonProps & {\r\n // 按钮是否显示\r\n display?: boolean\r\n // 按钮动作\r\n action?: string\r\n // 上传接受的文件类型\r\n uploadAccept?: string\r\n // 上传回调\r\n uploadCallback?: (param: any) => void\r\n // 上传成功回调\r\n uploadSuccess?: (param: any) => void\r\n }",
51
- "description": "按钮配置"
52
- },
53
- {
54
- "name": "click",
55
- "type": "(scope: ButtonClickScope) => void",
56
- "description": "按钮点击方法"
57
- }
58
- ]
59
- },
60
- {
61
- "name": "ButtonCompType",
62
- "properties": [
63
- {
64
- "name": "id",
65
- "type": "string",
66
- "description": "按钮ID"
67
- },
68
- {
69
- "name": "label",
70
- "type": "string",
71
- "description": "按钮名称"
72
- },
73
- {
74
- "name": "children",
75
- "type": "ButtonCompType[]",
76
- "description": "按钮子集"
77
- }
78
- ]
79
- }
80
- ]
81
- }
1
+ export default {
2
+ "props": [
3
+ {
4
+ "name": "list",
5
+ "description": "按钮数据",
6
+ "type": "(Array as PropType<ButtonCompType[]>) ||\n(Object as PropType<Record<string, ButtonCompType[]>>)",
7
+ "default": "() => []"
8
+ },
9
+ {
10
+ "name": "size",
11
+ "description": "设置按钮大小",
12
+ "type": "'large' | 'default' | 'small'",
13
+ "default": "'default'"
14
+ },
15
+ {
16
+ "name": "isLink",
17
+ "description": "是否是链接按钮",
18
+ "type": "boolean"
19
+ },
20
+ {
21
+ "name": "readonly",
22
+ "description": "按钮组是否为禁用状态",
23
+ "type": "boolean"
24
+ }
25
+ ],
26
+ "events": [],
27
+ "slots": [],
28
+ "methods": [],
29
+ "types": [
30
+ {
31
+ "name": "ButtonClickScope",
32
+ "properties": [
33
+ {
34
+ "name": "data",
35
+ "type": "Record<string, any>",
36
+ "description": ""
37
+ },
38
+ {
39
+ "name": "openLayer",
40
+ "type": "(options: LayerParamType) => void",
41
+ "description": ""
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "ButtonCompActionType",
47
+ "properties": [
48
+ {
49
+ "name": "config",
50
+ "type": "ButtonProps & {\n // 按钮是否显示\n display?: boolean\n // 按钮动作\n action?: string\n // 上传接受的文件类型\n uploadAccept?: string\n // 上传回调\n uploadCallback?: (param: any) => void\n // 上传成功回调\n uploadSuccess?: (param: any) => void\n }",
51
+ "description": "按钮配置"
52
+ },
53
+ {
54
+ "name": "click",
55
+ "type": "(scope: ButtonClickScope) => void",
56
+ "description": "按钮点击方法"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "name": "ButtonCompType",
62
+ "properties": [
63
+ {
64
+ "name": "id",
65
+ "type": "string",
66
+ "description": "按钮ID"
67
+ },
68
+ {
69
+ "name": "label",
70
+ "type": "string",
71
+ "description": "按钮名称"
72
+ },
73
+ {
74
+ "name": "children",
75
+ "type": "ButtonCompType[]",
76
+ "description": "按钮子集"
77
+ }
78
+ ]
79
+ }
80
+ ]
81
+ }
@@ -163,6 +163,16 @@ export default {
163
163
  "type": "string",
164
164
  "description": ""
165
165
  },
166
+ {
167
+ "name": "color",
168
+ "type": "string",
169
+ "description": "选项背景颜色"
170
+ },
171
+ {
172
+ "name": "textColor",
173
+ "type": "string",
174
+ "description": "选项文字颜色,不设置时根据背景色自动计算"
175
+ },
166
176
  {
167
177
  "name": "children",
168
178
  "type": "SelectOption[]",
@@ -108,6 +108,20 @@ Select 组件提供三种尺寸。
108
108
  </template>
109
109
  </Demo>
110
110
 
111
+ ## 带颜色
112
+
113
+ 选项可以设置背景颜色和文字颜色。
114
+
115
+ <Demo :source-code="selectColorCode">
116
+ <template #source>
117
+ <select-color />
118
+ </template>
119
+ <template #description>
120
+ 在选项数据中添加 `color` 属性设置背景颜色,添加 `textColor` 属性设置文字颜色;
121
+ 未设置 `textColor` 时会根据背景色自动计算合适的文字颜色。选中后输入框内的标签同样显示对应颜色。
122
+ </template>
123
+ </Demo>
124
+
111
125
  ## API
112
126
 
113
127
  <ApiTable :data="selectApi" componentName="select" />
@@ -121,6 +135,7 @@ import SelectMultiple from '../examples/select/multiple.vue'
121
135
  import SelectFilterable from '../examples/select/filterable.vue'
122
136
  import SelectGroup from '../examples/select/group.vue'
123
137
  import SelectIcon from '../examples/select/icon.vue'
138
+ import SelectColor from '../examples/select/color.vue'
124
139
  import selectApi from './meta/select'
125
140
  import selectBasicCode from '../examples/select/basic.vue?raw'
126
141
  import selectSizeCode from '../examples/select/size.vue?raw'
@@ -130,4 +145,5 @@ import selectMultipleCode from '../examples/select/multiple.vue?raw'
130
145
  import selectFilterableCode from '../examples/select/filterable.vue?raw'
131
146
  import selectGroupCode from '../examples/select/group.vue?raw'
132
147
  import selectIconCode from '../examples/select/icon.vue?raw'
148
+ import selectColorCode from '../examples/select/color.vue?raw'
133
149
  </script>
@@ -53,6 +53,20 @@
53
53
  </template>
54
54
  </Demo>
55
55
 
56
+ ## ShowTag 文本列标签展示
57
+
58
+ 不设置列类型,在列 `config` 中配置 `showTag: true`,即可将普通文本列按标签样式渲染。
59
+
60
+ <Demo :source-code="tableShowTagCode">
61
+ <template #source>
62
+ <table-show-tag />
63
+ </template>
64
+ <template #description>
65
+ 配置 `dataType: 'options'` 和 `options` 时,按逗号拆分单元格值并映射为 `{ value,label,color }` 标签列表;
66
+ 未配置 `options` 时,可通过 `tagDefaultColor` 指定默认背景色,将逗号分隔的原始文本直接渲染为标签。
67
+ </template>
68
+ </Demo>
69
+
56
70
  ## Icon 图标
57
71
 
58
72
  通过列类型 `j-icon` 可以渲染 SVG 图标。支持传入 SVG 字符串或 Iconify 图标名称。
@@ -444,6 +458,7 @@
444
458
  import TableBasic from '../examples/table/basic.vue'
445
459
  import TableColumnFilter from '../examples/table/column-filter.vue'
446
460
  import TableTag from '../examples/table/tag.vue'
461
+ import TableShowTag from '../examples/table/show-tag.vue'
447
462
  import TableIcon from '../examples/table/icon.vue'
448
463
  import TableLink from '../examples/table/link.vue'
449
464
  import TableLayerForm from '../examples/table/layer-form.vue'
@@ -478,6 +493,7 @@ import tableApi from './meta/table'
478
493
  import tableBasicCode from '../examples/table/basic.vue?raw'
479
494
  import tableColumnFilterCode from '../examples/table/column-filter.vue?raw'
480
495
  import tableTagCode from '../examples/table/tag.vue?raw'
496
+ import tableShowTagCode from '../examples/table/show-tag.vue?raw'
481
497
  import tableIconCode from '../examples/table/icon.vue?raw'
482
498
  import tableLinkCode from '../examples/table/link.vue?raw'
483
499
  import tableLayerFormCode from '../examples/table/layer-form.vue?raw'
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <j-select v-model="value" :options="options" placeholder="带颜色选择" style="width: 300px" />
3
+ <p v-if="value" style="margin-top: 12px; color: #606266">选中的值: {{ value }}</p>
4
+ </template>
5
+
6
+ <script setup lang="ts">
7
+ import { ref } from 'vue'
8
+
9
+ const value = ref('')
10
+ const options = [
11
+ { label: '默认选项', value: '1' },
12
+ { label: '成功', value: '2', color: '#e8f7ee' },
13
+ { label: '警告', value: '3', color: '#fff3e0', textColor: '#d46b08' },
14
+ { label: '错误', value: '4', color: '#f53f3f' },
15
+ ]
16
+ </script>
@@ -68,6 +68,7 @@ const records = ref([
68
68
  { id: 2, name: '评分', showType: 'j-rate', render: 3.5 },
69
69
  { id: 3, name: '滑块', showType: 'j-slider', render: 30 },
70
70
  { id: 4, name: '标签', showType: 'j-tag', render: 'a,b,c' },
71
+ { id: 4, name: '标签', showType: 'j-input-tag', render: 'a,b,c' },
71
72
  { id: 5, name: '标签', showType: 'text', render: 'a,b,c' },
72
73
  ])
73
74
  </script>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div style="position: relative; width: 100%; height: 220px">
3
+ <j-table :columns="columns" :records="records" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { ref } from 'vue'
9
+
10
+ const columns = ref([
11
+ {
12
+ id: 'name',
13
+ config: {
14
+ label: '客户',
15
+ width: 120,
16
+ align: 'left',
17
+ },
18
+ },
19
+ {
20
+ id: 'tags',
21
+ config: {
22
+ label: '标签(options 映射)',
23
+ width: 280,
24
+ align: 'left',
25
+ showTag: true,
26
+ dataType: 'options',
27
+ options: [
28
+ { value: 'ax', label: '安盛科技', color: '#fff7e8' },
29
+ { value: 'jy', label: '锦银集团', color: '#e8f3ff' },
30
+ { value: 'drs', label: '大都人寿', color: '#e8fffb' },
31
+ ],
32
+ },
33
+ },
34
+ {
35
+ id: 'status',
36
+ config: {
37
+ label: '状态(默认颜色)',
38
+ width: 240,
39
+ align: 'left',
40
+ showTag: true,
41
+ tagDefaultColor: '#e8f3ff',
42
+ },
43
+ },
44
+ {
45
+ id: 'level',
46
+ type: 'j-select',
47
+ config: {
48
+ label: '等级(j-select)',
49
+ width: 140,
50
+ align: 'center',
51
+ dataType: 'options',
52
+ showTag: true,
53
+ options: [
54
+ { value: 'high', label: '高', color: '#ffeded' },
55
+ { value: 'mid', label: '中', color: '#fff7e8' },
56
+ { value: 'low', label: '低', color: '#e8f3ff' },
57
+ ],
58
+ placeholder: '请选择等级',
59
+ },
60
+ },
61
+ ])
62
+
63
+ const records = ref([
64
+ { name: '客户A', tags: 'ax,jy', status: '进行中', level: 'high' },
65
+ { name: '客户B', tags: 'drs', status: '已签约,待回访', level: 'mid' },
66
+ { name: '客户C', tags: 'ax,jy,drs', status: '已完成', level: 'low' },
67
+ ])
68
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2simcode/ui",
3
- "version": "0.0.306",
3
+ "version": "0.0.308",
4
4
  "description": "A Vue 3 UI Component Library",
5
5
  "type": "module",
6
6
  "main": "./dist/simcode-ui.umd.js",