@pisell/materials 3.3.112 → 3.3.113

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.
@@ -2,6 +2,7 @@ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/hel
2
2
  import useEngineContext from "../../hooks/useEngineContext.js";
3
3
  import Calendar$1 from "../calendar/index.js";
4
4
  import locales_default from "./locales.js";
5
+ import { getHostLocale } from "../../utils/getHostLocale.js";
5
6
  import { addDateDays, dayNumber, formatDateLabel, inspectDateItems, monthDates, shiftMonth } from "../../utils/dateOnly.js";
6
7
  import { calendarLocale, calendarPanelValue } from "./calendarPanelBridge.js";
7
8
  import { calendarBaseDisplayRange, calendarDisplayRange, eventsOnDate, movedCalendarRange } from "./calendarEventProjection.js";
@@ -12,7 +13,7 @@ import { Popover } from "antd";
12
13
  import "./PisellCalendar.less";
13
14
  //#region src/components/pisellCalendar/PisellCalendar.tsx
14
15
  function PisellCalendar(props) {
15
- var _context$appHelper, _utils$storage, _interaction$preview, _interaction$preview6, _interaction$preview7, _interaction$preview8;
16
+ var _context$appHelper, _interaction$preview, _interaction$preview6, _interaction$preview7, _interaction$preview8;
16
17
  const { month, items, today, selectedDate, weekStartsOn = 0, maxEventsPerDay = 3, density = "comfortable", displayMode = "range", getDisplayDate, showEventCount = true } = props;
17
18
  const root = useRef(null);
18
19
  const cells = useRef(/* @__PURE__ */ new Map());
@@ -42,9 +43,8 @@ function PisellCalendar(props) {
42
43
  displayMode,
43
44
  getDisplayDate
44
45
  ]);
