@mijalowcode/materials 1.0.6 → 1.0.7
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/dist/index.js +97 -6
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Timeline, List, Descriptions, Typography, Checkbox, Radio, Dropdown, Avatar, Badge, DatePicker, Form, Input, Result, Statistic, Divider, Popover, Popconfirm, Tooltip, Skeleton, Progress, Alert, Spin,
|
|
1
|
+
import { Timeline, List, Descriptions, Typography, Checkbox, Radio, Dropdown, Avatar, Badge, DatePicker, Form, Input, Result, Statistic, Divider, Popover, Popconfirm, Tooltip, Skeleton, Progress, Alert, Spin, Modal, Table, Cascader, Switch, Pagination, Steps, Tabs, Tree, Upload, TimePicker, InputNumber, Select, Card, Col, Row, FilterColumns, Empty, Tag, message } from '@mijadesign/web';
|
|
2
2
|
import { Layout, Drawer, Button, Space, Descriptions as Descriptions$1, Modal as Modal$1, message as message$1 } from 'antd';
|
|
3
3
|
import { createContext, Children, isValidElement, useMemo, useCallback, useRef, useState, useEffect, cloneElement, useContext } from 'react';
|
|
4
4
|
import { ProTable, BetaSchemaForm } from '@ant-design/pro-components';
|
|
@@ -589,6 +589,24 @@ function SchemaFormWrapper({
|
|
|
589
589
|
);
|
|
590
590
|
}
|
|
591
591
|
var SchemaFormWrapper_default = SchemaFormWrapper;
|
|
592
|
+
function parsePattern(pattern) {
|
|
593
|
+
if (pattern instanceof RegExp || typeof pattern !== "string") {
|
|
594
|
+
return pattern;
|
|
595
|
+
}
|
|
596
|
+
const trimmedPattern = pattern.trim();
|
|
597
|
+
if (!trimmedPattern) {
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
try {
|
|
601
|
+
const slashPatternMatch = trimmedPattern.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
602
|
+
if (slashPatternMatch) {
|
|
603
|
+
return new RegExp(slashPatternMatch[1], slashPatternMatch[2]);
|
|
604
|
+
}
|
|
605
|
+
return new RegExp(trimmedPattern);
|
|
606
|
+
} catch {
|
|
607
|
+
return pattern;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
592
610
|
function FilterColumnsWrapper({
|
|
593
611
|
onSubmit,
|
|
594
612
|
onReset,
|
|
@@ -596,9 +614,55 @@ function FilterColumnsWrapper({
|
|
|
596
614
|
onEvent,
|
|
597
615
|
...rest
|
|
598
616
|
}) {
|
|
617
|
+
const formRef = useRef(void 0);
|
|
599
618
|
const emitEvent = useEventEmitter(onEvent);
|
|
619
|
+
const normalizedOptions = useMemo(() => {
|
|
620
|
+
if (!Array.isArray(rest.options)) {
|
|
621
|
+
return rest.options;
|
|
622
|
+
}
|
|
623
|
+
return rest.options.map((option) => {
|
|
624
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) {
|
|
625
|
+
return option;
|
|
626
|
+
}
|
|
627
|
+
const formItemProps = option.formItemProps;
|
|
628
|
+
if (!formItemProps || typeof formItemProps !== "object" || Array.isArray(formItemProps)) {
|
|
629
|
+
return option;
|
|
630
|
+
}
|
|
631
|
+
const rules = formItemProps.rules;
|
|
632
|
+
if (!Array.isArray(rules)) {
|
|
633
|
+
return option;
|
|
634
|
+
}
|
|
635
|
+
let hasPatternChanged = false;
|
|
636
|
+
const normalizedRules = rules.map((rule) => {
|
|
637
|
+
if (!rule || typeof rule !== "object" || Array.isArray(rule)) {
|
|
638
|
+
return rule;
|
|
639
|
+
}
|
|
640
|
+
const currentPattern = rule.pattern;
|
|
641
|
+
const nextPattern = parsePattern(currentPattern);
|
|
642
|
+
if (nextPattern === currentPattern) {
|
|
643
|
+
return rule;
|
|
644
|
+
}
|
|
645
|
+
hasPatternChanged = true;
|
|
646
|
+
return {
|
|
647
|
+
...rule,
|
|
648
|
+
pattern: nextPattern
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
if (!hasPatternChanged) {
|
|
652
|
+
return option;
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
...option,
|
|
656
|
+
formItemProps: {
|
|
657
|
+
...formItemProps,
|
|
658
|
+
rules: normalizedRules
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
});
|
|
662
|
+
}, [rest.options]);
|
|
600
663
|
const handleSubmit = useCallback(
|
|
601
|
-
(value, isReset) => {
|
|
664
|
+
async (value, isReset) => {
|
|
665
|
+
await formRef.current?.validateFields();
|
|
602
666
|
emitEvent("filterColumns.submit", {
|
|
603
667
|
value,
|
|
604
668
|
isReset: Boolean(isReset)
|
|
@@ -622,6 +686,8 @@ function FilterColumnsWrapper({
|
|
|
622
686
|
FilterColumns,
|
|
623
687
|
{
|
|
624
688
|
...rest,
|
|
689
|
+
options: normalizedOptions,
|
|
690
|
+
formRef,
|
|
625
691
|
onSubmit: handleSubmit,
|
|
626
692
|
onReset: handleReset,
|
|
627
693
|
onCollapsedChange: handleCollapsedChange
|
|
@@ -751,6 +817,13 @@ function DrawerWrapper(props) {
|
|
|
751
817
|
) });
|
|
752
818
|
}
|
|
753
819
|
var DrawerWrapper_default = DrawerWrapper;
|
|
820
|
+
function EmptyWrapper({ visible = true, ...props }) {
|
|
821
|
+
if (!visible) {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
return /* @__PURE__ */ jsx(Empty, { ...props });
|
|
825
|
+
}
|
|
826
|
+
var EmptyWrapper_default = EmptyWrapper;
|
|
754
827
|
function resolveTemplate2(template, record) {
|
|
755
828
|
let result = template;
|
|
756
829
|
Object.keys({}).forEach((key) => {
|
|
@@ -1160,7 +1233,7 @@ var componentMap = {
|
|
|
1160
1233
|
"Descriptions.Item": Descriptions.Item,
|
|
1161
1234
|
List,
|
|
1162
1235
|
"List.Item": List.Item,
|
|
1163
|
-
Empty,
|
|
1236
|
+
Empty: EmptyWrapper_default,
|
|
1164
1237
|
Spin,
|
|
1165
1238
|
Alert,
|
|
1166
1239
|
Progress,
|
|
@@ -2894,7 +2967,7 @@ var FilterColumnsMeta = {
|
|
|
2894
2967
|
name: "options",
|
|
2895
2968
|
label: "\u5B57\u6BB5\u914D\u7F6E",
|
|
2896
2969
|
// 使用字面量兜底,避免枚举运行时缓存导致的匹配失败
|
|
2897
|
-
type:
|
|
2970
|
+
type: PropType.FILTER_COLUMNS,
|
|
2898
2971
|
group: "\u6570\u636E",
|
|
2899
2972
|
defaultValue: []
|
|
2900
2973
|
},
|
|
@@ -5878,8 +5951,16 @@ var TypographyTextMeta = {
|
|
|
5878
5951
|
description: "\u6587\u672C",
|
|
5879
5952
|
category: ComponentCategory.DATA_DISPLAY,
|
|
5880
5953
|
icon: "FontSizeOutlined",
|
|
5881
|
-
|
|
5954
|
+
visibleInComponentPanel: true,
|
|
5882
5955
|
props: [
|
|
5956
|
+
{
|
|
5957
|
+
name: "children",
|
|
5958
|
+
label: "\u7C7B\u578B",
|
|
5959
|
+
type: PropType.STRING,
|
|
5960
|
+
bindable: true,
|
|
5961
|
+
defaultValue: "default",
|
|
5962
|
+
group: "\u57FA\u7840"
|
|
5963
|
+
},
|
|
5883
5964
|
{
|
|
5884
5965
|
name: "copyable",
|
|
5885
5966
|
label: "\u53EF\u590D\u5236",
|
|
@@ -6235,16 +6316,26 @@ var EmptyMeta = {
|
|
|
6235
6316
|
category: ComponentCategory.DATA_DISPLAY,
|
|
6236
6317
|
icon: "InboxOutlined",
|
|
6237
6318
|
canHaveChildren: false,
|
|
6319
|
+
visibleInComponentPanel: true,
|
|
6238
6320
|
props: [
|
|
6239
6321
|
{
|
|
6240
6322
|
name: "description",
|
|
6241
6323
|
label: "\u63CF\u8FF0\u6587\u5B57",
|
|
6242
6324
|
type: PropType.STRING,
|
|
6243
6325
|
group: "\u57FA\u7840"
|
|
6326
|
+
},
|
|
6327
|
+
{
|
|
6328
|
+
name: "visible",
|
|
6329
|
+
label: "\u662F\u5426\u663E\u793A",
|
|
6330
|
+
type: PropType.BOOLEAN,
|
|
6331
|
+
bindable: true,
|
|
6332
|
+
defaultValue: true,
|
|
6333
|
+
group: "\u72B6\u6001"
|
|
6244
6334
|
}
|
|
6245
6335
|
],
|
|
6246
6336
|
defaultProps: {
|
|
6247
|
-
description: "\u6682\u65E0\u6570\u636E"
|
|
6337
|
+
description: "\u6682\u65E0\u6570\u636E",
|
|
6338
|
+
visible: true
|
|
6248
6339
|
},
|
|
6249
6340
|
npm: {
|
|
6250
6341
|
package: "antd",
|