@pisell/materials 1.0.1046 → 1.0.1048
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.js +7 -7
- package/es/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Url/index.d.ts +2 -2
- package/es/components/filter/components/FilterButton/index.js +1 -1
- package/es/components/pisellDataSourceContainer/components/Pagination/index.d.ts +2 -2
- package/es/components/pisellDataSourceContainer/components/Table/index.d.ts +2 -2
- package/es/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +9 -4
- package/es/components/pisellDateTimeDisplay/hooks/useCurrentTime.js +5 -1
- package/es/components/pisellDateTimeDisplay/utils/localeUtils.js +10 -4
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +2 -1
- package/es/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.js +5 -2
- package/es/components/radio/index.d.ts +2 -2
- package/es/components/section-footers/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Url/index.d.ts +2 -2
- package/lib/components/filter/components/FilterButton/index.js +1 -1
- package/lib/components/pisellDataSourceContainer/components/Pagination/index.d.ts +2 -2
- package/lib/components/pisellDataSourceContainer/components/Table/index.d.ts +2 -2
- package/lib/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +9 -4
- package/lib/components/pisellDateTimeDisplay/hooks/useCurrentTime.js +5 -1
- package/lib/components/pisellDateTimeDisplay/utils/localeUtils.js +10 -4
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +2 -1
- package/lib/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.js +5 -2
- package/lib/components/radio/index.d.ts +2 -2
- package/lib/components/section-footers/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd20 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import * as antd_es_input3 from "antd/es/input";
|
|
5
5
|
|
|
6
6
|
//#region src/components/dataSourceComponents/fields/Input.Password/index.d.ts
|
|
7
|
-
declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<
|
|
7
|
+
declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd20.InputRef> & WithModeProps & WithFormItemProps>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Password };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd18 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/dataSourceComponents/fields/Input.Url/index.d.ts
|
|
6
|
-
declare const Url: React.FC<
|
|
6
|
+
declare const Url: React.FC<antd18.InputProps & React.RefAttributes<antd18.InputRef> & WithModeProps & WithFormItemProps>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { Url };
|
|
@@ -62,7 +62,7 @@ const Filter = ({ value, hiddenQuickFilter, hiddenOtherFilter, onChange, quickFi
|
|
|
62
62
|
if (dateRangeOpen && !visible) return;
|
|
63
63
|
setOpen(visible);
|
|
64
64
|
},
|
|
65
|
-
placement
|
|
65
|
+
placement: placement !== null && placement !== void 0 ? placement : "bottom"
|
|
66
66
|
}, /* @__PURE__ */ React.createElement(Button, {
|
|
67
67
|
className: buttonClassName,
|
|
68
68
|
icon: /* @__PURE__ */ React.createElement(FilterLines, null),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataSourceContainerContextType } from "../../type.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd23 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/pisellDataSourceContainer/components/Pagination/index.d.ts
|
|
6
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd23.PaginationProps> & DataSourceContainerContextType & React.RefAttributes<unknown> & {
|
|
7
7
|
refId?: string | undefined;
|
|
8
8
|
}, "ref"> & React.RefAttributes<any>>;
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataSourceContainerContextType } from "../../type.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd24 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/pisellDataSourceContainer/components/Table/index.d.ts
|
|
6
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd24.TableProps<any>> & DataSourceContainerContextType & {
|
|
7
7
|
scopeId?: string | undefined;
|
|
8
8
|
__id?: string | undefined;
|
|
9
9
|
} & React.RefAttributes<unknown> & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
|
+
import useEngineContext_default from "../../hooks/useEngineContext.js";
|
|
2
3
|
import { getDayjsLocale, isChinese } from "./utils/localeUtils.js";
|
|
3
4
|
import { useCurrentTime } from "./hooks/useCurrentTime.js";
|
|
4
5
|
import { getRelativeDay, getRelativeDayLabel } from "./utils/relativeDay.js";
|
|
@@ -42,9 +43,13 @@ import "./PisellDateTimeDisplay.less";
|
|
|
42
43
|
* />
|
|
43
44
|
*/
|
|
44
45
|
const PisellDateTimeDisplay = (props) => {
|
|
45
|
-
var _ref, _presetSource$localeK;
|
|
46
|
+
var _context$engine, _ref, _presetSource$localeK;
|
|
46
47
|
const { value: valueProp, layout = "horizontal", textAlign = "center", fields, formatByLocale, timeFormat, dateFormat, weekdayFormat, customFormat, inlineSeparator = " · ", containerStyle, timeStyle, dateStyle, weekdayStyle, refreshInterval, disableAutoRefresh = false, locale, onTimeUpdate, onClick, className, style } = props;
|
|
47
|
-
const
|
|
48
|
+
const context = useEngineContext_default();
|
|
49
|
+
const resolvedLocale = locale || (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en";
|
|
50
|
+
console.log("resolvedLocale", resolvedLocale);
|
|
51
|
+
const localeKey = getDayjsLocale(resolvedLocale);
|
|
52
|
+
console.log("localeKey", localeKey);
|
|
48
53
|
const baseLocale = localeKey.split("-")[0];
|
|
49
54
|
const presetSource = formatByLocale !== null && formatByLocale !== void 0 ? formatByLocale : DATETIME_DISPLAY_FORMATS;
|
|
50
55
|
const preset = (_ref = (_presetSource$localeK = presetSource[localeKey]) !== null && _presetSource$localeK !== void 0 ? _presetSource$localeK : presetSource[baseLocale]) !== null && _ref !== void 0 ? _ref : {};
|
|
@@ -55,10 +60,10 @@ const PisellDateTimeDisplay = (props) => {
|
|
|
55
60
|
const currentTime = useCurrentTime({
|
|
56
61
|
refreshInterval: refreshInterval !== null && refreshInterval !== void 0 ? refreshInterval : getRefreshInterval(effectiveTimeFormat),
|
|
57
62
|
disabled: disableAutoRefresh || valueProp !== void 0,
|
|
58
|
-
locale,
|
|
63
|
+
locale: resolvedLocale,
|
|
59
64
|
onUpdate: onTimeUpdate
|
|
60
65
|
});
|
|
61
|
-
const displayTime = valueProp !== void 0 && valueProp !== null ? dayjs(valueProp) : currentTime;
|
|
66
|
+
const displayTime = valueProp !== void 0 && valueProp !== null ? dayjs(valueProp).locale(localeKey) : currentTime;
|
|
62
67
|
if (customFormat) {
|
|
63
68
|
const formattedTime = displayTime.format(customFormat);
|
|
64
69
|
const containerInlineStyle$1 = _objectSpread2({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import usePisellConfig_default from "../../pisell-config-provider/hooks/usePisellConfig.js";
|
|
2
|
+
import useEngineContext_default from "../../../hooks/useEngineContext.js";
|
|
2
3
|
import { getDayjsLocale } from "../utils/localeUtils.js";
|
|
3
4
|
import { useEffect, useState } from "react";
|
|
4
5
|
import dayjs from "dayjs";
|
|
@@ -24,10 +25,13 @@ import dayjs from "dayjs";
|
|
|
24
25
|
* @returns 当前时间(Dayjs 对象)
|
|
25
26
|
*/
|
|
26
27
|
function useCurrentTime(options) {
|
|
28
|
+
var _context$engine;
|
|
27
29
|
const { refreshInterval = 6e4, disabled = false, locale: userLocale, onUpdate } = options || {};
|
|
28
30
|
const globalConfig = usePisellConfig_default();
|
|
31
|
+
const context = useEngineContext_default();
|
|
29
32
|
const globalLocale = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.locale;
|
|
30
|
-
const
|
|
33
|
+
const engineLocale = context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale;
|
|
34
|
+
const dayjsLocale = getDayjsLocale(userLocale || globalLocale || engineLocale || "en");
|
|
31
35
|
const [currentTime, setCurrentTime] = useState(() => {
|
|
32
36
|
return dayjs().locale(dayjsLocale);
|
|
33
37
|
});
|
|
@@ -20,19 +20,25 @@ function normalizeLocale(locale) {
|
|
|
20
20
|
function isChinese(locale) {
|
|
21
21
|
return normalizeLocale(locale).startsWith("zh");
|
|
22
22
|
}
|
|
23
|
+
/** dayjs 常用 locale 与项目已加载的 locale 对齐(zh-cn、en),en-us 等统一用 en */
|
|
24
|
+
function toDayjsLoadedLocale(normalized) {
|
|
25
|
+
if (normalized.startsWith("en")) return "en";
|
|
26
|
+
return normalized;
|
|
27
|
+
}
|
|
23
28
|
/**
|
|
24
29
|
* 获取 dayjs 兼容的 locale 代码
|
|
25
|
-
* 未传 locale
|
|
30
|
+
* 未传 locale 时:优先 materials 当前语言(globalConfig / umi_locale),若为默认 en-US 则用 @pisell/utils getLocale
|
|
26
31
|
* @param locale 原始 locale 代码(可选)
|
|
27
|
-
* @returns dayjs 兼容的 locale
|
|
32
|
+
* @returns dayjs 兼容的 locale 代码(与已加载的 zh-cn、en 对齐)
|
|
28
33
|
* @example 'zh-CN' -> 'zh-cn', 'en-US' -> 'en'
|
|
29
34
|
*/
|
|
30
35
|
function getDayjsLocale(locale) {
|
|
31
36
|
if (!locale) {
|
|
37
|
+
const fromMaterials = getCurrentLocale();
|
|
32
38
|
const fromUtils = typeof locales.getLocale === "function" ? locales.getLocale() : void 0;
|
|
33
|
-
return normalizeLocale(typeof fromUtils === "string" && fromUtils ? fromUtils :
|
|
39
|
+
return toDayjsLoadedLocale(normalizeLocale((fromMaterials && fromMaterials !== "en-US" ? fromMaterials : void 0) || (typeof fromUtils === "string" && fromUtils ? fromUtils : void 0) || fromMaterials));
|
|
34
40
|
}
|
|
35
|
-
return normalizeLocale(locale);
|
|
41
|
+
return toDayjsLoadedLocale(normalizeLocale(locale));
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
//#endregion
|
|
@@ -149,7 +149,8 @@ const RecordBoardToolBar = (props) => {
|
|
|
149
149
|
formFiltersPrefix: "",
|
|
150
150
|
size: "large",
|
|
151
151
|
buttonClassName: "record-board-toolbar-filter-btn",
|
|
152
|
-
hiddenQuickFilter: true
|
|
152
|
+
hiddenQuickFilter: true,
|
|
153
|
+
placement: "bottomLeft"
|
|
153
154
|
}, typeof filterConfig === "object" && filterConfig !== null ? filterConfig : {}));
|
|
154
155
|
const showColumnSetting = slots.columnSetting !== false && Array.isArray(gridColumns) && gridColumns.length > 0;
|
|
155
156
|
const topRight = /* @__PURE__ */ React.createElement(Space, null, showColumnSetting ? /* @__PURE__ */ React.createElement(ColumnSetting_default, null) : null, sortNode, filterNode, /* @__PURE__ */ React.createElement(ToolBarReset_default, { size: "large" }), slots.topRight);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
|
+
import useEngineContext_default from "../../hooks/useEngineContext.js";
|
|
2
3
|
import { getDayjsLocale } from "../pisellDateTimeDisplay/utils/localeUtils.js";
|
|
3
4
|
import { getRelativeDay } from "../pisellDateTimeDisplay/utils/relativeDay.js";
|
|
4
5
|
import { parseTimeRange } from "./utils/parseTimeRange.js";
|
|
@@ -38,9 +39,11 @@ import "./PisellTimeRangeDisplay.less";
|
|
|
38
39
|
* />
|
|
39
40
|
*/
|
|
40
41
|
const PisellTimeRangeDisplay = (props) => {
|
|
41
|
-
var _durationFormat$showS;
|
|
42
|
+
var _context$engine, _durationFormat$showS;
|
|
42
43
|
const { startAt, endAt, textAlign = "center", fields, showDateForSameDay = true, timeFormat, dateFormat, weekdayFormat, durationFormat, containerStyle, timeStyle, dateStyle, weekdayStyle, durationStyle, locale: localeProp, className, style, onClick } = props;
|
|
43
|
-
const
|
|
44
|
+
const context = useEngineContext_default();
|
|
45
|
+
const resolvedLocale = localeProp || (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en";
|
|
46
|
+
const effectiveLocale = useMemo(() => getDayjsLocale(resolvedLocale), [resolvedLocale]);
|
|
44
47
|
const { start, end, isSameDay } = useMemo(() => parseTimeRange(startAt, endAt, effectiveLocale), [
|
|
45
48
|
startAt,
|
|
46
49
|
endAt,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react18 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/radio/index.d.ts
|
|
5
|
-
declare const Radio: (props: any) =>
|
|
5
|
+
declare const Radio: (props: any) => react18.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Radio };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react17 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/section-footers/index.d.ts
|
|
5
5
|
interface SectionFooterProps {
|
|
@@ -8,6 +8,6 @@ interface SectionFooterProps {
|
|
|
8
8
|
right?: React.ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
declare const SectionFooters: (props: SectionFooterProps) =>
|
|
11
|
+
declare const SectionFooters: (props: SectionFooterProps) => react17.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { SectionFooters };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckboxGroupProps } from "./type.js";
|
|
3
3
|
import { WithModeProps } from "../../dataSourceForm/utils.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react35 from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts
|
|
7
7
|
type CheckboxComponent = React.FC & {
|
|
8
8
|
Group: typeof CheckboxGroupWithMode;
|
|
9
9
|
};
|
|
10
10
|
declare const CheckboxWithMode: CheckboxComponent;
|
|
11
|
-
declare const CheckboxGroupWithMode:
|
|
11
|
+
declare const CheckboxGroupWithMode: react35.FC<CheckboxGroupProps & WithModeProps>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { CheckboxWithMode };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd20 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import * as antd_es_input3 from "antd/es/input";
|
|
5
5
|
|
|
6
6
|
//#region src/components/dataSourceComponents/fields/Input.Password/index.d.ts
|
|
7
|
-
declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<
|
|
7
|
+
declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd20.InputRef> & WithModeProps & WithFormItemProps>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Password };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd18 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/dataSourceComponents/fields/Input.Url/index.d.ts
|
|
6
|
-
declare const Url: React.FC<
|
|
6
|
+
declare const Url: React.FC<antd18.InputProps & React.RefAttributes<antd18.InputRef> & WithModeProps & WithFormItemProps>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { Url };
|
|
@@ -65,7 +65,7 @@ const Filter = ({ value, hiddenQuickFilter, hiddenOtherFilter, onChange, quickFi
|
|
|
65
65
|
if (dateRangeOpen && !visible) return;
|
|
66
66
|
setOpen(visible);
|
|
67
67
|
},
|
|
68
|
-
placement
|
|
68
|
+
placement: placement !== null && placement !== void 0 ? placement : "bottom"
|
|
69
69
|
}, /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
70
70
|
className: buttonClassName,
|
|
71
71
|
icon: /* @__PURE__ */ react.default.createElement(_pisell_icon_es_FilterLines.default, null),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataSourceContainerContextType } from "../../type.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd24 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/pisellDataSourceContainer/components/Pagination/index.d.ts
|
|
6
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd24.PaginationProps> & DataSourceContainerContextType & React.RefAttributes<unknown> & {
|
|
7
7
|
refId?: string | undefined;
|
|
8
8
|
}, "ref"> & React.RefAttributes<any>>;
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataSourceContainerContextType } from "../../type.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as antd23 from "antd";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/pisellDataSourceContainer/components/Table/index.d.ts
|
|
6
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd23.TableProps<any>> & DataSourceContainerContextType & {
|
|
7
7
|
scopeId?: string | undefined;
|
|
8
8
|
__id?: string | undefined;
|
|
9
9
|
} & React.RefAttributes<unknown> & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_objectSpread2 = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
|
|
3
|
+
const require_useEngineContext = require('../../hooks/useEngineContext.js');
|
|
3
4
|
const require_localeUtils = require('./utils/localeUtils.js');
|
|
4
5
|
const require_useCurrentTime = require('./hooks/useCurrentTime.js');
|
|
5
6
|
const require_relativeDay = require('./utils/relativeDay.js');
|
|
@@ -45,9 +46,13 @@ require("./PisellDateTimeDisplay.less");
|
|
|
45
46
|
* />
|
|
46
47
|
*/
|
|
47
48
|
const PisellDateTimeDisplay = (props) => {
|
|
48
|
-
var _ref, _presetSource$localeK;
|
|
49
|
+
var _context$engine, _ref, _presetSource$localeK;
|
|
49
50
|
const { value: valueProp, layout = "horizontal", textAlign = "center", fields, formatByLocale, timeFormat, dateFormat, weekdayFormat, customFormat, inlineSeparator = " · ", containerStyle, timeStyle, dateStyle, weekdayStyle, refreshInterval, disableAutoRefresh = false, locale, onTimeUpdate, onClick, className, style } = props;
|
|
50
|
-
const
|
|
51
|
+
const context = require_useEngineContext.default();
|
|
52
|
+
const resolvedLocale = locale || (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en";
|
|
53
|
+
console.log("resolvedLocale", resolvedLocale);
|
|
54
|
+
const localeKey = require_localeUtils.getDayjsLocale(resolvedLocale);
|
|
55
|
+
console.log("localeKey", localeKey);
|
|
51
56
|
const baseLocale = localeKey.split("-")[0];
|
|
52
57
|
const presetSource = formatByLocale !== null && formatByLocale !== void 0 ? formatByLocale : require_dateTimeDisplayFormats.DATETIME_DISPLAY_FORMATS;
|
|
53
58
|
const preset = (_ref = (_presetSource$localeK = presetSource[localeKey]) !== null && _presetSource$localeK !== void 0 ? _presetSource$localeK : presetSource[baseLocale]) !== null && _ref !== void 0 ? _ref : {};
|
|
@@ -58,10 +63,10 @@ const PisellDateTimeDisplay = (props) => {
|
|
|
58
63
|
const currentTime = require_useCurrentTime.useCurrentTime({
|
|
59
64
|
refreshInterval: refreshInterval !== null && refreshInterval !== void 0 ? refreshInterval : require_getRefreshInterval.getRefreshInterval(effectiveTimeFormat),
|
|
60
65
|
disabled: disableAutoRefresh || valueProp !== void 0,
|
|
61
|
-
locale,
|
|
66
|
+
locale: resolvedLocale,
|
|
62
67
|
onUpdate: onTimeUpdate
|
|
63
68
|
});
|
|
64
|
-
const displayTime = valueProp !== void 0 && valueProp !== null ? (0, dayjs.default)(valueProp) : currentTime;
|
|
69
|
+
const displayTime = valueProp !== void 0 && valueProp !== null ? (0, dayjs.default)(valueProp).locale(localeKey) : currentTime;
|
|
65
70
|
if (customFormat) {
|
|
66
71
|
const formattedTime = displayTime.format(customFormat);
|
|
67
72
|
const containerInlineStyle$1 = require_objectSpread2._objectSpread2({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_usePisellConfig = require('../../pisell-config-provider/hooks/usePisellConfig.js');
|
|
3
|
+
const require_useEngineContext = require('../../../hooks/useEngineContext.js');
|
|
3
4
|
const require_localeUtils = require('../utils/localeUtils.js');
|
|
4
5
|
let react = require("react");
|
|
5
6
|
let dayjs = require("dayjs");
|
|
@@ -26,10 +27,13 @@ dayjs = require_rolldown_runtime.__toESM(dayjs);
|
|
|
26
27
|
* @returns 当前时间(Dayjs 对象)
|
|
27
28
|
*/
|
|
28
29
|
function useCurrentTime(options) {
|
|
30
|
+
var _context$engine;
|
|
29
31
|
const { refreshInterval = 6e4, disabled = false, locale: userLocale, onUpdate } = options || {};
|
|
30
32
|
const globalConfig = require_usePisellConfig.default();
|
|
33
|
+
const context = require_useEngineContext.default();
|
|
31
34
|
const globalLocale = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.locale;
|
|
32
|
-
const
|
|
35
|
+
const engineLocale = context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale;
|
|
36
|
+
const dayjsLocale = require_localeUtils.getDayjsLocale(userLocale || globalLocale || engineLocale || "en");
|
|
33
37
|
const [currentTime, setCurrentTime] = (0, react.useState)(() => {
|
|
34
38
|
return (0, dayjs.default)().locale(dayjsLocale);
|
|
35
39
|
});
|
|
@@ -21,19 +21,25 @@ function normalizeLocale(locale) {
|
|
|
21
21
|
function isChinese(locale) {
|
|
22
22
|
return normalizeLocale(locale).startsWith("zh");
|
|
23
23
|
}
|
|
24
|
+
/** dayjs 常用 locale 与项目已加载的 locale 对齐(zh-cn、en),en-us 等统一用 en */
|
|
25
|
+
function toDayjsLoadedLocale(normalized) {
|
|
26
|
+
if (normalized.startsWith("en")) return "en";
|
|
27
|
+
return normalized;
|
|
28
|
+
}
|
|
24
29
|
/**
|
|
25
30
|
* 获取 dayjs 兼容的 locale 代码
|
|
26
|
-
* 未传 locale
|
|
31
|
+
* 未传 locale 时:优先 materials 当前语言(globalConfig / umi_locale),若为默认 en-US 则用 @pisell/utils getLocale
|
|
27
32
|
* @param locale 原始 locale 代码(可选)
|
|
28
|
-
* @returns dayjs 兼容的 locale
|
|
33
|
+
* @returns dayjs 兼容的 locale 代码(与已加载的 zh-cn、en 对齐)
|
|
29
34
|
* @example 'zh-CN' -> 'zh-cn', 'en-US' -> 'en'
|
|
30
35
|
*/
|
|
31
36
|
function getDayjsLocale(locale) {
|
|
32
37
|
if (!locale) {
|
|
38
|
+
const fromMaterials = require_locale.getCurrentLocale();
|
|
33
39
|
const fromUtils = typeof _pisell_utils.locales.getLocale === "function" ? _pisell_utils.locales.getLocale() : void 0;
|
|
34
|
-
return normalizeLocale(typeof fromUtils === "string" && fromUtils ? fromUtils :
|
|
40
|
+
return toDayjsLoadedLocale(normalizeLocale((fromMaterials && fromMaterials !== "en-US" ? fromMaterials : void 0) || (typeof fromUtils === "string" && fromUtils ? fromUtils : void 0) || fromMaterials));
|
|
35
41
|
}
|
|
36
|
-
return normalizeLocale(locale);
|
|
42
|
+
return toDayjsLoadedLocale(normalizeLocale(locale));
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
//#endregion
|
|
@@ -152,7 +152,8 @@ const RecordBoardToolBar = (props) => {
|
|
|
152
152
|
formFiltersPrefix: "",
|
|
153
153
|
size: "large",
|
|
154
154
|
buttonClassName: "record-board-toolbar-filter-btn",
|
|
155
|
-
hiddenQuickFilter: true
|
|
155
|
+
hiddenQuickFilter: true,
|
|
156
|
+
placement: "bottomLeft"
|
|
156
157
|
}, typeof filterConfig === "object" && filterConfig !== null ? filterConfig : {}));
|
|
157
158
|
const showColumnSetting = slots.columnSetting !== false && Array.isArray(gridColumns) && gridColumns.length > 0;
|
|
158
159
|
const topRight = /* @__PURE__ */ react.default.createElement(antd.Space, null, showColumnSetting ? /* @__PURE__ */ react.default.createElement(require_index$7.default, null) : null, sortNode, filterNode, /* @__PURE__ */ react.default.createElement(require_index$5.default, { size: "large" }), slots.topRight);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_objectSpread2 = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
|
|
3
|
+
const require_useEngineContext = require('../../hooks/useEngineContext.js');
|
|
3
4
|
const require_localeUtils = require('../pisellDateTimeDisplay/utils/localeUtils.js');
|
|
4
5
|
const require_relativeDay = require('../pisellDateTimeDisplay/utils/relativeDay.js');
|
|
5
6
|
const require_parseTimeRange = require('./utils/parseTimeRange.js');
|
|
@@ -41,9 +42,11 @@ require("./PisellTimeRangeDisplay.less");
|
|
|
41
42
|
* />
|
|
42
43
|
*/
|
|
43
44
|
const PisellTimeRangeDisplay = (props) => {
|
|
44
|
-
var _durationFormat$showS;
|
|
45
|
+
var _context$engine, _durationFormat$showS;
|
|
45
46
|
const { startAt, endAt, textAlign = "center", fields, showDateForSameDay = true, timeFormat, dateFormat, weekdayFormat, durationFormat, containerStyle, timeStyle, dateStyle, weekdayStyle, durationStyle, locale: localeProp, className, style, onClick } = props;
|
|
46
|
-
const
|
|
47
|
+
const context = require_useEngineContext.default();
|
|
48
|
+
const resolvedLocale = localeProp || (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en";
|
|
49
|
+
const effectiveLocale = (0, react.useMemo)(() => require_localeUtils.getDayjsLocale(resolvedLocale), [resolvedLocale]);
|
|
47
50
|
const { start, end, isSameDay } = (0, react.useMemo)(() => require_parseTimeRange.parseTimeRange(startAt, endAt, effectiveLocale), [
|
|
48
51
|
startAt,
|
|
49
52
|
endAt,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react17 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/radio/index.d.ts
|
|
5
|
-
declare const Radio: (props: any) =>
|
|
5
|
+
declare const Radio: (props: any) => react17.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Radio };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react18 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/section-footers/index.d.ts
|
|
5
5
|
interface SectionFooterProps {
|
|
@@ -8,6 +8,6 @@ interface SectionFooterProps {
|
|
|
8
8
|
right?: React.ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
declare const SectionFooters: (props: SectionFooterProps) =>
|
|
11
|
+
declare const SectionFooters: (props: SectionFooterProps) => react18.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { SectionFooters };
|