@v2coding/ui 0.1.5 → 0.1.9

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 (50) hide show
  1. package/dist/v2coding-ui.esm.js +557 -842
  2. package/dist/v2coding-ui.min.js +1 -1
  3. package/dist/v2coding-ui.ssr.js +578 -836
  4. package/package.json +2 -3
  5. package/src/components/dialog/dialog.vue +0 -179
  6. package/src/components/drawer/drawer.vue +0 -523
  7. package/src/components/exports/index.vue +0 -53
  8. package/src/components/exports/remote-exports-dialog.vue +0 -202
  9. package/src/components/field/field.autocomplete.vue +0 -21
  10. package/src/components/field/field.calendar.vue +0 -117
  11. package/src/components/field/field.cascade.vue +0 -233
  12. package/src/components/field/field.checkbox.vue +0 -134
  13. package/src/components/field/field.color.vue +0 -24
  14. package/src/components/field/field.date.vue +0 -145
  15. package/src/components/field/field.fence.vue +0 -856
  16. package/src/components/field/field.icons.vue +0 -123
  17. package/src/components/field/field.lnglat.vue +0 -236
  18. package/src/components/field/field.number.vue +0 -43
  19. package/src/components/field/field.radio.vue +0 -100
  20. package/src/components/field/field.rate.vue +0 -37
  21. package/src/components/field/field.rich.vue +0 -155
  22. package/src/components/field/field.select.vue +0 -210
  23. package/src/components/field/field.slider.vue +0 -66
  24. package/src/components/field/field.switch.vue +0 -14
  25. package/src/components/field/field.text.vue +0 -66
  26. package/src/components/field/field.timepicker.vue +0 -70
  27. package/src/components/field/field.timeselect.vue +0 -24
  28. package/src/components/field/field.trigger.dialog.vue +0 -50
  29. package/src/components/field/field.trigger.popover.vue +0 -63
  30. package/src/components/field/field.upload.file.vue +0 -241
  31. package/src/components/field/field.upload.image.vue +0 -125
  32. package/src/components/fill-view/fill-view.vue +0 -43
  33. package/src/components/form/form.dialog.vue +0 -174
  34. package/src/components/form/form.drawer.vue +0 -246
  35. package/src/components/form/form.fieldset.vue +0 -110
  36. package/src/components/form/form.item.vue +0 -210
  37. package/src/components/form/form.vue +0 -302
  38. package/src/components/head-menu/head-menu.vue +0 -188
  39. package/src/components/head-menu/menu-item.vue +0 -80
  40. package/src/components/history/history.vue +0 -361
  41. package/src/components/icon/icon.vue +0 -63
  42. package/src/components/minimize/minimize.vue +0 -342
  43. package/src/components/page/page.vue +0 -43
  44. package/src/components/page/search-page.vue +0 -202
  45. package/src/components/provider/provider.vue +0 -15
  46. package/src/components/scroll-view/scroll-view.vue +0 -384
  47. package/src/components/table/column.vue +0 -262
  48. package/src/components/table/table.pagination.vue +0 -71
  49. package/src/components/table/table.select.vue +0 -165
  50. package/src/components/table/table.vue +0 -807
