@pisell/materials 6.0.12 → 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 +11 -11
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- 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/dataSourceForm/utils.js +6 -9
- 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/useDrawerState.d.ts +2 -2
- 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/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- 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/fields/Input.Subdomain/WithMode.js +4 -2
- package/es/components/dataSourceComponents/fields/index.d.ts +1 -1
- 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/components/table/Table/utils.d.ts +1 -1
- 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/dataSourceForm/utils.js +0 -6
- 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/useDrawerState.d.ts +2 -2
- 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/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- 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/fields/Input.Subdomain/WithMode.js +2 -2
- package/lib/components/dataSourceComponents/fields/index.d.ts +1 -1
- 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/components/table/Table/utils.d.ts +1 -1
- package/lib/hooks/useEngineContext.js +6 -0
- package/lowcode/data-source-menu/meta.ts +66 -6
- package/lowcode/form-item-translation/meta.ts +59 -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
|
@@ -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) => {
|
|
@@ -17,7 +17,7 @@ interface UseTablePropsProps {
|
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
declare const useTableProps: (props: UseTablePropsProps) => {
|
|
20
|
-
title: number | boolean | React.
|
|
20
|
+
title: number | boolean | Iterable<React.ReactNode> | React.JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
21
21
|
pagination: {
|
|
22
22
|
total: number;
|
|
23
23
|
current: number;
|
|
@@ -26,7 +26,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
26
26
|
showSizeChanger: boolean;
|
|
27
27
|
};
|
|
28
28
|
columns: import("./useColumns").Column[];
|
|
29
|
-
subTitle: number | boolean | React.
|
|
29
|
+
subTitle: number | boolean | Iterable<React.ReactNode> | React.JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: React.JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
@@ -65,7 +65,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
65
65
|
useCustomAction: boolean;
|
|
66
66
|
actionType: string;
|
|
67
67
|
openMode: "modal" | "drawer";
|
|
68
|
-
openContentSize: "small" | "
|
|
68
|
+
openContentSize: "small" | "large" | "middle";
|
|
69
69
|
openTitle: string;
|
|
70
70
|
key: string;
|
|
71
71
|
} | undefined;
|
|
@@ -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
|
);
|
|
@@ -132,7 +132,7 @@ var Subdomain = (props) => {
|
|
|
132
132
|
const inputValue = e.target.value.toLowerCase();
|
|
133
133
|
const { subdomain: newSubdomain } = parseExternalValue(inputValue);
|
|
134
134
|
setSubdomain(newSubdomain);
|
|
135
|
-
propsOnChange == null ? void 0 : propsOnChange(newSubdomain + suffix);
|
|
135
|
+
propsOnChange == null ? void 0 : propsOnChange(newSubdomain ? newSubdomain + suffix : "");
|
|
136
136
|
} catch (error) {
|
|
137
137
|
console.error("Error handling change:", error);
|
|
138
138
|
}
|
|
@@ -140,7 +140,7 @@ var Subdomain = (props) => {
|
|
|
140
140
|
const onBlur = (0, import_react.useCallback)((e) => {
|
|
141
141
|
try {
|
|
142
142
|
propsOnBlur == null ? void 0 : propsOnBlur(e);
|
|
143
|
-
propsOnChange == null ? void 0 : propsOnChange(subdomain + suffix);
|
|
143
|
+
propsOnChange == null ? void 0 : propsOnChange(subdomain ? subdomain + suffix : "");
|
|
144
144
|
} catch (error) {
|
|
145
145
|
console.error("Error handling blur:", error);
|
|
146
146
|
}
|
|
@@ -58,7 +58,7 @@ declare const formFieldMap: {
|
|
|
58
58
|
FormItemUpload: import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
59
59
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
60
60
|
};
|
|
61
|
-
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
61
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<any> | (import("react").FC<{}> & {
|
|
62
62
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
63
63
|
} & {
|
|
64
64
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -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") {
|
|
@@ -17,5 +17,6 @@ export interface Props extends Omit<HTMLAttributes<HTMLLIElement>, 'id'> {
|
|
|
17
17
|
wrapperRef?(node: HTMLLIElement): void;
|
|
18
18
|
item: TreeItemType;
|
|
19
19
|
renderItem?(item: TreeItemType): React.ReactNode;
|
|
20
|
+
isBlocked?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare const TreeItem: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -21,7 +21,9 @@ interface Props {
|
|
|
21
21
|
onChange?: (items: TreeItems) => void;
|
|
22
22
|
/** 删除节点前 */
|
|
23
23
|
onRemoveBefore?: (item: TreeItem) => Promise<boolean>;
|
|
24
|
+
/** 最大层级 */
|
|
25
|
+
maxLevel?: number;
|
|
24
26
|
}
|
|
25
|
-
export declare function SortableTree({ collapsible, value, indicator, indentationWidth, removable, renderItem, onChange, onRemoveBefore, }: Props): React.JSX.Element;
|
|
27
|
+
export declare function SortableTree({ collapsible, value, indicator, indentationWidth, removable, renderItem, onChange, onRemoveBefore, maxLevel, }: Props): React.JSX.Element;
|
|
26
28
|
declare const Demo: () => React.JSX.Element;
|
|
27
29
|
export default Demo;
|
|
@@ -51,7 +51,7 @@ var initialItems = [
|
|
|
51
51
|
{ id: "Spring", children: [] },
|
|
52
52
|
{ id: "Summer", children: [] },
|
|
53
53
|
{ id: "Fall", children: [] },
|
|
54
|
-
{ id: "Winter", children: [] }
|
|
54
|
+
{ id: "Winter", children: [], disabledDrop: true }
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
{
|
|
@@ -101,7 +101,8 @@ function SortableTree({
|
|
|
101
101
|
removable = true,
|
|
102
102
|
renderItem,
|
|
103
103
|
onChange,
|
|
104
|
-
onRemoveBefore
|
|
104
|
+
onRemoveBefore,
|
|
105
|
+
maxLevel = 3
|
|
105
106
|
}) {
|
|
106
107
|
const [items, setItems] = (0, import_react.useState)([]);
|
|
107
108
|
const [activeId, setActiveId] = (0, import_react.useState)(null);
|
|
@@ -111,17 +112,20 @@ function SortableTree({
|
|
|
111
112
|
console.log("初始化", value);
|
|
112
113
|
setItems(value);
|
|
113
114
|
}, [value]);
|
|
115
|
+
const flattenTreeData = (0, import_react.useMemo)(() => {
|
|
116
|
+
return (0, import_utilities2.flattenTree)(items);
|
|
117
|
+
}, [items]);
|
|
114
118
|
const flattenedItems = (0, import_react.useMemo)(() => {
|
|
115
|
-
const
|
|
116
|
-
const collapsedItems = flattenedTree.reduce(
|
|
119
|
+
const collapsedItems = flattenTreeData.reduce(
|
|
117
120
|
(acc, { children, collapsed, id }) => collapsed && children.length ? [...acc, id] : acc,
|
|
118
121
|
[]
|
|
119
122
|
);
|
|
120
123
|
return (0, import_utilities2.removeChildrenOf)(
|
|
121
|
-
|
|
124
|
+
flattenTreeData,
|
|
122
125
|
activeId != null ? [activeId, ...collapsedItems] : collapsedItems
|
|
123
126
|
);
|
|
124
|
-
}, [activeId,
|
|
127
|
+
}, [activeId, flattenTreeData]);
|
|
128
|
+
console.log("flattenedItems", flattenedItems);
|
|
125
129
|
const projected = activeId && overId ? (0, import_utilities2.getProjection)(
|
|
126
130
|
flattenedItems,
|
|
127
131
|
activeId,
|
|
@@ -148,6 +152,20 @@ function SortableTree({
|
|
|
148
152
|
(0, import_react.useEffect)(() => {
|
|
149
153
|
document.body.id = "body";
|
|
150
154
|
}, []);
|
|
155
|
+
function checkSubtreeDepth(items2, itemId, baseDepth) {
|
|
156
|
+
const item = items2.find((i) => i.id === itemId);
|
|
157
|
+
if (!item)
|
|
158
|
+
return false;
|
|
159
|
+
if (baseDepth >= maxLevel)
|
|
160
|
+
return true;
|
|
161
|
+
const children = items2.filter((i) => i.parentId === itemId);
|
|
162
|
+
if (baseDepth >= maxLevel - 1 && children.length > 0)
|
|
163
|
+
return true;
|
|
164
|
+
return children.some((child) => {
|
|
165
|
+
const childNewDepth = baseDepth + 1;
|
|
166
|
+
return childNewDepth >= maxLevel || checkSubtreeDepth(items2, child.id, childNewDepth);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
151
169
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
152
170
|
import_core.DndContext,
|
|
153
171
|
{
|
|
@@ -209,12 +227,46 @@ function SortableTree({
|
|
|
209
227
|
setOffsetLeft(delta.x);
|
|
210
228
|
}
|
|
211
229
|
function handleDragOver({ over }) {
|
|
212
|
-
|
|
230
|
+
if (!projected || !over) {
|
|
231
|
+
setOverId((over == null ? void 0 : over.id) ?? null);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const targetParent = projected.parentId ? flattenedItems.find((item) => item.id === projected.parentId) : null;
|
|
235
|
+
if (targetParent == null ? void 0 : targetParent.disabledDrop) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (projected.depth >= maxLevel) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const willExceedLimit = checkSubtreeDepth(
|
|
242
|
+
flattenTreeData,
|
|
243
|
+
activeId,
|
|
244
|
+
projected.depth
|
|
245
|
+
);
|
|
246
|
+
if (willExceedLimit) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
setOverId(over.id);
|
|
213
250
|
}
|
|
214
251
|
function handleDragEnd({ active, over }) {
|
|
215
252
|
resetState();
|
|
216
253
|
if (projected && over) {
|
|
217
254
|
const { depth, parentId } = projected;
|
|
255
|
+
const targetParent = parentId ? flattenedItems.find((item) => item.id === parentId) : null;
|
|
256
|
+
if (targetParent == null ? void 0 : targetParent.disabledDrop) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (depth >= maxLevel) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const willExceedLimit = checkSubtreeDepth(
|
|
263
|
+
flattenTreeData,
|
|
264
|
+
active.id,
|
|
265
|
+
depth
|
|
266
|
+
);
|
|
267
|
+
if (willExceedLimit) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
218
270
|
const clonedItems = JSON.parse(
|
|
219
271
|
JSON.stringify((0, import_utilities2.flattenTree)(items))
|
|
220
272
|
);
|
|
@@ -3,6 +3,8 @@ import React from 'react';
|
|
|
3
3
|
export interface PisellContentProps extends Omit<LayoutProps, 'prefixCls'> {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
__designMode?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
scroll?: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare const PisellContent: React.FC<PisellContentProps>;
|
|
8
10
|
export default PisellContent;
|
|
@@ -33,18 +33,29 @@ __export(content_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(content_exports);
|
|
35
35
|
var import_antd = require("antd");
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
37
|
var import_react = __toESM(require("react"));
|
|
37
38
|
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
38
39
|
var { Content } = import_antd.Layout;
|
|
39
40
|
var PisellContent = (props) => {
|
|
40
|
-
const { children, ...rest } = props;
|
|
41
|
+
const { children, className, height, scroll, ...rest } = props;
|
|
41
42
|
const lowCodeProps = (0, import_useEngineContext.default)();
|
|
42
43
|
const pageContent = (0, import_react.useMemo)(() => {
|
|
44
|
+
var _a, _b;
|
|
43
45
|
if (props.__designMode === "design") {
|
|
44
46
|
return "Page content";
|
|
45
47
|
}
|
|
46
|
-
return lowCodeProps.children;
|
|
48
|
+
return (_b = (_a = lowCodeProps == null ? void 0 : lowCodeProps.engine) == null ? void 0 : _a.props) == null ? void 0 : _b.children;
|
|
47
49
|
}, [props.__designMode]);
|
|
48
|
-
|
|
50
|
+
const contentStyle = (0, import_react.useMemo)(() => {
|
|
51
|
+
return {
|
|
52
|
+
height,
|
|
53
|
+
...rest.style
|
|
54
|
+
};
|
|
55
|
+
}, [height, rest.style]);
|
|
56
|
+
const contentClassName = (0, import_classnames.default)("pisell-layout-content", className, {
|
|
57
|
+
"pisell-layout-content-scroll": scroll
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ import_react.default.createElement(Content, { ...rest, style: contentStyle, className: contentClassName }, children, pageContent);
|
|
49
60
|
};
|
|
50
61
|
var content_default = PisellContent;
|
|
@@ -2,6 +2,7 @@ import type { LayoutProps } from 'antd';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface PisellFooterProps extends Omit<LayoutProps, 'prefixCls'> {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
height?: number;
|
|
5
6
|
}
|
|
6
7
|
declare const PisellFooter: React.FC<PisellFooterProps>;
|
|
7
8
|
export default PisellFooter;
|
|
@@ -36,7 +36,13 @@ var import_antd = require("antd");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var { Footer } = import_antd.Layout;
|
|
38
38
|
var PisellFooter = (props) => {
|
|
39
|
-
const { children, ...rest } = props;
|
|
40
|
-
|
|
39
|
+
const { children, height, ...rest } = props;
|
|
40
|
+
const footerStyle = (0, import_react.useMemo)(() => {
|
|
41
|
+
return {
|
|
42
|
+
height,
|
|
43
|
+
...rest.style
|
|
44
|
+
};
|
|
45
|
+
}, [height, rest.style]);
|
|
46
|
+
return /* @__PURE__ */ import_react.default.createElement(Footer, { ...rest, style: footerStyle }, children);
|
|
41
47
|
};
|
|
42
48
|
var footer_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;
|
|
@@ -33,10 +33,21 @@ __export(header_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(header_exports);
|
|
35
35
|
var import_antd = require("antd");
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
37
|
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_index = require("./index.less");
|
|
37
39
|
var { Header } = import_antd.Layout;
|
|
38
40
|
var PisellHeader = (props) => {
|
|
39
|
-
const { children, ...rest } = props;
|
|
40
|
-
|
|
41
|
+
const { children, className, height, fixed, ...rest } = props;
|
|
42
|
+
const headerStyle = (0, import_react.useMemo)(() => {
|
|
43
|
+
return {
|
|
44
|
+
height,
|
|
45
|
+
...rest.style
|
|
46
|
+
};
|
|
47
|
+
}, [height, rest.style]);
|
|
48
|
+
const headerClassName = (0, import_classnames.default)("pisell-layout-header", className, {
|
|
49
|
+
// 'pisell-layout-header-fixed': fixed,
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ import_react.default.createElement(Header, { ...rest, style: headerStyle, className: headerClassName }, children);
|
|
41
52
|
};
|
|
42
53
|
var header_default = PisellHeader;
|
|
@@ -36,6 +36,9 @@ var import_antd = require("antd");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var PisellLayout = (props) => {
|
|
38
38
|
const { children, ...rest } = props;
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
document.body.id = "body";
|
|
41
|
+
}, []);
|
|
39
42
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Layout, { ...rest }, children);
|
|
40
43
|
};
|
|
41
44
|
PisellLayout.Header = import_antd.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
|
+
}
|
|
@@ -33,10 +33,38 @@ __export(sider_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sider_exports);
|
|
35
35
|
var import_antd = require("antd");
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
37
|
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_index = require("./index.less");
|
|
37
39
|
var { Sider } = import_antd.Layout;
|
|
38
40
|
var PisellSider = (props) => {
|
|
39
|
-
const { children, ...rest } = props;
|
|
40
|
-
|
|
41
|
+
const { children, collapsible, collapsed, onCollapse, ...rest } = props;
|
|
42
|
+
const [collapsedState, setCollapsedState] = (0, import_react.useState)(collapsed);
|
|
43
|
+
const className = (0, import_classnames.default)("pisell-layout-sider", props.className);
|
|
44
|
+
const _onCollapse = (val, type) => {
|
|
45
|
+
onCollapse == null ? void 0 : onCollapse(val, type);
|
|
46
|
+
setCollapsedState(val);
|
|
47
|
+
};
|
|
48
|
+
(0, import_react.useEffect)(() => {
|
|
49
|
+
setCollapsedState(collapsed);
|
|
50
|
+
}, [collapsed]);
|
|
51
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
52
|
+
Sider,
|
|
53
|
+
{
|
|
54
|
+
...rest,
|
|
55
|
+
collapsible,
|
|
56
|
+
collapsed: collapsedState,
|
|
57
|
+
onCollapse: _onCollapse,
|
|
58
|
+
className
|
|
59
|
+
},
|
|
60
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: "pisell-layout-sider-content",
|
|
64
|
+
style: { overflowY: "auto", height: "100%" }
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
)
|
|
68
|
+
);
|
|
41
69
|
};
|
|
42
70
|
var sider_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;
|
|
@@ -49,6 +49,8 @@ var PisellMenu = ({
|
|
|
49
49
|
onSelect,
|
|
50
50
|
dataSource,
|
|
51
51
|
__designMode,
|
|
52
|
+
children,
|
|
53
|
+
other,
|
|
52
54
|
...restProps
|
|
53
55
|
}) => {
|
|
54
56
|
const _dataSource = (0, import_react.useMemo)(() => {
|
|
@@ -59,11 +61,13 @@ var PisellMenu = ({
|
|
|
59
61
|
return [
|
|
60
62
|
{
|
|
61
63
|
label: "菜单项1",
|
|
62
|
-
key: "item-1"
|
|
64
|
+
key: "item-1",
|
|
65
|
+
path: "/item-1"
|
|
63
66
|
},
|
|
64
67
|
{
|
|
65
68
|
label: "菜单项2",
|
|
66
|
-
key: "item-2"
|
|
69
|
+
key: "item-2",
|
|
70
|
+
path: "/item-2"
|
|
67
71
|
}
|
|
68
72
|
];
|
|
69
73
|
}
|
|
@@ -84,8 +88,12 @@ var PisellMenu = ({
|
|
|
84
88
|
selectedKeys,
|
|
85
89
|
onOpenChange,
|
|
86
90
|
onSelect,
|
|
87
|
-
...restProps
|
|
88
|
-
|
|
91
|
+
...restProps,
|
|
92
|
+
...other
|
|
93
|
+
},
|
|
94
|
+
children
|
|
89
95
|
);
|
|
90
96
|
};
|
|
97
|
+
PisellMenu.Item = import_antd.Menu.Item;
|
|
98
|
+
PisellMenu.SubMenu = import_antd.Menu.SubMenu;
|
|
91
99
|
var PisellMenu_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
|
}
|
|
@@ -155,7 +155,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
155
155
|
sort?: SortType | undefined;
|
|
156
156
|
mode: "" | "localStorage" | "remote";
|
|
157
157
|
currentViewMode: ModeType;
|
|
158
|
-
}) => ("
|
|
158
|
+
}) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
|
|
159
159
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
160
160
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
161
161
|
export {};
|