@xilonglab/vue-main 0.7.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 (53) hide show
  1. package/dist/page/app.vue +86 -0
  2. package/dist/page/login.vue +185 -0
  3. package/dist/page/setting.vue +72 -0
  4. package/dist/style/app.less +58 -0
  5. package/dist/style/reset.css +32 -0
  6. package/package.json +15 -0
  7. package/packages/XlBreadcrumb.vue +85 -0
  8. package/packages/XlControlBar.vue +64 -0
  9. package/packages/XlSideBar.vue +135 -0
  10. package/packages/button/XlAsyncButton.vue +67 -0
  11. package/packages/button/XlButton.vue +25 -0
  12. package/packages/button/XlDeleteButton.vue +22 -0
  13. package/packages/button/XlEditButton.vue +22 -0
  14. package/packages/button/XlIconButton.vue +22 -0
  15. package/packages/button/XlUploadButton.vue +109 -0
  16. package/packages/dialog/XlDialog.vue +116 -0
  17. package/packages/dialog/XlEditReviewDialog.vue +81 -0
  18. package/packages/dialog/XlFormDialog.vue +79 -0
  19. package/packages/dialog/XlImagePreviewDialog.vue +40 -0
  20. package/packages/dialog/XlMessageDialog.vue +74 -0
  21. package/packages/dialog/XlReviewDialog.vue +115 -0
  22. package/packages/dialog/XlStateDialog.vue +21 -0
  23. package/packages/form/XlCascader.vue +46 -0
  24. package/packages/form/XlCheckbox.vue +45 -0
  25. package/packages/form/XlDate.vue +54 -0
  26. package/packages/form/XlFormCol.vue +19 -0
  27. package/packages/form/XlFormRow.vue +20 -0
  28. package/packages/form/XlImageInput.vue +127 -0
  29. package/packages/form/XlInput.vue +53 -0
  30. package/packages/form/XlMapSelect.vue +72 -0
  31. package/packages/form/XlNumber.vue +11 -0
  32. package/packages/form/XlRadio.vue +42 -0
  33. package/packages/form/XlRawSelect.vue +71 -0
  34. package/packages/form/XlRegion.vue +51 -0
  35. package/packages/form/XlSearchSelect.vue +85 -0
  36. package/packages/form/XlSelect.vue +77 -0
  37. package/packages/form/XlSwitch.vue +33 -0
  38. package/packages/form/XlTabRadio.vue +43 -0
  39. package/packages/form/XlTags.vue +105 -0
  40. package/packages/form/XlTextarea.vue +48 -0
  41. package/packages/form/XlTime.vue +50 -0
  42. package/packages/form/data/areas.json +1 -0
  43. package/packages/index.js +130 -0
  44. package/packages/main/XlAutoSaver.vue +75 -0
  45. package/packages/main/XlDataView.vue +212 -0
  46. package/packages/main/XlFormDialog2.vue +80 -0
  47. package/packages/main/XlLoginForm.vue +192 -0
  48. package/packages/main/XlNavBar.vue +89 -0
  49. package/packages/main/XlStatusIndicator.vue +36 -0
  50. package/packages/main/XlTabView.vue +81 -0
  51. package/packages/main/XlToolBar.vue +132 -0
  52. package/packages/main/XlUpdateIndicator.vue +40 -0
  53. package/packages/main/XlVerticalMenu.vue +72 -0
