@archbiz/element-ui 0.0.0-stage → 0.1.1
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.
- package/dist/element-ui.cjs +11 -0
- package/dist/element-ui.js +5518 -0
- package/dist/style.css +1 -0
- package/package.json +50 -4
- package/src/components/ab-checkbox.vue +51 -0
- package/src/components/ab-color-picker.vue +39 -0
- package/src/components/ab-detail/ab-detail.vue +285 -0
- package/src/components/ab-detail/index.js +1 -0
- package/src/components/ab-drawer/ab-drawer.vue +50 -0
- package/src/components/ab-drawer/index.js +3 -0
- package/src/components/ab-icon/ab-icon.vue +90 -0
- package/src/components/ab-icon/index.js +1 -0
- package/src/components/ab-input-number.vue +49 -0
- package/src/components/ab-input-range.vue +90 -0
- package/src/components/ab-radio.vue +51 -0
- package/src/components/ab-router-link.vue +46 -0
- package/src/components/ab-search/ab-search.vue +168 -0
- package/src/components/ab-search/index.js +4 -0
- package/src/components/ab-select.vue +107 -0
- package/src/components/ab-table/ab-table-column.vue +131 -0
- package/src/components/ab-table/ab-table-columns.vue +62 -0
- package/src/components/ab-table/ab-table-operate.vue +160 -0
- package/src/components/ab-table/ab-table.vue +316 -0
- package/src/components/ab-table/columns.js +90 -0
- package/src/components/ab-table/footer.js +77 -0
- package/src/components/ab-table/formatter.js +2 -0
- package/src/components/ab-table/index.js +8 -0
- package/src/components/ab-table/utils.js +36 -0
- package/src/components/ab-time-period.vue +116 -0
- package/src/components/ab-time-picker.vue +38 -0
- package/src/components/ab-toolbar/ab-toolbar.vue +102 -0
- package/src/components/ab-toolbar/index.js +1 -0
- package/src/components/ab-tree-select.vue +456 -0
- package/src/components/ab-upload-file.vue +277 -0
- package/src/components/index.js +27 -0
- package/src/core/ab-form.js +25 -0
- package/src/core/alias.js +36 -0
- package/src/core/config.js +65 -0
- package/src/core/form-render.js +256 -0
- package/src/core/options.js +25 -0
- package/src/hooks/use-cache.js +75 -0
- package/src/index.js +39 -0
- package/src/makers/datePicker.js +8 -0
- package/src/makers/frame.js +23 -0
- package/src/makers/index.js +23 -0
- package/src/makers/input.js +12 -0
- package/src/makers/select.js +8 -0
- package/src/makers/slider.js +7 -0
- package/src/makers/timePicker.js +8 -0
- package/src/makers/tree.js +10 -0
- package/src/makers/upload.js +20 -0
- package/src/parsers/checkbox.js +5 -0
- package/src/parsers/colorPicker.js +29 -0
- package/src/parsers/datePicker.js +24 -0
- package/src/parsers/frame.js +17 -0
- package/src/parsers/hidden.js +11 -0
- package/src/parsers/index.js +36 -0
- package/src/parsers/input.js +15 -0
- package/src/parsers/number.js +29 -0
- package/src/parsers/radio.js +5 -0
- package/src/parsers/select.js +15 -0
- package/src/parsers/slider.js +21 -0
- package/src/parsers/switch.js +11 -0
- package/src/parsers/text.js +25 -0
- package/src/parsers/timePicker.js +12 -0
- package/src/parsers/tree.js +37 -0
- package/src/parsers/upload.js +35 -0
- package/src/plugins/ab-detail.js +7 -0
- package/src/plugins/ab-drawer.js +7 -0
- package/src/plugins/ab-form.js +14 -0
- package/src/plugins/ab-search.js +7 -0
- package/src/plugins/ab-table.js +15 -0
- package/src/plugins/ab-toolbar.js +7 -0
- package/src/rule/defaults.js +187 -0
- package/src/rule/formatter.js +218 -0
- package/src/style/index.css +356 -0
- package/src/utils/formatter.js +188 -0
- package/src/utils/router-link.js +59 -0
- package/README.md +0 -3
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ab-time-period w-full">
|
|
3
|
+
<div class="start-time">{{ period[0] || "--:--" }}</div>
|
|
4
|
+
<div v-if="isReadonly">~</div>
|
|
5
|
+
<el-slider
|
|
6
|
+
v-else
|
|
7
|
+
:class="{ 'is-empty': !period[0] && !period[1] }"
|
|
8
|
+
:value="sliderValue"
|
|
9
|
+
range
|
|
10
|
+
:step="30"
|
|
11
|
+
:min="bounds[0]"
|
|
12
|
+
:max="bounds[1]"
|
|
13
|
+
:format-tooltip="formatTime"
|
|
14
|
+
@input="updatePeriod"
|
|
15
|
+
@change="handleChange"
|
|
16
|
+
/>
|
|
17
|
+
<div class="end-time">{{ period[1] || "--:--" }}</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
function parseTime(value) {
|
|
23
|
+
const match = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(value || "").trim());
|
|
24
|
+
if (!match) return 0;
|
|
25
|
+
const hour = Number(match[1]);
|
|
26
|
+
const minute = Number(match[2]);
|
|
27
|
+
const second = match[3] ? Number(match[3]) : 0;
|
|
28
|
+
return hour * 3600 + minute * 60 + second;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function formatTime(value) {
|
|
32
|
+
const hour = Math.floor(value / 3600);
|
|
33
|
+
const minute = Math.floor((value % 3600) / 60);
|
|
34
|
+
const second = value % 60;
|
|
35
|
+
const time = `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`;
|
|
36
|
+
return second ? `${time}:${String(second).padStart(2, "0")}` : time;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: "AbTimePeriod",
|
|
41
|
+
props: {
|
|
42
|
+
abFormInject: { type: Object, default: undefined },
|
|
43
|
+
value: { type: Array, default: () => [] },
|
|
44
|
+
startTime: { type: String, default: "08:00" },
|
|
45
|
+
endTime: { type: String, default: "18:00" },
|
|
46
|
+
readonly: Boolean,
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
isReadonly() {
|
|
50
|
+
return this.readonly === true || Boolean(this.abFormInject && this.abFormInject.readonly === true);
|
|
51
|
+
},
|
|
52
|
+
bounds() {
|
|
53
|
+
const start = parseTime(this.startTime);
|
|
54
|
+
const end = parseTime(this.endTime);
|
|
55
|
+
return start < end ? [start, end] : [0, 86400];
|
|
56
|
+
},
|
|
57
|
+
period() {
|
|
58
|
+
const value = Array.isArray(this.value) ? this.value : [];
|
|
59
|
+
return [
|
|
60
|
+
value[0] === "" || value[0] === undefined ? null : value[0],
|
|
61
|
+
value[1] === "" || value[1] === undefined ? null : value[1],
|
|
62
|
+
];
|
|
63
|
+
},
|
|
64
|
+
selected() {
|
|
65
|
+
const [min, max] = this.bounds;
|
|
66
|
+
const start = this.period[0] === null ? min : parseTime(this.period[0]);
|
|
67
|
+
const end = this.period[1] === null ? max : parseTime(this.period[1]);
|
|
68
|
+
return start <= end ? [start, end] : [min, max];
|
|
69
|
+
},
|
|
70
|
+
sliderValue() {
|
|
71
|
+
const clamp = (value) => Math.min(this.bounds[1], Math.max(this.bounds[0], value));
|
|
72
|
+
return [clamp(this.selected[0]), clamp(this.selected[1])];
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
formatTime,
|
|
77
|
+
toPeriod(value) {
|
|
78
|
+
const next = Array.isArray(value) ? value : [];
|
|
79
|
+
return [
|
|
80
|
+
this.period[0] !== null && next[0] === this.sliderValue[0] ? this.period[0] : formatTime(next[0]),
|
|
81
|
+
this.period[1] !== null && next[1] === this.sliderValue[1] ? this.period[1] : formatTime(next[1]),
|
|
82
|
+
];
|
|
83
|
+
},
|
|
84
|
+
updatePeriod(value) {
|
|
85
|
+
this.$emit("input", this.toPeriod(value));
|
|
86
|
+
},
|
|
87
|
+
handleChange(value) {
|
|
88
|
+
this.$emit("change", this.toPeriod(value));
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<style>
|
|
95
|
+
.ab-time-period {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: flex-start;
|
|
99
|
+
width: 100%;
|
|
100
|
+
}
|
|
101
|
+
.ab-time-period .el-slider {
|
|
102
|
+
flex: 1;
|
|
103
|
+
margin: 0 12px;
|
|
104
|
+
}
|
|
105
|
+
.ab-time-period .start-time,
|
|
106
|
+
.ab-time-period .end-time {
|
|
107
|
+
width: 78px;
|
|
108
|
+
height: 100%;
|
|
109
|
+
}
|
|
110
|
+
.ab-time-period .end-time {
|
|
111
|
+
text-align: right;
|
|
112
|
+
}
|
|
113
|
+
.ab-time-period .el-slider.is-empty .el-slider__bar {
|
|
114
|
+
visibility: hidden;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-time-picker
|
|
3
|
+
ref="el"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:value="value"
|
|
6
|
+
:size="currentSize"
|
|
7
|
+
@input="handleInput"
|
|
8
|
+
@change="handleChange"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { useCache } from "../hooks/use-cache.js";
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: "AbTimePicker",
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: {
|
|
19
|
+
value: { default: undefined },
|
|
20
|
+
abFormInject: { type: Object, default: undefined },
|
|
21
|
+
},
|
|
22
|
+
computed: {
|
|
23
|
+
currentSize() {
|
|
24
|
+
const { getCurrentSize } = useCache();
|
|
25
|
+
const size = getCurrentSize();
|
|
26
|
+
return size && size !== "default" && size !== "large" ? size : undefined;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
handleInput(value) {
|
|
31
|
+
this.$emit("input", value);
|
|
32
|
+
},
|
|
33
|
+
handleChange(value) {
|
|
34
|
+
this.$emit("change", value);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { AbTableEnum, trans2VxeSize } from '../ab-table/utils.js';
|
|
3
|
+
|
|
4
|
+
const clone = (value) => (value === undefined ? value : JSON.parse(JSON.stringify(value)));
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'AbToolbar',
|
|
8
|
+
inject: {
|
|
9
|
+
abTableRef: { default: () => ({}) }
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
title: String,
|
|
13
|
+
permiPrefix: String,
|
|
14
|
+
rule: { type: [Object, Array], default: undefined },
|
|
15
|
+
queryHandler: Function,
|
|
16
|
+
refreshEnable: { type: Boolean, default: true },
|
|
17
|
+
exportEnable: { type: Boolean, default: false },
|
|
18
|
+
settingEnable: { type: Boolean, default: true },
|
|
19
|
+
btnTreeEnable: Boolean,
|
|
20
|
+
classNmae: String,
|
|
21
|
+
vertical: { type: Boolean, default: false }
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
loading: false
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
vxeCurrentSize() {
|
|
30
|
+
return trans2VxeSize('default');
|
|
31
|
+
},
|
|
32
|
+
currentRule() {
|
|
33
|
+
if (!this.rule || (Array.isArray(this.rule) && !this.rule.length)) return undefined;
|
|
34
|
+
const rule = clone(this.rule);
|
|
35
|
+
return Array.isArray(rule) ? { type: 'ElRow', children: [...rule] } : rule;
|
|
36
|
+
},
|
|
37
|
+
refreshHandler() {
|
|
38
|
+
if (this.queryHandler) return this.queryHandler;
|
|
39
|
+
const table = this.abTableRef && this.abTableRef.value;
|
|
40
|
+
if (table && typeof table.reload === 'function') return table.reload;
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
mounted() {
|
|
45
|
+
const table = this.abTableRef && this.abTableRef.value;
|
|
46
|
+
const toolbar = this.$refs.toolbar && (this.$refs.toolbar.$el ? this.$refs.toolbar : this.$refs.toolbar);
|
|
47
|
+
if (table && table.tableRef && toolbar && typeof table.tableRef.connect === 'function') {
|
|
48
|
+
table.tableRef.connect(toolbar);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
getTitle() {
|
|
53
|
+
return this.title;
|
|
54
|
+
},
|
|
55
|
+
renderButtons(h) {
|
|
56
|
+
if (this.title) {
|
|
57
|
+
return h('div', { class: 'ab-toolbar__title' }, [this.$slots.icon, this.title]);
|
|
58
|
+
}
|
|
59
|
+
if (this.$slots.buttons) return this.$slots.buttons;
|
|
60
|
+
return h('div', { class: 'ab-toolbar__title' }, [this.$route?.meta?.title || '']);
|
|
61
|
+
},
|
|
62
|
+
renderTools(h) {
|
|
63
|
+
const nodes = [...(this.$slots.tools || [])];
|
|
64
|
+
if (this.currentRule) {
|
|
65
|
+
nodes.push(
|
|
66
|
+
h('ab-table-operate', {
|
|
67
|
+
props: {
|
|
68
|
+
permiPrefix: this.permiPrefix,
|
|
69
|
+
rule: this.currentRule,
|
|
70
|
+
plain: true
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
return nodes;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
render(h) {
|
|
79
|
+
return h('vxe-toolbar', {
|
|
80
|
+
class: 'ab-toolbar',
|
|
81
|
+
ref: 'toolbar',
|
|
82
|
+
props: {
|
|
83
|
+
className: this.classNmae,
|
|
84
|
+
size: this.vxeCurrentSize,
|
|
85
|
+
loading: this.loading,
|
|
86
|
+
export: this.exportEnable,
|
|
87
|
+
refresh: this.refreshEnable
|
|
88
|
+
? this.refreshHandler
|
|
89
|
+
? { query: this.refreshHandler }
|
|
90
|
+
: true
|
|
91
|
+
: false,
|
|
92
|
+
custom: !!this.settingEnable,
|
|
93
|
+
vertical: this.vertical
|
|
94
|
+
},
|
|
95
|
+
scopedSlots: {
|
|
96
|
+
buttons: () => this.renderButtons(h),
|
|
97
|
+
tools: () => this.renderTools(h)
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AbToolbar } from './ab-toolbar.vue';
|