@@ -1,246 +0,0 @@
1
- <template>
2
- <ui-drawer
3
- class-name="ui-form-drawer"
4
- v-bind="$attrs"
5
- v-on="drawerListeners"
6
- :value="visible"
7
- :width="width"
8
- :transfer="transfer"
9
- :mask="mask"
10
- :inner="inner"
11
- @on-visible-change="updateVisible"
12
- >
13
- <div class="ui-form-drawer-wrapper" v-loading="loading">
14
- <ui-form ref="form" :fields="fields" :disabled="disabled" :actionButton="false" @submit="onSubmit" @ready="onReady">
15
- <slot></slot>
16
- </ui-form>
17
- </div>
18
- <div class="action-button" v-if="disabled !== true">
19
- <el-button type="primary" icon="el-icon-success" :loading="submitting" @click="submit">{{confirmText}}</el-button>
20
- <el-button icon="el-icon-error" @click="onCancel">{{cancelText}}</el-button>
21
- </div>
22
- </ui-drawer>
23
- </template>
24
-
25
- <script>
26
- import UiDrawer from '../drawer/drawer';
27
-
28
- export default {
29
- name: 'ui-form-drawer',
30
- inheritAttrs: false,
31
- components: {UiDrawer},
32
- props: {
33
- value: {
34
- type: Object,
35
- default: () => ({}),
36
- },
37
- visible: Boolean,
38
- // 抽屉宽度。当其值不大于 100 时以百分比显示,大于 100 时为像素
39
- width: {
40
- type: [String, Number],
41
- default: 500,
42
- },
43
- method: {
44
- type: String,
45
- validator: (val) => ['get', 'post'].includes(val),
46
- default: 'post',
47
- },
48
- url: String,
49
- cancelText: {
50
- type: String,
51
- default: '取消',
52
- },
53
- confirmText: {
54
- type: String,
55
- default: '确定',
56
- },
57
- cancel: {
58
- type: Function,
59
- default: () => void 0,
60
- },
61
- beforeSubmit: {
62
- type: Function,
63
- default: () => void 0,
64
- },
65
- afterSubmit: {
66
- type: Function,
67
- default: () => void 0,
68
- },
69
- fields: Array,
70
- loading: Boolean,
71
- // 是否将抽屉放置于 body 内
72
- transfer: {
73
- type: Boolean,
74
- default: false,
75
- },
76
- mask: {
77
- type: Boolean,
78
- default: false,
79
- },
80
- // 是否设置抽屉在某个元素内打开,开启此属性时,应当关闭 transfer 属性
81
- inner: {
82
- type: Boolean,
83
- default: true,
84
- },
85
- disabled: {
86
- type: Boolean,
87
- default: undefined,
88
- },
89
- },
90
- data() {
91
- return {
92
- ready: false,
93
- submitting: false,
94
- };
95
- },
96
- computed: {
97
- drawerListeners() {
98
- // submit/ready/input 属于当前组件自定义事件, 非 drawer 的事件
99
- // eslint-disable-next-line
100
- const {submit, ready, input, ...listeners} = this.$listeners;
101
- return listeners;
102
- },
103
- },
104
- watch: {
105
- visible: 'onVisibleChange',
106
- },
107
- methods: {
108
- onReady() {
109
- this.ready = true;
110
- this.$emit('ready');
111
- },
112
- onCancel() {
113
- const allow = this.cancel();
114
- if (allow === false) {
115
- return;
116
- }
117
- this.hide();
118
- },
119
- show() {
120
- this.$emit('update:visible', true);
121
- },
122
- hide() {
123
- this.$emit('update:visible', false);
124
- },
125
- submit() {
126
- this.$refs.form.onSubmit();
127
- },
128
- updateVisible(visible) {
129
- this.$emit('update:visible', visible);
130
- },
131
- async onVisibleChange(visible) {
132
- if (!visible) {
133
- await this.$nextTick();
134
- this.clearValidate();
135
- }
136
- },
137
- resetValues(values) {
138
- if (!this.$refs.form) {
139
- return;
140
- }
141
- this.$refs.form.resetValues(values);
142
- },
143
- getValues() {
144
- if (!this.$refs.form) {
145
- return;
146
- }
147
- return this.$refs.form.getValues();
148
- },
149
- setValues(values) {
150
- if (!this.$refs.form) {
151
- return;
152
- }
153
- this.$refs.form.setValues(values);
154
- },
155
- clearValidate (...args) {
156
- if (!this.$refs.form) {
157
- return;
158
- }
159
- this.$refs.form.clearValidate(...args)
160
- },
161
- onSubmit(formData) {
162
- // if (!this.ready) {
163
- // return;
164
- // }
165
- this.$emit('submit', {...formData});
166
- const allow = this.beforeSubmit(formData);
167
- if (allow === false) {
168
- return;
169
- }
170
- if (!this.url) {
171
- return;
172
- }
173
- let def;
174
- this.submitting = true;
175
- if (this.method === 'get') {
176
- def = this.getWithMessage(this.url, {params: formData});
177
- } else {
178
- def = this.postWithMessage(this.url, formData);
179
- }
180
- def.then((...args) => {
181
- this.submitting = false;
182
- this.$emit('after-submit', ...args);
183
- }).catch((...args) => {
184
- this.submitting = false;
185
- return Promise.reject(...args);
186
- });
187
- },
188
- },
189
- };
190
- </script>
191
-
192
- <style lang="less">
193
- .ui-form-drawer {
194
- display: flex;
195
- flex-direction: column;
196
- padding: 0;
197
- outline: none;
198
-
199
- .ui-drawer-body {
200
- flex: 1;
201
- padding: 0;
202
- overflow: hidden;
203
- display: flex;
204
- flex-direction: column;
205
-
206
- & > .el-form {
207
- flex: 1;
208
- overflow: auto;
209
- }
210
-
211
- & > .action-button {
212
- flex: none;
213
- }
214
- }
215
-
216
- .ui-form-drawer-wrapper {
217
- flex: 1;
218
- overflow: hidden;
219
-
220
- .el-form {
221
- width: 100%;
222
- height: 100%;
223
- overflow: auto;
224
- padding: 16px;
225
- box-sizing: border-box;
226
- }
227
- }
228
-
229
- .action-button {
230
- flex: none;
231
- padding: 16px;
232
- border-top: 1px solid #e8eaec;
233
- display: flex;
234
- flex-direction: row-reverse;
235
-
236
- button + button {
237
- margin-right: 16px;
238
- }
239
- }
240
-
241
- .action-button::after {
242
- content: '';
243
- clear: both;
244
- }
245
- }
246
- </style>
@@ -1,110 +0,0 @@
1
- <template>
2
- <div class="ui-form-fieldset" :class="{toggle: hasToggle, collapse: !isExpand}">
3
- <h3 v-if="legend" class="ui-form-fieldset-legend" v-once @click="toggle">{{ legend }}</h3>
4
- <div v-show="isExpand">
5
- <slot />
6
- </div>
7
- </div>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'ui-form-fieldset',
13
- props: {
14
- label: {
15
- type: String,
16
- default: '分组',
17
- },
18
- // 类似于 html fieldset 下的 legend 标签作用
19
- legend: {
20
- type: String,
21
- default() {
22
- return this.label;
23
- },
24
- },
25
- /**
26
- * 初始时是否展开
27
- */
28
- collapse: {
29
- type: Boolean,
30
- default: null,
31
- },
32
- },
33
- data() {
34
- return {
35
- expand: !this.collapse,
36
- };
37
- },
38
- computed: {
39
- hasToggle() {
40
- return !Object.is(null, this.collapse);
41
- },
42
- isExpand() {
43
- if (!this.hasToggle) {
44
- return true;
45
- }
46
- return this.expand;
47
- },
48
- },
49
- methods: {
50
- toggle() {
51
- if (!this.hasToggle) {
52
- return;
53
- }
54
- this.expand = !this.expand;
55
- },
56
- },
57
- };
58
- </script>
59
-
60
- <style lang="less" scoped>
61
- .ui-form-fieldset {
62
- padding: 30px 20px 10px;
63
- margin: 30px 0 20px;
64
- border: 1px dashed #aaa;
65
- border-radius: 2px;
66
- position: relative;
67
- &.toggle {
68
- &.collapse {
69
- padding: 0;
70
- border-bottom: none;
71
-
72
- .ui-form-fieldset-legend::after {
73
- content: '\f107';
74
- }
75
- }
76
-
77
- .ui-form-fieldset-legend {
78
- cursor: pointer;
79
- font-family: FontAwesome, serif;
80
- text-rendering: auto;
81
- -webkit-font-smoothing: antialiased;
82
- -moz-osx-font-smoothing: grayscale;
83
- }
84
-
85
- .ui-form-fieldset-legend::after {
86
- margin-left: 4px;
87
- content: '\f106';
88
- }
89
- }
90
-
91
- > .ui-form-fieldset-legend {
92
- position: absolute;
93
- top: -8px;
94
- padding: 0 30px;
95
- margin: 0;
96
- height: 16px;
97
- line-height: 16px;
98
- font-size: 14px;
99
- color: #666;
100
- left: 50%;
101
- transform: translateX(-50%);
102
- background: white;
103
- user-select: none;
104
- }
105
-
106
- & + .ui-form-fieldset {
107
- margin-top: 40px;
108
- }
109
- }
110
- </style>
@@ -1,210 +0,0 @@
1
- <template>
2
- <el-form-item v-bind="$attrs" :prop="name" :rules="realRules" class="ui-form-item" ref="formItem" :class="{'hidden-item': type === 'hidden'}">
3
- <div v-if="$scopedSlots.prefix" class="ui-form-item-prefix">
4
- <slot name="prefix"></slot>
5
- </div>
6
- <template slot="label" v-if="showLabel && label">
7
- {{ label }}
8
- <el-tooltip effect="dark" :content="info">
9
- <i v-if="info" class="el-icon-info info"></i>
10
- </el-tooltip>
11
- {{realColon ? ':' : ''}}
12
- </template>
13
- <form-field v-bind="$attrs" :name="name" v-model="fieldValue" :locked-value.sync="lockedValue" :type="type" :disabled="realDisabled" :placeholder="realPlaceHolder" :ignore="ignore" v-on="listeners">
14
- <slot></slot>
15
- </form-field>
16
- <div v-if="$scopedSlots.suffix" class="ui-form-item-suffix">
17
- <slot name="suffix"></slot>
18
- </div>
19
- </el-form-item>
20
- </template>
21
-
22
- <script>
23
- import VType, { getInputTypeText } from './vtype';
24
- import FormField from './form.field';
25
-
26
- export default {
27
- name: 'ui-form-item',
28
- inheritAttrs: false,
29
- inject: ['uiForm'],
30
- components: { FormField },
31
- props: {
32
- value: null,
33
- defaultValue: {
34
- default: undefined,
35
- },
36
- name: {
37
- type: String,
38
- required: true,
39
- },
40
- prop: String, // ignore prop. 强制要求使用 name 配置
41
- label: {
42
- type: String,
43
- default: '',
44
- },
45
- type: {
46
- type: String,
47
- default: 'text',
48
- },
49
- showLabel: {
50
- type: Boolean,
51
- default: true,
52
- },
53
- placeholder: String,
54
- vtype: [String, Array, Function],
55
- info: String,
56
- rules: null,
57
- /**
58
- * 是否显示 label 后面的冒号
59
- * 默认显示
60
- */
61
- colon: {
62
- type: Boolean,
63
- default: undefined,
64
- },
65
- disabled: {
66
- type: Boolean,
67
- default: undefined,
68
- },
69
- ignore: {
70
- type: Boolean,
71
- default: false,
72
- },
73
- message: String,
74
- },
75
- data () {
76
- return {
77
- fieldValue: this.defaultValue,
78
- lockedValue: this.defaultValue,
79
- };
80
- },
81
- computed: {
82
- realRules () {
83
- if (this.ignore) {
84
- return null;
85
- }
86
- if (this.rules) {
87
- return this.rules;
88
- }
89
- if (typeof this.vtype === 'function') {
90
- // this.vtype(rule, value, callback)
91
- return { validator: this.vtype };
92
- }
93
- let vtypes = [];
94
- if (typeof this.vtype === 'string') {
95
- vtypes = this.vtype.replace(/\s/g, '').split(',').filter(Boolean);
96
- } else if (Array.isArray(this.vtype) && this.vtype.length) {
97
- vtypes = this.vtype.filter(Boolean);
98
- }
99
- return vtypes.reduce((rules, vtype) => {
100
- let rule = vtype;
101
- if (typeof vtype === 'string') {
102
- const [type, ...args] = vtype.split(':');
103
- rule = VType[type](this.$props, ...args);
104
- }
105
- rule && rules.push(rule);
106
- return rules;
107
- }, []);
108
- },
109
- realPlaceHolder () {
110
- if (this.placeholder) {
111
- return this.placeholder;
112
- }
113
- let input = getInputTypeText(this.type);
114
- return `请${input}${this.label}`;
115
- },
116
- realColon () {
117
- if (!this.label) {
118
- return false;
119
- }
120
- if (!Object.is(undefined, this.colon)) {
121
- return this.colon;
122
- }
123
- if (!Object.is(undefined, this.uiForm.colon)) {
124
- return this.uiForm.colon;
125
- }
126
- return true;
127
- },
128
- realDisabled () {
129
- if (this.uiForm) {
130
- return this.uiForm.disabled || this.disabled;
131
- }
132
- return this.disabled;
133
- },
134
- listeners () {
135
- // eslint-disable-next-line
136
- const { change, input, ...listeners } = this.$listeners;
137
- return listeners;
138
- },
139
- },
140
- watch: {
141
- value (v) {
142
- this.fieldValue = v;
143
- },
144
- fieldValue (v) {
145
- this.uiForm.trigger('change', this.name, v, this);
146
- this.$emit('input', v);
147
- this.$emit('change', v);
148
- },
149
- },
150
- created () {
151
- this.registeredField();
152
- },
153
- methods: {
154
- registeredField () {
155
- this.uiForm.addField(this.name, this.fieldValue, this);
156
- },
157
- resetField (...args) {
158
- if (args.length > 0) {
159
- this.fieldValue = args[0];
160
- } else if (this.fieldValue !== this.defaultValue) {
161
- this.fieldValue = this.defaultValue;
162
- }
163
- this.lockedValue = this.fieldValue;
164
- this.$refs.formItem && this.$refs.formItem.$once('el.form.change', () => {
165
- this.$refs.formItem && this.$refs.formItem.clearValidate();
166
- });
167
- },
168
- },
169
- };
170
- </script>
171
-
172
- <style lang="less" scoped>
173
- .ui-form-item {
174
- ::v-deep .el-form-item__content {
175
- display: flex;
176
- flex-direction: row;
177
- align-items: center;
178
-
179
- > div {
180
- flex: 1;
181
- display: flex;
182
- align-items: center;
183
- }
184
-
185
- .ui-form-item-prefix,
186
- .ui-form-item-suffix {
187
- flex: none;
188
- }
189
- }
190
-
191
- .info {
192
- color: #909399;
193
- cursor: pointer;
194
- margin-left: 4px;
195
- }
196
-
197
- &.hidden-item {
198
- display: none;
199
- }
200
- }
201
-
202
- .el-form--inline .ui-form-item ::v-deep .el-form-item__label {
203
- flex: none;
204
- white-space: nowrap;
205
- }
206
-
207
- .el-form--inline .ui-form-item ::v-deep .el-form-item__content {
208
- display: inline-flex;
209
- }
210
- </style>