plain-design 1.0.0-beta.130 → 1.0.0-beta.132
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 +2 -2
- package/dist/plain-design.min.css +5 -4
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +2 -2
- package/package.json +2 -2
- package/src/packages/components/AutoTable/auto-table.scss +21 -0
- package/src/packages/components/AutoTable/filter/useTableOption.filter.state.ts +3 -2
- package/src/packages/components/AutoTable/use/useTableOption.column.popper.tsx +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.fill.tsx +2 -2
- package/src/packages/components/AutoTable/use/useTableOption.hooks.tsx +4 -2
- package/src/packages/components/AutoTable/use/useTableOption.pagination.tsx +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +5 -3
- package/src/packages/components/AutoTable/use/useTableOption.tips.tsx +2 -2
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +5 -2
- package/src/packages/components/Button/index.tsx +9 -2
- package/src/packages/components/Cascade/createSingleCascadeRender.tsx +1 -0
- package/src/packages/components/Dialog/index.tsx +6 -2
- package/src/packages/components/Dropdown/index.tsx +14 -1
- package/src/packages/components/Form/form.scss +4 -0
- package/src/packages/components/Form/layout/useFormLayout.tsx +1 -0
- package/src/packages/components/FormItem/index.tsx +7 -0
- package/src/packages/components/Input/useSuggestionInput.tsx +2 -1
- package/src/packages/components/Input/uses/useInputEnterHandler.tsx +9 -2
- package/src/packages/components/ListOption/index.tsx +20 -0
- package/src/packages/components/ListPanel/index.tsx +30 -0
- package/src/packages/components/ListPanel/list-panel.scss +20 -0
- package/src/packages/components/Scroll/index.tsx +1 -0
- package/src/packages/components/Select/createPublicSelectRender.tsx +4 -2
- package/src/packages/components/Select/decodeSelectRenderNode.tsx +4 -2
- package/src/packages/components/Select/index.tsx +13 -1
- package/src/packages/components/Select/select.utils.tsx +3 -2
- package/src/packages/components/Table/plc/use/useTableAutoSpan.tsx +112 -0
- package/src/packages/components/Table/plc/useTablePlc.tsx +2 -1
- package/src/packages/components/Table/plc/utils/plc.utils.ts +3 -0
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +3 -3
- package/src/packages/components/Table/table/Table.tsx +10 -6
- package/src/packages/components/Table/table/body/cell.tsx +34 -3
- package/src/packages/components/Table/table/body/useCellValue.tsx +14 -5
- package/src/packages/components/Table/table/head/head-cell.tsx +6 -0
- package/src/packages/components/Table/table/table.scss +4 -0
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +5 -1
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +8 -2
- package/src/packages/components/Table/table/utils/createTableHooks.ts +5 -3
- package/src/packages/components/Table/table/utils/table.utils.ts +3 -2
- package/src/packages/components/VirtualTable/index.tsx +6 -0
- package/src/packages/components/VirtualTable/virtual-table.scss +3 -3
- package/src/packages/components/createSimpleDate/index.ts +49 -0
- package/src/packages/components/useContextmenuOptions/index.tsx +40 -0
- package/src/packages/components/usePopup/trigger/useManagerTrigger.clickOutside.tsx +18 -23
- package/src/packages/components/useTableFilter/index.ts +73 -0
- package/src/packages/entry.tsx +6 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {iPopupManager} from "../utils/popup.utils";
|
|
2
2
|
import {onBeforeUnmount, onMounted} from "@peryl/react-compose";
|
|
3
|
-
import {throttle} from "@peryl/utils/throttle";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* 处理点击页面任何元素的时候检查是否触发了某个popup的click outside动作
|
|
@@ -13,28 +12,24 @@ export function useManagerTriggerClickOutside({ hooks }: iPopupManager) {
|
|
|
13
12
|
* @author 韦胜健
|
|
14
13
|
* @date 2023/5/16 16:23
|
|
15
14
|
*/
|
|
16
|
-
const onClick =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
100,
|
|
36
|
-
{ trailing: false }
|
|
37
|
-
);
|
|
15
|
+
const onClick = (e: MouseEvent) => {
|
|
16
|
+
const el = e.target as HTMLElement;
|
|
17
|
+
const list = hooks.onGetPopupElements.exec([]);
|
|
18
|
+
list.forEach(i => {
|
|
19
|
+
const { option, popupEl } = i();
|
|
20
|
+
const { reference } = option;
|
|
21
|
+
if (!popupEl) {return;}
|
|
22
|
+
if (reference.contains(el)) {
|
|
23
|
+
/*点击了reference*/
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (popupEl.contains(el)) {
|
|
27
|
+
/*点击了popup*/
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
hooks.onTriggerOutsideClick.exec({ e, option });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
38
33
|
onMounted(() => {
|
|
39
34
|
window.addEventListener('mouseup', onClick, true);
|
|
40
35
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {TableOptionSpace} from "../AutoTable/utils/TableOption.space";
|
|
2
|
+
import {computed, reactive, RenderNode} from "@peryl/react-compose";
|
|
3
|
+
import {iFilterQueryParam} from "../FilterService/utils/filter.service.utils";
|
|
4
|
+
|
|
5
|
+
export function useTableFilter<T>(
|
|
6
|
+
{
|
|
7
|
+
modelValue,
|
|
8
|
+
option,
|
|
9
|
+
defaultValue,
|
|
10
|
+
display,
|
|
11
|
+
handleClickTip,
|
|
12
|
+
handleClear,
|
|
13
|
+
getQueryParam,
|
|
14
|
+
noClear,
|
|
15
|
+
}: {
|
|
16
|
+
option: TableOptionSpace.iTableOption,
|
|
17
|
+
display: (val: T) => RenderNode,
|
|
18
|
+
getQueryParam: (val: T) => iFilterQueryParam,
|
|
19
|
+
modelValue?: { set: (newVal: T | null) => void, get: () => T | null },
|
|
20
|
+
defaultValue?: T,
|
|
21
|
+
handleClickTip?: (val: T) => void,
|
|
22
|
+
handleClear?: (val: T) => void,
|
|
23
|
+
noClear?: boolean,
|
|
24
|
+
}) {
|
|
25
|
+
|
|
26
|
+
const model = (() => {
|
|
27
|
+
const _modelValue = modelValue || (() => {
|
|
28
|
+
const state = reactive({ value: defaultValue });
|
|
29
|
+
return { get: (): T | null => state.value as any, set: (newVal: T | null) => {state.value = newVal as any;} };
|
|
30
|
+
})();
|
|
31
|
+
return {
|
|
32
|
+
get: () => _modelValue.get(),
|
|
33
|
+
set: (newVal: T | null) => {_modelValue.set(newVal);}
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
|
|
37
|
+
const clear = (val: T) => {
|
|
38
|
+
if (noClear) {return;}
|
|
39
|
+
!!handleClear ? handleClear(val) : model.set(null);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const tips = computed((): TableOptionSpace.iTableOptionTipMeta | null => {
|
|
43
|
+
const val = model.get();
|
|
44
|
+
if (val == null) {return null;}
|
|
45
|
+
return {
|
|
46
|
+
noClear,
|
|
47
|
+
display: () => display(val),
|
|
48
|
+
onClear: () => {
|
|
49
|
+
clear(val);
|
|
50
|
+
reload();
|
|
51
|
+
},
|
|
52
|
+
onClick: () => {handleClickTip?.(val);},
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
option.hooks.onClearFilter.use(() => {
|
|
57
|
+
const val = model.get();
|
|
58
|
+
if (val == null) {return;}
|
|
59
|
+
clear(val);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
option.hooks.onTips.use((list) => {!!tips.value && list.unshift(tips.value);});
|
|
63
|
+
|
|
64
|
+
option.hooks.onQueryParam.use(async () => {
|
|
65
|
+
const val = model.get();
|
|
66
|
+
if (val == null) {return;}
|
|
67
|
+
return getQueryParam(val);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const reload = () => option.methods.pageMethods.reload();
|
|
71
|
+
|
|
72
|
+
return { model, reload };
|
|
73
|
+
}
|
package/src/packages/entry.tsx
CHANGED
|
@@ -16,6 +16,8 @@ export {useDialog} from "./components/useDialog";
|
|
|
16
16
|
export {$dialog} from "./components/$dialog";
|
|
17
17
|
export {List} from "./components/List";
|
|
18
18
|
// export {Item} from "./components/Item";
|
|
19
|
+
export {ListPanel} from './components/ListPanel';
|
|
20
|
+
export {ListOption} from './components/ListOption';
|
|
19
21
|
export {useMessage} from "./components/useMessage";
|
|
20
22
|
export {$message} from "./components/$message";
|
|
21
23
|
export {useNotice} from "./components/useNotice";
|
|
@@ -131,6 +133,8 @@ export {Paragraph} from './components/Paragraph';
|
|
|
131
133
|
export {ParagraphItem} from './components/ParagraphItem';
|
|
132
134
|
export {ImagePreviewer} from './components/ImagePreviewer/ImagePreviewer';
|
|
133
135
|
export {Corner} from './components/Corner';
|
|
136
|
+
export {useContextmenuOptions} from './components/useContextmenuOptions';
|
|
137
|
+
export type {iContextmenuOption} from './components/useContextmenuOptions';
|
|
134
138
|
|
|
135
139
|
export {VirtualTable} from './components/VirtualTable';
|
|
136
140
|
export {Table} from './components/Table';
|
|
@@ -284,6 +288,8 @@ export {createWebDraggier} from './components/createWebDraggier';
|
|
|
284
288
|
export {createScrollDraggier} from './components/createScrollDraggier';
|
|
285
289
|
export {loadFile} from './components/loadFile';
|
|
286
290
|
export {getDeviceInfo, clearDeviceInfo, eDeviceType} from './utils/getDeviceInfo';
|
|
291
|
+
export {useTableFilter} from './components/useTableFilter';
|
|
292
|
+
export {createSimpleDate} from './components/createSimpleDate';
|
|
287
293
|
|
|
288
294
|
// @ts-ignore
|
|
289
295
|
setComponentPrefix(globalComponentPrefix);
|