@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,42 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlRadio" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ type: String,
12
+ default: "",
13
+ },
14
+ options: {
15
+ type: Array,
16
+ default() {
17
+ return [];
18
+ },
19
+ },
20
+ })
21
+
22
+ const value = computed({
23
+ get() {
24
+ return props.modelValue;
25
+ },
26
+ set(data) {
27
+ emits('change', data)
28
+ emits('update:modelValue', data)
29
+ },
30
+ });
31
+ </script>
32
+
33
+
34
+ <template>
35
+ <el-radio-group class="xl-radio" v-model="value">
36
+ <el-radio v-for="(option, index) in options" :key="index" :value="option.value">{{ option.label
37
+ }}</el-radio>
38
+ </el-radio-group>
39
+ </template>
40
+
41
+
42
+ <style lang="less"></style>
@@ -0,0 +1,71 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlRawSelect" })
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
+ labels: {
14
+ type: Array,
15
+ default: () => [],
16
+ },
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ width: {
22
+ default: 100,
23
+ },
24
+ multiple: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ placeholder: {
29
+ type: String,
30
+ default: '',
31
+ },
32
+ allowCreate: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ });
37
+
38
+
39
+ const visible = ref(true)
40
+
41
+ const value = computed({
42
+ get() {
43
+ return props.modelValue;
44
+ },
45
+ set(data) {
46
+ emits('change', data)
47
+ emits('update:modelValue', data)
48
+ },
49
+ });
50
+ </script>
51
+
52
+
53
+ <template>
54
+ <el-select v-if="visible" class="xl-raw-select xl-form-item" v-model="value" :placeholder="placeholder"
55
+ :disabled="disabled" :style="{ width: `${width}px` }" :multiple="multiple" clearable>
56
+ <el-option v-for="(label, index) in labels" :key="index" :value="label">
57
+ {{ label }}
58
+ </el-option>
59
+ </el-select>
60
+ </template>
61
+
62
+
63
+ <style lang="less" scoped>
64
+ .el-select {
65
+ margin: 3px 0;
66
+ }
67
+
68
+ .el-input__inner {
69
+ padding: 0 5px !important;
70
+ }
71
+ </style>
@@ -0,0 +1,51 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlRegion" })
3
+
4
+ import areas from "./data/areas.json";
5
+ import { computed } from 'vue';
6
+
7
+
8
+ const emits = defineEmits(['change', 'update:modelValue'])
9
+
10
+ const props = defineProps({
11
+ modelValue: {
12
+ default: "",
13
+ },
14
+ placeholder: {
15
+ type: String,
16
+ default: "请选择",
17
+ },
18
+ disabled: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ width: {
23
+ default: 200,
24
+ },
25
+ size: {
26
+ type: String,
27
+ default: "",
28
+ },
29
+ });
30
+
31
+ const value = computed({
32
+ get() {
33
+ return props.modelValue.split('/');
34
+ },
35
+ set(val) {
36
+ const data = val.join('/');
37
+ emits('change', data)
38
+ emits('update:modelValue', data)
39
+ },
40
+ });
41
+ </script>
42
+
43
+
44
+ <template>
45
+ <el-cascader class="xl-region" v-model="value" :options="areas" :disabled="disabled"
46
+ :style="{ width: width + 'px' }">
47
+ </el-cascader>
48
+ </template>
49
+
50
+
51
+ <style></style>
@@ -0,0 +1,85 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlSearchSelect" })
3
+
4
+ import { onMounted, ref, computed, watch, isRef, unref } 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
+ options: {
18
+ type: [Array, Object],
19
+ default: [],
20
+ },
21
+ placeholder: {
22
+ type: String,
23
+ default: "",
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ multiple: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ width: {
34
+ default: 100,
35
+ },
36
+ })
37
+
38
+ const showOptions = ref([])
39
+
40
+ const value = computed({
41
+ get() {
42
+ return props.modelValue;
43
+ },
44
+ set(data) {
45
+ emits('change', data)
46
+ emits('update:modelValue', data)
47
+ },
48
+ });
49
+
50
+ function handleClick() {
51
+ showOptions.value = isRef(props.options) ? props.options.value : props.options;
52
+ }
53
+
54
+ function handleFilter(val) {
55
+ const options = isRef(props.options) ? props.options.value : props.options;
56
+ if (val) {
57
+ showOptions.value = options.filter((item) => {
58
+ return item.label ? item.label.includes(val) : false;
59
+ });
60
+ } else {
61
+ showOptions.value = options;
62
+ }
63
+ }
64
+
65
+ watch(() => isRef(props.options) ? props.options.value : props.options, (val) => {
66
+ handleClick()
67
+ })
68
+
69
+ onMounted(() => {
70
+ handleClick()
71
+ })
72
+ </script>
73
+
74
+
75
+ <template>
76
+ <el-select class="xl-search-select xl-form-item" v-model="value" :placeholder="l?l:placeholder" filterable
77
+ :filter-method="handleFilter" @click="handleClick" :style="{ width: `${width}px` }" :disabled="disabled"
78
+ :multiple="multiple" clearable>
79
+ <el-option v-for="(option, index) in showOptions" :key="index" :label="option.label" :value="option.value">
80
+ </el-option>
81
+ </el-select>
82
+ </template>
83
+
84
+
85
+ <style></style>
@@ -0,0 +1,77 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlSelect" })
3
+
4
+ import { ref, computed, isRef, unref } 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
+ options: {
18
+ type: [Array, Object], // Allow both Array and Ref<Array>
19
+ default: () => [],
20
+ },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ width: {
26
+ default: 100,
27
+ },
28
+ multiple: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ placeholder: {
33
+ type: String,
34
+ default: '',
35
+ },
36
+ allowCreate: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ });
41
+
42
+
43
+ const visible = ref(true)
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
+ const resolvedOptions = computed(() => {
56
+ return props.options.value ? props.options.value : props.options;
57
+ });
58
+ </script>
59
+
60
+
61
+ <template>
62
+ <el-select v-if="visible" class="xl-select xl-form-item" v-model="value" :placeholder="l?l:placeholder"
63
+ :disabled="disabled" :style="{ width: `${width}px` }" :multiple="multiple" clearable>
64
+ <el-option v-for="option in resolvedOptions" :key="option.value" :label="option.label" :value="option.value"/>
65
+ </el-select>
66
+ </template>
67
+
68
+
69
+ <style lang="less" scoped>
70
+ .el-select {
71
+ margin: 3px 0;
72
+ }
73
+
74
+ .el-input__inner {
75
+ padding: 0 5px !important;
76
+ }
77
+ </style>
@@ -0,0 +1,33 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlSwitch" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ type: Number,
12
+ default: 0,
13
+ },
14
+ });
15
+
16
+ const value = computed({
17
+ get() {
18
+ return props.modelValue;
19
+ },
20
+ set(data) {
21
+ emits('change', data)
22
+ emits('update:modelValue', data)
23
+ },
24
+ });
25
+ </script>
26
+
27
+
28
+ <template>
29
+ <el-switch class="xl-switch" v-model="value" :active-value="1" :inactive-value="0" />
30
+ </template>
31
+
32
+
33
+ <style lang="less" scoped></style>
@@ -0,0 +1,43 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlTabRadio" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ default: "",
12
+ },
13
+ options: {
14
+ type: Array,
15
+ default() {
16
+ return [];
17
+ },
18
+ },
19
+ })
20
+
21
+ const value = computed({
22
+ get() {
23
+ return props.modelValue;
24
+ },
25
+ set(data) {
26
+ emits('change', data)
27
+ emits('update:modelValue', data)
28
+ },
29
+ });
30
+ </script>
31
+
32
+
33
+ <template>
34
+ <el-radio-group class="xl-tab-radio" v-model="value">
35
+ <el-radio-button v-for="(option, index) in options" :key="index" :value="option.value">{{ option.label
36
+ }}</el-radio-button>
37
+ </el-radio-group>
38
+ </template>
39
+
40
+
41
+ <style lang="less">
42
+ .xl-tab-radio {}
43
+ </style>
@@ -0,0 +1,105 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlTags" })
3
+
4
+ import { ref, computed } from 'vue'
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ type: String,
12
+ default: ''
13
+ },
14
+ editable: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ options: {
19
+ type: Array,
20
+ default: () => [],
21
+ },
22
+ type: {
23
+ type: String,
24
+ default: 'input'
25
+ }
26
+ })
27
+
28
+ const tags = computed({
29
+ get() {
30
+ if (typeof props.modelValue == 'string') {
31
+ if (props.modelValue.length !== 0) {
32
+ return props.modelValue.split(',');
33
+ }
34
+ }
35
+ return []
36
+ },
37
+ set(data) {
38
+ emits('change', data.join(','))
39
+ emits('update:modelValue', data.join(','))
40
+ },
41
+ });
42
+
43
+ const valueMap = computed(() => {
44
+ let tmp = {};
45
+ props.options.forEach((option) => {
46
+ tmp[option.value] = option.label;
47
+ });
48
+ return tmp;
49
+ })
50
+
51
+ const newTag = ref('')
52
+
53
+ const handlers = {
54
+ add() {
55
+ const temp = tags.value.slice()
56
+ temp.push(newTag.value);
57
+ tags.value = temp
58
+ newTag.value = ''
59
+ },
60
+ remove(index) {
61
+ tags.value.splice(index, 1)
62
+ const temp = tags.value.slice()
63
+ temp.splice(index, 1);
64
+ tags.value = temp
65
+ }
66
+ }
67
+ </script>
68
+
69
+
70
+ <template>
71
+ <div class="xl-tags">
72
+ <el-tag v-for="(tag, index) in tags" :key="tag" :closable="editable" @close="handlers.remove(index)">
73
+ {{ type == 'select' ? valueMap[tag] : tag }}
74
+ </el-tag>
75
+ <xl-input v-if="editable && type == 'input'" class="new-tag" v-model="newTag" />
76
+ <xl-search-select v-if="editable && type == 'select'" class="new-tag" v-model="newTag"
77
+ :options="options"/>
78
+ <xl-button v-if="editable" class="add-btn" @click="handlers.add">+ 添加</xl-button>
79
+ </div>
80
+ </template>
81
+
82
+
83
+ <style lang="less" scoped>
84
+ .el-tag {
85
+ margin-left: 3px;
86
+ margin-bottom: 2px;
87
+ }
88
+
89
+ .xl-input{
90
+ width:auto!important
91
+ }
92
+
93
+ .new-tag {
94
+ margin-left: 3px;
95
+ margin-bottom: 2px;
96
+ height: 32px;
97
+ line-height: 30px;
98
+ padding-top: 0;
99
+ padding-bottom: 0;
100
+ }
101
+
102
+ .add-btn {
103
+ margin-left: 3px;
104
+ }
105
+ </style>
@@ -0,0 +1,48 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlTextarea" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(["update:modelValue", 'change']);
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ },
12
+ placeholder: {
13
+ type: String,
14
+ default: "",
15
+ },
16
+ disabled: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ width: {
21
+ default: 100,
22
+ },
23
+ });
24
+
25
+ const value = computed({
26
+ get() {
27
+ return props.modelValue;
28
+ },
29
+ set(data) {
30
+ emits('change', data)
31
+ emits("update:modelValue", data)
32
+ },
33
+ });
34
+ </script>
35
+
36
+
37
+ <template>
38
+ <el-input class="xl-textarea xl-form-item" v-model="value" :placeholder="placeholder" type="textarea" size="small"
39
+ :disabled="disabled" :autosize="{ minRows: 2 }"></el-input>
40
+ </template>
41
+
42
+
43
+ <style lang="less" scoped>
44
+ textarea {
45
+ width: 100%;
46
+ height: 100%;
47
+ }
48
+ </style>
@@ -0,0 +1,50 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlTime" })
3
+
4
+ import { computed } from 'vue';
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ default: "",
12
+ },
13
+ placeholder: {
14
+ type: String,
15
+ default: "选择时间",
16
+ },
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ width: {
22
+ default: 100,
23
+ },
24
+ });
25
+
26
+ const value = computed({
27
+ get() {
28
+ return props.modelValue;
29
+ },
30
+ set(data) {
31
+ emits('change', data)
32
+ emits('update:modelValue', data)
33
+ },
34
+ });
35
+ </script>
36
+
37
+
38
+ <template>
39
+ <el-date-picker class="xl-time xl-form-item" v-model="value" type="datetime" :placeholder="placeholder"
40
+ :style="{ width: `${width}px` }" :disabled="disabled" clearable value-format="YYYY-MM-DD HH:mm:ss" />
41
+ </template>
42
+
43
+
44
+ <style lang="less">
45
+ .z-time {
46
+ .el-input__prefix {
47
+ display: none !important;
48
+ }
49
+ }
50
+ </style>