plain-design 1.0.0-beta.159 → 1.0.0-beta.160
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/plain-design.commonjs.min.js +1 -1
- package/dist/plain-design.min.js +1 -1
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/AutoTable/filter/useTableOption.filter.state.ts +4 -1
- package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.filter.tsx +388 -385
- package/src/packages/components/AutoTable/setting/useTableOption.setting.tsx +109 -109
- package/src/packages/components/Checkbox/index.tsx +4 -6
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import {classnames, computed, getComponentCls, reactive, SimpleFunction} from "@peryl/react-compose";
|
|
2
|
-
import {iTableOptionSettingConfig, iTableOptionSettingInnerUser} from "./useTableOption.setting.utils";
|
|
3
|
-
import {$dialog} from "../../$dialog";
|
|
4
|
-
import {Scroll} from "../../Scroll";
|
|
5
|
-
import '../utils/TableOption.space';
|
|
6
|
-
import i18n from "../../i18n";
|
|
7
|
-
import {AutoModule} from "../utils/AutoModule";
|
|
8
|
-
|
|
9
|
-
declare module '../utils/TableOption.space' {
|
|
10
|
-
namespace TableOptionSpace {
|
|
11
|
-
interface iTableOption {
|
|
12
|
-
setting: ReturnType<typeof useTableOptionSetting>;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const useTableOptionSetting = AutoModule.createRegistration((
|
|
18
|
-
{
|
|
19
|
-
config,
|
|
20
|
-
}
|
|
21
|
-
) => {
|
|
22
|
-
|
|
23
|
-
const state = reactive({
|
|
24
|
-
settingConfigs: [] as iTableOptionSettingConfig[],
|
|
25
|
-
activeKey: null as null | string,
|
|
26
|
-
closeSetting: null as null | SimpleFunction,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const isOpen =
|
|
30
|
-
|
|
31
|
-
const useTableOptionSettingInner: iTableOptionSettingInnerUser = (config) => {
|
|
32
|
-
state.settingConfigs.push(config);
|
|
33
|
-
return { isOpen: () => isOpen
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const openSetting = async (key: string) => {
|
|
37
|
-
|
|
38
|
-
const settingConfigs = state.settingConfigs.sort((a, b) => a.seq - b.seq);
|
|
39
|
-
const showConfig = state.settingConfigs.find(i => i.key === key);
|
|
40
|
-
!!showConfig && showConfig.beforeOpen && (await showConfig.beforeOpen());
|
|
41
|
-
state.activeKey = key;
|
|
42
|
-
|
|
43
|
-
/*已经打开就不用在打开一个dialog了,直接切换activeKey*/
|
|
44
|
-
if (isOpen
|
|
45
|
-
|
|
46
|
-
state.closeSetting = $dialog({
|
|
47
|
-
status: null,
|
|
48
|
-
size: config.size,
|
|
49
|
-
position: 'right',
|
|
50
|
-
width: null as any,
|
|
51
|
-
destroyOnClose: false,
|
|
52
|
-
footAlign: 'left',
|
|
53
|
-
noContentPadding: true,
|
|
54
|
-
externalClass: getComponentCls('auto-table-setting-dialog'),
|
|
55
|
-
title: i18n.$it('base.setting').d('设置'),
|
|
56
|
-
cancelButton: true,
|
|
57
|
-
cancelButtonText: i18n.$it('base.close').d('关闭'),
|
|
58
|
-
onHide: () => {state.closeSetting = null;},
|
|
59
|
-
render: () => {
|
|
60
|
-
return (
|
|
61
|
-
<div className={'auto-table-setting-wrapper'}>
|
|
62
|
-
<div className="auto-table-setting-nav">
|
|
63
|
-
{[null, ...settingConfigs, null].map((item, index) => (
|
|
64
|
-
<div key={index} className={classnames([
|
|
65
|
-
'auto-table-setting-nav-item',
|
|
66
|
-
{
|
|
67
|
-
'auto-table-setting-nav-item-active': !!item && item.key === state.activeKey,
|
|
68
|
-
'auto-table-setting-nav-item-prev': !!settingConfigs[index] && settingConfigs[index].key === state.activeKey,
|
|
69
|
-
'auto-table-setting-nav-item-next': !!settingConfigs[index - 2] && settingConfigs[index - 2].key === state.activeKey,
|
|
70
|
-
}
|
|
71
|
-
])} onClick={async () => {
|
|
72
|
-
if (!item) {return;}
|
|
73
|
-
!!item.beforeOpen && (await item.beforeOpen());
|
|
74
|
-
state.activeKey = item.key;
|
|
75
|
-
}}>
|
|
76
|
-
<div className="auto-table-setting-nav-item-inner">
|
|
77
|
-
{item?.title}
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
))}
|
|
81
|
-
</div>
|
|
82
|
-
<div className="auto-table-setting-body">
|
|
83
|
-
<Scroll>
|
|
84
|
-
<div className="auto-table-setting-body-inner">
|
|
85
|
-
{(() => {
|
|
86
|
-
const r = settingConfigs.find(i => i.key === state.activeKey);
|
|
87
|
-
if (!r) {return null;}
|
|
88
|
-
const content = !!r.render && r.render();
|
|
89
|
-
return (
|
|
90
|
-
<div className={classnames(['auto-table-setting-content', { 'auto-table-setting-content-pending': !!r && r.contentPending !== false }])}>
|
|
91
|
-
{content}
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
})()}
|
|
95
|
-
</div>
|
|
96
|
-
</Scroll>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
return closeSetting;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const closeSetting = () => state.closeSetting?.();
|
|
107
|
-
|
|
108
|
-
return { openSetting, closeSetting, useTableOptionSettingInner };
|
|
109
|
-
});
|
|
1
|
+
import {classnames, computed, getComponentCls, reactive, SimpleFunction} from "@peryl/react-compose";
|
|
2
|
+
import {iTableOptionSettingConfig, iTableOptionSettingInnerUser} from "./useTableOption.setting.utils";
|
|
3
|
+
import {$dialog} from "../../$dialog";
|
|
4
|
+
import {Scroll} from "../../Scroll";
|
|
5
|
+
import '../utils/TableOption.space';
|
|
6
|
+
import i18n from "../../i18n";
|
|
7
|
+
import {AutoModule} from "../utils/AutoModule";
|
|
8
|
+
|
|
9
|
+
declare module '../utils/TableOption.space' {
|
|
10
|
+
namespace TableOptionSpace {
|
|
11
|
+
interface iTableOption {
|
|
12
|
+
setting: ReturnType<typeof useTableOptionSetting>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const useTableOptionSetting = AutoModule.createRegistration((
|
|
18
|
+
{
|
|
19
|
+
config,
|
|
20
|
+
}
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const state = reactive({
|
|
24
|
+
settingConfigs: [] as iTableOptionSettingConfig[],
|
|
25
|
+
activeKey: null as null | string,
|
|
26
|
+
closeSetting: null as null | SimpleFunction,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const isOpen = () => !!state.closeSetting;
|
|
30
|
+
|
|
31
|
+
const useTableOptionSettingInner: iTableOptionSettingInnerUser = (config) => {
|
|
32
|
+
state.settingConfigs.push(config);
|
|
33
|
+
return { isOpen: () => isOpen() && state.activeKey === config.key };
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const openSetting = async (key: string) => {
|
|
37
|
+
|
|
38
|
+
const settingConfigs = state.settingConfigs.sort((a, b) => a.seq - b.seq);
|
|
39
|
+
const showConfig = state.settingConfigs.find(i => i.key === key);
|
|
40
|
+
!!showConfig && showConfig.beforeOpen && (await showConfig.beforeOpen());
|
|
41
|
+
state.activeKey = key;
|
|
42
|
+
|
|
43
|
+
/*已经打开就不用在打开一个dialog了,直接切换activeKey*/
|
|
44
|
+
if (isOpen()) {return state.closeSetting;}
|
|
45
|
+
|
|
46
|
+
state.closeSetting = $dialog({
|
|
47
|
+
status: null,
|
|
48
|
+
size: config.size,
|
|
49
|
+
position: 'right',
|
|
50
|
+
width: null as any,
|
|
51
|
+
destroyOnClose: false,
|
|
52
|
+
footAlign: 'left',
|
|
53
|
+
noContentPadding: true,
|
|
54
|
+
externalClass: getComponentCls('auto-table-setting-dialog'),
|
|
55
|
+
title: i18n.$it('base.setting').d('设置'),
|
|
56
|
+
cancelButton: true,
|
|
57
|
+
cancelButtonText: i18n.$it('base.close').d('关闭'),
|
|
58
|
+
onHide: () => {state.closeSetting = null;},
|
|
59
|
+
render: () => {
|
|
60
|
+
return (
|
|
61
|
+
<div className={'auto-table-setting-wrapper'}>
|
|
62
|
+
<div className="auto-table-setting-nav">
|
|
63
|
+
{[null, ...settingConfigs, null].map((item, index) => (
|
|
64
|
+
<div key={index} className={classnames([
|
|
65
|
+
'auto-table-setting-nav-item',
|
|
66
|
+
{
|
|
67
|
+
'auto-table-setting-nav-item-active': !!item && item.key === state.activeKey,
|
|
68
|
+
'auto-table-setting-nav-item-prev': !!settingConfigs[index] && settingConfigs[index].key === state.activeKey,
|
|
69
|
+
'auto-table-setting-nav-item-next': !!settingConfigs[index - 2] && settingConfigs[index - 2].key === state.activeKey,
|
|
70
|
+
}
|
|
71
|
+
])} onClick={async () => {
|
|
72
|
+
if (!item) {return;}
|
|
73
|
+
!!item.beforeOpen && (await item.beforeOpen());
|
|
74
|
+
state.activeKey = item.key;
|
|
75
|
+
}}>
|
|
76
|
+
<div className="auto-table-setting-nav-item-inner">
|
|
77
|
+
{item?.title}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
<div className="auto-table-setting-body">
|
|
83
|
+
<Scroll>
|
|
84
|
+
<div className="auto-table-setting-body-inner">
|
|
85
|
+
{(() => {
|
|
86
|
+
const r = settingConfigs.find(i => i.key === state.activeKey);
|
|
87
|
+
if (!r) {return null;}
|
|
88
|
+
const content = !!r.render && r.render();
|
|
89
|
+
return (
|
|
90
|
+
<div className={classnames(['auto-table-setting-content', { 'auto-table-setting-content-pending': !!r && r.contentPending !== false }])}>
|
|
91
|
+
{content}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
})()}
|
|
95
|
+
</div>
|
|
96
|
+
</Scroll>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return closeSetting;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const closeSetting = () => state.closeSetting?.();
|
|
107
|
+
|
|
108
|
+
return { openSetting, closeSetting, useTableOptionSettingInner };
|
|
109
|
+
});
|
|
@@ -125,12 +125,10 @@ export const Checkbox = designComponent({
|
|
|
125
125
|
onKeyDown={handler.keydown}
|
|
126
126
|
ref={onRef.el}>
|
|
127
127
|
<span className="plain-click-node">
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
disabled={editComputed.value.disabled!}/>
|
|
133
|
-
</Transition>
|
|
128
|
+
<CheckboxInner
|
|
129
|
+
checkStatus={checkStatus.value}
|
|
130
|
+
key={checkStatus.value}
|
|
131
|
+
disabled={editComputed.value.disabled!}/>
|
|
134
132
|
</span>
|
|
135
133
|
{(slots.labelContent.isExist() || props.label || props.checkboxForAll) && slots.labelContent(<span className="checkbox-label">{props.label || (props.checkboxForAll ? i18n.$it('base.select.all').d('全选') : '')}</span>)}
|
|
136
134
|
</div>))
|