Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/renderless/src/picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
*/

import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone, paeseIso8601 } from '@opentiny/utils'
import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone, parseIso8601 } from '@opentiny/utils'
import { isNumber, isDate } from '@opentiny/utils'
import { userPopper } from '@opentiny/vue-hooks'
import { DATEPICKER } from '@opentiny/utils'
Expand Down Expand Up @@ -177,7 +177,7 @@ const ignoreTimezone = (value) => {

const ignoreTimezoneFn = (value) => {
let date = value
const iso8601 = paeseIso8601(value)
const iso8601 = parseIso8601(value)
if (iso8601) {
const { year, month, day, hours, minutes, seconds } = iso8601
date = new Date(year, month, day, hours, minutes, seconds)
Expand Down
10 changes: 9 additions & 1 deletion packages/renderless/src/tabs-mf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ export const clickMore = (api) => (name) => {
}

export const removeItem =
({ props, state, emit }) =>
({ props, state, emit, api }) =>
(name, silent = false) => {
const itemIndex = state.items.findIndex((item) => item.name === name)
const navIndex = state.navs.findIndex((item) => item.name === name)
const isCurrent = state.currentItem && state.currentItem.name === name
const nextNav = state.navs[navIndex - 1] || state.navs[navIndex + 1]

if (!~itemIndex) return

Expand All @@ -148,6 +150,12 @@ export const removeItem =
state.navs.splice(navIndex, 1)
state.navs = [...state.navs]

if (isCurrent) {
const nextName = nextNav ? nextNav.name : state.items[0]?.name || ''
api.changeCurrentName(nextName)
state.currentItem = state.items.find((item) => item.name === nextName) || null
}

if (!silent) {
// Emits the close event
emit('edit', name, 'remove')
Expand Down
2 changes: 1 addition & 1 deletion packages/renderless/src/tabs-mf/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const renderless = (props, hooks, { vm, emit, nextTick }) => {
addItem: addItem(state),
addNav: addNav(state),
scrollTo: scrollTo({ vm, state }),
removeItem: removeItem({ props, state, emit }),
removeItem: removeItem({ props, state, emit, api }),
changeCurrentName: changeCurrentName({ state, emit }),
clickMore: clickMore(api),
beforeCarouselSwipe: beforeCarouselSwipe({ api, state, vm }),
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/date/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const timezone2 = '-00:00,+00:00,+01:00,+02:00,+03:00,+03:30,+04:00,+04:30,+05:0
const timezone3 = '+06:30,+07:00,+08:00,+09:00,+10:00,+10:30,+11:00,+11:30,+12:00,+12:45,+13:00,+14:00'
const timezones: string[] = [...timezone1.split(','), ...timezone2.split(','), ...timezone3.split(',')]

export const paeseIso8601 = (str: string) => {
export const parseIso8601 = (str: string) => {
const m = iso8601Reg.exec(str)
if (m && m.length === 25) {
const year = Number(m[1])
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export {
getWeekOfFirstDay,
getLocalTimezone,
getStrTimezone,
paeseIso8601
parseIso8601
} from './date'

// 与 date.ts 合并一下, 有几个重名变量,待整理, 如果功能一致就合并
Expand Down
Loading