oxy-uni-ui 1.2.3 → 2.0.0
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/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +353 -328
- package/components/common/util.ts +185 -32
- package/components/composables/index.ts +1 -0
- package/components/composables/usePopover.ts +24 -20
- package/components/composables/useVirtualScroll.ts +10 -9
- package/components/composables/useWindowResize.ts +35 -0
- package/components/oxy-action-sheet/index.scss +24 -11
- package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
- package/components/oxy-action-sheet/types.ts +7 -0
- package/components/oxy-backtop/index.scss +3 -3
- package/components/oxy-backtop/oxy-backtop.vue +9 -6
- package/components/oxy-backtop/types.ts +7 -7
- package/components/oxy-badge/index.scss +4 -4
- package/components/oxy-badge/oxy-badge.vue +3 -3
- package/components/oxy-badge/types.ts +2 -2
- package/components/oxy-button/index.scss +5 -5
- package/components/oxy-button/oxy-button.vue +5 -1
- package/components/oxy-calendar/index.scss +11 -11
- package/components/oxy-calendar/oxy-calendar.vue +1 -0
- package/components/oxy-calendar/types.ts +5 -0
- package/components/oxy-calendar-view/month/index.scss +4 -4
- package/components/oxy-calendar-view/month/types.ts +36 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
- package/components/oxy-calendar-view/year/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
- package/components/oxy-card/index.scss +2 -2
- package/components/oxy-cell/index.scss +8 -8
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox-group/index.scss +2 -2
- package/components/oxy-circle/oxy-circle.vue +10 -7
- package/components/oxy-circle/types.ts +5 -5
- package/components/oxy-col/oxy-col.vue +2 -2
- package/components/oxy-col-picker/index.scss +4 -4
- package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
- package/components/oxy-col-picker/types.ts +7 -2
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
- package/components/oxy-corner/index.scss +32 -32
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-curtain/index.scss +15 -15
- package/components/oxy-curtain/oxy-curtain.vue +4 -2
- package/components/oxy-curtain/types.ts +6 -1
- package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
- package/components/oxy-date-strip/types.ts +1 -1
- package/components/oxy-date-strip-item/index.scss +3 -3
- package/components/oxy-datetime-picker/index.scss +11 -11
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
- package/components/oxy-datetime-picker/types.ts +5 -0
- package/components/oxy-drop-menu/index.scss +3 -3
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
- package/components/oxy-drop-menu-item/types.ts +5 -0
- package/components/oxy-echarts/types.ts +6 -0
- package/components/oxy-fab/index.scss +8 -8
- package/components/oxy-fab/oxy-fab.vue +22 -3
- package/components/oxy-file-list/index.scss +24 -23
- package/components/oxy-file-list/oxy-file-list.vue +2 -2
- package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
- package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
- package/components/oxy-footer/index.scss +19 -0
- package/components/oxy-footer/oxy-footer.vue +78 -0
- package/components/oxy-footer/types.ts +17 -0
- package/components/oxy-form-item/types.ts +22 -1
- package/components/oxy-gap/oxy-gap.vue +2 -2
- package/components/oxy-gap/types.ts +2 -2
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid/types.ts +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
- package/components/oxy-grid-item/types.ts +1 -1
- package/components/oxy-guidance/index.scss +75 -0
- package/components/oxy-guidance/oxy-guidance.vue +201 -0
- package/components/oxy-guidance/types.ts +33 -0
- package/components/oxy-icon/oxy-icon.vue +2 -2
- package/components/oxy-icon/types.ts +1 -1
- package/components/oxy-img/oxy-img.vue +4 -4
- package/components/oxy-img/types.ts +3 -3
- package/components/oxy-img-cropper/index.scss +12 -12
- package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
- package/components/oxy-img-cropper/types.ts +2 -2
- package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
- package/components/oxy-img-lazy/types.ts +3 -3
- package/components/oxy-index-anchor/index.scss +2 -2
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
- package/components/oxy-index-bar/index.scss +3 -3
- package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
- package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
- package/components/oxy-input/index.scss +1 -1
- package/components/oxy-input-number/index.scss +5 -5
- package/components/oxy-input-number/oxy-input-number.vue +2 -2
- package/components/oxy-input-number/types.ts +3 -2
- package/components/oxy-keyboard/index.scss +5 -5
- package/components/oxy-keyboard/key/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -2
- package/components/oxy-keyboard/key/types.ts +15 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
- package/components/oxy-keyboard/types.ts +5 -0
- package/components/oxy-link/index.scss +2 -2
- package/components/oxy-list/oxy-list.vue +4 -3
- package/components/oxy-loading/oxy-loading.vue +8 -4
- package/components/oxy-loading/types.ts +1 -1
- package/components/oxy-loadmore/index.scss +3 -3
- package/components/oxy-long-press-menu/index.scss +93 -0
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
- package/components/oxy-long-press-menu/types.ts +34 -0
- package/components/oxy-message-box/index.scss +12 -11
- package/components/oxy-message-box/oxy-message-box.vue +11 -3
- package/components/oxy-message-box/types.ts +14 -0
- package/components/oxy-navbar/index.scss +2 -2
- package/components/oxy-navbar/oxy-navbar.vue +58 -13
- package/components/oxy-navbar/types.ts +8 -1
- package/components/oxy-navbar-capsule/types.ts +3 -0
- package/components/oxy-notice-bar/index.scss +3 -3
- package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
- package/components/oxy-notice-bar/types.ts +3 -3
- package/components/oxy-notify/index.ts +1 -0
- package/components/oxy-notify/oxy-notify.vue +3 -2
- package/components/oxy-notify/types.ts +7 -0
- package/components/oxy-pagination/index.scss +1 -1
- package/components/oxy-password-input/oxy-password-input.vue +2 -2
- package/components/oxy-password-input/types.ts +1 -1
- package/components/oxy-picker/index.scss +45 -2
- package/components/oxy-picker/oxy-picker.vue +100 -14
- package/components/oxy-picker/types.ts +29 -1
- package/components/oxy-picker-view/index.scss +3 -3
- package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
- package/components/oxy-popover/index.scss +9 -9
- package/components/oxy-popup/index.scss +2 -2
- package/components/oxy-popup/oxy-popup.vue +35 -2
- package/components/oxy-popup/types.ts +8 -1
- package/components/oxy-progress/index.scss +3 -3
- package/components/oxy-qrcode/draw.ts +398 -0
- package/components/oxy-qrcode/index.scss +2 -0
- package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
- package/components/oxy-qrcode/qrcode.ts +936 -0
- package/components/oxy-qrcode/types.ts +42 -0
- package/components/oxy-radio/index.scss +10 -10
- package/components/oxy-radio-group/index.scss +2 -2
- package/components/oxy-rate/types.ts +4 -4
- package/components/oxy-resize/index.scss +2 -2
- package/components/oxy-resize/oxy-resize.vue +4 -4
- package/components/oxy-resize/types.ts +3 -0
- package/components/oxy-rich-text/index.scss +30 -29
- package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
- package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
- package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
- package/components/oxy-rich-text/types.ts +6 -1
- package/components/oxy-row/oxy-row.vue +3 -3
- package/components/oxy-row/types.ts +1 -1
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-segmented/index.scss +16 -16
- package/components/oxy-segmented/oxy-segmented.vue +23 -3
- package/components/oxy-select/index.scss +144 -68
- package/components/oxy-select/oxy-select.vue +85 -50
- package/components/oxy-select/types.ts +13 -1
- package/components/oxy-select-picker/index.scss +7 -7
- package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
- package/components/oxy-select-picker/types.ts +2 -0
- package/components/oxy-sidebar-item/index.scss +1 -1
- package/components/oxy-signature/oxy-signature.vue +18 -10
- package/components/oxy-signature/types.ts +106 -13
- package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
- package/components/oxy-skeleton/types.ts +1 -1
- package/components/oxy-slider/index.scss +3 -3
- package/components/oxy-sort-button/index.scss +8 -8
- package/components/oxy-status-tip/index.scss +4 -4
- package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
- package/components/oxy-status-tip/types.ts +3 -3
- package/components/oxy-step/index.scss +14 -14
- package/components/oxy-sticky/oxy-sticky.vue +6 -6
- package/components/oxy-stream-render/types.ts +4 -1
- package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
- package/components/oxy-swiper/oxy-swiper.vue +6 -6
- package/components/oxy-swiper/types.ts +5 -5
- package/components/oxy-switch/index.scss +8 -8
- package/components/oxy-switch/oxy-switch.vue +2 -2
- package/components/oxy-switch/types.ts +1 -1
- package/components/oxy-tab/index.scss +11 -1
- package/components/oxy-tabbar/index.scss +1 -1
- package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
- package/components/oxy-table/index.scss +5 -5
- package/components/oxy-table/oxy-table.vue +8 -6
- package/components/oxy-table/types.ts +2 -2
- package/components/oxy-table-col/oxy-table-col.vue +3 -3
- package/components/oxy-table-col/types.ts +2 -2
- package/components/oxy-tabs/index.scss +43 -15
- package/components/oxy-tabs/oxy-tabs.vue +53 -19
- package/components/oxy-tabs/types.ts +15 -3
- package/components/oxy-tag/index.scss +15 -15
- package/components/oxy-text/index.scss +5 -1
- package/components/oxy-text/oxy-text.vue +76 -7
- package/components/oxy-text/types.ts +12 -0
- package/components/oxy-textarea/index.scss +6 -6
- package/components/oxy-toast/oxy-toast.vue +24 -8
- package/components/oxy-tooltip/index.scss +9 -9
- package/components/oxy-tree/index.scss +51 -15
- package/components/oxy-tree/oxy-tree.vue +13 -9
- package/components/oxy-tree/types.ts +12 -9
- package/components/oxy-upload/index.scss +21 -21
- package/components/oxy-upload/types.ts +2 -2
- package/components/oxy-verification-code/index.scss +6 -0
- package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
- package/components/oxy-verification-code/types.ts +82 -0
- package/components/oxy-video-preview/index.scss +4 -4
- package/components/oxy-virtual-scroll/index.scss +4 -4
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
- package/components/oxy-virtual-scroll/types.ts +14 -14
- package/components/oxy-voice-player/index.scss +908 -0
- package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
- package/components/oxy-voice-player/types.ts +567 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
- package/components/oxy-waterfall/types.ts +6 -6
- package/components/oxy-watermark/oxy-watermark.vue +35 -13
- package/components/oxy-watermark/types.ts +14 -14
- package/global.d.ts +2 -0
- package/locale/lang/ar-SA.ts +3 -0
- package/locale/lang/en-US.ts +3 -0
- package/locale/lang/zh-CN.ts +3 -0
- package/package.json +97 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/oxy-number-keyboard/index.scss +0 -78
- package/components/oxy-number-keyboard/key/index.scss +0 -81
- package/components/oxy-number-keyboard/key/index.vue +0 -78
- package/components/oxy-number-keyboard/key/types.ts +0 -11
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
- package/components/oxy-number-keyboard/types.ts +0 -83
- package/components/oxy-tree/components/tree-node-content.vue +0 -72
- package/components/oxy-tree/index.ts +0 -51
- package/oxy-uni-ui.zip +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<view class="oxy-rich-text" :style="customStyle" :class="{ editable }">
|
|
3
3
|
<view v-if="editable" class="editor_toolbox">
|
|
4
4
|
<template v-for="(button, index) in toolButtons" :key="index">
|
|
5
|
-
<image width="
|
|
5
|
+
<image width="32rpx" height="32rpx" v-if="button.icon" :src="button.icon" alt="" @click="button.tap()" />
|
|
6
6
|
<oxy-icon v-else size="18" :name="button.name" :class="button.class" @click="button.tap()" />
|
|
7
7
|
</template>
|
|
8
8
|
</view>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
></mp-html>
|
|
21
21
|
</view>
|
|
22
22
|
|
|
23
|
-
<oxy-popup v-model="dialog" position="bottom" closable @close="dialog = false">
|
|
23
|
+
<oxy-popup v-model="dialog" position="bottom" :max-width="popupMaxWidth" closable @close="dialog = false">
|
|
24
24
|
<view class="oxy-rich-text__popup">
|
|
25
25
|
<view class="dialog-title">{{ translate('insert' + (dialogType === 'emoji' ? 'Emoji' : 'Template')) }}</view>
|
|
26
26
|
<template v-if="dialogType === 'emoji'">
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</template>
|
|
41
41
|
</view>
|
|
42
42
|
</oxy-popup>
|
|
43
|
-
<oxy-popup v-model="linkDialog" position="bottom" closable @close="linkDialog = false">
|
|
43
|
+
<oxy-popup v-model="linkDialog" position="bottom" :max-width="popupMaxWidth" closable @close="linkDialog = false">
|
|
44
44
|
<view class="oxy-rich-text__popup">
|
|
45
45
|
<view class="dialog-title">{{ translate('insertLink') }}</view>
|
|
46
46
|
<view class="oxy-rich-text__link-input">
|
|
@@ -110,9 +110,9 @@ const emit = defineEmits<{
|
|
|
110
110
|
}>()
|
|
111
111
|
const { translate } = useTranslate('richText')
|
|
112
112
|
const templates = [
|
|
113
|
-
'<section style="text-align: center; margin:
|
|
114
|
-
'<div style="width: 100%; box-sizing: border-box; border-radius:
|
|
115
|
-
'<div style="border: 1px solid gray; box-shadow:
|
|
113
|
+
'<section style="text-align: center; margin: 0 auto;"><section style="border-radius: 8rpx; border: 1px solid #757576; display: inline-block; padding: 10rpx 40rpx;"><span style="font-size: 36rpx; color: #595959;">标题</span></section></section>',
|
|
114
|
+
'<div style="width: 100%; box-sizing: border-box; border-radius: 10rpx; background-color: #f6f6f6; padding: 20rpx; margin: 20rpx 0"><div>卡片</div><div style="font-size: 24rpx; color: gray">正文</div></div>',
|
|
115
|
+
'<div style="border: 1px solid gray; box-shadow: 6rpx 6rpx 0 #cfcfce; padding: 20rpx; margin: 20rpx 0">段落</div>'
|
|
116
116
|
]
|
|
117
117
|
const emojis = [
|
|
118
118
|
['😄', '😷', '😂', '😝', '😳', '😱', '😔', '😒', '😉'],
|
|
@@ -143,61 +143,61 @@ const actions = ref([
|
|
|
143
143
|
|
|
144
144
|
const customTagStyle = {
|
|
145
145
|
p: `
|
|
146
|
-
font-size:
|
|
146
|
+
font-size: 32rpx;
|
|
147
147
|
color: var(--oxy-rich-text-primary-color, #262626);
|
|
148
148
|
`,
|
|
149
149
|
h1: `
|
|
150
|
-
margin:
|
|
151
|
-
font-size:
|
|
150
|
+
margin: 36rpx 0 20rpx 0;
|
|
151
|
+
font-size: 48rpx;
|
|
152
152
|
font-weight: 700;
|
|
153
153
|
color: var(--oxy-rich-text-title-color, #000);
|
|
154
154
|
`,
|
|
155
155
|
h2: `
|
|
156
|
-
margin:
|
|
157
|
-
font-size:
|
|
156
|
+
margin: 28rpx 0 20rpx 0;
|
|
157
|
+
font-size: 40rpx;
|
|
158
158
|
font-weight: 600;
|
|
159
159
|
color: var(--oxy-rich-text-title-color, #000);
|
|
160
160
|
`,
|
|
161
161
|
h3: `
|
|
162
|
-
margin:
|
|
163
|
-
font-size:
|
|
162
|
+
margin: 24rpx 0 16rpx 0;
|
|
163
|
+
font-size: 36rpx;
|
|
164
164
|
font-weight: 600;
|
|
165
165
|
color: var(--oxy-rich-text-title-color, #000);
|
|
166
166
|
`,
|
|
167
167
|
h4: `
|
|
168
|
-
margin:
|
|
169
|
-
font-size:
|
|
168
|
+
margin: 24rpx 0 16rpx 0;
|
|
169
|
+
font-size: 32rpx;
|
|
170
170
|
font-weight: 600;
|
|
171
171
|
color: var(--oxy-rich-text-title-color, #000);
|
|
172
172
|
`,
|
|
173
173
|
h5: `
|
|
174
|
-
margin:
|
|
175
|
-
font-size:
|
|
174
|
+
margin: 20rpx 0 16rpx 0;
|
|
175
|
+
font-size: 30rpx;
|
|
176
176
|
font-weight: 600;
|
|
177
177
|
color: var(--oxy-rich-text-title-color, #000);
|
|
178
178
|
`,
|
|
179
179
|
h6: `
|
|
180
|
-
margin:
|
|
181
|
-
font-size:
|
|
180
|
+
margin: 16rpx 0;
|
|
181
|
+
font-size: 28rpx;
|
|
182
182
|
color: var(--oxy-rich-text-title-color, #000);
|
|
183
183
|
`,
|
|
184
184
|
blockquote: `
|
|
185
|
-
margin:
|
|
186
|
-
padding:
|
|
185
|
+
margin: 28rpx 0;
|
|
186
|
+
padding: 20rpx 24rpx;
|
|
187
187
|
color: var(--oxy-rich-text-blockquote-color, #555);
|
|
188
188
|
background: var(--oxy-rich-text-blockquote-bg, #f7f8fa);
|
|
189
|
-
border-left:
|
|
189
|
+
border-left: 8rpx solid var(--oxy-rich-text-blockquote-border-color, #007AFF);
|
|
190
190
|
`,
|
|
191
191
|
'blockquote>p': `
|
|
192
192
|
margin-block-start: 0;
|
|
193
193
|
margin-block-end: 0;
|
|
194
194
|
`,
|
|
195
195
|
ul: `
|
|
196
|
-
margin: 0 0
|
|
196
|
+
margin: 0 0 20rpx 0;
|
|
197
197
|
color: var(--oxy-rich-text-list-color, #444);
|
|
198
198
|
`,
|
|
199
199
|
li: `
|
|
200
|
-
margin:
|
|
200
|
+
margin: 12rpx 0;
|
|
201
201
|
line-height: 1.65;
|
|
202
202
|
color: var(--oxy-rich-text-list-color, #444);
|
|
203
203
|
`,
|
|
@@ -218,35 +218,35 @@ const customTagStyle = {
|
|
|
218
218
|
padding: 0;
|
|
219
219
|
border: none;
|
|
220
220
|
background: var(--oxy-rich-text-hr-color, #e5e6eb);
|
|
221
|
-
margin:
|
|
221
|
+
margin: 36rpx 0;
|
|
222
222
|
`,
|
|
223
223
|
table: `
|
|
224
224
|
border-spacing: 0;
|
|
225
225
|
overflow: auto;
|
|
226
226
|
min-width: 100%;
|
|
227
|
-
margin:
|
|
227
|
+
margin: 24rpx 0;
|
|
228
228
|
border-collapse: collapse;
|
|
229
229
|
`,
|
|
230
230
|
th: `
|
|
231
231
|
border: 1px solid var(--oxy-rich-text-table-border-color, #e5e6eb);
|
|
232
232
|
background: var(--oxy-rich-text-table-head-bg, #f7f8fa);
|
|
233
233
|
color: var(--oxy-rich-text-table-head-color, #333);
|
|
234
|
-
padding:
|
|
234
|
+
padding: 16rpx 24rpx;
|
|
235
235
|
font-weight: 600;
|
|
236
236
|
`,
|
|
237
237
|
td: `
|
|
238
238
|
border: 1px solid var(--oxy-rich-text-table-border-color, #e5e6eb);
|
|
239
239
|
color: var(--oxy-rich-text-table-text-color, #444);
|
|
240
|
-
padding:
|
|
240
|
+
padding: 16rpx 24rpx;
|
|
241
241
|
`,
|
|
242
242
|
pre: `
|
|
243
|
-
border-radius:
|
|
243
|
+
border-radius: 12rpx;
|
|
244
244
|
white-space: pre;
|
|
245
245
|
background: var(--oxy-rich-text-code-bg, #2d2d2d);
|
|
246
246
|
color: var(--oxy-rich-text-code-color, #f8f8f2);
|
|
247
|
-
font-size:
|
|
247
|
+
font-size: 26rpx;
|
|
248
248
|
line-height: 1.65;
|
|
249
|
-
padding:
|
|
249
|
+
padding: 24rpx;
|
|
250
250
|
overflow: auto;
|
|
251
251
|
position: relative;
|
|
252
252
|
`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
2
|
-
import { baseProps } from '../common/props'
|
|
2
|
+
import { baseProps, makeStringProp } from '../common/props'
|
|
3
3
|
|
|
4
4
|
export const richTextProps = {
|
|
5
5
|
...baseProps,
|
|
@@ -15,6 +15,11 @@ export const richTextProps = {
|
|
|
15
15
|
type: Boolean,
|
|
16
16
|
default: false
|
|
17
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* 弹层最大宽度,支持 `rpx`、`px`、`%` 等单位;
|
|
20
|
+
* `%` 在弹层打开时按屏幕宽度换算为 `rpx`
|
|
21
|
+
*/
|
|
22
|
+
popupMaxWidth: makeStringProp('1200rpx'),
|
|
18
23
|
uploadMethod: {
|
|
19
24
|
type: Function as any,
|
|
20
25
|
default: null
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
import { computed, type CSSProperties } from 'vue'
|
|
19
19
|
import { useChildren } from '../composables/useChildren'
|
|
20
20
|
import { ROW_KEY, rowProps } from './types'
|
|
21
|
-
import {
|
|
21
|
+
import { withDefaultUnit, objToStyle } from '../common/util'
|
|
22
22
|
|
|
23
23
|
const props = defineProps(rowProps)
|
|
24
24
|
const { linkChildren } = useChildren(ROW_KEY)
|
|
@@ -31,8 +31,8 @@ const rowStyle = computed(() => {
|
|
|
31
31
|
if (gutter < 0) {
|
|
32
32
|
console.error('[Oxy ui] warning(oxy-row): attribute gutter must be greater than or equal to 0')
|
|
33
33
|
} else if (gutter) {
|
|
34
|
-
style.marginLeft =
|
|
35
|
-
style.marginRight =
|
|
34
|
+
style.marginLeft = withDefaultUnit(gutter / 2)
|
|
35
|
+
style.marginRight = withDefaultUnit(gutter / 2)
|
|
36
36
|
}
|
|
37
37
|
return `${objToStyle(style)}${props.customStyle}`
|
|
38
38
|
})
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
align-items: center;
|
|
98
98
|
}
|
|
99
99
|
@include edeep(search-icon) {
|
|
100
|
-
margin-right:
|
|
100
|
+
margin-right: 16rpx;
|
|
101
101
|
color: $-search-icon-color;
|
|
102
102
|
font-size: $-search-icon-size;
|
|
103
103
|
}
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
position: absolute;
|
|
106
106
|
font-size: $-search-icon-size;
|
|
107
107
|
top: 50%;
|
|
108
|
-
left:
|
|
108
|
+
left: 32rpx;
|
|
109
109
|
transform: translateY(-50%);
|
|
110
110
|
color: $-search-icon-color;
|
|
111
111
|
}
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
@include edeep(clear) {
|
|
117
117
|
position: absolute;
|
|
118
118
|
right: 0;
|
|
119
|
-
padding:
|
|
119
|
+
padding: 12rpx 18rpx 12rpx 14rpx;
|
|
120
120
|
color: $-search-cancel-color;
|
|
121
121
|
}
|
|
122
122
|
@include edeep(clear-icon) {
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
width: 100%;
|
|
41
41
|
background-color: $-segmented-item-bg-color;
|
|
42
42
|
padding: $-segmented-padding;
|
|
43
|
-
border-radius:
|
|
43
|
+
border-radius: 8rpx;
|
|
44
44
|
box-sizing: border-box;
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
@include e(item) {
|
|
48
48
|
position: relative;
|
|
49
49
|
text-align: center;
|
|
50
|
-
border-radius:
|
|
50
|
+
border-radius: 8rpx;
|
|
51
51
|
flex: 1;
|
|
52
52
|
min-width: 0;
|
|
53
53
|
z-index: 1;
|
|
54
|
-
min-height:
|
|
55
|
-
line-height:
|
|
56
|
-
padding: 0
|
|
57
|
-
font-size:
|
|
54
|
+
min-height: 56rpx;
|
|
55
|
+
line-height: 56rpx;
|
|
56
|
+
padding: 0 24rpx;
|
|
57
|
+
font-size: 28rpx;
|
|
58
58
|
color: $-segmented-item-color;
|
|
59
59
|
font-weight: 400;
|
|
60
60
|
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
@include when(large) {
|
|
66
|
-
min-height:
|
|
67
|
-
line-height:
|
|
68
|
-
padding: 0
|
|
69
|
-
font-size:
|
|
66
|
+
min-height: 64rpx;
|
|
67
|
+
line-height: 64rpx;
|
|
68
|
+
padding: 0 24rpx;
|
|
69
|
+
font-size: 32rpx;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
@include when(small) {
|
|
74
|
-
min-height:
|
|
75
|
-
line-height:
|
|
76
|
-
padding: 0
|
|
77
|
-
font-size:
|
|
74
|
+
min-height: 48rpx;
|
|
75
|
+
line-height: 48rpx;
|
|
76
|
+
padding: 0 14rpx;
|
|
77
|
+
font-size: 24rpx;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
@include when(disabled) {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
|
|
85
85
|
@include m(active) {
|
|
86
86
|
background-color: $-segmented-item-acitve-bg;
|
|
87
|
-
border-radius:
|
|
87
|
+
border-radius: 8rpx;
|
|
88
88
|
height: calc(100% - $-segmented-padding * 2);
|
|
89
89
|
@include when(disabled) {
|
|
90
90
|
opacity: 0.8;
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
text-overflow: ellipsis;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
}
|
|
101
|
+
}
|
|
@@ -32,9 +32,10 @@ export default {
|
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
34
|
import { computed, getCurrentInstance, onMounted, reactive, watch } from 'vue'
|
|
35
|
-
import { getRect, isObj, objToStyle,
|
|
35
|
+
import { getRect, isObj, objToStyle, pause, isEqual, unitConvert } from '../common/util'
|
|
36
36
|
import type { CSSProperties } from 'vue'
|
|
37
37
|
import { segmentedProps, type SegmentedExpose, type SegmentedOption } from './types'
|
|
38
|
+
import { useWindowResize } from '../composables/useWindowResize'
|
|
38
39
|
const $item = '.oxy-segmented__item'
|
|
39
40
|
|
|
40
41
|
const props = defineProps(segmentedProps)
|
|
@@ -63,7 +64,24 @@ watch(
|
|
|
63
64
|
}
|
|
64
65
|
)
|
|
65
66
|
|
|
67
|
+
watch(
|
|
68
|
+
() => props.options,
|
|
69
|
+
async () => {
|
|
70
|
+
updateCurrentIndex()
|
|
71
|
+
await pause()
|
|
72
|
+
updateActiveStyle(false)
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
deep: true
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
|
|
66
79
|
const { proxy } = getCurrentInstance() as any
|
|
80
|
+
const handleWindowResize = async () => {
|
|
81
|
+
await pause()
|
|
82
|
+
updateActiveStyle(false)
|
|
83
|
+
}
|
|
84
|
+
useWindowResize(handleWindowResize)
|
|
67
85
|
|
|
68
86
|
onMounted(async () => {
|
|
69
87
|
updateCurrentIndex()
|
|
@@ -77,15 +95,17 @@ onMounted(async () => {
|
|
|
77
95
|
*/
|
|
78
96
|
function updateActiveStyle(animation: boolean = true) {
|
|
79
97
|
getRect($item, true, proxy).then((rects) => {
|
|
98
|
+
if (!Array.isArray(rects) || rects.length === 0 || !rects[state.activeIndex]) return
|
|
80
99
|
const rect = rects[state.activeIndex]
|
|
81
100
|
const style: CSSProperties = {
|
|
82
101
|
position: 'absolute',
|
|
83
|
-
|
|
102
|
+
// getRect 返回的是真实像素值,需按 px 输出避免宽屏下激活块尺寸偏大
|
|
103
|
+
width: unitConvert(rect.width, 0, { output: 'px' }),
|
|
84
104
|
'z-index': 0
|
|
85
105
|
}
|
|
86
106
|
const left = rects.slice(0, state.activeIndex).reduce((prev, curr) => prev + Number(curr.width), 0)
|
|
87
107
|
if (left) {
|
|
88
|
-
style.transform = `translateX(${left}
|
|
108
|
+
style.transform = `translateX(${unitConvert(left, 0, { output: 'px' })})`
|
|
89
109
|
}
|
|
90
110
|
if (animation) {
|
|
91
111
|
style.transition = 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)'
|