@pisell/materials 1.0.629 → 1.0.631
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 +1 -1
- package/build/lowcode/preview.js +12 -20
- package/build/lowcode/render/default/view.js +23 -28
- package/build/lowcode/view.js +21 -26
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +4 -3
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +2 -0
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +58 -0
- package/es/components/dataSourceComponents/dataSourceMenu/index.js +33 -6
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +2 -0
- package/es/components/pisellMenu/PisellMenu.d.ts +2 -2
- package/es/components/pisellMenu/PisellMenu.js +11 -5
- package/es/components/pisellMenu/types.d.ts +6 -10
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +4 -2
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +2 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +89 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/index.js +27 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +2 -0
- package/lib/components/pisellMenu/PisellMenu.d.ts +2 -2
- package/lib/components/pisellMenu/PisellMenu.js +11 -4
- package/lib/components/pisellMenu/types.d.ts +6 -10
- package/lowcode/_utils/defaultSchema.ts +15 -0
- package/lowcode/data-source-menu/meta.ts +66 -6
- package/package.json +3 -3
|
@@ -45,6 +45,7 @@ export declare const withOptions: <P extends unknown>(WrappedComponent: React.Co
|
|
|
45
45
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
46
46
|
labelField: string;
|
|
47
47
|
valueField: string;
|
|
48
|
+
extraParams?: Record<string, any> | undefined;
|
|
48
49
|
}) => React.JSX.Element;
|
|
49
50
|
export declare const getNestedValue: (obj: Record<string, any>, path: string) => Record<string, any>;
|
|
50
51
|
export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>, renderMode?: ModeType) => React.JSX.Element | null;
|
|
@@ -368,15 +368,16 @@ export var withOptions = function withOptions(WrappedComponent) {
|
|
|
368
368
|
var propsOptions = props.options,
|
|
369
369
|
optionSourceType = props.optionSourceType,
|
|
370
370
|
labelField = props.labelField,
|
|
371
|
-
valueField = props.valueField
|
|
371
|
+
valueField = props.valueField,
|
|
372
|
+
extraParams = props.extraParams;
|
|
372
373
|
var _useDataSource2 = useDataSource(),
|
|
373
374
|
list = _useDataSource2.list;
|
|
374
375
|
useEffect(function () {
|
|
375
376
|
if (optionSourceType === 'api') {
|
|
376
|
-
list.run({
|
|
377
|
+
list.run(_objectSpread({
|
|
377
378
|
page: 1,
|
|
378
379
|
pageSize: 200
|
|
379
|
-
});
|
|
380
|
+
}, extraParams));
|
|
380
381
|
}
|
|
381
382
|
}, []);
|
|
382
383
|
var options = useMemo(function () {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import BaseMenu from "../../pisellMenu";
|
|
4
|
+
/**
|
|
5
|
+
* @title: 数据源表单组件
|
|
6
|
+
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
7
|
+
*/
|
|
8
|
+
var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
9
|
+
var _window$app$menuManag = window.app.menuManager.useMenu(),
|
|
10
|
+
menuItems = _window$app$menuManag.menuItems,
|
|
11
|
+
selectedKeys = _window$app$menuManag.selectedKeys,
|
|
12
|
+
openKeys = _window$app$menuManag.openKeys,
|
|
13
|
+
setOpenKeys = _window$app$menuManag.setOpenKeys,
|
|
14
|
+
getShowChildren = _window$app$menuManag.getShowChildren,
|
|
15
|
+
handleClick = _window$app$menuManag.handleClick;
|
|
16
|
+
|
|
17
|
+
// 递归渲染菜单项
|
|
18
|
+
var renderMenuItems = function renderMenuItems(items) {
|
|
19
|
+
return items.map(function (item) {
|
|
20
|
+
if (item.hide) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
var _children = getShowChildren(item.children || []);
|
|
24
|
+
if (_children !== null && _children !== void 0 && _children.length) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(BaseMenu.SubMenu, {
|
|
26
|
+
key: item.key,
|
|
27
|
+
title: item.label,
|
|
28
|
+
icon: item.icon,
|
|
29
|
+
router: item.path
|
|
30
|
+
}, renderMenuItems(_children));
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.createElement(BaseMenu.Item, {
|
|
33
|
+
key: item.key,
|
|
34
|
+
icon: item.icon,
|
|
35
|
+
router: item.path
|
|
36
|
+
}, item.label);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/React.createElement(BaseMenu, _extends({
|
|
40
|
+
ref: ref,
|
|
41
|
+
mode: "inline"
|
|
42
|
+
// theme="dark"
|
|
43
|
+
,
|
|
44
|
+
selectedKeys: selectedKeys,
|
|
45
|
+
openKeys: openKeys,
|
|
46
|
+
onOpenChange: setOpenKeys,
|
|
47
|
+
onClick: function onClick(_ref) {
|
|
48
|
+
var _item$props;
|
|
49
|
+
var item = _ref.item;
|
|
50
|
+
handleClick((_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.router);
|
|
51
|
+
}
|
|
52
|
+
}, props, {
|
|
53
|
+
other: {
|
|
54
|
+
dataSource: undefined
|
|
55
|
+
}
|
|
56
|
+
}), renderMenuItems(menuItems));
|
|
57
|
+
});
|
|
58
|
+
export default DataSourceMenu;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
|
+
import PisellMenu from "../../pisellMenu";
|
|
4
4
|
import useVariables from "../hooks/useVariables";
|
|
5
|
-
|
|
5
|
+
import BaseMenu from "./Basic";
|
|
6
6
|
/**
|
|
7
7
|
* @title: 数据源表单组件
|
|
8
8
|
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
@@ -11,9 +11,36 @@ var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
11
11
|
var dataSource = props.dataSource;
|
|
12
12
|
var _useVariables = useVariables(),
|
|
13
13
|
parseVariable = _useVariables.parseVariable;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
var _dataSource = useMemo(function () {
|
|
15
|
+
if (Array.isArray(dataSource)) {
|
|
16
|
+
return dataSource;
|
|
17
|
+
}
|
|
18
|
+
if (props.__designMode === 'design') {
|
|
19
|
+
return [{
|
|
20
|
+
label: '菜单项1',
|
|
21
|
+
key: 'item-1'
|
|
22
|
+
}, {
|
|
23
|
+
label: '菜单项2',
|
|
24
|
+
key: 'item-2'
|
|
25
|
+
}];
|
|
26
|
+
}
|
|
27
|
+
if (typeof dataSource === 'string') {
|
|
28
|
+
return parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(dataSource);
|
|
29
|
+
}
|
|
30
|
+
return [];
|
|
31
|
+
}, [dataSource]);
|
|
32
|
+
|
|
33
|
+
// 设计模式下使用PisellMenu, 否则缺少app注入导致报错
|
|
34
|
+
if (props.__designMode === 'design') {
|
|
35
|
+
return /*#__PURE__*/React.createElement(PisellMenu, _extends({
|
|
36
|
+
ref: ref
|
|
37
|
+
}, props));
|
|
38
|
+
}
|
|
39
|
+
var MenuProvider = window.app.menuManager.MenuProvider;
|
|
40
|
+
return /*#__PURE__*/React.createElement(MenuProvider, {
|
|
41
|
+
menus: _dataSource
|
|
42
|
+
}, /*#__PURE__*/React.createElement(BaseMenu, _extends({
|
|
16
43
|
ref: ref
|
|
17
|
-
}));
|
|
44
|
+
}, props)));
|
|
18
45
|
});
|
|
19
46
|
export default DataSourceMenu;
|
|
@@ -4,6 +4,7 @@ declare const SelectWithDataSource: (props: import("antd").SelectProps<any, impo
|
|
|
4
4
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
5
5
|
labelField: string;
|
|
6
6
|
valueField: string;
|
|
7
|
+
extraParams?: Record<string, any> | undefined;
|
|
7
8
|
} & {
|
|
8
9
|
dataSource?: any;
|
|
9
10
|
}) => React.JSX.Element;
|
|
@@ -38,6 +38,7 @@ declare const formFieldMap: {
|
|
|
38
38
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
39
39
|
labelField: string;
|
|
40
40
|
valueField: string;
|
|
41
|
+
extraParams?: Record<string, any> | undefined;
|
|
41
42
|
} & {
|
|
42
43
|
dataSource?: any;
|
|
43
44
|
}) => import("react").JSX.Element;
|
|
@@ -94,6 +95,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
94
95
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
95
96
|
labelField: string;
|
|
96
97
|
valueField: string;
|
|
98
|
+
extraParams?: Record<string, any> | undefined;
|
|
97
99
|
} & {
|
|
98
100
|
dataSource?: any;
|
|
99
101
|
}) => import("react").JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './PisellMenu.less';
|
|
3
3
|
import type { PisellMenuProps } from './types';
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<PisellMenuProps & React.RefAttributes<unknown>>;
|
|
5
|
+
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
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; }
|
|
5
5
|
import { Menu as AntdMenu } from 'antd';
|
|
6
|
-
import React, { useMemo } from 'react';
|
|
6
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
7
7
|
import "./PisellMenu.less";
|
|
8
|
-
var PisellMenu = function PisellMenu(_ref) {
|
|
8
|
+
var PisellMenu = function PisellMenu(_ref, ref) {
|
|
9
9
|
var className = _ref.className,
|
|
10
10
|
style = _ref.style,
|
|
11
11
|
_ref$mode = _ref.mode,
|
|
@@ -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)) {
|
|
@@ -50,6 +52,10 @@ var PisellMenu = function PisellMenu(_ref) {
|
|
|
50
52
|
selectedKeys: selectedKeys,
|
|
51
53
|
onOpenChange: onOpenChange,
|
|
52
54
|
onSelect: onSelect
|
|
53
|
-
}, restProps
|
|
55
|
+
}, restProps, other, {
|
|
56
|
+
ref: ref
|
|
57
|
+
}), children);
|
|
54
58
|
};
|
|
55
|
-
|
|
59
|
+
PisellMenu.Item = AntdMenu.Item;
|
|
60
|
+
PisellMenu.SubMenu = AntdMenu.SubMenu;
|
|
61
|
+
export default /*#__PURE__*/forwardRef(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
|
}
|
|
@@ -45,6 +45,7 @@ export declare const withOptions: <P extends unknown>(WrappedComponent: React.Co
|
|
|
45
45
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
46
46
|
labelField: string;
|
|
47
47
|
valueField: string;
|
|
48
|
+
extraParams?: Record<string, any> | undefined;
|
|
48
49
|
}) => React.JSX.Element;
|
|
49
50
|
export declare const getNestedValue: (obj: Record<string, any>, path: string) => Record<string, any>;
|
|
50
51
|
export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>, renderMode?: ModeType) => React.JSX.Element | null;
|
|
@@ -414,14 +414,16 @@ var withOptions = (WrappedComponent) => {
|
|
|
414
414
|
options: propsOptions,
|
|
415
415
|
optionSourceType,
|
|
416
416
|
labelField,
|
|
417
|
-
valueField
|
|
417
|
+
valueField,
|
|
418
|
+
extraParams
|
|
418
419
|
} = props;
|
|
419
420
|
const { list } = (0, import_useDataSource.default)();
|
|
420
421
|
(0, import_react.useEffect)(() => {
|
|
421
422
|
if (optionSourceType === "api") {
|
|
422
423
|
list.run({
|
|
423
424
|
page: 1,
|
|
424
|
-
pageSize: 200
|
|
425
|
+
pageSize: 200,
|
|
426
|
+
...extraParams
|
|
425
427
|
});
|
|
426
428
|
}
|
|
427
429
|
}, []);
|
|
@@ -0,0 +1,89 @@
|
|
|
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_pisellMenu = __toESM(require("../../pisellMenu"));
|
|
37
|
+
var DataSourceMenu = (0, import_react.forwardRef)(
|
|
38
|
+
(props, ref) => {
|
|
39
|
+
const {
|
|
40
|
+
menuItems,
|
|
41
|
+
selectedKeys,
|
|
42
|
+
openKeys,
|
|
43
|
+
setOpenKeys,
|
|
44
|
+
getShowChildren,
|
|
45
|
+
handleClick
|
|
46
|
+
} = window.app.menuManager.useMenu();
|
|
47
|
+
const renderMenuItems = (items) => {
|
|
48
|
+
return items.map((item) => {
|
|
49
|
+
if (item.hide) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const _children = getShowChildren(item.children || []);
|
|
53
|
+
if (_children == null ? void 0 : _children.length) {
|
|
54
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
55
|
+
import_pisellMenu.default.SubMenu,
|
|
56
|
+
{
|
|
57
|
+
key: item.key,
|
|
58
|
+
title: item.label,
|
|
59
|
+
icon: item.icon,
|
|
60
|
+
router: item.path
|
|
61
|
+
},
|
|
62
|
+
renderMenuItems(_children)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default.Item, { key: item.key, icon: item.icon, router: item.path }, item.label);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
69
|
+
import_pisellMenu.default,
|
|
70
|
+
{
|
|
71
|
+
ref,
|
|
72
|
+
mode: "inline",
|
|
73
|
+
selectedKeys,
|
|
74
|
+
openKeys,
|
|
75
|
+
onOpenChange: setOpenKeys,
|
|
76
|
+
onClick: ({ item }) => {
|
|
77
|
+
var _a;
|
|
78
|
+
handleClick((_a = item.props) == null ? void 0 : _a.router);
|
|
79
|
+
},
|
|
80
|
+
...props,
|
|
81
|
+
other: {
|
|
82
|
+
dataSource: void 0
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
renderMenuItems(menuItems)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
var Basic_default = DataSourceMenu;
|
|
@@ -35,11 +35,37 @@ module.exports = __toCommonJS(dataSourceMenu_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_pisellMenu = __toESM(require("../../pisellMenu"));
|
|
37
37
|
var import_useVariables = __toESM(require("../hooks/useVariables"));
|
|
38
|
+
var import_Basic = __toESM(require("./Basic"));
|
|
38
39
|
var DataSourceMenu = (0, import_react.forwardRef)(
|
|
39
40
|
(props, ref) => {
|
|
40
41
|
const { dataSource } = props;
|
|
41
42
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
42
|
-
|
|
43
|
+
const _dataSource = (0, import_react.useMemo)(() => {
|
|
44
|
+
if (Array.isArray(dataSource)) {
|
|
45
|
+
return dataSource;
|
|
46
|
+
}
|
|
47
|
+
if (props.__designMode === "design") {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
label: "菜单项1",
|
|
51
|
+
key: "item-1"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: "菜单项2",
|
|
55
|
+
key: "item-2"
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
if (typeof dataSource === "string") {
|
|
60
|
+
return parseVariable == null ? void 0 : parseVariable(dataSource);
|
|
61
|
+
}
|
|
62
|
+
return [];
|
|
63
|
+
}, [dataSource]);
|
|
64
|
+
if (props.__designMode === "design") {
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default, { ref, ...props });
|
|
66
|
+
}
|
|
67
|
+
const MenuProvider = window.app.menuManager.MenuProvider;
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(MenuProvider, { menus: _dataSource }, /* @__PURE__ */ import_react.default.createElement(import_Basic.default, { ref, ...props }));
|
|
43
69
|
}
|
|
44
70
|
);
|
|
45
71
|
var dataSourceMenu_default = DataSourceMenu;
|
|
@@ -4,6 +4,7 @@ declare const SelectWithDataSource: (props: import("antd").SelectProps<any, impo
|
|
|
4
4
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
5
5
|
labelField: string;
|
|
6
6
|
valueField: string;
|
|
7
|
+
extraParams?: Record<string, any> | undefined;
|
|
7
8
|
} & {
|
|
8
9
|
dataSource?: any;
|
|
9
10
|
}) => React.JSX.Element;
|
|
@@ -38,6 +38,7 @@ declare const formFieldMap: {
|
|
|
38
38
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
39
39
|
labelField: string;
|
|
40
40
|
valueField: string;
|
|
41
|
+
extraParams?: Record<string, any> | undefined;
|
|
41
42
|
} & {
|
|
42
43
|
dataSource?: any;
|
|
43
44
|
}) => import("react").JSX.Element;
|
|
@@ -94,6 +95,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
94
95
|
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
95
96
|
labelField: string;
|
|
96
97
|
valueField: string;
|
|
98
|
+
extraParams?: Record<string, any> | undefined;
|
|
97
99
|
} & {
|
|
98
100
|
dataSource?: any;
|
|
99
101
|
}) => import("react").JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './PisellMenu.less';
|
|
3
3
|
import type { PisellMenuProps } from './types';
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<PisellMenuProps & React.RefAttributes<unknown>>;
|
|
5
|
+
export default _default;
|
|
@@ -49,8 +49,10 @@ var PisellMenu = ({
|
|
|
49
49
|
onSelect,
|
|
50
50
|
dataSource,
|
|
51
51
|
__designMode,
|
|
52
|
+
children,
|
|
53
|
+
other,
|
|
52
54
|
...restProps
|
|
53
|
-
}) => {
|
|
55
|
+
}, ref) => {
|
|
54
56
|
const _dataSource = (0, import_react.useMemo)(() => {
|
|
55
57
|
if (Array.isArray(dataSource)) {
|
|
56
58
|
return dataSource;
|
|
@@ -84,8 +86,13 @@ var PisellMenu = ({
|
|
|
84
86
|
selectedKeys,
|
|
85
87
|
onOpenChange,
|
|
86
88
|
onSelect,
|
|
87
|
-
...restProps
|
|
88
|
-
|
|
89
|
+
...restProps,
|
|
90
|
+
...other,
|
|
91
|
+
ref
|
|
92
|
+
},
|
|
93
|
+
children
|
|
89
94
|
);
|
|
90
95
|
};
|
|
91
|
-
|
|
96
|
+
PisellMenu.Item = import_antd.Menu.Item;
|
|
97
|
+
PisellMenu.SubMenu = import_antd.Menu.SubMenu;
|
|
98
|
+
var PisellMenu_default = (0, import_react.forwardRef)(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
|
}
|
|
@@ -733,6 +733,21 @@ export const formItemGeneralOptionTypeGroup = {
|
|
|
733
733
|
},
|
|
734
734
|
},
|
|
735
735
|
},
|
|
736
|
+
{
|
|
737
|
+
name: 'extraParams',
|
|
738
|
+
condition: (target: any) => {
|
|
739
|
+
const optionSourceType = target
|
|
740
|
+
.getProps()
|
|
741
|
+
.getPropValue('optionSourceType');
|
|
742
|
+
return optionSourceType === 'api';
|
|
743
|
+
},
|
|
744
|
+
title: {
|
|
745
|
+
type: 'i18n',
|
|
746
|
+
'en-US': 'Extra Params',
|
|
747
|
+
'zh-CN': '额外参数',
|
|
748
|
+
},
|
|
749
|
+
setter: 'JsonSetter'
|
|
750
|
+
},
|
|
736
751
|
{
|
|
737
752
|
name: 'labelField',
|
|
738
753
|
condition: (target: any) => {
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
defaultOpenKeys,
|
|
6
|
+
defaultSelectedKeys,
|
|
7
|
+
inlineCollapsed,
|
|
8
|
+
openKeys,
|
|
9
|
+
selectedKeys,
|
|
10
|
+
onOpenChange,
|
|
11
|
+
onSelect,
|
|
12
|
+
dataSource,
|
|
13
|
+
__designMode,
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
3
16
|
const DataSourceMenuMeta: IPublicTypeComponentMetadata = {
|
|
4
17
|
componentName: 'DataSourceMenu',
|
|
5
18
|
title: '菜单导航',
|
|
@@ -78,15 +91,52 @@ const DataSourceMenuMeta: IPublicTypeComponentMetadata = {
|
|
|
78
91
|
}
|
|
79
92
|
},
|
|
80
93
|
{
|
|
81
|
-
name: '
|
|
82
|
-
propType: '
|
|
83
|
-
description: '
|
|
84
|
-
|
|
94
|
+
name: 'defaultOpenKeys',
|
|
95
|
+
propType: 'array',
|
|
96
|
+
description: '默认展开的菜单项',
|
|
97
|
+
defaultValue: [],
|
|
98
|
+
setter: 'JsonSetter'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'defaultSelectedKeys',
|
|
102
|
+
propType: 'array',
|
|
103
|
+
description: '默认选中的菜单项',
|
|
104
|
+
defaultValue: [],
|
|
105
|
+
setter: 'JsonSetter'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'inlineCollapsed',
|
|
109
|
+
propType: "bool",
|
|
110
|
+
description: '是否内嵌折叠',
|
|
111
|
+
defaultValue: false,
|
|
112
|
+
setter: 'BoolSetter'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'openKeys',
|
|
116
|
+
propType: 'array',
|
|
117
|
+
description: '展开的菜单项',
|
|
118
|
+
defaultValue: [],
|
|
119
|
+
setter: 'JsonSetter'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'selectedKeys',
|
|
123
|
+
propType: 'array',
|
|
124
|
+
description: '选中的菜单项',
|
|
125
|
+
defaultValue: [],
|
|
126
|
+
setter: 'JsonSetter'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'other',
|
|
130
|
+
propType: 'object',
|
|
131
|
+
description: '其他属性',
|
|
132
|
+
defaultValue: {},
|
|
133
|
+
setter: 'JsonSetter'
|
|
85
134
|
},
|
|
86
135
|
{
|
|
87
136
|
name: 'style',
|
|
88
137
|
propType: 'object',
|
|
89
138
|
description: '样式',
|
|
139
|
+
defaultValue: {},
|
|
90
140
|
setter: 'StyleSetter'
|
|
91
141
|
}
|
|
92
142
|
],
|
|
@@ -96,8 +146,18 @@ const DataSourceMenuMeta: IPublicTypeComponentMetadata = {
|
|
|
96
146
|
},
|
|
97
147
|
supports: {
|
|
98
148
|
style: true,
|
|
99
|
-
className: true
|
|
100
|
-
|
|
149
|
+
className: true,
|
|
150
|
+
events: [
|
|
151
|
+
{
|
|
152
|
+
name: 'onOpenChange',
|
|
153
|
+
template: "onOpenChange(openKeys,${extParams}){\n// 展开菜单项变化时的回调\nconsole.log('onOpenChange', openKeys);}",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'onSelect',
|
|
157
|
+
template: "onSelect(selectedKeys,${extParams}){\n// 选中菜单项时的回调\nconsole.log('onSelect', selectedKeys);}",
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
101
161
|
}
|
|
102
162
|
};
|
|
103
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.631",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"swiper": "^8.4.7",
|
|
71
71
|
"react-barcode": "^1.5.3",
|
|
72
72
|
"vod-js-sdk-v6": "^1.4.11",
|
|
73
|
+
"@pisell/date-picker": "1.0.115",
|
|
73
74
|
"@pisell/icon": "0.0.10",
|
|
74
|
-
"@pisell/utils": "1.0.43"
|
|
75
|
-
"@pisell/date-picker": "1.0.115"
|
|
75
|
+
"@pisell/utils": "1.0.43"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"react": "^18.0.0",
|