@pisell/materials 6.0.13 → 6.0.14
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/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +20 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +21 -21
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +2 -0
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +61 -0
- package/es/components/dataSourceComponents/dataSourceMenu/index.js +39 -10
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +16 -1
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +42 -5
- package/es/components/dataSourceComponents/fields/DatePicker/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/DatePicker/type.d.ts +1 -0
- package/es/components/dataSourceComponents/hooks/useActions.js +9 -3
- package/es/components/date-picker/datePickerCpt.js +4 -2
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +1 -0
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +2 -1
- package/es/components/pisellDraggable/index.d.ts +3 -1
- package/es/components/pisellDraggable/index.js +89 -9
- package/es/components/pisellDraggable/types.d.ts +1 -0
- package/es/components/pisellLayout/content.d.ts +2 -0
- package/es/components/pisellLayout/content.js +26 -4
- package/es/components/pisellLayout/footer.d.ts +1 -0
- package/es/components/pisellLayout/footer.js +18 -3
- package/es/components/pisellLayout/header.d.ts +3 -0
- package/es/components/pisellLayout/header.js +26 -3
- package/es/components/pisellLayout/index.js +4 -1
- package/es/components/pisellLayout/index.less +23 -0
- package/es/components/pisellLayout/sider.d.ts +1 -0
- package/es/components/pisellLayout/sider.js +38 -3
- package/es/components/pisellMenu/PisellMenu.d.ts +5 -1
- package/es/components/pisellMenu/PisellMenu.js +10 -4
- package/es/components/pisellMenu/types.d.ts +6 -10
- package/es/hooks/useEngineContext.js +11 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +2 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +92 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/index.js +36 -6
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +17 -1
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +37 -3
- package/lib/components/dataSourceComponents/fields/DatePicker/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/DatePicker/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/hooks/useActions.js +3 -0
- package/lib/components/date-picker/datePickerCpt.js +4 -2
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +1 -0
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +1 -0
- package/lib/components/pisellDraggable/index.d.ts +3 -1
- package/lib/components/pisellDraggable/index.js +59 -7
- package/lib/components/pisellDraggable/types.d.ts +1 -0
- package/lib/components/pisellLayout/content.d.ts +2 -0
- package/lib/components/pisellLayout/content.js +14 -3
- package/lib/components/pisellLayout/footer.d.ts +1 -0
- package/lib/components/pisellLayout/footer.js +8 -2
- package/lib/components/pisellLayout/header.d.ts +3 -0
- package/lib/components/pisellLayout/header.js +13 -2
- package/lib/components/pisellLayout/index.js +3 -0
- package/lib/components/pisellLayout/index.less +23 -0
- package/lib/components/pisellLayout/sider.d.ts +1 -0
- package/lib/components/pisellLayout/sider.js +30 -2
- package/lib/components/pisellMenu/PisellMenu.d.ts +5 -1
- package/lib/components/pisellMenu/PisellMenu.js +12 -4
- package/lib/components/pisellMenu/types.d.ts +6 -10
- package/lib/hooks/useEngineContext.js +6 -0
- package/lowcode/data-source-menu/meta.ts +66 -6
- package/lowcode/form-item-translation/meta.ts +1 -1
- package/lowcode/pisell-content/__screenshots__/content.png +0 -0
- package/lowcode/pisell-content/meta.ts +28 -5
- package/lowcode/pisell-footer/__screenshots__/footer.png +0 -0
- package/lowcode/pisell-footer/meta.ts +17 -4
- package/lowcode/pisell-header/__screenshots__/header.png +0 -0
- package/lowcode/pisell-header/meta.ts +29 -5
- package/lowcode/pisell-layout/__screenshots__/layout.png +0 -0
- package/lowcode/pisell-layout/meta.ts +10 -5
- package/lowcode/pisell-sider/__screenshots__/sider.png +0 -0
- package/lowcode/pisell-sider/meta.ts +41 -4
- package/package.json +30 -28
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "height"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
11
|
import { Layout } from 'antd';
|
|
5
|
-
import React from 'react';
|
|
12
|
+
import React, { useMemo } from 'react';
|
|
6
13
|
var Footer = Layout.Footer;
|
|
7
14
|
var PisellFooter = function PisellFooter(props) {
|
|
8
15
|
var children = props.children,
|
|
16
|
+
height = props.height,
|
|
9
17
|
rest = _objectWithoutProperties(props, _excluded);
|
|
10
|
-
|
|
18
|
+
var footerStyle = useMemo(function () {
|
|
19
|
+
return _objectSpread({
|
|
20
|
+
height: height
|
|
21
|
+
}, rest.style);
|
|
22
|
+
}, [height, rest.style]);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Footer, _extends({}, rest, {
|
|
24
|
+
style: footerStyle
|
|
25
|
+
}), children);
|
|
11
26
|
};
|
|
12
27
|
export default PisellFooter;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { LayoutProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
3
4
|
export interface PisellHeaderProps extends Omit<LayoutProps, 'prefixCls'> {
|
|
4
5
|
children?: React.ReactNode;
|
|
6
|
+
height?: number;
|
|
7
|
+
fixed?: boolean;
|
|
5
8
|
}
|
|
6
9
|
declare const PisellHeader: React.FC<PisellHeaderProps>;
|
|
7
10
|
export default PisellHeader;
|
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "className", "height", "fixed"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
11
|
import { Layout } from 'antd';
|
|
5
|
-
import
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import React, { useMemo } from 'react';
|
|
14
|
+
import "./index.less";
|
|
6
15
|
var Header = Layout.Header;
|
|
7
16
|
var PisellHeader = function PisellHeader(props) {
|
|
8
17
|
var children = props.children,
|
|
18
|
+
className = props.className,
|
|
19
|
+
height = props.height,
|
|
20
|
+
fixed = props.fixed,
|
|
9
21
|
rest = _objectWithoutProperties(props, _excluded);
|
|
10
|
-
|
|
22
|
+
var headerStyle = useMemo(function () {
|
|
23
|
+
return _objectSpread({
|
|
24
|
+
height: height
|
|
25
|
+
}, rest.style);
|
|
26
|
+
}, [height, rest.style]);
|
|
27
|
+
var headerClassName = classNames('pisell-layout-header', className, {
|
|
28
|
+
// 'pisell-layout-header-fixed': fixed,
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/React.createElement(Header, _extends({}, rest, {
|
|
31
|
+
style: headerStyle,
|
|
32
|
+
className: headerClassName
|
|
33
|
+
}), children);
|
|
11
34
|
};
|
|
12
35
|
export default PisellHeader;
|
|
@@ -2,10 +2,13 @@ var _excluded = ["children"];
|
|
|
2
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
4
|
import { Layout } from 'antd';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
6
|
var PisellLayout = function PisellLayout(props) {
|
|
7
7
|
var children = props.children,
|
|
8
8
|
rest = _objectWithoutProperties(props, _excluded);
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
document.body.id = 'body';
|
|
11
|
+
}, []);
|
|
9
12
|
return /*#__PURE__*/React.createElement(Layout, rest, children);
|
|
10
13
|
};
|
|
11
14
|
PisellLayout.Header = Layout.Header;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.pisell-layout {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pisell-layout-header {}
|
|
6
|
+
|
|
7
|
+
.pisell-layout-header-fixed {
|
|
8
|
+
position: sticky;
|
|
9
|
+
top: 0;
|
|
10
|
+
z-index: 100;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pisell-layout-content {}
|
|
14
|
+
|
|
15
|
+
.pisell-layout-content-scroll {
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.pisell-layout-sider {}
|
|
20
|
+
|
|
21
|
+
.pisell-lowcode-layout-sider-trigger {
|
|
22
|
+
position: unset;
|
|
23
|
+
}
|
|
@@ -1,12 +1,47 @@
|
|
|
1
|
-
var _excluded = ["children"];
|
|
1
|
+
var _excluded = ["children", "collapsible", "collapsed", "onCollapse"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
11
|
import { Layout } from 'antd';
|
|
5
|
-
import
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import "./index.less";
|
|
6
15
|
var Sider = Layout.Sider;
|
|
7
16
|
var PisellSider = function PisellSider(props) {
|
|
8
17
|
var children = props.children,
|
|
18
|
+
collapsible = props.collapsible,
|
|
19
|
+
collapsed = props.collapsed,
|
|
20
|
+
onCollapse = props.onCollapse,
|
|
9
21
|
rest = _objectWithoutProperties(props, _excluded);
|
|
10
|
-
|
|
22
|
+
var _useState = useState(collapsed),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
collapsedState = _useState2[0],
|
|
25
|
+
setCollapsedState = _useState2[1];
|
|
26
|
+
var className = classNames('pisell-layout-sider', props.className);
|
|
27
|
+
var _onCollapse = function _onCollapse(val, type) {
|
|
28
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse(val, type);
|
|
29
|
+
setCollapsedState(val);
|
|
30
|
+
};
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
setCollapsedState(collapsed);
|
|
33
|
+
}, [collapsed]);
|
|
34
|
+
return /*#__PURE__*/React.createElement(Sider, _extends({}, rest, {
|
|
35
|
+
collapsible: collapsible,
|
|
36
|
+
collapsed: collapsedState,
|
|
37
|
+
onCollapse: _onCollapse,
|
|
38
|
+
className: className
|
|
39
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: 'pisell-layout-sider-content',
|
|
41
|
+
style: {
|
|
42
|
+
overflowY: 'auto',
|
|
43
|
+
height: '100%'
|
|
44
|
+
}
|
|
45
|
+
}, children));
|
|
11
46
|
};
|
|
12
47
|
export default PisellSider;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './PisellMenu.less';
|
|
3
3
|
import type { PisellMenuProps } from './types';
|
|
4
|
-
declare const PisellMenu:
|
|
4
|
+
declare const PisellMenu: {
|
|
5
|
+
({ className, style, mode, theme, defaultOpenKeys, defaultSelectedKeys, inlineCollapsed, openKeys, selectedKeys, onOpenChange, onSelect, dataSource, __designMode, children, other, ...restProps }: PisellMenuProps): React.JSX.Element;
|
|
6
|
+
Item: Omit<React.FunctionComponent<import("antd").MenuItemProps>, ""> & (<T extends import("antd").MenuItemProps>(props: T extends infer U extends import("antd").MenuItemProps ? unknown extends U ? import("antd").MenuItemProps : U : import("antd").MenuItemProps, context?: any) => React.ReactElement<any, any> | null);
|
|
7
|
+
SubMenu: React.FC<import("antd").SubMenuProps>;
|
|
8
|
+
};
|
|
5
9
|
export default PisellMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "style", "mode", "theme", "defaultOpenKeys", "defaultSelectedKeys", "inlineCollapsed", "openKeys", "selectedKeys", "onOpenChange", "onSelect", "dataSource", "__designMode"];
|
|
1
|
+
var _excluded = ["className", "style", "mode", "theme", "defaultOpenKeys", "defaultSelectedKeys", "inlineCollapsed", "openKeys", "selectedKeys", "onOpenChange", "onSelect", "dataSource", "__designMode", "children", "other"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -21,6 +21,8 @@ var PisellMenu = function PisellMenu(_ref) {
|
|
|
21
21
|
onSelect = _ref.onSelect,
|
|
22
22
|
dataSource = _ref.dataSource,
|
|
23
23
|
__designMode = _ref.__designMode,
|
|
24
|
+
children = _ref.children,
|
|
25
|
+
other = _ref.other,
|
|
24
26
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var _dataSource = useMemo(function () {
|
|
26
28
|
if (Array.isArray(dataSource)) {
|
|
@@ -29,10 +31,12 @@ var PisellMenu = function PisellMenu(_ref) {
|
|
|
29
31
|
if (__designMode === 'design') {
|
|
30
32
|
return [{
|
|
31
33
|
label: '菜单项1',
|
|
32
|
-
key: 'item-1'
|
|
34
|
+
key: 'item-1',
|
|
35
|
+
path: '/item-1'
|
|
33
36
|
}, {
|
|
34
37
|
label: '菜单项2',
|
|
35
|
-
key: 'item-2'
|
|
38
|
+
key: 'item-2',
|
|
39
|
+
path: '/item-2'
|
|
36
40
|
}];
|
|
37
41
|
}
|
|
38
42
|
return [];
|
|
@@ -50,6 +54,8 @@ var PisellMenu = function PisellMenu(_ref) {
|
|
|
50
54
|
selectedKeys: selectedKeys,
|
|
51
55
|
onOpenChange: onOpenChange,
|
|
52
56
|
onSelect: onSelect
|
|
53
|
-
}, restProps));
|
|
57
|
+
}, restProps, other), children);
|
|
54
58
|
};
|
|
59
|
+
PisellMenu.Item = AntdMenu.Item;
|
|
60
|
+
PisellMenu.SubMenu = AntdMenu.SubMenu;
|
|
55
61
|
export default PisellMenu;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { MenuProps } from 'antd';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
3
|
export interface PisellMenuProps extends Omit<MenuProps, 'items'> {
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
@@ -11,20 +11,16 @@ export interface PisellMenuProps extends Omit<MenuProps, 'items'> {
|
|
|
11
11
|
openKeys?: string[];
|
|
12
12
|
selectedKeys?: string[];
|
|
13
13
|
onOpenChange?: (openKeys: string[]) => void;
|
|
14
|
-
onSelect?: (info: {
|
|
15
|
-
key: string;
|
|
16
|
-
keyPath: string[];
|
|
17
|
-
item: ReactNode;
|
|
18
|
-
domEvent: Event;
|
|
19
|
-
selectedKeys: string[];
|
|
20
|
-
}) => void;
|
|
21
14
|
dataSource?: any;
|
|
22
15
|
__designMode?: string;
|
|
16
|
+
other?: PisellMenuProps;
|
|
23
17
|
}
|
|
24
18
|
export interface MenuItemType {
|
|
25
|
-
label: ReactNode;
|
|
26
19
|
key: string;
|
|
27
|
-
|
|
20
|
+
label: string;
|
|
21
|
+
path: string;
|
|
28
22
|
children?: MenuItemType[];
|
|
23
|
+
icon?: string | React.ReactNode;
|
|
24
|
+
hide?: boolean;
|
|
29
25
|
type?: 'group' | 'divider';
|
|
30
26
|
}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
7
|
import { createContext, useContext } from "react";
|
|
2
8
|
var defaultContext = /*#__PURE__*/createContext({});
|
|
3
9
|
var useEngineContext = function useEngineContext() {
|
|
4
10
|
var context = useContext(window.__appContext || defaultContext);
|
|
11
|
+
if ((context === null || context === void 0 ? void 0 : context.appHelper) === undefined) {
|
|
12
|
+
return _objectSpread(_objectSpread({}, context), {}, {
|
|
13
|
+
appHelper: window.__appHelper
|
|
14
|
+
});
|
|
15
|
+
}
|
|
5
16
|
return context || {};
|
|
6
17
|
};
|
|
7
18
|
export default useEngineContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ModeType } from '../../type';
|
|
3
3
|
export interface FormSettingContextType {
|
|
4
|
-
onDataSourceFinish?: (values: any, result: any) => void;
|
|
4
|
+
onDataSourceFinish?: (values: any, result: any, form: any) => void;
|
|
5
5
|
renderMode?: ModeType;
|
|
6
6
|
groupInfoPosition?: 'top' | 'side';
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -119,7 +119,7 @@ var SubmitButton = (props) => {
|
|
|
119
119
|
const formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
|
|
120
120
|
const result = await onSubmit(formattedValues);
|
|
121
121
|
if (onDataSourceFinish) {
|
|
122
|
-
onDataSourceFinish(formattedValues, result);
|
|
122
|
+
onDataSourceFinish(formattedValues, result, form);
|
|
123
123
|
}
|
|
124
124
|
if (refreshData) {
|
|
125
125
|
refreshTableData == null ? void 0 : refreshTableData();
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/dataSourceComponents/dataSourceMenu/Basic.tsx
|
|
30
|
+
var Basic_exports = {};
|
|
31
|
+
__export(Basic_exports, {
|
|
32
|
+
default: () => Basic_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Basic_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
37
|
+
var import_pisellMenu = __toESM(require("../../pisellMenu"));
|
|
38
|
+
var DataSourceMenu = (0, import_react.forwardRef)(
|
|
39
|
+
(props, ref) => {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
42
|
+
const {
|
|
43
|
+
menuItems,
|
|
44
|
+
selectedKeys,
|
|
45
|
+
openKeys,
|
|
46
|
+
setOpenKeys,
|
|
47
|
+
getShowChildren,
|
|
48
|
+
handleClick
|
|
49
|
+
} = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.menuManager) == null ? void 0 : _d.useMenu();
|
|
50
|
+
const renderMenuItems = (items) => {
|
|
51
|
+
return items.map((item) => {
|
|
52
|
+
if (item.hide) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const _children = getShowChildren(item.children || []);
|
|
56
|
+
if (_children == null ? void 0 : _children.length) {
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
58
|
+
import_pisellMenu.default.SubMenu,
|
|
59
|
+
{
|
|
60
|
+
key: item.key,
|
|
61
|
+
title: item.label,
|
|
62
|
+
icon: item.icon,
|
|
63
|
+
router: item.path
|
|
64
|
+
},
|
|
65
|
+
renderMenuItems(_children)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default.Item, { key: item.key, icon: item.icon, router: item.path }, item.label);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
import_pisellMenu.default,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
mode: "inline",
|
|
76
|
+
selectedKeys,
|
|
77
|
+
openKeys,
|
|
78
|
+
onOpenChange: setOpenKeys,
|
|
79
|
+
onClick: ({ item }) => {
|
|
80
|
+
var _a2;
|
|
81
|
+
handleClick((_a2 = item.props) == null ? void 0 : _a2.router);
|
|
82
|
+
},
|
|
83
|
+
...props,
|
|
84
|
+
other: {
|
|
85
|
+
items: void 0
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
renderMenuItems(menuItems)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
var Basic_default = DataSourceMenu;
|
|
@@ -33,13 +33,43 @@ __export(dataSourceMenu_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(dataSourceMenu_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
36
37
|
var import_pisellMenu = __toESM(require("../../pisellMenu"));
|
|
37
38
|
var import_useVariables = __toESM(require("../hooks/useVariables"));
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
var import_Basic = __toESM(require("./Basic"));
|
|
40
|
+
var DataSourceMenu = (props, ref) => {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
const { dataSource } = props;
|
|
43
|
+
const { parseVariable } = (0, import_useVariables.default)();
|
|
44
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
45
|
+
const _dataSource = (0, import_react.useMemo)(() => {
|
|
46
|
+
if (Array.isArray(dataSource)) {
|
|
47
|
+
return dataSource;
|
|
48
|
+
}
|
|
49
|
+
if (props.__designMode === "design") {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
label: "菜单项1",
|
|
53
|
+
key: "item-1",
|
|
54
|
+
path: "/item-1"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "菜单项2",
|
|
58
|
+
key: "item-2",
|
|
59
|
+
path: "/item-2"
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
if (typeof dataSource === "string") {
|
|
64
|
+
return parseVariable == null ? void 0 : parseVariable(dataSource);
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}, [dataSource]);
|
|
68
|
+
if (props.__designMode === "design") {
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default, { ...props });
|
|
43
70
|
}
|
|
44
|
-
);
|
|
71
|
+
const MenuProvider = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.menuManager) == null ? void 0 : _d.MenuProvider;
|
|
72
|
+
console.log("MenuProvider11", appHelper);
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(MenuProvider, { menus: _dataSource }, /* @__PURE__ */ import_react.default.createElement(import_Basic.default, { ...props }));
|
|
74
|
+
};
|
|
45
75
|
var dataSourceMenu_default = DataSourceMenu;
|
|
@@ -9,12 +9,16 @@ export declare type UseFormatParams = {
|
|
|
9
9
|
dataSourceKey: string;
|
|
10
10
|
fields: Field[];
|
|
11
11
|
};
|
|
12
|
-
export declare type
|
|
12
|
+
export declare type ApiListResult = {
|
|
13
13
|
list: any[];
|
|
14
14
|
count: number;
|
|
15
|
-
page: number;
|
|
16
15
|
size: number;
|
|
16
|
+
} & ({
|
|
17
|
+
page: number;
|
|
17
18
|
} | {
|
|
19
|
+
skip: number;
|
|
20
|
+
});
|
|
21
|
+
export declare type FormatListResultParams = ApiListResult | {
|
|
18
22
|
data: any[];
|
|
19
23
|
meta: {
|
|
20
24
|
count: number;
|
|
@@ -122,7 +122,7 @@ var customApiFormatFilter = (filter) => {
|
|
|
122
122
|
var useFormat = ({ dataSourceKey, fields }) => {
|
|
123
123
|
const formatListResult = (0, import_ahooks.useMemoizedFn)(
|
|
124
124
|
(res) => {
|
|
125
|
-
if (dataSourceKey === "pisell2-api" && "list" in res) {
|
|
125
|
+
if (dataSourceKey === "pisell2-api" && "list" in res && "page" in res) {
|
|
126
126
|
return {
|
|
127
127
|
data: res.list,
|
|
128
128
|
count: res.count,
|
|
@@ -130,6 +130,15 @@ var useFormat = ({ dataSourceKey, fields }) => {
|
|
|
130
130
|
pageSize: res.size
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
+
if (dataSourceKey === "mypisell-api" && "list" in res && "skip" in res) {
|
|
134
|
+
const skip = typeof res.skip === "number" ? res.skip : 1;
|
|
135
|
+
return {
|
|
136
|
+
data: res.list,
|
|
137
|
+
count: res.count,
|
|
138
|
+
page: skip - 1 || 1,
|
|
139
|
+
pageSize: res.size
|
|
140
|
+
};
|
|
141
|
+
}
|
|
133
142
|
if ("meta" in res) {
|
|
134
143
|
return {
|
|
135
144
|
data: res.data,
|
|
@@ -156,6 +165,13 @@ var useFormat = ({ dataSourceKey, fields }) => {
|
|
|
156
165
|
...customApiFormatFilter(params.filter || {})
|
|
157
166
|
};
|
|
158
167
|
}
|
|
168
|
+
if (dataSourceKey === "mypisell-api") {
|
|
169
|
+
return {
|
|
170
|
+
skip: (params == null ? void 0 : params.page) || 1,
|
|
171
|
+
num: (params == null ? void 0 : params.pageSize) || 10,
|
|
172
|
+
...customApiFormatFilter(params.filter || {})
|
|
173
|
+
};
|
|
174
|
+
}
|
|
159
175
|
return params;
|
|
160
176
|
});
|
|
161
177
|
const formatCreateUpdateParams = (0, import_ahooks.useMemoizedFn)((params) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FC } from 'react';
|
|
2
2
|
import { DatePickerProps } from './type';
|
|
3
3
|
import './ReadPretty.less';
|
|
4
|
-
declare const DatePickerReadPretty:
|
|
4
|
+
declare const DatePickerReadPretty: FC<DatePickerProps>;
|
|
5
5
|
export default DatePickerReadPretty;
|
|
@@ -35,9 +35,43 @@ module.exports = __toCommonJS(ReadPretty_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_classnames = __toESM(require("classnames"));
|
|
37
37
|
var import_dayjs = __toESM(require("dayjs"));
|
|
38
|
+
var import_usePisellConfig = __toESM(require("../../../pisell-config-provider/hooks/usePisellConfig"));
|
|
38
39
|
var import_ReadPretty = require("./ReadPretty.less");
|
|
39
|
-
var
|
|
40
|
-
|
|
40
|
+
var DEFAULT_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
41
|
+
var DATE_FORMATS = {
|
|
42
|
+
"zh-CN": {
|
|
43
|
+
withTime: "YYYY-MM-DD HH:mm:ss",
|
|
44
|
+
withoutTime: "YYYY-MM-DD"
|
|
45
|
+
},
|
|
46
|
+
"en-US": {
|
|
47
|
+
withTime: "HH:mm:ss YYYY-MM-DD",
|
|
48
|
+
withoutTime: "YYYY-MM-DD"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var DatePickerReadPretty = ({ value, renderMode, showTime }) => {
|
|
52
|
+
const { locale = "zh-CN" } = (0, import_usePisellConfig.default)();
|
|
53
|
+
const dateFormat = (0, import_react.useMemo)(() => {
|
|
54
|
+
if (locale in DATE_FORMATS) {
|
|
55
|
+
const formats = DATE_FORMATS[locale];
|
|
56
|
+
return showTime ? formats.withTime : formats.withoutTime;
|
|
57
|
+
}
|
|
58
|
+
if (process.env.NODE_ENV !== "production") {
|
|
59
|
+
console.warn(`Unsupported locale: ${locale}, falling back to default format`);
|
|
60
|
+
}
|
|
61
|
+
return DEFAULT_FORMAT;
|
|
62
|
+
}, [locale, showTime]);
|
|
63
|
+
const formattedDate = (0, import_react.useMemo)(() => {
|
|
64
|
+
if (!value)
|
|
65
|
+
return "";
|
|
66
|
+
try {
|
|
67
|
+
return (0, import_dayjs.default)(value).format(dateFormat);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (process.env.NODE_ENV !== "production") {
|
|
70
|
+
console.error("Error formatting date:", error);
|
|
71
|
+
}
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
}, [value, dateFormat]);
|
|
41
75
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
42
76
|
"span",
|
|
43
77
|
{
|
|
@@ -45,7 +79,7 @@ var DatePickerReadPretty = (props) => {
|
|
|
45
79
|
"pisell-date-picker-read-pretty-table-view": renderMode === "tableView"
|
|
46
80
|
})
|
|
47
81
|
},
|
|
48
|
-
|
|
82
|
+
formattedDate
|
|
49
83
|
);
|
|
50
84
|
};
|
|
51
85
|
var ReadPretty_default = DatePickerReadPretty;
|
|
@@ -43,7 +43,7 @@ var DatePickerWithMode = (0, import_utils2.withMode)(
|
|
|
43
43
|
(props) => {
|
|
44
44
|
return {
|
|
45
45
|
...props,
|
|
46
|
-
value: (0, import_utils.isString)(props.value) ? (0, import_dayjs.default)(props.value) : props.value
|
|
46
|
+
value: (0, import_utils.isString)(props.value) && props.value ? (0, import_dayjs.default)(props.value) : props.value
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
);
|
|
@@ -81,7 +81,8 @@ var DatePickerCpt = (props) => {
|
|
|
81
81
|
setValue(value);
|
|
82
82
|
}, [value]);
|
|
83
83
|
(0, import_react.useEffect)(() => {
|
|
84
|
-
|
|
84
|
+
var _a;
|
|
85
|
+
setValueStr(((_a = _value == null ? void 0 : _value.format) == null ? void 0 : _a.call(_value, format || "YYYY-MM-DD")) || "");
|
|
85
86
|
}, [_value]);
|
|
86
87
|
const customPresetItems = (0, import_react.useMemo)(() => {
|
|
87
88
|
const preset = [
|
|
@@ -229,6 +230,7 @@ var DatePickerCpt = (props) => {
|
|
|
229
230
|
);
|
|
230
231
|
};
|
|
231
232
|
const timeInputProps = (0, import_react.useMemo)(() => {
|
|
233
|
+
var _a;
|
|
232
234
|
let step = 1;
|
|
233
235
|
let _format = "";
|
|
234
236
|
if ((showTime == null ? void 0 : showTime.format) === "HH:mm") {
|
|
@@ -244,7 +246,7 @@ var DatePickerCpt = (props) => {
|
|
|
244
246
|
const val = e.target.value;
|
|
245
247
|
handleTimeChange(window.dayjs(val, _format));
|
|
246
248
|
},
|
|
247
|
-
value: _value == null ? void 0 : _value.format(_format)
|
|
249
|
+
value: (_a = _value == null ? void 0 : _value.format) == null ? void 0 : _a.call(_value, _format)
|
|
248
250
|
};
|
|
249
251
|
}, [showTime, _value]);
|
|
250
252
|
if (!picker || picker === "date") {
|