@@ -0,0 +1,40 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlImagePreviewDialog" })
3
+
4
+ import { ref } from 'vue'
5
+
6
+
7
+ const props = defineProps({
8
+ url: {
9
+ type: String,
10
+ default: ''
11
+ }
12
+ })
13
+
14
+ const visible = ref(false)
15
+
16
+
17
+ defineExpose({
18
+ show() {
19
+ visible.value = true
20
+ }
21
+ })
22
+ </script>
23
+
24
+
25
+ <template>
26
+ <el-dialog class="xl-image-preview-dialog xl-dialog" v-model="visible" width="50%">
27
+ <el-image :src="url"></el-image>
28
+ </el-dialog>
29
+ </template>
30
+
31
+
32
+
33
+ <style lang="less"></style>
34
+
35
+
36
+
37
+
38
+
39
+
40
+
@@ -0,0 +1,74 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlMessageDialog" })
3
+
4
+ import { ref } from 'vue'
5
+
6
+ const props = defineProps({
7
+ l: {
8
+ type: String,
9
+ default: "",
10
+ },
11
+ handler: {
12
+ type: Function,
13
+ default: ()=>{},
14
+ }
15
+ });
16
+
17
+ const emits = defineEmits(['confirm', 'cancel'])
18
+
19
+
20
+ const visible = ref(false)
21
+
22
+ const onConfirm = () => {
23
+ hide()
24
+ emits('confirm')
25
+ props.handler()
26
+ }
27
+
28
+ const onCancel = () => {
29
+ hide()
30
+ emits('cancel')
31
+ }
32
+
33
+ const show = () => {
34
+ visible.value = true
35
+ }
36
+
37
+ const hide = () => {
38
+ visible.value = false
39
+ }
40
+
41
+
42
+ defineExpose({ show })
43
+ </script>
44
+
45
+
46
+ <template>
47
+ <el-dialog class="xl-message-dialog xl-dialog" v-model="visible" title="提示" width="30%">
48
+ <div class="message">
49
+ <span>{{ l }}</span>
50
+ </div>
51
+ <div slot="footer" class="dialog-footer">
52
+ <el-button @click="onCancel">取消</el-button>
53
+ <el-button type="primary" @click="onConfirm">确定</el-button>
54
+ </div>
55
+ </el-dialog>
56
+ </template>
57
+
58
+
59
+ <style lang="less">
60
+ .xl-message-dialog {
61
+ .el-dialog__header {
62
+ text-align: left;
63
+ }
64
+
65
+ .message {
66
+ text-align: left;
67
+ }
68
+
69
+ .dialog-footer {
70
+ text-align: center;
71
+ margin-top: 20px;
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,115 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlReviewDialog" })
3
+
4
+ import { ref } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['confirm', 'pass', 'reject', 'close'])
8
+
9
+ const props = defineProps({
10
+ title: {
11
+ type: String,
12
+ default: "提示",
13
+ },
14
+ width: {
15
+ default: 30,
16
+ },
17
+ validate: {
18
+ type: Function,
19
+ default() {
20
+ return true
21
+ }
22
+ },
23
+ passCallback: {
24
+ type: Function,
25
+ default: async () => 0
26
+ },
27
+ rejectCallback: {
28
+ type: Function,
29
+ default: async () => 0
30
+ }
31
+ });
32
+
33
+ const visible = ref(false);
34
+
35
+ const onPass = async () => {
36
+ const validation = await props.validate()
37
+ if (validation) {
38
+ emits('confirm');
39
+ const error = await props.passCallback()
40
+ if (!error) {
41
+ hide();
42
+ emits('pass');
43
+ }
44
+ }
45
+ };
46
+
47
+ const onReject = async () => {
48
+ const error = await props.rejectCallback()
49
+ if (!error) {
50
+ hide();
51
+ emits('reject');
52
+ }
53
+ };
54
+
55
+ const onClose = () => {
56
+ emits('close');
57
+ };
58
+
59
+ const show = () => {
60
+ visible.value = true;
61
+ };
62
+
63
+ const hide = () => {
64
+ visible.value = false;
65
+ };
66
+
67
+ defineExpose({ show })
68
+ </script>
69
+
70
+
71
+ <template>
72
+ <el-dialog class="xl-review-dialog xl-dialog" :title="title" v-model="visible" @close="onClose" :width="width + '%'">
73
+ <slot />
74
+ <div style="text-align: center; padding: 10px; margin-top: 20px">
75
+ <span slot="footer" class="dialog-footer">
76
+ <el-button type="primary" @click="onPass">通过</el-button>
77
+ <el-button type="danger" @click="onReject">驳回</el-button>
78
+ </span>
79
+ </div>
80
+ </el-dialog>
81
+ </template>
82
+
83
+
84
+ <style lang="less">
85
+ .xl-review-dialog {
86
+ text-align: left;
87
+
88
+ border-radius: 10px 10px 7px 7px !important;
89
+ padding: 0;
90
+
91
+ .el-dialog__header {
92
+ border-radius: 7px 7px 0 0;
93
+ padding: 14px 20px 10px;
94
+ background: transparent linear-gradient(90deg, #073052 0%, rgb(100, 100, 100) 100%) 0% 0% no-repeat padding-box !important;
95
+
96
+ .el-dialog__headerbtn {
97
+ top: 14px;
98
+ }
99
+
100
+ .el-dialog__title,
101
+ .el-dialog__close {
102
+ color: rgb(245, 245, 245) !important;
103
+ }
104
+
105
+ .el-dialog__headerbtn {
106
+ top: 3px !important;
107
+ }
108
+
109
+ }
110
+
111
+ .el-dialog__body {
112
+ padding: 10px 10px 5px 10px;
113
+ }
114
+ }
115
+ </style>
@@ -0,0 +1,21 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlStateDialog" })
3
+
4
+ const props = defineProps({
5
+ dialogRef: {},
6
+ state: {},
7
+ ruleMap: {},
8
+ handler: {},
9
+ title: {},
10
+ labelWidth: {}
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <xl-form-dialog :ref="dialogRef" :title="title" :label-width="labelWidth" :data="state"
16
+ :ruleMap="ruleMap" :callback="handler">
17
+ <slot/>
18
+ </xl-form-dialog>
19
+ </template>
20
+
21
+ <style lang="less"></style>
@@ -0,0 +1,46 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlCascader" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const props = defineProps({
8
+ tmp: {
9
+ type: String,
10
+ default: "",
11
+ },
12
+ options: {
13
+ type: Array,
14
+ default() {
15
+ return [];
16
+ },
17
+ },
18
+ placeholder: {
19
+ type: String,
20
+ default: "",
21
+ },
22
+ width: {
23
+ default: 300,
24
+ },
25
+ })
26
+
27
+ const emits = defineEmits(['change'])
28
+
29
+ const value = computed({
30
+ get() {
31
+ return props.tmp.split("/");
32
+ },
33
+ set(data) {
34
+ emits('change', data.join("/"));
35
+ },
36
+ });
37
+ </script>
38
+
39
+
40
+ <template>
41
+ <el-cascader class="xl-cascader" v-model="value" :options="options" :placeholder="placeholder"
42
+ :style="{ width: width + 'px' }"></el-cascader>
43
+ </template>
44
+
45
+
46
+ <style></style>
@@ -0,0 +1,45 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlCheckbox" })
3
+
4
+ import { ref, computed } from 'vue';
5
+
6
+
7
+ const props = defineProps({
8
+ tmp: {
9
+ type: Array,
10
+ default: () => [],
11
+ },
12
+ options: {
13
+ type: Array,
14
+ default: () => [],
15
+ },
16
+ max: {
17
+ type: Number,
18
+ default: 1,
19
+ },
20
+ });
21
+
22
+
23
+ const emits = defineEmits(['change']);
24
+
25
+
26
+ const value = computed({
27
+ get() {
28
+ return props.tmp;
29
+ },
30
+ set(data) {
31
+ emits('change', data)
32
+ },
33
+ });
34
+ </script>
35
+
36
+
37
+ <template>
38
+ <el-checkbox-group class="xl-checkbox-group" v-model="value" :max="max">
39
+ <el-checkbox class="xl-checkbox" v-for="(option, index) in options" :key="index" :label="option.value">{{
40
+ option.label }}</el-checkbox>
41
+ </el-checkbox-group>
42
+ </template>
43
+
44
+
45
+ <style></style>
@@ -0,0 +1,54 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlDate" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const props = defineProps({
8
+ l: {
9
+ type: String,
10
+ default: "",
11
+ },
12
+ placeholder: {
13
+ type: String,
14
+ default: "选择日期",
15
+ },
16
+ disabled: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ tmp: {
21
+ type: String,
22
+ default: "",
23
+ },
24
+ width: {
25
+ default: 100,
26
+ },
27
+ });
28
+
29
+ const emits = defineEmits(['change'])
30
+
31
+ const value = computed({
32
+ get() {
33
+ return props.tmp;
34
+ },
35
+ set(data) {
36
+ emits('change', data)
37
+ },
38
+ });
39
+ </script>
40
+
41
+
42
+ <template>
43
+ <el-date-picker class="xl-date xl-form-item" type="date" :placeholder="l?l:placeholder" format="YYYY-MM-DD"
44
+ value-format="YYYY-MM-DD" v-model="value" :disabled="disabled" clearable :style="{ width: `${width}px` }" />
45
+ </template>
46
+
47
+
48
+ <style lang="less">
49
+ .xl-date {
50
+ .el-input__prefix {
51
+ display: none !important;
52
+ }
53
+ }
54
+ </style>
@@ -0,0 +1,19 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlFormCol" })
3
+
4
+ const props = defineProps({
5
+ span: {},
6
+ l: {},
7
+ p: {}
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <el-col :span="span">
13
+ <el-form-item :label="l" :prop="p">
14
+ <slot />
15
+ </el-form-item>
16
+ </el-col>
17
+ </template>
18
+
19
+ <style lang="less"></style>
@@ -0,0 +1,20 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlFormRow" })
3
+
4
+ const props = defineProps({
5
+ l: {},
6
+ p: {}
7
+ })
8
+ </script>
9
+
10
+ <template>
11
+ <el-row>
12
+ <el-col :span="24">
13
+ <el-form-item :label="l" :prop="p">
14
+ <slot />
15
+ </el-form-item>
16
+ </el-col>
17
+ </el-row>
18
+ </template>
19
+
20
+ <style lang="less"></style>
@@ -0,0 +1,127 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlImageInput" })
3
+
4
+ import { ref, computed } from 'vue'
5
+ const conversion = require('image-conversion')
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ default: "",
12
+ },
13
+ api: {
14
+ type: Function,
15
+ default: () => ({})
16
+ },
17
+ width: {
18
+ default: 635
19
+ },
20
+ height: {
21
+ default: 750
22
+ },
23
+ headers: {
24
+ type: Object,
25
+ default: () => ({})
26
+ },
27
+ params: {
28
+ type: Object,
29
+ default: () => ({})
30
+ },
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ compress: {
36
+ default: 0,
37
+ },
38
+ accept: {
39
+ type: String,
40
+ default: ''
41
+ },
42
+ })
43
+
44
+
45
+ const value = computed({
46
+ get() {
47
+ return props.modelValue;
48
+ },
49
+ set(data) {
50
+ emits('change', data)
51
+ emits('update:modelValue', data)
52
+ },
53
+ });
54
+
55
+
56
+ const loading = ref(false)
57
+
58
+
59
+ function beforeUpload() {
60
+ loading.value = true
61
+ }
62
+
63
+ function onSuccess(data, file, filelist) {
64
+ loading.value = false;
65
+ emits('update:modelValue', data)
66
+ }
67
+
68
+ async function upload(option) {
69
+ let formData = new FormData();
70
+ const { api, params } = props
71
+ let { file } = option
72
+
73
+ if (props.compress) {
74
+ const res = await conversion.compress(file, props.compress)
75
+ file = new File([res], file.name, { lastModified: Date.now() })
76
+ }
77
+
78
+ formData.append("file", file);
79
+ formData.append("filename", file.name);
80
+ for (let key in params) {
81
+ formData.append(key, params[key]);
82
+ }
83
+ return api(formData);
84
+ }
85
+ </script>
86
+
87
+
88
+ <template>
89
+ <el-upload class="xl-image-input" action="" v-loading="loading" :headers="headers" :http-request="upload"
90
+ :before-upload="beforeUpload" :on-success="onSuccess" :show-file-list="false" :disabled="disabled"
91
+ :accept="props.accept">
92
+ <img v-if="value" class="image" :src="`https://storage.heinz97.top/${value}`"
93
+ :style="`max-width: ${width}px;max-height:${height}px`" />
94
+ <el-icon v-else class="icon" :style="`width: ${width}px;height:${height}px`">
95
+ <Plus />
96
+ </el-icon>
97
+ </el-upload>
98
+ </template>
99
+
100
+
101
+ <style lang="less">
102
+ .xl-image-input {
103
+
104
+ .el-upload {
105
+ border: 1px dashed var(--el-border-color);
106
+ border-radius: 6px;
107
+ cursor: pointer;
108
+ position: relative;
109
+ overflow: hidden;
110
+ transition: var(--el-transition-duration-fast);
111
+
112
+ &:hover {
113
+ border-color: var(--el-color-primary);
114
+ }
115
+ }
116
+
117
+ .image {
118
+ display: block;
119
+ }
120
+
121
+ .el-icon.icon {
122
+ font-size: 28px;
123
+ color: #8c939d;
124
+ text-align: center;
125
+ }
126
+ }
127
+ </style>
@@ -0,0 +1,53 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlInput" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ l: {
11
+ type: String,
12
+ default: "",
13
+ },
14
+ modelValue: {
15
+ default: "",
16
+ },
17
+ placeholder: {
18
+ type: String,
19
+ default: "",
20
+ },
21
+ type: {
22
+ type: String,
23
+ default: "text",
24
+ },
25
+ disabled: {
26
+ default: false,
27
+ },
28
+ width: {
29
+ default: 100,
30
+ },
31
+ });
32
+
33
+ const value = computed({
34
+ get() {
35
+ return props.modelValue;
36
+ },
37
+ set(data) {
38
+ emits('change', data)
39
+ emits('update:modelValue', data)
40
+ },
41
+ });
42
+ </script>
43
+
44
+
45
+ <template>
46
+ <el-input class="xl-input xl-form-item" v-model="value" :placeholder="l?l:placeholder" :type="type" :disabled="disabled"
47
+ :style="{ width: `${width}px` }"></el-input>
48
+ </template>
49
+
50
+
51
+ <style scoped>
52
+ .xl-input {}
53
+ </style>
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlMapSelect" })
3
+
4
+ import { ref, computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ default: '',
12
+ },
13
+ values: {
14
+ type: Array,
15
+ default: () => [],
16
+ },
17
+ map: {
18
+ type: Object,
19
+ default() {
20
+ return {};
21
+ },
22
+ },
23
+ disabled: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ width: {
28
+ default: 100,
29
+ },
30
+ multiple: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ placeholder: {
35
+ type: String,
36
+ default: '',
37
+ },
38
+ allowCreate: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ });
43
+
44
+ const value = computed({
45
+ get() {
46
+ return props.modelValue;
47
+ },
48
+ set(data) {
49
+ emits('change', data)
50
+ emits('update:modelValue', data)
51
+ },
52
+ });
53
+ </script>
54
+
55
+
56
+ <template>
57
+ <el-select class="xl-map-select xl-form-item" v-model="value" :placeholder="placeholder"
58
+ :disabled="disabled" :style="{ width: `${width}px` }" :multiple="multiple" clearable>
59
+ <el-option v-for="val in values" :key="val" :label="map[val]" :value="val"/>
60
+ </el-select>
61
+ </template>
62
+
63
+
64
+ <style lang="less" scoped>
65
+ .el-select {
66
+ margin: 3px 0;
67
+ }
68
+
69
+ .el-input__inner {
70
+ padding: 0 5px !important;
71
+ }
72
+ </style>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlNumber" })
3
+ </script>
4
+
5
+
6
+ <template>
7
+ <xl-input type="number" v-bind="$props" />
8
+ </template>
9
+
10
+
11
+ <style scoped></style>