@v2coding/ui 0.1.4 → 0.1.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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/v2coding-ui.esm.js +1452 -679
  3. package/dist/v2coding-ui.min.js +1 -1
  4. package/dist/v2coding-ui.ssr.js +1469 -679
  5. package/package.json +2 -3
  6. package/src/components/dialog/dialog.vue +0 -179
  7. package/src/components/drawer/drawer.vue +0 -523
  8. package/src/components/exports/index.vue +0 -53
  9. package/src/components/exports/remote-exports-dialog.vue +0 -202
  10. package/src/components/field/field.autocomplete.vue +0 -21
  11. package/src/components/field/field.calendar.vue +0 -117
  12. package/src/components/field/field.cascade.vue +0 -233
  13. package/src/components/field/field.checkbox.vue +0 -134
  14. package/src/components/field/field.color.vue +0 -24
  15. package/src/components/field/field.date.vue +0 -145
  16. package/src/components/field/field.icons.vue +0 -123
  17. package/src/components/field/field.number.vue +0 -43
  18. package/src/components/field/field.radio.vue +0 -100
  19. package/src/components/field/field.rate.vue +0 -37
  20. package/src/components/field/field.rich.vue +0 -155
  21. package/src/components/field/field.select.vue +0 -210
  22. package/src/components/field/field.slider.vue +0 -66
  23. package/src/components/field/field.switch.vue +0 -14
  24. package/src/components/field/field.text.vue +0 -66
  25. package/src/components/field/field.timepicker.vue +0 -70
  26. package/src/components/field/field.timeselect.vue +0 -24
  27. package/src/components/field/field.trigger.dialog.vue +0 -50
  28. package/src/components/field/field.trigger.popover.vue +0 -63
  29. package/src/components/field/field.upload.file.vue +0 -241
  30. package/src/components/field/field.upload.image.vue +0 -125
  31. package/src/components/fill-view/fill-view.vue +0 -43
  32. package/src/components/form/form.dialog.vue +0 -174
  33. package/src/components/form/form.drawer.vue +0 -246
  34. package/src/components/form/form.fieldset.vue +0 -110
  35. package/src/components/form/form.item.vue +0 -210
  36. package/src/components/form/form.vue +0 -302
  37. package/src/components/head-menu/head-menu.vue +0 -188
  38. package/src/components/head-menu/menu-item.vue +0 -80
  39. package/src/components/history/history.vue +0 -361
  40. package/src/components/icon/icon.vue +0 -63
  41. package/src/components/minimize/minimize.vue +0 -342
  42. package/src/components/page/page.vue +0 -43
  43. package/src/components/page/search-page.vue +0 -202
  44. package/src/components/provider/provider.vue +0 -15
  45. package/src/components/scroll-view/scroll-view.vue +0 -384
  46. package/src/components/table/column.vue +0 -262
  47. package/src/components/table/table.pagination.vue +0 -71
  48. package/src/components/table/table.select.vue +0 -165
  49. package/src/components/table/table.vue +0 -807