45
- const utils = ((_context$appHelper = useEngineContext().appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
46
- const locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) || localStorage.getItem("umi_locale");
47
- locales.init(locales_default, locale || "en");
46
+ const locale = getHostLocale((_context$appHelper = useEngineContext().appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.storage);
47
+ locales.init(locales_default, locale);
48
48
  useEffect(() => {
49
49
  document.body.id = "body";
50
50
  }, []);
@@ -1,5 +1,6 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import useEngineContext from "../../hooks/useEngineContext.js";
3
+ import { getHostLocale } from "../../utils/getHostLocale.js";
3
4
  import { addDateDays, dayNumber, formatDateLabel, inspectDateItems, shiftMonth } from "../../utils/dateOnly.js";
4
5
  import locales_default from "./locales.js";
5
6
  import { changeGanttRange, clippedRange, viewportRange } from "./ganttLayout.js";
@@ -9,11 +10,10 @@ import { locales } from "@pisell/utils";
9
10
  import "./PisellGantt.less";
10
11
  //#region src/components/pisellGantt/PisellGantt.tsx
11
12
  function PisellGantt(props) {
12
- var _engineContext$appHel, _utils$storage, _props$collapsedGroup, _interaction$preview4, _interaction$preview5, _interaction$preview6;
13
+ var _engineContext$appHel, _props$collapsedGroup, _interaction$preview4, _interaction$preview5, _interaction$preview6;
13
14
  const { items, viewport, today, dayWidth = 40, labelWidth = 200, rowHeight = 40 } = props;
14
- const utils = ((_engineContext$appHel = useEngineContext().appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils) || {};
15
- const locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) || localStorage.getItem("umi_locale");
16
- locales.init(locales_default, locale || "en");
15
+ const locale = getHostLocale((_engineContext$appHel = useEngineContext().appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.storage);
16
+ locales.init(locales_default, locale);
17
17
  const messages = _objectSpread2({
18
18
  previous: locales.getText("pisell2.gantt.previous"),
19
19
  next: locales.getText("pisell2.gantt.next"),
@@ -0,0 +1,8 @@
1
+ //#region src/utils/getHostLocale.ts
2
+ function getHostLocale(storage) {
3
+ const readLocale = typeof (storage === null || storage === void 0 ? void 0 : storage.get) === "function" ? storage.get : storage === null || storage === void 0 ? void 0 : storage.getStorage;
4
+ const locale = typeof readLocale === "function" ? readLocale.call(storage, "umi_locale") : void 0;
5
+ return typeof locale === "string" && locale || localStorage.getItem("umi_locale") || "en";
6
+ }
7
+ //#endregion
8
+ export { getHostLocale };
@@ -3,6 +3,7 @@ const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.12
3
3
  const require_useEngineContext = require("../../hooks/useEngineContext.js");
4
4
  const require_index = require("../calendar/index.js");
5
5
  const require_locales = require("./locales.js");
6
+ const require_getHostLocale = require("../../utils/getHostLocale.js");
6
7
  const require_dateOnly = require("../../utils/dateOnly.js");
7
8
  const require_calendarPanelBridge = require("./calendarPanelBridge.js");
8
9
  const require_calendarEventProjection = require("./calendarEventProjection.js");
@@ -14,7 +15,7 @@ let antd = require("antd");
14
15
  require("./PisellCalendar.less");
15
16
  //#region src/components/pisellCalendar/PisellCalendar.tsx
16
17
  function PisellCalendar(props) {
17
- var _context$appHelper, _utils$storage, _interaction$preview, _interaction$preview6, _interaction$preview7, _interaction$preview8;
18
+ var _context$appHelper, _interaction$preview, _interaction$preview6, _interaction$preview7, _interaction$preview8;
18
19
  const { month, items, today, selectedDate, weekStartsOn = 0, maxEventsPerDay = 3, density = "comfortable", displayMode = "range", getDisplayDate, showEventCount = true } = props;
19
20
  const root = (0, react.useRef)(null);
20
21
  const cells = (0, react.useRef)(/* @__PURE__ */ new Map());
@@ -44,9 +45,8 @@ function PisellCalendar(props) {
44
45
  displayMode,
45
46
  getDisplayDate
46
47
  ]);
47
- const utils = ((_context$appHelper = require_useEngineContext.default().appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
48
- const locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) || localStorage.getItem("umi_locale");
49
- _pisell_utils.locales.init(require_locales.default, locale || "en");
48
+ const locale = require_getHostLocale.getHostLocale((_context$appHelper = require_useEngineContext.default().appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.storage);
49
+ _pisell_utils.locales.init(require_locales.default, locale);
50
50
  (0, react.useEffect)(() => {
51
51
  document.body.id = "body";
52
52
  }, []);
@@ -1,6 +1,7 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
3
  const require_useEngineContext = require("../../hooks/useEngineContext.js");
4
+ const require_getHostLocale = require("../../utils/getHostLocale.js");
4
5
  const require_dateOnly = require("../../utils/dateOnly.js");
5
6
  const require_locales = require("./locales.js");
6
7
  const require_ganttLayout = require("./ganttLayout.js");
@@ -11,11 +12,10 @@ let _pisell_utils = require("@pisell/utils");
11
12
  require("./PisellGantt.less");
12
13
  //#region src/components/pisellGantt/PisellGantt.tsx
13
14
  function PisellGantt(props) {
14
- var _engineContext$appHel, _utils$storage, _props$collapsedGroup, _interaction$preview4, _interaction$preview5, _interaction$preview6;
15
+ var _engineContext$appHel, _props$collapsedGroup, _interaction$preview4, _interaction$preview5, _interaction$preview6;
15
16
  const { items, viewport, today, dayWidth = 40, labelWidth = 200, rowHeight = 40 } = props;
16
- const utils = ((_engineContext$appHel = require_useEngineContext.default().appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils) || {};
17
- const locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) || localStorage.getItem("umi_locale");
18
- _pisell_utils.locales.init(require_locales.default, locale || "en");
17
+ const locale = require_getHostLocale.getHostLocale((_engineContext$appHel = require_useEngineContext.default().appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.storage);
18
+ _pisell_utils.locales.init(require_locales.default, locale);
19
19
  const messages = require_objectSpread2._objectSpread2({
20
20
  previous: _pisell_utils.locales.getText("pisell2.gantt.previous"),
21
21
  next: _pisell_utils.locales.getText("pisell2.gantt.next"),
@@ -0,0 +1,8 @@
1
+ //#region src/utils/getHostLocale.ts
2
+ function getHostLocale(storage) {
3
+ const readLocale = typeof (storage === null || storage === void 0 ? void 0 : storage.get) === "function" ? storage.get : storage === null || storage === void 0 ? void 0 : storage.getStorage;
4
+ const locale = typeof readLocale === "function" ? readLocale.call(storage, "umi_locale") : void 0;
5
+ return typeof locale === "string" && locale || localStorage.getItem("umi_locale") || "en";
6
+ }
7
+ //#endregion
8
+ exports.getHostLocale = getHostLocale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "3.3.112",
3
+ "version": "3.3.113",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -96,9 +96,9 @@
96
96
  "styled-components": "^6.0.0-rc.3",
97
97
  "swiper": "^8.4.7",
98
98
  "vod-js-sdk-v6": "^1.4.11",
99
- "@pisell/date-picker": "3.0.4",
99
+ "@pisell/icon": "0.0.11",
100
100
  "@pisell/utils": "3.0.2",
101
- "@pisell/icon": "0.0.11"
101
+ "@pisell/date-picker": "3.0.4"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": "^18.0.0",