Skip to content

Commit

Permalink
fix(comp:config): the weekStartsOn does not work in the enUS locale
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Jun 3, 2023
1 parent c3721a5 commit d729672
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit d729672

Please sign in to comment.