@@ -1,155 +0,0 @@
1
- <template>
2
- <quill-editor :content="value" :options="realOptions" @change="onChange"></quill-editor>
3
- </template>
4
-
5
- <script>
6
- import {Message} from 'element-ui';
7
- import {Quill, quillEditor} from 'vue-quill-editor';
8
- import FieldMixin from './field.mixin';
9
- import {quillRedefine} from './field.rich.upload';
10
- import 'quill/dist/quill.core.css';
11
- import 'quill/dist/quill.snow.css';
12
- import 'quill/dist/quill.bubble.css';
13
- import Objects from '../../util/objects';
14
-
15
- const Font = Quill.import('formats/font');
16
-
17
- Font.whitelist = ['Arial', 'FangSong', 'HeiTi', 'Microsoft'];
18
-
19
- Quill.register(Font, true);
20
-
21
- const defaultConfig = {
22
- upload: {
23
- url: ({type}) => (type === 'oss' ? '/aliyun/oss' : '/api/oss/upload'), // 必填参数 图片上传地址
24
- accept: 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon', // 可选 可上传的图片格式
25
- filename: 'file', // 必填参数 文件的参数名
26
- type: 'oss', // default:上传至服务器; oss:上传至oss
27
- afterUpload(result) {
28
- if (!result.success) {
29
- Message.error(result.message || '上传错误');
30
- return;
31
- }
32
- return result.content.url;
33
- },
34
- beforeUpload: () => void 0,
35
- },
36
- placeholder: '请输入...',
37
- theme: 'snow', // 主题
38
- modules: {
39
- toolbar: {
40
- // 工具栏选项
41
- container: [
42
- ['bold', 'italic', 'underline', 'strike'],
43
- ['blockquote', 'code-block'],
44
- [{header: 1}, {header: 2}],
45
- [{list: 'ordered'}, {list: 'bullet'}],
46
- [{script: 'sub'}, {script: 'super'}],
47
- [{indent: '-1'}, {indent: '+1'}],
48
- [{direction: 'rtl'}],
49
- [{size: ['small', false, 'large', 'huge']}],
50
- [{header: [1, 2, 3, 4, 5, 6, false]}],
51
- [{color: []}, {background: []}],
52
- [{font: ['Arial', 'FangSong', 'HeiTi', 'Microsoft']}],
53
- [{align: []}],
54
- ['clean'],
55
- ['link', 'image', 'video'],
56
- ],
57
- },
58
- },
59
- };
60
-
61
- const RichField = {
62
- name: 'ui-field-rich',
63
- mixins: [FieldMixin],
64
- components: {
65
- quillEditor,
66
- },
67
- computed: {
68
- realOptions() {
69
- return quillRedefine(Objects.merge({}, defaultConfig, this.$attrs));
70
- },
71
- },
72
- methods: {
73
- onChange({html}) {
74
- this.emitChange(html);
75
- },
76
- },
77
- };
78
-
79
- export default RichField;
80
- </script>
81
-
82
- <style lang="less">
83
- .quill-editor {
84
- /*工具栏内用*/
85
-
86
- .ql-font {
87
- span[data-value="Arial"]::before {
88
- content: "Arial" !important;
89
- font-family: "Arial",serif;
90
- }
91
-
92
- span[data-value="FangSong"]::before {
93
- content: "仿宋" !important;
94
- font-family: "仿宋_GB2312", "FangSong_GB2312", "宋体", "SimSun", "STFangsong","STSong", serif;
95
- }
96
-
97
- span[data-value="HeiTi"]::before {
98
- content: "黑体" !important;
99
- font-family: "黑体", "SimHei", "微软正黑体", "Microsoft JhengHei", "STHeiti",serif;
100
- }
101
-
102
- span[data-value="Microsoft"]::before {
103
- content: "微软雅黑" !important;
104
- font-family: "微软雅黑", "Microsoft YaHei",serif;
105
- }
106
- }
107
-
108
- /*编辑器内容用*/
109
-
110
- .ql-font-Arial {
111
- font-family: "Arial",serif;
112
- }
113
-
114
- .ql-font-FangSong {
115
- font-family: "仿宋_GB2312", "FangSong_GB2312", "宋体", "SimSun", "STFangsong","STSong", serif;
116
- }
117
-
118
- .ql-font-HeiTi {
119
- font-family: "黑体", "SimHei", "微软正黑体", "Microsoft JhengHei", "STHeiti",serif;
120
- }
121
-
122
- .ql-font-Microsoft {
123
- font-family: "微软雅黑", "Microsoft YaHei",serif;
124
- }
125
- }
126
- </style>
127
-
128
- <style lang="less" scoped>
129
- .quill-editor {
130
- width: 100%;
131
-
132
- display: flex;
133
- align-items: initial !important;
134
- flex-direction: column;
135
-
136
- .ql-toolbar {
137
- flex: none;
138
- }
139
-
140
- .ql-container {
141
- flex: auto;
142
- height: initial;
143
- display: flex;
144
- flex-direction: column;
145
-
146
- .ql-editor {
147
- flex: auto;
148
- }
149
- }
150
- }
151
-
152
- .quill-editor ::v-deep .ql-editor {
153
- min-height: 200px;
154
- }
155
- </style>
@@ -1,210 +0,0 @@
1
- <template>
2
- <div class="ui-field-select">
3
- <el-select ref="select" v-if="!refresh" v-bind="$attrs" v-on="_listeners" :value="pickerValue" :clearable="clearable" :multiple="multiple" :filterable="filterable" :filter-method="filterMethod" @input="onChange" @blur="onBlur" v-loading="realLoading" element-loading-spinner="el-icon-loading">
4
- <el-option v-bind="item" v-for="item in displayOptions" :key="item.value">
5
- <span v-html="item.label"></span>
6
- </el-option>
7
- <el-option v-if="isEmpty" value="__error__" disabled class="empty" label="重新加载" @click="init">
8
- 暂无数据!&emsp;
9
- <el-button v-show="realError" type="text" @click="init">重新加载</el-button>
10
- </el-option>
11
- </el-select>
12
- <div v-if="refresh" class="el-input-group el-input-group--append">
13
- <el-select ref="refreshSelect" v-bind="$attrs" v-on="_listeners" :value="pickerValue" :clearable="clearable" :multiple="multiple" :filterable="filterable" :filter-method="filterMethod" @input="onChange" @blur="onBlur" v-loading="realLoading" element-loading-spinner="el-icon-loading">
14
- <el-option v-bind="item" v-for="item in displayOptions" :key="item.value">
15
- <span v-html="item.label"></span>
16
- </el-option>
17
- <el-option v-if="isEmpty" value="__error__" disabled class="empty" label="重新加载" @click="init">
18
- 暂无数据!&emsp;
19
- <el-button v-show="realError" type="text" @click="init">重新加载</el-button>
20
- </el-option>
21
- </el-select>
22
- <div class="el-input-group__append">
23
- <el-button @click="onRefresh" icon="el-icon-refresh"></el-button>
24
- </div>
25
- </div>
26
- </div>
27
- </template>
28
-
29
- <script>
30
- import FieldMixin from './field.mixin';
31
- import DataMixin from './field.data.mixin';
32
- import Objects from '../../util/objects';
33
- // 简体中文 https://github.com/xmflswood/pinyin-match/issues
34
- import PinyinMatch from 'pinyin-match';
35
-
36
- export default {
37
- name: 'ui-field-select',
38
- mixins: [FieldMixin, DataMixin],
39
- inheritAttrs: false,
40
- props: {
41
- // 是否初始选中
42
- startNull: {
43
- type: Boolean,
44
- default: true,
45
- },
46
- clearable: {
47
- type: Boolean,
48
- default: true,
49
- },
50
- multiple: Boolean,
51
- refresh: Boolean,
52
- filterable: {
53
- type: Boolean,
54
- default: true,
55
- },
56
- },
57
- data() {
58
- return {
59
- query: '',
60
- };
61
- },
62
- computed: {
63
- isEmpty() {
64
- return !this.depends && !this.displayOptions.length;
65
- },
66
- pickerValue() {
67
- return this.getPickerValue(this.value);
68
- },
69
- displayOptions({realData, query}) {
70
- if (!query) {
71
- return realData;
72
- }
73
- return realData.filter(option => PinyinMatch.match(option.label, query));
74
- },
75
- },
76
- watch: {
77
- displayOptions(data, o) {
78
- if (!Objects.isEquals(data, o)) {
79
- this.initDefaultValue(data);
80
- }
81
- },
82
- },
83
- methods: {
84
- onRefresh() {
85
- this.$emit('refresh');
86
- },
87
- async init() {
88
- if (this.startNull) {
89
- this.done();
90
- }
91
- await this.getData();
92
- this.validateValue(String(this.value));
93
- if (!this.startNull) {
94
- this.initDefaultValue(this.realData);
95
- await this.$nextTick();
96
- this.done();
97
- }
98
- },
99
- initDefaultValue(data) {
100
- if (this.lockedValue) {
101
- if (this.value !== this.lockedValue) {
102
- this.onChange(this.lockedValue, true);
103
- }
104
- return;
105
- }
106
- const isSelect = data.some(item => this.value === item.value);
107
- if (isSelect) {
108
- return;
109
- }
110
- if (data.length <= 0 || this.startNull || this.multiple) {
111
- this.onChange(undefined, true);
112
- return;
113
- }
114
- const first = data.find(Boolean);
115
- first && first.value !== this.value && this.onChange(first.value, true);
116
- },
117
- getPickerValue(value) {
118
- if (this.multiple) {
119
- const arr = value ? value.split(',') : [];
120
- return arr.filter(v => this.validatePickerValue(v));
121
- }
122
- const v = String(value);
123
- return this.validatePickerValue(v) ? v : undefined;
124
- },
125
- validateValue(value) {
126
- if (this.multiple) {
127
- const arr = value ? value.split(',') : [];
128
- const validateValue = arr.filter(v => this.validatePickerValue(v)).join(',');
129
- if (validateValue !== value) {
130
- this.emitChange(validateValue);
131
- }
132
- // } else {
133
- // const isValid = this.validatePickerValue(value);
134
- // if (!isValid) {
135
- // this.emitChange();
136
- // }
137
- }
138
- },
139
- validatePickerValue(value) {
140
- return (this.realData || []).some(item => item.value === value);
141
- },
142
- getRealValue(value) {
143
- if (this.multiple) {
144
- return (value || []).join(',');
145
- }
146
- return value || '';
147
- },
148
- onChange(val, isInit) {
149
- if (val === '__error__') {
150
- return;
151
- }
152
- if (this.multiple && Array.isArray(val)) {
153
- const index = val.indexOf('__error__');
154
- if (index !== -1) {
155
- if (val.length === 1 ) {
156
- return;
157
- }
158
- val.splice(index, 1);
159
- }
160
- }
161
- val = this.getRealValue(val);
162
- if (isInit !== true) {
163
- this.$emit('update:lockedValue', val);
164
- }
165
- this.emitChange(val);
166
- },
167
- resetValue() {
168
- this.onChange(this.multiple ? [] : '');
169
- },
170
- focus() {
171
- const select = this.$refs.select;
172
- const refreshSelect = this.$refs.refreshSelect;
173
- if (select) {
174
- select.focus();
175
- } else if (refreshSelect) {
176
- refreshSelect.focus();
177
- }
178
- },
179
- filterMethod(query) {
180
- this.query = query;
181
- },
182
- onBlur() {
183
- this.query = '';
184
- },
185
- },
186
- };
187
- </script>
188
-
189
- <style lang="less">
190
- .ui-field-select {
191
- .el-select {
192
- width: 100%;
193
- }
194
-
195
- .el-input-group--append .el-select .el-input.is-focus .el-input__inner {
196
- border-color: var(--color-primary);
197
- }
198
-
199
- .empty {
200
- font-size: 12px;
201
- color: #909399;
202
- display: flex;
203
- align-items: center;
204
- }
205
-
206
- .el-loading-mask .el-loading-spinner {
207
- margin-top: -14px;
208
- }
209
- }
210
- </style>
@@ -1,66 +0,0 @@
1
- <template>
2
- <el-slider v-bind="$attrs" v-on="_listeners" v-model="v" :min="min" :max="max" :range="range" @input="onInput"></el-slider>
3
- </template>
4
-
5
- <script>
6
- import debounce from 'lodash.debounce';
7
- import FieldMixin from './field.mixin';
8
-
9
- export default {
10
- name: 'ui-field-slider',
11
- mixins: [FieldMixin],
12
- props: {
13
- range: Boolean,
14
- min: {
15
- type: Number,
16
- default: 0,
17
- },
18
- max: {
19
- type: Number,
20
- default: 100,
21
- },
22
- },
23
- data() {
24
- return {
25
- v: this.getPickerValue(this.value),
26
- };
27
- },
28
- watch: {
29
- value() {
30
- this.v = this.getPickerValue(this.value);
31
- },
32
- },
33
- methods: {
34
- getPickerValue(value) {
35
- if (this.range) {
36
- let [start, end] = value ? value.split(',') : [this.min, this.max];
37
- start = Math.max(Number(start), this.min);
38
- end = Math.min(Number(end), this.max);
39
- if (isNaN(start)) {
40
- start = this.min;
41
- }
42
- if (isNaN(end)) {
43
- end = this.max;
44
- }
45
- start = Math.min(start, end);
46
- end = Math.max(start, end);
47
- return [start, end];
48
- }
49
- const num = Number(value);
50
- return isNaN(num) ? this.min : num;
51
- },
52
- getRealValue(value) {
53
- if (this.range) {
54
- return value.join(',');
55
- }
56
- return value || '';
57
- },
58
- onInput: debounce(function(value) {
59
- const _value = this.getRealValue(value);
60
- this.emitChange(_value);
61
- }, 200, {leading: true}),
62
- },
63
- };
64
- </script>
65
-
66
- <style scoped></style>
@@ -1,14 +0,0 @@
1
- <template>
2
- <el-switch v-bind="$attrs" :value="value" v-on="$listeners"></el-switch>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-switch',
10
- mixins: [FieldMixin],
11
- };
12
- </script>
13
-
14
- <style scoped></style>
@@ -1,66 +0,0 @@
1
- <template>
2
- <el-input v-bind="$attrs" v-on="$listeners" :value="value" :type="type" :maxlength="maxlength" :clearable="clearable" :rows="rows" :autosize="autosize" :show-word-limit="showWordLimit"/>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-text',
10
- inheritAttrs: false,
11
- mixins: [FieldMixin],
12
- props: {
13
- type: {
14
- type: String,
15
- default: 'text',
16
- },
17
- maxlength: {
18
- type: Number,
19
- default() {
20
- if (this.type === 'text') {
21
- return 40;
22
- }
23
- return undefined;
24
- },
25
- },
26
- clearable: {
27
- type: Boolean,
28
- default: true,
29
- },
30
- rows: {
31
- type: Number,
32
- default: 3,
33
- },
34
- autosize: {
35
- type: [Boolean, Object],
36
- default: () => ({minRows: 3, maxRows: 5}),
37
- },
38
- showWordLimit: {
39
- type: Boolean,
40
- default: true,
41
- },
42
- },
43
- };
44
- </script>
45
-
46
- <style lang="less">
47
-
48
-
49
- .el-input__suffix-inner {
50
- display: flex;
51
- align-items: center;
52
- height: 100%;
53
- }
54
-
55
- .el-input--large .el-input__count .el-input__count-inner {
56
- line-height: 38px;
57
- }
58
-
59
- .el-input--medium .el-input__count .el-input__count-inner {
60
- line-height: 34px;
61
- }
62
-
63
- .el-input--mini .el-input__count .el-input__count-inner {
64
- line-height: 26px;
65
- }
66
- </style>
@@ -1,70 +0,0 @@
1
- <template>
2
- <el-time-picker v-bind="$attrs" v-on="_listeners" :value="pickerValue" :is-range="isRange" :value-format="valueFormat" :start-placeholder="startPlaceholder" :end-placeholder="endPlaceholder" @input="onChange" class="ui-timepicker-field"></el-time-picker>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-timepicker',
10
- mixins: [FieldMixin],
11
- props: {
12
- isRange: Boolean,
13
- valueFormat: {
14
- type: String,
15
- default: 'HH:mm:ss',
16
- },
17
- startPlaceholder: {
18
- type: String,
19
- default: '开始时间',
20
- },
21
- endPlaceholder: {
22
- type: String,
23
- default: '结束时间',
24
- },
25
- },
26
- // data() {
27
- // return {
28
- // v: this.getPickerValue(this.value),
29
- // };
30
- // },
31
- computed: {
32
- pickerValue() {
33
- return this.getPickerValue(this.value);
34
- },
35
- },
36
- // watch: {
37
- // value() {
38
- // this.v = this.getPickerValue(this.value);
39
- // },
40
- // },
41
- methods: {
42
- getPickerValue(value) {
43
- if (this.isRange) {
44
- return value ? value.split(',') : ['', ''];
45
- }
46
- return value;
47
- },
48
- getRealValue(value) {
49
- if (this.isRange && Array.isArray(value)) {
50
- return value.map((item) => item || '').join(',');
51
- }
52
- return value || '';
53
- },
54
- onChange(value) {
55
- const _value = this.getRealValue(value);
56
- this.emitChange(_value);
57
- },
58
- focus() {
59
- const timepicker = this.$children[0];
60
- timepicker && timepicker.focus();
61
- },
62
- },
63
- };
64
- </script>
65
-
66
- <style lang="less" scoped>
67
- .ui-timepicker-field.el-date-editor {
68
- width: 100%;
69
- }
70
- </style>
@@ -1,24 +0,0 @@
1
- <template>
2
- <el-time-select v-bind="$attrs" v-on="$listeners" :value="value" class="ui-timeselect-field"></el-time-select>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-timeselect',
10
- mixins: [FieldMixin],
11
- methods: {
12
- focus() {
13
- const timeselect = this.$children[0];
14
- timeselect && timeselect.focus();
15
- },
16
- },
17
- };
18
- </script>
19
-
20
- <style lang="less" scoped>
21
- .ui-timeselect-field.el-date-editor {
22
- width: 100%;
23
- }
24
- </style>
@@ -1,50 +0,0 @@
1
- <template>
2
- <div class="ui-field-trigger-dialog">
3
- <el-input :placeholder="placeholder" :value="value" readonly @focus="show">
4
- <el-button slot="append" :icon="icon" @click="show"></el-button>
5
- </el-input>
6
- <ui-dialog :title="placeholder" v-bind="dialog" v-on="$listeners" :visible.sync="visible" :cancel="cancel" :confirm="confirm">
7
- <slot></slot>
8
- </ui-dialog>
9
- </div>
10
- </template>
11
-
12
- <script>
13
- import FieldMixin from './field.mixin';
14
-
15
- export default {
16
- name: 'ui-field-trigger-dialog',
17
- mixins: [FieldMixin],
18
- props: {
19
- placeholder: String,
20
- cancel: {
21
- type: Function,
22
- default: (hide) => hide(),
23
- },
24
- confirm: {
25
- type: Function,
26
- default: (hide) => hide(),
27
- },
28
- icon: {
29
- type: String,
30
- default: 'el-icon-search',
31
- },
32
- dialog: [Object, String],
33
- },
34
- data() {
35
- return {
36
- visible: false,
37
- };
38
- },
39
- methods: {
40
- show() {
41
- this.visible = true;
42
- },
43
- },
44
- };
45
- </script>
46
-
47
- <style lang="less" scoped>
48
- .ui-field-trigger-dialog {
49
- }
50
- </style>