@community-release/nx-ui 0.0.4 → 0.0.7
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/module.d.mts +7 -0
- package/dist/module.d.ts +7 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +230 -9
- package/dist/runtime/components/accordion.vue +221 -0
- package/dist/runtime/components/animated-number/animateValue.d.ts +13 -0
- package/dist/runtime/components/animated-number/animateValue.mjs +56 -0
- package/dist/runtime/components/animated-number/index.vue +43 -0
- package/dist/runtime/components/button/index.vue +360 -0
- package/dist/runtime/components/button/index.vue.d.ts +81 -0
- package/dist/runtime/components/button/props.json +6 -0
- package/dist/runtime/components/card.vue +138 -0
- package/dist/runtime/components/checkbox.vue +227 -0
- package/dist/runtime/components/countdown/index.vue +64 -0
- package/dist/runtime/components/countdown/props.json +6 -0
- package/dist/runtime/components/filter/index.vue +140 -0
- package/dist/runtime/components/filter/props.json +4 -0
- package/dist/runtime/components/grid.vue +169 -0
- package/dist/runtime/components/grid.vue.d.ts +56 -0
- package/dist/runtime/components/helpers/Countdown.d.ts +0 -0
- package/dist/runtime/components/helpers/Countdown.mjs +143 -0
- package/dist/runtime/components/helpers/getEventCoord.d.ts +7 -0
- package/dist/runtime/components/helpers/getEventCoord.mjs +16 -0
- package/dist/runtime/components/helpers/isImageExist.d.ts +6 -0
- package/dist/runtime/components/helpers/isImageExist.mjs +20 -0
- package/dist/runtime/components/helpers/isMobileDevice.d.ts +5 -0
- package/dist/runtime/components/helpers/isMobileDevice.mjs +12 -0
- package/dist/runtime/components/helpers/isWebKit.d.ts +5 -0
- package/dist/runtime/components/helpers/isWebKit.mjs +12 -0
- package/dist/runtime/components/helpers/uniq.d.ts +2 -0
- package/dist/runtime/components/helpers/uniq.mjs +1 -0
- package/dist/runtime/components/icons/check.svg +1 -0
- package/dist/runtime/components/icons/check.white.svg +1 -0
- package/dist/runtime/components/impulse-indicator.vue +139 -0
- package/dist/runtime/components/impulse-indicator.vue.d.ts +21 -0
- package/dist/runtime/components/input/index.vue +241 -0
- package/dist/runtime/components/input/props.json +5 -0
- package/dist/runtime/components/label.vue +33 -0
- package/dist/runtime/components/loading.vue +91 -0
- package/dist/runtime/components/map/device-zoom-switch.vue +160 -0
- package/dist/runtime/components/map/index.vue +135 -0
- package/dist/runtime/components/map/location/index.vue +109 -0
- package/dist/runtime/components/map/location/list.vue +54 -0
- package/dist/runtime/components/map/location/nearest.vue +88 -0
- package/dist/runtime/components/map/openlayers/index.vue +355 -0
- package/dist/runtime/components/map/props.json +5 -0
- package/dist/runtime/components/map/store.d.ts +114 -0
- package/dist/runtime/components/map/store.mjs +166 -0
- package/dist/runtime/components/map/zoom.vue +61 -0
- package/dist/runtime/components/notice/index.vue +63 -0
- package/dist/runtime/components/notice/item.vue +118 -0
- package/dist/runtime/components/notice/store.d.ts +27 -0
- package/dist/runtime/components/notice/store.mjs +46 -0
- package/dist/runtime/components/radio.vue +215 -0
- package/dist/runtime/components/select.vue +303 -0
- package/dist/runtime/components/static-map.vue +345 -0
- package/dist/runtime/components/styles/components.less +3 -0
- package/dist/runtime/components/styles/mixins.less +6 -0
- package/dist/runtime/components/textarea/index.vue +166 -0
- package/dist/runtime/components/textarea/props.json +4 -0
- package/dist/runtime/components/tooltip.vue +137 -0
- package/dist/runtime/plugins/methods.d.ts +2 -0
- package/dist/runtime/plugins/methods.mjs +20 -0
- package/dist/runtime/plugins/variables.d.ts +2 -0
- package/dist/runtime/plugins/variables.mjs +17 -0
- package/dist/types.d.mts +2 -11
- package/dist/types.d.ts +2 -11
- package/package.json +2 -2
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="component-ui component-ui-checkbox" :class="classes">
|
|
3
|
+
<label>
|
|
4
|
+
<input
|
|
5
|
+
ref="input"
|
|
6
|
+
type="checkbox"
|
|
7
|
+
:name="name"
|
|
8
|
+
:checked="isChecked"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
@change="updateValue($event.target.checked)"
|
|
11
|
+
autocomplete="off"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<i></i>
|
|
15
|
+
|
|
16
|
+
<span>
|
|
17
|
+
<slot></slot>
|
|
18
|
+
</span>
|
|
19
|
+
</label>
|
|
20
|
+
</span>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
// Imports
|
|
25
|
+
import { computed } from 'vue';
|
|
26
|
+
|
|
27
|
+
//
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
name: {
|
|
30
|
+
required: false,
|
|
31
|
+
default: 'cb'
|
|
32
|
+
},
|
|
33
|
+
modelValue: {
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
haveError: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
useBinaries: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits(['change', 'onchange', 'update:modelValue']);
|
|
55
|
+
|
|
56
|
+
const classes = computed(() => {
|
|
57
|
+
const ar = [];
|
|
58
|
+
|
|
59
|
+
if (props.haveError) ar.push('tag-error');
|
|
60
|
+
if (props.disabled) ar.push('tag-disabled');
|
|
61
|
+
if (props.required) ar.push('tag-required');
|
|
62
|
+
|
|
63
|
+
return ar;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const isChecked = computed(() => {
|
|
67
|
+
let result = props.modelValue;
|
|
68
|
+
|
|
69
|
+
if (props.useBinaries) result = (result === 1 || result === '1') ? true : false;
|
|
70
|
+
|
|
71
|
+
return result;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Methods
|
|
75
|
+
function updateValue(checked) {
|
|
76
|
+
let value = checked;
|
|
77
|
+
|
|
78
|
+
if (props.useBinaries) value = value ? 1 : 0;
|
|
79
|
+
|
|
80
|
+
emit('change', value);
|
|
81
|
+
emit('update:modelValue', value);
|
|
82
|
+
emit('onchange', value);
|
|
83
|
+
};
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style lang="less">
|
|
87
|
+
.component-ui-checkbox {
|
|
88
|
+
@com-color-primary: var(--ui-color-primary);
|
|
89
|
+
@com-color-text-on-primary: var(--ui-color-text-on-primary);
|
|
90
|
+
@com-color-border: var(--ui-color-border);
|
|
91
|
+
@com-color-red: var(--ui-color-red);
|
|
92
|
+
|
|
93
|
+
@com-color-text: var(--ui-color-text);
|
|
94
|
+
@com-color-header-text: var(--ui-color-header-text);
|
|
95
|
+
@com-color-gray-text: var(--ui-color-gray-text);
|
|
96
|
+
@com-color-error-text: var(--ui-color-error);
|
|
97
|
+
|
|
98
|
+
@com-text-medium: var(--ui-text-medium);
|
|
99
|
+
@com-text-small: var(--ui-text-small);
|
|
100
|
+
|
|
101
|
+
@com-input-height: var(--ui-input-height-default);
|
|
102
|
+
|
|
103
|
+
@com-space-micro: var(--ui-space-micro);
|
|
104
|
+
|
|
105
|
+
position: relative;
|
|
106
|
+
display: inline-block;
|
|
107
|
+
text-align: left;
|
|
108
|
+
|
|
109
|
+
.error-wrap {
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: 100%;
|
|
112
|
+
left: 0;
|
|
113
|
+
padding: 0;
|
|
114
|
+
|
|
115
|
+
font-size: 11px;
|
|
116
|
+
|
|
117
|
+
color: @com-color-error-text;
|
|
118
|
+
background: transparent;
|
|
119
|
+
|
|
120
|
+
&:before, &:after { display: none; }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
> label {
|
|
124
|
+
position: relative;
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: left;
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 0 0 0 30px;
|
|
130
|
+
|
|
131
|
+
height: @com-input-height;
|
|
132
|
+
line-height: @com-input-height;
|
|
133
|
+
font-size: @com-text-small;
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
|
|
136
|
+
color: @com-color-text;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
|
|
139
|
+
> input {
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 0;
|
|
142
|
+
left: 0;
|
|
143
|
+
margin: 0;
|
|
144
|
+
padding: 0;
|
|
145
|
+
width: 100%;
|
|
146
|
+
height: 100%;
|
|
147
|
+
opacity: 0;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
> i {
|
|
152
|
+
transition: background 0.25s, border-color 0.25s;
|
|
153
|
+
|
|
154
|
+
position: absolute;
|
|
155
|
+
top: 50%;
|
|
156
|
+
left: 0;
|
|
157
|
+
margin-top: -9px;
|
|
158
|
+
width: 18px;
|
|
159
|
+
height: 18px;
|
|
160
|
+
border-radius: 3px;
|
|
161
|
+
border: 1px solid @com-color-gray-text;
|
|
162
|
+
|
|
163
|
+
color: @com-color-text-on-primary;
|
|
164
|
+
|
|
165
|
+
&:before {
|
|
166
|
+
content: '';
|
|
167
|
+
|
|
168
|
+
transition: opacity 0.25s;
|
|
169
|
+
|
|
170
|
+
opacity: 0;
|
|
171
|
+
|
|
172
|
+
position: absolute;
|
|
173
|
+
inset: 0;
|
|
174
|
+
background-position: center;
|
|
175
|
+
background-repeat: no-repeat;
|
|
176
|
+
background-size: 10px;
|
|
177
|
+
background-image: url(./icons/check.white.svg);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
> input:checked + i {
|
|
182
|
+
border-color: @com-color-primary;
|
|
183
|
+
background: @com-color-primary;
|
|
184
|
+
|
|
185
|
+
&:before {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
> a {
|
|
191
|
+
pointer-events: none;
|
|
192
|
+
position: relative;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
span {
|
|
196
|
+
//font-weight: 600;
|
|
197
|
+
color: @com-color-header-text;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Required
|
|
202
|
+
&.tag-required {
|
|
203
|
+
span:after {
|
|
204
|
+
content: '*';
|
|
205
|
+
padding-left: @com-space-micro;
|
|
206
|
+
color: @com-color-red;
|
|
207
|
+
font-weight: bold;
|
|
208
|
+
font-size: @com-text-medium;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Disabled
|
|
213
|
+
&.tag-disabled {
|
|
214
|
+
opacity: 0.6;
|
|
215
|
+
|
|
216
|
+
label,
|
|
217
|
+
input {
|
|
218
|
+
cursor: default;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Error
|
|
223
|
+
&.tag-error {
|
|
224
|
+
> label { color: @com-color-error-text; }
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="component-ui-countdown">
|
|
3
|
+
{{ time }}
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { ref, watchEffect, onMounted, onBeforeUnmount } from 'vue';
|
|
9
|
+
import Countdown from '../helpers/Countdown';
|
|
10
|
+
import comProps from '#build/ui.countdown.mjs';
|
|
11
|
+
|
|
12
|
+
// Data
|
|
13
|
+
//const { t } = useI18n();
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
ms: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: comProps.ms,
|
|
18
|
+
//default: 0
|
|
19
|
+
},
|
|
20
|
+
h: {
|
|
21
|
+
default: comProps.h,
|
|
22
|
+
},
|
|
23
|
+
m: {
|
|
24
|
+
default: comProps.m,
|
|
25
|
+
},
|
|
26
|
+
s: {
|
|
27
|
+
default: comProps.s,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const initialized = ref(false);
|
|
32
|
+
|
|
33
|
+
const time = ref(0);
|
|
34
|
+
let countdown = null;
|
|
35
|
+
|
|
36
|
+
watchEffect(() => {
|
|
37
|
+
if (!initialized.value) return;
|
|
38
|
+
if (countdown) countdown.destroy();
|
|
39
|
+
|
|
40
|
+
countdown = new Countdown( props.ms / 1000 );
|
|
41
|
+
countdown.onTick = onTick;
|
|
42
|
+
countdown.onFinish = onFinish;
|
|
43
|
+
countdown.start();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Methods
|
|
47
|
+
function onTick(e) {
|
|
48
|
+
const h = parseInt(e.h) ? `${e.h}${props.h} ` : '';
|
|
49
|
+
|
|
50
|
+
time.value = `${h}${e.m}${props.m} ${e.s}${props.s}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function onFinish() {
|
|
54
|
+
time.value = '00:00:00';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Hooks
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
initialized.value = true;
|
|
60
|
+
});
|
|
61
|
+
onBeforeUnmount(() => {
|
|
62
|
+
if (countdown) countdown.destroy();
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="component-ui component-ui-filter">
|
|
3
|
+
<span
|
|
4
|
+
v-for="item of items"
|
|
5
|
+
@click="$emit('update:modelValue', genUpdatedValue(item.value))"
|
|
6
|
+
:class="{'tag-active': isSelected(item.value)}"
|
|
7
|
+
>
|
|
8
|
+
<i v-if="item.icon" :class="item.icon"></i>
|
|
9
|
+
{{ item.name }}
|
|
10
|
+
</span>
|
|
11
|
+
</section>
|
|
12
|
+
</template>
|
|
13
|
+
<script setup>
|
|
14
|
+
// Imports
|
|
15
|
+
import { computed } from 'vue';
|
|
16
|
+
import comProps from '#build/ui.filter.mjs';
|
|
17
|
+
|
|
18
|
+
//
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
/*
|
|
21
|
+
[
|
|
22
|
+
{
|
|
23
|
+
name: '..',
|
|
24
|
+
value: '..',
|
|
25
|
+
icon?: 'icon-home'
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
*/
|
|
29
|
+
items: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => [],
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
modelValue: {
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
activeColor: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
default: comProps.activeColor
|
|
41
|
+
},
|
|
42
|
+
activeBg: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: false,
|
|
45
|
+
default: comProps.activeBg
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const computedModel = computed(() => {
|
|
50
|
+
return props.modelValue;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const isMultiSelect = computed(() => {
|
|
54
|
+
return Array.isArray(props.modelValue);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Methods
|
|
58
|
+
function isSelected(id) {
|
|
59
|
+
if (isMultiSelect.value) {
|
|
60
|
+
return computedModel.value.includes(id);
|
|
61
|
+
} else {
|
|
62
|
+
return computedModel.value === id;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function genUpdatedValue(id) {
|
|
67
|
+
// If multi select
|
|
68
|
+
if (isMultiSelect.value) {
|
|
69
|
+
// If item already in array then remove it
|
|
70
|
+
if (isSelected(id)) {
|
|
71
|
+
let ar = [...computedModel.value];
|
|
72
|
+
|
|
73
|
+
for (let i=0; i < ar.length; i++) {
|
|
74
|
+
if (ar[i] === id) ar.splice(i--, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return ar;
|
|
78
|
+
// If item not in array then add it
|
|
79
|
+
} else {
|
|
80
|
+
return [...computedModel.value, id];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// If single select
|
|
84
|
+
} else {
|
|
85
|
+
return id;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lang="less">
|
|
91
|
+
.component-ui-filter {
|
|
92
|
+
@com-space-default: var(--ui-space-default);
|
|
93
|
+
@com-space-small: var(--ui-space-small);
|
|
94
|
+
|
|
95
|
+
@com-input-height-small: var(--ui-input-height-small);
|
|
96
|
+
|
|
97
|
+
--active-color: v-bind(activeColor);
|
|
98
|
+
--active-bg: v-bind(activeBg);
|
|
99
|
+
|
|
100
|
+
overflow-x: auto;
|
|
101
|
+
overflow-y: hidden;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
|
|
104
|
+
margin-inline: calc(@com-space-default * -1);
|
|
105
|
+
padding: @com-space-default;
|
|
106
|
+
|
|
107
|
+
span {
|
|
108
|
+
user-select: none;
|
|
109
|
+
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
|
|
112
|
+
vertical-align: top;
|
|
113
|
+
margin-right: @com-space-small;
|
|
114
|
+
padding: 0 @com-space-small;
|
|
115
|
+
|
|
116
|
+
height: @com-input-height-small;
|
|
117
|
+
line-height: @com-input-height-small;
|
|
118
|
+
|
|
119
|
+
border-radius: 30px;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
i {
|
|
124
|
+
margin-right: 8px;
|
|
125
|
+
width: 18px;
|
|
126
|
+
height: 18px;
|
|
127
|
+
font-size: 18px;
|
|
128
|
+
color: var(--active-bg);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tag-active {
|
|
132
|
+
color: var(--active-color);
|
|
133
|
+
background: var(--active-bg);
|
|
134
|
+
|
|
135
|
+
i {
|
|
136
|
+
color: var(--active-color);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="component-ui component-ui-grid" :class="getClasses" :style="getStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</section>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
// Data
|
|
10
|
+
props: {
|
|
11
|
+
textAlign: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: 'left'
|
|
14
|
+
},
|
|
15
|
+
gap: {
|
|
16
|
+
type: [String, Object],
|
|
17
|
+
default: 'var(--ui-space-default)'
|
|
18
|
+
},
|
|
19
|
+
gridTemplateColumns: {
|
|
20
|
+
type: [String, Object],
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
gapTop: {
|
|
24
|
+
type: [Boolean, String],
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
gapBottom: {
|
|
28
|
+
type: [Boolean, String],
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
data: function () {
|
|
33
|
+
return {
|
|
34
|
+
timeout: null,
|
|
35
|
+
windowWidth: 999999
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
getClasses() {
|
|
40
|
+
let r = [
|
|
41
|
+
'tag-text-' + this.textAlign
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return r;
|
|
45
|
+
},
|
|
46
|
+
getStyle() {
|
|
47
|
+
let r = {};
|
|
48
|
+
let padding = this.computedGap.split(' ');
|
|
49
|
+
let paddingTop = padding[0];
|
|
50
|
+
let paddingBottom = padding[0];
|
|
51
|
+
|
|
52
|
+
r['grid-gap'] = this.computedGap;
|
|
53
|
+
|
|
54
|
+
if (this.computedGridTemplateColumns) {
|
|
55
|
+
r['grid-template-columns'] = this.computedGridTemplateColumns;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (this.gapTop === true)
|
|
59
|
+
r['padding-top'] = paddingTop;
|
|
60
|
+
|
|
61
|
+
if (this.gapBottom === true)
|
|
62
|
+
r['padding-bottom'] = paddingBottom;
|
|
63
|
+
|
|
64
|
+
return r;
|
|
65
|
+
},
|
|
66
|
+
computedItemMaxWidth() {
|
|
67
|
+
return parseInt(this.itemMaxWidth);
|
|
68
|
+
},
|
|
69
|
+
computedGridTemplateColumns() {
|
|
70
|
+
if (typeof this.gridTemplateColumns == 'object') {
|
|
71
|
+
let result = 'default';
|
|
72
|
+
let ar = [];
|
|
73
|
+
|
|
74
|
+
for (let key in this.gridTemplateColumns) {
|
|
75
|
+
if (key !== 'default') {
|
|
76
|
+
ar.push(key >> 0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (ar.length) {
|
|
81
|
+
ar = ar.sort((a, b) => a - b);
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < ar.length; i++) {
|
|
84
|
+
if (this.windowWidth < ar[i]) {
|
|
85
|
+
result = ar[i] + '';
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return this.gridTemplateColumns[result];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return this.gridTemplateColumns;
|
|
95
|
+
},
|
|
96
|
+
computedGap() {
|
|
97
|
+
if (typeof this.gap == 'object') {
|
|
98
|
+
let result = 'default';
|
|
99
|
+
let ar = [];
|
|
100
|
+
|
|
101
|
+
for (let key in this.gap) {
|
|
102
|
+
if (key !== 'default') {
|
|
103
|
+
ar.push(key >> 0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (ar.length) {
|
|
108
|
+
ar = ar.sort((a, b) => a - b);
|
|
109
|
+
|
|
110
|
+
for (let i = 0; i < ar.length; i++) {
|
|
111
|
+
if (this.windowWidth < ar[i]) {
|
|
112
|
+
result = ar[i] + '';
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return this.gap[result];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return this.gap;
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// Methods
|
|
126
|
+
methods: {
|
|
127
|
+
handleResize() {
|
|
128
|
+
clearTimeout(this.timeout);
|
|
129
|
+
this.timeout = setTimeout(this.onResize.bind(this), 250);
|
|
130
|
+
},
|
|
131
|
+
onResize() {
|
|
132
|
+
this.windowWidth = window.innerWidth;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// Hooks
|
|
137
|
+
mounted() {
|
|
138
|
+
this.$nextTick(() => {
|
|
139
|
+
this.handleResize();
|
|
140
|
+
|
|
141
|
+
window.addEventListener('resize', this.handleResize);
|
|
142
|
+
window.addEventListener('orientationchange', this.handleResize);
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
beforeDestroy() {
|
|
147
|
+
window.removeEventListener('resize', this.handleResize);
|
|
148
|
+
window.removeEventListener('orientationchange', this.handleResize);
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<style lang="less">
|
|
154
|
+
.component-ui-grid {
|
|
155
|
+
display: grid;
|
|
156
|
+
|
|
157
|
+
&.tag-text-center {
|
|
158
|
+
text-align: center;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.tag-text-left {
|
|
162
|
+
text-align: left;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&.tag-text-right {
|
|
166
|
+
text-align: right;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
namespace props {
|
|
3
|
+
namespace textAlign {
|
|
4
|
+
export let type: StringConstructor;
|
|
5
|
+
let _default: string;
|
|
6
|
+
export { _default as default };
|
|
7
|
+
}
|
|
8
|
+
namespace gap {
|
|
9
|
+
let type_1: (StringConstructor | ObjectConstructor)[];
|
|
10
|
+
export { type_1 as type };
|
|
11
|
+
let _default_1: string;
|
|
12
|
+
export { _default_1 as default };
|
|
13
|
+
}
|
|
14
|
+
namespace gridTemplateColumns {
|
|
15
|
+
let type_2: (StringConstructor | ObjectConstructor)[];
|
|
16
|
+
export { type_2 as type };
|
|
17
|
+
let _default_2: string;
|
|
18
|
+
export { _default_2 as default };
|
|
19
|
+
}
|
|
20
|
+
namespace gapTop {
|
|
21
|
+
let type_3: (StringConstructor | BooleanConstructor)[];
|
|
22
|
+
export { type_3 as type };
|
|
23
|
+
let _default_3: boolean;
|
|
24
|
+
export { _default_3 as default };
|
|
25
|
+
}
|
|
26
|
+
namespace gapBottom {
|
|
27
|
+
let type_4: (StringConstructor | BooleanConstructor)[];
|
|
28
|
+
export { type_4 as type };
|
|
29
|
+
let _default_4: boolean;
|
|
30
|
+
export { _default_4 as default };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function data(): {
|
|
34
|
+
timeout: null;
|
|
35
|
+
windowWidth: number;
|
|
36
|
+
};
|
|
37
|
+
namespace computed {
|
|
38
|
+
function getClasses(): string[];
|
|
39
|
+
function getStyle(): {
|
|
40
|
+
'grid-gap': () => any;
|
|
41
|
+
'grid-template-columns': () => any;
|
|
42
|
+
'padding-top': any;
|
|
43
|
+
'padding-bottom': any;
|
|
44
|
+
};
|
|
45
|
+
function computedItemMaxWidth(): number;
|
|
46
|
+
function computedGridTemplateColumns(): any;
|
|
47
|
+
function computedGap(): any;
|
|
48
|
+
}
|
|
49
|
+
namespace methods {
|
|
50
|
+
function handleResize(): void;
|
|
51
|
+
function onResize(): void;
|
|
52
|
+
}
|
|
53
|
+
function mounted(): void;
|
|
54
|
+
function beforeDestroy(): void;
|
|
55
|
+
}
|
|
56
|
+
export default _default;
|
|
File without changes
|