@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,134 +0,0 @@
1
- <template>
2
- <div class="ui-field-checkbox" v-loading="realLoading" element-loading-spinner="el-icon-loading">
3
- <el-checkbox-group v-show="all && realData.length" class="all" :value="checkAll">
4
- <component :is="optionComponent" :indeterminate="indeterminate" @change="onCheckAllChange" :border="ui === 'border'">全选</component>
5
- </el-checkbox-group>
6
- <el-divider v-show="all && realData.length" direction="vertical"></el-divider>
7
- <el-checkbox-group v-bind="$attrs" :value="pickerValue" @input="onChange" class="options">
8
- <component
9
- :is="optionComponent"
10
- v-for="item in realData"
11
- :key="item.value"
12
- :label="item.value"
13
- :border="ui === 'border'"
14
- :checked="item.checked"
15
- :disabled="item.disabled"
16
- :true-label="item.trueLabel"
17
- :false-label="item.falseLabel"
18
- >
19
- {{ item.label }}
20
- </component>
21
- </el-checkbox-group>
22
- <div v-if="isEmpty" class="empty">暂无数据!&emsp;<el-button v-show="realError" type="text" @click="init">重新加载</el-button>
23
- </div>
24
- </div>
25
- </template>
26
-
27
- <script>
28
- import FieldMixin from './field.mixin';
29
- import DataMixin from './field.data.mixin';
30
-
31
- export default {
32
- name: 'ui-field-checkbox',
33
- mixins: [FieldMixin, DataMixin],
34
- props: {
35
- ui: {
36
- type: String,
37
- validator: (val) => ['default', 'border', 'button'].includes(val),
38
- },
39
- all: {
40
- type: Boolean,
41
- default: true,
42
- },
43
- },
44
- computed: {
45
- pickerValue() {
46
- return this.valueToArr(this.value);
47
- },
48
- optionComponent() {
49
- if (this.ui === 'button') {
50
- return 'el-checkbox-button';
51
- }
52
- return 'el-checkbox';
53
- },
54
- checkAll() {
55
- const valueArr = this.value ? this.value.split(',') : [];
56
- return !this.realData.some((item) => !valueArr.includes(String(item.value)));
57
- },
58
- indeterminate() {
59
- if (this.checkAll) {
60
- return false;
61
- }
62
- return !!this.pickerValue.length;
63
- },
64
- isEmpty() {
65
- return !this.realData.length;
66
- },
67
- },
68
- methods: {
69
- init() {
70
- this.getData().then(() => {
71
- this.done();
72
- });
73
- },
74
- valueToArr(value) {
75
- return value ? value.split(',') : [];
76
- },
77
- onCheckAllChange(checkAll) {
78
- if (checkAll) {
79
- const vals = this.realData.map(({value}) => value);
80
- this.onChange(vals);
81
- } else {
82
- this.onChange([]);
83
- }
84
- },
85
- onChange(val) {
86
- this.emitChange(val.join(','));
87
- },
88
- resetValue() {
89
- this.onChange([]);
90
- },
91
- },
92
- };
93
- </script>
94
-
95
- <style lang="less" scoped>
96
- .ui-field-checkbox {
97
- .all {
98
- display: flex;
99
-
100
- > .el-checkbox {
101
- margin-right: 0;
102
- }
103
- }
104
-
105
- .options {
106
- display: flex;
107
- flex-direction: row;
108
- align-items: center;
109
- }
110
-
111
- .empty {
112
- display: inline-flex;
113
- align-items: center;
114
- font-size: 12px;
115
- color: #909399;
116
- }
117
-
118
- ::v-deep .el-checkbox {
119
- margin: 0 8px 0 0;
120
- }
121
-
122
- ::v-deep .el-checkbox.is-bordered + .el-checkbox.is-bordered {
123
- margin-left: 0;
124
- }
125
-
126
- ::v-deep .el-divider {
127
- margin: 0 10px;
128
- }
129
- }
130
-
131
- ::v-deep .el-loading-mask .el-loading-spinner {
132
- margin-top: -14px;
133
- }
134
- </style>
@@ -1,24 +0,0 @@
1
- <template>
2
- <el-color-picker v-bind="$attrs" v-on="$listeners" :value="value" :show-alpha="showAlpha" class="ui-field-color"></el-color-picker>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-color',
10
- mixins: [FieldMixin],
11
- props: {
12
- showAlpha: {
13
- type: Boolean,
14
- default: true,
15
- },
16
- },
17
- };
18
- </script>
19
-
20
- <style scoped>
21
- .ui-field-color {
22
- width: 100%;
23
- }
24
- </style>
@@ -1,145 +0,0 @@
1
- <template>
2
- <el-date-picker
3
- v-bind="$attrs"
4
- v-on="_listeners"
5
- :value="pickerValue"
6
- :type="type"
7
- :format="format"
8
- :value-format="valueFormat"
9
- :start-placeholder="startPlaceholder"
10
- :end-placeholder="endPlaceholder"
11
- :picker-options="realPickerOptions"
12
- @input="onChange"
13
- class="ui-date-field"
14
- />
15
- </template>
16
-
17
- <script>
18
- import FieldMixin from './field.mixin';
19
- import {DisabledDate, Shortcuts} from './field.date.picker-options';
20
-
21
- export default {
22
- name: 'ui-field-date',
23
- mixins: [FieldMixin],
24
- props: {
25
- type: {
26
- type: String,
27
- default: 'date',
28
- },
29
- format: {
30
- type: String,
31
- default() {
32
- switch (this.type) {
33
- case 'year':
34
- return 'yyyy';
35
- case 'month':
36
- case 'monthrange':
37
- return 'yyyy-MM';
38
- case 'week':
39
- return 'yyyy-WW';
40
- case 'datetime':
41
- case 'datetimerange':
42
- return 'yyyy-MM-dd HH:mm:ss';
43
- default:
44
- return 'yyyy-MM-dd';
45
- }
46
- },
47
- },
48
- valueFormat: {
49
- type: String,
50
- default() {
51
- return this.format;
52
- },
53
- },
54
- startPlaceholder: {
55
- type: String,
56
- default: '请选择开始时间',
57
- },
58
- endPlaceholder: {
59
- type: String,
60
- default: '请选择结束时间',
61
- },
62
- pickerOptions: {
63
- type: Object,
64
- },
65
- shortcuts: {
66
- type: String,
67
- default() {
68
- if (this.type === 'date') {
69
- return 'today,yesterday,lastMonth';
70
- }
71
- return '';
72
- }
73
- },
74
- disabledDate: {
75
- type: String,
76
- validator: (val) => ['before', 'after'].includes(val),
77
- },
78
- },
79
- computed: {
80
- pickerValue() {
81
- return this.getPickerValue(this.value);
82
- },
83
- realPickerOptions() {
84
- if (this.pickerOptions) {
85
- return this.pickerOptions;
86
- }
87
- const options = {};
88
- if (this.shortcuts) {
89
- const shortcuts = [];
90
- this.shortcuts.split(',').reduce((prev, shortcut) => {
91
- const sc = Shortcuts[shortcut];
92
- if (sc) {
93
- prev.push(sc);
94
- }
95
- return prev;
96
- }, shortcuts);
97
- shortcuts.length > 0 && (options.shortcuts = shortcuts);
98
- }
99
- if (this.disabledDate) {
100
- const disabledDate = DisabledDate[this.disabledDate];
101
- disabledDate && (options.disabledDate = disabledDate);
102
- }
103
- return options;
104
- },
105
- },
106
- methods: {
107
- getPickerValue(value) {
108
- switch (this.type) {
109
- case 'dates':
110
- case 'daterange':
111
- case 'monthrange':
112
- case 'datetimerange':
113
- return value ? value.split(',') : [];
114
- default:
115
- return value;
116
- }
117
- },
118
- getRealValue(value) {
119
- switch (this.type) {
120
- case 'dates':
121
- case 'daterange':
122
- case 'monthrange':
123
- case 'datetimerange':
124
- return value ? value.join(',') : '';
125
- default:
126
- return value || '';
127
- }
128
- },
129
- onChange(value) {
130
- const _value = this.getRealValue(value);
131
- this.emitChange(_value);
132
- },
133
- focus() {
134
- const datepicker = this.$children[0];
135
- datepicker && datepicker.focus();
136
- },
137
- },
138
- };
139
- </script>
140
-
141
- <style lang="less" scoped>
142
- .ui-date-field.el-date-editor {
143
- width: 100%;
144
- }
145
- </style>
@@ -1,123 +0,0 @@
1
- <template>
2
- <trigger-field popover v-bind="$attrs" :value="value" :visible.sync="visible" :prefix-icon="value" @hide="onHide">
3
- <div class="ui-field-icons">
4
- <el-input class="filter" v-model="filter" placeholder="输入名称快速查找" clearable/>
5
- <div class="scroll">
6
- <div class="icons" v-loading="iconsLoading">
7
- <div v-for="icon in filteredIcons" :key="icon" class="icon" :class="{active: value === icon}" :title="icon" @click="sel(icon)">
8
- <icon :name="icon"/>
9
- <span class="ellipsis">{{ icon }}</span>
10
- </div>
11
- </div>
12
- </div>
13
- </div>
14
- </trigger-field>
15
- </template>
16
-
17
- <script>
18
- import Icon from '../icon/icon';
19
- import FieldMixin from './field.mixin';
20
- import TriggerField from './field.trigger';
21
- import Iconfont from '../../config/config.iconfont';
22
-
23
- export default {
24
- name: 'ui-field-icons',
25
- mixins: [FieldMixin],
26
- components: {Icon, TriggerField},
27
- data() {
28
- return {
29
- filter: '',
30
- icons: [],
31
- iconsLoading: false,
32
- visible: false,
33
- };
34
- },
35
- computed: {
36
- filteredIcons() {
37
- return this.icons.filter((icon) => icon.toLowerCase().indexOf(String(this.filter).toLowerCase()) !== -1);
38
- },
39
- },
40
- mounted() {
41
- this.initIcons();
42
- },
43
- methods: {
44
- async initIcons() {
45
- this.iconsLoading = true;
46
- const icons = await Iconfont.getIcons();
47
- this.iconsLoading = false;
48
- this.icons = icons;
49
- },
50
- onChange(val) {
51
- this.$emit('input', val);
52
- this.$emit('change', val);
53
- },
54
- sel(icon) {
55
- this.onChange(icon);
56
- this.visible = false;
57
- },
58
- onHide() {
59
- this.filter = '';
60
- },
61
- focus() {
62
- this.visible = true;
63
- },
64
- },
65
- };
66
- </script>
67
-
68
- <style lang="less" scoped>
69
- .ui-field-icons {
70
- .filter {
71
- margin-bottom: 10px;
72
-
73
- ::v-deep .el-input__validateIcon {
74
- display: none;
75
- }
76
- }
77
-
78
- .scroll {
79
- height: 200px;
80
- overflow: auto;
81
- }
82
-
83
- .icons {
84
- display: flex;
85
- flex-wrap: wrap;
86
-
87
- .icon {
88
- flex: none;
89
- width: 150px;
90
- height: 28px;
91
- margin: 2px;
92
- padding: 4px;
93
- border-radius: 2px;
94
- cursor: pointer;
95
- transition: all 0.3s;
96
- overflow: hidden;
97
- text-overflow: ellipsis;
98
- white-space: nowrap;
99
- display: flex;
100
- flex-direction: row;
101
- align-items: center;
102
-
103
- &:hover {
104
- background: #eaeaea;
105
- }
106
-
107
- &.active {
108
- color: #409eff;
109
- box-shadow: inset 0 0 3px #666;
110
- }
111
-
112
- .ui-icon {
113
- margin-right: 4px;
114
- }
115
-
116
- span {
117
- flex: 1;
118
-
119
- }
120
- }
121
- }
122
- }
123
- </style>
@@ -1,43 +0,0 @@
1
- <template>
2
- <el-input-number v-bind="$attrs" v-on="$listeners" :value="pickerValue" class="ui-number-field" :controls-position="controlsPosition" />
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-number',
10
- mixins: [FieldMixin],
11
- props: {
12
- controlsPosition: {
13
- type: String,
14
- default: 'right',
15
- },
16
- },
17
- computed: {
18
- pickerValue() {
19
- const v = [null, undefined, ''].includes(this.value) ? undefined : +this.value;
20
- if (isNaN(v)) {
21
- return undefined;
22
- }
23
- return v;
24
- },
25
- },
26
- methods: {
27
- focus() {
28
- const numberInput = this.$children[0];
29
- numberInput && numberInput.focus();
30
- },
31
- }
32
- };
33
- </script>
34
-
35
- <style lang="less" scoped>
36
- .ui-number-field {
37
- width: 100%;
38
-
39
- ::v-deep input {
40
- text-align: initial;
41
- }
42
- }
43
- </style>
@@ -1,100 +0,0 @@
1
- <template>
2
- <div class="ui-field-radio" v-loading="realLoading" element-loading-spinner="el-icon-loading">
3
- <el-radio-group v-bind="$attrs" v-on="$listeners" :value="value">
4
- <component v-bind:is="optionComponent" v-bind="item" v-for="item in realData" :key="item.value" :label="item.value" :border="ui === 'border'" :title="item.label">
5
- {{ item.label }}
6
- </component>
7
- </el-radio-group>
8
- <div v-if="isEmpty" class="empty">暂无数据!&emsp;<el-button v-show="realError" type="text" @click="init">重新加载</el-button>
9
- </div>
10
- </div>
11
- </template>
12
-
13
- <script>
14
- import FieldMixin from './field.mixin';
15
- import DataMixin from './field.data.mixin';
16
- import Objects from '../../util/objects';
17
-
18
- export default {
19
- name: 'ui-field-radio',
20
- mixins: [FieldMixin, DataMixin],
21
- props: {
22
- ui: {
23
- type: String,
24
- validator: (val) => ['default', 'border', 'button'].includes(val),
25
- },
26
- initDefault: {
27
- type: Boolean,
28
- default: true,
29
- },
30
- },
31
- computed: {
32
- optionComponent() {
33
- if (this.ui === 'button') {
34
- return 'el-radio-button';
35
- }
36
- return 'el-radio';
37
- },
38
- isEmpty() {
39
- return !this.realData.length;
40
- },
41
- },
42
- watch: {
43
- realData(data, o) {
44
- if (!Objects.isEquals(data, o)) {
45
- this.initDefaultValue();
46
- }
47
- },
48
- },
49
- methods: {
50
- init() {
51
- this.getData().then(() => {
52
- this.done();
53
- this.initDefaultValue();
54
- });
55
- },
56
- initDefaultValue() {
57
- if (!this.initDefault) {
58
- return;
59
- }
60
- if (this.hasMatched()) {
61
- return;
62
- }
63
- const first = this.realData.find(Boolean);
64
- first && this.onChange(first.value);
65
- },
66
- hasMatched() {
67
- return this.realData.some((item) => Object.is(item.value, this.value));
68
- },
69
- resetValue() {
70
- this.onChange('');
71
- },
72
- },
73
- };
74
- </script>
75
-
76
- <style lang="less" scoped>
77
- .ui-field-radio {
78
- .empty {
79
- display: inline-flex;
80
- align-items: center;
81
- font-size: 12px;
82
- color: #909399;
83
- }
84
-
85
- > .el-radio-group {
86
- display: inline-flex;
87
- flex-direction: row;
88
- flex-wrap: wrap;
89
- align-items: center;
90
-
91
- .el-radio {
92
- line-height: 36px;
93
- }
94
- }
95
- }
96
-
97
- ::v-deep .el-loading-mask .el-loading-spinner {
98
- margin-top: -14px;
99
- }
100
- </style>
@@ -1,37 +0,0 @@
1
- <template>
2
- <el-rate v-bind="$attrs" v-on="_listeners" v-model="score" :max="max"></el-rate>
3
- </template>
4
-
5
- <script>
6
- import FieldMixin from './field.mixin';
7
-
8
- export default {
9
- name: 'ui-field-rate',
10
- mixins: [FieldMixin],
11
- props: {
12
- max: {
13
- type: Number,
14
- default: 5,
15
- },
16
- },
17
- computed: {
18
- score: {
19
- get() {
20
- if (!this.value) {
21
- return 0;
22
- }
23
- const num = Number(this.value);
24
- if (isNaN(num)) {
25
- return 0;
26
- }
27
- return Math.min(num, this.max);
28
- },
29
- set(v) {
30
- this.onChange(v);
31
- }
32
- },
33
- },
34
- };
35
- </script>
36
-
37
- <style scoped></style>