Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(comp:config): the weekStartsOn does not work in the enUS locale #1570

Merged
merged 1 commit into from
Jun 3, 2023
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
2 changes: 1 addition & 1 deletion packages/components/config/src/dateConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function createDefaultDateConfig(): DateConfig<number | Date, Date> {
const parse = (dateString: string, format: string) => parseDate(dateString, format, now(), { locale: locale.date })
return {
now,
weekStartsOn: () => locale.date.options?.weekStartsOn || 1,
weekStartsOn: () => locale.date.options?.weekStartsOn ?? 1,
get: (date, type) => {
switch (type) {
case 'year':
Expand Down
8 changes: 6 additions & 2 deletions packages/components/dropdown/demo/Basic.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<template>
<IxDropdown>
<a class="ix-dropdown-trigger">Hover me <IxIcon name="down"></IxIcon></a>
<IxDropdown v-model:visible="visible">
<a class="ix-dropdown-trigger">Hover me <IxIcon :name="visible ? 'up' : 'down'"></IxIcon></a>
<template #overlay>
<IxMenu :dataSource="dataSource" :selectable="false" @click="onClick"></IxMenu>
</template>
</IxDropdown>
</template>

<script setup lang="ts">
import { ref } from 'vue'

import { MenuClickOptions, MenuData } from '@idux/components/menu'

const visible = ref(false)

const dataSource: MenuData[] = [
{ type: 'item', key: 'one', label: 'One' },
{ type: 'item', key: 'two', label: 'Two' },
Expand Down
5 changes: 4 additions & 1 deletion packages/site/src/iduxInstall.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable import/order */
import type { App } from 'vue'

import { vClickOutside } from '@idux/cdk/click-outside'
import { createGlobalConfig } from '@idux/components/config'
import { IDUX_ICON_DEPENDENCIES, addIconDefinitions } from '@idux/components/icon'
import { vClickOutside } from '@idux/cdk/click-outside'

//import { enUS } from '@idux/components/locales'

// 静态加载: `IDUX_ICON_DEPENDENCIES` 是 `@idux` 的部分组件默认所使用到图标,建议在此时静态引入。
addIconDefinitions(IDUX_ICON_DEPENDENCIES)
Expand All @@ -14,6 +16,7 @@ const loadIconDynamically = (iconName: string) => {
}

const globalConfig = createGlobalConfig({
//locale: enUS,
icon: { loadIconDynamically },
})

Expand Down