@pisell/materials 1.0.4 → 1.0.6
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 +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +26 -4
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +26 -4
- package/es/components/DragSortList/index.d.ts +32 -0
- package/es/components/DragSortList/index.js +85 -0
- package/es/components/MultipleContainersSortList/index.d.ts +15 -0
- package/es/components/MultipleContainersSortList/index.js +156 -0
- package/es/components/date-picker/index.js +5 -0
- package/es/components/table/Actions/Filter/Dropdown/index.d.ts +14 -0
- package/es/components/table/Actions/Filter/Dropdown/index.js +99 -0
- package/es/components/table/Actions/Filter/Dropdown/index.less +74 -0
- package/es/components/table/Actions/Filter/FilterItem/index.d.ts +7 -6
- package/es/components/table/Actions/Filter/FilterItem/index.js +15 -12
- package/es/components/table/Actions/Filter/QuickFilter/index.d.ts +3 -0
- package/es/components/table/Actions/Filter/QuickFilter/index.js +25 -0
- package/es/components/table/Actions/Filter/index.d.ts +3 -8
- package/es/components/table/Actions/Filter/index.js +23 -12
- package/es/components/table/Actions/Sort/index.d.ts +12 -0
- package/es/components/table/Actions/Sort/index.js +23 -0
- package/es/components/table/Actions/index.d.ts +1 -1
- package/es/components/table/Actions/index.js +14 -10
- package/es/components/table/Actions/index.less +9 -1
- package/es/components/table/{Actions → Header}/Buttons/index.js +1 -1
- package/es/components/table/Header/index.d.ts +4 -0
- package/es/components/table/Header/index.js +20 -0
- package/es/components/table/Header/index.less +16 -0
- package/es/components/table/Pagination/index.d.ts +8 -2
- package/es/components/table/Pagination/index.js +32 -28
- package/es/components/table/Pagination/index.less +62 -7
- package/es/components/table/Summary/index.d.ts +4 -0
- package/es/components/table/Summary/index.js +12 -0
- package/es/components/table/Summary/index.less +5 -0
- package/es/components/table/Table/fields/date/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/date/Config/index.js +4 -0
- package/es/components/table/Table/fields/date/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/date/Edit/index.js +42 -0
- package/es/components/table/Table/fields/date/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/{text/Preview → date/Show}/index.js +3 -5
- package/es/components/table/Table/fields/date/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/date/Sort/index.js +4 -0
- package/es/components/table/Table/fields/date/index.d.ts +14 -0
- package/es/components/table/Table/fields/date/index.js +17 -0
- package/es/components/table/Table/fields/image/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/image/Config/index.js +4 -0
- package/es/components/table/Table/fields/image/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/image/Edit/index.js +23 -0
- package/es/components/table/Table/fields/image/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/image/Show/index.js +19 -0
- package/es/components/table/Table/fields/image/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/image/Sort/index.js +4 -0
- package/es/components/table/Table/fields/image/index.d.ts +14 -0
- package/es/components/table/Table/fields/image/index.js +17 -0
- package/es/components/table/Table/fields/index.d.ts +173 -8
- package/es/components/table/Table/fields/index.js +19 -3
- package/es/components/table/Table/fields/link/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/link/Config/index.js +4 -0
- package/es/components/table/Table/fields/link/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/link/Edit/index.js +59 -0
- package/es/components/table/Table/fields/link/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/link/Show/index.js +29 -0
- package/es/components/table/Table/fields/link/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/link/Sort/index.js +4 -0
- package/es/components/table/Table/fields/link/index.d.ts +4 -2
- package/es/components/table/Table/fields/link/index.js +8 -4
- package/es/components/table/Table/fields/number/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/number/Config/index.js +4 -0
- package/es/components/table/Table/fields/number/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/number/Edit/index.js +24 -0
- package/es/components/table/Table/fields/number/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/{link/Preview → number/Show}/index.js +4 -5
- package/es/components/table/Table/fields/number/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/number/Sort/index.js +4 -0
- package/es/components/table/Table/fields/number/index.d.ts +14 -0
- package/es/components/table/Table/fields/number/index.js +17 -0
- package/es/components/table/Table/fields/rangePicker/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/rangePicker/Config/index.js +4 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +58 -0
- package/es/components/table/Table/fields/rangePicker/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/rangePicker/Show/index.js +16 -0
- package/es/components/table/Table/fields/rangePicker/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/rangePicker/Sort/index.js +4 -0
- package/es/components/table/Table/fields/rangePicker/index.d.ts +14 -0
- package/es/components/table/Table/fields/rangePicker/index.js +17 -0
- package/es/components/table/Table/fields/select/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/select/Config/index.js +4 -0
- package/es/components/table/Table/fields/select/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/select/Edit/index.js +23 -0
- package/es/components/table/Table/fields/select/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/select/Show/index.js +27 -0
- package/es/components/table/Table/fields/select/Show/index.less +0 -0
- package/es/components/table/Table/fields/select/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/select/Sort/index.js +4 -0
- package/es/components/table/Table/fields/select/index.d.ts +14 -0
- package/es/components/table/Table/fields/select/index.js +17 -0
- package/es/components/table/Table/fields/select/index.less +0 -0
- package/es/components/table/Table/fields/text/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/text/Config/index.js +4 -0
- package/es/components/table/Table/fields/text/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/text/Edit/index.js +23 -0
- package/es/components/table/Table/fields/text/Edit/index.less +0 -0
- package/es/components/table/Table/fields/text/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/text/Show/index.js +16 -0
- package/es/components/table/Table/fields/text/Show/index.less +0 -0
- package/es/components/table/Table/fields/text/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/text/Sort/index.js +4 -0
- package/es/components/table/Table/fields/text/index.d.ts +4 -2
- package/es/components/table/Table/fields/text/index.js +8 -4
- package/es/components/table/Table/fields/types/index.d.ts +27 -0
- package/es/components/table/Table/fields/types/index.js +1 -0
- package/es/components/table/Table/index.js +13 -30
- package/es/components/table/Table/index.less +1 -90
- package/es/components/table/Table/tableConfig/body/CellProvider/index.js +21 -14
- package/es/components/table/Table/tableConfig/header/CellProvider/index.js +1 -6
- package/es/components/table/Table/tableConfig/header/CellProvider/index.less +1 -1
- package/es/components/table/index.d.ts +16 -3
- package/es/components/table/index.js +43 -9
- package/es/components/table/model.d.ts +3 -0
- package/es/components/table/model.js +19 -0
- package/es/utils/hoc.js +3 -2
- package/lib/components/DragSortList/index.d.ts +32 -0
- package/lib/components/DragSortList/index.js +119 -0
- package/lib/components/MultipleContainersSortList/index.d.ts +15 -0
- package/lib/components/MultipleContainersSortList/index.js +181 -0
- package/lib/components/date-picker/index.js +15 -0
- package/lib/components/table/Actions/Filter/Dropdown/index.d.ts +14 -0
- package/lib/components/table/Actions/Filter/Dropdown/index.js +128 -0
- package/lib/components/table/Actions/Filter/Dropdown/index.less +74 -0
- package/lib/components/table/Actions/Filter/FilterItem/index.d.ts +7 -6
- package/lib/components/table/Actions/Filter/FilterItem/index.js +8 -2
- package/lib/components/table/Actions/Filter/QuickFilter/index.d.ts +3 -0
- package/lib/components/table/Actions/Filter/QuickFilter/index.js +56 -0
- package/lib/components/table/Actions/Filter/index.d.ts +3 -8
- package/lib/components/table/Actions/Filter/index.js +16 -5
- package/lib/components/table/Actions/Sort/index.d.ts +12 -0
- package/lib/components/table/{Table/fields/text/Preview → Actions/Sort}/index.js +10 -18
- package/lib/components/table/Actions/Sort/index.less +0 -0
- package/lib/components/table/Actions/index.d.ts +1 -1
- package/lib/components/table/Actions/index.js +7 -3
- package/lib/components/table/Actions/index.less +9 -1
- package/lib/components/table/{Actions → Header}/Buttons/index.js +2 -2
- package/lib/components/table/Header/Buttons/index.less +0 -0
- package/lib/components/table/Header/index.d.ts +4 -0
- package/lib/components/table/Header/index.js +44 -0
- package/lib/components/table/Header/index.less +16 -0
- package/lib/components/table/Pagination/index.d.ts +8 -2
- package/lib/components/table/Pagination/index.js +27 -22
- package/lib/components/table/Pagination/index.less +62 -7
- package/lib/components/table/Summary/index.d.ts +4 -0
- package/lib/components/table/{Table/fields/text/Editor → Summary}/index.js +12 -9
- package/lib/components/table/Summary/index.less +5 -0
- package/lib/components/table/Table/fields/date/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/date/Config/index.js +28 -0
- package/lib/components/table/Table/fields/date/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/date/Edit/index.js +67 -0
- package/lib/components/table/Table/fields/date/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/{link/Preview → date/Show}/index.js +8 -9
- package/lib/components/table/Table/fields/date/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/date/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/date/index.d.ts +14 -0
- package/lib/components/table/Table/fields/date/index.js +51 -0
- package/lib/components/table/Table/fields/image/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/image/Config/index.js +28 -0
- package/lib/components/table/Table/fields/image/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/image/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/image/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/image/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/{link/Editor → image/Show}/index.js +17 -9
- package/lib/components/table/Table/fields/image/Show/index.less +0 -0
- package/lib/components/table/Table/fields/image/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/image/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/image/index.d.ts +14 -0
- package/lib/components/table/Table/fields/image/index.js +51 -0
- package/lib/components/table/Table/fields/image/index.less +0 -0
- package/lib/components/table/Table/fields/index.d.ts +173 -8
- package/lib/components/table/Table/fields/index.js +19 -3
- package/lib/components/table/Table/fields/link/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/link/Config/index.js +28 -0
- package/lib/components/table/Table/fields/link/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/link/Edit/index.js +78 -0
- package/lib/components/table/Table/fields/link/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/link/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/link/Show/index.js +48 -0
- package/lib/components/table/Table/fields/link/Show/index.less +0 -0
- package/lib/components/table/Table/fields/link/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/link/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/link/index.d.ts +4 -2
- package/lib/components/table/Table/fields/link/index.js +8 -4
- package/lib/components/table/Table/fields/number/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/number/Config/index.js +28 -0
- package/lib/components/table/Table/fields/number/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/number/Edit/index.js +44 -0
- package/lib/components/table/Table/fields/number/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/number/Show/index.js +37 -0
- package/lib/components/table/Table/fields/number/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/number/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/number/index.d.ts +14 -0
- package/lib/components/table/Table/fields/number/index.js +51 -0
- package/lib/components/table/Table/fields/rangePicker/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/rangePicker/Config/index.js +28 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +73 -0
- package/lib/components/table/Table/fields/rangePicker/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/rangePicker/Show/index.js +37 -0
- package/lib/components/table/Table/fields/rangePicker/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/rangePicker/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +14 -0
- package/lib/components/table/Table/fields/rangePicker/index.js +51 -0
- package/lib/components/table/Table/fields/select/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/select/Config/index.js +28 -0
- package/lib/components/table/Table/fields/select/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/select/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/select/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/select/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/select/Show/index.js +46 -0
- package/lib/components/table/Table/fields/select/Show/index.less +0 -0
- package/lib/components/table/Table/fields/select/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/select/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/select/index.d.ts +14 -0
- package/lib/components/table/Table/fields/select/index.js +51 -0
- package/lib/components/table/Table/fields/select/index.less +0 -0
- package/lib/components/table/Table/fields/text/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/text/Config/index.js +28 -0
- package/lib/components/table/Table/fields/text/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/text/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/text/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/text/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/text/Show/index.js +37 -0
- package/lib/components/table/Table/fields/text/Show/index.less +0 -0
- package/lib/components/table/Table/fields/text/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/text/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/text/index.d.ts +4 -2
- package/lib/components/table/Table/fields/text/index.js +8 -4
- package/lib/components/table/Table/fields/types/index.d.ts +27 -0
- package/lib/components/table/Table/fields/types/index.js +17 -0
- package/lib/components/table/Table/index.js +19 -20
- package/lib/components/table/Table/index.less +1 -90
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.js +19 -14
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.js +1 -3
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.less +1 -1
- package/lib/components/table/index.d.ts +16 -3
- package/lib/components/table/index.js +28 -6
- package/lib/components/table/model.d.ts +3 -0
- package/lib/components/table/model.js +14 -0
- package/lib/utils/hoc.js +3 -2
- package/lowcode/button/meta.ts +17 -87
- package/lowcode/table/meta.ts +146 -63
- package/package.json +11 -4
- package/es/components/table/Actions/Buttons/index.less +0 -30
- package/es/components/table/Table/fields/link/Editor/index.d.ts +0 -3
- package/es/components/table/Table/fields/link/Editor/index.js +0 -10
- package/es/components/table/Table/fields/link/Preview/index.d.ts +0 -3
- package/es/components/table/Table/fields/text/Editor/index.d.ts +0 -3
- package/es/components/table/Table/fields/text/Editor/index.js +0 -11
- package/es/components/table/Table/fields/text/Preview/index.d.ts +0 -3
- package/lib/components/table/Actions/Buttons/index.less +0 -30
- package/lib/components/table/Table/fields/link/Editor/index.d.ts +0 -3
- package/lib/components/table/Table/fields/link/Preview/index.d.ts +0 -3
- package/lib/components/table/Table/fields/text/Editor/index.d.ts +0 -3
- package/lib/components/table/Table/fields/text/Preview/index.d.ts +0 -3
- /package/es/components/table/{Table/fields/link/Editor → Actions/Sort}/index.less +0 -0
- /package/es/components/table/{Actions → Header}/Buttons/index.d.ts +0 -0
- /package/es/components/table/{Table/fields/link/Preview → Header/Buttons}/index.less +0 -0
- /package/es/components/table/Table/fields/{text/Editor → image/Edit}/index.less +0 -0
- /package/es/components/table/Table/fields/{text/Preview → image/Show}/index.less +0 -0
- /package/{lib/components/table/Table/fields/link/Editor → es/components/table/Table/fields/image}/index.less +0 -0
- /package/{lib/components/table/Table/fields/link/Preview → es/components/table/Table/fields/link/Edit}/index.less +0 -0
- /package/{lib/components/table/Table/fields/text/Editor → es/components/table/Table/fields/link/Show}/index.less +0 -0
- /package/{lib/components/table/Table/fields/text/Preview → es/components/table/Table/fields/select/Edit}/index.less +0 -0
- /package/lib/components/table/{Actions → Header}/Buttons/index.d.ts +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DraggableAttributes } from "@dnd-kit/core";
|
|
2
|
+
import { SyntheticListenerMap } from "@dnd-kit/core/dist/hooks/utilities";
|
|
3
|
+
import React from "react";
|
|
4
|
+
declare type IdType = string | number;
|
|
5
|
+
export interface Props<T> {
|
|
6
|
+
list?: T[];
|
|
7
|
+
onChange?: (list: T[]) => void;
|
|
8
|
+
rowKey: IdType | ((val: T) => IdType);
|
|
9
|
+
children: (params: {
|
|
10
|
+
item: T;
|
|
11
|
+
index: number;
|
|
12
|
+
style: React.CSSProperties;
|
|
13
|
+
props: any;
|
|
14
|
+
}) => React.ReactElement<HTMLElement>;
|
|
15
|
+
}
|
|
16
|
+
export default function Sortable<T extends Record<string, any>>({ list, onChange, rowKey, children, }: Props<T>): JSX.Element;
|
|
17
|
+
export interface SortableItemProps<T> {
|
|
18
|
+
id: number;
|
|
19
|
+
index: number;
|
|
20
|
+
children: (params: {
|
|
21
|
+
item: T;
|
|
22
|
+
index: number;
|
|
23
|
+
style: React.CSSProperties;
|
|
24
|
+
props: any;
|
|
25
|
+
setActivatorNodeRef: (element: HTMLElement | null) => void;
|
|
26
|
+
listeners: SyntheticListenerMap;
|
|
27
|
+
attributes: DraggableAttributes;
|
|
28
|
+
}) => React.ReactElement<HTMLElement>;
|
|
29
|
+
item: T;
|
|
30
|
+
}
|
|
31
|
+
export declare function SortableItem<T>({ id, index, item, children, }: SortableItemProps<T>): React.ReactElement<HTMLElement, string | React.JSXElementConstructor<any>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import { DndContext } from "@dnd-kit/core";
|
|
8
|
+
import { SortableContext, arrayMove, useSortable } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
10
|
+
import { isFunction } from "@pisell/utils";
|
|
11
|
+
import React, { useCallback, useMemo } from "react";
|
|
12
|
+
export default function Sortable(_ref) {
|
|
13
|
+
var _ref$list = _ref.list,
|
|
14
|
+
list = _ref$list === void 0 ? [] : _ref$list,
|
|
15
|
+
onChange = _ref.onChange,
|
|
16
|
+
rowKey = _ref.rowKey,
|
|
17
|
+
children = _ref.children;
|
|
18
|
+
var getRowKey = useCallback(function (row) {
|
|
19
|
+
if (isFunction(rowKey)) {
|
|
20
|
+
return rowKey(row);
|
|
21
|
+
}
|
|
22
|
+
return row[rowKey];
|
|
23
|
+
}, [rowKey]);
|
|
24
|
+
var items = useMemo(function () {
|
|
25
|
+
return list === null || list === void 0 ? void 0 : list.map(function (item) {
|
|
26
|
+
return getRowKey(item);
|
|
27
|
+
});
|
|
28
|
+
}, [list, rowKey]);
|
|
29
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
30
|
+
onDragEnd: function onDragEnd(_ref2) {
|
|
31
|
+
var over = _ref2.over,
|
|
32
|
+
active = _ref2.active;
|
|
33
|
+
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
34
|
+
var activeIndex = list === null || list === void 0 ? void 0 : list.findIndex(function (i) {
|
|
35
|
+
return i.id === active.id;
|
|
36
|
+
});
|
|
37
|
+
var overIndex = list === null || list === void 0 ? void 0 : list.findIndex(function (i) {
|
|
38
|
+
return i.id === (over === null || over === void 0 ? void 0 : over.id);
|
|
39
|
+
});
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(arrayMove(list, activeIndex, overIndex));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
44
|
+
items: items
|
|
45
|
+
}, list.map(function (item, index) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
47
|
+
key: getRowKey(item),
|
|
48
|
+
id: getRowKey(item),
|
|
49
|
+
item: item,
|
|
50
|
+
index: index
|
|
51
|
+
}, children);
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
export function SortableItem(_ref3) {
|
|
55
|
+
var id = _ref3.id,
|
|
56
|
+
index = _ref3.index,
|
|
57
|
+
item = _ref3.item,
|
|
58
|
+
children = _ref3.children;
|
|
59
|
+
var _useSortable = useSortable({
|
|
60
|
+
id: id
|
|
61
|
+
}),
|
|
62
|
+
attributes = _useSortable.attributes,
|
|
63
|
+
isSorting = _useSortable.isSorting,
|
|
64
|
+
listeners = _useSortable.listeners,
|
|
65
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
66
|
+
setActivatorNodeRef = _useSortable.setActivatorNodeRef,
|
|
67
|
+
transform = _useSortable.transform,
|
|
68
|
+
transition = _useSortable.transition;
|
|
69
|
+
return children({
|
|
70
|
+
item: item,
|
|
71
|
+
index: index,
|
|
72
|
+
style: {
|
|
73
|
+
transform: CSS.Transform.toString(transform && _objectSpread(_objectSpread({}, transform), {}, {
|
|
74
|
+
scaleY: 1
|
|
75
|
+
})),
|
|
76
|
+
transition: transition
|
|
77
|
+
},
|
|
78
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
79
|
+
listeners: listeners,
|
|
80
|
+
attributes: attributes,
|
|
81
|
+
props: {
|
|
82
|
+
ref: setNodeRef
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SortableItemProps } from "../DragSortList";
|
|
3
|
+
declare type IdType = string | number;
|
|
4
|
+
export interface MultipleContainersSortListProps<T> {
|
|
5
|
+
list: Record<string, T[]>;
|
|
6
|
+
vertical: boolean;
|
|
7
|
+
wrapStyle: React.CSSProperties;
|
|
8
|
+
onChange: (val: Record<string, T[]>) => void;
|
|
9
|
+
renderContainer?: (dom: React.ReactElement) => React.ReactElement;
|
|
10
|
+
rowKey: IdType | ((val: T) => IdType);
|
|
11
|
+
children: SortableItemProps<T>["children"];
|
|
12
|
+
}
|
|
13
|
+
export declare const TRASH_ID = "void";
|
|
14
|
+
declare const MultipleContainersSortList: <T extends Record<string, any>>(props: MultipleContainersSortListProps<T>) => JSX.Element;
|
|
15
|
+
export default MultipleContainersSortList;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { DndContext } from "@dnd-kit/core";
|
|
18
|
+
import { SortableContext, arrayMove, verticalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
|
|
19
|
+
import { isFunction } from "@pisell/utils";
|
|
20
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
21
|
+
import { SortableItem } from "../DragSortList";
|
|
22
|
+
export var TRASH_ID = "void";
|
|
23
|
+
var DefaultRenderContainer = function DefaultRenderContainer(props) {
|
|
24
|
+
var id = props.id,
|
|
25
|
+
children = props.children,
|
|
26
|
+
renderContainer = props.renderContainer;
|
|
27
|
+
var _useSortable = useSortable({
|
|
28
|
+
id: id
|
|
29
|
+
}),
|
|
30
|
+
setNodeRef = _useSortable.setNodeRef;
|
|
31
|
+
if (isFunction(renderContainer)) {
|
|
32
|
+
return renderContainer({
|
|
33
|
+
children: children,
|
|
34
|
+
ref: setNodeRef,
|
|
35
|
+
id: id
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (renderContainer) return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
ref: setNodeRef
|
|
40
|
+
}, children);
|
|
41
|
+
};
|
|
42
|
+
var MultipleContainersSortList = function MultipleContainersSortList(props) {
|
|
43
|
+
var wrapStyle = props.wrapStyle,
|
|
44
|
+
list = props.list,
|
|
45
|
+
children = props.children,
|
|
46
|
+
onChange = props.onChange,
|
|
47
|
+
renderContainer = props.renderContainer,
|
|
48
|
+
_props$rowKey = props.rowKey,
|
|
49
|
+
rowKey = _props$rowKey === void 0 ? "id" : _props$rowKey;
|
|
50
|
+
var _useState = useState([]),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
containers = _useState2[0],
|
|
53
|
+
setContainers = _useState2[1];
|
|
54
|
+
var getRowKey = useCallback(function (row) {
|
|
55
|
+
if (isFunction(rowKey)) {
|
|
56
|
+
return rowKey(row);
|
|
57
|
+
}
|
|
58
|
+
return row[rowKey];
|
|
59
|
+
}, [rowKey]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
setContainers(Object.keys(list));
|
|
62
|
+
}, [list]);
|
|
63
|
+
var findContainer = function findContainer(id) {
|
|
64
|
+
if (id in list) {
|
|
65
|
+
return id;
|
|
66
|
+
}
|
|
67
|
+
return Object.keys(list).find(function (key) {
|
|
68
|
+
return list[key].map(function (item) {
|
|
69
|
+
return getRowKey(item);
|
|
70
|
+
}).includes(id);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var handleDragOver = function handleDragOver(_ref) {
|
|
74
|
+
var active = _ref.active,
|
|
75
|
+
over = _ref.over;
|
|
76
|
+
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
77
|
+
if (overId == null || overId === TRASH_ID || active.id in list) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
var overContainer = findContainer(overId);
|
|
81
|
+
var activeContainer = findContainer(active.id);
|
|
82
|
+
if (!overContainer || !activeContainer) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (activeContainer !== overContainer) {
|
|
86
|
+
var _objectSpread2;
|
|
87
|
+
var activeItems = list[activeContainer];
|
|
88
|
+
var overItems = list[overContainer];
|
|
89
|
+
var overIndex = overItems.findIndex(function (item) {
|
|
90
|
+
return getRowKey(item) === overId;
|
|
91
|
+
});
|
|
92
|
+
var activeIndex = activeItems.findIndex(function (item) {
|
|
93
|
+
return getRowKey(item) === active.id;
|
|
94
|
+
});
|
|
95
|
+
var newIndex;
|
|
96
|
+
if (overId in list) {
|
|
97
|
+
newIndex = overItems.length + 1;
|
|
98
|
+
} else {
|
|
99
|
+
var isBelowOverItem = over && active.rect.current.translated && active.rect.current.translated.top > over.rect.top + over.rect.height;
|
|
100
|
+
var modifier = isBelowOverItem ? 1 : 0;
|
|
101
|
+
newIndex = overIndex >= 0 ? overIndex + modifier : overItems.length + 1;
|
|
102
|
+
}
|
|
103
|
+
var newList = _objectSpread(_objectSpread({}, list), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, activeContainer, list[activeContainer].filter(function (item) {
|
|
104
|
+
return getRowKey(item) !== active.id;
|
|
105
|
+
})), _defineProperty(_objectSpread2, overContainer, [].concat(_toConsumableArray(list[overContainer].slice(0, newIndex)), [list[activeContainer][activeIndex]], _toConsumableArray(list[overContainer].slice(newIndex, list[overContainer].length)))), _objectSpread2));
|
|
106
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newList);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var handleDragEnd = function handleDragEnd(_ref2) {
|
|
110
|
+
var active = _ref2.active,
|
|
111
|
+
over = _ref2.over;
|
|
112
|
+
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
113
|
+
var overContainer = findContainer(overId);
|
|
114
|
+
var activeContainer = findContainer(active.id);
|
|
115
|
+
if (!activeContainer) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (overContainer) {
|
|
119
|
+
var activeIndex = list[activeContainer].findIndex(function (item) {
|
|
120
|
+
return getRowKey(item) === active.id;
|
|
121
|
+
});
|
|
122
|
+
var overIndex = list[overContainer].findIndex(function (item) {
|
|
123
|
+
return getRowKey(item) === overId;
|
|
124
|
+
});
|
|
125
|
+
if (activeIndex !== overIndex) {
|
|
126
|
+
var newList = _objectSpread(_objectSpread({}, list), {}, _defineProperty({}, overContainer, arrayMove(list[overContainer], activeIndex, overIndex)));
|
|
127
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newList);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
132
|
+
onDragOver: handleDragOver,
|
|
133
|
+
onDragEnd: handleDragEnd
|
|
134
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
style: wrapStyle
|
|
136
|
+
}, containers.map(function (container) {
|
|
137
|
+
return /*#__PURE__*/React.createElement(DefaultRenderContainer, {
|
|
138
|
+
id: container,
|
|
139
|
+
renderContainer: renderContainer
|
|
140
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
141
|
+
key: container,
|
|
142
|
+
items: list[container].map(function (item) {
|
|
143
|
+
return getRowKey(item);
|
|
144
|
+
}),
|
|
145
|
+
strategy: verticalListSortingStrategy
|
|
146
|
+
}, list[container].map(function (item, index) {
|
|
147
|
+
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
148
|
+
key: getRowKey(item),
|
|
149
|
+
id: getRowKey(item),
|
|
150
|
+
item: item,
|
|
151
|
+
index: index
|
|
152
|
+
}, children);
|
|
153
|
+
})));
|
|
154
|
+
})));
|
|
155
|
+
};
|
|
156
|
+
export default MultipleContainersSortList;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { DatePicker as OriginalDatePicker } from 'antd';
|
|
2
2
|
import { withMomentProps } from "../../utils/hoc";
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import localeData from 'dayjs/plugin/localeData';
|
|
5
|
+
import weekday from 'dayjs/plugin/weekday';
|
|
6
|
+
dayjs.extend(weekday);
|
|
7
|
+
dayjs.extend(localeData);
|
|
3
8
|
var OriginalRangePicker = OriginalDatePicker.RangePicker;
|
|
4
9
|
var DatePicker = withMomentProps(OriginalDatePicker, ['defaultPickerValue', 'defaultValue', 'showTime.defaultValue', 'value']);
|
|
5
10
|
var RangePicker = withMomentProps(OriginalRangePicker, ['defaultPickerValue', 'defaultValue', 'showTime.defaultValue', 'value']);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
export declare type FilterItemProps = {
|
|
4
|
+
type: "single" | "input" | "datePicker" | "rangePicker";
|
|
5
|
+
name: string;
|
|
6
|
+
props: object;
|
|
7
|
+
label: string;
|
|
8
|
+
other: Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
export interface DropdownProps {
|
|
11
|
+
list: FilterItemProps[];
|
|
12
|
+
}
|
|
13
|
+
declare const Dropdown: React.FC<DropdownProps>;
|
|
14
|
+
export default Dropdown;
|
|
@@ -0,0 +1,99 @@
|
|
|
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, { useCallback, useMemo } from "react";
|
|
3
|
+
import { DotsSix, HelpCircle } from "@pisell/icon";
|
|
4
|
+
import MultipleContainersSortList from "../../../../MultipleContainersSortList";
|
|
5
|
+
import "./index.less";
|
|
6
|
+
import FilterItem from "../FilterItem";
|
|
7
|
+
import { useSharedState } from "../../../../../hooks";
|
|
8
|
+
import { Context } from "../../../model";
|
|
9
|
+
var titleMap = {
|
|
10
|
+
quickFilter: "Quick Filter",
|
|
11
|
+
otherFilter: "Filter"
|
|
12
|
+
};
|
|
13
|
+
var DragItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
|
+
var attributes = props.attributes,
|
|
15
|
+
listeners = props.listeners,
|
|
16
|
+
setActivatorNodeRef = props.setActivatorNodeRef,
|
|
17
|
+
style = props.style;
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
19
|
+
ref: ref
|
|
20
|
+
}, attributes, {
|
|
21
|
+
style: style,
|
|
22
|
+
className: "filter-dropdown-drag-item"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DotsSix, _extends({
|
|
24
|
+
ref: setActivatorNodeRef
|
|
25
|
+
}, listeners, {
|
|
26
|
+
className: "dots-six-icon"
|
|
27
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "filter-dropdown-drag-item-right"
|
|
29
|
+
}, props.children));
|
|
30
|
+
});
|
|
31
|
+
var Dropdown = function Dropdown(props) {
|
|
32
|
+
var _useSharedState = useSharedState(Context),
|
|
33
|
+
state = _useSharedState.state,
|
|
34
|
+
dispatch = _useSharedState.dispatch;
|
|
35
|
+
var list = useMemo(function () {
|
|
36
|
+
return {
|
|
37
|
+
quickFilter: state.quickFilter,
|
|
38
|
+
otherFilter: state.otherFilter
|
|
39
|
+
};
|
|
40
|
+
}, [state.quickFilter, state.otherFilter]);
|
|
41
|
+
var handleSortChange = function handleSortChange(list) {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: "setQuickFilter",
|
|
44
|
+
payload: list.quickFilter
|
|
45
|
+
});
|
|
46
|
+
dispatch({
|
|
47
|
+
type: "setOtherFilter",
|
|
48
|
+
payload: list.otherFilter
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var renderContainer = useCallback(function (_ref) {
|
|
52
|
+
var children = _ref.children,
|
|
53
|
+
ref = _ref.ref,
|
|
54
|
+
id = _ref.id;
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "filter-dropdown-container-wrap"
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "filter-dropdown-container-title-wrap"
|
|
59
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
className: "filter-dropdown-container-title"
|
|
61
|
+
}, titleMap[id]), /*#__PURE__*/React.createElement(HelpCircle, {
|
|
62
|
+
className: "filter-dropdown-container-icon-help"
|
|
63
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
ref: ref,
|
|
65
|
+
className: "filter-dropdown-container-filter-wrap"
|
|
66
|
+
}, children));
|
|
67
|
+
}, []);
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "filter-dropdown-wrap"
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "filter-dropdown-wrap-content"
|
|
72
|
+
}, /*#__PURE__*/React.createElement(MultipleContainersSortList, {
|
|
73
|
+
list: list,
|
|
74
|
+
rowKey: "name",
|
|
75
|
+
renderContainer: renderContainer,
|
|
76
|
+
onChange: handleSortChange
|
|
77
|
+
}, function (_ref2) {
|
|
78
|
+
var item = _ref2.item,
|
|
79
|
+
index = _ref2.index,
|
|
80
|
+
style = _ref2.style,
|
|
81
|
+
props = _ref2.props,
|
|
82
|
+
attributes = _ref2.attributes,
|
|
83
|
+
setActivatorNodeRef = _ref2.setActivatorNodeRef,
|
|
84
|
+
listeners = _ref2.listeners;
|
|
85
|
+
return /*#__PURE__*/React.createElement(DragItem, _extends({}, props, {
|
|
86
|
+
index: index,
|
|
87
|
+
attributes: attributes,
|
|
88
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
89
|
+
listeners: listeners,
|
|
90
|
+
style: style
|
|
91
|
+
}), /*#__PURE__*/React.createElement(FilterItem, {
|
|
92
|
+
name: item.name,
|
|
93
|
+
label: item.label,
|
|
94
|
+
type: item.type,
|
|
95
|
+
other: item.other
|
|
96
|
+
}));
|
|
97
|
+
})));
|
|
98
|
+
};
|
|
99
|
+
export default Dropdown;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.filter-dropdown-wrap {
|
|
2
|
+
width: 400px;
|
|
3
|
+
padding: 4px;
|
|
4
|
+
max-height: 400px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
.filter-dropdown-wrap-content {
|
|
8
|
+
flex: 1;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
}
|
|
11
|
+
.filter-dropdown-wrap-footer {
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
.filter-dropdown-drag-item {
|
|
15
|
+
display: flex;
|
|
16
|
+
padding: 8px 12px 12px;
|
|
17
|
+
align-items: center;
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
background: var(--gray-50, #F9FAFB);
|
|
20
|
+
margin-bottom: 12px;
|
|
21
|
+
.dots-six-icon {
|
|
22
|
+
font-size: 24px;
|
|
23
|
+
color: #98A2B3;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
.ant-form-item {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
.filter-dropdown-drag-item-right {
|
|
30
|
+
margin-left: 16px;
|
|
31
|
+
flex: 1;
|
|
32
|
+
.filter-dropdown-drag-item-title {
|
|
33
|
+
color: var(--text-text-2, #777);
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
font-style: normal;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 20px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
.filter-dropdown-container-wrap {
|
|
43
|
+
border-bottom: 1px solid var(--surface-surface-4, #e2e2e2);
|
|
44
|
+
min-height: 70px;
|
|
45
|
+
margin-bottom: 20px;
|
|
46
|
+
&:last-child {
|
|
47
|
+
border: none;
|
|
48
|
+
}
|
|
49
|
+
.filter-dropdown-container-title-wrap {
|
|
50
|
+
color: var(--text-text-3, #919191);
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
line-height: 22px;
|
|
55
|
+
margin-bottom: 12px;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
.filter-dropdown-container-title {
|
|
59
|
+
margin-right: 6px;
|
|
60
|
+
color: var(--gray-900, #101828);
|
|
61
|
+
font-size: 16px;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: 24px;
|
|
65
|
+
}
|
|
66
|
+
.filter-dropdown-container-icon-help {
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
color: var(--gray-400,#98A2B3)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.filter-dropdown-container-filter-wrap {
|
|
72
|
+
min-height: 80px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FilterItemProps as ItemProps } from "../index";
|
|
3
2
|
import "./index.less";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export interface FilterItemProps {
|
|
4
|
+
type: "single" | "input" | "datePicker" | "rangePicker";
|
|
5
|
+
label: string;
|
|
6
|
+
props?: object;
|
|
7
|
+
name: string;
|
|
8
|
+
other: Record<string, any>;
|
|
9
|
+
}
|
|
9
10
|
declare const FilterItem: React.FC<FilterItemProps>;
|
|
10
11
|
export default FilterItem;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Form } from "antd";
|
|
3
|
+
import { fieldMaps } from "../../../Table/fields";
|
|
3
4
|
import "./index.less";
|
|
4
|
-
var FilterItem = function FilterItem(
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
var FilterItem = function FilterItem(props) {
|
|
6
|
+
var label = props.label,
|
|
7
|
+
type = props.type,
|
|
8
|
+
name = props.name;
|
|
9
|
+
var Com = useMemo(function () {
|
|
10
|
+
var _fieldMaps$type;
|
|
11
|
+
return (_fieldMaps$type = fieldMaps[type]) === null || _fieldMaps$type === void 0 ? void 0 : _fieldMaps$type.edit;
|
|
12
|
+
}, [type]);
|
|
13
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
14
|
+
label: label,
|
|
15
|
+
name: name
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Com, null));
|
|
14
17
|
};
|
|
15
18
|
export default FilterItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import { useSharedState } from "../../../../../hooks";
|
|
4
|
+
import { Context } from "../../../model";
|
|
5
|
+
import FilterItem from "../FilterItem";
|
|
6
|
+
var QuickFilter = function QuickFilter() {
|
|
7
|
+
var _useSharedState = useSharedState(Context),
|
|
8
|
+
state = _useSharedState.state,
|
|
9
|
+
dispatch = _useSharedState.dispatch;
|
|
10
|
+
var quickFilter = state.quickFilter;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
12
|
+
wrap: true
|
|
13
|
+
}, (quickFilter || []).map(function (item) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(FilterItem, {
|
|
15
|
+
key: item.name,
|
|
16
|
+
name: item.name
|
|
17
|
+
// label={item.label}
|
|
18
|
+
,
|
|
19
|
+
type: item.type,
|
|
20
|
+
other: item.other,
|
|
21
|
+
props: item.props
|
|
22
|
+
});
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
export default QuickFilter;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
props: object;
|
|
6
|
-
title: string;
|
|
7
|
-
};
|
|
8
|
-
declare type FilterListProps = {
|
|
9
|
-
list: FilterItemProps[];
|
|
2
|
+
import { DropdownProps } from "./Dropdown";
|
|
3
|
+
export declare type FilterListProps = {
|
|
4
|
+
list: DropdownProps["list"];
|
|
10
5
|
};
|
|
11
6
|
declare const Filter: React.FC<FilterListProps>;
|
|
12
7
|
export default Filter;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Button,
|
|
3
|
-
import
|
|
1
|
+
import React, { useMemo, useRef } from "react";
|
|
2
|
+
import { Button, Popover } from "antd";
|
|
3
|
+
import Dropdown from "./Dropdown";
|
|
4
|
+
import { FilterLines } from "@pisell/icon";
|
|
4
5
|
var Filter = function Filter(_ref) {
|
|
5
|
-
var list = _ref.list
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
var _ref$list = _ref.list,
|
|
7
|
+
list = _ref$list === void 0 ? [] : _ref$list;
|
|
8
|
+
var ref = useRef(null);
|
|
9
|
+
var content = useMemo(function () {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
11
|
+
list: list
|
|
12
|
+
});
|
|
13
|
+
}, [list]);
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
ref: ref
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
17
|
+
content: content,
|
|
18
|
+
arrow: false,
|
|
19
|
+
getPopupContainer: function getPopupContainer() {
|
|
20
|
+
return ref.current;
|
|
21
|
+
}
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
23
|
+
icon: /*#__PURE__*/React.createElement(FilterLines, null)
|
|
24
|
+
}, "Filter")));
|
|
14
25
|
};
|
|
15
26
|
export default Filter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type SortItemProps = {
|
|
3
|
+
type: "single" | "input";
|
|
4
|
+
name: string;
|
|
5
|
+
props: object;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
declare type SortListProps = {
|
|
9
|
+
list: SortItemProps[];
|
|
10
|
+
};
|
|
11
|
+
declare const Sort: React.FC<SortListProps>;
|
|
12
|
+
export default Sort;
|