chain-saasui 1.0.11 → 1.0.12-alpha.3
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/COMPONENTS.md +319 -319
- package/README.md +5 -5
- package/babel.config.js +13 -13
- package/build/version-alpha.js +72 -72
- package/build/version-patch.js +44 -44
- package/build/webpack.common.js +83 -83
- package/build/webpack.components.js +69 -69
- package/build/webpack.demo.js +40 -40
- package/components/css/button.scss +42 -42
- package/components/css/card.scss +44 -44
- package/components/css/common.scss +47 -47
- package/components/css/container.scss +14 -14
- package/components/css/currency.scss +11 -11
- package/components/css/detail.scss +87 -87
- package/components/css/dialog.scss +75 -75
- package/components/css/form.scss +167 -150
- package/components/css/group.scss +86 -86
- package/components/css/index.scss +24 -24
- package/components/css/itemlist.scss +53 -53
- package/components/css/messagebox.scss +73 -73
- package/components/css/notice.scss +91 -91
- package/components/css/pageTabs.scss +204 -204
- package/components/css/pagetable.scss +125 -122
- package/components/css/segmented.scss +98 -98
- package/components/css/space.scss +13 -13
- package/components/css/steps.scss +129 -129
- package/components/css/stepsNew.scss +78 -78
- package/components/css/table.scss +2 -2
- package/components/css/tablebuttons.scss +12 -12
- package/components/css/tag.scss +26 -26
- package/components/css/tips.scss +4 -4
- package/components/css/tooltipWrap.scss +26 -26
- package/components/css/unit.scss +35 -35
- package/components/src/SButton/Button/index.vue +68 -71
- package/components/src/SButton/SButtonText/index.vue +56 -56
- package/components/src/SButton/STableButtons/STableButtons.md +111 -111
- package/components/src/SButton/STableButtons/index.vue +135 -116
- package/components/src/SButton/index.js +3 -3
- package/components/src/SCard/index.vue +50 -50
- package/components/src/SContainer/index.vue +35 -35
- package/components/src/SDialog/index.vue +101 -101
- package/components/src/SDrawer/index.vue +98 -98
- package/components/src/SForm/FieldGroup/index.vue +121 -121
- package/components/src/SForm/SCascader/index.vue +144 -144
- package/components/src/SForm/SCheckbox/index.vue +96 -96
- package/components/src/SForm/SCurrency/index.vue +287 -287
- package/components/src/SForm/SDatePicker/index.vue +260 -179
- package/components/src/SForm/SInput/index.vue +68 -68
- package/components/src/SForm/SInputNumber/index.vue +218 -219
- package/components/src/SForm/SMaskInput/index.vue +66 -66
- package/components/src/SForm/SRadio/index.vue +96 -96
- package/components/src/SForm/SSelect/index.vue +220 -220
- package/components/src/SForm/SSwitch/index.vue +46 -46
- package/components/src/SForm/index.js +11 -11
- package/components/src/SForm/mixins/attrsMixin.js +46 -46
- package/components/src/SGroup/index.vue +94 -95
- package/components/src/SIcon/Icon/index.vue +20 -20
- package/components/src/SInputDialog/InputDialog.vue +100 -100
- package/components/src/SInputDialog/index.js +71 -71
- package/components/src/SItemList/index.vue +56 -56
- package/components/src/SMessagebox/index.js +66 -66
- package/components/src/SMessagebox/messagebox.vue +108 -108
- package/components/src/SNotice/Alert/index.vue +54 -54
- package/components/src/SNotice/index.js +1 -1
- package/components/src/SPage/PageButton/index.vue +44 -44
- package/components/src/SPage/PageTabs/index.vue +588 -593
- package/components/src/SPage/Pagedetail.vue +116 -116
- package/components/src/SPage/Pagestep.vue +94 -94
- package/components/src/SPage/Pagetable.vue +139 -135
- package/components/src/SPage/index.js +3 -3
- package/components/src/SSegmented/segmented.vue +332 -332
- package/components/src/SSpace/Space/index.vue +45 -45
- package/components/src/SSpace/SpaceItem/index.vue +11 -11
- package/components/src/SSpace/index.js +2 -2
- package/components/src/SSteps/index.vue +53 -53
- package/components/src/SStepsNew/index.vue +65 -65
- package/components/src/STable/STablecolumn.vue +190 -180
- package/components/src/STable/SUtable.vue +163 -163
- package/components/src/STable/SUtableColumn.vue +182 -176
- package/components/src/STable/index.vue +208 -208
- package/components/src/STag/index.vue +35 -35
- package/components/src/STip/index.vue +17 -17
- package/components/src/STooltipWrap/index.vue +89 -89
- package/components/src/SUnit/index.vue +94 -94
- package/components/src/index.js +74 -74
- package/components/src/utils/formatTime.js +52 -0
- package/gulpfile.js +20 -20
- package/jsconfig.json +25 -25
- package/lib/css/index.css +1 -1
- package/lib/saasui.common.js +1 -1
- package/package.json +88 -88
- package/public/html/ie.html +45 -45
- package/public/index.html +273 -273
- package/public/robots.txt +1 -1
- package/src/App.vue +27 -27
- package/src/components/HelloWorld.vue +39 -39
- package/src/main.js +16 -16
- package/vue.config.js +40 -40
package/COMPONENTS.md
CHANGED
|
@@ -1,319 +1,319 @@
|
|
|
1
|
-
# saasui 组件清单
|
|
2
|
-
|
|
3
|
-
基础组件必须优先使用 `common/saasui` 中的封装,禁止直接使用原生 `el-*` 组件。未在此列出的组件才允许回落到 Element UI。
|
|
4
|
-
|
|
5
|
-
## 使用前提
|
|
6
|
-
|
|
7
|
-
`saasui` 已在主应用中全局 `Vue.use(saasui)` 注册,模板内直接使用 kebab-case 标签即可:
|
|
8
|
-
|
|
9
|
-
```vue
|
|
10
|
-
<s-button type="primary">保存</s-button>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
所有组件通过 `v-bind="$attrs"` / `v-on="$listeners"` 透传到底层 Element UI,因此 element 原有 props/事件仍可使用。
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 一、按钮类
|
|
18
|
-
|
|
19
|
-
### `<s-button>`
|
|
20
|
-
|
|
21
|
-
主按钮,替代 `el-button`。封装了路由跳转、`icon` 类型、边框模式。
|
|
22
|
-
|
|
23
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
24
|
-
| ------ | ------ | -------- | ----------------------------------------- |
|
|
25
|
-
| type | String | default | `primary` / `default` / `danger` / `icon` |
|
|
26
|
-
| border | String | - | 边框样式,自定义 class 后缀 |
|
|
27
|
-
| mode | String | button | `button` / `link` / `external` |
|
|
28
|
-
| path | String | - | `mode=link` 时的路由 path |
|
|
29
|
-
| query | Object | - | 路由 query |
|
|
30
|
-
| target | String | - | `_blank` 在新窗口打开 |
|
|
31
|
-
|
|
32
|
-
```vue
|
|
33
|
-
<s-button type="primary" @click="handleSave">保存</s-button>
|
|
34
|
-
<s-button mode="link" path="/detail" :query="{ id }">查看</s-button>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### `<s-button-text>`
|
|
38
|
-
|
|
39
|
-
文字按钮,用于表格行内次要操作,替代 `el-button type="text"`。
|
|
40
|
-
|
|
41
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
42
|
-
| ------ | ------ | ---- | --------------------- |
|
|
43
|
-
| type | String | text | `text` / `link` |
|
|
44
|
-
| path | String | - | `type=link` 时的路由 path |
|
|
45
|
-
| query | Object | - | 路由 query |
|
|
46
|
-
| target | String | - | `_blank` 在新窗口打开 |
|
|
47
|
-
|
|
48
|
-
### `<s-table-buttons>`
|
|
49
|
-
|
|
50
|
-
行内操作按钮组,**表格操作列强制使用**。超出 `maxLength` 自动收起到下拉更多。
|
|
51
|
-
|
|
52
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
53
|
-
| --------- | ------ | ---- | ------------- |
|
|
54
|
-
| list | Array | [] | 按钮配置数组,见下方字段 |
|
|
55
|
-
| row | Object | - | 当前行,透传到 onClick |
|
|
56
|
-
| maxLength | Number | 2 | 最多显示几个,其余进入更多 |
|
|
57
|
-
| moreType | String | text | `text` / `more`(更多按钮样式) |
|
|
58
|
-
|
|
59
|
-
`list` 项:`{ label, onClick, show?, tip?, attrs? }`,`show` 支持布尔或函数。
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<s-table-buttons :list="actionList" :row="row" @action="handleAction" />
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## 二、分页 / 布局 / 容器
|
|
68
|
-
|
|
69
|
-
### `<s-pagetable>`
|
|
70
|
-
|
|
71
|
-
**列表页外层容器,必须使用**。自带 `header` / `form` / `footer` 插槽。
|
|
72
|
-
|
|
73
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
74
|
-
| ----------------- | ------- | ----- | ------------------------ |
|
|
75
|
-
| title | String | 路由标题 | 页头标题,默认取路由 meta |
|
|
76
|
-
| mode | String | page | `page` / `form` |
|
|
77
|
-
| showHeader | Boolean | false | 是否显示头部 |
|
|
78
|
-
| showClose | Boolean | false | 显示返回箭头 |
|
|
79
|
-
| showFooter | Boolean | true | 是否渲染 footer 插槽 |
|
|
80
|
-
| showFooterButton | Boolean | false | 底部是否展示「取消 / 确认」按钮 |
|
|
81
|
-
| loadingBtn | Boolean | false | 确认按钮 loading |
|
|
82
|
-
| confirmText | String | 确定 | |
|
|
83
|
-
| cancelText | String | 取消 | |
|
|
84
|
-
|
|
85
|
-
插槽:`default`(内容)、`header`、`header-append`、`title`、`form`(搜索区)、`footer`(分页)。
|
|
86
|
-
|
|
87
|
-
```vue
|
|
88
|
-
<s-pagetable>
|
|
89
|
-
<template #form>...筛选条件...</template>
|
|
90
|
-
<s-table :data="list" :columns="columns" />
|
|
91
|
-
<template #footer>
|
|
92
|
-
<el-pagination ... />
|
|
93
|
-
</template>
|
|
94
|
-
</s-pagetable>
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### `<s-page-tabs>` (项目中的 Tabs 基础组件)
|
|
98
|
-
|
|
99
|
-
基于数组驱动的标签页,**替代 `el-tabs`**(项目中不存在 `s-tabs`,对应组件就是这个)。支持滚动、拖拽、显隐控制。
|
|
100
|
-
|
|
101
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
102
|
-
| ------------ | ----------------- | ------------------------------ | ----------------------- |
|
|
103
|
-
| value | String / Number | '' | `v-model`,当前激活的 value |
|
|
104
|
-
| tabs | Array | [] | `{ label, value, disabled?, show? }` |
|
|
105
|
-
| fieldNames | Object | `{ label, value }` | 字段映射 |
|
|
106
|
-
| gap | String / Number | 32 | tab 间距 |
|
|
107
|
-
| showBorder | Boolean | true | 是否显示下边框 |
|
|
108
|
-
| beforeLeave | Function | - | 切换前钩子,返回 `false`/Promise reject 阻止切换 |
|
|
109
|
-
| draggable | Boolean | false | 是否开启拖拽排序 |
|
|
110
|
-
|
|
111
|
-
事件:`input`、`tab-click(tab, index)`、`tabs-sort(newTabs, { from, to, tab })`。
|
|
112
|
-
|
|
113
|
-
插槽:`extra`(右侧)、`tab-suffix`(每个 tab 尾部)。
|
|
114
|
-
|
|
115
|
-
```vue
|
|
116
|
-
<s-page-tabs v-model="active" :tabs="tabs" />
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
> 纯样式的简单切换也可以使用原生 `el-tabs`,但项目规范下**优先用 `s-page-tabs`**。
|
|
120
|
-
|
|
121
|
-
### `<s-page-button>`
|
|
122
|
-
|
|
123
|
-
页面级按钮区容器,用于 `s-pagetable` 顶部操作栏排布。
|
|
124
|
-
|
|
125
|
-
### `<s-card>`
|
|
126
|
-
|
|
127
|
-
内容卡片,带标题和可折叠能力。
|
|
128
|
-
|
|
129
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
130
|
-
| ---------- | ------- | ----- | -------- |
|
|
131
|
-
| title | String | '' | 卡片标题 |
|
|
132
|
-
| titleSub | String | '' | 副标题 |
|
|
133
|
-
| isCollapse | Boolean | false | 是否开启折叠箭头 |
|
|
134
|
-
|
|
135
|
-
插槽:`title`、`action`(右上角)、`default`。
|
|
136
|
-
|
|
137
|
-
### `<s-container>`
|
|
138
|
-
|
|
139
|
-
外层容器,不常用,用于非 PageTable 页面的基础容器。
|
|
140
|
-
|
|
141
|
-
### `<s-group>`
|
|
142
|
-
|
|
143
|
-
分组数据块,常用于首页卡片类分组展示。
|
|
144
|
-
|
|
145
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
146
|
-
| --------------- | -------- | ----- | ---------------------- |
|
|
147
|
-
| list | Array | [] | 分组数据,`{ label, children }` |
|
|
148
|
-
| data | Object | {} | 绑定数据 |
|
|
149
|
-
| isActive | Function | - | 判断 item 是否激活 |
|
|
150
|
-
| showGroupTitle | Boolean | false | 是否显示分组标题 |
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## 三、表格
|
|
155
|
-
|
|
156
|
-
### `<s-table>`
|
|
157
|
-
|
|
158
|
-
**列表页表格强制使用**。继承 `el-table` 全部 props + 事件,新增 `columns` 配置化、内置多选列。
|
|
159
|
-
|
|
160
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
161
|
-
| ---------------- | -------- | ------- | --------------------------------- |
|
|
162
|
-
| data | Array | - | 同 `el-table` |
|
|
163
|
-
| border | Boolean | true | 默认有边框 |
|
|
164
|
-
| columns | Array | [] | 列配置,见下方 |
|
|
165
|
-
| minWidth | Number/String | 160 | 列默认最小宽度 |
|
|
166
|
-
| selectable | Boolean | false | 是否展示多选列 |
|
|
167
|
-
| selectableType | String | default | `default` / `all`(跨页全选) |
|
|
168
|
-
| reserveSelection | Boolean | false | 翻页保留选中 |
|
|
169
|
-
| checkSelectable | Function | () => true | 行是否可选 |
|
|
170
|
-
| selected | Array | [] | 跨页全选时的选中 id 集合,需 `:selected.sync` |
|
|
171
|
-
|
|
172
|
-
`columns` 项字段:
|
|
173
|
-
|
|
174
|
-
| 字段 | 说明 |
|
|
175
|
-
| -------- | ---------------------------------------- |
|
|
176
|
-
| label | 表头文字 |
|
|
177
|
-
| value | 对应 `prop`,也是插槽名 |
|
|
178
|
-
| type | `text` / `select` / `unit` / `operate` / `index` / `UserModel` |
|
|
179
|
-
| tip | 表头 tooltip |
|
|
180
|
-
| width / minWidth / fixed | 列宽、冻结 |
|
|
181
|
-
| actionList | `type=operate` 时的按钮数组 |
|
|
182
|
-
| options | `type=select` / `unit` 时的字典 |
|
|
183
|
-
|
|
184
|
-
事件:`action(name, row, column)`(操作列)、`selection-change`、`select-all`、透传 `el-table` 所有事件。
|
|
185
|
-
|
|
186
|
-
暴露方法:`doLayout()`、`clearSelection()`、`toggleRowSelection()`、`getSelection()`。
|
|
187
|
-
|
|
188
|
-
```vue
|
|
189
|
-
<s-table
|
|
190
|
-
:data="list"
|
|
191
|
-
:columns="[
|
|
192
|
-
{ label: '姓名', value: 'name' },
|
|
193
|
-
{ label: '状态', value: 'status', type: 'unit', options: statusOptions },
|
|
194
|
-
{ label: '操作', value: 'action', type: 'operate', actionList },
|
|
195
|
-
]"
|
|
196
|
-
@action="onAction" />
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### `<s-table-column>`
|
|
200
|
-
|
|
201
|
-
内置于 `s-table` 的列渲染器,一般不直接使用,通过 `columns` 配置。
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## 四、弹窗 / 抽屉
|
|
206
|
-
|
|
207
|
-
### `<s-dialog>`
|
|
208
|
-
|
|
209
|
-
**新增 / 编辑弹窗必须使用**。继承 `el-dialog` 全部 props,内置 footer、loading。
|
|
210
|
-
|
|
211
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
212
|
-
| ------------------ | ------------- | ----- | ------------------- |
|
|
213
|
-
| visible | Boolean | false | 使用 `visible.sync` |
|
|
214
|
-
| width | String/Number | 720px | |
|
|
215
|
-
| showFooter | Boolean | true | 是否显示底部按钮 |
|
|
216
|
-
| showCancelButton | Boolean | true | |
|
|
217
|
-
| showConfirmButton | Boolean | true | |
|
|
218
|
-
| loadingBtn | Boolean | false | 确认按钮 loading |
|
|
219
|
-
| confirmText | String | 确定 | |
|
|
220
|
-
| cancelText | String | 取消 | |
|
|
221
|
-
| closeOnClickModal | Boolean | false | 强制 false,点击遮罩不关闭 |
|
|
222
|
-
|
|
223
|
-
事件:`confirm`、`close`、`update:visible`。
|
|
224
|
-
|
|
225
|
-
```vue
|
|
226
|
-
<s-dialog :visible.sync="visible" title="新增" :loading-btn="saving" @confirm="onSave">
|
|
227
|
-
...表单...
|
|
228
|
-
</s-dialog>
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### `<s-drawer>`
|
|
232
|
-
|
|
233
|
-
侧边抽屉,参数同 `s-dialog`,`width` 改为 `size`(默认 720px)。
|
|
234
|
-
|
|
235
|
-
### `SMessagebox` / `SInputDialog`
|
|
236
|
-
|
|
237
|
-
以 JS 方式调起的命令式弹窗,直接从 saasui 导入调用。
|
|
238
|
-
|
|
239
|
-
```js
|
|
240
|
-
import saasui from 'saasui';
|
|
241
|
-
saasui.SMessagebox({ title: '提示', content: '...' });
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## 五、表单控件(替代 `el-*`)
|
|
247
|
-
|
|
248
|
-
> 所有控件支持 `from="text"` 进入纯展示模式,用于详情页与表单共用一套配置。
|
|
249
|
-
|
|
250
|
-
| 组件 | 替代 | 关键 props |
|
|
251
|
-
| ------------------- | ----------- | ------------------------------------------------ |
|
|
252
|
-
| `<s-input>` | el-input | `type`、`from`、默认 `clearable`、`maxlength` |
|
|
253
|
-
| `<s-input-number>` | el-input-number | |
|
|
254
|
-
| `<s-select>` | el-select | `options=[{ label, value }]`、默认 `filterable`、支持分组 |
|
|
255
|
-
| `<s-cascader>` | el-cascader | `options`、`props` |
|
|
256
|
-
| `<s-date-picker>` | el-date-picker | `type` 默认 `date`、`valueFormat` 默认 `yyyy-MM-dd` |
|
|
257
|
-
| `<s-radio-group>` | el-radio-group | `options`、`direction`(horizontal / vertical) |
|
|
258
|
-
| `<s-switch>` | el-switch | |
|
|
259
|
-
| `<s-mask-input>` | - | 脱敏输入 |
|
|
260
|
-
| `<s-currency>` | - | 货币金额输入 |
|
|
261
|
-
| `<s-currency-select>`| - | 货币种类选择 |
|
|
262
|
-
| `<s-field-group>` | - | 多字段组合,`fields=[{ field, type, ... }]` |
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
|
|
266
|
-
## 六、展示 / 反馈
|
|
267
|
-
|
|
268
|
-
| 组件 | 用途 |
|
|
269
|
-
| ----------------- | ---------------------------------------- |
|
|
270
|
-
| `<s-unit value type options>` | 状态点 / tag 样式展示,配合字典 |
|
|
271
|
-
| `<s-tag>` | 标签,替代 `el-tag` |
|
|
272
|
-
| `<s-tip>` | 提示性文字 / 弱提示 |
|
|
273
|
-
| `<s-alert>` | 警告/通知条,替代 `el-alert` |
|
|
274
|
-
| `<s-tooltip-wrap>`| 自适应文字省略 + tooltip,替代常见 `text-overflow` 包装 |
|
|
275
|
-
| `<s-item-list>` | 展示键值对列表 |
|
|
276
|
-
| `<s-steps>` | 步骤条,替代 `el-steps` |
|
|
277
|
-
| `<s-segmented>` | 分段控件 |
|
|
278
|
-
| `<s-icon>` | 图标统一入口 |
|
|
279
|
-
| `<s-empty>` | 空状态 |
|
|
280
|
-
|
|
281
|
-
### `<s-tooltip-wrap>`
|
|
282
|
-
|
|
283
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
284
|
-
| --------- | ------- | --------- | --------------- |
|
|
285
|
-
| text | String | '' | 展示文本,超出才显示 tooltip |
|
|
286
|
-
| placement | String | top-start | |
|
|
287
|
-
| lineClamp | String | '1' | 多行省略行数 |
|
|
288
|
-
| inherit | Boolean | false | 继承父级文字样式 |
|
|
289
|
-
|
|
290
|
-
### `<s-unit>`
|
|
291
|
-
|
|
292
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
293
|
-
| ------- | -------------- | --- | ------------------- |
|
|
294
|
-
| value | String/Number | - | 值 |
|
|
295
|
-
| type | String | '' | 预设类型 |
|
|
296
|
-
| options | Array | [] | 字典数组 |
|
|
297
|
-
| props | Object | - | 字段映射 `{ value, label, style }` |
|
|
298
|
-
| color | String | '' | 强制指定颜色 |
|
|
299
|
-
| isLink | Boolean | - | 是否当链接展示 |
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## 七、布局
|
|
304
|
-
|
|
305
|
-
### `<s-space>` / `<s-space-item>`
|
|
306
|
-
|
|
307
|
-
元素间距容器,替代手写 `margin`。
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## 使用规则速记
|
|
312
|
-
|
|
313
|
-
1. **新建列表页** → `s-pagetable` + `s-table` + `s-table-buttons` + `s-dialog`
|
|
314
|
-
2. **Tabs 切换** → `s-page-tabs`,不要再写 `el-tabs`
|
|
315
|
-
3. **表单字段** → `s-input` / `s-select` / `s-date-picker` / `s-radio-group`,详情页传 `from="text"` 即可
|
|
316
|
-
4. **弹窗** → 新增编辑用 `s-dialog`、侧边配置用 `s-drawer`、命令式用 `SMessagebox`
|
|
317
|
-
5. **行内操作** → 一律用 `s-table-buttons`,不要手写 `el-button` 列表
|
|
318
|
-
6. **文字省略** → `s-tooltip-wrap`,不要手写 `text-overflow`
|
|
319
|
-
7. **状态展示** → `s-unit` + 字典,不要自己拼颜色
|
|
1
|
+
# saasui 组件清单
|
|
2
|
+
|
|
3
|
+
基础组件必须优先使用 `common/saasui` 中的封装,禁止直接使用原生 `el-*` 组件。未在此列出的组件才允许回落到 Element UI。
|
|
4
|
+
|
|
5
|
+
## 使用前提
|
|
6
|
+
|
|
7
|
+
`saasui` 已在主应用中全局 `Vue.use(saasui)` 注册,模板内直接使用 kebab-case 标签即可:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<s-button type="primary">保存</s-button>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
所有组件通过 `v-bind="$attrs"` / `v-on="$listeners"` 透传到底层 Element UI,因此 element 原有 props/事件仍可使用。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 一、按钮类
|
|
18
|
+
|
|
19
|
+
### `<s-button>`
|
|
20
|
+
|
|
21
|
+
主按钮,替代 `el-button`。封装了路由跳转、`icon` 类型、边框模式。
|
|
22
|
+
|
|
23
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
24
|
+
| ------ | ------ | -------- | ----------------------------------------- |
|
|
25
|
+
| type | String | default | `primary` / `default` / `danger` / `icon` |
|
|
26
|
+
| border | String | - | 边框样式,自定义 class 后缀 |
|
|
27
|
+
| mode | String | button | `button` / `link` / `external` |
|
|
28
|
+
| path | String | - | `mode=link` 时的路由 path |
|
|
29
|
+
| query | Object | - | 路由 query |
|
|
30
|
+
| target | String | - | `_blank` 在新窗口打开 |
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<s-button type="primary" @click="handleSave">保存</s-button>
|
|
34
|
+
<s-button mode="link" path="/detail" :query="{ id }">查看</s-button>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `<s-button-text>`
|
|
38
|
+
|
|
39
|
+
文字按钮,用于表格行内次要操作,替代 `el-button type="text"`。
|
|
40
|
+
|
|
41
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
42
|
+
| ------ | ------ | ---- | --------------------- |
|
|
43
|
+
| type | String | text | `text` / `link` |
|
|
44
|
+
| path | String | - | `type=link` 时的路由 path |
|
|
45
|
+
| query | Object | - | 路由 query |
|
|
46
|
+
| target | String | - | `_blank` 在新窗口打开 |
|
|
47
|
+
|
|
48
|
+
### `<s-table-buttons>`
|
|
49
|
+
|
|
50
|
+
行内操作按钮组,**表格操作列强制使用**。超出 `maxLength` 自动收起到下拉更多。
|
|
51
|
+
|
|
52
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
53
|
+
| --------- | ------ | ---- | ------------- |
|
|
54
|
+
| list | Array | [] | 按钮配置数组,见下方字段 |
|
|
55
|
+
| row | Object | - | 当前行,透传到 onClick |
|
|
56
|
+
| maxLength | Number | 2 | 最多显示几个,其余进入更多 |
|
|
57
|
+
| moreType | String | text | `text` / `more`(更多按钮样式) |
|
|
58
|
+
|
|
59
|
+
`list` 项:`{ label, onClick, show?, tip?, attrs? }`,`show` 支持布尔或函数。
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<s-table-buttons :list="actionList" :row="row" @action="handleAction" />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 二、分页 / 布局 / 容器
|
|
68
|
+
|
|
69
|
+
### `<s-pagetable>`
|
|
70
|
+
|
|
71
|
+
**列表页外层容器,必须使用**。自带 `header` / `form` / `footer` 插槽。
|
|
72
|
+
|
|
73
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
74
|
+
| ----------------- | ------- | ----- | ------------------------ |
|
|
75
|
+
| title | String | 路由标题 | 页头标题,默认取路由 meta |
|
|
76
|
+
| mode | String | page | `page` / `form` |
|
|
77
|
+
| showHeader | Boolean | false | 是否显示头部 |
|
|
78
|
+
| showClose | Boolean | false | 显示返回箭头 |
|
|
79
|
+
| showFooter | Boolean | true | 是否渲染 footer 插槽 |
|
|
80
|
+
| showFooterButton | Boolean | false | 底部是否展示「取消 / 确认」按钮 |
|
|
81
|
+
| loadingBtn | Boolean | false | 确认按钮 loading |
|
|
82
|
+
| confirmText | String | 确定 | |
|
|
83
|
+
| cancelText | String | 取消 | |
|
|
84
|
+
|
|
85
|
+
插槽:`default`(内容)、`header`、`header-append`、`title`、`form`(搜索区)、`footer`(分页)。
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<s-pagetable>
|
|
89
|
+
<template #form>...筛选条件...</template>
|
|
90
|
+
<s-table :data="list" :columns="columns" />
|
|
91
|
+
<template #footer>
|
|
92
|
+
<el-pagination ... />
|
|
93
|
+
</template>
|
|
94
|
+
</s-pagetable>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `<s-page-tabs>` (项目中的 Tabs 基础组件)
|
|
98
|
+
|
|
99
|
+
基于数组驱动的标签页,**替代 `el-tabs`**(项目中不存在 `s-tabs`,对应组件就是这个)。支持滚动、拖拽、显隐控制。
|
|
100
|
+
|
|
101
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
102
|
+
| ------------ | ----------------- | ------------------------------ | ----------------------- |
|
|
103
|
+
| value | String / Number | '' | `v-model`,当前激活的 value |
|
|
104
|
+
| tabs | Array | [] | `{ label, value, disabled?, show? }` |
|
|
105
|
+
| fieldNames | Object | `{ label, value }` | 字段映射 |
|
|
106
|
+
| gap | String / Number | 32 | tab 间距 |
|
|
107
|
+
| showBorder | Boolean | true | 是否显示下边框 |
|
|
108
|
+
| beforeLeave | Function | - | 切换前钩子,返回 `false`/Promise reject 阻止切换 |
|
|
109
|
+
| draggable | Boolean | false | 是否开启拖拽排序 |
|
|
110
|
+
|
|
111
|
+
事件:`input`、`tab-click(tab, index)`、`tabs-sort(newTabs, { from, to, tab })`。
|
|
112
|
+
|
|
113
|
+
插槽:`extra`(右侧)、`tab-suffix`(每个 tab 尾部)。
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<s-page-tabs v-model="active" :tabs="tabs" />
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> 纯样式的简单切换也可以使用原生 `el-tabs`,但项目规范下**优先用 `s-page-tabs`**。
|
|
120
|
+
|
|
121
|
+
### `<s-page-button>`
|
|
122
|
+
|
|
123
|
+
页面级按钮区容器,用于 `s-pagetable` 顶部操作栏排布。
|
|
124
|
+
|
|
125
|
+
### `<s-card>`
|
|
126
|
+
|
|
127
|
+
内容卡片,带标题和可折叠能力。
|
|
128
|
+
|
|
129
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
130
|
+
| ---------- | ------- | ----- | -------- |
|
|
131
|
+
| title | String | '' | 卡片标题 |
|
|
132
|
+
| titleSub | String | '' | 副标题 |
|
|
133
|
+
| isCollapse | Boolean | false | 是否开启折叠箭头 |
|
|
134
|
+
|
|
135
|
+
插槽:`title`、`action`(右上角)、`default`。
|
|
136
|
+
|
|
137
|
+
### `<s-container>`
|
|
138
|
+
|
|
139
|
+
外层容器,不常用,用于非 PageTable 页面的基础容器。
|
|
140
|
+
|
|
141
|
+
### `<s-group>`
|
|
142
|
+
|
|
143
|
+
分组数据块,常用于首页卡片类分组展示。
|
|
144
|
+
|
|
145
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
146
|
+
| --------------- | -------- | ----- | ---------------------- |
|
|
147
|
+
| list | Array | [] | 分组数据,`{ label, children }` |
|
|
148
|
+
| data | Object | {} | 绑定数据 |
|
|
149
|
+
| isActive | Function | - | 判断 item 是否激活 |
|
|
150
|
+
| showGroupTitle | Boolean | false | 是否显示分组标题 |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 三、表格
|
|
155
|
+
|
|
156
|
+
### `<s-table>`
|
|
157
|
+
|
|
158
|
+
**列表页表格强制使用**。继承 `el-table` 全部 props + 事件,新增 `columns` 配置化、内置多选列。
|
|
159
|
+
|
|
160
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
161
|
+
| ---------------- | -------- | ------- | --------------------------------- |
|
|
162
|
+
| data | Array | - | 同 `el-table` |
|
|
163
|
+
| border | Boolean | true | 默认有边框 |
|
|
164
|
+
| columns | Array | [] | 列配置,见下方 |
|
|
165
|
+
| minWidth | Number/String | 160 | 列默认最小宽度 |
|
|
166
|
+
| selectable | Boolean | false | 是否展示多选列 |
|
|
167
|
+
| selectableType | String | default | `default` / `all`(跨页全选) |
|
|
168
|
+
| reserveSelection | Boolean | false | 翻页保留选中 |
|
|
169
|
+
| checkSelectable | Function | () => true | 行是否可选 |
|
|
170
|
+
| selected | Array | [] | 跨页全选时的选中 id 集合,需 `:selected.sync` |
|
|
171
|
+
|
|
172
|
+
`columns` 项字段:
|
|
173
|
+
|
|
174
|
+
| 字段 | 说明 |
|
|
175
|
+
| -------- | ---------------------------------------- |
|
|
176
|
+
| label | 表头文字 |
|
|
177
|
+
| value | 对应 `prop`,也是插槽名 |
|
|
178
|
+
| type | `text` / `select` / `unit` / `operate` / `index` / `UserModel` |
|
|
179
|
+
| tip | 表头 tooltip |
|
|
180
|
+
| width / minWidth / fixed | 列宽、冻结 |
|
|
181
|
+
| actionList | `type=operate` 时的按钮数组 |
|
|
182
|
+
| options | `type=select` / `unit` 时的字典 |
|
|
183
|
+
|
|
184
|
+
事件:`action(name, row, column)`(操作列)、`selection-change`、`select-all`、透传 `el-table` 所有事件。
|
|
185
|
+
|
|
186
|
+
暴露方法:`doLayout()`、`clearSelection()`、`toggleRowSelection()`、`getSelection()`。
|
|
187
|
+
|
|
188
|
+
```vue
|
|
189
|
+
<s-table
|
|
190
|
+
:data="list"
|
|
191
|
+
:columns="[
|
|
192
|
+
{ label: '姓名', value: 'name' },
|
|
193
|
+
{ label: '状态', value: 'status', type: 'unit', options: statusOptions },
|
|
194
|
+
{ label: '操作', value: 'action', type: 'operate', actionList },
|
|
195
|
+
]"
|
|
196
|
+
@action="onAction" />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `<s-table-column>`
|
|
200
|
+
|
|
201
|
+
内置于 `s-table` 的列渲染器,一般不直接使用,通过 `columns` 配置。
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 四、弹窗 / 抽屉
|
|
206
|
+
|
|
207
|
+
### `<s-dialog>`
|
|
208
|
+
|
|
209
|
+
**新增 / 编辑弹窗必须使用**。继承 `el-dialog` 全部 props,内置 footer、loading。
|
|
210
|
+
|
|
211
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
212
|
+
| ------------------ | ------------- | ----- | ------------------- |
|
|
213
|
+
| visible | Boolean | false | 使用 `visible.sync` |
|
|
214
|
+
| width | String/Number | 720px | |
|
|
215
|
+
| showFooter | Boolean | true | 是否显示底部按钮 |
|
|
216
|
+
| showCancelButton | Boolean | true | |
|
|
217
|
+
| showConfirmButton | Boolean | true | |
|
|
218
|
+
| loadingBtn | Boolean | false | 确认按钮 loading |
|
|
219
|
+
| confirmText | String | 确定 | |
|
|
220
|
+
| cancelText | String | 取消 | |
|
|
221
|
+
| closeOnClickModal | Boolean | false | 强制 false,点击遮罩不关闭 |
|
|
222
|
+
|
|
223
|
+
事件:`confirm`、`close`、`update:visible`。
|
|
224
|
+
|
|
225
|
+
```vue
|
|
226
|
+
<s-dialog :visible.sync="visible" title="新增" :loading-btn="saving" @confirm="onSave">
|
|
227
|
+
...表单...
|
|
228
|
+
</s-dialog>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### `<s-drawer>`
|
|
232
|
+
|
|
233
|
+
侧边抽屉,参数同 `s-dialog`,`width` 改为 `size`(默认 720px)。
|
|
234
|
+
|
|
235
|
+
### `SMessagebox` / `SInputDialog`
|
|
236
|
+
|
|
237
|
+
以 JS 方式调起的命令式弹窗,直接从 saasui 导入调用。
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
import saasui from 'saasui';
|
|
241
|
+
saasui.SMessagebox({ title: '提示', content: '...' });
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 五、表单控件(替代 `el-*`)
|
|
247
|
+
|
|
248
|
+
> 所有控件支持 `from="text"` 进入纯展示模式,用于详情页与表单共用一套配置。
|
|
249
|
+
|
|
250
|
+
| 组件 | 替代 | 关键 props |
|
|
251
|
+
| ------------------- | ----------- | ------------------------------------------------ |
|
|
252
|
+
| `<s-input>` | el-input | `type`、`from`、默认 `clearable`、`maxlength` |
|
|
253
|
+
| `<s-input-number>` | el-input-number | |
|
|
254
|
+
| `<s-select>` | el-select | `options=[{ label, value }]`、默认 `filterable`、支持分组 |
|
|
255
|
+
| `<s-cascader>` | el-cascader | `options`、`props` |
|
|
256
|
+
| `<s-date-picker>` | el-date-picker | `type` 默认 `date`、`valueFormat` 默认 `yyyy-MM-dd` |
|
|
257
|
+
| `<s-radio-group>` | el-radio-group | `options`、`direction`(horizontal / vertical) |
|
|
258
|
+
| `<s-switch>` | el-switch | |
|
|
259
|
+
| `<s-mask-input>` | - | 脱敏输入 |
|
|
260
|
+
| `<s-currency>` | - | 货币金额输入 |
|
|
261
|
+
| `<s-currency-select>`| - | 货币种类选择 |
|
|
262
|
+
| `<s-field-group>` | - | 多字段组合,`fields=[{ field, type, ... }]` |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 六、展示 / 反馈
|
|
267
|
+
|
|
268
|
+
| 组件 | 用途 |
|
|
269
|
+
| ----------------- | ---------------------------------------- |
|
|
270
|
+
| `<s-unit value type options>` | 状态点 / tag 样式展示,配合字典 |
|
|
271
|
+
| `<s-tag>` | 标签,替代 `el-tag` |
|
|
272
|
+
| `<s-tip>` | 提示性文字 / 弱提示 |
|
|
273
|
+
| `<s-alert>` | 警告/通知条,替代 `el-alert` |
|
|
274
|
+
| `<s-tooltip-wrap>`| 自适应文字省略 + tooltip,替代常见 `text-overflow` 包装 |
|
|
275
|
+
| `<s-item-list>` | 展示键值对列表 |
|
|
276
|
+
| `<s-steps>` | 步骤条,替代 `el-steps` |
|
|
277
|
+
| `<s-segmented>` | 分段控件 |
|
|
278
|
+
| `<s-icon>` | 图标统一入口 |
|
|
279
|
+
| `<s-empty>` | 空状态 |
|
|
280
|
+
|
|
281
|
+
### `<s-tooltip-wrap>`
|
|
282
|
+
|
|
283
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
284
|
+
| --------- | ------- | --------- | --------------- |
|
|
285
|
+
| text | String | '' | 展示文本,超出才显示 tooltip |
|
|
286
|
+
| placement | String | top-start | |
|
|
287
|
+
| lineClamp | String | '1' | 多行省略行数 |
|
|
288
|
+
| inherit | Boolean | false | 继承父级文字样式 |
|
|
289
|
+
|
|
290
|
+
### `<s-unit>`
|
|
291
|
+
|
|
292
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
293
|
+
| ------- | -------------- | --- | ------------------- |
|
|
294
|
+
| value | String/Number | - | 值 |
|
|
295
|
+
| type | String | '' | 预设类型 |
|
|
296
|
+
| options | Array | [] | 字典数组 |
|
|
297
|
+
| props | Object | - | 字段映射 `{ value, label, style }` |
|
|
298
|
+
| color | String | '' | 强制指定颜色 |
|
|
299
|
+
| isLink | Boolean | - | 是否当链接展示 |
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## 七、布局
|
|
304
|
+
|
|
305
|
+
### `<s-space>` / `<s-space-item>`
|
|
306
|
+
|
|
307
|
+
元素间距容器,替代手写 `margin`。
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 使用规则速记
|
|
312
|
+
|
|
313
|
+
1. **新建列表页** → `s-pagetable` + `s-table` + `s-table-buttons` + `s-dialog`
|
|
314
|
+
2. **Tabs 切换** → `s-page-tabs`,不要再写 `el-tabs`
|
|
315
|
+
3. **表单字段** → `s-input` / `s-select` / `s-date-picker` / `s-radio-group`,详情页传 `from="text"` 即可
|
|
316
|
+
4. **弹窗** → 新增编辑用 `s-dialog`、侧边配置用 `s-drawer`、命令式用 `SMessagebox`
|
|
317
|
+
5. **行内操作** → 一律用 `s-table-buttons`,不要手写 `el-button` 列表
|
|
318
|
+
6. **文字省略** → `s-tooltip-wrap`,不要手写 `text-overflow`
|
|
319
|
+
7. **状态展示** → `s-unit` + 字典,不要自己拼颜色
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
## 纯粹 ui组件库 基于elementui的二次封装
|
|
3
|
-
```js
|
|
4
|
-
import saasui from 'saasui';
|
|
5
|
-
Vue.use(saasui)
|
|
1
|
+
|
|
2
|
+
## 纯粹 ui组件库 基于elementui的二次封装
|
|
3
|
+
```js
|
|
4
|
+
import saasui from 'saasui';
|
|
5
|
+
Vue.use(saasui)
|
|
6
6
|
```
|